Skip to content

Instantly share code, notes, and snippets.

Adam Rogers rodreegez

Block or report user

Report or block rodreegez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View HowToDrinkBeerCoC.md

HowToDrinkBeer Code of Conduct

All members of this public Slack channel are required to agree with the following code of conduct. Organisers will enforce this code. We are expecting cooperation from all participants to help ensuring a safe environment for everybody.

Need Help?

Contact adam@deskbeers.com, the owner of the Slack organisation that provides the #howtodrinkber channel, or one of the members of the @staff group.

The Quick Version

View niece.rb
def alexandra
p "hello alexandra. how old are you?"
age = gets.chomp
age.to_i.times { p "HAPPY BIRTHDAY" ; sleep 1 }
"ROARRRR!!!"
end
View main.css
.container {
width: 96%;
max-width: 920px;
margin: auto;
padding: 2px;
}
.site {
color: #383838;
padding-top: 70px;
@rodreegez
rodreegez / gemfile.sh
Created May 28, 2013
Create a Gemfile with the specified gems.
View gemfile.sh
#!/bin/bash
# Usage:
#
# $ gemfile sinatra
# $ cat Gemfile
# source 'https://rubygems.org'
# gem 'sinatra'
function gemfile {
View gist:3886049
trigger_app GET /apps/:id/trigger(.:format) apps#trigger
app_hooks GET /apps/:app_id/hooks(.:format) hooks#index
POST /apps/:app_id/hooks(.:format) hooks#create
new_app_hook GET /apps/:app_id/hooks/new(.:format) hooks#new
edit_app_hook GET /apps/:app_id/hooks/:id/edit(.:format) hooks#edit
app_hook GET /apps/:app_id/hooks/:id(.:format) hooks#show
PATCH /apps/:app_id/hooks/:id(.:format) hooks#update
PUT /apps/:app_id/hooks/:id(.:format) hooks#update
DELETE /apps/:app_id/hooks/:id(.:format) hooks#destroy
apps GET /apps(.:format) apps#index
@rodreegez
rodreegez / gist:1818506
Created Feb 13, 2012
Ruby 1.9.2 Load paths
View gist:1818506

via Gregory Brown (@seacreature) on Twitter:

Wrong way to deal with the 1.9.2 removal of . from the loadpath:

  1. require "./foo/bar" forces you to run code from your project root
  2. $LOAD_PATH.unshift(".") recreates security issue, and pollutes

Right way to deal with the 1.9.2 removal of . from the loadpath:

  1. require_relative "foo/bar" if you don't need Ruby 1.8 compatibility
View too_many_arrays.rb
# my_array is an array of arrays
if my_array.any?
my_array.each do |my_sub_array|
if my_sub_array.any?
my_sub_array.each do |my_thing|
my_thing.do_something
end
end
end
end
@rodreegez
rodreegez / fog.rb
Created May 14, 2011
Retrive S3 files with Fog
View fog.rb
require 'fog'
con = Fog::Storage.new(
provider: 'AWS',
aws_secret_access_key: 'ABC123',
region: 'eu-west-1',
aws_access_key_id: 'ABC123'
)
=> Fog::AWS::Storage object
@rodreegez
rodreegez / .vimrc
Created May 12, 2011
my vim settings, use at your own risk
View .vimrc
set nocompatible " Must come first because it changes other options.
call pathogen#runtime_append_all_bundles() " Pathogen
runtime macros/matchit.vim " ruby text blocks
syntax enable
set background=dark
colorscheme solarized
@rodreegez
rodreegez / gist:740759
Created Dec 14, 2010
hydra verbose output
View gist:740759
wkst-150:hydra_test Rodreegez$ time RAILS_ENV=test rake hydra
(in /Users/Rodreegez/Projects/scratch/hydra_test)
1292348265.678 MASTER| Initialized
1292348265.67811 MASTER| Files: (["test/unit/1_test.rb", "test/unit/10_test.rb", "test/unit/7_test.rb", "test/unit/9_test.rb", "test/unit/8_test.rb", "test/unit/6_test.rb", "test/unit/3_test.rb", "test/unit/2_test.rb", "test/unit/5_test.rb", "test/unit/4_test.rb", "test/functional/tags_controller_test.rb", "test/functional/blog_posts_controller_test.rb", "test/functional/authors_controller_test.rb", "test/unit/author_test.rb", "test/unit/helpers/blog_posts_helper_test.rb", "test/unit/helpers/tags_helper_test.rb", "test/unit/blog_post_test.rb", "test/unit/tag_test.rb", "test/unit/helpers/authors_helper_test.rb"])
1292348265.67816 MASTER| Workers: ([{"type"=>"local", "runners"=>2}, {"directory"=>"/Users/mint/Projects/hydra_test", "connect"=>"mini", "type"=>"ssh", "runners"=>2}])
1292348265.67818 MASTER| Verbose: (true)
Hydra Testing [>
You can’t perform that action at this time.