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 | |
#Requires PHP 5.3.0 | |
define("CONSUMER_KEY", "consumer_key"); | |
define("CONSUMER_SECRET", "consumer_secret"); | |
define("OAUTH_TOKEN", "access_token"); | |
define("OAUTH_SECRET", "access_secret"); | |
function oauth_gen($method, $url, $iparams, &$headers) { |
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
/* | |
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
*/ | |
var http = require('http'), | |
fs = require('fs'), | |
util = require('util'); | |
http.createServer(function (req, res) { | |
var path = 'video.mp4'; |
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 | |
// Next two functions taken from a commenter on http://php.net/manual/en/function.unserialize.php | |
function unserialize_recursive($val) { | |
//$pattern = "/.*\{(.*)\}/"; | |
if(is_serialized($val)){ | |
$val = trim($val); | |
$ret = unserialize($val); | |
if (is_array($ret)) { | |
foreach($ret as &$r) $r = unserialize_recursive($r); |
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
# Why rewrite URLs? Read this: http://en.wikipedia.org/wiki/Rewrite_engine | |
# Apache (.htaccess or httpd.conf) | |
# Make sure AllowOverride is on for the directory, or put the rewrite rules in httpd.conf | |
# http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule . /index.php [L] | |
# Nginx (nginx.conf) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
// Next two functions taken from a commenter on http://php.net/manual/en/function.unserialize.php | |
function unserialize_recursive($val) { | |
//$pattern = "/.*\{(.*)\}/"; | |
if(is_serialized($val)){ | |
$val = trim($val); | |
$ret = unserialize($val); | |
if (is_array($ret)) { | |
foreach($ret as &$r) $r = unserialize_recursive($r); |
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
# ---------------------------------------------------------------------- | |
# /PUBLIC folder .htaccess | |
# ---------------------------------------------------------------------- | |
# This .htaccess file is recommended | |
# to be placed at root/public folder | |
# of your Laravel powered application | |
# ---------------------------------------------------------------------- | |
# This file works with Laravel 3 and 4 | |
# ---------------------------------------------------------------------- | |
# Turning on the rewrite engine is necessary for the following rules and |
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
location ~ ^/wp-content/uploads/(.*) { | |
if (!-f $request_filename) { | |
rewrite ^/wp-content/uploads/(.*)$ http://www.remotesite.com/wp-content/uploads/$1 redirect; | |
} | |
} |
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
LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM('My String'), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) AS `post_name` |
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
ROUND((RAND() * (max-min))+min) |
OlderNewer