Skip to content

Instantly share code, notes, and snippets.

View etozzato's full-sized avatar
💀
I work hard so my cat doesn't have to

Emanuele Tozzato etozzato

💀
I work hard so my cat doesn't have to
View GitHub Profile
rvm gemset empty && bundler install
category = {
'Gwen Plus Five' => 'customportraits',
'Marianne' => ''
'Sanders Tanya' => ''
'SATC' => ''
'Dearjohn' => ''
'Portlandpropr And Kids' => ''
'Friends With Benefits' => ''
'Seacreature' => 'illustrations'
'JonJill' => ''
@etozzato
etozzato / binary_combinations.rb
Created December 1, 2014 05:48
Binary Combinations for spreadsheet
0.upto(8){|i| puts i.to_s(2).rjust(4,'0').split(//).join("\t")}
# =>
# 0 0 0 0
# 0 0 0 1
# 0 0 1 0
# 0 0 1 1
# 0 1 0 0
# 0 1 0 1
# 0 1 1 0
@etozzato
etozzato / pivotaltracker.com.js
Created October 31, 2014 17:16
Sense of Urgency(TM) for PivotalTracker
function color(interval){
$('header.tc_page_header').css('background-color', 'rgb('+parseInt(Math.random()*255)+','+parseInt(Math.random()*255)+','+parseInt(Math.random()*255)+')')
setTimeout(function(){
color(interval);
},interval);
}
$('document').ready(function(){
setTimeout(function(){
$('h3[title="my work"]').html("<marquee>my Work</marquee>")
@etozzato
etozzato / subl.sh
Created October 30, 2014 17:32
Sublime Text 3 CLI (subl)
~  sudo ln -s /Applications/Sublime\ Text\ 3.app/Contents/SharedSupport/bin/subl /usr/bin/sub
~  chmod a+x /usr/bin/sub
@etozzato
etozzato / dst.js
Last active August 29, 2015 14:08
Working with ActiveSupport::TimeZone
// MomentJS can use different types of timezone offset
// including the one obtained by ActiveSupport::TimeZone
var timezone_offset = "+01:00";
console.log(moment().zone(timezone_offset).format('LLLL'));
> Tuesday, October 28 2014 7:51 PM
console.log(moment().format('LLLL'));
for TABLE in $(psql table_name -c "\dt" | awk '{print $3}'); do psql table_name -c "select '$TABLE', count(*) from $TABLE;" | grep -A1 "\-\-\-\-" | tail -1; done
@etozzato
etozzato / gist:85da5cb66ab935d06ebf
Created October 13, 2014 23:20
Window Resize
// in the component's didInsertElement
$(window).on('resize', function() {
return Em.run.debounce(that, 'resizeWindow', 250);
});
// in the route's willTransition
$(window).off('resize');
Processing by Api::Admin::MarkerActivitiesController#create as JSON
Parameters: {"title"=>"THIS IS OKAY", "description"=>"default description", "social_is_active"=>true, "social_description"=>"default description", "labels_is_active"=>true, "labels_description"=>"default description", "label_data"=>"[FILTERED]", "sentiment_is_active"=>true, "sentiment_description"=>"default description", "image_attachment"=>{"name"=>"Screen Shot 2014-06-20 at 12.47.55 PM.png", "type"=>"image/png", "data"=>"[FILTERED]"}, "api_version"=>"v1", "project_id"=>"3078", "marker_activity"=>{}}
// My Annotation object has labels, but only carries the list of label values
// "labels":["terr","anno"]
// This is the form of the full annotationLabel
// {"id":1,"label":"Terrifying","value":"terr"}
// {"id":2,"label":"Annoying","value":"anno"}