Skip to content

Instantly share code, notes, and snippets.

View burtlo's full-sized avatar

Lynn Frank burtlo

View GitHub Profile
@burtlo
burtlo / sample_entry.markdown
Created October 16, 2013 21:13
Developers are using Octopress to deliver information to other developers. It is important that we consider those other developers when creating our content and how that content is displayed. Defining a custom liquid tag helps you represent your content in a way that is easy to understand. The following gist contains all the content you need to …

To get started with Rails we need to install the gem. From the terminal type:

{% terminal %}
$ gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
...
{% endterminal %}
require 'ruby-processing'
class Board
def positions
@positions ||= [ [], [], [] ]
end
def at(x,y)
positions[x][y]
require 'ruby-processing'
class Board
def positions
@positions ||= [ [], [], [] ]
end
def at(x,y)
positions[x][y]
require 'ruby-processing'
class Board
def positions
@positions ||= [ [], [], [] ]
end
def at(x,y)
positions[x][y]
class MyPresenter < OpenStruct
end
@burtlo
burtlo / finders.rb
Last active December 24, 2015 15:09
Class Macros
module Finders
def find_by(*attributes)
attributes.each do |attribute|
define_method("find_by_#{attribute}") do |criteria|
puts "Finding by #{attribute} with #{criteria}"
all.find{|c| c.send(attribute).to_s == criteria.to_s}
end
end
end
end
[:a,:b,:c].reverse_each.with_index do |item,index|
puts "#{item} #{index}"
end
# c 0
# b 1
# a 2
module Enumerable
def each_with_reverse_index
# require "frank_logger/version"
require 'delegate'
require 'log4r'
module FrankLogger
class Logger < SimpleDelegator
def self.[](logname)
new(Log4r::Logger.new(logname))
end
@burtlo
burtlo / gist:6597209
Created September 17, 2013 16:58
Chicken and the Egg
$ spree install --auto-accept
gemfile spree
gemfile spree_gateway
gemfile spree_auth_devise
run bundle install from "."
https://github.com/spree/spree_gateway.git (at master) is not checked out. Please run `bundle install`
~/mystore/ ruby-2.0.0
$ bundle install
Updating https://github.com/spree/spree_gateway.git
<?xml version="1.0" encoding="utf-8"?>
<Options>
<Game>
<HideCursor>true</HideCursor>
<MinimapOpacity>0.5</MinimapOpacity>
<PickupTexts>true</PickupTexts>
<DamageTexts>true</DamageTexts>
</Game>
<Graphics>
<AmbientOcclusion>true</AmbientOcclusion>