(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
}; | |
NodeList.prototype.__proto__ = Array.prototype; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Writing JS for everything is great and all, but I don't want to see JS | |
// inline in my Jade templates. Thankfully, there are ways of abstrating it | |
// into mixins! | |
// Want some Rails-like helpers? | |
mixin link_to(name, href) | |
- href = href || "#" | |
a(href="#{href}")= name | |
// How about a single editing point for a class name? |
This gist was prompted by Nigel Small’s tweet of a query to generate a unique id for a node (and is posted here with his agreement). It inspired me to think about how it could be used in a full example, unrestricted by Twitter’s 140 characters. I have also looked at how we could generate different sets of unique ids for different labels.
Auto-incrementing #Neo4j counter
MERGE (x:Counter {name:'foo'})
ON CREATE SET x.count = 0
ON MATCH SET x.count = x.count + 1
RETURN x.count
— Nigel Small (@technige) December 16, 2013
This is a curated set of conventions and best practices for Stylus, an expressive, dynamic, robust and advanced CSS preprocessor. Frustrated with there not being a set of conventions set in place (that could be easily found), I set forth to find out on my own.
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
$.ajaxSetup({ | |
beforeSend: function (xhr) { | |
xhr.setRequestHeader('X-Bottle-CsrfToken', '{{ session.csrf }}') | |
} | |
}); |
class @VideoProgressTracker | |
constructor: (@video) -> | |
@played_five_seconds = 0 | |
@checkpoints = [0, 25, 50, 75, 95] | |
track: -> | |
@played_five_seconds += 1 | |
@triggerCheckpoints(500 * @played_five_seconds / @duration) | |
start: -> |
#Relevent parts to explain action, routes in Ember 1.0pre
##Action Helper
The {{action}}
helper registers an HTML element within a template for
DOM event handling and forwards that interaction to the Application's router,
the template's Ember.View
instance, or supplied target
option (see 'Specifiying a Target').
User interaction with that element will invoke the supplied action name on
the appropriate target.
(Example without Router skipped, check helpers/action.js)