Skip to content

Instantly share code, notes, and snippets.

View mtford90's full-sized avatar

Michael Ford mtford90

View GitHub Profile
@mtford90
mtford90 / bug_fixed_position_field.py
Created March 29, 2014 13:02
proposed bug fix for django-positions #26
from positions import PositionField
class BugFixedPositionField(PositionField):
def pre_save(self, model_instance, add):
#NOTE: check if the node has been moved to another collection; if it has, delete it from the old collection.
previous_instance = None
collection_changed = False
if not add and self.collection is not None:
@mtford90
mtford90 / gist:2182d9b6d6b17b417646
Last active November 15, 2019 23:01
Better fonts
@mtford90
mtford90 / gist:a1d60c65973a4cdb4070
Created January 1, 2015 16:29
Illustrator Useful

Customisation

Useful links when using Adobe Illustrator

@mtford90
mtford90 / gist:ef8dd80681b29fe023db
Last active August 29, 2015 14:12
Cordova Stuff
var LETTERS = 'acdegilmnoprstuw';
/**
* The provided hash function with additional logging
* @param s
* @returns {number}
*/
function hash(s) {
var h = 7;
for (var i = 0; i < s.length; i++) {
Car = Collection.model('Car', {
id: 'id',
attributes: ['colour'],
properties: {
blah: {
get: function () {
return this.colour ? this.colour.toUpperCase() : this.colour;
},
// Workaround for chrome.
function Something() {
_.extend(this, {
attr: 1,
_extras = {},
__setattr__: function (key, value) {
this._extras[key] = value;
},
__getattr__: function (key) {
return this._extras[key] || 'That attribute doesnt exist yet!';
}
var oldOn = siesta.events.on;
siesta.events.on = function (event, fn) {
oldOn.call(siesta.events, event, function (e) {
$rootScope.$apply(function () {
fn(e);
})
});
}
var myAPI = {
doSomeShit: function (cb) {
// Need to preserve the binding of cb,
// but you can't do cb.this - there's no way to find out what it's bound to
cb.call(cb.this, 'arg1', 'arg2')
}
};
function MyClass() {
this.shitIsDone = false;

Useful Links

Random stuff that would be useful in making a (much better) Pocket alternative

Libraries

Content Extraction

  • readability.js - a JS library that performs text extraction
  • goose - a mature content/article extractor in scala