Skip to content

Instantly share code, notes, and snippets.

View copiousfreetime's full-sized avatar

Jeremy Hinegardner copiousfreetime

View GitHub Profile
@copiousfreetime
copiousfreetime / triage-repo
Last active January 8, 2016 18:24
A quick script to open the next issue in a repo
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'octokit', '~> 4.2'
gem 'trollop', '~> 2.1'
gem 'launchy', '~> 2.4'
gem 'netrc', '~> 0.11'
List numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
int result = 0;
for(int i = 0; i < numbers.size(); i++) {
if ((numbers.get(i) > 5) &&
(isEven(numbers.get(i))) &&
(numbers.get(i) < 9) &&
(numbers.get(i) * 2 > 15)) {
result = numbers.get(i);
Process: Telegram [15552]
Path: /Applications/Telegram.app/Contents/MacOS/Telegram
Identifier: ru.keepcoder.Telegram
Version: 1.60 (20263)
App Item ID: 747648890
App External ID: 812412646
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Telegram [15552]
User ID: 501
@copiousfreetime
copiousfreetime / demonstrate-maildir-issue-91.txt
Created March 21, 2015 21:49
demonstrate maildir-issue-19
jeremy@ample-3:~/repos/git/maildir ruby-2.1.5@maildir bugfix/demonstrate-issue-19 % SEED=48094 bundle exec rake
/opt/rubies/ruby-2.1.5/bin/ruby -I"lib" -I"/Users/jeremy/.gem/repos/ruby-2.1.5/maildir/gems/rake-10.4.2/lib" "/Users/jeremy/.gem/repos/ruby-2.1.5/maildir/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/test_*.rb"
* DEFERRED: Message#utime should update the messages atime.
Run options: --seed 48094
# Running:
.......assigning Maildir.serializer to #<Maildir::Serializer::Base:0x007fb071f37c70> from /Users/jeremy/repos/git/maildir/test/test_serializers.rb:34:in `block (3 levels) in <class:TestSerializers>'
.assigning Maildir.serializer to #<Maildir::Serializer::YAML:0x007fb073a6a0b0> from /Users/jeremy/repos/git/maildir/test/test_serializers.rb:34:in `block (3 levels) in <class:TestSerializers>'
.assigning Maildir.serializer to #<Maildir::Serializer::JSON:0x007fb0739ebe68> from /Users/jeremy/repos/git/maildir/test/test_serializers.rb:34:in `block (3 levels) in <class:TestSerializers>'
#!/usr/bin/env ruby
# A more general case of finding all of the classes in a hierarchy
#
# Inspired by Nick Sieger's excellent article
# http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy/
#
top_class = Exception
prune_below = [ SystemCallError ]
outer_modules_to_skip = %w[ Gem ]
@copiousfreetime
copiousfreetime / output.txt
Last active August 29, 2015 14:14
sort_vs_sort_by.rb
jeremy@ample-3:~/tmp ruby-2.1.5@default % ruby sort_vs_sort_by.rb
Rehearsal ------------------------------------------------------------------------------
#sort array of hashes 0.760000 0.010000 0.770000 ( 0.759593)
#sort_by array of hashes 0.290000 0.000000 0.290000 ( 0.299255)
#sort array of strings 0.550000 0.000000 0.550000 ( 0.554952)
#sort_by array of strings 0.280000 0.000000 0.280000 ( 0.276396)
#sort direct array of strings 0.100000 0.010000 0.110000 ( 0.102575)
#sort_by array of strings(2) (no counting) 0.260000 0.000000 0.260000 ( 0.266884)
--------------------------------------------------------------------- total: 2.260000sec
@copiousfreetime
copiousfreetime / a.rb
Last active August 29, 2015 14:10
Roda App with sub applications
class A < ::Roda
def do_a_thing
# ...
end
route do |r|
r.get 'thing' do
do_a_thing
end
end
@copiousfreetime
copiousfreetime / a.rb
Last active August 29, 2015 14:10
mult_route roda app
class A < ::Roda
def do_a_thing
# ...
end
# route('a') do |r| -- doesn't work
::App.route('a') do |r|
r.get 'thing' do
do_a_thing # Method not Found
end
@copiousfreetime
copiousfreetime / vectra-output.txt
Created October 2, 2014 22:45
vektra-output.txt
Please specify a github user to pull keys from
jeremy@ample-3:~ ruby-2.1.2@default % ./alpha.sh copiousfreetime
++echo 'Booting vektra outpost instance...'
Booting vektra outpost instance...
++vektra boot
! Creating VM
+ Downloading image from vektra.com...
+ Image size: 1007489536 bytes
344.81 MB / 960.82 MB [===========================================>-----------------------------------------------------------------------------] 35.89 % 2.97 MB/s 3m27s960.82 MB / 960.82 MB [=============================================================================================================================] 100.00 % 2.78 MB/s
+ Image downloaded!
#!/usr/bin/env ruby
require 'rake/clean'
require 'rake/testtask'
task :default => [:spec, :test]
task :spec do
sh "rspec ."
end