Skip to content

Instantly share code, notes, and snippets.

View subtubes-io's full-sized avatar
👷‍♂️
Building things

subtubes subtubes-io

👷‍♂️
Building things
  • Napa, California
View GitHub Profile
define(function (require, exports, module) {
var OptionsManager = require('famous/core/OptionsManager');
var MouseSync = require("famous/inputs/MouseSync");
var sync = new MouseSync();
function Draggable(options) {
this.options = Object.create(Draggable.DEFAULT_OPTIONS);
this._optionsManager = new OptionsManager(this.options);
@subtubes-io
subtubes-io / Famous Flipper Example
Created May 22, 2014 20:34
This code is from the Famous html5devconf
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Owner: [email protected]
* @license MPL 2.0
* @copyright Famous Industries, Inc. 2014
*/
define(function(require, exports, module) {
@subtubes-io
subtubes-io / Abstract Data Type Data Structure (ADT) JavasScript
Created April 29, 2014 15:59
Abstract Data Type Data Structure (ADT) JavasScript
(function () {
var myList;
var List = function () {
this.listSize = 0;
this.pos = 0;
this.dataStore = [];
@subtubes-io
subtubes-io / Bash Script to deploy Node App to Heroku
Last active November 1, 2020 14:31
Bash Script to deploy app to create and deploy app to Heroku use `./filename [appName]`
#!/bin/sh
echo "Creating $1"
express --css stylus $1
cd $1
touch README.md
npm install
touch run_locally.sh
chmod 777 run_locally.sh
echo "web: node app.js" > Procfile
echo "node_modules" .gitignore
@subtubes-io
subtubes-io / Recursive Function - Function Property
Created April 26, 2014 14:00
Based on example in JavaScript Ninja - John Resig Nifty little caveat regarding recursive function as a property. Key is to use a inline function
var ninja = {
chirp: function signal(n) {
if (n > 1) {
return signal(n-1) + " - chirp";
}
else{
return "chirp";
}
}
@subtubes-io
subtubes-io / Method Binding Mixin in JavaScript
Created April 26, 2014 00:11
Method binding mixing pattern using JavaScript with partial application
var methodMixin = function (func, obj){
var args = Array.prototype.slice.apply(arguments, [2]);
return function () {
func.apply(obj, args);
}
};
@subtubes-io
subtubes-io / JavaScript Mixin Pattern
Created April 25, 2014 19:16
Basic JavaScript mixin paattern
(function () {
"use strict";
var mixin = function () {
var arg,
prop,
mixedChild = { },
len = arguments.length;
for (arg = 0; arg < len; arg ++) {
@subtubes-io
subtubes-io / Recursion Example
Last active August 29, 2015 14:00
JavaScript Recursion Example
(function () {
"use strict";
var list = [
{ name: "level 1", obs: [
{name: "level 2", obs: [
{name: "level 3 a"},
{name: "level 3 b"}
]}
@subtubes-io
subtubes-io / AngularJS Webworker
Created April 23, 2014 18:47
AngularJS Webworker
(function () {
"use strict";
angular.module("exampleApp")
.factory("WebWorks", ["$q", function ($q) {
var worker = new Worker('scripts/workers/doWork.js');
var defer;
worker.addEventListener('message', function(e) {
@subtubes-io
subtubes-io / AngularJS Model Sample
Created April 23, 2014 17:33
AngularJS Model Sample
(function () {
"use strict";
angular.module("exampleApp")
.provider("Person", function () {
this.$get = [function () {
var Person = function (id) {