Skip to content

Instantly share code, notes, and snippets.

View simonexmachina's full-sized avatar

Simon Wade simonexmachina

  • Melbourne, Australia
View GitHub Profile
- 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 / 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

@simonexmachina
simonexmachina / changes.diff
Last active August 29, 2015 14:04
token-auth adapter
diff --git a/modules/token-auth/models/UserInterface.js b/modules/token-auth/models/UserInterface.js
index ff14924..39e88a1 100644
--- a/modules/token-auth/models/UserInterface.js
+++ b/modules/token-auth/models/UserInterface.js
@@ -44,3 +44,17 @@ UserInterface.findByUsername = function(username) {};
@return Promise A promise that yields an instance
*/
UserInterface.findById = function(id) {};
+
+/**
junk@0.3.0 node_modules/ember-cli/node_modules/bower/node_modules/junk
stringify-object@0.2.1 node_modules/ember-cli/node_modules/bower/node_modules/stringify-object
supports-color@0.2.0 node_modules/ember-cli/node_modules/bower/node_modules/chalk/node_modules/supports-color
object-assign@0.3.1 node_modules/ember-cli/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/object-assign
npm WARN unmet dependency /Users/simonwade/Temp/npm-test/node_modules/ember-cli/node_modules/bower/node_modules/bower-json requires graceful-fs@'~2.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
intersect@0.0.3 node_modules/ember-cli/node_modules/bower/node_modules/bower-json/node_modules/intersect
assert-plus@0.1.2 node_modules/ember-cli/node_modules/bower/node_modules/insight/node_modules/request/node_modules/http-signature/node_modules/assert-plus
npm WARN unmet dependency /Users/simonwade/Temp/npm-test/node_modules/ember-cli/node_mod
@simonexmachina
simonexmachina / README.md
Last active August 29, 2015 14:06
offlien-data readme

offline-data

A general-purpose, minimal solution for offline-first data access.

This module consists of two components for achieving offline capability, a DataCache for reads and an UpdateQueue for writes:

  • DataCache is a cache for HTTP (GET) data, backed by a PouchDB database that's continuously synced from a remote master database so that the cache contains all your data when you're offline.
  • UpdateQueue is a persistent queue for HTTP (POST and PUT) requests that will handle queing requests to the server and sending them when a connection becomes available.

DataCache