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
// The following is sugar for writing out in full a view constructor function, its prototype, and the boilerplate | |
// for inheriting from maria.ElementView. This sugar uses naming conventions to wire together | |
// the view with its model, controller, and their methods. | |
// | |
// A checkit.TodoView will observe a checkit.TodoModel. When the model changes, the update method below is called. | |
// When a user clicks on the todo element, the handling is delegated to the checkit.TodoController's | |
// handleRootClick method. | |
// | |
maria.ElementView.declareConstructor(checkit, 'TodoView', { | |
template: '<li><span class="todo-content"></span></li>', // the template can live elsewhere, of course |
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
(ns ^{ :doc "Library implemented eventual value abstraction." | |
:author "Irakli Gozalishvili" } | |
eventuals) | |
(defprotocol IDeferred | |
"Protocol for deferred values" | |
(-realize [this value] "Resolves deferred with this value")) | |
(defprotocol IEventual | |
"Protocol for eventual values" |
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
/* | |
It's interesting to think about event/observer libraries for the first time after years of using | |
the same library, making messes, and trying to figure out how best to build reasonably large | |
browser apps. I realize that I want an event library that eases writing MVC applications in JavaScript. | |
*/ | |
/* |
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
I'm sorry, but I have to admit, there are things in this world, which are - unfortunately awesome. | |
Cars cause pollution, the environment suffers, but a fancy new ride is - unfortunately awesome. | |
I'm chewing on a crayon, mom tells me to 'Stop it!', but it relaxes me - unfortunately awesome. | |
Diagnosis: psychosis!, I don't care, a joint first thing in the morning - unfortunately awesome. | |
"Stop nuclear energy!" you hear them screaming and I charge my smartphone - unfortunately awesome. | |
Finally a new job, gotta' get up early in the morning, getting wasted in a pub - unfortunately awesome. | |
My teeth are rotten, but they don't hurt yet, I'm not going to the dentist - unfortunately awesome. | |
I'm decorating drunken friends, it's mean indeed, - but unfortunately awesome. | |
Bad for the offspring, bad for the North-sea, bad for your head - but unfortunately awesome. |
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 each = function (Array) {"use strict"; | |
/*! all you need to `each(obj, cb [,context])` | |
* @author WebReflection | |
* @license WTFPL - http://en.wikipedia.org/wiki/WTFPL | |
* @gist https://gist.github.com/2294934 | |
*/ | |
var | |
toString = {}.toString, | |
hasOwnProperty = {}.hasOwnProperty, | |
array = toString.call([]), |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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 cloneObject(object) { | |
return extendObject({}, object); | |
} | |
function extendObject(base, object) { | |
var visited = [object]; | |
// http://en.wikipedia.org/wiki/Adjacency_list_model | |
var set = [{value: base}]; |
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
// duck typing ( maybe all you need ) | |
var me = {name: "WebReflection"}; | |
// basic class | |
function Person() {} | |
Person.prototype.getName = function () { | |
return this.name; | |
}; | |
Person.prototype.setName = function (name) { | |
this.name = name; |
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
// Here is a proposal for minimalist JavaScript classes(?), that does not | |
// introduces any additional syntax to the language, instead it standardizes | |
// approach already used by majority of JS frameworks today. | |
// !!! What is a PROBLEM!!! | |
function Dog(name) { | |
// Classes are for creating instances, calling them without `new` changes | |
// behavior, which in majority cases you need to handle, so you end up with | |
// additional boilerplate. |
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
// ==UserScript== | |
// @name Use Markdown, sometimes, in your HTML. | |
// @author Paul Irish <http://paulirish.com/> | |
// @link http://git.io/data-markdown | |
// @match * | |
// ==/UserScript== | |
// If you're not using this as a userscript just delete from this line up. It's cool, homey. |