This file contains 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
-- transforms a pretty-but-difficult string into an ugly-but-easy array for tilemaps | |
local function string2Tiles(str) | |
local tiles = {} | |
local row_length = #(str:match("[^\n]+")) | |
for x = 1,row_length,1 do | |
tiles[x] = {} | |
end |
This file contains 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 'rubygems' | |
require 'rspec' | |
class Fixnum | |
ROMANS = { M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X: 10, IX: 9, V: 5, IV: 4, I: 1 } | |
def to_roman | |
ROMANS.detect do |roman, arabic| | |
diff = self - arabic | |
return "#{roman}#{diff.to_roman}" if diff >= 0 | |
end |
This file contains 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
local function _getNameFromG(theClass) | |
for k,v in pairs(_G) do | |
if v == theClass then return k end | |
end | |
return "Anonymous" -- non-global classes will get "Anonymous" | |
end | |
function Object:subclass(name) | |
local theSubClass = {...} | |
... |
This file contains 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
-- Option 1 "Conservative" | |
class("Foo", BaseClass, function(self) | |
def( "instanceMethod", function(self, param1, param2) | |
... | |
end) | |
self.def( "classMethod", function(self, param1, param2) | |
... | |
end) |
This file contains 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
context('ecomba', function() | |
context('adam', function() | |
adam = 1 | |
test('God created Adam', function() | |
assert_not_nil(adam) |
This file contains 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
tween = require 'tween' | |
function love.update(dt) | |
tween.update(dt) | |
end | |
local greenLight, yellowLight, redLight |
This file contains 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 A | |
def foo | |
baz | |
end | |
def bar | |
self.baz | |
end |
This file contains 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 'app' | |
# application-exclusive settings | |
set :smtp_port, '587' | |
set :smtp_server, 'smtp.gmail.com' | |
set :smtp_password, 'secret' | |
set :smtp_user, 'my_mail@example.com' | |
set :address, 'my_mail@example.com' | |
set :domain, 'example.com' |
This file contains 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
local AliveCell = {} | |
function AliveCell:new(neighbors) | |
return setmetatable({neighbors = neighbors}, {__index = self}) | |
end | |
function AliveCell:willLive() | |
return cell.neighbors > 1 and cell.neighbors < 4 | |
end |
This file contains 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
object(stdClass)#134 (16) { | |
["menu"]=> | |
string(0) "" | |
["container"]=> | |
bool(false) | |
["container_class"]=> | |
string(0) "" | |
["container_id"]=> | |
string(0) "" | |
["menu_class"]=> |
OlderNewer