Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
(function() { | |
var CSSCriticalPath = function(w, d, opts) { | |
var opt = opts || {}; | |
var css = {}; | |
var pushCSS = function(r) { | |
if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
for(var i = 0; i < styles.length; i++) { | |
if(!!styles[i] === false) continue; | |
var pair = styles[i].split(": "); |
var https = require('https'); | |
var fs = require('fs'); | |
var url = 'https://raw.githubusercontent.com/dconnolly/chromecast-backgrounds/master/backgrounds.json'; | |
Array.prototype.getLast = function() { | |
return this[this.length - 1]; | |
}; | |
function logFail(err){ | |
console.log('Failed!'); |
require "delegate" | |
class CollectionProxy | |
def products | |
@products ||= HasManyAssociation.new([]) | |
@products.associated_class ||= Product | |
@products | |
end | |
end | |
I've written this code to test what happens once a Stripe card token has been passed through to the server. This code does not do any browser testing (because JS-friendly headless testing is painful at best, and impossible if you want VCR in the mix). VCR is being used here to capture interactions with a test Stripe account, to ensure the tests are fast on future runs. That said, it's structured so that nothing is expected to be present in the Stripe account. If you delete all the stored VCR cassettes, the specs will safely re-record them.
Instead of using VCR.use_cassette
directly, instead you use stripe_cassette
in your specs, passing in the current spec example object. This will automatically generate a cassette name based on the spec's file name and the example's description (limitations of this are noted in the code comments). Within the cassette's recording block, Stripe data is cleared out before yielding back to the spec, with a context object. The context object provides access to helper methods
# An answer to https://tour.golang.org/moretypes/26 | |
# This is a bit more readable than other examples that I found online | |
# Implement a fibonacci function that returns a function (a closure) that returns successive fibonacci numbers (0, 1, 1, 2, 3, 5, ...). | |
package main | |
import "fmt" | |
// fibonacci is a function that returns | |
// a function that returns an int. |
# The ChatGptService class provides an easy way to integrate with the OpenAI ChatGPT API. | |
# It allows you to send and receive messages in a conversation thread, and reset the thread | |
# if necessary. | |
# | |
# Example usage: | |
# chat_gpt_service = ChatGptService.new(BEARER_TOKEN) | |
# response = chat_gpt_service.chat("Hello, how are you?") | |
# puts response | |
# # => {"message"=> | |
# # {"id"=>"8e78691a-1fde-4bd5-ad68-46b23ea65d8f", |