- Add the below build file with
Tools -> Build System -> New Build System...
- Make sure you have
Tools -> Build System -> Automatic
ticked - Install this plugin: https://github.com/alexnj/SublimeOnSaveBuild
- That should be it!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Jasmine itself | |
"lib/jasmine.js", | |
// a console reporter; this one works fine: | |
// http://code.google.com/p/phantomjs/source/browse/test/lib/jasmine-console.js | |
"lib/jasmine-console.js", | |
// your actual code | |
"src.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var regex = /^[A-Z]{1,2}[0-9]{1,2}[A-Z]? ?[0-9][A-Z]{2}$/i; | |
/** | |
* NB. This is case-insensitive and doesn't care about the whitespace. | |
* | |
* Matches these formats: | |
* | |
* AA9A 9AA | |
* A9A 9AA | |
* A9 9AA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Largely inspired by: http://stackoverflow.com/questions/9690241/rendering-svg-polygons-in-raphael-javascript-library | |
# You have, for example, this: | |
# <polygon fill="#00B8C0" stroke="#00FFFF" stroke-miterlimit="10" points="146.5,196.326 137.326,205.5 155.674,205.5 "/> | |
# You would like this: | |
# M147,196L137,206L156,206Z | |
# Assuming `xml` is your <polygon> node... | |
polygonToPath = (xml) -> | |
p = xml.getAttribute "points" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It's very common to have a class with a name like "button-23" or | |
# "container2346112" and to need to extricate just the digits. Of course | |
# this is simple, but I've seen some developers do this in weird and | |
# wonderful ways. Here's a simple way: | |
String::toDigits = -> parseInt @.replace(/\D+/g, ""), 10 | |
# Or in JavaScript: | |
`String.prototype.toDigits = function() { return parseInt(this.replace(/\D+/, ""), 10); }` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm pretty sure there isn't a built-in way of doing this; | |
# the below is one (simple) way... | |
# This assumes `paper` is your Raphael paper | |
getElementsBounds = -> | |
bottom = paper.bottom | |
elements = [] | |
while bottom | |
elements.push bottom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -disable-prompt-on-repost & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backbone.Collection's `where` is very useful for quickly selecting | |
# parts of a Collection, and it returns an array. But an array of | |
# Backbone.Models isn't terribly helpful if you want to insert that | |
# into a template which expects an array of raw objects. This might help | |
# you a little, though: | |
collectionToRaw = (collection, key) -> | |
_.map (collection.where "type" : key), (filtered) -> | |
filtered.toJSON() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your browser's developer console, put this: | |
window.onerror = function(error) { return false; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Caveat: I'm not a PHP programmer, so this may or may | |
* not be the most idiomatic code... | |
* | |
* FPDF is a free PHP library for creating PDFs: | |
* http://www.fpdf.org/ | |
*/ | |
require("fpdf.php"); | |
class PDF extends FPDF { |