Examples for Template Contexts in Rango
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 Uncurry fun types r where | |
uncurryNP :: fun -> NP I types -> r | |
instance forall fun r t types. | |
( Uncurry fun types r | |
) => Uncurry (t -> fun) (t ': types) r where | |
uncurryNP f ((I a) :* as) = uncurryNP (f a) as | |
instance (s ~ r) => Uncurry s '[] r where | |
uncurryNP z Nil = z |
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
import Html exposing (..) | |
import Html.App as App | |
import Html.Events exposing (..) | |
import List | |
import Json.Decode as Json | |
join : List String -> String | |
join list = (List.foldr (++) "" list) | |
main : Program Never |
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 Hash | |
define_method '[]_with_try_on', do |*args| | |
if args.size == 1 and respond_to?(args.first) | |
send(:'[]_with_try_on', args.first) | |
else | |
args.inject(self.dup){|memo, e| memo.dup.delete(e) if memo.is_a?(Hash) } | |
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
class RESTController < Controller | |
def self.object_name=(object_name) | |
@@object_name = object_name | |
end | |
def self.object_name | |
@@object_name | |
end | |
# @api plugin |
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 'nokogiri' | |
app = proc do |env| | |
doc = Nokogiri::HTML('<html><head></head><body><div id="hello">Hello World</div></body></html>') | |
body = doc.css('#hello').content | |
[body, 200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.size.to_s }] | |
end | |
run app |
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 Game | |
include DataMapper::Resource | |
# | |
# Properties | |
# | |
property :id, Serial | |
# | |
# Associations |