This file contains hidden or 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
try { | |
$response = Stripe_Event::retrieve($event_json->id); | |
// If you get to this point, you have a valid Stripe Event. | |
// You will do something with the response, which will be a Stripe_Event. | |
} catch (Stripe_InvalidRequestError $e) { | |
// If you get to this point, you tried to request an invalid Stripe_Event. |
This file contains hidden or 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
curl https://api.stripe.com/v1/customers/cus_2oZkg25nCQC4SO/cards/card_2wpfNByDV44zuO \ | |
-u <YOUR_TEST_SECRET>: \ | |
-X DELETE |
This file contains hidden or 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
class Ability | |
include CanCan::Ability | |
def initialize(subject) | |
can :manage, :all | |
end | |
end |
This file contains hidden or 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
.CodeRay { | |
background-color: #efefef; | |
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; | |
color: #000; | |
margin-bottom: 14px; | |
} | |
.CodeRay pre { | |
margin: 0px; | |
padding: 1em; |
This file contains hidden or 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
# Explicit contexts | |
describe ".some_method?" do | |
context "when <condition is met>" do | |
it "should be true" do | |
@foo.condition = "met" | |
@foo.should be_some_method | |
end | |
end | |
context "when <condition is not met>" do |
This file contains hidden or 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
String url = "https://path/to/url/service"; | |
HttpClient client = new HttpClient(); | |
PostMethod method = new PostMethod(url); | |
// Test whether to ignore cert errors | |
if (ignoreCertErrors){ | |
TrustManager[] trustAllCerts = new TrustManager[]{ | |
new X509TrustManager(){ | |
public X509Certificate[] getAcceptedIssuers(){ return null; } | |
public void checkClientTrusted(X509Certificate[] certs, String authType) {} |
This file contains hidden or 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
<div id="wrapper"> | |
<div id="hammertime-inside-wrapper">This is a test</div> | |
</div> | |
<script> | |
$(function(){ | |
$("#wrapper").hammer(); | |
$("#hammertime-inside-wrapper").bind("tap", function(e) { console.log(e); }); | |
}); | |
</script> |
This file contains hidden or 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
// Set the require.js configuration for your application. | |
require.config({ | |
// Initialize the application with the main application file | |
deps: ["main"], | |
paths: { | |
// JavaScript folders | |
libs: "../assets/js/libs", | |
plugins: "../assets/js/plugins", |
This file contains hidden or 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
function resultHandler(result){ | |
alert(result); | |
} | |
function errorHandler(error){ | |
alert("ERROR: "+ error); | |
} | |
$(document).on("deviceready", function(){ | |
PGExternalScreen.setupScreenConnectionNotificationHandlers( resultHandler, errorHandler ); |
This file contains hidden or 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
MYAPP = { | |
fetchTemplate: function(path, done) { | |
window.JST = window.JST || {}; | |
// Should be an instant synchronous way of getting the template, if it | |
// exists in the JST object. | |
if (JST[path]) { | |
return done(JST[path]); | |
} |