Skip to content

Instantly share code, notes, and snippets.

View harrymahardhika's full-sized avatar

Harry Mahardhika harrymahardhika

View GitHub Profile
@harrymahardhika
harrymahardhika / userChrome.css
Created September 18, 2018 17:15
Firefox: remove forward/back button and tabs toolbar
#back-button, #forward-button {
display: none;
}
#TabsToolbar {
visibility: collapse;
}
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
def current_user
@current_user ||= User.find_by_auth_token(cookies.signed[:auth_token]) if cookies[:auth_token]
end
def authenticate_user!
redirect_to login_url unless current_user
@harrymahardhika
harrymahardhika / airports.sql
Created August 23, 2018 06:27 — forked from tanerdogan/airports.sql
airports.sql - airport list (total 8800 airport)
This file has been truncated, but you can view the full file.
DROP TABLE IF EXISTS `airports`;
CREATE TABLE IF NOT EXISTS `airports` (
`code` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityCode` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryCode` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`timezone` varchar(8) COLLATE utf8_turkish_ci DEFAULT NULL,
@harrymahardhika
harrymahardhika / reinstall_mysql
Last active June 25, 2018 05:27
Reinstall MySQL
brew remove mysql;
brew cleanup;
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist;
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist;
sudo rm -rf /usr/local/var/mysql;
unset TMPDIR;
brew services cleanup;
brew install mysql;
brew remove mysql;
brew cleanup;
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist;
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist;
sudo rm -rf /usr/local/var/mysql;
unset TMPDIR;
brew services cleanup;
@harrymahardhika
harrymahardhika / zsh.md
Created August 25, 2017 04:39 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
sudo rm -rf /usr/local/lib/node_modules;
sudo rm -rf ~/.npm;
brew uninstall --force --ignore-dependencies node;
brew install node;
@harrymahardhika
harrymahardhika / tmux.md
Created May 27, 2017 05:37 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

PROMPT='%{$fg[blue]%}%c%{$reset_color%}$(git_prompt_info) %{$fg[red]%}❯%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ‼"
@harrymahardhika
harrymahardhika / fix_zsh_history.sh
Created February 23, 2017 15:52 — forked from kolach/fix_zsh_history.sh
Fix for zsh: corrupt history file /home/marc/.zsh_history
#!/bin/sh
# Borrowed from http://marcparadise.com/blog/2013/09/21/how-to-fix-a-corrupt-history-file/
# If you ever see a message like this upon starting a new shell
# zsh: corrupt history file /home/marc/.zsh_history
# here is a quick fix
cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
# And reload history
fc -R .zsh_history