Skip to content

Instantly share code, notes, and snippets.

View newtriks's full-sized avatar

Simon Bailey newtriks

View GitHub Profile
@newtriks
newtriks / crop.js
Created February 7, 2014 14:33 — forked from arian/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
newtriks / Q_post_example.js
Created February 10, 2014 15:58
Example HTTP POST with JSON body data using Q based on reported issue https://github.com/kriskowal/q-io/issues/8#issuecomment-34633958
var body = JSON.stringify({
token: 'foo',
files: files // Array of filenames
});
var headers = {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(body, 'utf8')
};
"scripts": {
"test": "grunt travis --verbose"
}
@newtriks
newtriks / no-sudo-npm.md
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 http://npmjs.org/install.sh or simply download via your browser. This is a shell script from npmjs.org and I found to be safe to run, please ensure you're happy before executing the script.
  4. sh install.sh (note: not sudo)
@newtriks
newtriks / app.js
Created July 8, 2014 11:02
Example using provider and ng-mixin
angular.module('app', []).config(require('./common/exceptions’));
@newtriks
newtriks / gist:eae45ff9d9aeb9788bb0
Created July 30, 2014 14:34
sublime find filters
-*.min.js,-*.min.map,-app/_bower_components/*,-node_modules/*,-.tmp/*,-.jekyll/*,-.sass-cache/*,-dist/*,-public/*,-tmp/*,-vendor/bundle/*
@newtriks
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
osascript -e 'display notification "Reloaded browser..." with title "LiveReload"'
package
{
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard;
import mx.controls.PopUpButton;
@newtriks
newtriks / gist:1016612
Created June 9, 2011 12:09
Run command with rake test
task :default => :list do
%x{touch readme.txt}
end
task :list do
@dump=%x{ls}
puts "Directory contents: #{@dump}"
end
@newtriks
newtriks / FlexTestRunner.mxml
Created June 10, 2011 15:35
Flex ASUnit4 TestRunner
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="800"
minHeight="600"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import asunit.core.TextCore;