Skip to content

Instantly share code, notes, and snippets.

@JonnieCache
JonnieCache / zellij_tab_title.zsh
Last active November 10, 2024 20:33
ZSH script to set the zellij tab title to the running command line, or the current directory
function current_dir() {
local current_dir=$PWD
if [[ $current_dir == $HOME ]]; then
current_dir="~"
else
current_dir=${current_dir##*/}
fi
echo $current_dir
}
@JonnieCache
JonnieCache / fml.service
Created June 20, 2019 17:48
A section from FML's systemd unit file
ExecStart=/usr/bin/docker run --name fml --rm -v /var/run/postgresql:/tmp/ --network=clevername -e DB_URL -e RACK_ENV -p9292:9292 fml:production
@JonnieCache
JonnieCache / update_fml.sh
Created June 20, 2019 17:36
A script to automatically tag the latest working revision of FML
#!/usr/bin/env bash
set -e
VERSION=$(git -C /home/fml/fml.git log --notes=tinyci-result --format="%H %N" --reverse | grep success | tail -n1 | cut -f1 -d' ')
echo "new commit: $VERSION"
read -n1 -r -p "is this ok? "
echo
@JonnieCache
JonnieCache / .tinyci.yml
Last active June 20, 2019 17:26
FML's tinyci config
build: VERSION=<%= commit %> docker-compose build --force-rm test
test: export VERSION=<%= commit %> && docker-compose run --rm test && docker-compose down
hooks:
after_test_success: VERSION=<%= commit %> docker-compose build app
after_all: rm -rf <%= export %>; docker rmi fml:<%= commit %>-test
@JonnieCache
JonnieCache / exception.rb
Created October 23, 2015 10:57
exception question
begin
raise FooError, "abc"
rescue FooError => e
raise e if e.message == "abc"
rescue => e
# i want to get here
end
@JonnieCache
JonnieCache / fix-google-favicon.user.js
Created September 2, 2015 10:03
User script to put back the 2012 google favicon
// ==UserScript==
// @id fix-google-favicon
// @name fix-google-favicon
// @version 1.0
// @namespace jonniecache
// @author jonniecache
// @description Put back the 2012 google favicon so you can find your tabs
// @include *.google.*
// @run-at document-end
// ==/UserScript==
@JonnieCache
JonnieCache / pry-stack_explorer.exploding.txt
Created January 22, 2013 13:47
pry-stack_explorer exploding
>>>RACK_ENV=test be rspec spec ⏎ ✭ ✱ ◼
Launching Redacted in test mode
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Geocoders::Mapquest
with some ungeocoded exposures
@JonnieCache
JonnieCache / spacewar.lst
Created December 11, 2012 12:11
Spacewar PDP1 Source Code
-/macro fio-dec system, june 1963
007652 640500 szm=sza sma-szf
007652 650500 spq=szm i
007652 761200 clc=cma+cla-opr
- define senseswitch A
- repeat 3, A=A+A
- szs A
- term
- define init A,B
- law B
@JonnieCache
JonnieCache / gist:1595656
Created January 11, 2012 17:11
class instance variables
class Foo
class << self #anything inside this is executed in the context of the class object
attr_accessor :bar
def upcase_bar
@bar.upcase
end
end
def self.downcase_bar #also, in the class definition, self also refers to the class object
@JonnieCache
JonnieCache / gist:1589747
Created January 10, 2012 15:58
spree_master bundle error
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 3.1.1) ruby depends on
railties (~> 3.1.0) ruby
spree (>= 0) ruby depends on
railties (3.2.0.rc2)