Skip to content

Instantly share code, notes, and snippets.

@josephj
josephj / trac-wiki-transfer.php
Created April 18, 2011 04:02
Export all wikis from one Trac environment to another Trac environment.
#!/usr/bin/php
<?php
// Modify the following constants according to your needs.
define("BACKUP_PATH", "/var/backup/trac/"); // Backup directory.
define("SOURCE_PROJECT", "/var/www/trac/muchiii"); // Source Trac Environment
define("TARGET_PROJECT", "/var/www/trac/router"); // Target Trac Environment
define("REPLACE_FROM", array( // Replace search string in wiki content.
"muchiii.com",
));
define("REPLACE_TO", array( // Replaced string in wiki content.
@josephj
josephj / CustomRules.js
Created August 29, 2011 02:38
For miiiCasa Open Platform developers to simulate the miiiCasa Goodie Bar Environment without miiiCasa-enabled router installed.
import System;
import System.Windows.Forms;
import Fiddler;
// INTRODUCTION
// This is the FiddlerScript Rules file, which creates some of the menu commands and
// other features of Fiddler. You can edit this file to modify or add new commands.
//
// The original version of this file is named SampleRules.js and it is in the
// \Program Files\Fiddler\ folder. When Fiddler first starts, it creates a copy named
@josephj
josephj / .tmux.conf
Created October 22, 2011 08:20
My .tmux.conf
# Make tmux like screen, using Ctrl+A
unbind C-b
set -g prefix ^A
bind a send-prefix
# General configuration.
# $ tmux show-options -g
set -g base-index 1
set -g display-time 5000
set -g repeat-time 1000
@josephj
josephj / .tmux.conf
Created October 24, 2011 01:54 — forked from josephj/.tmux.conf
My .tmux.conf
# General configuration.
# $ tmux show-options -g
set -g base-index 1
set -g display-time 5000
set -g repeat-time 1000
set -g status-keys vi
set -g status-utf8 on
set -g status-bg black
set -g status-fg white
set -g status-justify left
@josephj
josephj / debugging.js
Created November 28, 2011 03:51
Remove unecessary JavaScript logs, for debugging purpose.
YUI_config = {
logInclude : {
"ID3": true
}
};
if (typeof console !== "undefined") {
console.log = function (m, t, s) {
s = s || null;
if (!s) {
return false;
/**
* A convenience method to instantiate ID3.
*
* @method id3
* @static
* @param attrs {Object} The attribute object.
* @param callback {Function} The callback function.
* @param args {Array} The arguments you need in callback function.
*/
@josephj
josephj / yui3-io-xdr-native-cookie.html
Created December 26, 2011 15:35
Get cross-domain cookie by using YUI3 io (native mode).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="created" content="2011-12-08">
<title>Y.io XDR using Flash</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssfonts/fonts-min.css">
<link rel="stylesheet" href="/prototype.css">
<script src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
@josephj
josephj / yui3-io-xdr-flash-cookie.html
Created December 26, 2011 15:40
Get cross-domain cookie by using YUI3 io (flash mode)
<?php
header("Access-Control-Allow-Origin: " . $_SERVER["HTTP_ORIGIN"]);
header("Access-Control-Allow-Methods: POST, GET");
header("Access-Control-Max-Age: 1");
header("Access-Control-Allow-Credentials: true");
$cookie = (isset($_COOKIE["cookie"]) && $_COOKIE["cookie"] !== "") ? $_COOKIE["cookie"] : NULL;
if ( ! $cookie)
{