Let's write better JavaScript, and the same, k?
We always use spaces, and we always use four. Set your editor now.
function myFunction() {
// D. Crockford's method for adding methods to the prototype object | |
Function.prototype.method = function (name, func) { | |
this.prototype[name] = func; | |
return this; | |
}; | |
// Add is_array function to Array, return true | |
Array.method('is_array', function () { | |
return true; | |
}); |
<?php | |
/* | |
Plugin Name: Videos | |
Plugin URI: | |
Author: Dave Rupert | |
Author URI: http://www.daverupert.com | |
Description: A custom post type that adds videos and custom taxonomies. | |
Version: 1.0 | |
*/ |
<?php | |
require_once( 'customobject.php' ); | |
$options = array( | |
'public' => true, | |
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ), | |
'menu_position' => 5, | |
'has_archive' => true, | |
'rewrite' => array( 'slug' => 'rising-profiles' ) |
<?php | |
/** | |
* @package MyPlugin | |
* @version 1.0 | |
* | |
* Plugin Name: MyPlugin | |
* Plugin URI: http://myurl.com/myplugin | |
* Description: A simple plugin to properly include css and javascript files into a WordPress site. | |
* -(these files won't be minified and concatenated unless you use WP Total Cache or something similar.) | |
* Author: Jason Rhodes |
function arrayValueMatch( array1, array2 ) { | |
var length = array1.length, match = false; | |
for ( i=0; i<length; i+=1 ) { | |
if ( array2.indexOf( array1[i] ) > -1 ) { | |
match = true; | |
break; | |
} | |
} | |
return match; | |
} |
/** | |
* A function to take a string written in dot notation style, and use it to | |
* find a nested object property inside of an object. | |
* | |
* Useful in a plugin or module that accepts a JSON array of objects, but | |
* you want to let the user specify where to find various bits of data | |
* inside of each custom object instead of forcing a standardized | |
* property list. | |
* | |
* @param String nested A dot notation style parameter reference (ie "urls.small") |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.host; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" |
<?php | |
class A | |
{ | |
public static $var = "I'm set in A!<br>"; | |
public static function getStatic() { | |
echo static::$var; | |
} | |
public static function getSelf() { |
#!/bin/sh | |
# | |
# To enable this hook, rename this file to "post-merge". | |
# We could probably run composer update here, but this is safer for now | |
if git diff --name-only HEAD^1 | grep composer.json >/dev/null | |
then | |
echo ' ' | |
echo '#############################################################################' |