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
#!/bin/bash | |
libs=( "/usr/local/lib/libmacfuse_i32.2.dylib" \ | |
"/usr/local/lib/libosxfuse_i32.2.dylib" \ | |
"/usr/local/lib/libosxfuse_i64.2.dylib" \ | |
"/usr/local/lib/libmacfuse_i64.2.dylib" \ | |
"/usr/local/lib/libosxfuse_i32.la" \ | |
"/usr/local/lib/libosxfuse_i64.la" \ | |
"/usr/local/lib/pkgconfig/osxfuse.pc" ) |
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
package main | |
import "fmt" | |
func main() { | |
// make sure that printf pads digits with zeros so we can sort the strings | |
// without converting to them back to ints | |
fmt.Printf("%010d\n", 1) |
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
package main | |
// parallel_rw.go experiments with parallel read/write from a file without | |
// syncing (aka flushing) or closing. | |
import ( | |
"encoding/binary" | |
"fmt" | |
// "math/rand" | |
"os" |
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
package main | |
// crash_recover.go experiments with recovering from a file that suddenly | |
// crashed (files are written without sync or close.) | |
import ( | |
"encoding/binary" | |
"fmt" | |
"math/rand" | |
"os" |
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
package flushing | |
import ( | |
"encoding/binary" | |
"fmt" | |
"math/rand" | |
"os" | |
"testing" | |
) |
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
# ~*~ encoding: utf-8 ~*~ | |
module Enumerable | |
# Freezes elements and nested containers recursively. | |
def deep_freeze | |
each { |o| o.respond_to?(:deep_freeze) ? o.deep_freeze : o.freeze } | |
freeze | |
end | |
end |
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
RSpec::Matchers.define :validate_existence_of do |association| | |
description { "require an existing #{association}" } | |
@association = association | |
@attribute = "#{association}_id" | |
@message_finder_factory = Shoulda::Matchers::ActiveModel::ValidationMessageFinder | |
def unique_id |
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
RSpec::Matchers.define :have_a_valid_factory do | |
match do |subject| | |
factory = subject.class.name.underscore.to_sym | |
FactoryGirl.build(factory).should be_valid | |
end | |
end |
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
color.grad <- function(input, bins=10) { | |
colors <- c('#FFFFFF', heat.colors(bins-1)) # white for 0/NA | |
input[is.na(input)] <- 0 # replace NA with 0 | |
colors[cut(input, bins, labels=F)] # break up into bins, project colors | |
} |
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
#!/usr/bin/env ruby | |
require 'mongo' | |
require 'ruby-progressbar' | |
conn = Mongo::Connection.new | |
db = conn['yelp'] | |
coll = db['reviews'] | |
user_ids, biz_ids = {}, {} |
OlderNewer