twitter github linkedin email

Álvaro Ramírez

[2015-05-28 Thu] # Emacs org tables

Student Prob 1 Prob 2 Prob 3 Total Note
Maximum 10 15 25 50 10.0
Peter 10 8 23 41 8.2
Sam 2 4 3 9 1.8
Average       25.0  
  Mon Tue Web Thu Fri Sat Sun total
week 1 0 10 30 30 50 0 0 120
week 2 60 60 70 80 81 0 0 351
week 3 60 61 71 30 50 0 0 272
week 4 40 33 25 55 68 0 0 221
              total 964

[2015-05-28 Thu] # Mastering Emacs is out

Emacs is amazingly alive. New packages are regularly listed on melpa and a new book just came out: Mastering Emacs by Mickey Petersen.

cover.png

[2015-05-25 Mon] # South Carolina travel bookmarks

[2015-05-25 Mon] # Colorado travel bookmarks

[2015-05-25 Mon] # Bash bookmarks

[2015-05-25 Mon] # restclient.el

Installed Pashky's restclient.el Emacs package. Super helpful when trying out REST APIs.

restclient.png

[2015-05-25 Mon] # Seatle travel bookmarks

[2015-05-25 Mon] # Berlin travel bookmarks

[2015-05-25 Mon] # Skeuomorph

From Wikipedia, skeuomorph ˈskjuːəmɔrf is a derivative object that retains ornamental design cues from structures that were necessary in the original. Examples include pottery embellished with imitation rivets reminiscent of similar pots made of metal and a software calendar that imitates the appearance of binding on a paper desk calendar.

[2015-05-25 Mon] # define-word

Installed Abo Abo's define-word Emacs package. A handy package to define words at point.

define-word.png

[2015-05-22 Fri] # Flushing empty lines in Emacs

Via masteringemacs.org, removing blank lines in a buffer:

M-x flush-lines RET ^$ RET

[2015-05-22 Fri] # Regex bookmarks

[2015-05-06 Wed] # Write to temp iOS snippet

NSString *tempDir = NSTemporaryDirectory();
NSLog(@"%@", tempDir);
NSString *dataFilePath = [tempDir stringByAppendingPathComponent:@"my.file"];
[data writeToFile:dataFilePath atomically:YES];

[2015-05-04 Mon] # Greece travel bookmarks

[2015-05-04 Mon] # Sri Lanka travel bookmarks

[2015-05-04 Mon] # Switzerland travel bookmarks

[2015-05-04 Mon] # Thailand travel bookmarks

[2015-05-04 Mon] # Madagascar travel bookmarks

[2015-05-04 Mon] # Hong Kong travel bookmarks

[2015-05-04 Mon] # Barcelona travel bookmarks

[2015-05-04 Mon] # Iceland travel bookmarks

[2015-04-30 Thu] # Building clang-format

Based on instructions from Building clang-format and friends on OSX Mountain Lion.

#!/bin/bash
set -o nounset
set -o errexit

# Based on instructions from:
# http://blog.hardcodes.de/articles/63/building-clang-format-and-friends-on-osx-mountain-lion

readonly LLVM_DIR_PATH='/tmp/llvm'

update_repo() {
  if [[ ! -d $1 ]]; then
    git clone $2
  else
    cd $1
    git pull
    cd ..
  fi
  cd ..
}

update_all_repos() {
  update_repo "llvm" "http://llvm.org/git/llvm.git"
  pushd "${LLVM_DIR_PATH}/llvm/tools"
  update_repo "clang" "http://llvm.org/git/clang.git"
  popd
  cd "../../${LLVM_DIR_PATH}/llvm/tools/clang/tools"
  update_repo "clang-tools-extra" "http://llvm.org/git/clang-tools-extra.git"
  cd "../../.."
}

build_clang() {
  mkdir -p clang
  mkdir -p build
  cd clang
  ../llvm/configure --enable-libcpp --enable-cxx11 --enable-debug-symbols=no --enable-optimized --prefix="${LLVM_DIR_PATH}/build"
  make install
}

mkdir -p $LLVM_DIR_PATH
cd ${LLVM_DIR_PATH}
update_all_repos
build_clang

[2015-04-30 Thu] # Programmatic iOS Auto Layout

Basic iOS auto layout usage. See Adopting Auto Layout and Visual Format language for reference.

- (instancetype)initWithFrame:(CGRect)frame {
  self = [super initWithFrame:frame];
  if (self) {
    // Disable autoresizing mask translation for parent.
    self.translatesAutoresizingMaskIntoConstraints = NO;

    _subview1 = [[UIView alloc] init];
    // Disable autoresizing mask translation for subview.
    _subview1.translatesAutoresizingMaskIntoConstraints = NO;

    _subview1.backgroundColor = [UIColor redColor];
    [self addSubview:_subview1];

    // Creates a dictionary of bindings to be used in visual format.
    NSDictionary *viewBindings = NSDictionaryOfVariableBindings(_subview1);

    // H: horizontal layout
    // |-50- spacing in relation to superview
    // [_subview1(==50)] subview1's width
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-50-[_subview1(==50)]"
                                                                 options:0
                                                                 metrics:nil
                                                                   views:viewBindings]];
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_subview1(==50)]"
                                                                 options:0
                                                                 metrics:nil
                                                                   views:viewBindings]];
  }
  return self;
}

[2015-04-23 Thu] # Japan travel bookmarks

[2015-04-19 Sun] # UK travel bookmarks

[2015-04-19 Sun] # Development quotes

[2015-04-19 Sun] # Spain travel bookmarks

[2015-04-19 Sun] # Meet up bookmarks

[2015-04-17 Fri] # Plantuml example

Played with Plantuml. Convenient for generating UML diagrams from text. Here's the Language Reference Guide. Here's an example:

@startuml
  abstract class Singer {
    abstract void sing()
    void Dance()
  }

  Singer <|-- PopSinger
  Singer <|-- SalsaSinger

  class PopSinger {
    void sing()
  }

  class SalsaSinger {
    void sing()
  }

@enduml

plantuml-singer.png

Install plantuml on Mac OS X:

brew install plantum

Generating diagram:

$GRAPHVIZ_DOT=~/homebrew/bin/dot java -jar path/to/plantuml.8018.jar diagram.plantuml

[2015-04-14 Tue] # Helm-describe-helm-attribute

Writing A Spotify Client in 16 Minutes is fantastic for picking up helm and Emacs lisp tips. Of interest helm-describe-helm-attribute, second to the awesomeness of helm-spotify integration.

[2015-04-12 Sun] # Youtube videos in your org html export

Sacha Chua and John Wiegley posted a wonderful video on Emacs lisp development tips. Embedding the following raw HTML using #+BEGIN_HTML/#+END_HTML:

<iframe width="420"
        height="315"
        src="https://www.youtube.com/embed/QRBcm6jFJ3Q"
        frameborder="0"
        allowfullscreen>
</iframe>

results in an embedded video when exporting your org file:

[2015-04-12 Sun] # .net bookmarks

[2015-04-10 Fri] # UK property bookmarks

[2015-04-09 Thu] # Git commit message style

Adopted Tim Pope's Git commit message style. Also enabled Emacs's git-commit-training-wheels-mode:

(use-package git-commit-training-wheels-mode :ensure t
  :commands (git-commit-training-wheels-mode))

(use-package git-commit-mode :ensure t
  :config
  (add-hook 'git-commit-mode-hook 'git-commit-training-wheels-mode)
  :commands (git-commit-mode))

[2015-04-06 Mon] # fci-mode and org-html-export-to-html bug

Having enabled fci-mode in most programing modes, org-html-export-to-html now exports an additional unicode character in source blocks. This thread has a workaround:

(defun org-html-fontify-code (code lang)
  ;; ...
  (funcall lang-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (when (require 'fill-column-indicator nil 'noerror)
    (fci-mode -1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (insert code)
  ;; ...

[2015-04-03 Fri] # Try cocoapods out

Cocapods try:

$ pod try POD_NAME

[2015-04-03 Fri] # Cornwall travel bookmarks

[2015-04-03 Fri] # Austria travel bookmarks


[2015-05-25 Mon] updated

[2015-04-02 Thu] # Cinnamon desktop run dialog

Note to self. Open with Alt-f2.

[2015-03-29 Sun] # Books for 2015

[2015-03-29 Sun] # Ayahuasca bookmarks

[2015-03-28 Sat] # Emacs init.el bookmarks

[2015-03-28 Sat] # CSS vertical align using flex

Codepen snippet:

div{
  height: 200px;
  background: #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
}

p{
  margin: auto
}

[2015-03-26 Thu] # London diving schools

[2015-03-26 Thu] # Helm buffer URLs

Venturing into Emacs lisp and Helm. Here's a go at listing all URLs in current buffer.

(require 'goto-addr)

(defun ar/helm-buffer-url-candidates ()
  "Generate helm candidates for all URLs in buffer."
  (save-excursion
    (goto-char (point-min))
    (let ((helm-candidates '())
          (url))
      (while (re-search-forward goto-address-url-regexp
                                nil t)
        (setq url
              (buffer-substring-no-properties (match-beginning 0)
                                              (match-end 0)))
        (add-to-list 'helm-candidates
                     (cons url
                           url)))
      helm-candidates)))

(defun ar/helm-buffer-urls ()
  "Narrow down and open a URL in buffer."
  (interactive)
  (helm :sources `(((name . "Buffer URLs")
                    (candidates . ,(ar/helm-buffer-url-candidates))
                    (action . (lambda (url)
                                (browse-url url)))))))

[2015-03-23 Mon] # Doh! undo last git commit

$ git reset --soft HEAD~1

[2015-03-22 Sun] # Resetting variables using defvar

Want to re-evaluate defvars and modify variables? eval-defun (bound to C-M-x) can help. From the manual:

If the current defun is actually a call to `defvar', then reset the variable using its initial value expression even if the variable already has some other value. (Normally `defvar' does not change the variable's value if it already has a value.) Treat `defcustom' similarly.

[2015-03-22 Sun] # Broken Xcode plugins?

Some Xcode plugins stopped loading after updating Xcode. Ensure the latest DVTPlugInCompatibilityUUIDs is added to the plugin's Info.plist. Get from:

$ defaults read \
    /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

[2015-03-22 Sun] # Born to Run references


[2015-03-23 Mon] updated

References from reading Christopher McDougall's Born to Run:

Recipe by Megan Mignot, based on book references:

Mama Tita’s Pancakes

  • 1 ½ cups cooked brown rice
  • 1 cup coconut milk
  • 2 ripe bananas
  • 1 tablespoon honey
  • ½ cup white cornmeal
  • 2 teaspoons baking powder

[2015-03-19 Thu] # Org tips from 2015-03-18 Emacs hangout


[2015-03-22 Sun] updated

Lots of great tips in Emacs Hangout 2015-03-18. Favorites:

  • Private org drawer to prevent export:
:PRIVATE:
My super duper secret text I don't want to export.
:END:
  • C-c C-p/C-c C-n Jump over sections.
  • (setq org-hide-leading-stars t).
  • (org-bullets-mode).
  • (org-refile).
  • C-u (org-refile) jumps, no refile.
  • (helm-org-in-buffer-headings).

[2015-03-19 Thu] # Food bookmarks

[2015-03-19 Thu] # Ethiopia travel bookmarks

[2015-03-19 Thu] # China travel bookmarks


[2015-05-25 Mon] updated

[2015-03-18 Wed] # South Korea travel bookmarks

[2015-03-18 Wed] # Sharing on iOS

NSString *title = @"Sharing on iOS bookmarks.";
NSURL *url = [NSURL URLWithString:@"http://xenodium.com/#sharing-on-ios"];
UIImage *image = [UIImage imageNamed:@"beautiful-image"];

UIActivityViewController *controller =
  [[UIActivityViewController alloc]
    initWithActivityItems:@[title, url, image]
    applicationActivities:nil];

// self being a UIViewController.
[self presentViewController:controller animated:YES completion:nil];
  • Sharing through Mail app on simulator isn't supported.

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=… {Message=Service Connection Interrupted}

[2015-03-18 Wed] # San Francisco travel bookmarks

[2015-03-18 Wed] # Istanbul travel bookmarks

[2015-03-17 Tue] # Italy travel bookmarks


[2015-05-25 Mon] updated

[2015-03-17 Tue] # Emacs lisp debug on entry

Wanted to track down which package was enabling ido-mode on my behalf. debug-on-entry to the rescue. Pass the method name in question and you're good to go.

(debug-on-entry 'ido-mode)

When done, use cancel.

(cancel-debug-on-entry 'ido-mode)

[2015-03-17 Tue] # Burma travel bookmarks

[2015-03-16 Mon] # OS X Screencasts to animated GIF

[2015-03-15 Sun] # Writing Xcode plugins

defaults read \
    /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

[2015-03-15 Sun] # Uninstalling Alcatraz from Xcode

$ rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin
$ rm -rf ~/Library/Application\ Support/Alcatraz

ps. Removing all plugins:

$ rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*

[2015-03-14 Sat] # Prefill Emacs swiper with current region

The new swiper Emacs package is proving to be a great alternative to helm-swoop. Here's how to prefill with current region:

(defun ar/prefilled-swiper ()
  "Pre-fill swiper input with region."
  (interactive)
  (if (region-active-p)
      (let ((region-text (buffer-substring (region-beginning)
                                           (region-end))))
        (swiper region-text))
    (swiper)))

(global-set-key (kbd "C-s")
                #'ar/prefilled-swiper)

[2015-03-14 Sat] # Change Mac OS app icon

  • Open the new icon (.icns) in Preview.
  • Select all (⌘-a).
  • Copy (⌘-c).
  • Ctrl-click on app icon.
  • Select Get Info.
  • Click on app icon (top-left).
  • Paste (⌘-v).
  • Done!

overriding.png

after.png

[2015-03-11 Wed] # Hack on Emacs London meetup bookmarks

[2015-03-09 Mon] # Working with OS X and Emacs tips

From M-x all-things-emacs, Ryan McGeary's OS X/Emacs workflow.

Dotfiles

[2015-03-09 Mon] # Building ycmd

Build

$ git clone https://github.com/Valloric/ycmd.git
$ cd ycmd
$ git submodule update --init --recursive
$ ./build.sh --clang-completer

Test

$ python ycmd
  serving on http://127.0.0.1:54265

[2015-03-08 Sun] # Regular bookmarks

[2015-03-08 Sun] # Photography bookmarks

[2015-03-08 Sun] # Paris travel bookmarks

  • Au Passage. Small plates in fun atmosphere.
  • Berthillon Ice Cream.
  • Buvette Gastrotheque. Wine bar with small dishes.
  • Cheri Bibi, possibly hipster, underneath Sacre Coeur, good cocktails.
  • Creperie Josseline. Worth the queue. Drink Breton cider with crepes.
  • Holybelly Canal Saint Martin.
  • L'Aller Retour. The place for steak-frites.
  • L'Office. Wine bar/bistrot.
  • Le Barav'.
  • Marché d'Aligre. Authentic neighbourhood market.
  • Marché des Enfants Rouge. Small covered market. Eat at food stalls.
  • Mosquee de Paris. City mosque. Drink mint tea at courtyard under olive trees or eat in restaurant inside. North African food.
  • Musee d'Orsay.
  • Paris: A Guide To Some Of The Best Cafes In Canal St. Martin.
  • Pierre Herme. For great pastries and macarons.
  • RATP for transport info including the "carnet" of 10 tickets.
  • Rodin Museum.

[2015-03-08 Sun] # Org mode bookmarks

[2015-03-08 Sun] # London food backlog

Hammersmith

Islington

Peckham

Soho

  • BAO (Bao buns! enough said).

Sloane Square

Hammersmith

[2015-03-07 Sat] # UX bookmarks

[2015-03-07 Sat] # Unix/Linux tips backlog

rsync --rsync-path=/usr/local/bin/rsync --partial \
    --progress --rsh=ssh john@host:/path/to/file path/to/partial/file

[2015-03-07 Sat] # Recipes

Tom Kha Gai soup

  • Chicken or Prawns
  • 2 kaffir lime leaves
  • 1 lemongrass stalk
  • 1 1/2 cocunut milk
  • 3/4 sliced fresh galaghal
  • 1 1/2 chicken stock or water
  • 1/2 cup mushrooms
  • 3 1/2 tbsp sugar
  • 1/2 cup of cilantro
  • 1-4 thai chillies
  • 1-2 tbsp chili oil
  • 1 green onion

Veg-Fruit juice

  • Lime
  • Ginger
  • Apple
  • Chilly
  • Celery
  • Fig
  • Blueberries

Berry Hempster

  • Hemp milk
  • Hemp protein
  • Strawberry
  • Blueberry
  • Date

How to cook Beef Chow Fun.

[2015-03-07 Sat] # Music backlog

[2015-03-06 Fri] # UX scrapbook bookmarks

[2015-03-06 Fri] # Travel bookmarks

[2015-03-06 Fri] # Startup bookmarks


[2015-04-27 Mon] updated

[2015-03-06 Fri] # Romania travel bookmarks

[2015-03-06 Fri] # Productivity bookmarks

[2015-03-06 Fri] # Privacy bookmarks

[2015-03-06 Fri] # Mindfulness bookmarks

[2015-03-06 Fri] # Lifestyle bookmarks


[2015-05-25 Mon] updated

[2015-03-06 Fri] # iOS imaging bookmarks

[2015-03-06 Fri] # Graphics bookmarks

[2015-03-06 Fri] # Go bookmarks

[2015-03-06 Fri] # GitHub

[2015-03-06 Fri] # Courses bookmarks

[2015-03-05 Thu] # Reload inputrc

Reload .iputrc from bash prompt: C-x C-r. More at bashref manual.

[2015-03-05 Thu] # Learning Emacs lisp


[2015-04-13 Mon] updated
  • Use nreverse and nconc to operate on lists in-place.
  • Set buffer local variables:
(setq-local my-clever-var)
  • Execute before saving buffer:
(add-hook 'write-file-hooks
          (lambda ()
            (message "about to save!")))
  • Possibly use to start processes and send file content:
(make-comint NAME PROGRAM &optional STARTFILE &rest SWITCHES)
  • Creating markers:
(setq my-marker (copy-marker (point)))
  #<marker at 10251 in *ielm*>

(marker-buffer my-marker)
  #<buffer *ielm*>

(marker-position my-marker)
  10251 (#o24013, #x280b, ?⠋)
  • Get org heading at point:
(org-get-heading 'no-tags 'no-todo)
  • Remove string text properties. From manual:

(substring-no-properties STRING &optional FROM TO)

Return a substring of STRING, without text properties. It starts at index FROM and ends before TO. TO may be nil or omitted; then the substring runs to the end of STRING. If FROM is nil or omitted, the substring starts at the beginning of STRING. If FROM or TO is negative, it counts from the end.

  • Skip org entry metadata/drawers:
(org-end-of-meta-data-and-drawers)
  • Random access to org entry using id (or CUSTOM_ID):
(org-open-link-from-string "[[#%exciting-custom-id]]")
  • Go to where the function is defined.
  • Press C-u C-M-x. Edebug breakpoint for function.
  • Invoke function in question.
  • n/c will get you around.
  • q when done.
  • Pretty printing objects:
(let ((my-var (list "val1"
                    "val2"
                    "val3")))
  (pp-to-string my-var))
  • Search and/or replace in curent buffer:
(re-search-forward "needle"
                   nil t)
(match-beginning 0) ;; Start location of match from last search.
(match-end 0) ;; End location of match from last search.
(replace-match "love")

;; needle-in-haystack
  • Restrict buffer editing to a region:
(narrow-to-region (point)
                  (point-max))
  • Restore restriction:
(save-restriction (narrow-to-region (point)
                                    (point-max))
  • Restore point, mark, and current buffer:
(save-excursion (goto-char (point-max))
                (insert "Hello elisp."))
  • Concatenating strings:
(concat "Hello " "elisp " "world.")
  • Grabbing thing at point:
(thing-at-point 'word)
(thing-at-point 'symbol)
(thing-at-point 'line)
  • Unit test with ert.
  • Basic iteration with dolist:
(dolist (v '("a" "b" "c"))
  (print v))
  • Output to other buffer:
(with-current-buffer (get-buffer-create "*some buffer*")
  (princ '(some list to print)
         (current-buffer)))
  • For a temporary buffer, use with-temp-buffer:
(with-temp-buffer
  (insert "abc")
  (point))
  • Cons cells bookmark.
  • Check for substring:
(string-match-p REGEXP STRING &optional START)
  • Matching substrings and accessing groups:
(setq haystack "Always click [[http://reddit.com/r/emacs][here]].")
(setq needle-re "\\[\\[\\(.*\\)]\\[\\(.*\\)]]")
  "\\[\\[\\(.*\\)]\\[\\(.*\\)]]"

(string-match needle-re haystack)
  13 (#o15, #xd, ?\C-m)

(match-string 0 haystack)
  "[[http://reddit.com/r/emacs][here]]"

(match-string 1 haystack)
  "http://reddit.com/r/emacs"

(match-string 2 haystack)
  "here"
  • Return argument unchanged (noop):
(identity ARG)
  • Org insert today's timestamp
(org-insert-time-stamp (current-time))
(car LIST)
  • All but first element
(cdr LIST)
  • Add NEWELT to front of PLACE
(push NEWELT PLACE)
  • Invoke 'FUNCTION for each in SEQUENCE
(mapcar FUNCTION SEQUENCE)
  • Search/replace
(while (search-forward "Hello")
  (replace-match "Bonjour"))
  • Save to kill ring = copy.
  • Point = cursor position.
  • Mark = a buffer position.
  • Kill = cut text.
  • Yank = paste.
  • Buffer:File = 1:1.
  • Window:Buffer = 1:1.
  • Frame:Window = 1:many.
  • Font lock = syntax highlighting.

[2015-03-05 Thu] # iOS bookmarks

[2015-03-05 Thu] # india travel bookmarks


updated
[2015-03-25 wed] updated

[2015-03-05 thu] # git bookmarks

[2015-03-04 wed] # language learning bookmarks


updated

[2015-02-18 wed] # git conflict resolution déjà vu?


updated

use git rerere. here's a post.

[2015-01-17 sat] # graphics design tools

[2015-04-23 thu] # emacs key bindings and maps


updated

based on masteringemacs.org.

bonus tip

prefix key, followed by c-h, lists keys in prefix.

keymap

maps key to action.

keymap found in buffer and most major modes.

keys

  • undefined: self explanatory.
  • prefix key: ie. c-x (part of complete key).
  • complete key: complete input executes associated command.

mapping

  • (define-key keymap key def): add to current buffer map.
  • (local-set-key key command): add to active buffer (no map option).
  • (local-unset-key key)
  • (global-set-key key command): add to global keymap (all buffers).
  • (global-unset-key key)

key codes

  • kbd: macro transaltes human-readable key to emacs readable.
  • function and navigation keys must be surrounded by <>.
  • example: (kbd "c-c p") or (kbd "<f8>") of (kbd "<down>").

remapping

  • use remap to replace mapping (ie. kill-line with my/kill-line).
  • (define-key keymap [remap original-function] 'my-own-function).

reserved keys

  • "c-c ?" generally reserved for you, but third party packages use it.
  • function keys (ie. f1-f12).
  • hyper and super (ancient).

lookup order

  • in a nutshell: minor mode keys, local keys, global keys.
  • full order:
    1. overriding-terminal-local-map: terminal-specific key binds.
    2. overriding-local-map: override all other local keymaps (avoid if possible).
    3. char property at point: useful for yasnippet.
    4. emulation-mode-map-alists: advanced multi-mode keymap.
    5. minor-mode-overriding-map-alist: minor modes in major modes.
    6. minor-mode-map-alist: as previous (preferred for minor modes) <–—
    7. current-local-map: buffers current local map.
    8. current-global-map: last place to look (ie. global).

mode hooks

  • (local-set-key (kbd "c-c q") 'my-awesome-method)) in hook-method.
  • for key-chord-define, use current-local-map.

[2014-12-30 tue] # video backlog


updated

todo griefwalker.

[2014-12-30 tue] # travel gear

[2014-12-30 tue] # movie backlog


updated
  • akira kurosawa director.
  • awake, the life of yogananda.
  • babadook.
  • birdmane.
  • boyhood.
  • enter the void, by gaspar noe
  • four horsemen.
  • hirokazu koreeda director.
  • naomi kawaze director.
  • nostalghia
  • sion sono director.
  • solyaris
  • stalker
  • takashi kitano director.
  • takashi miike director.
  • the connection.
  • the mirror
  • uncle boonmee who can recall his past lives, by apichatpong weerasethakul.
  • waking life, by rickard linklater.

[2014-12-30 tue] # books backlog

[2014-12-29 mon] # spotted


updated

[2014-12-03 wed] # emacs tips backlog


updated

avoid writing pitfalls using artbollocks-mode and writegood

more at sacha's post.

create presentations in org and export via org-ioslide.

yasnippet mirrors with transformations

for example:

- (${1:id})${2:foo}
{
    return $2;
}

- (void)set${2:$(capitalize yas-text)}:($1)avalue
{
    [$2 autorelease];
    $2 = [avalue retain];
}
$0

more at snippet development.

installing emacs 24.4 on mac os

see yamamoto's mac port.

$ brew tap railwaycat/emacsmacport
$ brew install emacs-mac

graphical system monitor

see symon.

elmacro

elmacro shows keyboard macros or latest interactive commands as emacs lisp.

weather package

monitor clipboard and automatically paste to buffer

see clipmon.

try out stock-ticker

try out ibuffer-vc

sort python imports

see pyimpsort.

private configuration

see private package.

unify mechanism to open files

export ascii art

with artist mode + ditaa for uml. demo video.

speed up window handling

see ace-window.

mac os clipboard support (from terminal)

see pbcopy.

speedtype

see speedtype.

building emacs 24.4 on linux

sudo apt-get install texinfo build-essential xorg-dev libgtk-3-dev libjpeg-dev libncurses5-dev libgif-dev libtiff-dev libm17n-dev libpng12-dev librsvg2-dev libotf-dev ./configure –with-gtk –prefix=/your/fav/prefix

jumping around tips

see zerokspot.

use-package post

at lunaryorn.

static blog

see org-page.

youtube-dl for emacs

see or emacs.

clang indexing tool

see clang-tags.

project management for c/c++

see malinka.

git modes

see git-modes.

lots of org links

found at dain.io.

create custom theme

see trường's post.

gtd emacs workflow

see charles cave's notes.

simplify file transformations

see make-it-so.

lisp editing

see lispy.

continue comment blocks

m-j (indent-new-comment-line).

o(1) link jump

see ace-link.

choosing magit repo

c-u c-x g (magit-status).

project templates

see skeletor.

melpa recipe format

see format.

naturaldocs for javascript in emacs

see vineet's post. ===== At lunaryorn.

Static blog

See org-page.

youtube-dl for Emacs

See Or emacs.

Clang indexing tool

See clang-tags.

Project management for C/C++

See Malinka.

Git modes

See git-modes.

Lots of org links

Found at dain.io.

Create custom theme

See Trường's post.

GTD Emacs workflow

See Charles Cave's notes.

Simplify file transformations

See make-it-so.

LISP editing

See lispy.

Continue comment blocks

M-j (indent-new-comment-line).

O(1) link jump

See ace-link.

Choosing magit repo

C-u C-x g (magit-status).

Project templates

See Skeletor.

Melpa recipe format

See format.

NaturalDocs for JavaScript in Emacs

checkdoc

checks buffer for doc strings file errors.

toggling key bingings

squashing commits with magit

see post.

editing colors

see kurecolor.

hide lines longer than

export org to reveal.js

see org-reveal.

beautify org

org-beautify-theme: a sub-theme to make org-mode more beautiful.

minimalist appearance

see minimal.

want buffer local cursor color?

see ccc.

narrowing regions

  • c-x n n (narrow-to-region).
  • c-x n w (widen).

linux system-wide emacs keybindings

org protocol

Editing XML?

Try out nxml-mode.

Move by parens

For example, C-M-u moves backward out of one level of parentheses. More at the manual.

Debug expanded elisp macros

See Wisdom and Wonder's post.

Working with Java

Describe bindings

  • C-h b lists all bindings.
  • Narrow down with occurr or Helm!

Shell commands

  • C-u M-! (inline shell-command).
  • C-u M-| (shell-command-on-region).

Search manuals

  • info-apropos (lookup subject in all manuals).
  • emacs-index-search (lookup subject in Emacs manual).

Recursive query/replace

  • M-x find-dired RET.
  • Navigate to location, RET.
  • Add find argument (omit for all files), RET.
  • t (select all).
  • Q (query-replace).
  • Enter search/replace terms.
  • y/n for each match.
  • C-x s ! (save all).

Disable furniture

(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)

Repeat last command

C-x z (and just z threreafter).

Replace char with a newline

  • M-x replace-string RET ; RET C-q C-j.
  • C-q (quoted-insert).
  • C-j (newline).

[2014-11-02 Sun] # Xcode6 tips

Shortcuts

  • ⌘⇧o Fuzzy file search.
  • ⌘⌥j Fuzzy file search (showing in Xcode project hierarchy).
  • ⌘⇧j Show file in Xcode project hierarchy.
  • ⌘⌥0 Show/hide utility area (right panel).
  • ⌘0 Show/hide navigation area (left panel).
  • ⇧⌘Y Show/hide debug area (bottom panel).
  • Ctrli Indent selection.
  • ⌘\ Toggle breakpoint on line.
  • ⌘/ Toggle comment.
  • ⌘[1-8] Select tabs on left panel.
  • Ctrl[1-x] Select top file navigation menu items.

Xcode features

  • Snippets.
  • Templates.
  • View debugging.
  • Simctl (send files to simulator).

Plugins of interest

  • Fuzzy autocomplete.
  • Uncrustify for indentation.
  • xcs code switch expansion.
  • Org and order (for properties).

[2014-09-20 Sat] # Emacs lisp bookmarks

[2014-09-19 Fri] # Emacs bookmarks


[2015-05-27 Wed] updated

[2014-09-11 Thu] # Resetting gnome-terminal preferences

Resetting preferences

gconftool --recursive-unset /apps/gnome-terminal

Want 256 colors?

Edit .bash_profile

export TERM="screen-256color"

Ensure .bash_profile is loaded

From gnome-terminal window:

gnome-terminal
  Edit
    Profiles...
      Edit
        Title and Command
          X Run command as login shell

Solarized

Bonus: See post to get solarized on gnome-terminal.

[2014-07-14 Mon] # Java bookmarks

[2014-07-14 Mon] # HTML5 bookmarks

[2014-07-13 Sun] # Python bookmarks


[2015-05-04 Mon] updated

[2014-07-13 Sun] # Development bookmarks

[2013-11-04 Mon] # Some python idioms

  • Prefer double quotes if escaping single quotes.
  • Prefer string interpolation over join. Eg. "'%s'" % member_default.
  • Prefer double underscore for privates.
  • Prefer with statement to implicitly close file.
with open(path, 'r') as text_file:
    text = text_file.read()
  • Prefer list comprehensions to filter.
  • Prefer using separate modules over classes if only using for separation.
  • Keep in mind: "eafp vs lbyl" (ie. just let it throw).
  • Prefer exceptions over assertions.
  • Throw ValueError for wrong input.
  • Return explicit False if remaining case is always false.