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
out = [] | |
Facility.find_each do |facility| | |
if facility.send(:belong_to_billable_company?) && facility.facility_map.geometric_objects.count > 10 | |
out << "#{facility.company.name}, #{facility.name} has #{facility.facility_map.geometric_objects.count} objects" | |
end | |
end | |
facilities_receiving_texts = SMSReceivedEvent.pluck(:facility_id).uniq.length | |
facilities_sending_texts = SMSSentEvent.pluck(:facility_id).uniq.length | |
sms_received = SMSReceivedEvent.count |
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
Example of a working query | |
db.postalCode.find( { 'geo' :{ $near :{ $geometry :{ type : "Point" ,coordinates : [ -94.58, 39.09 ] } ,$maxDistance : 10000} } } ); | |
GIS Standard: <Longitude,Latitude> | |
db.businesses.count( { 'geo' :{ $near :{ $geometry :{ type : "Point" ,coordinates : [ -94.595033, 39.102704 ] } ,$maxDistance : 4000} } } ); | |
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 RetryMonitor | |
include Sidekiq::Worker | |
def perform | |
retry_queue = Sidekiq::RetrySet.new | |
if retry_queue.size > 0 | |
# Send an email or do something else. | |
end | |
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
Install XCode & Command Line Tools (Use the App Store) | |
Install Git - http://git-scm.com/download/mac | |
Follow these instructions: https://help.github.com/articles/generating-ssh-keys | |
# Installing Homebrew | |
open Terminal | |
cd ~ | |
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" | |
brew update | |
brew edit play |
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
Install Full XCode w/ Command Line tools | |
which rvm (remove if it exists) | |
which rbenv (remove if it exists) | |
which chruby (remove if it exists) | |
Remove Homebrew (https://gist.github.com/mxcl/1173223) | |
which nvm (remove if it exists) |
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
Files: git ls-files | wc -l | |
LOC: git ls-files | xargs wc -l |
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
brew install elasticsearch | |
mkdir -p ~/Library/LaunchAgents | |
ln -nfs /usr/local/Cellar/elasticsearch/0.19.11/homebrew.mxcl.elasticsearch.plist ~/Library/LaunchAgents/ | |
launchctl load -wF ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist | |
cd /usr/local/Cellar/elasticsearch/0.19.11/bin | |
plugin -install richardwilly98/elasticsearch-river-mongodb | |
To stop the ElasticSearch daemon: | |
launchctl unload -wF ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist |
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
adamsList = ['a','b','c'] | |
# Traditional (and more readable) | |
for x in adamsList | |
console.log x | |
#Enhanced for loop (should be faster. | |
for x in [adamsList.length - 1..0] by -1 | |
console.log x |
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
redis = require "redis" | |
randomString = (length) -> | |
chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
result = "" | |
i = length | |
while i > 0 | |
result += chars[Math.round(Math.random() * (chars.length - 1))] | |
--i |
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
/play tada | |
/play nyan | |
/play tmyk | |
/play rimshot | |
/play trombone | |
/play crickets | |
/play live | |
/play ohmy | |
/play greatjob | |
/play yeah |
NewerOlder