Skip to content

Instantly share code, notes, and snippets.

Avatar

Siddarth Chandrasekaran siddarth

View GitHub Profile
View gist:a944a1e8b72c7e3f68c3
### Keybase proof
I hereby claim:
* I am siddarth on github.
* I am siddarth (https://keybase.io/siddarth) on keybase.
* I have a public key whose fingerprint is 9F8D D1D6 1875 F63D CBE5 5A33 6702 E6C2 4A11 1160
To claim this, I am signing this object:
@siddarth
siddarth / gist:6241382
Created Aug 15, 2013
Stripe FX: Getting the converted amount from the BalanceTransaction
View gist:6241382

Creating a USD charge on a GBP account:

$ curl https://api.stripe.com/v1/charges \
    -u REDACTED: \
    -d amount=400 \
    -d currency=usd \
    -d card[number]=4242424242424242 \
    -d card[exp_month]=04 \
    -d card[exp_year]=16 \
    -d card[cvv]=390 \
View Workday summary
# H/T: http://stackoverflow.com/questions/6240808/count-line-changes-with-git
git log --stat --author $(git config --get user.email) --since="$(ruby -e "print Time.now - 24*60*60")" --until="now" | awk -F',' '/files? changed/ {
files += $1
insertions += $2
deletions += $3
}
END {
print "Files Changed: " files
print "Insertions: " insertions
View gist:4263997
require 'rubygems'
require 'sinatra'
get '/anonymous' do
"<html><body><a href='data:text/html;charset=utf-8,<html><script>window.location=\"http://localhost:4567/request\";</script></html>'>Link</a></body></html>"
end
get '/request' do
request.referer.inspect
end
View gist:4151329
function find(what, current) {
var ret;
if (!current) {
current = window.top;
}
for (var i=0; i < current.frames.length;i++) {
if (current.frames[i].name == what){
return current.frames[i];
}
ret = find(what,current.frames[i]);
@siddarth
siddarth / gist:1379771
Created Nov 20, 2011
Stripe PHP simple example with amount
View gist:1379771
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("STRIPE_API_KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@siddarth
siddarth / gist:1379745
Created Nov 20, 2011 — forked from gdb/gist:1255035
Stripe PHP simple example
View gist:1379745
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
View gist:1190828
#include <stdio.h>
#include <glob.h>
#include <unistd.h>
#include <assert.h>
#define PATH_SIZE 1024
#define FD_PATH "/proc/%d/fd/*.*"
int main(int argc, char **argv) {
int pid = getpid();
View gist:1074432
diff --git a/lib/heliotrope/message.rb b/lib/heliotrope/message.rb
index 5d6fe10..0ff640e 100644
--- a/lib/heliotrope/message.rb
+++ b/lib/heliotrope/message.rb
@@ -172,9 +172,10 @@ private
if part.multipart?
if mime_type_for(part) =~ /multipart\/alternative/
target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first
- decode_mime_parts target, preferred_type, level + 1
+ decode_mime_parts target, preferred_type, level + 1 unless target.nil?
View gist:406123
$ port search scala
cassandra @0.6.0 (databases)
A highly scalable, eventually consistent, distributed, structured key-value store.
dspam @3.9.0 (mail, net)
Scalable, open-source statistical anti-spam filter
mkpwd @0.7 (sysutils)
mkpwd is a scalable password generator
You can’t perform that action at this time.