Skip to content

Instantly share code, notes, and snippets.

View makevoid's full-sized avatar
:atom:
coding

Francesco 'makevoid' Canessa makevoid

:atom:
coding
View GitHub Profile
@makevoid
makevoid / stringify_recursive.rb
Last active May 22, 2020 04:19 — forked from edvardm/symbolize_recursive.rb
Recursively symbolize ruby hash keys in a nested structure. Uses refinements instead of monkey patching Hash.
# # usage:
# require_relative 'lib/stringify_helper'
# extend StringifyHelper
# using StringifyHelper
#
# { test: { foo: "bar" } }.deep_stringify_keys #=> \
# # { "test" => { "foo" => "bar" } }
module StringifyHelper
extend self
import "AssetLedger.sol";
// TODO describe rules of exchange.
// In the AF market all users benefit from a "last look" facility to prevent
// them falling foul of mechanical arb sniping by those exploiting the way
// the blockchain and smart contract data lags the real markets being tracked.
// The system proceeds through a series of batching steps, which in practice
// might correspond to some number of blocks (for example, each batching step
// corresponds to a block). Orders collected in batching step B_i are initially
// in a "pending" state although visible within the book. Orders then remain
@makevoid
makevoid / juggernaut.rb
Last active August 29, 2015 14:27 — forked from maccman/juggernaut.rb
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@makevoid
makevoid / payments_dreamcode.js
Last active August 29, 2015 14:26 — forked from gr2m/payments_dreamcode.js
Imagine you could purchase items from your store, with pure JavaScript in the browser. How would it look like? Here's what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// purchase a product with a credit card
purchase('productId')
.using( {
cc: "4556934156210213",
valid: "2016-10",
csc: "123"
} )
// purchase a product with paypal
purchase('productId')
@makevoid
makevoid / bitswitch_intel_edison_counterparty.js
Last active August 29, 2015 14:20 — forked from cryptocracy/bitswitch_intel_edison_main.js
BitSwitch Countertparty version
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:false */
/*global */
var mraa = require('mraa'); //require mraa
var request = require('request');
var _ = require('underscore')
var addr2watch = '1LJ4rddYGzT8GqwQioMNw3cYQJdwjM3Drs' // bitcoin address to watch
var assetName = 'PROG'
@makevoid
makevoid / uri.js
Created September 6, 2012 10:53 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@makevoid
makevoid / hack.sh
Created April 5, 2012 09:19 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Show Path bar in Finder"
defaults write com.apple.finder ShowPathbar -bool true
echo "Disable the Ping sidebar in iTunes"
defaults write com.apple.iTunes disablePingSidebar -bool true
@makevoid
makevoid / README.md
Created January 17, 2012 22:29
Thorrents.com JSONP embedded search example

Example of embedded http://thorrents.com search, and a tribute to Cory Doctorow ;) tnx to @thedod

See it live here.

If you want to embed this (or any other search) in an existing page:

  • Remove first and last line and paste this where you want it in the <body/>.
  • Change query to whatever you want to search (and maybe change limit).
@makevoid
makevoid / README.md
Created August 27, 2011 02:23 — forked from reborg/open_local_html_hotcocoa_webview.rb
Hotcocoa basic WebView hello world (to embed a webpp in a native one basically)

Run

if you don't have macruby and hotcocoa already:

rvm use macruby
gem i hotcocoa

ok then you can run:

hotcocoa webviewbasic

@makevoid
makevoid / install rubycocoa over rvm's 1.8.7.sh
Created November 10, 2010 05:19 — forked from thibaudgg/install rubycocoa over rvm's 1.8.7
install rubycocoa over rvm's 1.8.7
# v 1.0.1
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.1/RubyCocoa-1.0.1.tar.gz/download
~$ tar xzf RubyCocoa-1.0.1.tar.gz && rm RubyCocoa-1.0.1.tar.gz && cd RubyCocoa-1.0.1
~/RubyCocoa-1.0.1$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.1$ ruby install.rb setup
~/RubyCocoa-1.0.1$ sudo ruby install.rb install