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
$ -> | |
# load some SVG, call render() on successful load | |
$.ajax( | |
url : "data/file.svg" | |
dataType : "xml" | |
success : render | |
) | |
render = (data) -> | |
srcPaths = SVGExtractPaths.extract data |
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
package { | |
import flash.filesystem.File; | |
import flash.filesystem.FileMode; | |
import flash.filesystem.FileStream; | |
public class LockFile { | |
private var lock : File; | |
private var lockData : String = "LOCKED: " + new Date().toTimeString(); | |
private var ensureAtomicity : Boolean; |
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
// USAGE: | |
// To use a custom cursor with a path of css/cursors/custom.cur you would do this: | |
// @include custom-cursor(css/cursors/,custom) | |
@mixin custom-cursor($baseURL, $filename) | |
cursor : url($filename + ".cur"),url($baseURL + "/" + $filename + ".cur"),default |
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
lsof | grep FILENAME | kill -9 `awk '{print $2}'` |
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
Utils = | |
Math : | |
class MathUtils | |
@clamp : (num, min, max) -> | |
return min if num < min | |
return max if num > max | |
num | |
String : |
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
# CoffeeScript makes this almost uniquely easy. | |
class Singleton | |
instance = undefined | |
@getInstance : -> | |
instance ?= new @ | |
# And a singleton class can be subclassed elegantly too. | |
class SingletonTest extends Singleton | |
constructor : -> |
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
# If you have a local test environment with a server running on (say) http://localhost:8888/ | |
# and are also using Sinatra running on http://localhost:4567/ then you will most likely run | |
# into cross-domain problems communicating between the two via JavaScript. Here's a quick | |
# fix that will work beautifully for your local testing environment _but you should not use | |
# otherwise_! | |
require "sinatra" | |
before do | |
headers "Access-Control-Allow-Origin" => "*" |
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
// Since Backbone.Model's hasChanged() function only works after "change" events... | |
Backbone.Model.prototype.hasDefaultChanged = function(prop) { | |
return this.defaults[prop] !== this.get(prop); | |
}; |
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
// Assuming you have markup like: | |
// | |
// <a class="stupid-button" href="#">I'm a fake button</a> | |
// | |
// ...you can use the following CSS to make it look like a regular WebKit button. Probably. | |
a.stupid-button | |
color : black | |
text-decoration : none | |
padding : 2px 6px |
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
/* usage: var $el = make("div", {"class" : "foo"}, "bar"); // -> <div class="foo">bar</div> */ | |
function make(t, a, c) { var e; return e = document.createElement(t), a && $(e).attr(a), c != null && $(e).html(c), e; } |
OlderNewer