Skip to content

Instantly share code, notes, and snippets.

View shatsar's full-sized avatar
🌵

Michele Zonca shatsar

🌵
View GitHub Profile
@shatsar
shatsar / keybase.md
Created September 28, 2014 13:51
Keybase proof

Keybase proof

I hereby claim:

  • I am shatsar on github.
  • I am mzonca (https://keybase.io/mzonca) on keybase.
  • I have a public key whose fingerprint is 6296 03C7 CE7E 5638 57CD C09D 139A EA2C 61A3 4D26

To claim this, I am signing this object:

@shatsar
shatsar / compile less files
Last active December 19, 2015 11:29
Shell snippet to compile every less file in the current directory with the .css suffix. It uses the ruby 'lessc' command
find "$PWD" -name '*.less' | while read line; do
OUTPUT=`echo $line | sed "s|\.less|\.css|"`
lessc -x "$line" >> "$OUTPUT"
done
@shatsar
shatsar / proxy-auth-header.txt
Created May 24, 2012 19:48
Proxy-Authorization header value
// Pseudo-code
HASH = BASE64(PUBLIC_KEY + ":" + HMAC_SHA1(PUBLIC_KEY, PRIVATE_KEY) )
@shatsar
shatsar / gist:2307359
Created April 5, 2012 01:50 — forked from subnetmarco/gist:1498896
New Spec
<api format="JSON">
<authentication type="QueryParameter">
<description><![CDATA[This is a simple query parameter authentication]]></description>
<parameters>
<parameter name="apiKey" optional="false">
<description><![CDATA[Your API Key]]></description>
</parameter>
</parameters>
</authentication>
@shatsar
shatsar / gist:2230274
Created March 28, 2012 20:32
Revelation header generation
def __generate_header(self):
"Generates a header"
header = "rvl\x00" # magic string
header += "\x01" # data version
header += "\x00" # separator
header += "\x00\x04\x06" # application version TODO
header += "\x00\x00\x00" # separator
return header
# ...
# Call a method asynchronously and get a Thread object
thread = bitly.getShortenedUrl("http://www.mashape.com", "bitly-login", "bitly-api-key") { |response|
shortenedUrl = response["shortenedUrl"] # See the API's documentation
puts "Finally the shortened url is " + shortenedUrl
}
=begin
// ...
// Call a method asynchronously and get a Thread object
Thread thread = bitly.getShortenedUrl("http://www.mashape.com", "bitly-login", "bitly-api-key", new MashapeCallback() {
@Override
public void requestCompleted(Object response) {
JSONObject jsonResponse = (JSONObject) response;
System.out.println("Finally the shortened url is " + jsonResponse.getString("shortenedUrl"));
}
#import "Sample.h"
@implementation Sample
- (void) doAPIRequest {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@try {
// Initialize the Obj-C Client Library with a Developer key
@shatsar
shatsar / sample.rb
Created November 16, 2011 04:24
Generated Ruby Client Library
require "Bitly.rb"
obj = Bitly.new("MY_PUBLIC_KEY", "MY_PRIVATE_KEY")
@shatsar
shatsar / async.py
Created November 16, 2011 04:22
Python asynchronous mode
from Bitly import Bitly
obj = Bitly("MY_PUBLIC_KEY", "MY_PRIVATE_KEY")
def my_function(result):
print result
obj.getShortenedUrl("http://mashape.com", "mashape", "apikey", my_function)
print "waiting"