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
| javascript: setTimeout(() => { | |
| const url = location.href.replace(/#.+$/, ""); | |
| let title = document.title.replace(/^[0-9]+\. /, ""); | |
| if ("github.com" === location.host) { | |
| title = title.replace(/ by .+?$/, ""); | |
| } else if ("docs.google.com" === location.host) { | |
| title = title.replace(/ - Google .+?$/, ""); | |
| } |
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
| // ==UserScript== | |
| // @name How much longer do I have to work this month? | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Calculates the number of hours you need to work for the rest of the month | |
| // @author Rastam Hadi | |
| // @match https://p.secure.freee.co.jp/ | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=freee.co.jp | |
| // @grant none | |
| // ==/UserScript== |
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
| class User < ActiveRecord::Base | |
| # Inner classes FTW! | |
| class Null | |
| def name | |
| nil | |
| end | |
| end | |
| # If you have a more meaningful class name then by all means! | |
| class Guest |
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
| ActiveModelSerializers.config.serializer_lookup_chain.unshift( | |
| lambda do |resource_class, serializer_class, namespace| | |
| # Maps Foo::Bar to FooSerializer | |
| parent_module_name = resource_class.name.deconstantize | |
| [serializer_class, namespace].map do |m| | |
| "#{m}::#{parent_module_name}Serializer" | |
| end | |
| end | |
| ) |
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
| eval "$(rbenv init -)" | |
| export EDITOR="/usr/local/bin/sublime -n -w" | |
| # The next line updates PATH for the Google Cloud SDK. | |
| source '/Users/rastam/google-cloud-sdk/path.bash.inc' | |
| # The next line enables bash completion for gcloud. | |
| source '/Users/rastam/google-cloud-sdk/completion.bash.inc' | |
| # SSH host selector |
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
| [alias] | |
| padd = "!f() { git add $(git status -s | grep -v '^M' | cut -c4- | peco); }; f" | |
| pdiff = "!f() { git diff $(git status -s | grep -v '^M' | cut -c4- | peco); }; f" | |
| peach = "!f() { ~/bin/peach.sh }; f" | |
| undo = "!f() { git checkout -- $(git status -s | grep '^ ' | cut -c4- | peco); }; f" | |
| unstage = "!f() { git reset HEAD $(git status -s | grep -v '^[ ?]' | cut -c4- | peco); }; f" | |
| localprune = "!f() { ~/bin/localprune.sh; }; f" | |
| pr = "!f() { ~/bin/pr.sh; }; f" |