Skip to content
View rails_class_configuration.rb
module ClassConfiguration
extend ActiveSupport::Concern
module ClassMethods
def class_configuration(key, default = nil)
class_attribute :"_#{key}"
define_singleton_method(key) do |*args|
if args.empty?
View pay_netsuite_invoice_with_stripe.rb
# Michael Bianco <>
require 'stripe'
# Replace this test mode key and run this example on your account
Stripe.api_key = 'sk_test_123'
# Create a card token to be associated with a customer. This is normally done
# on your payment frontend using Stripe.js
card_token = Stripe::Token.create(
View target_blank_external_links_filter.rb
View image_asset_path_filter.rb
module HTML
class Pipeline
class ImageAssetPathFilter < HTML::Pipeline::Filter
def call"img").each do |img|
next if img['src'].nil?
src = img['src'].strip
View stripe_transfer_containing_charge.rb
# NOTE `auto_paging_each` requires a recent stripe ruby gem version
def stripe_transfer_containing_charge(stripe_charge, limit: 100)
txn = stripe_charge.balance_transaction
Stripe::Transfer.list({ limit: 100, created: { gt: stripe_charge.created }}).auto_paging_each do |transfer|
Stripe::BalanceTransaction.list({ limit: 100, transfer: }).auto_paging_each do |bt|
if == stripe_charge.balance_transaction
return transfer
# For use in a `bin/setup` script to make onboarding new devs painless
# by configuring the current directory to link to a hard coded heroku app name
# test if heroku is configured for the app
if ! heroku config 2>&1 > /dev/null; then
echo $'\nHeroku is not configured. Configuring Heroku...'
# NOTE heroku app name hardcoded here
View all_stargazers_and_forkers.bash
# to avoid rate limiting
curl -u $GH_USERNAME:$GH_TOKEN -s$GITHUB_ORGANIZATION_OR_USER/repos?per_page=200 | jq '.[] .full_name' | sed 's/\"//g' | while read line; do
# forks and stargazers
curl -u $GH_USERNAME:$GH_TOKEN -s$line/stargazers | jq '.[] .login'
curl -u $GH_USERNAME:$GH_TOKEN -s$line/forks | jq '.[] .owner .login'
curl -s$GITHUB_USER/repos?per_page=200 | jq '.[] .clone_url' | sed 's/\"//g' | while read line; do g clone "$line"; done
View expost-published-post-permalink-list.php
require( dirname( __FILE__ ) . '/wp/wp-load.php' );
$posts = new WP_Query('post_type=post&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;
foreach($posts as $post) {
$permalink = get_permalink($post->ID);
View gui-scripting-mavericks.applescript
on enabledGUIScripting(flag)
get system attribute "sysv"
if result is less than 4240 then -- 4240 is OS X 10.9.0 Mavericks
-- In OS X 10.8 Mountain Lion and older, enable GUI Scripting globally by calling this handler and passing 'true' in the flag parameter before your script executes any GUI Scripting commands, or pass 'false' to disable GUI Scripting. Authentication is required only if the value of the 'UI elements enabled' property will be changed. Returns the final setting of 'UI elements enabled' even if unchanged.
tell application "System Events"
activate -- brings System Events authentication dialog to front
set UI elements enabled to flag
return UI elements enabled
Something went wrong with that request. Please try again.