How do you compare date/times in RSpec?
If you do this
expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i| # Sublime Text 3 languages list: | |
| ls -1 /Applications/Sublime\ Text.app/Contents/MacOS/Packages/ | |
| # Remove all default Sublime Text 3 snippets for Python language | |
| export ST3_LANG="Python" | |
| mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/ | |
| unzip -l /Applications/Sublime\ Text.app/Contents/MacOS/Packages/$ST3_LANG.sublime-package | grep '.sublime-snippet' | awk '{print $4}' | while read f; do touch ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/$f; done | |
| unset ST3_LANG |
| # activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb | |
| # Maps logical Rails types to MySQL-specific data types. | |
| def type_to_sql(type, limit = nil, precision = nil, scale = nil) | |
| return super unless type.to_s == 'integer' | |
| case limit | |
| when 1; 'tinyint' | |
| when 2; 'smallint' | |
| when 3; 'mediumint' | |
| when nil, 4, 11; 'int(11)' # compatibility with MySQL default |
| " Check if NERDTree is open or active | |
| function! rc:isNERDTreeOpen() | |
| return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) | |
| endfunction | |
| " Call NERDTreeFind iff NERDTree is active, current window contains a modifiable | |
| " file, and we're not in vimdiff | |
| function! rc:syncTree() | |
| if &modifiable && rc:isNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff | |
| NERDTreeFind |
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
| # This patch detects {index_columns} that match something like | |
| # the example below, then strips the surrounding double quotes. | |
| # | |
| # "(settings->'example')" | |
| # | |
| # The resulting CREATE INDEX sql looks something like: | |
| # | |
| # CREATE INDEX "idx_users_on_settings_example" ON "users" USING gin ((settings->>'example')) | |
| # | |
| # Your {add_index} call should looks something like: |