Skip to content

Instantly share code, notes, and snippets.

'analysis': {
'analyzer': {
'phone_number': {
'type': "edgeNGram",
'min_gram': 3,
'max_gram': 11,
'side': "back"}}}
@ieure
ieure / gist:1334458
Created November 2, 2011 18:35
scala-defuns.el
(defun scala-beginning-of-defun (&optional arg)
(re-search-backward "\\(\\(case\\s*\\)?class\\|def\\)" nil t arg))
(defun scala-end-of-defun (&optional arg)
(scala-beginning-of-defun)
(goto-char (- (search-forward "{") 1))
(forward-sexp))
(eval-after-load "scala-mode"
(add-hook 'scala-mode-hook
# -*- coding: utf-8 -*-
from operator import add, mul
def f(*args, **kwargs):
return lambda g: g(*args, **kwargs)
map(f(5, 5), (add, mul)) # -> [10, 25]
(add-hook 'find-file-hook
(lambda ()
(when (and (not buffer-read-only) (bobp) (eobp)
(let ((table (yas/get-snippet-tables major-mode)))
(when table
(gethash "new-file" (elt (car table) 2)))))
(yas/expand-one "new-file")
(set-buffer-modified-p nil))))
(defmacro absolute-dirname (path)
"Return the directory name portion of a path.
If PATH is local, return it unaltered.
If PATH is remote, return the remote diretory portion of the path."
`(cond ((tramp-tramp-file-p ,path)
(elt (tramp-dissect-file-name ,path) 3))
(t ,path)))
(defmacro dir-locals (dir vars)
(defmacro with-ido (&rest body)
"Evaluate BODY with ido-mode enabled."
(let ((save-symbol (gensym "with-ido-save")))
`(let ((,save-symbol (or ido-mode -1)))
(unwind-protect
(progn
(ido-mode 1)
,@body)
(ido-mode ,save-symbol)))))
(defvar upside-down-alist
'((?a . ?ɐ)
(?b . ?q)
(?c . ?ɔ)
(?d . ?p)
(?e . ?ǝ)
(?f . ?ɟ)
(?g . ?ƃ)
(?h . ?ɥ)
(?i . ?ı)
@ieure
ieure / cdup.sh
Created December 13, 2011 21:57
function up ()
{
if [ "$1" != "" -a "$2" != "" ]; then
local DIR=$1
local TARGET=$2
elif [ "$1" ]; then
local DIR=$PWD
local TARGET=$1
fi
while [ ! -e $DIR/$TARGET -a $DIR != "/" ]; do
@ieure
ieure / pdl-org.el
Created January 4, 2012 19:08 — forked from plathrop/pdl-org.el
(defun pdl-agenda ()
"Switch to my agenda, regenerating it in the process."
(interactive)
(save-selected-window
(pop-to-buffer
(prog1 org-agenda-buffer-name
(if (get-buffer org-agenda-buffer-name)
(org-agenda-redo)
(org-agenda nil "a")
(org-agenda-day-view))))))
/**
* __ __
* /.-' `-.\
* // \\
* /j_______________j\
* /o.-==-. .-. .-==-.o\
* || )) (( ||
* \\____// \\____//
* `-==-' `-==-'
*/