Skip to content

Instantly share code, notes, and snippets.

inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@bobthecow
bobthecow / .gitconfig
Created June 10, 2010 15:30
Git aliases
[alias]
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
lc = log ORIG_HEAD.. --stat --no-merges
smash = merge --no-commit --log
eat = branch -M
prune-all = !git remote | xargs -n 1 git remote prune
whois = "!sh -c 'git log -i --pretty=\"format:%an <%ae>\" --author=\"$1\" | sort -u' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
class Fab(object):
def __enter__(self):
self._stack = []
return self
def __exit__(self, *args, **kwargs):
print self._stack
def __call__(self, *args):
self._stack += args

finger_server.js

An extremely minimal implementation of the Finger protocol using node.js.

To run (Finger uses port 79 which requires sudo):

sudo node finger_server.js
import logging
import os
import signal
import sys
def when_ready(server):
def monitor():
modify_times = {}
while True:
for module in sys.modules.values():
// new node.js tls api
var tls = require('tls');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
var server = tls.createServer(options, function (s) {
@ry
ry / https-hello-world.js
Created January 4, 2011 00:03
new node https api
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
@nelstrom
nelstrom / only.vim
Created February 11, 2011 07:52
A command to close all Vim buffers that are not currently visible.
command! -nargs=* Only call CloseHiddenBuffers()
function! CloseHiddenBuffers()
" figure out which buffers are visible in any tab
let visible = {}
for t in range(1, tabpagenr('$'))
for b in tabpagebuflist(t)
let visible[b] = 1
endfor
endfor
" close any buffer that are loaded and not visible
@unixmonkey
unixmonkey / Cucumber Plain Text Feature.tmLanguage
Created March 10, 2011 20:15
Cucumber Language definition file for TextMate; modified to work with Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>feature</string>
</array>
<key>firstLineMatch</key>
<string>기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd(.*)</string>