Skip to content

Instantly share code, notes, and snippets.

View rickard2's full-sized avatar

Rickard Andersson rickard2

View GitHub Profile
@rickard2
rickard2 / gist:3999774
Created November 2, 2012 09:35
Ember Playground
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8/>
<title>Dev playground</title>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-1.0.0-pre.2.js"></script>
</head>
<body>
@rickard2
rickard2 / gist:3999571
Created November 2, 2012 08:50
https wp
<?php
/*
Plugin Name: HTTPS everywhere
Plugin URI: http://
Description: HTTPS everywhere
Author: Rickard Andersson
Version: 1.0
Author URI: http://0x539.se/
*/
@rickard2
rickard2 / gist:3964335
Created October 27, 2012 11:22
WordPress international tags tests
<?php
class Tests_Term_Intl extends WP_UnitTestCase {
function test_one_char_terms() {
$post = array(
'post_content' => 'test',
'post_status' => 'publish',
'post_title' => 'test',
'post_type' => 'post',
@rickard2
rickard2 / gist:3923951
Created October 20, 2012 16:45
Unit test for #22233
<?php
function test_multiple_calls() {
$key = rand_str();
$obj1 = new stdClass;
$obj2 = new stdClass;
$obj1->prop = false;
@rickard2
rickard2 / gist:3923757
Created October 20, 2012 16:04
WP update_option bug
<?php
function test1() {
$a = new stdClass;
$a->foo = false;
$b = new stdClass;
$b->foo = false;
@rickard2
rickard2 / gist:3738318
Created September 17, 2012 16:27
Image copy
#!/bin/bash
if [ -z $1 ]; then
echo "Usage: $0 /path/to/destination/folder"
exit 1
fi
BASE=$1
@rickard2
rickard2 / gist:3701613
Created September 11, 2012 20:03
Android bug
div[role='main'] {
width: 610px;
float: left;
// Strange android 4.x browser bug, layout will f-up if there's no background color set
article * {
background-color: #fff;
}
}
<?php
class JsonDecoder implements DecoderInterface {
public function decode( $data )
{
$decoded = @json_decode( $data, true );
$decoded = $this->removeBooleans( $decoded );
@rickard2
rickard2 / gist:3135689
Created July 18, 2012 11:26
WordPress tests with wpdb
<?php
class testWPDB extends wpdb {
function prepare( $query, $arguments )
{
return vsprintf( $query, $arguments );
}
}
@rickard2
rickard2 / gist:3131367
Created July 17, 2012 19:15
phpunit error
There was 1 error:
1) UTCW_Test_Data::test_author
mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)
/www/wpstable/wp-includes/wp-db.php:1038
/www/wpstable/wp-includes/wp-db.php:504
/www/utcw2/tests/test_utcw_data.php:11
/usr/bin/phpunit:46