Skip to content

Instantly share code, notes, and snippets.

@emilkaiser
emilkaiser / booli.php
Created August 24, 2012 08:20
Booli API PHP
$auth = array();
$auth['callerId'] = "YOUR_CALLER_ID";
$auth['time'] = time();
$auth['unique'] = rand(0, PHP_INT_MAX);
$auth['hash'] = sha1($auth['callerId'] . $auth['time'] . "YOUR_PRIVATE_KEY" . $auth['unique']);
$url = "http://api.booli.se/listings/?q=nacka&" . http_build_query($auth);
$curl = curl_init($url);
curl_setopt_array($curl, array(
@emilkaiser
emilkaiser / booli.py
Created August 24, 2012 08:32
Booli API Python
import httplib
import time
from hashlib import sha1
import random
import string
import json
callerId = "YOUR_CALLER_ID"
timestamp = str(int(time.time()))
unique = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(16))
@emilkaiser
emilkaiser / booli.rb
Created August 24, 2012 09:00
Booli API Ruby
require 'digest/sha1'
require 'net/http'
require "uri"
callerId = "YOUR_CALLER_ID"
time = Time.now.to_i.to_s
unique = "%.16x"%rand(9**20).to_s
hash = Digest::SHA1.hexdigest(callerId + time + "YOUR_PRIVATE_KEY" + unique)
uri = URI.parse("http://api.booli.se/listings?q=nacka&callerId="+callerId+"&time="+time+"&unique="+unique+"&hash="+hash)
@emilkaiser
emilkaiser / less-custom.js
Created October 17, 2013 07:51
Custom javascript function in less
/**
* node less-custom.js
* --> .class{width:2;height:olleh}
*/
var less = require('less.js/lib/less');
less.tree.functions.reverse = function (args) {
return new(less.tree.Anonymous)(new(less.tree.Anonymous)(args.value.split("").reverse().join("")));
}

Keybase proof

I hereby claim:

  • I am emilkaiser on github.
  • I am emilk (https://keybase.io/emilk) on keybase.
  • I have a public key whose fingerprint is CB98 9C87 897C 8652 C63F C5D5 48FB 1D58 BB38 EBA4

To claim this, I am signing this object:

@emilkaiser
emilkaiser / booli.js
Created December 9, 2014 13:19
Booli API Node.js
var http = require('http');
var querystring = require('querystring');
var crypto = require('crypto');
var shasum = crypto.createHash('sha1');
var auth = {};
auth.callerId = "YOUR_CALLER_ID";
auth.time = Math.round(Date.now() / 1000);
auth.unique = crypto.randomBytes(Math.ceil(16/2)).toString("hex").slice(0, 16);
auth.hash = shasum.update(auth.callerId + auth.time + "YOUR_PRIVATE_KEY" + auth.unique).digest("hex");