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
#!/bin/bash | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### | |
### to verify your gpu is cuda enable check |
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
func paymentAuthorizationViewController( | |
controller: PKPaymentAuthorizationViewController, | |
didAuthorizePayment payment: PKPayment, | |
completion: ((PKPaymentAuthorizationStatus) -> Void)) { | |
self.handlePaymentAuthorizationWithPayment(payment, completion:completion); | |
} | |
func handlePaymentAuthorizationWithPayment(payment: PKPayment, completion: ((PKPaymentAuthorizationStatus) -> Void)!) { | |
STPAPIClient.sharedClient().createTokenWithPayment( |
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
// | |
// ViewController.swift | |
// testingstripe | |
// | |
// Created by Charles Francis on 5/22/15. | |
// Copyright (c) 2015 Charles Francis. All rights reserved. | |
import UIKit | |
class ViewController: UIViewController, PKPaymentAuthorizationViewControllerDelegate { |
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
Stripe.api_key = # your API key | |
nextCharges = Stripe::Charge.all(:limit => 100) | |
data = nextCharges.data | |
while nextCharges.has_more do | |
nextCharges = Stripe::Charge.all(:limit => 100, :starting_after => data[data.length - 1].id) | |
data = data + nextCharges.data | |
end | |
data.inject(0) {| sum, nextCharge | sum + nextCharge.amount } |
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
| znc response | | |
ZnNetworkingUtils defaultSocketStreamTimeout: 60. | |
(znc := ZnClient new) logToTranscript. | |
response := znc | |
url: 'https://api.stripe.com/v1/charges'; | |
headerAt: 'Authorization' | |
add: ('BEARER {1}' format: { <YOUR KEY> }); | |
formAt: 'amount' put: '1000'; |
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
Dim StripeURL, APIKey | |
StripeURL = "https://api.stripe.com/v1/charges" | |
APIKey = <YOUR SECRET KEY> | |
Function makeStripeAPICall(requestBody) | |
Dim objXmlHttpMain | |
Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP") | |
On Error Resume Next | |
objXmlHttpMain.open "POST", StripeURL, False |
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
// From the repl: | |
scala> val features: Seq[Array[FeatureNode]] = values._2 | |
features: Seq[Array[liblinear.FeatureNode]] = List(Array(FeatureNode(idx=1, value=1.0)), Array(FeatureNode(idx=2, value=1.0))) | |
scala> features.toArray | |
res5: Array[Array[liblinear.FeatureNode]] = Array(Array(FeatureNode(idx=1, value=1.0)), Array(FeatureNode(idx=2, value=1.0))) | |
// But when this is otherwise executed: | |
[info] null (TraversableOnce.scala:388) | |
[info] scala.collection.TraversableOnce$class.toArray(TraversableOnce.scala:388) | |
[info] scala.collection.immutable.List.toArray(List.scala:45) |
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
> lst | |
[,1] [,2] [,3] | |
[1,] "3" "2" "1" | |
> table(lst, lst) | |
Error in sort.list(y) : | |
'x' must be atomic for 'sort.list' | |
Have you called 'sort' on a list? | |
> traceback() | |
4: stop("'x' must be atomic for 'sort.list'\nHave you called 'sort' on a list?") | |
3: sort.list(y) |
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
java.lang.NullPointerException | |
at scala.Array$$anon$2.apply(Array.scala:46) | |
at scala.Array$$anon$2.apply(Array.scala:45) | |
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:226) | |
at scala.collection.mutable.ArrayOps.flatMap(ArrayOps.scala:34) |
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
require("gtools") | |
require("hash") | |
# Thunks an expression. Basic lazy evaluation. | |
thunk <- defmacro(x, expr=function() x) | |
# But it turns out this is unnecessary! R lazily evaluates its arguments! | |
thunk2 <- function(x) { function() { x } } | |
# Further: | |
delayedAssign("x", 1/0) | |
# actually is better than what I'd implemented so far: creates a promise for |
NewerOlder