Skip to content

Instantly share code, notes, and snippets.

View benley's full-sized avatar
🐈

Benjamin Staffin benley

🐈
View GitHub Profile
@Milly
Milly / openurl.vim
Created February 10, 2010 08:42
[VIM] Open url or file with default viewer.
" Vim plugin file - openurl
"
" Last Change: 13 Mar 2013
" Maintainer: Milly
" Purpose: Open url or file with default viewer.
" Options:
" g:openurl_regex - URL match regex (default: empty)
" g:openurl_dos_path - Enable DOS path (default: 0)
" g:openurl_encoding - Character encoding for URL (default: auto detect)
" g:openurl_highlight - Highlight URL (default: 1)
@kfdm
kfdm / build-irssi-python.sh
Created July 31, 2010 05:47
Compiling irssi-python
#!/bin/bash
# From http://sector-5.net/archives/irssi-python-for-irssi-0-8-15/
cd irssi-python &&
svn revert -R . &&
patch -p0 -i ../irssi-python-for-0.8.14.patch
sed -i 's/ docs//' Makefile.am &&
sed -i 's|docs/Makefile||' 'configure.in' &&
sed -i 's/pyconstants.c/pycore.c/' 'configure.in' &&
cp /usr/share/autoconf-archive/ac_python_devel.m4 . &&
libtoolize -f -c &&
@Milly
Milly / gem-fetch-dependencies
Created April 8, 2011 09:43
Extend 'gem fetch' command. Fetch all dependencies.
#!/usr/bin/ruby
require 'rubygems'
require 'rubygems/commands/fetch_command'
class Gem::Commands::FetchCommand
def add_version_option_with_fetch_depends
add_version_option_without_fetch_depends
add_option('-y', '--[no-]dependencies',
"Fetch dependent gems") do |value, options|
@russolsen
russolsen / lisp_parser.rb
Created January 26, 2012 20:31
An S expression (i.e. LISP) parser in 32 lines of Ruby.
class SExpressionParser
def initialize(expression)
@tokens = expression.scan /[()]|\w+|".*?"|'.*?'/
end
def peek
@tokens.first
end
def next_token
@gregorynicholas
gregorynicholas / .inputrc
Last active April 19, 2024 04:10
OSX .inputrc to make terminal way better. and by better i mean i'm naked
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
@sente
sente / git-r-done.js
Created February 14, 2012 23:00
the bookmarklet to render html!
// Stuart Powers
function write_window(content) {
top.consoleRef=window.open('',
'git-r-done',
+',menubar=1'
+',toolbar=1'
+',status=1'
+',scrollbars=1'
+',resizable=1');
@dplepage
dplepage / gist:2024129
Created March 12, 2012 19:26
Subclassing Flask
import flask
class HelloApp(flask.Flask):
def __init__(self, import_name):
super(HelloApp, self).__init__(import_name)
self.route("/hello")(self.hello)
def hello(self):
return "Hello, world!"
@dplepage
dplepage / gist:2024199
Created March 12, 2012 19:33
Routing decorator for flask subclassing
import flask
class RoutingData(object):
def __init__(self, args, kwargs):
super(RoutingData, self).__init__()
self.args = args
self.kwargs = kwargs
def route(*args, **kwargs):
def wrap(fn):
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#