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 Node | |
attr_accessor :children | |
attr_accessor :title | |
def general_deep_copy | |
Marshal.load(Marshal.dump(self)) | |
end | |
def specific_deep_copy | |
Node.new(@title,children.map(&:specific_deep_copy)) |
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
on the client side's HTML HEAD tag you include: | |
<script src="/dictionary.js" type="text/javascript" charset="utf-8"></script> | |
<script> | |
var current_language = "italian"; | |
</script> | |
you manage current_language variable according to user's langauge | |
and where translated text is needed you use the amazing <dictkey> tag: |
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 'active_support/all' | |
class AktivRekord | |
def self.has_many what | |
define_method(what.to_s.pluralize) do | |
what.to_s.classify.constantize.find_by_id(self.send("#{what.to_s.singularize}_id")) | |
end | |
end | |
end | |
class Person < AktivRekord |
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
# encoding: utf-8 | |
def i(what) | |
"I #{what}" | |
end | |
def ♥(who) | |
"LOVE #{who}" | |
end | |
def you |
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
# encoding: utf-8 | |
def אני(what) | |
"I #{what}" | |
end | |
def ♥(who) | |
"LOVE #{who}" | |
end | |
def אותך |
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
sentence = "there is a wild rose" | |
letters = sentence.gsub(' ','').split(//) |
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
package main | |
import ( | |
"fmt" | |
) | |
func fibonaci(l uint) { | |
var fibo func(arr []uint, l uint) | |
fibo = func(arr []uint, l uint) { | |
if l == 0 { |
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
package main | |
import "fmt" | |
func fibonaci(l uint) uint { | |
var fibo func(arr []uint, l uint) uint | |
var ret uint | |
fibo = func(arr []uint, l uint) uint { | |
if l > 2 { | |
ret = fibo([]uint{arr[1], (arr[0] + arr[1])}, l-1) |
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 Action | |
end | |
module Carry | |
include Action | |
end | |
module ShowOff | |
include Action | |
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
hello |
OlderNewer