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
include ActionView::Helpers::DateHelper | |
def time_remaining | |
start_count = Delayed::Job.count | |
if start_count == 0 | |
rate = 0 | |
start_time = Time.now | |
time_remaining = distance_of_time_in_words(start_time, start_time) | |
else | |
sleep(10) | |
end_count = Delayed::Job.count |
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
require 'typhoeus' | |
require 'yajl/json_gem' | |
require 'active_support/core_ext/hash' | |
require 'active_support/core_ext/object' | |
hydra = Typhoeus::Hydra.new | |
params = { u: "http://memecaptain.com/all_the_things.jpg", | |
tt: "All the things", | |
tb: "use memecaptain api!" }.to_param |
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
require 'active_support/core_ext/string' | |
str = "<p>Seeking self-motivated Senior SQL Server DBA who will work closely with development teams and support the enterprise databases for four automotive businesses.</p> <p> </p> <p> We are seeking a team player, who is a great communicator, that is well versed in SQL Server 2005 and 2008.</p> <p> </p> <p> This person should possess skills in SQL Server database administration including: performance tuning, backup and recovery, log shipping, and T-SQL.</p> <p> </p> <p> With limited supervision, the Sr DBA will be responsible for:</p> <p> </p> <ul> <li> The administration and maintenance of Enterprise level SQL Server 2005 and 2008 database systems for three Dominion companies supplying websites and CRM tools for automotive dealerships in an environment requiring 24 X 7 up time</li> <li> The management and administration of 30+ TB of data in a NetApp/EMC SAN environment in two hosting facilities</li> <li> Excellent internal customer service and decision-making a |
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
str = "<strong> </strong> <p> Hello dere! </p> <ul> <li> </li> <li> I am list </li> </ul>" | |
# Remove only whitespace | |
str.gsub(/((<[^>\/]+>)(\s+)(<\/[^>\/]+>))/, '\2\4') | |
#=> "<strong></strong> <p> Hello dere! </p> <ul> <li></li> <li> I am list </li> </ul>" | |
# Remove tags that contain only whitespace | |
str.gsub(/\s*<[^>\/]+>\s+<\/[^>\/]+>\s*/, '') | |
#=> "<p> Hello dere! </p> <ul><li> I am list </li> </ul>" |
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
def status_value(status) | |
return 1 if status=='pending' | |
return 2 if status=='active' | |
return 3 if status=='closed' | |
end | |
# Sort collection of job_postings by 'status' and 'posted_at DESC' on Orion | |
@jps = User.find_by_email("[email protected]").job_postings |
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
def counts_by_day_for_job_posting(job_posting_id) | |
results = JobApplication.where(job_posting_id: job_posting_id). | |
where(created_at: 1.month.ago..Time.now). | |
group('date(created_at)').count | |
counts = [] | |
results.each do |result| | |
h = { date: Date.parse(result.first), | |
job_posting_id: job_posting_id, | |
application_count: result.last } | |
counts << h |
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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="afowler" | |
export EDITOR="vim" |
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
[user] | |
name = XXXX | |
email = XXXX | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
[color "status"] | |
changed = yellow | |
added = green |
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/bash | |
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm | |
/usr/bin/sudo /usr/sbin/groupdel rvm | |
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete or comment out if this was a Per-User installation." |
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
(30.days.ago.to_date..Date.today).each do |date| | |
puts date.to_s | |
end |
OlderNewer