Esempio di utilizzo di Grunt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #= require ./behaviour | |
| class @GeocodedField extends Behaviour | |
| init: -> | |
| @$latField = @domData('lat-dom') | |
| @$lngField = @domData('lng-dom') | |
| startingValue = @$dom.val() | |
| if startingValue.length > 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "virtus" | |
| module Commands | |
| module Base | |
| def self.included(base) | |
| base.extend ClassMethods | |
| base.include Virtus.model | |
| base.include ActiveModel::Validations | |
| base.prepend InstanceMethods |
http://morphett.info/turing/turing.html
Consiglio: prima di scrivere la versione "a codice" vi conviene fare il disegnino :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name":"Rattata", | |
| "id":19 | |
| }, | |
| { | |
| "name":"Charmander", | |
| "id":4 | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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! |