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
class MyPlugin | |
def self.calculates(name) | |
self.calculations << name | |
end | |
def self.calculations | |
@calculations ||= [] | |
end | |
def initialize(debug=false) | |
@debug = debug |
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
--- | |
- 0de33921da7ae678f09e782017eee33df69771e7 | |
- 85030b36651be800165eea871af63b87fe31bf84 | |
- 57fe8140f5f55e3b13172029ad15facbb970a44b | |
- 12027a2dc7a6ea68bd79ae20365d94320b3664e8 | |
- 62f22aea6c96916f469f5b889999e945eb78d12f | |
- 938b299a81af0e821dafd179da87ac562f9039f5 | |
- f0e8d7e364b79899d306bdd6237b55778ebfb362 | |
- 9409b573d2135b7adda3560ebe6e15fa89b81e3f | |
- 285f269086ebaecd3d18023d4887c9e1f2eb6e8f |
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 commits(&block) | |
mutex = Mutex.new | |
queue = self.repositories(username) | |
self.thread_count.times.map { | |
Thread.new do | |
while repo_name = mutex.synchronize { queue.pop } | |
# get windows and then each sha | |
repo_commits(repo_name, username, start_time, end_time) do |commit| | |
mutex.synchronize { block.call 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
def commits(&block) | |
queue = self.sha_list | |
self.thread_count.times.map { | |
Thread.new do | |
while sha = mutex.synchronize { queue.shift } | |
hash = fetch_sha(sha) | |
commit = Commit.new(hash, repo_name, username) | |
mutex.synchronize { block.call commit } | |
end | |
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
def fetch_sha(repo_name, sha) | |
VCR.use_cassette("#{repo_name}/shas/#{sha}", :record => :new_episodes) do | |
return client.commit(repo_name, sha) | |
end | |
end | |
def commits_window(repo_name, username, since_time, until_time) | |
options = { :author => username, :since =>since_time.iso8601, :until = until_time.iso8601 } | |
VCR.use_cassette("#{repo_name}/#{username}/commits/#{since_time.to_i}-#{until_time.to_i}", :record => :new_episodes) 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
program :version, '0.0.1' | |
program :description, 'See activity on Github.' | |
command :impact do |c| | |
c.syntax = 'hubtime impact' | |
c.summary = '' | |
c.description = 'Graph your additions and deletions' | |
c.option '--months INTEGER', 'How many months of history' | |
c.option '--user USERNAME', 'Which Github user' | |
c.action do |args, options| |
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
total_stats: | |
additions: 163007 | |
deletions: 88260 | |
impact: 251267 | |
count: 1753 | |
repo_stats: | |
bleonard/daily: | |
additions: 2172 | |
deletions: 1257 | |
impact: 3429 |
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
namespace :app do | |
desc "create a new app with the given name -- for example, app:create[new_app_name]" | |
task :create, [:name] => :environment do |t, args| | |
underscore = get_underscore(args) | |
name = underscore.camelize | |
directory = get_directory(args) | |
raise "#{directory} already exists!" if File.exists?(directory) | |
puts "Creating app #{name} in #{directory}" |
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
bus = ResqueBusSpec.watch | |
# do stuff | |
events = bus.all_queued("my_event") | |
events.size.should == 2 | |
event = events.first.attributes | |
event["action"].should == "whatever" | |
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
### Keybase proof | |
I hereby claim: | |
* I am bleonard on github. | |
* I am bleonard (https://keybase.io/bleonard) on keybase. | |
* I have a public key whose fingerprint is 7D99 EFAB 312F A0CD A182 CFA1 6D2C 6D1D 1FC9 D682 | |
To claim this, I am signing this object: |
OlderNewer