Skip to content

Instantly share code, notes, and snippets.

View richo's full-sized avatar

richö butts richo

View GitHub Profile
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
@richo
richo / gist:10436849
Created April 11, 2014 01:53
example.php
<?php
require dirname(__file__) . '/lib/Stripe.php';
Stripe::setApiKey('<KEYGOESHERE>');
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
$charge = Stripe_Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd'));
echo $charge;
elekt 2 ± make ~/code/ext/stripe-rust master¹ (+1|1|)
mkdir -p build/
rustc -L ext/rust-http/build -L ext/rust-openssl/build src/lib.rs --out-dir=build
src/connection.rs:42:31: 42:32 error: unresolved name `T`.
src/connection.rs:42 let decoder = Decoder<T>::new();
^
src/connection.rs:42:33: 42:38 error: unresolved name `new`. Did you mean `req`?
src/connection.rs:42 let decoder = Decoder<T>::new();
^~~~~
src/decoder.rs:5:14: 5:15 error: use of undeclared type name `T`
use std::str;
use std::vec::Vec;
use serialize::{json,Decodable};
pub struct Decoder<T>;
impl<T: Decodable<json::Decoder,json::Error>> Decoder<T> {
pub fn decode(data: Vec<u8>) -> T {
let data = str::from_utf8(data.as_slice());
src/http/headers/serialization_utils.rs:70:21: 70:31 error: mismatched types: expected `&u8` but found `u8` (expect
ed &-ptr but found u8)
src/http/headers/serialization_utils.rs:70 if b == '\\' as u8 || b == '"' as u8 {
^~~~~~~~~~
src/http/headers/serialization_utils.rs:70:40: 70:49 error: mismatched types: expected `&u8` but found `u8` (expect
ed &-ptr but found u8)
src/http/headers/serialization_utils.rs:70 if b == '\\' as u8 || b == '"' as u8 {
@richo
richo / gist:10817735
Created April 16, 2014 06:37
keybase.md
### Keybase proof
I hereby claim:
* I am richo on github.
* I am richo (https://keybase.io/richo) on keybase.
* I have a public key whose fingerprint is 5F03 E595 48B8 5416 FBF9 C1A6 20D4 99E1 BA4D ACAA
To claim this, I am signing this object:
-------
0
0
-------
1
1
-------
0
0
-------
@richo
richo / foo.rs
Last active August 29, 2015 14:00
let args = ~["foo", "bar"];
// Or something like
// let args = ~["qux", "naz", "b9rk"]
match args.as_slice() {
["foo", arg] => handle_foo(arg),
["qux", a1, a2] => handle_qux(a1, a2),
_ => usage()
}
#![crate_id = "cli"]
extern crate stripe;
extern crate http;
use stripe::connection::Connection;
use stripe::customer::CustomerId;
use http::method::Get;
use std::os;
use std::fmt::Show;
@richo
richo / Makefile
Last active August 29, 2015 14:00
main: main.rs
rustc -o $@ $<