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 'gmail' | |
require 'github_api' | |
require 'netrc' | |
require 'pry' | |
netrc = Netrc.read | |
github = Github.new(basic_auth: netrc['api.github.com'].join(':')) | |
Gmail.new(*netrc['imap.gmail.com']) do |gmail| | |
gmail.inbox.emails(from: 'github.com').each do |message| | |
begin |
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 "rubygems" | |
require "mutter" | |
require "httparty" | |
REMOTE = "origin" | |
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:]([^\/]+\/[^\/]+)\.git/, 1] | |
USER = `git config --get github.user`.chomp | |
TOKEN = `git config --get github.token`.chomp |
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
// Forgetful.js is what I use on SSDs to prevent disk wear. | |
// Because each SSD sector can only be written a set # of times | |
// it's important not to write huge log files for no reason. | |
// So my test logs (and some others) are all outputted to this | |
// node.js instance which keeps track of the throughput | |
// in simply-named channels. | |
// | |
// To use this in, e.g., Rails, put this in environments/test.rb: | |
// | |
// class NamedChannelSocket < TCPSocket |
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
# Include an anonymous module | |
# | |
# Useful for defining a class with a base module. So, instead of: | |
# | |
# class Foo | |
# module Base | |
# def bar | |
# # ... | |
# 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
twitter.json |
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 'mechanize' | |
require 'httparty' | |
# Ugly code, for an ugly hack. | |
# Hey, if Lighthouse didn't suck then none of this would happen. | |
# It's been lotsa fun coding it though, so I suppose I should be thankful for the "opportunity" |
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
module Mongo | |
module Instrumentation | |
def self.instrument(clazz, *methods) | |
clazz.module_eval do | |
methods.each do |m| | |
class_eval %{def #{m}_with_instrumentation(*args, &block) | |
ActiveSupport::Notifications.instrumenter.instrument "mongo.mongo", :name => "#{m}" do | |
#{m}_without_instrumentation(*args, &block) | |
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
#spinnerContainer { | |
display: none; | |
position: absolute; | |
top: 340px; | |
right: 350px; | |
width: 54px; | |
height: 54px; | |
} | |
#spinner { |
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
with recursive category_ancestors (id, parent_id, name) as ( | |
select id, parent_id, name | |
from categories where id = 123 | |
union | |
select parent.id, parent.parent_id, parent.name | |
from categories parent | |
inner join category_ancestors on parent.id = category_ancestors.parent_id | |
) | |
select * from category_ancestors; |
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 'parslet' | |
class Mini < Parslet::Parser | |
rule(:start) { match('[iIaAoOsS]').as(:switch) } | |
rule(:typing) { match('[^\e]').repeat.as(:typing) } | |
rule(:terminate) { match('\e').as(:escape) } | |
rule(:insertion) { start >> typing >> terminate } | |
root(:insertion) | |
end |
OlderNewer