Skip to content

Instantly share code, notes, and snippets.

View siriokun's full-sized avatar
Hotfixing deprecated codes

Rio Purnomo siriokun

Hotfixing deprecated codes
View GitHub Profile
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
@beastaugh
beastaugh / bookmarklet
Created December 2, 2010 14:17
Remove any viewport meta elements
javascript:(function(){var b=document.getElementsByTagName('meta'),c=b.length,a;while(c--){a=b[c];if(a.name.toLowerCase()=='viewport'){a.parentNode.removeChild(a)}}})();
@jaz303
jaz303 / gist:781358
Created January 15, 2011 23:17
Key State
<html>
<head>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'></script>
<script type='text/javascript'>
var states = {};
// w - 87
// a - 65
// s - 83
// d - 68
@thefuxia
thefuxia / extended-help.php
Created February 28, 2011 16:23
WP-Plugin Extended Help
<?php # -*- coding: utf-8 -*-
/*
Plugin Name: Extended Help
Description: Help texts for super heroes
Version: 0.1
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL
*/
@thefuxia
thefuxia / placekitten.php
Created March 5, 2011 21:49
WordPress Plugin for kitten placeholders. Defines an action and a shortcode.
<?php
/*
Plugin Name: Placekitten
Description: Shortcode [placekitten w=100 h=300 g=1 alt=kitten] and action.
Version: 1.0
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL
*/
@markjaquith
markjaquith / activate-deactivate-uninstall-example.php
Created March 6, 2011 17:27
Example code for doing activate/deactivate/uninstall hooks in a WordPress plugin
<?php
// Change /*CUSTOMIZE_THIS*/ to a unique name (two places). Go ahead, make it long.
// Like, your initials, and your full plugin name.
// e.g. MTJ_Some_Awesome_Plugin_Controller
/*CUSTOMIZE_THIS*/_Controller::init();
class /*CUSTOMIZE_THIS*/_Controller {
function init() {
@taiju
taiju / functions.php
Created March 24, 2011 10:02
WP_Widget_Text
<?php
/**
* HTML widget class
*
* WPINC/default-widgets.php内にある
* WP_Widget_Textを使いやすいように改変したもの
*
*/
class WP_Widget_HTML extends WP_Widget {
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@getify
getify / bench-LABjs-parallel.html
Created May 24, 2011 05:53
comparing LABjs and $script.js when parallel loading with execution order dependencies
<script src="../vendor/lab2.min.js"></script>
<script type="text/javascript">
var start = (+new Date);
// load some scripts dependent on each other (in parallel but preserving execution order)
$LAB
.setOptions({AlwaysPreserveOrder:true})
.script('a.js')
.script('b-needs-a.js')
.script('c-needs-b.js')
@thefuxia
thefuxia / quote-author.php
Created May 28, 2011 04:55
WordPress Plugin Quote Author
<?php # -*- coding: utf-8 -*-
/*
Plugin Name: Custom Taxonomy Quote Author
Plugin URI: https://gist.github.com/996608
Description: Creates a custom taxonomy <code>Quote Author</code> with an URI <code>/qa/author-name/</code>
Version: 1.0
Required: 3.1
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL