Skip to content

Instantly share code, notes, and snippets.

@jwdeane
jwdeane / Change WP domain
Created August 9, 2010 14:20
Changed your Wordpress domain?
// Edit themes functions.php. Right after initial <?php line place the following:
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
// 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";
}
}
@cfpg
cfpg / gist:972764
Created May 14, 2011 23:42
WordPress: Get Tag ID when you only have the Tag name
<?php
function get_tag_id_by_name($tag_name) {
global $wpdb;
$tag_ID = $wpdb->get_var("SELECT * FROM ".$wpdb->terms." WHERE `name` = '".$tag_name."'");
return $tag_ID;
}
?>
@mcollina
mcollina / back.js
Created May 17, 2011 15:24
Sencha Touch Back Button Plugin
BackButton = Ext.extend(Ext.Button, {
ui: 'back',
text: 'Back',
hidden: true,
id: 'back',
handler: function() {
var dispatchOptions = this.backStack.pop();
Ext.dispatch(dispatchOptions);
if(this.backStack.length == 0) {
@ChrisLTD
ChrisLTD / functions.php
Created May 24, 2011 14:54
Enable Kitchen Sink in Wordpress TinyMCE by default
function unhide_kitchensink( $args ) {
$args['wordpress_adv_hidden'] = false;
return $args;
}
add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' );
@mattwiebe
mattwiebe / responsive-images.php
Created September 21, 2011 23:02
Mobile First Responsive Images for WordPress
<?php
/*
Plugin Name: Mobile First Responsive Images
Description: Serve up smaller images to smaller screens.
Version: 0.1.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
@aarongustafson
aarongustafson / responsive-iframes.css
Created October 25, 2011 17:07
Responsive iFrames with jQuery
iframe {
max-width: 100%;
}
@tubalmartin
tubalmartin / mobile_detector.php
Created January 3, 2012 15:06
Lightweight detector of mobile devices, OSs & browsers (PHP)
<?php
/*
* Lightweight detector of mobile devices, OSs & browsers
* Copyright 2012 Túbal Martín (email: tubalmartin@gmail.com)
* License: GPL2
*/
if ( ! function_exists('mobile_detector') )
{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }
@Integralist
Integralist / remote-git.md
Created February 21, 2012 09:51
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)