Skip to content

Instantly share code, notes, and snippets.

View tagliala's full-sized avatar
🏠
Working from home

Geremia Taglialatela tagliala

🏠
Working from home
View GitHub Profile
@tagliala
tagliala / gist:6cfe162c3294924e77da
Created August 28, 2014 08:18
Friendly Id bug with globalize
# Activate the gem you are reporting the issue against.
gem 'activerecord', '3.2.19'
gem 'friendly_id', '4.0.10.1'
gem 'globalize', '3.0.4'
gem 'i18n'
require 'active_record'
require 'friendly_id'
require 'globalize'
require 'minitest/autorun'
@tagliala
tagliala / gist:7e2dcd600cc015b07a8a
Created January 21, 2015 14:39
Recursively optimize images
find . -name "*.jpg" -type f -exec jpegtran -copy none -optimize -progressive -outfile {} {} \;
find . -name "*.png" -type f -exec optipng {} \;
@tagliala
tagliala / SassMeister-input.scss
Created June 19, 2015 09:32
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin variable-icon-font($icon-code) {
content: #{"\"\\"}#{$icon-code + "\""};
}
@tagliala
tagliala / gist:3655017
Created September 6, 2012 11:19
distance from
# http://www.movable-type.co.uk/scripts/latlong.html
def distance_from(place, unit = :km)
radius = (unit == :km) ? 6371 : 3959
dLat = (place.source[:lat] - source[:lat]) * Math::PI / 180
dLon = (place.source[:lng] - source[:lng]) * Math::PI / 180
lat1 = source[:lat] * Math::PI / 180
lat2 = place.source[:lat] * Math::PI / 180
a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2)
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))
@tagliala
tagliala / sidebar.js
Created October 27, 2012 23:46
[W.I.P] Facebook-like sidebar for twitter bootstrap
/* =============================================================
* bootstrap-sidebar.js v2.1.2
* http://twitter.github.com/bootstrap/javascript.html#sidebar
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@tagliala
tagliala / style.json
Created December 19, 2012 20:08
Google Maps Facebook Style
[
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{ "color": "#b1bdd6" }
]
},{
"featureType": "water",
"elementType": "labels.text.fill",
@tagliala
tagliala / random_close_location.rb
Created January 6, 2013 15:06
Random location near source
def random_close_location(max_dist = 0.5, km = true)
# http://www.geomidpoint.com/random/calculation.html
return unless source && source[:lat] != nil && source[:lng] != nil
deg_to_rad = Math::PI / 180
rad_to_deg = 180 / Math::PI
radius_earth_M = 3960.056052
radius_earth_Km = 6372.796924
@tagliala
tagliala / style.css
Created February 26, 2013 11:38
Pure CSS3 filled-in Radio Buttons feat. FontAwesome
.circle-radio-boxes {
margin-left: -10px;
padding-top: 5px;
}
.circle-radio-boxes input[type=radio] {
visibility: hidden;
position: absolute !important;
top: -9999px !important;
left: -9999px !important;
}
@tagliala
tagliala / gist:5705809
Last active December 18, 2015 01:39
svg people marker, home marker google maps
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize() {
@tagliala
tagliala / html.css
Created August 2, 2013 21:10
Firefox mobile default stylesheet
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* bidi */
[dir="rtl"] {