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
trigger: function (e, t) { | |
var n, r, i, s, o; | |
t == null && (t = {}), Reader.Debug.log("[Shortcuts] trigger " + e); | |
if ($(window).width() < 768 && ["j", "k"].indexOf(e) === -1) return !0; | |
n = Reader.Contents.container, o = n.hasClass("slide") ? Reader.Contents.offset : n.scrollTop(); | |
switch (e) { | |
case "space": | |
return s = n.height() - o, i = n.scrollTop() + s, r = !1, $(".post").each(function (e, t) { | |
var u, a; | |
if (r) return; |
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 bash | |
set -ue | |
merge_shas="`git rev-list HEAD --merges --grep='^Merge pull request #[0-9]\{1,\} '`" | |
merges="`echo "$merge_shas" | wc -l | tr -d ' '`" | |
fast_forwards=0 | |
non_fast_forwards=0 | |
while read -r merge_sha; do | |
first_parent="`git rev-list -1 $merge_sha^1`" |
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 python | |
import argparse | |
import getpass | |
import json | |
import re | |
import requests | |
import subprocess | |
parser = argparse.ArgumentParser() |
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
module TestModule | |
end | |
class Included | |
class << self | |
include TestModule | |
end | |
end | |
class Prepended |
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 | |
# Git post-commit hook that sends an approximation of GitHub's 'push' webhook | |
# after every commit. Helpful for testing code that consumes those webhooks. | |
# | |
# To set this up: | |
# 1. Create a local repo where you'll make test commits | |
# 2. Copy this script to .git/hooks/post-commit | |
# 3. Make it executable: `chmod +x .git/hooks/post-commit` | |
# 4. Change the `uri` variable below to where webhooks should be sent |
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
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'mysql2' | |
gem 'benchmark-ips' |
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/bash | |
hosted_zone_id=$1 | |
hostnames=`./get_hostnames_from_hosted_zone.sh "$hosted_zone_id"` | |
while read hostname; do | |
echo "$hostname" | |
instance_id=`./hostname_to_instance_id.sh "$hostname"` | |
if [[ -z $instance_id ]]; then | |
echo " hostname doesn't contain instance id, skipping." | |
else |
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 "test_helper" | |
class MemoizedAttributesTest < IdentityCache::TestCase | |
def test_memoization_should_not_break_dirty_tracking | |
item = Item.create! | |
IdentityCache.cache.with_memoization do | |
Item.fetch(item.id) | |
Item.fetch(item.id).title = "my title" | |
Item.fetch(item.id).update(title: "my title") |
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
def each_char_matching_pattern(io, pattern) | |
return enum_for(:each_char_matching_pattern, io, pattern) unless block_given? | |
io.each_line.lazy.select do |line| | |
line =~ pattern | |
end.flat_map do |line| | |
line.chars | |
end.each do |line| | |
yield line | |
puts "\toffset: #{io.pos}" |
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 | |
require 'thor' | |
require 'dogapi' | |
require 'pry' | |
class DatadogPry < Thor | |
DatadogDashboard = Struct.new(:name, :queries) | |
DatadogMonitor = Struct.new(:name, :queries) |
OlderNewer