Skip to content

Instantly share code, notes, and snippets.

View wfleming's full-sized avatar
🔥
This is fine.

Will Fleming wfleming

🔥
This is fine.
View GitHub Profile
@wfleming
wfleming / decorators.mjs
Last active April 13, 2023 22:13
esbuild babel plugin to parse decorators
import fs from "node:fs/promises"
import { createHash } from "node:crypto"
import * as babel from "@babel/core"
export function decoratorsPlugin() {
return {
name: "babel-decorators",
setup: function(build) {
const ignoreSet = new Set() // js files that don't contain @connect
const cache = new Map() // path => { origHash, transformedSrc }
@wfleming
wfleming / scotland.markdown
Last active March 29, 2018 02:51
Chris_Scotland_reqs

Here's a brain dump. I don't remember what your route was going to be/what towns you're hitting aside from Edinburgh & Glasgow, so some of these might be interesting & some might be miles out of your way.

Walks

  • Arthur's Seat is a nice small hike in Edinburgh. It's a gentle hike, not too long, and ends up on a peak with a great overlook of the whole city.
  • Ben Nevis is a more serious hike, but if you're in that area (it's farther North in the West, near Fort William), it's a great hike. It's the tallest peak in the UK. There will be snow at the top. For all that, it's not actually that long or difficult a hike if you have decent footwear. The Ben Nevis Inn at the foot of the trail is also a very good restaurant. (Not a great place to stay though: they're only accomodation is a bunkhouse mostly used by through-hikers.) http://www.ben-nevis-inn.co.uk/

Places to Stay

You probably already have this mapped out, and I didn't stay anywhere very nice for the most part.

@wfleming
wfleming / enpass2pass.csv
Created May 13, 2017 20:37
enpass2pass.rb sample
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
"Title","Field","Value","Field","Value",.........,"Note"
"somesite.com","url","https://www.somesite.com/login.jsp","loginUser","abby@normal.com","LOGIN<>password","JauxCK53FJnqhIcvP5ibnFR0PLHhYqpt","htmlAction","https://www.somesite.com/signin.jsp","htmlID","userSignIn","htmlMethod","POST","htmlName","frm_user_signin",""
"siteb.com","url","https://account.siteb.com","userid","iamwhoiam","password","opensesame","remember","✓","htmlMethod","POST",""
"sitec.com","url","https://login.sitec.com/","password","hHfVj13ov3A4JD4De1PNHqSn5Ipp","password confirmation","hHfVj13ov3A4JD4De1PNHqSn5Ipp","Username","abby@normal.com","htmlAction","https://sitec.com/password_reset/some-random-token","htmlID","update-credentials","htmlMethod","post",""
"sited.com","url","http://www.sited.com/forum/index.php","members display name","paulatreides","EmailAddress","paul@atreides.com","PassWord","nzmLKwgOosn,PQwXvoSKTWZ","PassWord Check","nzmLKwgOosn,PQwXvoSKTWZ","qa answer","1234","recaptcha response field","why on earth was this rec
@wfleming
wfleming / grid_overlay.js
Last active March 21, 2017 00:35
Client Side Grid Overlay
/* Grid Overlay
*
* Can be adapted to overlay layout guides on a website.
*/
(function(win, doc) {
function GridOverlay(targetSel) {
this.targetEl = doc.querySelector(targetSel);
this.measurements = {
colCount: 12,
colWidth: 60,
@wfleming
wfleming / Xorg.0.log
Created September 4, 2016 01:36
arch_x11_hang
[ 9109.310]
X.Org X Server 1.18.4
Release Date: 2016-07-19
[ 9109.321] X Protocol Version 11, Revision 0
[ 9109.325] Build Operating System: Linux 4.5.4-1-ARCH x86_64
[ 9109.331] Current Operating System: Linux thor 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64
[ 9109.331] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=df1fd44d-8de0-423f-bde8-7604d562f7cb rw quiet cryptdevice=UUID=6c064ba4-df98-4f05-882d-789bf0203daa:cryptroot root=/dev/mapper/cryptroot
[ 9109.341] Build Date: 19 July 2016 05:54:24PM
[ 9109.344]
[ 9109.348] Current version of pixman: 0.34.0
@wfleming
wfleming / benchmark.rb
Created August 12, 2016 16:01
benchmark-named-block
require "benchmark"
class Foo
def a(memo)
yield memo if block_given?
end
def b(memo, &block)
block.call(memo) if block
end
@wfleming
wfleming / bump_build_number.sh
Created April 24, 2015 15:27
iOS/OS X App Development Build Number Script
#!/bin/sh
#
# I use this in most of my iOS projects: it's a script that sets the build
# number of compiled builds based on the number of commits on the git branch.
#
# Using the number of git commits has the useful properties of being an integer
# that always increases (if you don't abuse git too much), and of not relying
# on any external tools or configuration files so it will be the same for a
# given commit no matter who builds it. The "integer that increases" property
# is important because Apple requires this to be the case for builds submitted
@wfleming
wfleming / mongo.png
Last active August 29, 2015 14:11
Mongo Image
mongo.png
@wfleming
wfleming / main.rb
Created October 9, 2014 23:34
FourSquare simple
require 'foursquare2'
# pass the client auth info via ENV
client = Foursquare2::Client.new(
:client_id => ENV['CLIENT_ID'],
:client_secret => ENV['CLIENT_SECRET'],
:api_version => '20151030'
)
# get venues near E2 0DL
@wfleming
wfleming / Canonical URL bookmarklet
Created March 21, 2010 17:13
A bookmarklet to look for and display canonical & short URLs a page may provide and show them to the user for easy copy & paste.
javascript:
// I've been using http://subsimple.com/bookmarklets/jsbuilder.htm to compress
var d = document, h = d.getElementsByTagName('head')[0], dg = d.createElement('div');
// set up the dialog div a bit more
dg.id = 'canonical_dialog';
dg.style.background = 'white';
d.getElementsByTagName('body')[0].appendChild(dg);
function s2() {