Skip to content

Instantly share code, notes, and snippets.

Franco Rondini rondinif

View GitHub Profile
@rondinif
rondinif / gist:9058989
Created Feb 17, 2014
Debugging Mobile Chrome using Desktop Chrome via ADB port forwarding.
View gist:9058989
adb forward tcp:9222 localabstract:chrome_devtools_remote
@rondinif
rondinif / gist:9870604
Created Mar 30, 2014
Come ottenere il nome dell'ultimo file scaricato, come copiare l'ultimo file scaricato in file di lavoro temporaneo.
View gist:9870604
> ls -t ~/Downloads | head -1
LISTA_MOVIMENTI_20140330101644484.csv
> cp `ls -t ~/Downloads | head -1` workfile.csv
@rondinif
rondinif / gist:9876953
Created Mar 30, 2014
Some CVS transformation in Ruby
View gist:9876953
> cat workfile.csv | ruby -rcsv -ne '
row = CSV.parse_line($_)
puts CSV.generate_line(row, {col_sep: ";" })
' > work1.csv
> cat workfile.csv | ruby -rcsv -ne '
row = CSV.parse_line($_)
row.each {|elem| elem.tr!(",.",".,") if elem.match(/^-?[0-9,.]+$/)}
puts CSV.generate_line(row, {col_sep: ";" })
View how_to_convert_dos_2_unix
student=1
topic=DownloadBoundServiceAsync
gdsrc=~/projects/coursera/posa-002/POSA-14-20140706/grading-drivers/week-8-assignment-7/W8-A7-ThreadedDownloads-BoundServices/src/edu/vuum/mocca/$topic.java
peer_assesment=./peer-assessments/week8/s$student/$topic.java
tmp_peer_assesment=./tmp/$topic.java
awk '{ sub(/\r$/,""); print }' < $peer_assesment > $tmp_peer_assesment
opendiff $gdsrc $tmp_peer_assesment
@rondinif
rondinif / StatelessCalculator.java
Last active Dec 16, 2015
StatelessCalculator.java
View StatelessCalculator.java
package org.rondadev.samples;
/**
* @author rondadev
*
*/
public class StatelessCalculator {
public double add(double a, double b) {
return a + b;
}
@rondinif
rondinif / StatefulCalculator.java
Created Apr 29, 2013
StatefulCalculator.java
View StatefulCalculator.java
package org.rondadev.samples;
/**
* @author rondadev
*
*/
public class StatefulCalculator {
private StatelessCalculator calculator;
double register = 0;
View sample_app.rb
# singleton-as-module loaded once, kept in memory
module App
module Global extend self
def calc
@calc ||= StatefulCalculator.new
end
end
end
View config.ru
root = File.dirname(__FILE__) # => "."
require File.join( root, 'sample_app' ) # => true
run Sample # ..in sample_app.rb ..class Sample < Sinatra::Base
View Gemfile
source :rubygems
gem 'sinatra'
gem 'warbler'
View gist:5481142
rvm use --create jruby-1.6.7@jruby_sinatra
export JRUBY_OPTS=--1.9
You can’t perform that action at this time.