Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install libgpgme11-dev

sudo gem install ruby-gpgme

$ gem sources -a http://gems.whatever.com

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

def alexandra
p "hello alexandra. how old are you?"
age = gets.chomp
age.to_i.times { p "HAPPY BIRTHDAY" ; sleep 1 }
"ROARRRR!!!"
end
.container {
width: 96%;
max-width: 920px;
margin: auto;
padding: 2px;
}
.site {
color: #383838;
padding-top: 70px;
@rodreegez
rodreegez / gemfile.sh
Created May 28, 2013 18:21
Create a Gemfile with the specified gems.
#!/bin/bash
# Usage:
#
# $ gemfile sinatra
# $ cat Gemfile
# source 'https://rubygems.org'
# gem 'sinatra'
function gemfile {
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 February 13, 2012 17:36
Ruby 1.9.2 Load paths

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
# 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 18:15
Retrive S3 files with Fog
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