Docker.app will complain about incompatible processor, so we will use Docker Machine.
Download Docker for Mac (Docker.app). It contains some binaries that are necessary.
brew install virtualbox docker-machine
# put these lines into your ~/.bashrc | |
alias paste="powershell.exe -Command Get-Clipboard" | |
alias copy="powershell.exe -Command 'Set-Clipboard([Console]::In.ReadToEnd())'" |
# Mike Bianco <[email protected]> | |
# Description: Example of using Stripe's subscription billing to add usage based billing | |
# information to the customer's recurring invoice | |
require 'stripe' | |
require 'sinatra' | |
Stripe.api_key = ENV['STRIPE_KEY'] | |
# This example uses sinatra to listen for webhooks. You can easily use rails, or any other framework/language. |
/// Verify the signature passed with the Paddle request parameters. | |
/// Details here: https://paddle.com/docs/reference-verifying-webhooks | |
func verifyPaddleSignature(inParameters parameters: [String:String]) throws -> Bool { | |
guard let signatureString = parameters[PaddleParameter.signature.rawValue], | |
let signature = Data(base64Encoded: signatureString) else { | |
return false | |
} | |
// Need to gather sorted parameters | |
var signatureParameters = parameters |
WITH table_opts AS ( | |
SELECT | |
c.oid, c.relname, c.relfrozenxid, c.relminmxid, n.nspname, array_to_string(c.reloptions, '') AS relopts | |
FROM pg_class c | |
INNER JOIN pg_namespace n ON c.relnamespace = n.oid | |
WHERE c.relkind IN ('r', 't') AND n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_temp' | |
), | |
vacuum_settings AS ( | |
SELECT | |
oid, relname, nspname, relfrozenxid, relminmxid, |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
ℹ️ There is a newer alternative project that does similar things and more, check it out at https://github.com/stevenilsen123/mac-keyboard-behavior-in-windows
Make Windows PC's shortcut act like macOS (Mac OS X) (using AutoHotkey (ahk) script)
With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
/* bling.js */ | |
window.$ = document.querySelector.bind(document); | |
window.$$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
NodeList.prototype.__proto__ = Array.prototype; | |
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |