Skip to content

Instantly share code, notes, and snippets.

@robinsloan
robinsloan / unfave.rb
Last active June 5, 2022 21:32
Unfave script, because why not??
#!/usr/bin/env ruby
require "rubygems"
require "twitter"
require "json"
require "faraday"
# things you must configure
TWITTER_USER = "your_username"
# get these from dev.twitter.com
@codemedic
codemedic / vpn-docker-fix
Last active June 15, 2023 18:17
Docker network through host IPSec / Strongswan VPN
#!/usr/bin/env bash
# Link up docker network via IPSec VPN on docker-host.
#
# NOTE: This script can either be "sourced" into your .bashrc or executed directly. Be
# it sourced or executed, the usage syntax below is the same.
#
# Usage: [dry_run=1] [debug=1] vpn-docker-fix [docker-network-1 [docker-network-2 ...]]
#
# Env Variables:
@paulirish
paulirish / what-forces-layout.md
Last active April 23, 2024 15:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@robinsloan
robinsloan / langoliers.rb
Last active April 7, 2024 13:22
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@tanepiper
tanepiper / twitter_oauth_getter.js
Created September 11, 2010 16:14
A small command line nodejs script for doing Twitter OAuth.
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: --key=[consumer key] -secret=[consumer secret]')
.demand(['key', 'secret'])
.argv
;
var OAuth = require('oauth').OAuth;
var Step = require('step');