Skip to content

Instantly share code, notes, and snippets.

View wilmoore's full-sized avatar

Wil (₩) Moore III wilmoore

View GitHub Profile
/*
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
describe "GET current" do
before do
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}"
get :current, :format => 'js'
end
it { should respond_with(:success) }
it { should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") }
it { should render_template('notices/current') }
end
@wilmoore
wilmoore / application.httpd
Created April 22, 2011 19:41
Bootstrapping a multi-environment ZF 1.x application (please use Composer and Composer's autoloader instead)
<VirtualHost *:80>
ServerName ##APP_DOMAIN##
ServerAlias www.##APP_DOMAIN##
ServerAlias ##APPLICATION_ENV##.www.##APP_DOMAIN##
ServerAlias ##APPLICATION_ENV##.##APP_DOMAIN##
ServerAdmin admin@##APP_DOMAIN##
SetEnv APPLICATION_ENV ##APPLICATION_ENV##
SetEnv SERVER_HOSTNAME ##SERVER_HOSTNAME##
Header append X-Host-List "%{SERVER_HOSTNAME}e"
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@wilmoore
wilmoore / convert.sh
Created June 2, 2011 00:29
convert markdown to reStructured Text (Thanks Doctrine2) - https://github.com/doctrine/dbal-documentation/blob/master/convert.sh
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE
@itang
itang / BlueEyesDemo.scala
Created July 23, 2011 18:11
simple benchmark for Blueeyes, Servlet, Play!
package demo
import blueeyes.BlueEyesServer
import blueeyes.BlueEyesServiceBuilder
import blueeyes.concurrent.Future
import blueeyes.concurrent.Future._
import blueeyes.core.data.{ ByteChunk, BijectionsChunkJson }
import blueeyes.core.http.HttpStatusCodes._
import blueeyes.core.http.combinators.HttpRequestCombinators
import blueeyes.core.http.MimeTypes._
@Synchro
Synchro / gist:1139429
Created August 11, 2011 11:29
PHP Base-62 encoder/decoder
<?php
/**
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <[email protected]>
* @copyright 2011 Marcus Bointon
* @license http://www.opensource.org/licenses/mit-license.html MIT License
@defunkt
defunkt / gitio
Created September 11, 2011 08:11
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@wilmoore
wilmoore / filter-and-sort.coffee
Last active September 27, 2015 11:08
filter-and-sort language comparison
fields = ['firstName', 'middleName', 'lastName', 'suffix']
names = [
{ firstName: 'Diane', middleName: 'Tanya ', lastName: ' Douglas', suffix: '' },
{ firstName: 'Jon ', middleName: '', lastName: ' Watson', suffix: '' },
{ firstName: ' Michelle ', middleName: '', lastName: ' Ajuria', suffix: '' },
{ firstName: 'Elliot ', middleName: '', lastName: 'Gray ', suffix: 'III'},
{ firstName: ' Jason ', middleName: '', lastName: 'Doran', suffix: '' }]
# drop superfluous spaces and empty name parts (i.e. if there is no middle name, get rid of it)
names.every (name) ->
@tpope
tpope / speeddating.vim
Created October 16, 2011 05:04
Increment keywords with speeddating.vim
" Place in ~/.vim/after/plugin/speeddating.vim
" In Vim, -4 % 3 == -1. Let's return 2 instead.
function! s:mod(a,b)
if (a:a < 0 && a:b > 0 || a:a > 0 && a:b < 0) && a:a % a:b != 0
return (a:a % a:b) + a:b
else
return a:a % a:b
endif
endfunction