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 dtrace -qn 'pid$target:mysqld:*mysql_parse*:entry { printf("%Y %s\n", walltimestamp, copyinstr(arg1)) }' -p `pgrep -x mysqld` |
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
| date = '03/27/1992' | |
| year = /(?<year>(20)?(07|08|09|10|11|12))/ | |
| month = /(?<month>0[1-9]|1[012])/ | |
| day = /(?<day>0[1-9]|\.[1-9]|[12][0-9]|3[01])/ | |
| NUMERAL_DATE_REGEX = /#{year}(?<separator>\.|\-|\/|_)?#{month}(\k<separator>)?#{day}/ | |
| if match = NUMERAL_DATE_REGEX.match(@file_name) | |
| Date.parse(date).strftime("%y.%m.%d") | |
| 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
| require 'bundler/setup' | |
| Bundler.require | |
| module Soshified | |
| def self.setup! | |
| config = YAML.load_file(File.join(File.dirname(__FILE__), 'config/db.yml')) | |
| DataMapper::Logger.new(STDOUT, :debug) | |
| DataMapper.setup(:default, config['ipgallery']) | |
| 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
| function mkrvmrc () { | |
| latest_ruby="$(rvm list strings | tail -n -1)" | |
| echo "rvm $latest_ruby@$(basename $PWD) --create" > .rvmrc | |
| source .rvmrc | |
| } |
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 MatchData | |
| def to_hash | |
| Hash[[names, captures].transpose] | |
| end | |
| alias :to_h :to_hash | |
| 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
| launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist | |
| rm -f ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist | |
| brew uninstall memcached | |
| brew install https://raw.github.com/gist/2421766/1a210dbd360486631ff4fb22fd74a0eed5983d91/memcached.rb | |
| cp /usr/local/Cellar/memcached/1.4.13/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/ | |
| launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist | |
| tail -f /usr/local/var/log/memcached.log |
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
| #(^|\s|\)|\(|\{|\}|>|\]|\[|href=\S)((http|https|news|ftp)://(?:[^<>\)\[\"\s]+|[a-zA-Z0-9/\._\-!&\#;,%\+\?:=]+))(</a>)?# | |
| #(^|\s|\)|\(|\{|\}|>|\]|\[|href=\S)(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))(</a>)?# |
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
| # encoding: UTF-8 | |
| # requires ruby 1.9.3 and up | |
| # gem install nokogiri typhoeus | |
| require 'nokogiri' | |
| require 'typhoeus' | |
| module Imgur | |
| class AlbumDownloader |
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
| # Various notes relating to my switch vim | |
| ctrl-o in insert mode to switches you to normal mode for one command | |
| then back to insert mode. | |
| Key Movement | |
| h Left | |
| l Right | |
| k Up a line |
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
| rvm use 1.9.3@rails_backbone_example --create | |
| gem install rails | |
| rails new rails_backbone_test --skip-bundle | |
| cd rails_backbone_test | |
| Add `gem 'rails-backbone'` to Gemfile | |
| bundle | |
| rails g backbone:install | |
| rails g scaffold Post title:string content:string | |
| rails g backbone:scaffold Post title:string content:string | |
| rake db:migrate |