A Pen by Flavio De Stefano on CodePen.
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 | |
$db = new PDO('mysql:host=localhost;dbname=randomplaces', 'root', ''); | |
for ($i=0; $i<500; $i++) { | |
$lat = rand(35,47).'.'.rand(); | |
$lng = rand(9,20).'.'.rand(); | |
$url = "https://maps.googleapis.com/maps/api/geocode/json?sensor=false&latlng=".$lat.",".$lng; | |
$json = json_decode(file_get_contents($url),1); |
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/bash | |
# How to install | |
# curl https://gist.github.com/kopiro/8859612/raw -o /usr/local/bin/ti-resize | |
# How to use | |
# Put all your assets @2x in your $TITANIUM_PROJECT/assets | |
# Open Terminal | |
# ti-resize (in your Titanium Project directory) |
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
var bb = [ | |
_.min($$.pluck('lat')), _.min($$.pluck('lng')), | |
_.max($$.pluck('lat')), _.max($$.pluck('lng')) | |
]; | |
$.map.region = { | |
latitude: (bb[0]+bb[2])/2, | |
longitude: (bb[1]+bb[3])/2, | |
latitudeDelta: 1.4*(bb[2]-bb[0]), | |
longitudeDelta: 1.4*(bb[3]-bb[1]) | |
}; |
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 get_coords_from_address($address) { | |
$url = sprintf("https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=%s", urlencode($address)); | |
$res = file_get_contents($url); | |
if (empty($res)) { | |
throw new Exception("Empty response"); | |
} |
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 parse_ini_string($s) { | |
$S = []; $ls = ''; | |
foreach (explode("\n", $s) as $l) { | |
if (preg_match("/\[(.+?)\]/", $l, $q)) { | |
$ls = $q[1]; $r[$ls] = []; | |
} elseif (preg_match("/(.+?)\=\"(.+?)\"/", $l, $q)) { | |
$S[$ls][$q[1]] = $q[2]; | |
} |
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
/* Edit this file adding: ~/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/iphone/Classes/TiUISwitch.m */ | |
-(void)setOnTintColor_:(id)color { | |
if ([color isKindOfClass:[UIColor class]]) { | |
[[self switchView] setOnTintColor:color ]; | |
} else { | |
TiColor *ticolor = [TiUtils colorValue:color]; | |
[[self switchView] setOnTintColor: [ticolor _color ] ]; | |
} | |
} |
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
/* Add to this file: ~/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/iphone/Classes/TiUIView.m */ | |
-(void)setShadow_:(id)args | |
{ | |
if (args != nil) { | |
self.layer.masksToBounds = NO; | |
if ([args objectForKey:@"shadowOffset"] != nil) { | |
CGPoint p = [TiUtils pointValue: [args objectForKey:@"shadowOffset"]]; | |
CGSize shadowOffset = {p.x,p.y}; |
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 | |
use Illuminate\Console\Command; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Input\InputArgument; | |
class Localize extends Command { | |
protected $name = 'localize'; | |
protected $description = 'Set the coordinates'; |
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
/* | |
Fix TextArea.hintText property | |
*/ | |
exports.createTextArea = function(args) { | |
var $textArea = Ti.UI.createTextArea(args); | |
if (args.hintText) { | |
$textArea.originalColor = $textArea.color || '#000'; | |
if (!$textArea.value) { | |
$textArea.applyProperties({ |
OlderNewer