Skip to content

Instantly share code, notes, and snippets.

View fukata's full-sized avatar

fukata fukata

View GitHub Profile
@fukata
fukata / random_chars.py
Created May 6, 2011 13:01
Random Characters
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def random_chars(num=36):
import random
chars = "asdfghjkqwertyuopzxcvbnm1234567890ASDFGHJKLZXCVBNMQWERTYUOP"
strs = [random.choice(chars) for x in range(num)]
return ''.join(strs)
@fukata
fukata / site-thermography-example.js
Created May 8, 2011 11:09
サイトサーモグラフィの設置サンプル
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
var _st = {"activate_code":"[アクティベートコード]"};
</script>
<script type="text/javascript" src="http://site-thermography.appspot.com/media/js/thermography.js"></script>
@fukata
fukata / release2wp.sh
Created May 14, 2011 18:14
Release to WordPress plugin.
#!/bin/bash
########################################################
#
# 普段、gitなどで開発し、WordPressプラグインリポジトリの
# tagsディレクトリをリリース目的のみに利用している人用のスクリプト
#
# Usage:
# ./release2wp.sh repo release_dir tag [msg]
#
@fukata
fukata / atnd
Created May 15, 2011 14:33
Attendance memo tool.
#!/bin/bash
###########################################################
#
# Clone repo:
# git clone git://gist.github.com/973205.git attendance
#
# Create Database:
# mysqladmin -u root atnd
# mysql -u root atnd < attendance/ddl.sql
@fukata
fukata / implements_display_icon.diff
Created May 22, 2011 08:35
Google Ajax Translation implements display icon.
diff --git a/ajaxtranslation.php b/ajaxtranslation.php
index 1baf716..70f313e 100644
--- a/ajaxtranslation.php
+++ b/ajaxtranslation.php
@@ -723,6 +723,51 @@ if (!class_exists('GoogleTranslation')) {
return $translate_block;
}
+ /**
+ * get a translate button that can be used anywhere in a post or page as needed by a custom theme. This should be in the WordPress loop.
@fukata
fukata / automatic_close_notification.js
Created June 14, 2011 17:36
Automatic close Google Chrome Desktop Notification
var notification = webkitNotifications.createNotification(
'icon-48.png',
'TITLE',
'BODY'
);
notification.ondisplay = function(){
var self = this;
var close_interval = 5000;
setTimeout(function(){
@fukata
fukata / MY_Loader.php
Created June 24, 2011 01:57
Default escape display vars.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader {
public function __construct() {
parent::__construct();
}
/**
* CI_Loader::_ci_load is private method.
*
* (non-PHPdoc)
@fukata
fukata / codeigniter_2.0.2_and_2.0.3.diff
Created August 20, 2011 16:41
CodeIgniter 2.0.2 and 2.0.3 diff
diff -ru CodeIgniter_2.0.2/application/config/autoload.php CodeIgniter_2.0.3/application/config/autoload.php
--- CodeIgniter_2.0.2/application/config/autoload.php 2011-04-08 02:20:00.000000000 +0900
+++ CodeIgniter_2.0.3/application/config/autoload.php 2011-08-20 20:59:14.000000000 +0900
@@ -37,7 +37,7 @@
|
*/
-$autoload['packages'] = array(APPPATH.'third_party');
+$autoload['packages'] = array();
@fukata
fukata / mv_pictures_date.sh
Created August 22, 2011 14:40
move pictures by date
#!/bin/bash
DIR=${1?'pictures directory require.'}
DIR=${DIR%/}
PIC_DIR='YOUR SAVE PICTURE ROOT PATH'
total=$(ls $DIR |wc -l)
count=1
for line in $(ls -lt $DIR |awk '{print $6","$8}')
do
@fukata
fukata / database.patch
Created September 5, 2011 05:52
CIUnit Install Script
--- CodeIgniter_2.0.3/application/config/database.php 2011-08-20 20:59:14.000000000 +0900
+++ application/config/database.php 2011-09-05 14:04:52.375136218 +0900
@@ -45,6 +45,9 @@
*/
$active_group = 'default';
+if (defined('CIUnit_Version')) {
+ $active_group .= '_test';
+}
$active_record = TRUE;