Skip to content

Instantly share code, notes, and snippets.

noah iamnoah

Block or report user

Report or block iamnoah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View console.viz.js
/**
* Usage:
console.viz("digraph foo { a -> b; }");
*/
(function(global) {
"use strict";
if (!global.console) {
return;
}
@iamnoah
iamnoah / SassMeister-input.scss
Created Jul 22, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
.bar {
color: green;
}
View canjs_with_react.js
define(function(require) {
var compute = require("can/observe/compute/compute");
/**
* Simple mixin that allows using CanJS Maps, Models and computes in React components.
*
* The render method becomes a compute. Any change calls forceUpdate.
* React will take the new virtual DOM and efficiently update the real DOM
* only if needed.
*
@iamnoah
iamnoah / webServer.groovy
Created Mar 6, 2014
Minimal Groovy for a static webserver. Suitable for use with gradle run
View webServer.groovy
/**
* Usage:
groovy webServer.groovy [-Pport=80] [-PwebRoot=/path/to/files]
*
* Or with gradle, place in src/main/groovy, and place assets in src/main/webapp
* and use as the mainClassName.
*/
import com.sun.net.httpserver.*
// only supports basic web content types
@iamnoah
iamnoah / steal-warn.js
Created Sep 14, 2013
Convert steal.dev.warn calls to console.warns
View steal-warn.js
/**
* Shaper for cleaning up steal 3.2 declarations. Multiple calls are collapsed into a single
* wrapped call and non-dependant arguments are sorted.
*/
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['../shaper', '../fmt', '../ref', '../tkn'], function(Shaper, Fmt, Ref, tkn) {
"use strict"; "use restrict";
new Shaper("steal-warn", function(root) {
@iamnoah
iamnoah / amdify.js
Created Sep 14, 2013
Convert stealJS modules to AMD modules
View amdify.js
/**
* Shaper for cleaning up steal 3.2 declarations. Multiple calls are collapsed into a single
* wrapped call and non-dependant arguments are sorted.
*/
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['../shaper', '../fmt', '../ref', '../tkn'], function(Shaper, Fmt, Ref, tkn) {
"use strict"; "use restrict";
var args = process.argv,
@iamnoah
iamnoah / cleanup-modified-js.sh
Created Jul 12, 2013
Crude bash script to run my jsshaper quotes and alpha plugins on any file in the current git project that has been modified. i.e., a sort of pre-commit cleanup.
View cleanup-modified-js.sh
TARGET_DIR="`pwd`/"
cd `dirname $0`
for f in $(cd "$TARGET_DIR" && git status | grep "\.js$" | cut -c14- | awk -v root="$TARGET_DIR" '{ print root $1 }')
do
node run-shaper.js "$f" plugins/quotes.js plugins/alpha.js --source > "$f".fixed
mv "$f"{.fixed,}
done
@iamnoah
iamnoah / quotes.js
Last active Dec 19, 2015
Simple JS Shaper plugin to convert all single quoted strings to double quotes.
View quotes.js
/**
* Usage:
* 1. git clone git://github.com/olov/jsshaper.git
* 2. mv quotes.js plugins/
* 3. node run-shaper.js TARGET_FILE plugins/quotes.js --source > CORRECTLY_QUOTED_FILE
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
@iamnoah
iamnoah / alpha.js
Created Jun 4, 2013
JSShaper script to alphabetize object literals.
View alpha.js
/**
* Usage:
* 1. git clone git://github.com/olov/jsshaper.git
* 2. mv alpha.js plugins/
* 3. node run-shaper.js TARGET_FILE plugins/alpha.js --source > ALPHABATIZED_FILE
*/
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['../shaper', '../fmt', '../ref', '../tkn'], function(Shaper, Fmt, Ref, tkn) {
"use strict"; "use restrict";
View gist:4177841
/*
* jQuery++ - 1.0.0 (2012-11-23)
* http://jquerypp.com
* Copyright (c) 2012 Bitovi
* Licensed MIT
*/
(function (window, $, undefined) {
// ## jquery/dom/styles/styles.js
var getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
// The following variables are used to convert camelcased attribute names
You can’t perform that action at this time.