start new:
tmux
start new with session name:
tmux new -s myname
| <?php | |
| # Step 1: Create a customer from the card details | |
| require_once("vendor/autoload.php"); | |
| White::setApiKey("test_sec_k_886a1e89b2c0abce479bf"); // Secret key | |
| $customer = White_Customer::create(array( | |
| 'name' => "John Doe", | |
| 'description' => "Amember customer", | |
| 'email' => "john.doe@example.com", | |
| 'card' => array( |
| # From https://whitepayments.com/docs/api/#create-a-new-charge | |
| <?php | |
| require_once('./lib/White.php'); | |
| White::setApiKey("test_sec_k_886a1e89b2c0abce479bf"); # Your secret API key | |
| White_Charge::create(array( | |
| "amount" => 1000, // 10.00 | |
| "currency" => "aed", | |
| "card" => "tok_38951a48cd3859d2dcf62957e1c9", # The token from White.js |
| AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
| manager.responseSerializer = [AFJSONResponseSerializer serializer]; | |
| manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/json"]; | |
| NSDictionary *params = @{@"amount":@"1000", | |
| @"currency":@"aed", | |
| @"email":@"ahmed@example.com",@"card[name]":@"Abdullah Ahmed", | |
| @"card[number]":@"4242424242424242", | |
| @"card[exp_month]":@"11", | |
| @"card[exp_year]":@"2016", | |
| @"card[cvc]":@"123", |
| <?php | |
| $token = $_POST['startToken']; // from Beautiful.js | |
| require_once('./lib/Start.php'); | |
| Start::setApiKey("test_sec_k_e06df93760b388375e1f6"); | |
| Start_Customer::create(array( | |
| "name" => "Abdullah Ahmed", | |
| "email" => "abdullah@msn.com", | |
| "card" => $token, |
| <?php | |
| // Setup Start object | |
| require_once('./lib/Start.php'); | |
| Start::setApiKey("test_sec_k_e06df93760b388375e1f6"); | |
| // Get the customer ID (usually from your Database) | |
| $customer_id = "cus_abc123def456ghi789"; | |
| // Charge the customer (can be done many times, over a period of time) | |
| Start_Charge::create(array( |
| # y = theta_1 * x + theta_0 | |
| # Not actually required in the gradient descent calculation; just used to verify | |
| # the sanity of the results :) | |
| def compute_error_for_line_given_points(theta_0, theta_1, points): | |
| totalError = 0 | |
| for i in range(0, len(points)): | |
| x = points[i, 0] | |
| y = points[i, 1] | |
| totalError += (y - (theta_1 * x + theta_0)) ** 2 | |
| return totalError / (2 * float(len(points))) |
| 32.502345269453031 | 31.70700584656992 | |
|---|---|---|
| 53.426804033275019 | 68.77759598163891 | |
| 61.530358025636438 | 62.562382297945803 | |
| 47.475639634786098 | 71.546632233567777 | |
| 59.813207869512318 | 87.230925133687393 | |
| 55.142188413943821 | 78.211518270799232 | |
| 52.211796692214001 | 79.64197304980874 | |
| 39.299566694317065 | 59.171489321869508 | |
| 48.10504169176825 | 75.331242297063056 | |
| 52.550014442733818 | 71.300879886850353 |
| /* | |
| Coded by Marjan Olesch | |
| Sketch from Insctructables.com | |
| Open source - do what you want with this code! | |
| */ | |
| #include <Servo.h> | |
| int PIN_ESC = 9, value = 0; | |
| Servo srvESC; |
| // White doesn't provide a C# wrapper library (yet), but you can still easily | |
| // create charges by sending requests directly to the API. Here's how. | |
| using RestSharp; | |
| var client = new RestClient(); | |
| client.BaseUrl = "https://api.start.payfort.com/"; | |
| client.Authenticator = new HttpBasicAuthenticator("your_secret_api_key_here", ""); | |
| var request = new RestRequest("charges", Method.POST); // send a POST request | |
| request.AddParameter("currency", "AED"); |