Skip to content

Instantly share code, notes, and snippets.

View nicferrier's full-sized avatar

Nic Ferrier nicferrier

View GitHub Profile
@Wilfred
Wilfred / show-your-colors.el
Created May 4, 2013 23:35
show-your-colours.el --- an HTTP server showing the current buffer fontified
;;; show-your-colours --- an HTTP server showing the current buffer fontified
;; Author: Wilfred Hughes <me@wilfred.me.uk>
;; Version: 0.1
;; Package-Requires: ((s "1.3.0"))
;;; Commentary:
;; Allow others to see what you're editing in Emacs. For live
;; screencasts, or general Emacs advocacy. If you have multiple

Semantic Key-bindings

The following is an issue that comes up from time to time on #emacs, and we don’t really have a good answer to it. I don’t for a minute think that I have figured this whole thing out, but here goes.

The problem

Joe Hacker is an Emacs user, and is quite content, only some he doesn’t like a particular key-binding. To make things concrete, he

@dlo
dlo / allpinboard.py
Last active September 5, 2019 15:26 — forked from ttscoff/allpinboard.rb
Python version of https://gist.github.com/3773519 that pulls all bookmarks on the first sync, and does incremental updates afterwards. Also uses the Mac OS X keychain to retrieve your password so it doesn't need to live in a file on your computer in plain text.
#!/usr/bin/env python
"""
This script is designed to generate a simple html file with _all_ of your
Pinboard.in bookmarks The HTML file can be added to Launchbar's index as a
custom bookmark file and you can search your entire Pinboard.in collection
instantly from Launchbar (by title only). It includes any applied tags as part
of the title to aid in searching.
You should edit the `username`, `bookmark_filename`, and `local_timezone`
@cqfd
cqfd / for.el
Last active February 15, 2018 22:37
List comprehensions in Emacs Lisp :)
;; Clojure-style list comprehensions for Emacs Lisp
(setq lexical-binding t)
;; (for ((x '(1 2 3 4 5))
;; (:let ((y (* x x))))
;; (:while (< y 10)))
;; y)
;; => (1 4 9)
@nicferrier
nicferrier / gist:3510071
Created August 29, 2012 10:29
make a query string from a form with bonzo
function form_to_qs(form) {
var qs = "";
var fields_array = $(form[0].elements);
fields_array.each(
function (e,i){
var pair = e.name + "=" + encodeURIComponent(e.value);
qs = qs + pair + ((i < fields_array.length - 1)?"&":"");
}
);
@mogigoma
mogigoma / elnode-publish.el
Created August 11, 2012 06:25
A hack to publish any buffer exactly as it appears in Emacs on demand over HTTP.
(defvar mak/elnode-publish-port
4444
"The port for published buffers to be served on.")
(defvar mak/elnode-publish-buffers
(make-hash-table :test 'equal)
"List of the buffers to publish over HTTP.")
(defun mak/elnode-publish-handler (httpcon)
"Handler for buffers published by Elnode."
@nicferrier
nicferrier / gist:3273143
Created August 6, 2012 10:08
marmalade test
:;exec emacs -batch -Q -l "$0" -f marmalade-test "$@"
;; Test marmalade from the command line by attempting to install the
;; fakir package.
;; It's all done in a new temporary directory (based on the pid of the
;; emacs process) so it should be very isolated from any emacs you
;; have running.
(defun marmalade-test ()
(interactive)
@nibrahim
nibrahim / gist:2466292
Created April 22, 2012 19:21
Screencast make rules
ARCHIVE_DIR=/home/noufal/projects/emacsmovies.org/videos
all: generate archive
upload: generate
curl --location --header "authorization: LOW xxxx:yyyy" --upload-file ./${number}-episode-${name}.webm http://s3.us.archive.org/EmacsMovies/${number}-episode-${name}.webm
curl --location --header "authorization: LOW xxxx:yyyy" --upload-file ./${number}-episode-${name}.mkv http://s3.us.archive.org/EmacsMovies/${number}-episode-${name}.mkv
archive: ${number}-episode-${name}.webm
@wolph
wolph / to_json.sql
Created April 6, 2012 10:35
Some functions to convert arrays/hstore to json :)
CREATE OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$
SELECT replace($1, '''', '\'''); $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$
SELECT '''' || to_json($1) || ''': ''' || to_json($2) || ''''; $$ LANGUAGE SQL IMMUTABLE;