Skip to content

Instantly share code, notes, and snippets.

var MyJSON = {};
function isArray(arg){
return Object.prototype.toString.call(arg) === '[object Array]';
}
function escapeStr(s){
return '"' + s
.replace(/\\/g, "\\\\")
.replace(/\t/g, "\\t")
@sonota88
sonota88 / libo_calc.bat
Last active August 29, 2015 14:04
LibreOffice Calc Sample
@echo off
set JJS=C:\path\to\java\bin\jrunscript.exe
set LIBO_DIR=C:\Program Files (x86)\LibreOffice 4
set CLASSPATH=%LIBO_DIR%\program\classes\unoil.jar
set CLASSPATH=%CLASSPATH%;%LIBO_DIR%\URE\java\juh.jar
set CLASSPATH=%CLASSPATH%;%LIBO_DIR%\URE\java\jurt.jar
set CLASSPATH=%CLASSPATH%;%LIBO_DIR%\URE\java\ridl.jar
rem echo %CLASSPATH%
// jrunscript/Rhino
/**
* @param writer java.io.Writer
*/
function FileWriter(writer){
this.writer = writer;
}
FileWriter.prototype.close = function(){
this.writer.close();
// JScript
function toWinPath(path){
return path.replace(/\//g, "\\");
}
var MYSQLADMIN = toWinPath("C:/path/to/mysql/bin/") + "mysqladmin -uXXXX -pXXXX";
function print(value){
WScript.StdOut.Write("" + value);
@sonota88
sonota88 / gist:5021285
Last active December 14, 2015 03:29
ログを時間でフィルタするやつ
# -*- coding: utf-8 -*-
def format_datetime(y, m, d, hour, min)
"%04d-%02d-%02d %02d:%02d" % [y, m, d, hour, min]
end
def auto_hour(from_or_to)
if from_or_to == :from
0
elsif from_or_to == :to
@sonota88
sonota88 / volatile-highlight.el
Last active June 10, 2023 04:18
volatile-highlight.el
;; (c) 2011 sonota486 <yosiot8753@gmail.com>
;; license: GPL
;; ;; .emacs.el example
;; (require 'volatile-highlight)
;; (set-face-background 'volatile-highlight-face "#ffff00") ; optional
(copy-face 'highlight 'volatile-highlight-face)
package dbunitsample;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Memebers {
@sonota88
sonota88 / org.css
Created June 3, 2011 12:52
org css
/*
# (setq org-export-htmlize-output-type 'css)
# (setq org-export-html-style-include-default nil)
#+style: <link href="org.css" rel="stylesheet" type="text/css" />
*/
* { line-height: 170%;
@sonota88
sonota88 / block-indent.el
Created May 15, 2011 02:26
block-indent.el
;; block-indent.el
;; author: sonota
;; license: GPL
;; save-excursionとカーソル周辺のブロック(関数など)の自動インデントを組み合わせてみた - 再発明日記
;; http://d.hatena.ne.jp/sonota88/20101218/1292678664
;;;;
;; ルールの書式:
;; ((modes) ; 関連付けるメジャーモードのリスト
(require 'imcap)
(setq imcap-file-name-format "%Y-%m-%d-%H%M%S.png")
(setq imcap-directory "imcap")
(setq imcap-capture-delay 5)
(defun imcap-capture-command-format ()
(concat " sleep "
(format "%s" imcap-capture-delay)
" ; "