Skip to content

Instantly share code, notes, and snippets.

View alloyking's full-sized avatar
🎧
.

Tim Shultis alloyking

🎧
.
View GitHub Profile
@cliffordp
cliffordp / functions.php
Last active April 6, 2023 15:36
The Events Calendar: Remove the Organizers post type from Events
<?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
/**
* ================== 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
@kgundula
kgundula / boundbox
Last active September 22, 2016 15:43
Calculate distance between two sets lat/lon coordinates and Calculate destination lat/lon given a starting point lat/lon cordinates, bearing, and distance, and Calculate the bounding box
// 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));
}
@fazlurr
fazlurr / canvas-upload.php
Created March 27, 2014 07:20 — forked from xjamundx/canvas-upload.php
Function to save base64 image to png with PHP
<?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.';
@casivaagustin-zz
casivaagustin-zz / gist:9261586
Created February 27, 2014 23:04
nginx location rule to redirect non existing images to another server
#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;
}
@psi-4ward
psi-4ward / GridStream.js
Created October 22, 2013 11:28
NodeJS MongoDB-GridFS Video range stream example Lets your browser seek/jump wihin the video-playback.
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);
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

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.

Twitter

@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

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.

Query Parameters

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

@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
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, {