Skip to content

Instantly share code, notes, and snippets.

View paganotoni's full-sized avatar
💭
⚡️⚡️

Antonio Pagano paganotoni

💭
⚡️⚡️
View GitHub Profile
@paganotoni
paganotoni / get_location_1.js
Created May 12, 2011 21:32 — forked from wadey/get_location_1.js
SimpleGeo JavaScript getLocation examples
client.getLocation({enableHighAccuracy: true}, function(err, position) {
if (err) {
// Could not retrieve location information. Check err for more information
} else {
// Latitude and longitude available in position.coords
}
});
@paganotoni
paganotoni / heroku_autoscale.rb
Created November 23, 2011 14:36
Heroku Autoscale + Min and Max Workers
# Inspired by https://gist.github.com/1332883
module HerokuAutoscale
module Scaler
class << self
@@heroku = Heroku::Client.new( ENV['HEROKU_USER'], ENV['HEROKU_PASS'] )
def workers
@@heroku.info(ENV['HEROKU_APP'])[:workers].to_i
end
@paganotoni
paganotoni / parametersToControllerUnit.groovy
Created December 31, 2011 01:11
Adding Hash of parameters for ControllerUnitTest on groovy
def parameters = [ title: "Basic", company:"Experience", location:"Boston", type: "Senior", salary: "80k", description: " BAsic desc", experience: "Experience", draft: "false", email: "antonio@pagano.com",industries: "Ind1, ind2", functions: "BB", experiences: "experiences",skills: "Skill1" ]
parameters.each{
controller.params."${it.key}" = it.value
}
@paganotoni
paganotoni / delete_historical_trash.rb
Created January 5, 2012 20:32
How to delete historical trash on mongo
ids = HistoricalQuery.alive_queries_ids
HistoricalElement.not_in( query_id: ids ).delete_all
@paganotoni
paganotoni / Month_DD_YYYY.groovy
Created January 7, 2012 17:05
Month_DD_YYYY format for new Groovy Date
String.format('%tB %<te %<tY', new Date())​
@paganotoni
paganotoni / gist:1679093
Created January 25, 2012 22:05
PorDiosNo
<span class="subcategory">
<input type="text" id="companyName" name="companyname" value="" style="WIDTH: 200px;">
<span class="validate_job_company" style="margin:0px; padding:0px; color:red"></span>
<div class="delete_link" style="display: inline-table;">
<a href="#" onclick="javascript:jQuery(this).parent().parent().parent().parent().remove();return false;" style="padding-top: 0px;">Remove</a>
</div>
</span>
....
@paganotoni
paganotoni / psql_csv_load
Created February 13, 2012 15:13
PSQL Load from CSV
copy <table name> from '/Users/charlypalencia/Desktop/<file).csv' using delimiters ',';
@paganotoni
paganotoni / projects_function.zsh
Last active October 2, 2015 01:47
Projects Function for Zsh
# This is my projects function
PROJECTS_DIR="/Users/$(whoami)/Projects"
p() {
PROJECT_NAME="$1";
if [ -d "$PROJECTS_DIR/$PROJECT_NAME" ]; then
cd "$PROJECTS_DIR/$PROJECT_NAME";
else
echo "\n| ERROR: Hey! Project '$PROJECT_NAME' doesn't exist \n| please check the folder name exists inside your \$PROJECTS_FOLDER\n"
fi
@paganotoni
paganotoni / escape.js
Created May 9, 2012 03:37
Escape function for JS pattern related strings
// Thanks to kouphax
RegExp.escape = function(str){
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
return str.replace(specials, "\\$&");
}
@paganotoni
paganotoni / mixins.groovy
Created May 24, 2012 13:32
Simple Groovy Mixin example
class Other {
def first = {
return list[0]
}
def hello(){
return "hello ${ myName() }"
}
}