Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
#
# Copyright (C) 2009 Torsten Becker <[email protected]>
require 'socket'
require 'uri'
* Quit Sublime Text 2 (so you don’t accidentally change any settings)
* In your Dropbox folder (usually at ~/Dropbox/), add a folder called Sublime Text 2
* Open the folder with your ST2 settings (should be ~/Library/Application Support/Sublime Text 2/)
* Copy the following 3 folders into ~/Dropbox/Sublime Text 2/: Installed Packages, Packages, and Pristine Packages
* Rename the original 3 folders in ~/Library/Application Support/Sublime Text 2/ to something like Installed Packages-20110119,
@there4
there4 / Readme.md
Created April 13, 2013 23:02 — forked from NV/Readme.md

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
/**
* SELECT2
*
* Renders Select2 - jQuery based replacement for select boxes
*
* Requires an 'options.values' value on the schema.
* Can be an array of options, a function that calls back with the array of options, a string of HTML
* or a Backbone collection. If a collection, the models must implement a toString() method
*/
Backbone.Form.editors.Select2 = Backbone.Form.editors.Base.extend({
// directly uploads to S3
// See http://philfreo.com/blog/how-to-allow-direct-file-uploads-from-javascript-to-amazon-s3-signed-by-python/
// See https://github.com/elasticsales/s3upload-coffee-javascript
editors.Filepicker = editors.Text.extend({
tagName: 'div',
events: {
'change input[type=file]': 'uploadFile',
// like 'Select' editor, but will always return a boolean (true or false)
editors.BooleanSelect = editors.Select.extend({
initialize: function(options) {
options.schema.options = [
{ val: '1', label: 'Yes' },
{ val: '', label: 'No' }
];
editors.Select.prototype.initialize.call(this, options);
},
getValue: function() {
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(chref=d.href).replace(e.href,"").indexOf("#")&&(!/^[a-z\+\.\-]+:/i.test(chref)||chref.indexOf(e.protocol+"//"+e.host)===0)&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone");
@there4
there4 / Catching clicks
Created December 7, 2012 02:29 — forked from anonymous/Catching clicks
Form handler that doesn't work in Firefox
formEvent: function (event) {
console.log(event); // "Not defined!" -- Firefox
eventType = event.target.type;
switch (eventType) {
case "checkbox":
classArray = event.target.classList;
key = classArray[0];
value = classArray[1];
@there4
there4 / vertebrates.js
Created November 6, 2012 22:03 — forked from jsvine/vertebrates.js
vertebrates.js
var Vertebrate = {};
Vertebrate.Model = Backbone.Model.extend();
Vertebrate.Collection = Backbone.Collection.extend({
model: Vertebrate.Model
});
// Source: http://en.wikipedia.org/wiki/Vertebrates
var vertebrates = new Vertebrate.Collection([