Skip to content

Instantly share code, notes, and snippets.

View jcreamer898's full-sized avatar
🏠
Working from home

Jonathan Creamer jcreamer898

🏠
Working from home
View GitHub Profile
@jcreamer898
jcreamer898 / ui.js
Created December 5, 2012 16:53
Using monologue.js
pane.on( "click.shares", "#versions", function() {
fileRecord.displayVersions(function( records ) {
fileRecord.emit( "versions.retrieved", {
records: records
});
});
});
pane.on( "click.shares", "#sharing", function() {
fileRecord.displayVersions(function(records) {
fileRecord.emit( "shares.retrieve", {
@jcreamer898
jcreamer898 / anvil.cdnjs.js
Created January 4, 2013 18:17
anvil.cdnjs changes
var request = require( "request" );
var path = require( "path" );
var pluginFactory = function(_, anvil) {
var root = path.resolve( __dirname, "../" );
return anvil.plugin({
// Name your plugin
name: "anvil.cdnjs",
// Activity list: "identify", "pull", "combine", "pre-process","compile", "post-process", "push", "test"
@jcreamer898
jcreamer898 / anvil.jquerymobile.js
Last active December 10, 2015 15:41
Example of using a task in an anvil scaffold
var path = require("path");
module.exports = function(_, anvil) {
var root = path.resolve(__dirname, "../");
anvil.scaffold({
type: "jqm:init",
description: "Creates a bare bones jQuery Mobile application folder structure.",
prompt: [{
@jcreamer898
jcreamer898 / anvilPluginList.js
Created January 7, 2013 18:49
Parses npm to generate a list of anvil plugins
var fs = require( "fs" ),
_ = require( "underscore" ),
request = require( "request" ),
postal = require( "postal" ),
Monologue = require( "monologue.js" )( _ ),
machina = require( "machina" ),
jsdom = require( "jsdom" );
require( "monopost" )( _, Monologue, postal );
require( "machina.postal" )( postal, machina );
@jcreamer898
jcreamer898 / backbone.monologue.js
Last active December 11, 2015 07:18
Abstract backbone's trigger method and call Monologue's emit.
// Push backbone's routing events to the buss.
var trigger = AppRouter.prototype.trigger;
AppRouter.prototype.trigger = function() {
var args = Array.prototype.slice.call( arguments, 1 );
this.emit( arguments[ 0 ], args );
trigger.apply( this, args );
};
@jcreamer898
jcreamer898 / gist:4945152
Created February 13, 2013 14:58
Difference b/w Knockout.js and Backbone.js

The main diff b/w the 2 IMO

Backbone is more customizeable and suited for larger apps.

Backbone stays out of the DOM for the most part so it's a little bit more manageable long term.

KO does great w/ smaller multi-page apps that need a lot of complex forms etc, like you said.

The thing is, you can make Backbone have the 2 way binding style of Knockout with something like https://github.com/NYTimes/backbone.stickit, it just takes more setup. But, it also might be worth the time and effor to set up.

@jcreamer898
jcreamer898 / gist:5101307
Last active December 14, 2015 14:29
A style guide for working with scss.

Sass style guild, particularly when dealing with .scss.

.container {
    /* styles for the `self` item at the top */
    width: 960px;
  
    /* When less than 3 props, do inline */
    .item { width: 100px; height: 100px; }
@jcreamer898
jcreamer898 / compass.js
Created March 15, 2013 16:00
contains bug fixes for anvil.compass
/*
anvil.compass - Compass plugin for anvil.js
version: 0.1.1
author: [object Object]
copyright: 2012
license: Dual licensed
MIT (http://www.opensource.org/licenses/mit-license)
GPL (http://www.opensource.org/licenses/gpl-license)
*/
var cp = require( "child_process" ),

I was thinking that through the use of the require in modulea, I'd be able to get a reference to the app based on what I thought I understood from http://requirejs.org/docs/api.html#circular. But, apparently I am wrong? :) Instead I get Uncaught Error: Module name "app" has not been loaded yet for context: _

@jcreamer898
jcreamer898 / Gruntfile.js
Created April 26, 2013 20:11
Simple gruntfile.js
module.exports = function ( grunt ) {
// Project configuration.
grunt.initConfig( {
concat: {
basic: {
src: [ 'jsResources/underscore-min.js',
'jsResources/product-viewer/lib/core.js',
'jsResources/product-viewer/lib/mediaplayer.js',
'jsResources/product-viewer/lib/options.js',