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 function check_youtube_url($s, $c=FALSE) | |
{ | |
$page = 'youtube.com/watch?'; | |
$player = 'youtube.com/v/'; | |
$short = 'youtu.be/'; | |
$clean = str_replace( array( 'http://', 'www.' ), '', $s ); | |
if ( strpos( $clean, $page ) === 0 ) | |
{ |
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 el = document.createElement( 'div' ); | |
el.setAttribute( 'ontouchstart', 'return;' ); | |
if ( typeof el.ontouchstart == 'function' ) | |
{ | |
// yay a touch device! | |
} |
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 | |
# This work is licenced under the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License. | |
# To view a copy of this licence, visit http://creativecommons.org/licenses/by-sa/2.0/uk/ or send a letter | |
# to Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA. | |
# So before you start, the script assumes the following: | |
# 1. you have some sort of SSH access | |
# 2. you are owner of your blog (in terms of computa permissions) | |
# 3. the blog folder is called 'blog' (if not, change all instances of the word 'blog' with whatever it's called) |
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
url.rewrite-once = ( | |
"^/(.*/)?files/$" => "/index.php", | |
"^/(.*/)?files/(.*)" => "/wp-content/blogs.php?file=$2", | |
"^(/wp-admin/.*)" => "$1", | |
"^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2", | |
"^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2", | |
"^/(.*)/?$" => "/index.php" | |
) |
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 timer = setInterval( function() | |
{ | |
if ( /loaded|complete/.test( document.readyState ) ) | |
{ | |
clearInterval( timer ); | |
// go! | |
} | |
}, 10 ); |
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
function scrollGetCoords(e) | |
{ | |
var coors; | |
if ( e.hasOwnProperty( 'originalEvent' ) ) | |
{ | |
e = e.originalEvent; | |
} | |
if ( e.touches && e.touches.length ) |
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
#!/usr/bin/env python | |
import logging | |
import urllib | |
def serialise_model(m, d): | |
# let's serialise this bad boy | |
ps = m.properties() | |
# check if we're dealing with a list or not |
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
function title_case($string, $delimiters = array(" ", "-", "O'"), $exceptions = array("to", "a", "the", "of", "by", "and", "with", 'it', 'as', "for")) { | |
/* | |
* Exceptions in lower case are words you don't want converted | |
* Exceptions all in upper case are any words you don't want converted to title case | |
* but should be converted to upper case, e.g.: | |
* king henry viii or king henry Viii should be King Henry VIII | |
*/ | |
foreach ($delimiters as $delimiter){ | |
$words = explode($delimiter, $string); | |
$newwords = array(); |
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
a = [ 'webkit', 'moz', 'ms', 'o', '' ] | |
n = 'enter' | |
f = { | |
'from' : [ | |
'opacity: 0', | |
'.transform( e(\'rotate(360deg)\')' | |
], | |
'to' : [ | |
'opacity: 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
(function ($) { | |
$.fn.animateCSS = function (effect, delay, callback) { | |
// Return this to maintain chainability | |
return this.each(function () { | |
// Cache $(this) for speed | |
var $this = $(this); |
OlderNewer