Skip to content

Instantly share code, notes, and snippets.

@gfranko
gfranko / app.build.js
Last active October 12, 2015 14:58
Backbone-Require-Boilerplate (BRB) Mobile and Desktop Build Configuration with almond.js
// Node.js - Require.js Build Script
// To run the build type the following: node app.build.js
// Loads the Require.js Optimizer
var requirejs = require('../public/js/libs/r.js');
// Sets up the basic configuration
var baseConfig = {
@gfranko
gfranko / Command Line Error Log
Created November 3, 2012 04:07
Nodejitsu Error
$ jitsu deploy
info: Welcome to Nodejitsu gregfranko
info: jitsu v0.10.4, node v0.8.9
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in server.js
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /Users/gregfranko/OS/FantasyMMA/package.json
data:
@gfranko
gfranko / jquery.ui.widget.js
Created February 10, 2013 19:44
AMD Compatible jQueryUI Widget Factory
/*! jQuery UI - v1.10.0 - 2013-02-10
* http://jqueryui.com
* Includes: jquery.ui.widget.js
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */
;(function (widgetFactory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.ui.widget", ["jquery"], function() {
@gfranko
gfranko / app.js
Created April 4, 2013 19:53
Method to check if an element is visible. Detects if another element is absolutely positioned on top of it. Should work in IE9+, Firefox 3+, Chrome, and Safari.
isVisible(document.getElementById('at-follow'));
@gfranko
gfranko / example.js
Last active December 19, 2015 22:39
Ember.js Views - It would be amazing if Ember Views would allow you to pass an events object of key/value event delegation mappings (similar to Backbone Views). Right now you have to use event.target conditional checking, create more granular Views, or use the action Handlebars helper to trigger custom events.
App = Ember.Application.create();
App.ExampleView = Ember.View.extend({
// This removes the whole event.target ugly checking
events: {
'.example click': function() {
console.log('an example image was clicked!');
}
}
});
1. Release AMDClean.js v0.4.0:
a. Remove all `require` methods that contain empty function declarations
b. Implement Gulp.js as the build system
2. Create Gulp Plugins:
a. Jasmine-Node
3. Release DownloadBuilder.js v0.8.0:
a. Support Require.js build configurations with the r.js web builder
b. Support built-in minification with the uglify.js web minifier
1. Creating Maintainable JavaScript Libraries with AMDClean
2. Backbone.js Custom Builds
3. Grunt or Gulp?
4. Web Components & Polymer
5. The Future of jQuery Plugins - A Web Components Story
@gfranko
gfranko / example.js
Created February 7, 2014 17:56
Make Entire Tocify TOC Visible
$('#toc').tocify({
'showAndHideOnScroll': false
});
@gfranko
gfranko / index.js
Created February 10, 2014 05:28
requirebin sketch
// Checks to see if any CSS rule using inline-block also includes the IE6 and IE7 inline-block hack
// If the IE hacks are not there, they are added
var css = require('css'),
_ = require('lodash'),
exampleCSS = '.example-selector { display: inline-block; }',
ast = css.parse(exampleCSS);
_.each(ast.stylesheet.rules, function(rule) {
fixIEBugs(rule);
});
@gfranko
gfranko / index.js
Created February 10, 2014 05:57
requirebin sketch
var esprima = require('esprima'),
estraverse = require('estraverse'),
escodegen = require('escodegen');
console.log('esprima', esprima);
console.log('estraverse', estraverse);
console.log('escodegen', escodegen);