Skip to content

Instantly share code, notes, and snippets.

View toin0u's full-sized avatar
🚀

Antoine Kirk toin0u

🚀
View GitHub Profile
<?php
require 'vendor/autoload.php';
$geocoder = new \Geocoder\Geocoder();
$adapter = new \Geocoder\HttpAdapter\SocketHttpAdapter();
$provider = new \Geocoder\Provider\GoogleMapsProvider($adapter);
$geocoder->registerProvider($provider);
try {
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1">
<style type="text/css">
div { display: none; font-size: 15px; color: #FF0000; }
#title { display: block; color: #000000; }
/* iPhone 3 portrait */
<?php
/**
* This file is part of the Geocoder package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
@toin0u
toin0u / Redis.php
Created May 13, 2013 11:04
When PhpRedis is set up with an Redis::OPT_PREFIX, It does set the prefix to the key and to the timeout value. To set the resolved key in an array seems fixing this issue. @see: https://github.com/nicolasff/phpredis/issues/158
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->setOption(Redis::OPT_PREFIX, 'foo:');
$redis->sAdd('queues', 'my-queue');
// output: "SADD" "foo:queues" "my-queue"
$redis->blpop('queue:my-queue', 5);
<?php
interface ProviderInterface
{
public function foo();
}
abstract class AbstractProvider implements ProviderInterface
{
public function bar()
@toin0u
toin0u / diff
Created May 15, 2014 21:54
Nominatim JSON & XML diff
http://nominatim.openstreetmap.org/search?q=Paris&format=xml&addressdetails=1&limit=5
``` xml
<?xml version="1.0" encoding="UTF-8" ?>
<searchresults timestamp='Thu, 29 Aug 13 15:07:41 +0000' attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright' querystring='Paris' polygon='false' exclude_place_ids='97923440,97357969,42637879,42729434,97962432' more_url='http://nominatim.openstreetmap.org/search?format=xml&amp;exclude_place_ids=97923440,97357969,42637879,42729434,97962432&amp;addressdetails=1&amp;q=Paris'>
<place place_id='97923440' osm_type='relation' osm_id='7444' place_rank='16' boundingbox="48.8155250549316,48.902156829834,2.22412180900574,2.46976041793823" lat='48.8565056' lon='2.3521334' display_name='Paris, Île-de-France, 75000, France métropolitaine, European Union' class='place' type='city' importance='0.96893459932191' icon='http://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png'>
<city>Paris</city><county>Paris</county><state>Île-de-Fr
HTTP/1.1 200 OK
Date: Sat, 17 May 2014 21:45:16 GMT
Server: Apache/2.2.22 (Ubuntu)
Content-Location: search.php
Vary: negotiate,accept
@toin0u
toin0u / proof
Created September 17, 2014 21:34
Keybase.io proof
### Keybase proof
I hereby claim:
* I am toin0u on github.
* I am toin0u (https://keybase.io/toin0u) on keybase.
* I have a public key whose fingerprint is 5694 F6E4 B48B C1D8 C84F 48C8 7F8C 16C0 C9A0 A87B
To claim this, I am signing this object:
@toin0u
toin0u / composer.json
Created February 17, 2015 10:46
Flysystem ~1.0 + SFTP adapter
{
"require": {
"league/flysystem": "~1.0",
"league/flysystem-sftp": "~1.0"
}
}
@toin0u
toin0u / composer.json
Created February 22, 2015 22:22
DigitalOceanV2 with Guzzle 3.9
{
"require": {
"toin0u/digitalocean-v2": "0.5.*",
"guzzle/guzzle": "~3.9"
}
}