Skip to content

Instantly share code, notes, and snippets.


Simon Bailey newtriks

View GitHub Profile
View gist:eae45ff9d9aeb9788bb0
newtriks / app.js
Created Jul 8, 2014
Example using provider and ng-mixin
View app.js
angular.module('app', []).config(require('./common/exceptions’));
newtriks / bower.js
Created Jul 3, 2014
Gulp task to run bower install/update and remove dependencies.
View bower.js
var gulp = require('gulp');
var bower = require('bower');
var del = require('del');
var _ = require('lodash');
var deleteDeps = function (deps, cb) {
var path = bower.config.cwd + "/" +;
_.each(deps, function (dep) {
del(path + "/" + dep, function (e) {});
newtriks /
Last active Nov 7, 2015
Project setup for: angular, gulp, bower, testem and protractor
  1. Install global dependencies: npm install -g browserify gulp bower testem protractor
  2. Install local npm dependencies: npm install
  3. Install local bower dependencies: gulp bowerInstall
  4. Install Protractor specific webdrivers: webdriver-manager update
  5. Build project into dist directory: gulp build
  6. Run application on local webserver plus watch for changes: gulp watch
  7. Run unit tests: testem
  8. Run end-to-end tests: gulp protractor (gulp watch must be running in as another process i.e. in another console window).
newtriks /
Created Jul 3, 2014
Non-sudo npm -g installation
  1. npm set prefix ~/.node
  2. export PATH=$HOME/.node/bin:$PATH >> ~/.profile
  3. wget or simply download via your browser. This is a shell script from and I found to be safe to run, please ensure you're happy before executing the script.
  4. sh (note: not sudo)
View package.json
"scripts": {
"test": "grunt travis --verbose"
newtriks / Q_post_example.js
Created Feb 10, 2014
Example HTTP POST with JSON body data using Q based on reported issue
View Q_post_example.js
var body = JSON.stringify({
token: 'foo',
files: files // Array of filenames
var headers = {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(body, 'utf8')
View crop.js
var spawn = require('child_process').spawn;
var Stream = require('stream');
* crops and resizes images to our desired size
* @param {Stream} streamIn in stream containing the raw image
* @return {Stream}
exports.cropImage = function(streamIn){
newtriks / file.js
Created Feb 6, 2014
NodeJS module to download multiple files from Amazon S3
View file.js
#!/usr/bin/env node
var Q = require('q'),
FS = require('fs'),
PB = require('progress'),
AWS = require('aws-sdk'),
conf = new require('../config')();
package net.fkasoft.wowzamod;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;