This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require "frank_logger/version" | |
require 'delegate' | |
require 'log4r' | |
module FrankLogger | |
class Logger < SimpleDelegator | |
def self.[](logname) | |
new(Log4r::Logger.new(logname)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[: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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyPresenter < OpenStruct | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-processing' | |
class Board | |
def positions | |
@positions ||= [ [], [], [] ] | |
end | |
def at(x,y) | |
positions[x][y] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-processing' | |
class Board | |
def positions | |
@positions ||= [ [], [], [] ] | |
end | |
def at(x,y) | |
positions[x][y] |