Skip to content

Instantly share code, notes, and snippets.

View dingram's full-sized avatar

Dave Ingram dingram

View GitHub Profile
<?php
function echoRequest(ReqtRequest $request) {
$resp = new RestResponseOk(array(
'url' => $url,
'verb' => $verb,
'headers' => $headers,
'args' => $get_args,
'body' => $body,
), $request);
$resp->render();
RewriteEngine On
RewriteRule ^index.php$ - [L]
RewriteRule .* index.php [L,QSA]
#!/bin/bash
#
# git-svn-rebase-all
# by Dave Ingram <http://github.com/dingram/>
#
SHELL=${SHELL:-/bin/bash}
curbranch=$(git symbolic-ref HEAD 2>/dev/null)
if [ $? -eq 0 ]; then
curbranch=${curbranch##*/}
else
#!/usr/bin/env zsh
# ------------------------------------------------------------------------------
# Fish style live command coloring.
# ------------------------------------------------------------------------------
# Token types styles.
# See http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135
ZLE_RESERVED_WORD_STYLE='bold'
ZLE_ALIAS_STYLE='bold'
ZLE_BUILTIN_STYLE='bold'
@dingram
dingram / lipsum.pl
Created October 19, 2010 14:41
Lorem Ipsum (lipsum) generator, in Perl, using lipsum.com
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::Entities;
use Getopt::Long;
# Generate lipsum (courtesy of lipsum.com)
# probably needs neatening up here and there
# comments? who needs comments? perl is easy to understand...
@dingram
dingram / gist:1405675
Created November 29, 2011 17:43
Date highlight script for Google Docs
function numToCol(c) {
var r = '';
if (c > 25) {
r = String.fromCharCode('A'.charCodeAt(0) + parseInt(c / 26, 10) - 1);
}
r = r + String.fromCharCode('A'.charCodeAt(0) + parseInt(c % 26, 10));
return r;
}
function getCellForDate_(d) {
@dingram
dingram / gist:2171573
Created March 23, 2012 15:10
vimrc sessions
"*****************************************************************************
" Vim Sessions
"*****************************************************************************
" ignore 'options' because of latex-suite (would be pointless to save that!)
set sessionoptions=blank,curdir,folds,help,resize,tabpages,winsize
if has('win32') || has('win64')
set sessionoptions+=slash,unix
map <leader>ss :mksession! ~/_vimsession<cr>
map <leader>sr :source ~/_vimsession<cr>
else
@dingram
dingram / js-sdk.min.js
Created September 10, 2012 14:34
A minimalist way of including social JavaScript SDKs into a page. Includes Google Analytics, Twitter widgets, Facebook, and Google +1
window.___gcfg={lang:'en-GB'};var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-123456-9']);_gaq.push(['_trackPageview']);!function(d,s){var st=d.getElementsByTagName(s)[0],j=function(i,u){if(d.getElementById(i))return;var js=d.createElement(s);js.id=i;js.async=true;js.src=u;st.parentNode.insertBefore(js,st)};setTimeout(function(){j("twitter-wjs","//platform.twitter.com/widgets.js");j("facebook-jssdk","//connect.facebook.net/en_GB/all.js#xfbml=1");j("gplusone-sdk","https://apis.google.com/js/plusone.js")}, 0);j("ga-sdk",('https:'==d.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js')}(document,'script');
@dingram
dingram / whotime
Last active December 20, 2015 15:38
#!/bin/bash
#
# By Dave Ingram
export TZ="Europe/London"
case $( date +%I ) in
01) DOCTOR='William Hartnell' ;;
02) DOCTOR='Patrick Troughton' ;;
03) DOCTOR='Jon Pertwee' ;;
04) DOCTOR='Tom Baker' ;;
@dingram
dingram / designer.html
Created August 7, 2014 00:59
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_scaffold {
position: absolute;
top: 0px;
right: 0px;