(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.
# config/initializers/teaspoon.rb | |
module Teaspoon | |
module BootHelper | |
def create_browserify_bundle(suite) | |
bundle = File.join(Rails.root, 'tmp/javascripts', "suites/#{suite.name}.js") | |
bundle_dir = File.dirname(bundle) | |
FileUtils.mkdir_p(bundle_dir) unless File.directory?(bundle_dir) | |
specs = suite.spec_assets(false).map { |asset| "#{asset.gsub(/\.js.*$/, '')}" } |
/* global Application, ObjC, $ */ | |
/** | |
* repozish.js | |
* | |
* this is an example of using os x yosemite's "JavaScript for Automation": | |
* | |
* https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html | |
* | |
* it repositions some windows based on some position settings. you can run |
var EventEmitter = require('events').EventEmitter, | |
_ = require('lodash'); | |
/** | |
* Creates an action functor object | |
*/ | |
exports.createAction = function() { | |
var action = new EventEmitter(), | |
eventLabel = "action", |
(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.
$sailsSocket.subscribe('event',function(message){ | |
if(message.verb ==='created'){ | |
$scope.events.push(message.data); | |
} | |
}); | |
$sailsSocket.get('/api/event/subscribe').success(function(data){ | |
console.log("Subscribed") | |
}); | |
$sailsSocket.get('/api/event').success(function(data){ | |
$scope.events =data; |
angular.module('myApp.directives', []) | |
.directive('myCanvas', function() { | |
return { | |
// Angular needs to know what type of usage we want to allow for this (attribute, class name, or tag). | |
// For this example, a tag is great. | |
restrict: 'E', | |
// We want to replace the original custom tag with a template | |
replace: true, |
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
// Simulate config options from your production environment by | |
// customising the .env file in your project's root folder. | |
require('dotenv')().load(); | |
// Require keystone and i18n | |
var keystone = require('keystone'), | |
i18n= require('i18n'); | |
// Initialise Keystone with your project's configuration. | |
// See http://keystonejs.com/guide/config for available options |
#!/usr/bin/env python | |
# | |
# Very basic example of using Python and IMAP to iterate over emails in a | |
# gmail folder/label. This code is released into the public domain. | |
# | |
# RKI July 2013 | |
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/ | |
# | |
import sys | |
import imaplib |