This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pulseaudio --start | |
pactl load-module module-raop-sink server=10.0.1.22 sink_name=raop.CFA.local description="CFA" | |
mpg123 <the_file> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'simple_oauth' | |
require 'net/http' | |
require 'rack' | |
class GetTwitterRSS | |
@@consumer_secrets={:consumer_key=>"<<YOUR_KEY>>",:consumer_secret=>"<<YOUR_SECRET>>} | |
@@user_secrets={"username | |
1"=>{:token_secret=>"<<TOKEN_SECRET>>",:token=>"<<ACCESS_TOKEN>>"}} | |
@@base="api.twitter.com" | |
def call(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!Doctype html> | |
<html> | |
<head> | |
<title>311 Density</title> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="https://github.com/CloudMade/Leaflet/raw/master/dist/leaflet.css" /> | |
<!--[if lte IE 8]><link rel="stylesheet" href="https://github.com/CloudMade/Leaflet/raw/master/dist/leaflet.ie.css" /><![endif]--> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Pretty Methods | |
#you can call any_object.pretty_methods | |
#it will return a hash of classes from that objects ancestor chain, and all the method names (as symbols) of that object which are created by that ancestor. | |
#example: 5.pretty_methods: {Fixnum=>[:%, %+, :odd? ....], Integer=>[:ceil,:round,...],...Kernel=>[:is_a?, :taint, ...] | |
#you can pass the parameter 'false' to get back classes as strings, instead of Class objects | |
#add 'require <path>/pretty_methods.rb' to your .irbrc file, and have the fun by default! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails console | |
> a = Time.zone.now # => Mon, 25 Jul 2011 23:47:52 EDT -04:00 | |
> b = Time.zone.parse(a.to_s) # => Mon, 25 Jul 2011 23:47:52 EDT -04:00 | |
> c = Time.zone.parse(a.strftime("%Y-%m-%d %H:%M:%S.%N %z")) # => Mon, 25 Jul 2011 23:47:52 EDT -04:00 | |
> a == b # => false | |
> a == c # => true | |
> a.nsec # => 583744338 | |
> b.nsec # => 0 | |
> c.nsec # => 583744338 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//mustachify the interwebs! | |
// | |
// tested only on google chrome, so far | |
// | |
// ==UserScript== | |
// @name mustache image | |
// @include http://* | |
// ==/UserScript== | |
//we need jquery, 'cus otherwise searching for all the stupid background-image using inline styles is a pain. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chunky_png' | |
module ChunkyPNG::Color | |
LUMA_WEIGHTS = [0.30, 0.59, 0.11] | |
#based on http://en.wikipedia.org/wiki/HSL_and_HSV | |
def self.to_hcy_floats(i) #creates hue, chroma, luma tuple | |
r,g,b = to_truecolor_bytes(i).map {|x| x/255.0} | |
minx,maxx = [r,g,b].minmax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'github_v3_api' | |
g = g=GitHubV3API.new(ENV['GITHUB_OAUTH2_TOKEN']) | |
cfa = g.orgs.list.first | |
names = cfa.repos.map(&:name) | |
names.each do |name| | |
hooks = g.get("/repos/codeforamerica/#{name}/hooks") | |
scream_hook = hooks.find {|h| h["name"] == "web" && h["config"]["url"] =~ /6178/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is a very very minor modification of http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ , to use google maps api v3. | |
//if you run this javascript on a page, or include it, you'll get nice tile number overlays. | |
function TileToQuadKey ( x, y, zoom){ | |
var quad = ""; | |
for (var i = zoom; i > 0; i--){ | |
var mask = 1 << (i - 1); | |
var cell = 0; | |
if ((x & mask) != 0) | |
cell++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><body> | |
<div style='position: absolute; left: 0px; top: 0px; background: url("http://tile.stamen.com/terrain/13/1312/3165.png") -10px -10px no-repeat; width: 256px; height:256px;'> </div> | |
<div style='position: absolute; left: 0px; top: 246px; background: url("http://tile.stamen.com/terrain/13/1312/3166.png") -10px 0px no-repeat; width: 256px; height:256px;'> </div> | |
<div style='position: absolute; left: 0px; top: 502px; background: url("http://tile.stamen.com/terrain/13/1312/3167.png") -10px 0px no-repeat; width: 256px; height:256px;'> </div> | |
<div style='position: absolute; left: 0px; top: 758px; background: url("http://tile.stamen.com/terrain/13/1312/3168.png") -10px 0px no-repeat; width: 256px; height:10px;'> |
OlderNewer