This file contains 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 AutocompleteSearch | |
class << self | |
def populate(query_scope) | |
query_scope.find_each do |item| | |
name = item.label | |
json_data = format_data(item) | |
name.length.times do |n| | |
key = name[0, n+1] | |
$redis.zadd "kupsearch:#{key.downcase}", 1, json_data | |
end |
This file contains 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
{ | |
"auto_complete_commit_on_tab": true, | |
"caret_style": "solid", | |
"color_scheme": "Packages/User/RailsCastsColorScheme (SL).tmTheme", | |
"draw_white_space": "all", | |
"enable_tab_scrolling": false, | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
"*.pyc", |
This file contains 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
Documentation: | |
Enabled: false | |
AllCops: | |
Include: | |
- '**/Rakefile' | |
- '**/config.ru' | |
Exclude: | |
- 'db/**/*' | |
- 'test/test_helper.rb' | |
- 'spec/spec_helper.rb' |
This file contains 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
# Sublime CTags Mouse Map Command + Click to Go to definition | |
# Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User | |
[ | |
{ | |
"button": "button1", | |
"count": 1, | |
"modifiers": ["command"], | |
"command": "goto_definition", | |
"press_command": "drag_select" |
This file contains 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 StellarLogger < Logger | |
def format_message(severity, timestamp, progname, msg) | |
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" | |
end | |
end | |
logfile = File.open("#{Rails.root}/log/stellar.log", 'a') # create log file | |
logfile.sync = true # automatically flushes data to file | |
STELLAR_LOGGER = StellarLogger.new(logfile) |
This file contains 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
# Returns the class descending directly from ActiveRecord::Base in the inheritance hierarchy. | |
def active_record_descendant_class(klass) | |
if klass == ActiveRecord::Base || klass.superclass == ActiveRecord::Base | |
klass | |
elsif klass.superclass.nil? | |
fail "#{name} doesn't belong in a hierarchy descending from ActiveRecord" | |
else | |
active_record_descendant_class(klass.superclass) | |
end | |
end |
This file contains 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
answer['attributes']['name'] | |
answer['attributes']['name'] |
This file contains 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
#!/bin/sh | |
# Collect the jpg's | |
ls *.jpg stills.txt | |
# Create the video (mencoder) | |
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vibrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt | |
# TODO: Upload to YouTube? |
This file contains 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
#!/bin/sh | |
OPTIONS='-hf -vf -o' | |
TS=$(date +%Y-%m-%d_%T) | |
# Take a snapshot | |
raspistill $OPTIONS "$TS".jpg | |
# For now this is the filename | |
file="$TS.jpg" |
This file contains 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
Sun Apr 12 23:33:52 PHT 2015: PING google.com (120.28.26.227) 56(84) bytes of data. | |
Sun Apr 12 23:33:52 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=1 ttl=57 time=34.6 ms | |
Sun Apr 12 23:33:53 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=2 ttl=57 time=34.6 ms | |
Sun Apr 12 23:33:54 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=3 ttl=57 time=33.7 ms | |
Sun Apr 12 23:33:55 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=4 ttl=57 time=37.1 ms | |
Sun Apr 12 23:33:56 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=5 ttl=57 time=35.3 ms | |
Sun Apr 12 23:33:57 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=6 ttl=57 time=36.3 ms | |
Sun Apr 12 23:33:58 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=7 ttl=57 time=34.4 ms | |
Sun Apr 12 23:33:59 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=8 ttl=57 time=39.2 ms | |
Sun Apr 12 23:34:00 PHT 2015: 64 bytes from 120.28.26.227: icmp_seq=9 ttl=57 time=33.2 ms |