Skip to content

Instantly share code, notes, and snippets.

View lkraav's full-sized avatar
🎯
Focusing

Leho Kraav lkraav

🎯
Focusing
View GitHub Profile
@eric1234
eric1234 / git-fork-compare
Created October 29, 2010 18:40
Scripts to review diverging git forks
#!/bin/sh
# Provides a way to compare a fork against the original it is based
# on so you can get a general idea of what is in a fork.
#
# git-fork-compare <original> <fork>
TMP_GIT=`mktemp -d`;
rmdir $TMP_GIT;
git clone -q $2 $TMP_GIT;
cd $TMP_GIT;
@kylef
kylef / pyeval.py
Last active September 25, 2015 01:27
Python Evaluate for ZNC modpython
import sys
import re
from code import InteractiveInterpreter
import znc
class pyeval(znc.Module, InteractiveInterpreter):
module_types = [znc.CModInfo.UserModule, znc.CModInfo.NetworkModule]
description = 'Evaluates python code'
@Viper007Bond
Viper007Bond / gist:1297669
Created October 19, 2011 07:27
Determining if modifying the main query or not in WordPress
<?php
# See bigdawggi's comment below for a good combined example
// Pre-3.3
function cf_google_search_kill_wp_search( $where, $query ) {
global $wp_the_query;
if( ! is_admin() && $query->is_search() && $query === $wp_the_query ) {
$where = ' AND 1=0';
<html>
<head>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" type="text/css">
<style type="text/css">
code { display: block; }
pre { color: green; }
</style>
</head>
<body>
<h1>Balanced Sample - Collect Bank Account Information</h1>
@etienned
etienned / csstidy
Created May 25, 2012 18:28
CLI for the PHP version of CSSTidy
#!/usr/bin/env php
<?php
/**
* CSSTidy - Command Line Interface (CLI)
*
* Command Line Interface that try to mimic as much as possible the C++ CLI
* version of csstidy. It should be a drop in replacment for the C++ CLI that is
* no longuer maintain. New settings like css_level are added.
*
* Copyright 2005, 2006, 2007 Florian Schmitz
@Rarst
Rarst / class-oh-shuddup.php
Created June 14, 2012 17:35
Shuts up deprecated messages for specific functions
<?php
Oh_Shuddup::on_load( array( 'get_theme_data' ) );
/**
* Shuts up deprecated messages for specific functions.
*/
class Oh_Shuddup {
static $functions;
@tomjn
tomjn / junction-fix.php
Created June 22, 2012 10:15
WP Junction fix
<?php
/*
Plugin Name: Junction fixes for plugins
Plugin URI: http://interconnectit.com/
Description: Junctioning files into the WordPess plug-ins folder causes problems with php 5.3 for plugin_url, this tries to fix it. Place in the wp-content/mu-plugins folder so it loads before all other plugins.
Author: James R Whitehead
Version: 0.0.0.0.0.0.2
Author URI: http://interconnectit.com
*/
@corsonr
corsonr / custom-post-type-flush-rewrite-rules.php
Created December 4, 2012 10:57 — forked from netconstructor/custom-post-type-flush-rewrite-rules.php
Pseudo-elegant way to flush rewrite rules after creating a custom post type.
<?php
/**
* Example for writing a WP plugin that adds a custom post type and flushes
* rewrite rules only once on initialization.
*/
/**
* On activation, we'll set an option called 'my_plugin_name_flush' to true,
* so our plugin knows, on initialization, to flush the rewrite rules.
*/
@jasonmorganson
jasonmorganson / .bash_profile
Created December 8, 2012 01:08
Responsive Prompt
# Create a flexible, responsive prompt.
# Based on the Responsive Prompt
# http://jondavidjohn.com/blog/2012/12/how-to-accomplish-a-responsive-bash-prompt
working_directory() {
dir=`pwd`
in_home=0
if [[ `pwd` =~ ^$HOME($|\/) ]]; then
dir="~${dir#$HOME}"
@thefuxia
thefuxia / mlp-addon-post-meta.php
Last active November 26, 2015 09:00
MLP Addon: Sync post meta fields
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: MLP Addon: Sync post meta fields
* Plugin URI: https://gist.github.com/toscho/6393c79aacba0983a96a
* Description: Create a custom field, put it into the MLP translation box, and sync it across the sites.
* Version: 2015.03.03
* Required: 4.0
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT