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
function gitwho() { | |
personal_email = "<PERSONAL_EMAIL>" | |
work_email = "<WORK_EMAIL>" | |
git_current="`git config --global --get user.email`" | |
if [ "$1" == "" ]; then | |
echo $git_current | |
else | |
if [ "$1" == "switch" ]; then | |
if [ "$git_current" == "$personal_email" ]; then | |
email="$personal_email" |
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
[color] | |
ui = true | |
[user] | |
name = <name> | |
email = <email> | |
[core] | |
editor = vim |
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
.bundle | |
.*.sw* | |
.DS_Store | |
.yardoc |
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 Array | |
def to_h(keys) | |
Hash[*keys.zip(self).flatten] | |
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
module SimpleImapReader | |
require 'net/imap' | |
#require 'mail' | |
class << self | |
def config | |
@config ||= SimpleImapReader::Config.new | |
end | |
def configure(&block) | |
config.configure(&block) |
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 'net/http' | |
class Item | |
#replaced with dynamic initialization below | |
#attr_reader :id, :user, :state | |
# | |
# | |
# Sample JSON | |
# | |
# [{ "id":1, "user":"john", "state":"active" }, | |
# { "id":2, "user":"jane", "state":"inactive" }, |
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 Item | |
def initialize item | |
raise "expected Hash param" unless item.kind_of? Hash | |
item.each do |key,value| | |
instance_variable_set(clean_key(key), value) | |
define_singleton_method(key.to_s) { instance_variable_get( clean_key(key) ) } | |
define_singleton_method("#{key.to_s}=") { |val| instance_variable_set( clean_key(key), val ) } | |
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
$ sudo cat /etc/nginx/sites-enabled/blog | |
server { | |
server_name blog.mervine.net; | |
location / { | |
proxy_pass http://f2h1gg.tumblr.com; | |
} | |
} |
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
# | |
# I've learned to never do this! | |
# | |
sudo su - | |
cd /etc/alternatives | |
mv bash_completion_gem bash_completion_gem1.8 | |
ln -s /etc/bash_completion.d/gem1.9.1 bash_completion_gem | |
mv erb erb1.8 | |
ln -s /usr/bin/erb1.9.1 erb |
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
$ sudo apt-get install mysql-server mysql-client | |
... output omitted ... | |
$ sudo mysqladmin -u root -h localhost password 'password' | |
... output omitted ... | |
$ mysql -u root -p | |
... output omitted ... | |
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'your_host_name' IDENTIFIED BY "password"; | |
Query OK, 0 rows affected (0.00 sec) | |
mysql> FLUSH PRIVILEGES; |
OlderNewer