This file contains hidden or 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 bl.pid AS blocked_pid, | |
a.usename AS blocked_user, | |
ka.query AS current_statement_in_blocking_process, | |
now() - ka.query_start AS blocking_duration, | |
kl.pid AS blocking_pid, | |
ka.usename AS blocking_user, | |
a.query AS blocked_statement, | |
now() - a.query_start AS blocked_duration | |
FROM pg_catalog.pg_locks bl | |
JOIN pg_catalog.pg_stat_activity a ON a.pid = bl.pid |
This file contains hidden or 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
[ | |
{ | |
"left": 1, | |
"right": 2, | |
"operator": "<" | |
}, | |
"and", | |
[ | |
{ | |
"left": 2, |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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| |
NewerOlder