Skip to content

Instantly share code, notes, and snippets.

View ilikepi's full-sized avatar

James Blanding ilikepi

View GitHub Profile
@ilikepi
ilikepi / predicate_matcher_experiment_spec.rb
Created November 9, 2022 19:24
Experiments with rspec predicate matchers
require 'spec_helper'
class PredicateMatcherExperiment
attr_reader :ivar
def initialize(ivar: nil)
@ivar = ivar
end
@ilikepi
ilikepi / rails_maintenance_with_db_roles.md
Last active June 13, 2021 21:52
Theoretical maintenance mode for Rails using database roles.

Database setup

-- NOTE: this script assumes a connection to a database
-- named `myapp_development` with adequate permissions
BEGIN;

-- user to be listed in config/database.yml
-- NOTE: this user does not own any database objects
@ilikepi
ilikepi / firefox-run.applescript
Last active December 24, 2023 06:11
macOS Automator script to force Firefox to always boot with ProfileManager
on run {input, parameters}
tell application "Finder"
set ffxAppPath to POSIX path of (application file id "org.mozilla.firefox" as string)
end tell
set ffxBinaryName to "firefox"
set ffxExePath to ffxAppPath & "/Contents/MacOS/" & ffxBinaryName
-- Command to start a new instance of Firefox Profile Manager in the background
-- and return its pid.
@ilikepi
ilikepi / test_unicode_stdout.py
Created February 22, 2018 00:20
Python Unicode output tester
#!/usr/bin/env python
import sys
import codecs
import locale
unicode_string = u' \\u2013: \u2013'
print 'sys.stdout.encoding: %(enc)s' % {'enc': sys.stdout.encoding}
@ilikepi
ilikepi / CONTRIBUTING.md
Last active August 29, 2015 13:56
Tweaked version of CONTRIBUTING.md from preservim/vim-markdown#60

These contributing guidelines were accepted rather late in the history of this plugin, after much code had already been written.

If you find any existing behavior which does not conform to these guidelines, please correct it and send a pull request.

General Rules

Every non local identifier must start with g:vim_markdown_.

Documentation

@ilikepi
ilikepi / vim-markdown.expanded_gfm_syntax.test.txt
Created September 26, 2013 22:32
Test content for experimenting with GFM support in plasticboy/vim-markdown. This gist is defined as plain text to prevent GitHub from formatting it when displayed.
Highlight :banana_pepper: and :-1: and @cow, but not :banana or :#:.
My commit is 9082385
9823498
xyz@0928342
banana/xyz@0928342
something something #209
xyz#234
banana/xyz#234
+++ backtick#43
import re
p = re.compile("\(\(([^()]+)\)\)")
file_path = str(raw_input('File Name >'))
orig_text = open(file_path).read()
new_text = ""
footnoteMatches = p.finditer(orig_text)
coordinates = []
@ilikepi
ilikepi / gist:941515
Created April 26, 2011 00:04
can haz random line?
# output a random line of /etc/hosts via the most ugly means possible
sed -n $(perl -e 'printf "%s", int(rand(int(`wc -l /etc/hosts`)))+1;')p /etc/hosts