Skip to content

Instantly share code, notes, and snippets.

View simonexmachina's full-sized avatar

Simon Wade simonexmachina

  • Melbourne, Australia
View GitHub Profile
{
"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",
@simonexmachina
simonexmachina / index.js
Created January 28, 2014 22:21
Demonstration of nodemon's tty.isatty issue
var debug = require('debug')('foo');
debug('bar');
- 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 / 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
@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 / post.md
Created May 8, 2014 23:17
JavaScript and Object Models

JavaScript and Object Models

A "choose your own adventure" story

JavaScript is has both object-oriented and functional heritage, thanks to its two parents: Scheme and Self.

It provides first class functions and makes it simple to compose these function objects into bundles of awesome. Even though I'm an OO "true believer" at heart, I find myself composing my code using functional concepts, and use the OO approach where there's a clear benefit or where I feel that it's the best way to communicate the interface.

Object-oriented software design is by no means the only way to do software design, but it's been an immensely successful model for a very long time now, and provides a clear and well-understood mental model for thinking and communicating about software. Lots of good ideas like encapsulation, delegation, traits and composition fit well into OO design.

@simonexmachina
simonexmachina / code.md
Created May 19, 2014 02:06
BaseController

OrganisationsController

This is a sketch of what we want:

var Proto = require('uberproto'),
    resource = require('express-resource');

// in controllers/organisations.js
module.exports = function(app) {
@simonexmachina
simonexmachina / file-upload.js
Created May 30, 2014 08:42
File uploads in Node.js
var multiparty = require('multiparty'),
mkdirp = require('mkdirp'),
path = require('path'),
fs = require('fs');
module.exports = function handleFileUpload(req, res, saveDir, cb) {
var form = new multiparty.Form();
mkdirp(saveDir, function(err) {
if (err) return cb(err);
form.parse(req, function(err, fields, files) {
### Keybase proof
I hereby claim:
* I am aexmachina on github.
* I am aexmachina (https://keybase.io/aexmachina) on keybase.
* I have a public key whose fingerprint is C99E 8EA3 9A10 90C7 5D71 6D67 D63F 6167 31A6 C4BD
To claim this, I am signing this object:
@simonexmachina
simonexmachina / instructions.md
Last active August 29, 2015 14:04
Instructions for using source maps with broccoli-sass

We're currently working on making this just work, but in the interim you can use the following instructions.

Source Maps

You can enable source maps by setting sourceMap: true in the options, but it's likely that your SASS source files aren't in the output tree (and hence are not available to your dev tools over HTTP), so you'll need to tell your dev tools where to find the source files:

Instructions for Chrome