Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
var host='www.educacion.es'; | |
var uri='/404.html'; | |
var sys = require('sys'); | |
var http = require('http'); | |
var Iconv = require('iconv').Iconv; | |
var Buffer = require('buffer').Buffer; | |
var httpcli = http.createClient(80, host); | |
var request = httpcli.request( 'GET', uri, { |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST
requests with voice file encoded in FLAC format, and query parameters for control.
client
The client's name you're connecting from. For spoofing purposes, let's use chromium
lang
Speech language, for example, ar-QA
for Qatari Arabic, or en-US
for U.S. English
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
var app = require('express')(); | |
var GridStore = require('mongodb').GridStore; | |
var ObjectID = require('mongodb').ObjectID; | |
var MongoClient = require('mongodb').MongoClient; | |
var Server = require('mongodb').Server; | |
var dbConnection; | |
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) { | |
dbConnection = db; | |
app.listen(3000); |
#Rewrites the request, extracting a fragment of the file name and using a remote server. | |
location @fetchFromRemote { | |
rewrite ^/path/to/images/(.*)$ http://remoteserver.com/other/path/to/images/$1 redirect; | |
} | |
#Will try to see if we have the file in this server, is not will use fetchFromRemote | |
location ~ ^/path/to/images/.*(png|jpg|jpeg|gif|ico|swf)$ { | |
try_files $uri @fetchFromRemote; | |
} |
<?php | |
// requires php5 | |
define('UPLOAD_DIR', 'images/'); | |
$img = $_POST['img']; | |
$img = str_replace('data:image/png;base64,', '', $img); | |
$img = str_replace(' ', '+', $img); | |
$data = base64_decode($img); | |
$file = UPLOAD_DIR . uniqid() . '.png'; | |
$success = file_put_contents($file, $data); | |
print $success ? $file : 'Unable to save the file.'; |
// Calculating the bounding box | |
function boundbox ($lat, $lon, $distance, $units="km") { | |
return array ( "N" => getDestinationCoordinates ($lat,$lon, 0,$distance,$units), | |
"E" => getDestinationCoordinates ($lat,$lon, 90,$distance,$units), | |
"S" => getDestinationCoordinates ($lat,$lon, 180,$distance,$units), | |
"W" => getDestinationCoordinates ($lat,$lon, 270,$distance,$units)); | |
} |
/** | |
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ================== | |
* | |
* This patch works around iOS9 UIWebView regression that causes infinite digest | |
* errors in Angular. | |
* | |
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular | |
* have the workaround baked in. | |
* | |
* To apply this patch load/bundle this file with your application and add a |
<?php | |
/** | |
* The Events Calendar: Remove the Organizers post type from Events. | |
* | |
* Replace instances of ORGANIZER_POST_TYPE with VENUE_POST_TYPE if you | |
* want to do so for Venues instead. | |
* | |
* @link https://theeventscalendar.com/knowledgebase/linked-post-types/ | |
* @link https://gist.github.com/a521d02facbc64ce3891c9341384cc07 |