Skip to content

Instantly share code, notes, and snippets.

View danprince's full-sized avatar

Dan Prince danprince

View GitHub Profile
@danprince
danprince / prepare.md
Created April 13, 2013 12:14
GitHub deployment with prepare.py

Prepare

Reads the names of files that have arrived from a git pull and creates the necessary commands to deploy them in a deploy.sh file.

Usage

git pull | python prepare.py This creates a deploy.sh file sh deploy.sh Any new files will be deployed to the server.

function c(i){return i.match(/1[0-9]*1/g).length}
@danprince
danprince / gist:5608014
Created May 19, 2013 15:34
Print Hello, World! without using string or integer literals.
w=[];
z = new String();
s=function(a){
w.push(String.fromCharCode(a.join(z)));
};
a={}+[],
b=+!a,
c=b+b,
d=c+b,
e=d+b;
@danprince
danprince / gist:5615036
Last active December 17, 2015 13:10
L33tify (case sensitive version)
c=""
a.split(c).map(function(l){b='oi/eas'
x=b.indexOf(l)
~x?l=x:1
c+=l})
@danprince
danprince / gist:5649923
Last active December 17, 2015 17:59
Functionless FizzBuzz
f={set b(l){
m=function(a,b){while(a>b){a-=b}r=--a}
i=1
while(i<=l){
a=i++
m(i,3)
r?0:a+="fizz"
m(i,5)
r?0:a+="buzz"
console.log(a)
@danprince
danprince / StroopJsGuide.md
Last active December 18, 2015 11:19
Dipstick: StroopJS
@danprince
danprince / gist:6150241
Last active December 20, 2015 14:58
Game of Life: Io Golf
f :=File with("l")
f openForUpdating
l :=f readLines
h :=l size
C :=method(x,y,
if(x>=0 and x<h,
if(y>=0 and y<h,
return l at(y) at(x)-48)
)
return 0
@danprince
danprince / zipper.coffee
Created August 22, 2013 20:24
Zipper Golf (broke the rules though)
n=""
c=(x)->n+=String.fromCharCode(x)
c 122;c 105;c 112;c 112;c 101;c 114
window[n]=(u,d)->
o=[]
u.map(y,j) ->
o.push y,d[j]
o
@danprince
danprince / gist:6389841
Last active December 22, 2015 00:29
Selttob fo reeb!
<?php
$i=99;
$e=1;
$R='strrev';
function P($i){
$b="elttob";
$i==1?0:$b="s".$b;
return $b;
@danprince
danprince / $.js
Created September 1, 2013 01:23
String based functions
$=function(){
a=arguments
return function(){
for(k in a)
this[a[k]]=arguments[k]
c=a[a.length-1]
i=c.indexOf("$")
r=c.substr(i+1)
eval(c.substr(0,i))
return new Function("return "+r)()