Skip to content

Instantly share code, notes, and snippets.

View burtlo's full-sized avatar

Lynn Frank burtlo

View GitHub Profile
Bob = function() {
this.hey = function(message) {
if (this.isSilence(message)) {
return "Fine, be that way.";
} else if (this.isShouting(message)) {
return "Woah, chill out!";
} else if (this.isAQuestion(message)) {
return "Sure";
} else {
#! /usr/bin/env ruby
# encoding: utf-8
#
# Script to export the scripts inside the Scripts.rvdata2 data file to Data/exported_scripts as plain text Ruby files.
# If you run this script from inside RPG Maker VX Ace, I would suggest creating the Data/exported_scripts folder yourself
# as RGSS3 doesn't seem to support requiring FileUtils.
# Based on HIRATA Yasuyuki / 平田 泰行's rvdata2_dump.rb script: https://gist.github.com/hirataya/1853033
begin
require 'fileutils'
rescue LoadError
<?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>
@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
# require "frank_logger/version"
require 'delegate'
require 'log4r'
module FrankLogger
class Logger < SimpleDelegator
def self.[](logname)
new(Log4r::Logger.new(logname))
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
@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
class MyPresenter < OpenStruct
end
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]