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
var userMap = function() { | |
day = Date.UTC(this.created_at.getFullYear(), this.created_at.getMonth(), this.created_at.getDate()); | |
emit({ day: day, user_id: this.user_id }, { count: 1 }); | |
} | |
var userReduce = function(key, values) { | |
var count = 0; | |
values.forEach(function(v) { | |
count += v['count']; |
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/sh | |
# http://stackoverflow.com/a/6262715 | |
# .git/hooks/pre-commit | |
# chmod +x .git/hooks/pre-commit | |
# A git hook script to find and fix trailing whitespace | |
# in your commits. Bypass it with the --no-verify option | |
# to git-commit | |
# |
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
function dethrottle { | |
sudo ipfw delete 1 | |
} | |
function throttle { | |
if test $# -eq 0 | |
then | |
echo 'throttle <port> <bandwidth (KB)>' | |
elif test $# -eq 1 | |
then |
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 | |
date = ARGV[0] | |
unless date | |
puts "usage: ruby #{ __FILE__ } <date>" | |
puts " eg: ruby #{ __FILE__ } 2015-06-07" | |
exit | |
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
require 'spec_helper' | |
# Think you've fixed it? Try | |
# `while rake spec:controllers; do :; done` | |
# and grab a coffee | |
RSpec.describe SomethingsController, type: :controller do | |
# ... | |
describe '#create' do | |
# ... |
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 'thread' | |
require 'fiber' | |
require 'benchmark' | |
include Benchmark | |
class DeferredProxy < BasicObject | |
def initialize(&block) | |
@fiber = ::Fiber.new do | |
thread = ::Thread.new{ @result = block.call } | |
::Fiber.yield |
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 'rubygems' | |
require 'aws-sdk' | |
is_clean = `git diff-index HEAD`.chomp.empty? | |
unless is_clean | |
puts 'You currently have uncommitted changes. Stash or commit them before bundling.' | |
exit | |
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
diff --git a/app/partials/account-bar.cjsx b/app/partials/account-bar.cjsx | |
index 0976873..435711c 100644 | |
--- a/app/partials/account-bar.cjsx | |
+++ b/app/partials/account-bar.cjsx | |
@@ -46,6 +46,9 @@ module.exports = React.createClass | |
@setState {unread: !!conversations.length} | |
.catch (e) -> throw new Error(e) | |
+ close: -> | |
+ document.querySelector('.account-menu.modal-form-underlay').click() |
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 | |
data = `bsondump #{ ARGV[0] }`.chomp | |
data.gsub! /ObjectId\(\s?(\"\w+\")\s?\)/, '\1' | |
data.gsub! /Date\(\s?(\w+)\s?\)/, '\1' | |
data = data.split "\n" | |
data = "[#{ data.join(', ') }]" | |
File.open(ARGV[1], 'w') do |f| |
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
SELECT | |
"access_control_lists".* | |
FROM "access_control_lists" | |
WHERE | |
("access_control_lists"."roles" && '{owner}') AND | |
"access_control_lists"."resource_type" = 'Project' AND | |
"access_control_lists"."resource_id" IN (53, 55) |
OlderNewer