Skip to content

Instantly share code, notes, and snippets.

View nfreear's full-sized avatar

Nick Freear nfreear

View GitHub Profile
@nfreear
nfreear / iet_wp_query_shortcode.php
Created March 14, 2015 23:40
Shortcode [wp_query] wrapper around WordPress core function: `wp_query` | https://github.com/IET-OU/wp-iet-generic-plugins [LACE]
<?php
/*
Plugin Name: IET WP_Query
Plugin URI: https://github.com/IET-OU/oer-evidence-hub-org
Description: Shortcode [wp_query] wrapper around WordPress core function: `wp_query` [LACE]
Author: Nick Freear [@IET-OU]
Author URI: https://github.com/IET-OU
Version: 0.1
*/
import urllib2
import json
import re
response = urllib2.urlopen('http://api.embed.ly/v1/api/services/python')
services = json.loads(response.read())
url = 'http://soundcloud.com/dociler/dociler-futuricity'
for service in services:
for regex in service['regex']:
if re.match(regex, url):
print "Matched %s to %s" % (url, service['displayname'])
@scribu
scribu / gist:636827
Created October 20, 2010 17:02
WP_Query Debug
<?php
function wp_query_debug() {
global $wp, $wp_query;
echo '<pre>';
var_dump($wp->matched_rule);
print_r($wp_query);
echo '</pre>';
}
@pablox-cl
pablox-cl / csv2yaml.rb
Created November 7, 2010 17:14 — forked from reservationlive/Ruby script to convert CSV to YAML
Simple Ruby CSV to YAML converter
#!/usr/bin/env ruby
#
# Originally written by http://redartisan.com/tags/csv
# Added and minor changes by Gavin Laking
#
# "id","name","mime_type","extensions","icon_url"
# "1","unknown","unknown/unknown","||","/images/icon/file_unknown.gif"
# "2","image/tiff","image/tiff","|tiff|tif|","/images/icon/blank.png"
#
# if you want to remove the id: "number" line from the resulting YAML file
anonymous
anonymous / gist:713716
Created November 24, 2010 14:22
#!/c/WebServers/usr/local/php5/php
<?php echo 123 ?>
@samsoir
samsoir / staging.rebuild.sh
Created April 12, 2011 16:36
Rebuild script for the OU Annotate Staging Server
#!/bin/bash
# +--------------------------------------------------------------------------+
# | OU Annotate Staging Rebuild Script |
# | Written by Sam de Freyssinet <sam@def.reyssi.net> |
# +--------------------------------------------------------------------------+
# | Permission to use, copy, modify, and/or distribute this software for any |
# | purpose with or without fee is hereby granted, provided that the above |
# | copyright notice and this permission notice appear in all copies. |
# +--------------------------------------------------------------------------+
@perusio
perusio / drupal_uid_header.module
Created December 27, 2011 07:31
Simple module to add a header with the user ID
<?php
/**
* @file drupal_uid_header.module
* @author António P. P. Almeida <appa@perusio.net>
* @date Tue Dec 27 2011
*
* @brief Sets an HTTP header with the UID (Drupal 6).
*
*/
@nfreear
nfreear / iframe-blackout.drupal-block.html
Created January 19, 2012 10:32
Adding SOPA blackout to a Drupal Gardens - Javascript + Iframe - by Jacob Singh.name, Zachstronaut.
<script>
/*!
* Javascript-iframe (Drupal) SOPA-blackout solution.
*
* authors: Jacob Singh, Zachstronaut, Nick Freear, 2012-01-17.
* help: http://jacobsingh.name/content/adding-sopa-blackout-drupal-gardens
* via: http://drupal.org/planet
*/
(function blackout(){
var a = new Date,
@nfreear
nfreear / my-ajax-debug.drupal.php
Last active September 30, 2015 03:17
If a debug parameter variable is set, output PHP expressions in HTTP headers / Drupal.
<?php
<?php
ini_set( 'display_errors', 1);
error_reporting( E_ALL );
//header( 'Content-Type: text/plain');
function my_test() {
@maettig
maettig / LICENSE.txt
Created February 7, 2012 03:56 — forked from 140bytes/LICENSE.txt
encodeJavaScriptString in 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Thiemo Mättig <http://maettig.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE