Skip to content

Instantly share code, notes, and snippets.

@crishushu
crishushu / build.js
Last active August 29, 2015 14:17 — forked from jrburke/build.js
//Download jquery.js and place it in the build, do not use require-jquery.js
//in the build, since each of the build layers just needs almond and not the
//full require.js file.
//This file is run in nodejs to do the build: node build.js
//Load the requirejs optimizer
var requirejs = require('./r.js');
//Set up basic config, include config that is
//common to all the requirejs.optimize() calls.
@crishushu
crishushu / mocha-controller.js
Last active September 14, 2017 21:46
MochaJS: Mocha controller for Node
var Mocha = require("mocha");
var mocha = new Mocha();
var _suites = [];
var _done = false;
/**
* default mocha options
* for other configurations, check out bin/_mocha
*/
mocha.reporter("nyan");
@crishushu
crishushu / grunt-client-debugger.js
Last active August 29, 2015 14:02
Gruntjs: Skeleton for client-side debugging
module.exports = function(grunt) {
grunt.initConfig({
npmEnv: '', // path to node_modules folder
debugPort: '', // debugger port
connectPort: , // connector port 35725
base: '.', // path to index
watch: {
refresh: {
options: {
livereload: '<%= connect.options.livereload %>'
@crishushu
crishushu / grunt-node-debugger.js
Last active August 29, 2015 14:02
Gruntjs: Skeleton for node debugging
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
npmEnv: '', // path to node_modules folder
debugPort: '', // port to debug node
debugFile: '', // file to debug
concurrent: {
dev: {
tasks: ['nodemon', 'node-inspector'],
@crishushu
crishushu / load.js
Created June 5, 2014 09:21
JavaScript: Async js/css file loader
function load (arr, suc, err) {
var libs = [];
for (var i = 0, len = arr.length; i < len; i++) {
var el = arr[i];
// var domElem = null;
var extension = el.split(".")[el.split(".").length - 1];
switch (extension) {
case "css":
(function() {
$("<link/>", {
// Typical AMD factory that returns a value, but uses an r-value (sync) require(),
// rather than a long, awkward dependency list.
// You cannot use module.exports or exports to declare the module:
(function (define){
define(function (require) {
"use strict";
var mod = require('pkb/modA');
return {