Skip to content

Instantly share code, notes, and snippets.

@mattyod
mattyod / json-schema-version.md
Created September 3, 2012 11:11
An example of how a JSON schema version attribute might be used

For example a simple schema might be:

{
  "title": "Example",
  "description": "An example",
  "version": "0.0.1",
  "properties": {
    "things": {
      "type": "array",

"required": true,

@mattyod
mattyod / GoldilocksAndTheThreeBears.js
Created September 20, 2012 11:11
Last night my wife dreamt that I left her because she wouldn't let me read my JavaScript to her. Tonight she gets this...
(function() {
var Bear = function(porridge, chair, bed) {
this.porridge = porridge;
this.chair = chair;
this.bed = bed;
return this;
};
@mattyod
mattyod / forceFailure.js
Created October 18, 2012 12:51
Catch silent failures in Jasmine
window.onerror = function() {
var args = arguments;
describe('Test Suite:', function() {
it('May have skipped tests', function() {
expect(args).toEqual([]);
});
});
};
@mattyod
mattyod / user-settings
Last active March 8, 2017 22:31
Sublime Text user settings
{
"show_full_path": true,
"rulers": [80],
"ensure_newline_at_eof_on_save": true,
"translate_tabs_to_spaces": true,
"draw_minimap_border": true,
"draw_white_space": "all",
"scroll_past_end": true,
"tab_size": 2,
"trim_trailing_white_space_on_save": true
@mattyod
mattyod / gist:4266995
Last active March 29, 2017 12:39
Sublime key bindings
[
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+v"], "command": "paste_and_indent" }
{ "keys": ["super+shift+r"], "command": "refresh_folder_list" }
]
@mattyod
mattyod / default.jade
Created March 22, 2013 14:42
Quick and dirty Jade template example for drmarkpowell
doctype html
head
link(rel='stylesheet', href='css/screen.css')
html
body
article
header
h1 My Schema
span.container {
each property, name in properties
@mattyod
mattyod / arguments
Created April 17, 2013 20:55
f'kin with arguments
function args() {
if (!arguments['0']['2']) {
arguments['0']['2'] = arguments['0']['1'];
}
return arguments;
}
function wrap() {
@mattyod
mattyod / functionalFolly
Created May 19, 2013 21:54
Functional folly
var x, // Give me a value for it to be twoo
method = function (callback) {
callback();
};
var twoo = function () {
console.log('twoo');
};
var fawlse = function () {
@mattyod
mattyod / fireGet
Created June 9, 2013 22:18
Fire a GET request.
new Image().src = 1;
@mattyod
mattyod / postcodes
Created July 9, 2013 13:24
UK post code regex
With Santander UK
(GIR( ?)0AA)|(^(?![QVX])[A-Z]((?![IJZ])[A-Z]?)[0-9][0-9]?[A-HJKSTUW]?)( ?)[0-9](?![CIKMOV])[A-Z]{2}$
Without Santander UK
(^(?![QVX])[A-Z]((?![IJZ])[A-Z]?)[0-9][0-9]?[A-HJKSTUW]?)( ?)[0-9](?![CIKMOV])[A-Z]{2}$