Skip to content

Instantly share code, notes, and snippets.

View hilem's full-sized avatar

Nicholas Hilem hilem

  • Chestnut
  • San Francisco
View GitHub Profile
@hilem
hilem / Pwease hewp
Last active August 29, 2015 14:13 — forked from anonymous/Pwease hewp
<script>
var images = [
"http://philipdahl.com/crow/web1.jpg"
,"http://philipdahl.com/crow/web2.jpg"
,"http://philipdahl.com/crow/web3.jpg"
,"http://philipdahl.com/crow/web4.jpg"
,"http://philipdahl.com/crow/web5.jpg"
,"http://philipdahl.com/crow/web6.jpg"
,"http://philipdahl.com/crow/web7.jpg"
@hilem
hilem / gist:1e4c7fcf53fbc74a1cb5
Last active August 29, 2015 14:07
Playing with Pat
package main
import (
r "github.com/dancannon/gorethink"
//$ "github.com/gorilla/mux"
"github.com/bmizerany/pat"
"log"
"net/http"
"time"
)
@hilem
hilem / gist:a1af26e245e08e8100aa
Created August 26, 2014 17:49
playing with docker
FROM ubuntu:trusty
### Notes:
## 1) don't use homebrew for go/docker on OSx, it's outdated and will cause headaches for any other install path
## 2) build with
## > docker build -t <repos_name> .
## 3) run with
## > docker run -d -P <repos_name>
## 4) view logs with
## > docker logs -f <container_nick>
@hilem
hilem / montage creation script
Created January 29, 2014 06:17
post images to a directory, set this script to watch the directory with cron
#!/bin/bash
# A simple script to create an album artwork montage
## move files to within montage directory w/ prepended unix timestamp
c_time=$(date +%s)
for f in `ls /tmp | grep "now_playing-"`
do
mv /tmp/${f} /tmp/montage/${c_time}_${f}
c_time=$(($c_time + 1))
done
@hilem
hilem / ember question
Created January 14, 2013 03:05
Is this really necessary?
App = Ember.Application.create()
App.Adapter = DS.RESTAdapter.extend()
App.store = DS.Store.create({
revision: 11,
adapter: App.Adapter.create()
})
App.MyModel = DS.Model.extend({
name: DS.attr('string')
# http://blog.jazzychad.net/2012/08/01/array-iteration-problem.html
def argh(arr, val, n)
# change to arr2 = arr if you want to change the array in place
arr2 = arr.dup
tmp_range = (0..arr2.length)
tmp_range = n < 0 ? (n..arr2.length) : (0..(n-1)) unless n == 0
tmp = []
arr2.each_with_index { |v, i| tmp << [v, i] if v == val }
tmp[tmp_range].map! { |v| v[0] += val }
tmp.each { |v| arr2[v[1]] = v[0] }