Skip to content

Instantly share code, notes, and snippets.

@jakobo
jakobo / evernote.js
Created August 24, 2012 07:17
Interesting Bits from Felocity.com's node.js implementation
/*
[SHARD] - your evernote shard
Right click on a note and copy it's Public URL. You will have something like
https://www.evernote.com/shard/s7/sh/...
the bit after "shard/" is the shard for your public notes. In the above, it's "s7"
[USER_ID] - your user id
You can get this by visiting a shared notebook in your account. It's also another
way to get your shard information, as the "shard/NN" string will also be present
there
@jakobo
jakobo / perferences.json
Created August 24, 2012 06:26 — forked from thegilby/perferences.json
My Sublime Text 2 config
{
"__urls__": [
"I do this to preserve comments between reloads",
"1. https://github.com/buymeasoda/soda-theme",
"2. install color addon",
"3. install Package Control",
"4. add LESS and SASS packages"
],
"bold_folder_labels": true,
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
@jakobo
jakobo / original.js
Created August 17, 2012 22:25
document.createElement, Checkboxes, and IE
var cb = document.createElement("input");
cb.type = "checkbox";
cb.checked = true;
@jakobo
jakobo / sample.php
Created August 17, 2012 22:23
Snaptest and PHP Isolation Testing
<?php
class Dispatcher {
public function dispatch($call, $key_stack, $options = array()) {
// ... set up an array for child processes
// ... dispatch, collect round robin
// ... got a complete response from a child
call_user_func_array($options['thread_complete_callback'], array($results));
// ... continue until all dispatches are made for $key_stack
// ... dispatch complete callback
return call_user_func_array($options['dispatch_complete_callback'], array($results));
@jakobo
jakobo / not_thread_safe.js
Created August 17, 2012 22:18
JS Threads
var foo_count = 0;
var bar_count = 0;
var foo = function() {
++foo_count;
window.setTimeout(bar, 5);
};
var bar = function() {
++bar_count;
alert("foo="+foo_count+", bar="+bar_count);
@jakobo
jakobo / transaction_entity.php
Created August 17, 2012 22:16
Reversable Transaction Entities
<?PHP
/**
* Required Include Files
*/
require_once(DIR_CLASSES . 'container/datatypecontainer.php');
class TransactionEntry
{
function TransactionEntry()
{
$this->Container = new DataTypeContainer();
@jakobo
jakobo / bank_transaction_manager.php
Created August 17, 2012 22:14
PHP transaction managers
<?php
$btm = new BankTransactionManager($transaction);
// create entry (Account, Entry Type)
$e = $btm->createEntry("Gold.Gold");
$e->setUserId($user_id);
$e->addGold($gold_amount);
$btm->addEntry($e);
$e = $btm->createEntry("ServerGold.Gold");
var createScriptNode = (function() {
var testScr = document.createElement("script"),
property = "innerHTML";
testScr.type = "text/javascript";
try {
testScr.text = ";";
property = "text";
}
catch(e) {}
return function(code) {
exports.increment = function(val) {
return val + 1;
};
@jakobo
jakobo / common.js
Created December 21, 2011 18:56
dependency injection
var foo = require("foo"),
bar = foo.bar;
exports.bar = bar;