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 exec = require('child_process').exec; | |
var request = require('request'); | |
exec('echo hello world', function(err, stdout, stderr) { | |
request.post({ | |
method: 'POST', | |
url: 'http://localhost/post/this/somewhere', | |
formData: { | |
myFile: { |
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
#!/bin/bash | |
# Scans a project recursively for depreciated lodash functions | |
# | |
# Usage: lodash-depreciated [other grep options] | |
# | |
# Lodash changelog - https://github.com/lodash/lodash/wiki/Changelog#v400 | |
grep \ | |
--color=auto -r \ | |
--exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=.git --exclude-dir=build --exclude-dir=data \ |
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
/** | |
* Compile all JS files into the build directory | |
*/ | |
var scriptBootCount = 0; | |
gulp.task('scripts', ['load:config'], function() { | |
var hasErr; | |
return gulp.src(paths.scripts) | |
.pipe(gplumber({ | |
errorHandler: function(err) { | |
gutil.log(colors.red('ERROR DURING JS BUILD')); |
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
// This example uses a dynamic array of items, creating a promise for each and finally executing them via $q.limitAll with a maximum of 3 items running concurrently | |
// Assumes SomeModel is a promise based structure like $http or ngResource | |
var stuff = [ // Very big array of things to request // ]; | |
$q.limitAll(3, | |
stuff.map(function(item) { | |
return SomeModel.get({id: item}).$promise; |
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 electron = require('electron'); | |
electron.ipcRenderer | |
// Tell Conkie that we want CPU and memory info | |
.send('statsRegister', ['cpu', 'memory']) | |
// Recieve module statistics when Conkie provides them | |
.on('updateStats', function(e, data) { | |
// Update local data |
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 _ = require('lodash'); | |
var async = require('async-chainable'); | |
var memcached = require('memcached'); | |
var cache = new memcached('127.0.0.1:11211'); | |
async() | |
.forEach(_.shuffle(_.times(1000, i => i)), function(next, i) { | |
cache.get('demo.' + i, function(err, res) { | |
console.log('Hello', i, res); |