Skip to content

Instantly share code, notes, and snippets.

View stefanoverna's full-sized avatar

Stefano Verna stefanoverna

View GitHub Profile
class CreateBooking
class LimitReached < RuntimeError; end
class AlreadyBooked < RuntimeError; end
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_reader :slot_id
attr_reader :book_cart
#= require ./behaviour
class @GeocodedField extends Behaviour
init: ->
@$latField = @domData('lat-dom')
@$lngField = @domData('lng-dom')
startingValue = @$dom.val()
if startingValue.length > 0
require 'kss'
styleguide = Kss::Parser.new('app/assets/stylesheets')
puts styleguide.sections
module Renderer
def self.render options = {}
assigns = options.delete(:assigns) || {}
view = view_class.new ActionController::Base.view_paths, assigns
view.extend ApplicationHelper
view.extend CustomHelper

Esempio di utilizzo di Grunt

require "virtus"
module Commands
module Base
def self.included(base)
base.extend ClassMethods
base.include Virtus.model
base.include ActiveModel::Validations
base.prepend InstanceMethods
@stefanoverna
stefanoverna / turing.md
Last active August 29, 2015 14:23
Macchine di Turing

Simulatore macchina di Turing

http://morphett.info/turing/turing.html

Consiglio: prima di scrivere la versione "a codice" vi conviene fare il disegnino :)

Macchine di Turing da realizzare

1) Una macchina che arriva alla fine dei dati (0/1) e si ferma

[
{
"name":"Rattata",
"id":19
},
{
"name":"Charmander",
"id":4
},
{
var request = require("request");
var FeedParser = require("feedparser");
var sanitizeHtml = require('sanitize-html');
var Iconv = require('iconv').Iconv;
var Promise = require('bluebird').Promise;
function feedItems(url) {
return new Promise(function(resolve, reject) {
var req = request(url, { timeout: 10000, pool: false });
req.setMaxListeners(50);
@stefanoverna
stefanoverna / doc.md
Last active February 10, 2016 21:41
Dato API Documentation

Session

A session is required to access to read-and-write API endpoints

Attributes

Name Type Description Example
id string JSON web token for the session "eyJCJhbGci.eyJhaWwuY29tIn0.32wQOMci"
links:user:linkage:id string ID of user "312"
@stefanoverna
stefanoverna / gist:a765e310d96beea5d502
Created February 19, 2016 13:32
Batch create AIFI
paragraph = titolo, body, immagine, attachment
attachment = titolo, body, file
gruppo = titolo, descrizione, attachments
articoli = titolo, body, published_at, immagine, attachment
DOMAIN = "magazine-admin.bookrepublic.it"
ActiveRecord::Base.transaction do
existing_space = Space.by_domain(DOMAIN)
existing_space && existing_space.destroy!