Skip to content

Instantly share code, notes, and snippets.

View benekastah's full-sized avatar

Paul Harper benekastah

  • San Francisco
View GitHub Profile
@benekastah
benekastah / .gitconfig
Last active August 29, 2015 14:20
Git babysit - remind yourself to do the things you always forget before pushing
[alias]
babysit = !git-babysit
@benekastah
benekastah / gist:ea77ef8920268bea8580
Last active August 29, 2015 14:13
React Model Logic Brainstorm
ChartEditor = React.createClass({
datasetDidChange: function () {
this.setState({
datasets: chartioStore.get('datasets')
});
}
});
DatasetModel = React.createClass({
components: [ChartEditor],
BUILD_JS = {
'vendor': {
# ...
'include_patterns': ['vendor/javascripts/jschardet/src/*.js'],
'exclude_patterns': ['vendor/javascripts/jschardet/src/index.js'],
# ...
}
}
var $el = $('.some-element');
var clickHandler = function () {
// do things
};
$el.click(clickHandler);
// This works, but it isn't the best way
keyBindings({
@benekastah
benekastah / .gitconfig
Created April 10, 2014 17:33
Use vimdiff for git merges and diffs
[diff]
tool = vimdiff
[difftool]
prompt = false
[merge]
tool = vimdiff
[mergetool]
prompt = false
(function (root, module) {
'use strict';
if (!module) {
module = root;
}
var _keys = Object.keys || function (o) {
var keys = [];
for (var prop in o) {
@benekastah
benekastah / bit_adder.js
Created November 7, 2013 20:31
A bit adder implemented in javascript.
function assertSize(size, value) {
console.assert(size === value.length, 'size mismatch');
}
function not_1(n) {
assertSize(1, n);
return n === '0' ? '1' : '0';
}
@benekastah
benekastah / failed_test_1
Created June 11, 2013 07:44
Limejs failed unit tests on Chrome Version 27.0.1453.110 on OSX 10.8.4
5 of 5 tests executed.
3 passed, 2 failed.
Duration: 1s.
Lime Unit Tests - lime.style [FAILED]
localhost:8080/javascripts/lime/lime/tests/style.htm
6 of 6 tests run in 11ms.
4 passed, 2 failed.
2 ms/test. 58 files loaded.
ERROR in testTransform
Rotated matrix
@benekastah
benekastah / gist:4100127
Created November 17, 2012 20:47
Padrino rbx crash
Rubinius Crash Report #rbxcrashreport
Error: signal SIGILL
[[Backtrace]]
0 rbx 0x0000000107e8f476 _ZN8rubiniusL12segv_handlerEi + 486
1 libsystem_c.dylib 0x00007fff840018ea _sigtramp + 26
2 ??? 0x0000000000000006 0x0 + 6
3 rbx 0x0000000107e92715 _ZN8rubinius5abortEv + 53
4 rbx 0x0000000107f92b63 _ZN8rubinius13ZeroArguments6invokeEPNS_2VMEPNS_12NativeMethodEPNS_23NativeMethodEnvironmentERNS_9ArgumentsE + 83
@benekastah
benekastah / domStore.js
Created September 2, 2011 22:39
This is the basis for my DomStore repo (https://github.com/benekastah/DomStore)
(function ()
{
var hasProperty = Object.hasOwnProperty,
// make sure we have a trim function available
trim = String.prototype.trim || function () { return this.replace(/^\s*/, '').replace(/\s*$/, ''); },
// This function divides a string into multiple strings of a certain length.
// Some browsers limit an individual cookie to about 4000 bytes of data
// This allows us to store all the info we want by splitting an item into multiple cookies
divide = function (len)