TODO: make gem for this
This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.
-
Set the install directory for Bower components:
// .bowerrc
/* | |
Title: Vanilla JavaScript to fix responsive SVGs in some versions of Safari. | |
What it does: Stops the problem I described here: http://stackoverflow.com/q/17158717/1147859 Reference URL of the issue: http://codepen.io/benfrain/full/fhyrD | |
It will work on all SVGs referenced inside objects as long as given the class .emb: | |
<object class="emb" data="img/cup.svg" type="image/svg+xml"></object> | |
And also any inline SVGs. |
uglify: { | |
production: { | |
options: { | |
report: 'min' | |
}, | |
files: [{ | |
expand: true, | |
cwd: '<%= dir.tempJS %>/', | |
src: '*.js', | |
dest: '<%= dir.publicJS %>', |
#! /usr/bin/env python2 | |
# Requires: PIL, colormath | |
# | |
# Improved algorithm now automatically crops the image and uses much | |
# better color matching | |
from PIL import Image, ImageChops | |
from colormath.color_objects import RGBColor | |
import argparse | |
import math |
func main() { | |
s := []string{"this", "is", "a", "test"} | |
mapper := func(s string) string { | |
return "prefix-" + s | |
} | |
tap := func(s string) { | |
fmt.Printf("tap: %s\n", s) |
package main | |
import ( | |
"bytes" | |
"encoding/hex" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net" |
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
all: thread_prng adversary Makefile advantages | |
thread_prng: thread_prng.c | |
gcc --std=c99 -o thread_prng -lpthread thread_prng.c | |
adversary: adversary.c | |
gcc --std=c99 -o adversary adversary.c | |
advantages: adversary thread_prng | |
for option in r m; do \ |
#!/usr/bin/env ruby | |
# This is my current blacklist when playing spotify in radio mode with "heavy metal". | |
blacklist = ['Nickelback', 'Scorpions', 'Watain', 'Mayhem', 'Guns N\' Roses'] | |
# gem install ruby-dbus | |
require "dbus" | |
session_bus = DBus::SessionBus.instance |
package main | |
import ( | |
"database/sql" | |
"errors" | |
"fmt" | |
_ "github.com/bmizerany/pq" | |
"os" | |
"regexp" | |
"strings" |