Skip to content

Instantly share code, notes, and snippets.

View FanaHOVA's full-sized avatar
🛠️
Automating

Alessio Fanelli FanaHOVA

🛠️
Automating
View GitHub Profile
@LucaRonin
LucaRonin / assignment.md
Last active March 22, 2016 13:46
Wanderio Assignment

L’obiettivo dell’esercizio è realizzare una piccola applicazione Rails che, dati un punto di partenza e destinazione, restituisca durata e prezzo medio dei tragitti disponibili con i diversi mezzi di trasporto (volo, treno e bus).

Come esempio di ricerca puoi considerare la tratta Roma - Milano.

Di seguito un esempio di utilizzo dell’applicazione:


Endpoint: <host>/search/Rome/Milan

@mahemoff
mahemoff / bulk_update.rb
Created January 22, 2016 11:59
simple active record bulk-updater with different values in a single column Raw
class ActiveRecord::Base
def self.bulk_update(column, values_by_id)
ids = values_by_id.keys.join(',')
query = []
query << ["UPDATE #{self.table_name} SET #{column}=case id"]
query << values_by_id.map { |id, count|
"WHEN #{id} THEN #{count}"
}
query << "END"
query << "WHERE id IN (#{ids})"
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh