Skip to content

Instantly share code, notes, and snippets.

View dblandin's full-sized avatar

devon blandin dblandin

View GitHub Profile
https://ortastuff.s3.amazonaws.com/gifs/bike.gif
https://ortastuff.s3.amazonaws.com/gifs/bug-hunting.gif
https://ortastuff.s3.amazonaws.com/gifs/cheers-boxing.gif
https://ortastuff.s3.amazonaws.com/gifs/clap-2.gif
https://ortastuff.s3.amazonaws.com/gifs/clap.gif
https://ortastuff.s3.amazonaws.com/gifs/danger.gif
https://ortastuff.s3.amazonaws.com/gifs/delisa-nah.gif
https://ortastuff.s3.amazonaws.com/gifs/delisa-one-thumb.gif
https://ortastuff.s3.amazonaws.com/gifs/delisa-two-thumbs-2.gif
https://ortastuff.s3.amazonaws.com/gifs/delisa-two-thumbs.gif
@voxxit
voxxit / USING-VAULT.md
Last active July 7, 2022 03:02
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init
@alexrothenberg
alexrothenberg / Rakefile
Created March 19, 2014 14:10
stub api calls for rubymotion calabash tests
Motion::Project::App.setup do |app|
app.info_plist['API_BASE_URL'] = ENV['API_BASE_URL'] || 'http://api.myserver.com'
end
task :cucumber => [:stub, :'build:simulator', :'calabash:run']
task :stub do
ENV['API_BASE_URL'] = 'http://stub.example.com'
end
# MODEL
class Case < ActiveRecord::Base
include Eventable
has_many :tasks
concerning :Assignment do
def assign_to(new_owner:, details:)
transaction do
@ole
ole / geocode_coordinates.rb
Created January 23, 2014 18:23
Geocodes addresses on the command line and print the geo coordinates (latitude and longitude). See http://oleb.net/blog/2014/01/geocoding-automator-service/ for more info on how I am using this script.
#!/usr/bin/env ruby
# Determines the coordinates (latitude and longitude) of the places or
# addresses passed as arguments (either on the command line or via stdin)
# and prints the results.
# This script requires the Ruby Geocoder gem by Alex Reisner
# (http://www.rubygeocoder.com).
# To install the gem, run this command from a Terminal session:
#
@alexrothenberg
alexrothenberg / ui_view.rb
Created November 21, 2013 16:23
Convenience methods for dealing with coordinates in RubyMotion
class UIView
def top
frame.origin.y
end
def left
frame.origin.x
end
def height
frame.size.height
end
@seanlilmateus
seanlilmateus / forwardable.rb
Created May 24, 2013 07:57
rubymotion Forwardable module
module Forwardable
FORWARDABLE_VERSION = "1.1.0"
@debug = nil
class << self
attr_accessor :debug
end
# Takes a hash as its argument. The key is a symbol or an array of
# symbols. These symbols correspond to method names. The value is
@sdball
sdball / sandi_metz_rules_for_developers.md
Created January 18, 2013 18:47
Rules for good development from Sandi Metz

Sandi Metz’ rules for developers

  1. Your class can be no longer than a hundred lines of code.
  2. Your methods can be no longer than five lines of code
  3. You can pass no more than four parameters and you can't just make it one big hash.
  4. In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
  5. Your view can only know about one instance variable.
  6. Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
  7. Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]
@harperreed
harperreed / Restaurants-near-1871.md
Created December 6, 2012 22:32
Restaurants near 1871

#Restaurants near 1871

Help curate this list. start filling out the data and links about each place and add places!


##Cheap

  • Protein Bar
    • Phone: (312) 346-7300
    • Address: 222 Merchandise Mart Plaza Chicago, IL 60654
@ryanb
ryanb / issues_with_modules.md
Created November 29, 2012 22:38
Points on how modules can make code difficult to read.

My issues with Modules

In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.

A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval.

You can find instance_eval used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.

class Article &lt; ActiveRecord::Base