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 Model | |
attr_accessor :x | |
def initialize | |
@observers ||= {} | |
end | |
def observe(key, callback = nil, &blk) | |
@observers[key] ||= [] | |
if block_given? |
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 Model | |
def initialize | |
@observers ||= {} | |
end | |
def observe(key, callback = nil, &blk) | |
@observers[key] ||= [] | |
if block_given? | |
@observers[key] << blk |
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
Controller: | |
Todos.popupController = SC.Object.create( | |
popupShowing: false, | |
showPopup: function(){ this.set('popupShowing', true) }, | |
hidePopup: function(){ this.set('popupShowing', false) } | |
// ... // | |
}) ; | |
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 Button | |
def initialize | |
@listeners ||= [] | |
end | |
def add_listner(listener = nil, &blk) | |
if block_given? | |
@listeners << blk | |
unless listener.nil? # borde kolla att listener är lambda här | |
@listeners << listener |
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
2597406934722172416615503402127591541488048538651769658472477070395253454351127368626555677283671674475463758722307443211163839947387509103096569738218830449305228763853133492135302679278956701051276578271635608073050532200243233114383986516137827238124777453778337299916214634050054669860390862750996639366409211890125271960172105060300350586894028558103675117658251368377438684936413457338834365158775425371912410500332195991330062204363035213756525421823998690848556374080179251761629391754963458558616300762819916081109836526352995440694284206571046044903805647136346033000520852277707554446794723709030979019014860432846819857961015951001850608264919234587313399150133919932363102301864172536477136266475080133982431231703431452964181790051187957316766834979901682011849907756686456845066287392485603914047605199550066288826345877189410680370091879365001733011710028310473947456256091444932821374855573864080579813028266640270354294412104919995803131876805899186513425175959911520563155337703996941035518275274919959802 |
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
<!--[if WorstBrowserEver]> | |
________ | |
.##@@&&&@@##. | |
,##@&::%&&%%::&@##. | |
#@&:%%000000000%%:&@# | |
#@&:%00' '00%:&@# | |
#@&:%0' '0%:&@# | |
#@&:%0 0%:&@# | |
#@&:%0 This is for good 0%:&@# | |
#@&:%0 luck trying to 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
module Test | |
class Object | |
def test | |
puts "wiee" | |
end | |
end | |
foo = Object.new | |
foo.test # => "wiee" | |
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
var Template = function(markup){ this.markup = markup; var reg_exp = /(\$[a-zA-Z0-9]+)/i } | |
Template.prototype.compile = function(vars){ | |
this.markup = this.markup.replace(this.reg_exp, function(match){ | |
var key = match.substr(1, match.length-1) | |
return vars[key] | |
}) | |
return this.markup | |
} | |
/* Usage */ |
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
<html> | |
<head> | |
<style type="text/css" media="screen"> | |
body { padding: 0; margin: 0; } | |
#header { height: 200px; background: #ccc; position: relative; padding: 10px; } | |
#menu { list-style: none; position: absolute; right: 50%; margin-right: -300px; top: 0px;} | |
#menu li { float: left; margin-right: 20px;} | |
#header h1 { position: absolute; left: 50%; margin-left: -300px; top: -10px;} | |
</style> | |
</head> |
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 { | |
config: { | |
debug: false, | |
var2: "foo", | |
limit: 5 | |
} | |
initialize: function(config){ | |
this.config.extend(config); | |
}, |
OlderNewer