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: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 / btn-group-radio.css
Last active October 11, 2017 09:00
Pure CSS3 Bootstrap Radio Buttons
.btn-group-radio input[type=radio] {
visibility: hidden;
position: absolute !important;
top: -9999px !important;
left: -9999px !important;
}
.btn-group-radio input[type=radio]:checked + .btn {
color: #333333;
background-color: #e6e6e6;
@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"] {
@tagliala
tagliala / forms.css
Created August 2, 2013 21:16
Firefox default forms.css
/* 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/. */
/**
Styles for old GFX form widgets
**/
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
@tagliala
tagliala / 3.2.1.html
Created October 16, 2013 15:18
How to profile CSS selectors?
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
<title>FA 3.2.1 performance test</title>
<script src="js/test.js"></script>
<link rel="stylesheet" href="css/font-awesome.3.2.1.min.css">
</head>
<body onload="test()" id="body" data-icon-class="icon"></body>