Skip to content

Instantly share code, notes, and snippets.

//**********************************
// ヘルパー
//**********************************
var resize = function (width, height, anchor) {
if (typeof anchor === 'undefined') anchor = 'top-left';
return slate.operation('resize', {
'width' : width,
'height' : height,

基本的には https://github.com/jigish/slate/wiki/JavaScript-Configs を参照

JavaScriptによる設定ファイルの置き場所

  • .slate.jsをホームディレクトリに置く
  • .slate => .slate.js の順で読み込まれる

globalオブジェクト

  • slate => SlateのAPIにアクセスできる
  • _ => underscore.jsを使う

slate オブジェクト

config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# alt-{right,left,up,down} でその方向にウィンドウサイズを変化させる
bind right:alt resize +10% +0
bind left:alt resize -10% +0
bind up:alt resize +0 -10%
bind down:alt resize +0 +10%
@jewel12
jewel12 / show-current-dir.zsh
Created December 17, 2012 08:52
tmuxでアクティブでないウィンドウの名前をそのウィンドウ内でのカレントディレクトリにする
show-current-dir-as-window-name() {
tmux set-window-option window-status-format " #I ${PWD:t} " > /dev/null
}
show-current-dir-as-window-name
add-zsh-hook chpwd show-current-dir-as-window-name
int incomingByte = 0;
int firstLedPinNum = 10;
int lastLedPinNum = 13;
int ledBlinkFactorSec = 100
void setup() {
Serial.begin(9600);
for(int i = firstLedPinNum; i <= lastLedPinNum; i++) {
pinMode(i, OUTPUT);
@jewel12
jewel12 / things_project_to_google_calendar.rb
Created December 4, 2012 17:07
Thingsのプロジェクト期限をGoogleカレンダーに登録する
# -*- coding: utf-8 -*-
require "gcalapi"
require "appscript"
include Appscript
class ThingsApp
def initialize
@things = app("Things")
end
require 'pathname'
puts File.expand_path(File.join( File.dirname(__FILE__), "../lib/yamada" ))
puts Pathname(__FILE__).dirname.expand_path + "../lib/yamada"
@jewel12
jewel12 / dayone.el
Created October 29, 2012 19:42
Create a new entry of DayOne on Emacs.
(defvar path-to-dayone "/usr/local/bin/dayone"
"Executable path to DayOne CLI")
(defun dayone-save-new-entry ()
"Save buffer as a new DayOne entry"
(interactive)
(if (executable-find path-to-dayone)
(call-process-region
1 (point-max) path-to-dayone nil nil nil "new")))
@jewel12
jewel12 / move-to-mark.el
Created September 9, 2012 10:19
move-to-mark
(defun move-to-mark ()
(interactive)
(let ((pos (point)))
(if (mark)
(progn (goto-char
(if (boundp 'marked-pos) marked-pos (mark)))
(setq marked-pos pos))
(message "There is no marked point to move."))))
(global-set-key (kbd "M-q") 'move-to-mark)
@jewel12
jewel12 / list_sum.io
Created July 11, 2012 18:20
二次元配列内の数値を合計する
// total とリスト内の全ての数値に与えられた演算処理を行い、total を逐次更新する
// リスト内の要素が全て Number であることが前提
List op_inject := method(op_str,
Number inject_op := Number getSlot(op_str)
total := 0
call target foreach(v, total = total inject_op(v))
return total)
// ネストしているリストにも対応
List sum := method(