Skip to content

Instantly share code, notes, and snippets.

@abicky
abicky / Runit
Last active September 29, 2015 09:28
command line tool for RUnit, which is a unit test framework for R
#!/usr/bin/env Rscript
#---------------------------------------------------------------------------
# command line tool for RUnit, which is a unit test framework for R
#
# Copyright 2012- Takeshi Arabiki
# License: MIT License (http://opensource.org/licenses/MIT)
#
# See also: http://d.hatena.ne.jp/a_bicky/20120109/1326074730 [in Japanese]
#---------------------------------------------------------------------------
@abicky
abicky / cumsum.pl
Created January 14, 2012 13:22
output the cumulative sum of the input data
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
my (@keys, @values, $HELP, $TEST);
GetOptions('keys=i{,}' => \@keys, 'values=i{,}' => \@values, 'help' => \$HELP, 'test' => \$TEST);
sub usage {
print STDERR <<USAGE;
usage: $0 --keys key_fields --values value_fields
@abicky
abicky / ess-r-d.el.patch
Created April 15, 2012 10:05
patch for ess-r-d.el (ESS 12.0.4)
--- ess-r-d.el.orig 2012-04-06 08:02:29.000000000 +0900
+++ ess-r-d.el 2012-04-14 22:20:21.000000000 +0900
@@ -511,10 +511,15 @@
(when (and ess-current-process-name
(get-process ess-current-process-name)
(not (ess-process-get 'busy)))
- (let* ((funname (or (and ess-eldoc-show-on-symbol ;; aggressive completion
- (ess-get-object-at-point))
- (car (ess--funname.start))))
- (doc (cadr (ess-function-arguments funname))))
@abicky
abicky / anything-R.el.patch
Created April 15, 2012 10:43
patch for anything-R.el
--- anything-R.el.orig 2012-04-15 18:44:10.000000000 +0900
+++ anything-R.el 2012-04-15 19:41:11.000000000 +0900
@@ -44,43 +44,76 @@
(require 'anything)
(require 'ess-site)
+(defvar anything-R-default-limit
+ anything-candidate-number-limit)
+
+(defvar anything-R-help-limit
@abicky
abicky / init.el
Created April 15, 2012 13:59
init.el for R (ESS)
;;; ~/.emacs.d/init.el
;;;---------------------------------
;;; 基本設定
;;;---------------------------------
;; 自分でダウンロードした *.el, *.elc のディレクトリ
(setq my-site-lisp (expand-file-name "~/.emacs.d/site-lisp"))
;; my-site-lisp を load-path に追加
(add-to-list 'load-path my-site-lisp)
;; 起動メッセージを表示しない
(setq inhibit-startup-message t)
@abicky
abicky / auto-complete.el.patch
Created June 19, 2012 18:03
patch for auto-complete.el (fix a bug that ac-auto-start is ignored)
diff --git auto-complete.el auto-complete.el
index 286c2d4..7a7b418 100644
--- auto-complete.el
+++ auto-complete.el
@@ -841,7 +841,8 @@ You can not use it in source definition like (prefix . `NAME')."
(eval prefix))))
(if (and point
(integerp req)
- (< (- current point) req))
+ (< (- current point)
@abicky
abicky / canvas_get_transform.js
Created July 23, 2012 18:50
Simple implementation of CanvasRenderingContext2D#getTransform (getTransform for HTML5 Canvas API)
/**
* Copyright 2012- Takeshi Arabiki
* License: MIT License (http://opensource.org/licenses/MIT)
*/
(function() {
CanvasRenderingContext2D.prototype._transform = [1, 0, 0, 1, 0, 0];
CanvasRenderingContext2D.prototype._transforms = [];
CanvasRenderingContext2D.prototype.getTransform = function() {
(setq x-select-enable-clipboard t)
(defun copy-from-clipboard (text &optional rest)
(let ((process-connection-type nil) proc)
(if (eq system-type 'darwin)
(setq proc (start-process "pbcopy" "*Messages*" "pbcopy"))
(setq proc (start-process "xsel" "*Messages*" "xsel" "-b" "-i")))
(process-send-string proc text)
(process-send-eof proc)))
(defun paste-from-clipboard ()
@abicky
abicky / msgpack.R
Last active December 10, 2015 12:19
MessagePack for R (support only unpack)
#---------------------------------------------------------------------
# MessagePack for R (support only unpack)
#
# Copyright 2013- Takeshi Arabiki
# License: MIT License (http://opensource.org/licenses/MIT)
#
# > source("msgpack.R")
# > msgpack$unpack("\x93\x01\x02\x03")
# [1] 1 2 3
# > msgpack$unpack(c(charToRaw("\xCD\x01"), as.raw(0x00)))
import "js/web.jsx";
class History {
function a() : void {
History.b();
}
static function b() : void {
}
}