Skip to content

Instantly share code, notes, and snippets.

View nicolaracco's full-sized avatar

Nicola Racco nicolaracco

  • Calco, LC - Italy
View GitHub Profile

Keybase proof

I hereby claim:

  • I am nicolaracco on github.
  • I am gawaine (https://keybase.io/gawaine) on keybase.
  • I have a public key whose fingerprint is 393F 9DE5 851F E42B F7EC D433 FBF3 A259 E8B8 532B

To claim this, I am signing this object:

@nicolaracco
nicolaracco / god
Created February 14, 2014 15:35
GOD init script for RHEL
#!/bin/bash
#
# God under multi-user RVM
#
# http://god.rubyforge.org
# http://beginrescueend.com/integration/god/
#
# chkconfig: - 85 15
# description: Control the God gem. Expects the gem to \
# to be installed under a multi-user RVM \
@nicolaracco
nicolaracco / datepicker-html5-glue.js
Created January 31, 2014 10:11
Glue to allow you to work with date inputs using the native datepicker when supported and JQuery UI as a fallback
(function() {
var setupDatePickerGlue = function($el, format) {
var elName = $el.attr("name"), // field name
elId = $el.attr("id"), // field id
elValue = $el.attr("value"); // field raw value
// remove the name to prevent value conflict on submit
$el.removeAttr("name");
// prepend an hidden input field with the same name
$el.before($("<input type='hidden' name='" + elName + "' id='raw-" + elId + "' />"));
# app.coffee
require 'express'
class Server
constructor: ->
@app = express()
@server = http.createServer(@app)
@io = SocketIO.listen @server, logger: @logger
@configure_app()
# app.coffee
require 'express'
class Server
constructor: ->
@app = express()
@server = http.createServer(@app)
@io = SocketIO.listen @server, logger: @logger
@configure_app()
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :domain, 'server.ovofarm.com'
set :user, 'user'
set :forward_agent, true
set :deploy_to, '/var/apps/studioinnovo'
set :repository, 'ssh://git@bitbucket.org/gawaine/studioinnovo.git'
#using excel
ExcelFile::Sheet.defile :game_of_thrones_episodes do
#dunno @ the moment
end
ExcelFile::Row.define :episode_row do
attribute :name
attribute :index
attribute :description
@nicolaracco
nicolaracco / refactoring.coffee
Created October 21, 2011 13:27
bindEvents refactoring
Class Product
options: ['size', 'fitting', 'last']
constructor: (@availabilities) ->
@bindEvents()
bindEvents: ->
for option in @options
callback = _(@optionClickHandler).bind @, option
@container(option).find('a').click callback
function testWithoutParentheses() {
var start = new Date();
var end;
var a = 0;
for (var i = 0; i < 1000000000; i++)
if (i % 2 == 0)
a++;
end = new Date();
return end-start;
}
class Carta {
private static enum Seme { Oro, Bastoni, Coppe, Spade }
private int value;
private Seme seme;
public Carta(int value, Seme seme) { this.value = value; this.seme = seme; }
public int getValue() { return int; }
public Seme getSeme() { return seme; }
}