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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
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
ALLOWED_TYPES = { | |
'pdf' => ['application/pdf', 'application/x-download'], | |
'image' => ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif'], | |
'text' => ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], | |
'spreadsheet' => ['application/excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] | |
} | |
ALLOWED_TYPES.map{ |g,s| s }.flatten # => ["application/pdf", "application/x-download", "image/jpg", "image/jpeg", "image/pjpeg", "image/png", "image/x-png", "image/gif", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] |
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
import fnmatch | |
import re | |
import threading | |
import datetime | |
import time | |
import shutil | |
import _strptime | |
import tempfile |
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
def chosen_select (element_id, option_number) | |
page.execute_script("$('##{element_id}').next('.chzn-container').trigger('mousedown')") | |
page.execute_script("$('##{element_id}_chzn_o_#{option_number}').trigger('mouseover').trigger('mouseup')") | |
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
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
It was created by configure, which was | |
generated by GNU Autoconf 2.68. Invocation command line was | |
$ ./configure --prefix=/Users/erik/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/erik/.rvm/usr | |
## --------- ## | |
## Platform. ## |
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 Business < ActiveRecord::Base | |
has_one :location, as: :locatable | |
accepts_nested_attributes_for :location, allow_destroy: true, reject_if: -> (attributes) { attributes['address'].blank? } | |
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
# replaces irb in the rails console with pry | |
# instead of 'rails c', start the console with 'rails pry' | |
rails(){ | |
if [[ $@ == "pry" ]]; then | |
command pry -r ./config/environment; | |
else | |
command rails "$@"; | |
fi; | |
} |
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
passenger@rails:/var/www/html/ems.domain.com/current$ redis-server | |
[13937] 21 Jun 13:38:02 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf' | |
[13937] 21 Jun 13:38:02 * Server started, Redis version 2.4.11 | |
[13937] 21 Jun 13:38:02 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. | |
[13937] 21 Jun 13:38:04 * DB loaded from disk: 2 seconds | |
[13937] 21 Jun 13:38:04 * The server is now ready to accept connections on port 6379 | |
[13937] 21 Jun 13:38:05 - DB 0: 21 keys (0 volatile) in 48 slots HT. | |
[13937] 21 Jun 13:38:05 - 0 clients connected (0 slaves), 42474312 bytes in use | |
[13937] 21 Jun 13:38:10 - DB 0: 21 keys (0 volatile) in 32 slots HT. | |
[13937] 21 Jun 13:38:10 - 0 clients connected (0 slaves), 42474312 bytes in use |
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
Show hidden characters
{ | |
"color_scheme": "Packages/User/Gowalla.tmTheme", | |
"font_face": "Inconsolata-g", | |
"font_options": | |
[ | |
"subpixel_antialias" | |
], | |
"font_size": 14.0, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, |
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
!!! 5 | |
/[if lt IE 7] <html lang="en" class="no-js ie6"> | |
/[if IE 7 ] <html lang="en" class="no-js ie7"> | |
/[if IE 8 ] <html lang="en" class="no-js ie8"> | |
/[if IE 9 ] <html lang="en" class="no-js ie9"> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> | |
%head | |
%meta{:charset => "utf-8"}/ | |
/ | |
Always force latest IE rendering engine (even in intranet) & Chrome Frame |