Skip to content

Instantly share code, notes, and snippets.

View rjfranco's full-sized avatar
🙂
Either working or playing video games

Ramiro Jr. Franco rjfranco

🙂
Either working or playing video games
View GitHub Profile
@rjfranco
rjfranco / spot.sh
Created May 10, 2012 20:24
Spot Alias for mdfind within a console directory
alias spot='mdfind -onlyin `pwd`'
@rjfranco
rjfranco / gist:2094651
Created March 19, 2012 04:17
Installing ruby-debug with ruby-1.9.3-p125
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p125 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@rjfranco
rjfranco / placeholders.coffee
Created January 23, 2012 18:33
Semantically Correct Backwards compatible placeholders.
# Created By Ramiro Jr. Franco for Crowdcompass
# http://ramiro.mx || http://www.crowdcompass.com
# Requires Modernizr with placeholder support - http://www.modernizr.com
#
# Essentially, I wanted a way to keep the nice <labels> in markup, but apply the
# placeholder styles in all browsers. This has been tested with FF 6+, Chrome 14+,
# IE7,8,9, and Safari 4+. When a browser does support the HTML5 placeholder it just
# kills the label and applies the placeholder attribute based on the Label text,
# otherwise it actually applies a method to the input to switch out the the value on
# focus / blur. For passwords it hides/shows a separate input field to retain
@rjfranco
rjfranco / generating_select_form_model.rb
Created January 3, 2012 03:45
Generating select from model
class Character < ActiveRecord::Base
has_many :weapons
end
class Weapon < ActiveRecord::Base
belongs_to :character
end
@rjfranco
rjfranco / variable_method_name.rb
Created December 21, 2011 00:21
use variable as method name
# trying to get "entity" to act as whatever you pass to method, so if you pass person @event.person would be returned.
# below is what I ended up using, just in case anyone else runs into this >.>
def get_scope(entity)
entity = entity.pluralize.downcase.to_sym
@event.send entity
end
@rjfranco
rjfranco / bash-output
Created December 1, 2011 08:50
cap deploy:migrations problem
ramiro@tedera:/var/www/ramiro.mx/current$ rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell '1.9.3@ramiromx' -c 'cd /var/www/ramiro.mx/releases/20111201083621 && rake RAILS_ENV=production db:migrate --trace'
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
stack level too deep
/usr/local/rvm/gems/ruby-1.9.3-p0@ramiromx/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => db:migrate => environment
@rjfranco
rjfranco / nginx.sh
Created November 29, 2011 21:35
Sample start script for passenger compiled nginx on ubuntu 10.04
#! /bin/sh
# After copying this to /etc/init.d/nginx and setting chmod + x then run update-rc.d -f nginx defaults
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@rjfranco
rjfranco / post.rb
Created November 27, 2011 22:28
Pieces of Rails App that is Giving no "name" method error
# Post Model
class Post < ActiveRecord::Base
belongs_to :user
validates :title, :presence => true
validates :content, :presence => true
end
@rjfranco
rjfranco / sample.scss
Created October 7, 2011 00:30
sample.scss
@import "reset";
@mixin rounded($radius: 5px) {
border-radius: $radius;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
}
@mixin shadow($dist: 5px, $str: 3px, $top: 0, $left: 0, $color: rgba(0,0,0,.1) ) {
box-shadow: $color $top $left $dist $str;
@rjfranco
rjfranco / maplocation.html
Created August 31, 2011 17:18
sample map location output
<div id='location_selectors'>
<ul>
<li class="select optional geo_selector" id="activity_geo_location_input" style="display:none"><label for="activity_location_id">Geo location</label>
<select id="activity_location_id" name="activity[location_id]">
<option value="1256">1256</option>
<option value="2664">2664</option>
<option value="3986">3986</option>
</select>
</li>
<li class="select optional map_selector_420" id="activity_area_input" style="display:none">