Skip to content

Instantly share code, notes, and snippets.

var child_process = require('child_process');
// exec: spawns a shell.
child_process.exec('ls -lah /tmp', function(error, stdout, stderr){
console.log(stdout);
});
// execFile: executes a file with the specified arguments
child_process.execFile('ls', ['-lah', '/tmp'], function(error, stdout, stderr){
console.log(stdout);
var gulp = require('gulp'),
del = require('del'),
plugins = require('gulp-load-plugins')(),
bower = require('main-bower-files'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
browserify = require('browserify'),
browserSync = require('browser-sync');
var conf = {
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface RunInThread {
}
var mock = function (constr, name) {
var HelperConstr = function(){};
HelperConstr.prototype = constr.prototype;
var result = new HelperConstr();
for (var key in constr.prototype) {
try {
if (constr.prototype[ key ] instanceof Function) {
result[ key ] = jasmine.createSpy(( name || 'mock' ) + '.' + key);
}
} catch (ex) {
define(['underscore'
], function (_) {
'use strict';
describe('a spy', function () {
console.log('settings check in <<<');
var foo, bar = null;
beforeEach(function () {
@lijie2000
lijie2000 / uri.js
Created April 29, 2014 15:38 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"