Skip to content

Instantly share code, notes, and snippets.


Simon Bailey newtriks

View GitHub Profile
newtriks / crop.js
Created February 7, 2014 14:33 — forked from arian/crop.js
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 / Q_post_example.js
Created February 10, 2014 15:58
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 package.json
"scripts": {
"test": "grunt travis --verbose"
newtriks /
Created July 3, 2014 08:05
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)
newtriks / app.js
Created July 8, 2014 11:02
Example using provider and ng-mixin
View app.js
angular.module('app', []).config(require('./common/exceptions’));
newtriks / gist:eae45ff9d9aeb9788bb0
Created July 30, 2014 14:34
sublime find filters
View gist:eae45ff9d9aeb9788bb0
newtriks / gist:4f1fcef9da7dde4c91bf
Last active August 29, 2015 14:04
If using #OSX LiveReload app add to ‘Run a custom command’ which’ll display a notification #Mavericks
View gist:4f1fcef9da7dde4c91bf
osascript -e 'display notification "Reloaded browser..." with title "LiveReload"'
import flash.display.DisplayObject;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard;
import mx.controls.PopUpButton;
newtriks / gist:1016612
Created June 9, 2011 12:09
Run command with rake test
View gist:1016612
task :default => :list do
%x{touch readme.txt}
task :list do
puts "Directory contents: #{@dump}"
newtriks / FlexTestRunner.mxml
Created June 10, 2011 15:35
Flex ASUnit4 TestRunner
View FlexTestRunner.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
import asunit.core.TextCore;