Skip to content

Instantly share code, notes, and snippets.

View kaeff's full-sized avatar

Klaus Fl kaeff

View GitHub Profile
class Car {
this.engine;
ignite() {
this.engine.turnOn();
}
accelerate() {}
getPostiion() {}
turnLeft() {}
turnOff() {
@kaeff
kaeff / delete-readability.js
Created August 30, 2018 14:50
Delete Readability entries from Kindle
// Snippets to be copy/pasted in the JS console on Amazon's "my content and devices" page
// Do this once
NodeList.prototype.forEach = Array.prototype.forEach;
// Paste this to select the entries. Then click "delete" and confirm
document.querySelectorAll("*[title='Readability.']").forEach((el) => el.closest(".contentTableListRow_myx").querySelector("i.listViewIconPosition_myx").click())
@kaeff
kaeff / -
Created March 16, 2018 11:40
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title></title>
<style type="text/css">
ReadMsgBody {
width: 100%;
}
@kaeff
kaeff / dl-lesson.sh
Created November 18, 2016 09:28
Download an egghead.io lesson using youtube-dl
#!/bin/bash
# Usage: dl-lession.sh https://egghead.io/courses/react-fundamentals
let n=1
for link in $(curl -s $1 | pup '.series-lessons-list a attr{href}'); do
filename=$(echo $link | sed "s/https:\/\/egghead.io\/lessons\///g" | sed "s/\?.*$//g")
filename_numbered=$(echo "$n $filename" | awk '{ printf "%02i-%s.mp4\n", $1, $2 }')
youtube-dl -o "$filename_numbered" "$link"
let n++
done
@kaeff
kaeff / apps-missing-from-brew.sh
Created March 2, 2017 13:02
Utility to find apps which are missing from `brew list` although installed
#!/bin/bash
brew cask list | sed 's/ +/\n/g' | sort > apps-cask.txt
ls -l /Applications | cut -c 55- | grep -v '\->' | sed 's/ /-/g' | sed 's/\.app//g' | awk '{print tolower($0)}' | sort > apps.txt
comm -23 apps.txt apps-cask.txt > apps-not-installed-by-brew.txt
ls /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/Casks | sed 's/\.rb//' > all-casks.txt
comm -12 apps-not-installed-by-brew.txt all-casks.txt > apps-missing-from-brew.txt
cat apps-missing-from-brew.txt
@kaeff
kaeff / readability_deleter.js
Created December 3, 2013 10:06
UserScript for deleting readability entries from Amazon's Kindle Personal Document settings UI
var ReadabilityDeleter = function () {
var readabilityColumnOnly = function(el) {
return el.innerHTML.indexOf("@readability.com") > 0;
};
var queryReadabilityRows = function () {
var candidates = document.querySelectorAll("#orderList td.greyed");
return Array.prototype.slice.call(candidates).filter(readabilityColumnOnly);
};
module RentARoleModel
class Application < Rails::Application
config.action_mailer.default_options = { from: "rent-a-role-model@kaeff.net" }
end
end
@kaeff
kaeff / .vimrc
Last active December 22, 2015 08:48
JSON prettyfying, requires NodeJS. I use from VIM in combination with the vim-json plugin for syntax highlighting and extra sweetness. See https://github.com/elzr/vim-json
" Settings for vim-json
au! BufRead,BufNewFile *.json set filetype=json
au FileType json setlocal foldmethod=syntax
" Use jsonpp for auto-indendting
au FileType json setlocal equalprg=jsonpp\ -
@kaeff
kaeff / Guardfile
Last active December 17, 2015 15:59
Spork, Guard Test Setup for Rails
guard 'rspec', cli: '--drb', all_on_start: false, all_after_pass: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
@kaeff
kaeff / .bowerrc
Last active December 15, 2015 22:50
How to use Bower with the Asset Pipeline in Rails
{
"directory" : "vendor/assets/components"
}