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
ActivityLogIteration.latest.where('end_date is null').find_each do |iteration| | |
iteration.set_duration_in_days_until_today | |
iteration.save | |
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
Property.all.each do |property| | |
property.activity_logs.each do |activity_log| | |
iterations = activity_log.activity_log_iterations.order('iteration_time desc') | |
iterations.each_with_index do |iteration, index| | |
next_iteration = iterations[index+1] | |
if next_iteration.present? | |
iteration.update_column(:end_date, next_iteration.iteration_time) | |
end | |
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
User.find_by_email('[email protected]').properties.each do |property| | |
property.activity_logs.each do |activity_log| | |
iterations = activity_log.activity_log_iterations.order('id desc') | |
puts iterations | |
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
User.find_by_email('[email protected]').properties.each do |property| | |
property.activity_logs.each do |activity_log| | |
iterations = activity_log.activity_log_iterations.order('id desc') | |
iterations.each_with_index do |iteration, index| | |
next_iteration = iterations[index+1] | |
if next_iteration.present? | |
iteration.update_column(:end_date, next_iteration.iteration_time) | |
end | |
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
git for-each-ref --sort=-committerdate refs/heads/ --format='%1B[0;32m%(authorname)%09%1B[0;36m(%(committerdate:relative))%09%1B[0;33m%(refname:short)%09%1B[m%(subject)' --count 15 | tail -r | column -t -s $'\t' |
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
# Typically in Rails to use VCR we setup the RSpec config like so: | |
RSpec.configure do |config| | |
config.extend VCR::RSpec::Macros #deprecated | |
end | |
# This gives us access to the use_vcr_cassette method: | |
describe Reviewed::Article do | |
use_vcr_cassette 'article/grill' | |
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
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
[[ -s "$HOME/.nvm/nvm.sh" ]] && . /Users/chris/.nvm/nvm.sh # This loads NVM | |
PATH=$PATH:/usr/local/sbin |
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
describe 'custom flyers' do | |
use_vcr_cassette :record => :new_episodes | |
let(:property){ create :property, custom_flyer: File.open(Rails.root.join "spec/fixtures/space_flyers/horizontal_flyer.pdf") } | |
let(:space){ create :space, custom_flyer: File.open(Rails.root.join "spec/fixtures/space_flyers/vertical_flyer.pdf"), property: property } | |
before do | |
binding.pry | |
visit property_path(property) |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
jQuery.fn.MytoJson = function(options) { | |
options = jQuery.extend({}, options); | |
var self = this, | |
json = {}, | |
push_counters = {}, | |
patterns = { | |
"validate": /^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/, | |
"key": /[a-zA-Z0-9_]+|(?=\[\])/g, |