Skip to content

Instantly share code, notes, and snippets.

View scribu's full-sized avatar

Cristi Burcă scribu

View GitHub Profile
### Keybase proof
I hereby claim:
* I am scribu on github.
* I am scribu (https://keybase.io/scribu) on keybase.
* I have a public key whose fingerprint is 2C8A 343A FDCC DDD2 6442 CCF1 8219 7F75 BDAF B501
To claim this, I am signing this object:
@scribu
scribu / index.html
Last active August 29, 2015 14:14
Negative Feedback
<html>
<head>
<title>Negative Feedback</title>
<style>
body {
background: black;
}
.half {
float: left;
@scribu
scribu / monty-hall.py
Last active August 29, 2015 14:16
Simulation for the Monty Hall problem.
import random
DOORS = set([1, 2, 3])
def play(picked_door, do_switch):
door_with_car = random.sample(DOORS, 1)[0]
revealed_door = random.sample(DOORS.difference([door_with_car]), 1)[0]
if do_switch:
@scribu
scribu / tabbed-widgets.diff
Created September 16, 2010 15:06
tabbed widgets fix
We couldn’t find that file to show.
@scribu
scribu / category-custom-fields.php
Created October 8, 2010 13:24
Category Custom Fields
<?php
/*
Plugin Name: Category Custom Fields
Author: scribu
*/
class Category_Custom_Fields {
function init() {
@scribu
scribu / copy-widgets.php
Created October 12, 2010 08:04
Copy entire sidebar configuration from one site to another
<?php
/**
* Copy entire sidebar configuration from one site to another
*
* @param int $old_site The id of the original site
* @param int $old_site The id of the site to copy the widgets to
*/
function copy_widgets($old_site, $new_site) {
global $wpdb, $blog_id;
@scribu
scribu / gist:625748
Created October 14, 2010 07:12
Backtrace Deprecated
<?php
/*
Plugin Name: Better Deprecation Warnings
Author: scribu
Version: 1.0
*/
class Backtrace_Deprecated {
function init() {
@scribu
scribu / gist:626355
Created October 14, 2010 15:19
locate_skin_url()
<?php
function locate_skin_url( $name ) {
$dir = false === strpos($name, '.css') ? 'js' : 'css';
if ( file_exists(STYLESHEETPATH . "/$dir/$name")) {
$url = get_bloginfo('stylesheet_directory') . "/$dir/$name";
} elseif ( file_exists(TEMPLATEPATH . "/$dir/$name") ) {
$url = get_bloginfo('template_directory') . "/$dir/$name";
} else {
@scribu
scribu / gist:626060
Created October 14, 2010 11:32
php ini
# add these lines in your .htaccess file
php_value memory_limit 128M
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 120
@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>';
}