Skip to content

Instantly share code, notes, and snippets.

View dubilla's full-sized avatar

Dan Ubilla dubilla

View GitHub Profile
@dubilla
dubilla / index.html
Created September 5, 2012 23:46
Just a very simple css3 spinner made with only 2 divs, it will work on every browsers except IE because it doesn't support css animations. You only have to change the LESS variables a the top of the css and it'll do the trick :)
<div class="spinner">
<span class="mask"></span>
</div>
@dubilla
dubilla / index.html
Created September 5, 2012 23:46
Just a very simple css3 spinner made with only 2 divs, it will work on every browsers except IE because it doesn't support css animations.
<div class="spinner">
<span class="mask"></span>
</div>
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,
=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')
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)
@dubilla
dubilla / gist:7455749
Created November 13, 2013 20:24
CK's Bash profile
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
# 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
@dubilla
dubilla / branches
Created December 30, 2013 18:24
Display last n branches
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'
@dubilla
dubilla / gist:8345195
Created January 10, 2014 01:08
Script for single user
User.find_by_email('sales@viewthespace.com').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
User.find_by_email('sales@viewthespace.com').properties.each do |property|
property.activity_logs.each do |activity_log|
iterations = activity_log.activity_log_iterations.order('id desc')
puts iterations
end
end