Skip to content

Instantly share code, notes, and snippets.

View olistik's full-sized avatar

Maurizio De Magnis olistik

View GitHub Profile
foo bar

Social Coding

Il corso si pone l'obiettivo di insegnare i rudimenti dello sviluppo di applicazioni web ad un gruppo di cittadini desiani.

Questo corso è da considerarsi come prima, esplorativa, iterazione e in quanto tale il numero di partecipanti sarà volutamente basso (4-6 persone massimo).

Ogni incontro avrà la durata indicativa di 1 ora.

I partecipanti si divideranno in coppie e ad ogni coppia sarà fornito un portatile. Durante ogni incontro l'uso del computer verrà alternato ad intervalli di 15 minuti tra i componenti della coppia. Questo approccio si chiama "pair-programming": sfruttando la condivisione della postazione la coppia ottiene una maggiore efficienza di apprendimento.

[2015-11-30 14:02:33] /home/olistik/.rvm/wrappers/ruby-2.2.3@rubinius/rake
current path: /home/olistik/.rvm/src/rbx-2.5.8
PATH=/home/olistik/.rvm/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/olistik/bin:/home/olistik/packages/go/bin:/home/olistik/projects/go/bin:/home/olistik/bin:/home/olistik/packages/go/bin:/home/olistik/projects/go/bin
command(3): /home/olistik/.rvm/wrappers/ruby-2.2.3@rubinius/rake install --trace
** Invoke install (first_time)
** Invoke build:build (first_time)
** Invoke vm/vm (first_time)
** Invoke vm/gen/config_variables.h (first_time)
** Invoke library/rubinius/configuration.rb (first_time, not_needed)
** Invoke config.rb (first_time, not_needed)
require "pp"
def generate_timestamps(count)
8.times.inject([Time.now]) do |memo, current|
memo << memo.last + current * (10 * rand).to_i + 10
end
end
timestamps = generate_timestamps(8)
@olistik
olistik / ruby-bridge--specifiche.md
Last active November 19, 2015 16:40
Documento dettagliato della struttura del corso Ruby Bridge

Il documento è stato spostato a questo link.

@olistik
olistik / discussion.rb
Created November 17, 2015 08:28
How to implement (Discussion N:M Tag) with ActiveRecord
class Discussion < ActiveRecord::Base
has_and_belongs_to_many :tags
def self.my_scope
# TODO: replace me with something meaningful
where("discussions.id < 10")
end
def self.tags_count
@olistik
olistik / ruby-bridge.md
Last active November 19, 2015 17:32
Ruby Bridge

Il documento è stato spostato presso questo link

@olistik
olistik / spank.rb
Last active November 10, 2015 13:29 — forked from anonymous/spank.rb
#encoding: utf-8
newT = Time.new
birth1 = gets.chomp
birth2 = gets.chomp
while birth2 > 12
puts ' immetti un mese che esista!!'
birth2 = gets.chomp
end
birth3 = gets.chomp
while birth3 > 31
@olistik
olistik / application_controller.rb
Created November 2, 2015 17:24
Prevents raised exceptions to be computationally expensive. Reference: https://gist.github.com/olistik/46a0b2879d6b5e7f616a
class ApplicationController < ActionController::Base
def index
foo_data.foo1
foo_data.foo2
request.xxx
end
private
@olistik
olistik / application_controller.rb
Last active November 2, 2015 17:19
In Rails, when you save an instance variable and the an exception occurs, the error reporting process calls `.inspect` on each instance variable, multiple times. This is extremely bad if you store objects whose representation is really expensive. An example is an Active Record scope matching a lot of objects (> thousands). The application simply…
class ApplicationController < ActionController::Base
def index
foo1 # creates the first instance variable
foo2 # creates the second instance variable
request.xxx # raises an exception
# see the logs, you should expect `.inspect` being called several times for each instance variable
end