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 'gserver' | |
class MyServer < GServer | |
def initialize(port=12345, *args) | |
super(port, *args) | |
end | |
def serve(io) | |
io.puts("The time is currently #{Time.now}") | |
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
This is gist. | |
There are none like it, but this one is somebody's. | |
It is Bob's life. | |
I must master eggs as I must master my spam. | |
Without Tom gist is useless. | |
Without gist, splatted, fried cheese with sweet chilli sauce is useless. |
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
module ColorOutput | |
RED = 31 | |
GREEN = 32 | |
YELLOW = 33 | |
BLUE = 34 | |
MAGENTA = 35 | |
CYAN = 36 | |
def self.wrap(s, start_code, end_code = nil) | |
end_code = start_code - (start_code % 10) + 9 if end_code.nil? |
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
function lshift(x, by) | |
return x * 2 ^ by | |
end | |
function rshift(x, by) | |
return math.floor(x / 2 ^ by) | |
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
class('Foo', BaseClass, function(self) -- base class is optional | |
function instanceFunction(...) | |
-- ... | |
end | |
function self.classFunction(...) | |
-- ... | |
end | |
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
tween.update(dt) | |
tween(t, goal, callback, easing) |
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
camera = {} | |
camera._x = 0 | |
camera._y = 0 | |
camera.scaleX = 1 | |
camera.scaleY = 1 | |
camera.rotation = 0 | |
function camera:set() | |
love.graphics.push() | |
love.graphics.rotate(-self.rotation) |
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
foo = { hello = 3, world = 4 } | |
bar = setmetatable({ exclamation = 5 }, { __index = foo }) | |
x = table.attributes(bar) -- I have no idea what would be a fitting name for this function | |
-- x = { hello = 3, world = 4, exclamation = 5 } |
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
@mixin transition($type, $time, $ease) { | |
-webkit-transition: $type $time $ease; | |
transition: $type $time $ease; | |
} |
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
// These are some nice reusable mixins I keep around | |
@mixin transition($type, $time, $ease) { | |
-webkit-transition: $type $time $ease; | |
transition: $type $time $ease; | |
} | |
@mixin border-radius($length) { | |
border-radius: $length; | |
-webkit-border-radius: $length; |
OlderNewer