Skip to content

Instantly share code, notes, and snippets.

View simonexmachina's full-sized avatar

Simon Wade simonexmachina

  • Melbourne, Australia
View GitHub Profile
@simonexmachina
simonexmachina / anagramma.coffee
Created April 14, 2014 01:41
CoffeeScript is beautiful
fs = require 'fs'
_ = require 'underscore'
input = '/Users/simonwade/Downloads/wl.txt'
dictionary = fs.readFileSync(input).toString().split('\n')
anagram = (w)->
anagrams = []
chars = countChars w
for word in _.filter dictionary, (word)-> word.length == w.length
@simonexmachina
simonexmachina / gist:9357528
Created March 4, 2014 22:59
Ember Data Pagination

Ember Data's moved on quite a bit since I wrote my pull request, so I'd need to do it again. I've decided to lay out the case here and if you and the other members of the team feel it's a good idea then I'll do it again.

Here's the approach that I'm advocating:

  • Whenever the store asks the adapter to fetch some records a Request object (a new class) is created that contains the information required to request another page of results.
  • The Request object is also used to contain the sinceToken that's currently there
  • The meta object that's returned from the server is then attached to the Request object, which is attached to the returned RecordArray so that downstream users of the RecordArray (eg. ArrayControllers) have access to the page number, page size and the total number of records
  • RecordArrays would have two new methods: fetchPage() and fetchMore(), which would use the information in the Request object to perform another fetch from the server.
  • Adapters can control the para
- Icon sizes
- Conversation icon is now too small
- Header bar
- Even up the padding above and below the text, this will reduce size of the header bar
- All icons are now too big
- Antialiasing in the sprite
- Let's do separate 1x and 2x sprite images
@simonexmachina
simonexmachina / index.js
Created January 28, 2014 22:21
Demonstration of nodemon's tty.isatty issue
var debug = require('debug')('foo');
debug('bar');
{
"name": "medianode",
"version": "0.0.1-1",
"description": "A platform that allows planners and publishers to build, RFP, commit and invoice in a simple user friendly interface.",
"author": "Simon Wade <[email protected]>",
"main": "index.js",
"repository": "[email protected]:LaunchEngine/medianode.git",
"scripts": {
"test": "grunt test",
"start": "node index.js",
info: Welcome to Nodejitsu aexmachina
info: jitsu v0.13.9, node v0.10.24
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node index.js
info: Creating snapshot 0.0.1-1
info Uploading: [=============================] 100%
error: Error running command deploy
error: npm exited with code 1
error: npm installation failed, please double check your package.json dependencies
@simonexmachina
simonexmachina / login_test.js
Created January 23, 2014 04:47
moduleFor() usage
import api from 'mn/utils/api';
import {moduleFor, test} from 'mn/tests/helpers/module_for';
var App, sandbox;
moduleFor('controller:login', 'Acceptances - Login', {
setup: function() {
App = startApp();
sandbox = sinon.sandbox.create();
},
@simonexmachina
simonexmachina / instructions.md
Created January 9, 2014 02:15
Node.js install instructions for Ubuntu 12
sudo apt-get update
sudo apt-get install git nodejs npm ruby1.9.1 -y
~~sudo ln -s nodejs /usr/bin/node~~
sudo npm config set registry http://registry.npmjs.org/
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm install npm grunt-cli forever -g
sudo gem install bundler
@simonexmachina
simonexmachina / Gruntfile.js
Last active December 29, 2015 01:39
EAK Gruntfile
module.exports = function(grunt) {
// To support Coffeescript, SASS, LESS and others, just install
// the appropriate grunt package and it will be automatically included
// in the build process:
//
// * for Coffeescript, run `npm install --save-dev grunt-contrib-coffee`
//
// * for SASS (SCSS only), run `npm install --save-dev grunt-sass`
// * for SCSS/SASS support (may be slower), run
// `npm install --save-dev grunt-contrib-sass`
@simonexmachina
simonexmachina / upstart.conf
Last active December 26, 2015 22:59
upstart.conf for Ghost.js, or any other Node.js program
#!upstart
#
# An example upstart script for running a Node.js process as a service
# using Forever as the process monitor. For more configuration options
# associated with Forever, see: https://github.com/nodejitsu/forever
#
# You will need to set the environment variables noted below to conform to
# your use case, and should change the description.
#
description "Example upstart script for a Node.js process"