This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syohei@gretsch:% prove -v --exec='emacs -Q --script' sample.el | |
sample.el .. | |
1..3 | |
ok 1 - string type test | |
ok 2 - add test | |
ok 3 - matching test test | |
ok | |
All tests successful. | |
Files=1, Tests=3, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.04 cusr 0.00 csys = 0.05 CPU) | |
Result: PASS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var fs = require('fs'); | |
var downloadUrl = process.argv[2]; | |
if (typeof donwloadUrl === undefined) { | |
console.log("Usage: request.js URL"); | |
process.exit(1); | |
} | |
request.get({ uri: downloadUrl }, function (error, response, body) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import re | |
from http import Client, Request | |
url = '' | |
if len(sys.argv) > 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Encode; | |
use Term::ANSIColor qw(:constants); | |
use File::Which qw(which); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Lisp; | |
use strict; | |
use warnings; | |
use Scalar::Util qw/looks_like_number/; | |
use List::MoreUtils qw/zip/; | |
sub new { | |
my $env; $env = { | |
':label' => sub { my ($name, $val) = @_ ; $env->{$name} = $val;}, | |
':quote' => sub { $_[0] }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'konoha-mode) | |
;; setting for flymake | |
(require 'flymake) | |
(add-to-list 'flymake-allowed-file-name-masks '("\\.k\\'" flymake-konoha-init)) | |
(defun flymake-konoha-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## show git branch at right prompt | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' formats '[%b]' | |
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]' | |
precmd () { | |
psvar=() | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" | |
topdir=`git rev-parse --show-toplevel 2>/dev/null` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-temp-buffer | |
(shell-command | |
"osascript -e 'tell application \"Finder\" to get bounds of window of desktop'" t) | |
(goto-char (point-min)) | |
(if (re-search-forward "[0-9]+, [0-9]+, \\([0-9]+\\), \\([0-9]+\\)") | |
(let ((width (buffer-substring-no-properties | |
(match-beginning 1) (match-end 1))) | |
(height (buffer-substring-no-properties | |
(match-beginning 2) (match-end 2)))) | |
(mapcar #'string-to-int (list width height))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
use warnings; | |
sub each_with_index (\@) { | |
my $array_ref = shift; | |
my $length = scalar @{$array_ref}; | |
my $index = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; insert 'use Module' which is at cursor. | |
(define-key cperl-mode-map (kbd "C-c C-m") 'cperl-insert-use-statement) | |
(defun cperl-insert-use-statement () | |
"use statement auto-insertion." | |
(interactive) | |
(let ((module-name (cperl-word-at-point)) | |
(insert-point (cperl-detect-insert-point))) | |
(save-excursion | |
(let ((use-statement (concat "\nuse " module-name ";"))) |