Skip to content

Instantly share code, notes, and snippets.

View fukata's full-sized avatar

fukata fukata

View GitHub Profile
@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;
@fukata
fukata / jsunit_util.js
Created September 12, 2011 11:02
jsunit utility
function base_url() {
var url = window.location.href;
var idx = url.lastIndexOf('/');
if (idx > 0) {
url = url.substr(0, idx);
} else {
url = "";
}
return url;
}
@fukata
fukata / post_file_and_data.pl
Created September 28, 2011 02:18
Post file and data use LWP::UserAgent.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode;
use HTTP::Request::Common;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
@fukata
fukata / .xmodmap
Created September 28, 2011 04:44
Super_R is mapped Control_R for Thinkpad Travel Keyboard on Ubuntu
remove Control = Control_R
keysym Control_R = Super_R
add Control = Control_R
@fukata
fukata / weight.js
Created October 22, 2011 17:29
Weight Chart at Google Calendar
/**
* Return calendar for weight.
* @return Calendar
*/
function getWeightCal() {
var id = 'YOUR GOOGLE CALENDAR ID';
var cal = CalendarApp.getOwnedCalendarById(id);
return cal;
}
@fukata
fukata / ci_2.0.3_and_2.1.0.diff
Created November 15, 2011 00:09
CodeIgniter 2.0.3 and 2.1.0 diff
diff -ru CodeIgniter_2.0.3//application/config/database.php CodeIgniter_2.1.0//application/config/database.php
--- CodeIgniter_2.0.3//application/config/database.php 2011-08-20 20:59:14.000000000 +0900
+++ CodeIgniter_2.1.0//application/config/database.php 2011-11-01 01:15:36.000000000 +0900
@@ -27,7 +27,8 @@
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
-| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7.
+| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
+| (and in table creation queries made with DB Forge).
@fukata
fukata / tag-date
Created January 10, 2012 02:53
sorted commiter date git tags.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use autodie;
sub validate_show_lines {
my ( $show ) = @_;
return @$show[0] =~ /^tag .*$/;
}