Skip to content

Instantly share code, notes, and snippets.

View ryanseys's full-sized avatar
🌴

Ryan Seys ryanseys

🌴
View GitHub Profile
@ryanseys
ryanseys / fac_iter.js
Created April 21, 2013 16:38
Iterative Factorial in JavaScript
function fac_iter(n) {
var result = 1;
if(n > 1) {
while(n > 1) {
result *= n;
n--;
}
}
return result;
}
@ryanseys
ryanseys / coda.sh
Created April 25, 2013 00:08
Download all torrents from Coda.fm
#!/bin/bash
for (( c=1; c<=7087; c++ ))
do
wget http://coda.fm/albums/$c/torrent/download?file=$c.torrent
done
@ryanseys
ryanseys / .git_config
Last active December 17, 2015 04:18
Sync master & gh-pages by adding these 2 lines in your .git/config file
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:user/repo.git
# add the following 2 lines so $ git push pushes to both master & gh-pages
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
@ryanseys
ryanseys / .zshrc
Created May 28, 2013 16:24
Turn off zsh autocorrect
source $ZSH/oh-my-zsh.sh
unsetopt correct
var obj = {
children: [
{
children: [
{
id: "item2"
}
],
id: "folder_test"
},
@ryanseys
ryanseys / gist:6826844
Created October 4, 2013 14:28
Export history with time-stamps
export HISTTIMEFORMAT="%F %T "; history
@ryanseys
ryanseys / index.html
Last active December 25, 2015 07:09 — forked from BitPuffin/gist:6936429
#! stdtmpl
# proc htmlLayout(request: TRequest, content, title: string): string =
# result = ""
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
<script src="https://login.persona.org/include.js"></script>
<script src="/js/personabuttons.js"></script>
<script src="/js/personawatcher.js"></script>
@ryanseys
ryanseys / Dockerfile
Last active December 26, 2015 15:19
Dockerfile for Node.js apps
FROM ubuntu:12.04
MAINTAINER Ryan Seys <ryan@ryanseys.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu precise universe" >> /etc/apt/sources.list
RUN apt-get update # DATE: 2013/10/26
RUN apt-get upgrade -y
RUN apt-get install -y python-software-properties python g++ make software-properties-common
RUN add-apt-repository ppa:chris-lea/node.js && apt-get update
RUN apt-get install -y nodejs
ADD . /src
RUN cd /src; npm install
@ryanseys
ryanseys / deploy
Last active December 26, 2015 17:29
deploy
#!/bin/sh
set -e
echo 'Deploying...'
apt-get install -y nginx
service nginx start
update-rc.d nginx defaults
docker build -t ryanseys/hello github.com/ryanseys/node-helloworld
docker run -d ryanseys/hello
docker ps
@ryanseys
ryanseys / gist:7305562
Created November 4, 2013 16:50
Empty array in Python treated as None-ish type
//JavaScript
[] || 'hello' // returns []
# Python
[] or 'hello' # returns 'hello'