This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TomTomHelper | |
# Generate Add To TomTom button | |
# You can pass following options hash: | |
# name - place name | |
# latitude - decimal latitude | |
# longitude - decimal longitude | |
# attribution - your attribution | |
# logo - link to your logo | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Float | |
# Convert decimal to degrees, minutes, seconds sexagesimal | |
# (used for GPS coordinates) | |
def to_sexagesimal | |
degrees = abs.floor | |
x = (abs - degrees) * 60 | |
minutes = x.floor | |
seconds = (((x - minutes) * 60) * 100).round.to_f / 100 | |
sign = self < 0 ? '-' : '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_to_rows($array, $cols, $complete = true) | |
{ | |
$rows = array_chunk($array, $cols); | |
$last = count($rows) - 1; | |
if (!$complete || $last < 0) | |
return $rows; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Returns the utf string corresponding to the unicode value (from php.net, courtesy - [email protected]) | |
function code2utf($num) | |
{ | |
if ($num < 128) return chr($num); | |
if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); | |
if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); | |
if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); | |
return ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Breaks long non-breaking string | |
*/ | |
function break_nonbreaking($str, $max_length = 20, $breaker = ' ') | |
{ | |
$max_length = (int)$max_length; | |
preg_match_all("/[^\s]{{$max_length},}/", $str, $m); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'exifr' | |
data = Dir.glob("photos/*.jpg").collect do |file| | |
{ | |
:file => file, | |
:time => EXIFR::JPEG.new(file).date_time, | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blynus tai reikia kepti is miltu, vandens, truputi pieno ir 1-2 kiausiniu | |
tesla turi buti gana skysta, kad dideli blynai iseitu | |
o padazui reikia isvirti bulviu | |
jas sutrinti | |
pakepti spirguciu | |
ir tada ta bulviu kose su gana nemazai pieno ir tais spirguciais pakepinti keptuveje | |
pieno reikia ipilti tiek, kad padazas butu ne sausas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usualy we hang out in Kreuzberg, Friedrichshein and Prenzlauerberg areas as well as Mitte (center). | |
http://berlin.unlike.net/locations/39-Club-der-Visionaere | |
Club der Visionaere - an outside bar/club/place to hang out in Kreuzberg. It's IN one of the canals, on some sort of floating rafts. | |
Schlesische str., leading to the club is also worth noticing with one of the best indian food restaurants and lots of small watering holes. L.U.X .with live bands and Vendel with experimental poetry in german are my favourites:) | |
Bar 25 - another outside bar on the bank of river. 3 day parties or just to sit back and spend a warm afternoon. Also has circus, motel and restaurant. | |
http://berlin.unlike.net/locations/272-Bar-25 | |
Hops & Barley brewery pub (Friedrichshain) - locally brewed beer in one of my favourite neighbourhoods. The whole area between Boxhander str and Simon Dach str. is dense with pubs, thai food restaurants and Kieze-kiosks (small shops with astounishing variety of beers). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Update GeoLite Cities database from MaxMind | |
# (C) 2010 Laurynas Butkus laurynas.butkus at gmail.com | |
# | |
TMP=/tmp | |
TARGET_DIR=/usr/local/share/GeoIP | |
cd $TMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FormBuilderHelper | |
def multi_locale_field(method, opts = {}) | |
opts = { | |
:type => :text_field | |
}.merge(opts) | |
type = opts.delete(:type) | |
html = [] | |
OlderNewer