Skip to content

Instantly share code, notes, and snippets.

(defun get-repo-url (arg)
(let* ((remote (if arg "upstream" (nth 2 (s-split "/" (magit-get-tracked-ref)))))
(remote-url (magit-get "remote" remote "url"))
(fragments (s-split "[:/@]/?/?" (s-chop-suffix ".git" remote-url))))
(concat "http://" (s-join "/" (cdr fragments)))))
(defun open-in-repo (arg)
(interactive "P")
(let* ((url (get-repo-url arg))
(branch (if arg "master" (magit-get-current-branch)))
@founddrama
founddrama / gist:1013614
Created June 8, 2011 01:42
a jshint pre-commit hook for git
#!/bin/sh
# A pre-commit hook for git to lint JavaScript files with jshint
# @see https://github.com/jshint/jshint/
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@iwinux
iwinux / .tmux.conf
Created April 15, 2012 04:41
tmux.conf
# reference https://bitbucket.org/xuxiaodong/dotman/src/cb7f1e6fb338/.tmux.conf
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1
set -s escape-time 0
# key bindings
@NdYAG
NdYAG / markdown.xml
Created August 18, 2012 09:44 — forked from lg0/markdown.xml
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>
@Fishrock123
Fishrock123 / genrun.js
Last active December 18, 2015 05:38 — forked from jlongster/testgen.js
basic generator async lib fleshed out to be slightly nicer
// based off of https://gist.github.com/creationix/5544019
// these could probably be condensed more, but I'm just doing this
// quickly
exports = module.exports = run;
exports.call = call;
exports.invoke = invoke;
exports.bind = bind;
@kejun
kejun / dabblet.css
Created September 5, 2013 03:06 — forked from anonymous/dabblet.css
thumb截中间区域
/* thumb截中间区域 */
fieldset {
display: inline-block;
border: 1px solid #ddd;
}
.thumb {
position: relative;
@jpetazzo
jpetazzo / authproxy.py
Created October 13, 2011 05:29
WSGI Proxy App to add HTTP Basic Auth to outbound requests
HTTPUSER = 'mylogin'
HTTPPASS = 'mypassword'
from wsgiproxy.app import WSGIProxyApp
from base64 import encodestring
proxyapp = WSGIProxyApp('http://remote.server.domain.com/')
# Craft Basic Auth header. Don't forget to strip the trailing \n.
HTTPAUTH = 'Basic ' + encodestring(HTTPUSER+':'+HTTPPASS).strip()
@anjackson
anjackson / gist:2888380
Created June 7, 2012 11:47
Making a Bottle app that routes to a proxy
import bottle
from wsgiproxy.app import WSGIProxyApp
# Remove "hop-by-hop" headers (as defined by RFC2613, Section 13)
# since they are not allowed by the WSGI standard.
FILTER_HEADERS = [
'Connection',
'Keep-Alive',
'Proxy-Authenticate',
'Proxy-Authorization',
@tarekziade
tarekziade / piproxy.py
Created May 2, 2012 09:12
Proxy to simulate --allow-hosts with PIP- adapted from a wsgi proxy found out there
# adapted from https://code.google.com/p/wsgi-proxy
from httplib import HTTPConnection
from urlparse import urlparse
import copy
import logging
import mimetypes
import os
_hoppish = {
@cowboy
cowboy / very-small-ie-detect.js
Created August 21, 2010 13:26 — forked from padolsey/gist:527683
Very small IE detect (aka type coersion ftw)
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 6) then:
// ie === 0
// If you're in IE (>=6) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}