This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------- | |
0 | |
0 | |
------- | |
1 | |
1 | |
------- | |
0 | |
0 | |
------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main: main.rs | |
rustc -o $@ $< |