Skip to content

Instantly share code, notes, and snippets.

View nrk's full-sized avatar
🤔
はい、猫のように見えます。

Daniele Alessandri nrk

🤔
はい、猫のように見えます。
View GitHub Profile
>>> t1 = Time.new
=> Tue Aug 18 12:26:40 +02:00 2009
>>> t2 = Time.at(t1)
=> Tue Aug 18 12:26:40 +02:00 2009
>>>
>>> "t1: #{t1.object_id}"
=> "t1: 44"
>>> "t2: #{t1.object_id}"
=> "t2: 44"
>>>
@nrk
nrk / TimeOps.cs.diff
Created August 19, 2009 07:45
Testing rufus-scheduler (git 513214a) under IronRuby (git 8d1b9f3c)
diff --git a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs
index 461f7c9..efb7b33 100644
--- a/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs
+++ b/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/TimeOps.cs
@@ -53,18 +53,18 @@ namespace IronRuby.Builtins {
return new DateTime(other.Ticks, other.Kind);
}
[RubyMethod("at", RubyMethodAttributes.PublicSingleton)]
public static DateTime Create(object/*!*/ self, double seconds) {
@nrk
nrk / gist:177573
Created August 29, 2009 16:48
Testing redis-lua with Telescope
------------------------------------------------------------------------
Client initialization:
Can connect successfully [P]
Accepts an URI for connection parameters [P]
Accepts a table for connection parameters [P]
------------------------------------------------------------------------
Client features:
Send raw commands [P]
Create a new unbound command object [P]
Define commands at module level [P]
@nrk
nrk / haml_test.lua
Created September 4, 2009 10:47
Haml, Cosmo and string templates in a Mercury application
--[[
Extremely simple demo of a Mercury application that uses a various template
engines to render the final html output. The Haml support is provided by
Norman Clarke's excellent lua-haml (http://github.com/norman/lua-haml/).
]]
require 'luarocks.require'
require 'mercury'
require 'haml'
require 'cosmo'
@nrk
nrk / fibonacci.lua
Created September 10, 2009 21:33
Mercury + Haml: generating fibonacci numbers
require 'luarocks.require'
require 'mercury'
require 'haml'
module('fibonacci', package.seeall, mercury.application)
local templates = {
index = [[
%html
%head
#
# [{:op=>"and"},
# [{:op=>"="}, [{:path=>"hello"}, {:lit=>":ivan"}]],
# [{:op => "or"},
# [{:op=>"="}, [{:path=>"test"}, {:lit=>":ivan"}]],
# [{:op => ">"}, [:path => "test3", {:list => ":ivan"}]]]]
#
# hello = :ivan and (test = :ivan or test3 = :ivan)
class Parser
#!/usr/bin/ruby
require 'Qt4'
include Qt
Application.new ARGV do
Widget.new do
button_quit = PushButton.new 'Click me to quit' do
connect(SIGNAL :clicked) { Application.instance.quit }
end
@nrk
nrk / cosmo-and-mustache.lua
Created October 22, 2009 16:00
Similarities between cosmo and mustache
require 'luarocks.require'
require 'cosmo'
require 'mustache'
do
local template = "$do_cards[[$rank of $suit, ]]"
local view = {
{ rank = "Ace", suit = "Spades", show = true },
{ rank = "Queen", suit = "Diamonds", show = false },
{ rank = "10", suit = "Hearts", show = true },
@nrk
nrk / greetings-mustache.lua
Created October 23, 2009 09:24
Mercury's greetings example ported to mustache.
-- Here is mercury's greetings example ported to mustache.
-- Note that support for partial templates is still missing.
require 'luarocks.require'
require 'mercury'
require 'mustache'
module('greetings', package.seeall, mercury.application)
local templates = {
@nrk
nrk / output.txt
Created October 26, 2009 21:45
Pipelining commands in redis-lua
* PONG
* true
* 0
* 10
* 40
* 1
* 40
* {2=40}