1 | 2 | diff | wanted result |
---|---|---|---|
A | A | A | |
B | < B | ||
C | C | C | |
D | > D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\set QUIET 1 | |
\pset null '¤' | |
\set PROMPT1 '[%/] > ' | |
\set PROMPT2 '%R > ' | |
\timing | |
\x auto | |
\set VERBOSITY verbose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# move to `.git/hooks/pre-commit`; run `chmod +x .git/hooks/pre-commit` | |
set -e | |
files=$(git diff --staged --name-only --diff-filter=ACMRTUXB | grep '\.rb$' | tr '\\\n' ' ') | |
# Check we have files before trying to run the tests. | |
# Prevents getting stuck if we only update non .rb files. | |
if [[ -n $files ]];then | |
git diff --staged --name-only --diff-filter=ACMRTUXB | grep '\.rb$' | tr '\\\n' ' ' | xargs --no-run-if-empty bundle exec rubocop -A --config "$(git rev-parse --show-toplevel)/.rubocop.yml" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The args being numeric cause auto casting; This is what we want | |
-- e.g `COUNT(*)` returns a whole number but we often want to divide it to float | |
-- Postgres percent function | |
CREATE OR REPLACE FUNCTION percent(portion numeric, total numeric, round_level integer default 1) | |
RETURNS numeric | |
IMMUTABLE | |
RETURNS NULL ON NULL INPUT | |
PARALLEL SAFE | |
as $fbd$ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
files=$(git diff --staged --name-only --diff-filter=ACMRTUXB | grep '\.rb$' | tr '\\\n' ' ') | |
# Check we have files before trying to run the tests. | |
# Prevents getting stuck if we only update non .rb files. | |
if [[ -n $files ]];then | |
if [ $commands[gxargs] ]; then | |
git diff --staged --name-only --diff-filter=ACMRTUXB | grep '\.rb$' | tr '\\\n' ' ' | gxargs --no-run-if-empty bundle exec rubocop -A --force-exclusion --config "$(git rev-parse --show-toplevel)/.rubocop.yml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
# This reads a CSV and outputs it in the Cross Stitch osx format | |
# For the life of me I could not get https://flosscross.com/ to actually read the output | |
# when run with `ruby csv_to_osx_cross_stitch_format.rb > output.osx` | |
# despite `file output.osx` telling me it was valid XML (and being the same as | |
# a file _exported_ from flosscross) | |
# Instead I created a new blank project in flosscross, exported that to OSX, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export the text from the papier chrome extension (https://chromewebstore.google.com/detail/papier/hhjeaokafplhjoogdemakihhdhffacia) | |
# Extension was not updated to Manifest V3 and chrome won't allow it to be opened again so you lose you're notes. | |
# I was able to get them back with the below. You need go & jq, commands are for a Mac, but hopefully things work with other OS's | |
# No support given | |
$ go install github.com/cions/leveldb-cli/cmd/leveldb@latest | |
$ cp -r ~/Library/Application\ Support/Google/Chrome/Default/Local\ Storage/leveldb ~/documents/chrome-leveldb | |
$ rm ~/documents/chrome-leveldb/LOCK | |
$ cd ~/documents | |
$ level-db get "_chrome-extension://hhjeaokafplhjoogdemakihhdhffacia\0\x01papier-save" -d chrome-leveldb > key_value.txt |
OlderNewer