Skip to content

Instantly share code, notes, and snippets.

View descovi's full-sized avatar
🐈
Programming with cat

Alessandro Descovi descovi

🐈
Programming with cat
View GitHub Profile
@descovi
descovi / gist:1292946
Created October 17, 2011 15:59
Common
strlen('stringa');
ini_set('display_errors', 'On');
filter_var('stringa',FILTER_VALIDATE_EMAIL);
@descovi
descovi / validation-outside.rb
Created March 8, 2012 16:30
rails 3 validation outside model (active record)
########
class ActivationCode
include ActiveModel::Validations
attr_accessor :activation_code
validates :activation_code, :presence => true
def initialize(activation_code)
@activation_code = activation_code
@descovi
descovi / rimuovi_css.js
Created April 23, 2012 10:32
Rimuovere un css al volo.
document.styleSheets[0].disabled = true
@descovi
descovi / gist:2693795
Created May 14, 2012 12:56
Sublime Text 2 - Ruby bindings
/packages/user/Default (OSX).sublime-keymap
[
{
"keys": ["shift+ctrl+super+f"],
"command": "open_dir",
"args": {"dir": "$file_path", "file": "$file_name"}
},
{
"keys": ["command+shift+."],
@descovi
descovi / gist:2699883
Created May 15, 2012 08:00
Sublime Text 2 - Sublime Linter - Remove
//remove annoying hint about semicolon in sublime linter
"jshint_options":
{
"evil": true,
"regexdash": true,
"browser": true,
"wsh": true,
"trailing": true,
"sub": true,
@descovi
descovi / ciccione.css
Created May 25, 2012 15:08
pulsanti ciccione
.ciccione {
width: 257px;
border-radius: 6px;
font-size: 18px;
padding: 18px;
padding-left: 10px;
padding-top: 10px;
padding-bottom: 10px;
color: #555;
border: 1px solid #CCC;
@descovi
descovi / replacement.css
Created September 3, 2012 14:32
CSS replacement di Nicolas Gallagher
.replace {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@descovi
descovi / event_custom.js.coffee
Created September 24, 2012 10:46
Event custom in coffescript
# launch event
$('body').trigger 'event_custom'
# capture the event
$('body').bind 'event_custom', ->
alert "event fired!"
@descovi
descovi / pagine.js.coffee
Created October 1, 2012 16:58
Quanto è bella?
$.ajax 'http://localhost:3000/risorsa/index',
type: 'GET',
data: "uniquekey=#{codice_commessa}",
dataType: 'json',
processData: true,
success: (data)->
customer = data.customer
for key, value of data.productInstance
if value.productName == "SCHEDA_AZIENDA_GIALLO"
productReferenceUrl = value.productReference.replace("ITA|","")
@descovi
descovi / application.rb
Created October 10, 2012 17:19
Settare l'applicazione per avere una timezone comune.
# Le query ora dialogano non più su utc ma sono impostato sulla time zone Italiana.
module Registration
class Application < Rails::Application
config.time_zone = 'Rome'
config.active_record.default_timezone = :local