Skip to content

Instantly share code, notes, and snippets.

View x5gtrn's full-sized avatar
🔊
♪ minimal techno ♫

Daisuke Masuda x5gtrn

🔊
♪ minimal techno ♫
View GitHub Profile
@x5gtrn
x5gtrn / gist:217863
Created October 25, 2009 03:04
test of generic for, ipairs()
local array = {["key1"] = 1, key2 = 2; 3, 4, 5; key3 = 6; 7, 8}
print("array size=" .. #array)
for i,v in ipairs(array) do
print("index=" .. i
.. " value=" .. v)
end
print("value of key1=" .. array.key1)
print("value of key2=" .. array.key2)
print("value of key3=" .. array.key3)
@x5gtrn
x5gtrn / main.lua
Created October 25, 2009 07:19
making module template
package.path = package.path .. ";../?.lua"
require "module1"
require "module2"
module1.showDate()
showGrobalVal()
imageMap.remove(strUserId);
if (!ImageIO.getUseCache()) {
ImageIO.setUseCache(true);
}
BufferedImage image = null;
try {
imageMap.put(strUserId, ImageIO.read(url));
} catch (IOException e) {
imageMap.put(strUserId, null);
}
public boolean isEquals(File file1, File file2) {
FileInputStream fis1 = null;
FileInputStream fis2 = null;
try {
byte[] ba1 = new byte[(int) file1.length()];
byte[] ba2 = new byte[(int) file2.length()];
fis1 = new FileInputStream(file1);
fis1.read(ba1);
fis2 = new FileInputStream(file2);
fis2.read(ba2);
public static void main(String[] args) throws Exception {
String inFilePath = args[0];
int targetColumn = Integer.parseInt((args[1]));
String outFilePath = args[2];
File inCsv = new File(inFilePath);
File outCsv = new File(outFilePath);
BufferedReader br = null;
FileInputStream fis = null;
@x5gtrn
x5gtrn / DBMainTransactionManager.php
Created April 9, 2013 17:24
Transaction Management by Model for CakePHP
<?php
App::uses('TransactionManager', 'Model');
class DBMainTransactionManager extends TransactionManager {
public $name = 'DBMainTransactionManager';
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct();
$this->useDbConfig = Configure::read('Datasource.mysql.master.main');
@x5gtrn
x5gtrn / private.xml
Last active December 16, 2015 22:38
custom setting for KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<list>
<item>
<name>x5gtrn's Original Setting</name>
<list>
<item>
<name>Enable xHHK compatible Arrow Key Mode (Using Mac)</name>
<identifier>remap.xhhkmacmode</identifier>
@x5gtrn
x5gtrn / syoya_dev_team-checks.xml
Last active December 25, 2015 20:29
sun_checks.xml based.
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
@x5gtrn
x5gtrn / 0_reuse_code.js
Created November 23, 2013 17:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>background</key>
<data>
BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
ZmZmAAAAg65HYT+G
</data>
<key>border</key>