Skip to content

Instantly share code, notes, and snippets.

@fivetanley
fivetanley / test.js
Last active February 27, 2018 14:34
const puppeteer = require('puppeteer');
(async () => {
const { HEROKU_EMAIL, HEROKU_PASSWORD } = process.env;
const browser = await puppeteer.launch({headless: false})
const page = await browser.newPage();
await page.goto('https://dashboard.heroku.com');
// login
await page.type('#email', HEROKU_EMAIL);
@brianhempel
brianhempel / bench_rails_memory_usage.rb
Last active October 6, 2022 12:47
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@caseywatts
caseywatts / bookmarkleting.md
Last active June 8, 2024 20:32
Making Bookmarklets

This is one chapter of my "Chrome Extension Workshops" tutorial, see the rest here: https://gist.github.com/caseywatts/8eec8ff974dee9f3b247

Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book

Making Bookmarklets

I'm feeling very clever. I've got this sweet line of javascript that replaces "cloud" with "butt". My mom would LOVE this, but she doesn't computer very well. I'm afraid to show her the Developer Console and have her type/paste this in. But she IS pretty good at bookmarks, she knows just how to click those!

A bookmark normally takes you to a new web page. A bookmarklet is a bookmark that runs javascript on the current page instead of taking you to a new page. To declare that it is a bookmarklet, the "location" it points to starts with javascript:.

@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@seanski
seanski / release
Last active January 30, 2017 20:35
Here is a little script that I wrote to manage capistrano deploys. It checks for asset changes and precompiles assets, if needed. It also looks for schema changes and will run migrations if there are any changes. It uses GitFlow for release creation.
#!/usr/bin/env ruby
require 'date'
require 'git'
class Releaser
attr_accessor :app_path, :repo, :skip_deploy, :version, :version_file
def initialize(app_path, version, version_file, skip_deploy=false)
raise ArgumentError.new('First argument must be version number in Major, Minor, Patch format, ex. 11.222.324') unless version.valid?
@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
Back in 1997, when I was a PC Support Specialist, I asked Frank Stuart, who was our systems administrator (and had already put in notice to leave), what things I'd need to know in order to "keep the wheels on" until we could find a systems administrator to replace him. He said, "no problem", and the next day emailed me the following list:
ARP/RARP
Apache
C
DNS / bind / nslookup/ resolver library
IP Addresses (class A, B, C, D) / subnetting (subnet mask)
IPC / pipes / shared memory / semaphores
IPv6
NFS