Skip to content

Instantly share code, notes, and snippets.

View mogox's full-sized avatar
🇲🇽
🤖

Enrique Carlos Mogollan mogox

🇲🇽
🤖
View GitHub Profile
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@mikegehard
mikegehard / gist:954537
Created May 4, 2011 00:35
Waiting until all jquery ajax calls are done
//Useful if you have a slow CI server...
When /^I wait until all Ajax requests are complete$/ do
wait_until do
page.evaluate_script('$.active') == 0
end
end

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jbaylor-rpx
jbaylor-rpx / salesforce_id.rb
Created May 14, 2012 03:35
Convert Salesforce IDs from 15 character to 18 characters (and back)
# Salesforce originally used case-sensitive 15-character IDs.
# Later they added three error-correcting characters to make their 18-character ID.
# This class converts from one to the other and back
#
# Usage:
# SalesforceId.convert('a0D30000001n7Pi') => 'a0D30000001n7PiEAC'
# OR
# SalesforceId.convert('a0D30000001n7PiEAC') => 'a0D30000001n7Pi'
# SalesforceId.convert('A0d30000001N7pIeAc') => 'a0D30000001n7Pi'
#
@rafaelp
rafaelp / find_unused_images.rake
Last active April 18, 2024 11:27
Rake task to find unused images on Rails project to deletion.
# It requires ACK - http://betterthangrep.com/
task :find_unused_images do
images = Dir.glob('app/assets/images/**/*')
images_to_delete = []
images.each do |image|
unless File.directory?(image)
# print "\nChecking #{image}..."
print "."
result = `ack -1 -G '(app|public)' --ruby --html --css --js #{File.basename(image)}`
@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@egaumer
egaumer / controller.js
Created May 14, 2013 11:20
Elasticsearch/AngularJS Pagination Example
$scope.pager = {
pageChange: function(pageNum) {
$scope.search(resultPager.get(pageNum));
},
next: function() {
this.pageChange(resultPager.next());
},
@afeld
afeld / gist:5704079
Last active November 27, 2023 15:43
Using Rails+Bower on Heroku
@mogox
mogox / gist:9143210
Last active March 29, 2016 00:24
Git tips(reminders)

Adding a remote

git remote add upstream https://github.com/otheruser/repo.git

List of remotes

git remote -v