This file contains 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
gist_urls_file=$(mktemp) | |
gist -l | sed 's/ .*$//' > $gist_urls_file | |
cat $gist_urls_file | while read -r line; do | |
gist_url="$line" | |
gist_id="$(echo $gist_url | sed 's|https://gist.github.com/||')" | |
clone_url="[email protected]:$gist_id.git" | |
git clone $clone_url | |
done |
This file contains 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
Not a pretty sight | |
When the web dies screaming loud | |
The site is not found. | |
Morning and sorrow | |
404 not with us now | |
Lost to paradise. | |
This file contains 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
// ==UserScript== | |
// @match https://www.google.com/calendar/* | |
// ==/UserScript== | |
window.alert = function (s) { | |
console.log(s); | |
}; | |
console.log('Disabling Google Calendar javascript alerts. They are instead routed to this console.'); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vue.js Sandbox</title> | |
</head> | |
<body> | |
<script src="https://unpkg.com/vue/dist/vue.js"></script> | |
<div id="app"> | |
<button @click="checkAll">Check all</button> |
This file contains 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
void(prompt('Copy',"<item><title>"+document.title+'</title><guid%20isPermaLink="true">'+document.location+"</guid><link>"+document.location+"</link></item>")) |
This file contains 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
loop do | |
print 'Listening... ' | |
utterance = gets | |
command = utterance.strip.sub(/\.$/, '').downcase.split(/\s+/).first | |
case command | |
when 'say' | |
puts utterance.sub(/^say/i, '') | |
when 'exit', 'quit' | |
puts "Exiting..." |
This file contains 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
# Debugging helper, useful while fixing N+1 problems | |
# Based on https://gist.github.com/crazymykl/b526e0ed6b285b3c4e77 | |
def count_queries(log: false, &block) | |
ActiveRecord::Base.logger = Logger.new(STDOUT) if log | |
query_count = 0 | |
increment_count = -> (*) { query_count += 1 } | |
ActiveSupport::Notifications.subscribed(increment_count, 'sql.active_record', &block) | |
query_count | |
end |
This file contains 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
SELECT schemaname, relname, n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC; |
This file contains 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
function find(start, finish, qualifier) { | |
var index; | |
for (index = start; start <= finish; index++) { | |
if (qualifier(index)) { | |
return index; | |
} | |
} | |
} |
This file contains 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 up dotfiles. (It would be amazing if there were an environment variable for this instead!) | |
RUN printf "set editing-mode vi\nset keymap vi" > ~/.inputrc | |
RUN printf "bind -v" > ~/.editrc |