Skip to content

Instantly share code, notes, and snippets.

View giovannibenussi's full-sized avatar

Giovanni giovannibenussi

View GitHub Profile
@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@btoone
btoone / deploy.rb
Created August 17, 2011 14:48
Example Capistrano configuration for multi stage deployment
# app/config/deploy.rb
# Most of the changes specific to your environment will be set in
# the `app/config/deploy/[env].rb` files.
# define multiple deployments
set :stages, %w(production staging)
set :default_stage, "staging"
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@ktheory
ktheory / enumerable_pluck.rb
Created February 15, 2012 22:54
An Enumerable#pluck method for ruby
module Enumerable
def pluck(key)
map {|obj| obj[key] }
end
end
@ianmurrays
ianmurrays / devise.es.yml
Created March 19, 2012 19:53
Devise 2.0 Spanish Locale
es:
errors:
messages:
expired: "ha expirado, por favor pide una nueva"
not_found: "no encontrado"
already_confirmed: "ya fue confirmada. Intenta ingresar."
not_locked: "no ha sido bloqueada"
not_saved:
one: "Ha habido 1 error:"
other: "Han habido %{count} errores:"
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@cupakromer
cupakromer / gist:3371003
Created August 16, 2012 15:23
each_with_object vs inject
my_array = %w[test one two three]
# Inject takes the value of the block and passes it along
# This often causes un-intended errors
my_array.inject({}) do |transformed, word|
puts transformed
transformed[word] = word.capitalize
end
# Output:
# {}
@benyarb
benyarb / vimium_colemak
Last active November 18, 2023 04:37
Vimium Colemak Keybindings
# Custom key mappings
map n scrollDown
map N previousTab
map e scrollUp
map E nextTab
map i scrollRight
map I goForward