Skip to content

Instantly share code, notes, and snippets.

View DavidSouther's full-sized avatar
💭
You can statistics syntax, not semantics.

David Souther DavidSouther

💭
You can statistics syntax, not semantics.
View GitHub Profile
# Sublime package NVM node path configuration
# Save this file in:
# ~/.config/sublime-text-2/Packages/node_env.py
import os
os.environ["PATH"] = "/home/joao/.nvm/v0.10.2/bin:/home/joao/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
print "PATH=" + os.environ["PATH"]
require("ncp").ncp("node_modules/docco/resources/parallel/", "parallel", function(err, res) { console.log("done:", arguments); });
@DavidSouther
DavidSouther / trkstr actions
Last active August 29, 2015 14:13
Song Flux Demo Code
angular.module('trkstr.player.actions', [
'songFlux'
]).factory('PlayerActions', function(songFactory){
function Action(){
this.module = this.module || 'trkstr';
this.dispatcher = songFactory.getDispatcher(this.module);
}
Action.prototype.dispatch = function(){
this.dispatcher.dispatch(this);
@DavidSouther
DavidSouther / item-component.js
Last active August 29, 2015 14:13
Musings on AtScript annotations with a Flux component.
import {Component} from 'angular'
import {template} from 'chat/message/item-template';
@Inject(['ChatActions', 'MessageStore'])
@Component({selector: 'messageItem', bindAs: 'state', template: template})
@IsolateScope({query: 'query'})
export class MessageItem {
constructor(Actions: ChatActions, Store: MessageStore}) {
this._Actions = Actions;
Question and Answer from Grantland on the Boston Olympics:
Q: Have you ever been to a party where 100 people show up, but the space provided is only really enough for about 20 of them. And only one person that lives there is actually throwing the party, so pretty much all of the people that live there are pissed off that you are there? And the one person throwing the party doesn’t actually have enough money to fund the party, so they had to ask their roommates (who already didn’t want you there) for money, just pissing them off even more? And the party apartment has furniture oddly place around it so its almost impossible to get around as is, let alone with 80% more people in it? Oh, and those roommates that live there and don’t want you there and are already pissed off? They love to drink. Mostly whiskey. So they are definitely going to abrasively let all the outsiders know how they really feel? I give you ‪#‎Boston2024‬.
A: BS: Come on, anytime you can put the Summer Olympics in a city that’s way too cra
@DavidSouther
DavidSouther / Actions.js
Created January 13, 2015 15:45
Song flux theory post
angular.module('trkstr.player.actions', [
'songFlux'
]).factory('PlayerActions', function(songFactory){
function PlayAction(track){
this.track = track;
this.purpose = 'Request a track be played.';
this.dispatcher = songFactory.getDispatcher('trkstr');
}
PlayAction.prototype.dispatch = function(){
@DavidSouther
DavidSouther / actions.js
Last active August 29, 2015 14:14
Song Flux 1 - Actions
angular.module('trkstr.player.actions', [
'songFlux'
]).factory('PlayerActions', function(songFactory){
function PlayAction(track){
this.track = track;
this.purpose = 'Request a track be played.';
this.dispatcher = songFactory.getDispatcher('trkstr');
}
PlayAction.prototype.dispatch = function(){
@DavidSouther
DavidSouther / store.js
Last active August 29, 2015 14:14
Song Flux 2 - Store Registers
PlayerFactory = function(Actions, song) {
function PlayerStore() {
global.EventEmitter.call(this);
this.dispatcher = song.getDispatcher('trkstr');
this.Events = PlayerStore.Events;
this.currentTrack = { title: "Nothing Playing..." };
this.doPlay = this.dispatcher.register(Actions.Play, this.play.bind(this));
}
PlayerStore.prototype = Object.create(EventEmitter.prototype);
@DavidSouther
DavidSouther / template.html
Created January 30, 2015 15:28
Song Flux 4 - Component Template
<!-- PlayerController Template -->
<div class="Player">
<pre class="title">playing {{ state.track.title }}</pre>
<audio
ng-if="state.track.path"
autoplay controls
ng-src="{{ state.track.path }}"
/>
</div>
@DavidSouther
DavidSouther / component.js
Created January 30, 2015 15:30
Song Flux 6 - LibraryComponent
function LibraryController(Library, Actions) {
this.Library = Library; // A library has albums, which have tracks
this.albums = Library.albums; // Updates on Library mutation events
this.Actions = Actions;
}
LibraryController.prototype.play = function(track) {
return this.Actions.Play(track).dispatch();
};