This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function xhr(options) { | |
| var deferred = Q.defer(), | |
| req = new XMLHttpRequest(); | |
| req.open(options.method || 'GET', options.url, true); | |
| // Set request headers if provided. | |
| Object.keys(options.headers || {}).forEach(function (key) { | |
| req.setRequestHeader(key, options.headers[key]); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(['underscore' | |
| ], function (_) { | |
| 'use strict'; | |
| describe('a spy', function () { | |
| console.log('settings check in <<<'); | |
| var foo, bar = null; | |
| beforeEach(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
NewerOlder