Skip to content

Instantly share code, notes, and snippets.

(defvar upside-down-alist
'((?a . ?ɐ)
(?b . ?q)
(?c . ?ɔ)
(?d . ?p)
(?e . ?ǝ)
(?f . ?ɟ)
(?g . ?ƃ)
(?h . ?ɥ)
(?i . ?ı)
(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)))))
(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)
(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))))
# -*- 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]
@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
'analysis': {
'analyzer': {
'phone_number': {
'type': "edgeNGram",
'min_gram': 3,
'max_gram': 11,
'side': "back"}}}
<html><head><title>Error 500</title></head><body bgcolor="#ffffff"><h1>Status Code: 500</h1>Exception: <br>Stacktrace: <pre>net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2424)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1747)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
Traceback (most recent call last):
File "/Users/ieure/Dropbox/Projects/simplegeo/places/places/importer.py", line 136, in import_geojson
while q.qsize() >= QUEUE_THRESH:
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/multiprocessing/queues.py", line 113, in qsize
return self._maxsize - self._sem._semlock._get_value()
NotImplementedError
{
"properties": {
"classifiers": [
{
"category": "Restaurant",
"type": "Food & Drink",
"subcategory": ""
}
]
}