Skip to content

Instantly share code, notes, and snippets.

Mario Andrés macool

Block or report user

Report or block macool

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View users_list.txt
Apellido1 Apellido2 Nombre1
Apellido1 Apellido3 Nombre2
Apellido1 Apellido4 Nombre1
Peter González Parker
Peter González Parker
View test.csv
descripcion tags
prueba uno tag1,tag2
macool / psql_encoding.sql
Created Nov 16, 2015 — forked from turboladen/psql_encoding.sql
Script for dealing with creating Postgres databases that complain with: ``` PG::InvalidParameterValue: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. ``` ...when trying to create the production DB. Taken from:…
View psql_encoding.sql
sudo su postgres
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
macool / gauges-with-turbolinks.js
Created Sep 5, 2015
gauges to work with turbolinks on rails
View gauges-with-turbolinks.js
macool /
Created Aug 23, 2015
make facebook sdk work with turbolinks on rails 4
appId = *******
$ ->
bindFacebookEvents() unless window.fbEventsBound
bindFacebookEvents = ->
.on('page:fetch', saveFacebookRoot)
.on('page:change', restoreFacebookRoot)
macool / queries.sql
Last active Aug 29, 2015
Foodbank vouchers query results
View queries.sql
/* Original query */
SELECT CONCAT(clientFirstName, clientLastName) AS fullName, count(*) AS ocurrences
FROM vouchers
WHERE BETWEEN "2011-01-01" AND "2011-12-31"
GROUP BY fullName
HAVING count(*) >= 2 AND count(*) <= 20
/* taking ~457ms */
/* for 2012: ~1.79s */
/* for 2013: ~5.24s */
/* for 2014: ~2.63s */
macool / terminal output
Created Feb 4, 2015
travis vm debugging sxt specs
View terminal output
travis@debug-hs-12736-matthewford-ruby-1423060806:~/bitzesty/sxt$ bundle install --without development deployment --jobs=3 --retry=3
Fetching source index from
Fetching git://
Fetching git://
Installing Platform 0.4.0
Installing rake 10.3.2
Installing i18n 0.7.0
Installing multi_json 1.10.1
View base.rb
def material_pictograms_for_region(region)
return "" unless material.pictograms_of(region).present?
hazard_pictograms = []
pictograms_path = Rails.root.join("app/assets/images/hazard-pictograms/")
image_names = Dir[pictograms_path + "*.png"].map { |f| f.split("/").last }! {|n| File.basename(n,File.extname(n)) } # remove png extension
image_names = image_names.sort.reverse # so that we select latest coincidence
material.pictograms_of(region).map { |pic|
pic.image_name if pic.image_name.present?
} { |pictogram_name|
View gist:cb80c634b8a5ce37208f
describe 'If a geographical area has a parent geographical area group then the
validity period of the parent geographical area group must span the validity
period of the geographical area' do
describe "GA5" do
let(:geographical_area) {
parent_geographical_area_group_sid: parent_id)
View failing specs
GoogleAccessToken add some examples to (or delete) /Users/macool/Documents/development/TrussellTrust/FoodbankWeb/spec/models/google_access_token_spec.rb
# No reason given
# ./spec/models/google_access_token_spec.rb:4
1) Donor should correctly summaries donations by event for a foodbank in a defined date range
Failure/Error: result = Donor.find_donation_weight_by_event_for_foodbank_in_date_range(, start_date, end_date)
You can’t perform that action at this time.