Skip to content

Instantly share code, notes, and snippets.

💿

Rolando Murillo rnmp

💿
Block or report user

Report or block rnmp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:916788
def create
@roll = Roll.new(params[:roll])
@rolls = Roll.all(:order => "created_at DESC", :limit => 5)
# Creating a random id & name in case is empty
@number = (rand(900000)+100001)
@roll.id = @number
if @roll.name.empty?
@roll.name = "Roll #" + @number.to_s
end
@rnmp
rnmp / gist:916793
Created Apr 13, 2011
Remove '#' or '0x' from hexadecimal color codes
View gist:916793
def create
color = params[:color]
color[:color].gsub!(/^(#|0x)/, '')
@color = Color.new(color)
@color.user = current_user
if @color.save
redirect_to(root_url)
end
end
@rnmp
rnmp / gist:917798
Created Apr 13, 2011
Register the clicked position of the page in a form
View gist:917798
$(function(){
var page = $('#page')
page.prepend('<i id="position" />');
var position = $('#position')
position.hide();
$('.submit-hover').hide();
page.click( function(e){
$('#x').val(e.pageX);
$('#y').val(e.pageY);
position.css('top', e.pageY - 15);
@rnmp
rnmp / gist:917816
Created Apr 13, 2011
Sums the total time (float)
View gist:917816
class Project < ActiveRecord::Base
belongs_to :company
has_many :logs
validates_presence_of :name
def total_hours
total_time = 0
logs.each do |l|
total_time += l.time.to_f
@rnmp
rnmp / gist:958164
Created May 5, 2011
:rsync Rakefile
View gist:958164
require 'nanoc3/tasks'
user = "serveradmin@acualicio.us"
server = "acualicio.us"
path = "/nfs/c05/h01/mnt/70722/users/.home/domains/acualicio.us/"
# message = "changed on" + Time.now.localtime.strftime("%Y-%m-%d")
task :sync do
system "rsync -vru --exclude='.DS_Store' html #{user}@#{server}:#{path}"
end
View README.markdown

Tabit

The God's easiest way to create tab-based interface.

Example

$(function(){
  $('#example').tabit();
});
@rnmp
rnmp / gist:985242
Created May 22, 2011
CSS3 gradients background clipping
View gist:985242
h1 {
background: #eee -webkit-gradient(linear,
left 20, left 40,
color-stop(0, transparent),
color-stop(0.5, rgba(0, 0, 0, 0.33)),
color-stop(0.25, rgba(0, 0, 0, 0)),
color-stop(0.75, transparent));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent; }
@rnmp
rnmp / gist:1002206
Created Jun 1, 2011
Perform an action when one or more checkboxes are checked
View gist:1002206
var runWhenClicked = function(){
var checked = $('#fave-restaurants').find(":checked");
checked.length > 0 ? $('#find-table-favorite').text('Buscar en los seleccionados') : $('#find-table-favorite').text('Buscar mesas'); }
$(':checkbox').click(runWhenClicked);
@rnmp
rnmp / gist:1002209
Created Jun 1, 2011
Zoom in CSS3 animation
View gist:1002209
@-webkit-keyframes roll-action {
0% {
-webkit-transform: scale(2);
opacity: 0; }
100% {
-webkit-transform: scale(1);
opacity: 1; } }
span.roll-result {
-webkit-animation: roll-action 0.25s; }
View README.md

Divit

A tiny grid-system designed to fit on almost any width of your container by providing percentage-based proportions.

You can’t perform that action at this time.