break, continue, goto, returnで抜ける
f, err := os.Open(name)
if err != nil {
return err
}
d, err := f.Stat()
if err != nil {
return err
const axios = require('axios') | |
const decode = require('decode-html') | |
const CHANNEL = '#dev' | |
const ISSUE_REPO = 'foo/bar' | |
exports.otochan = (req, res) => { | |
console.log('Received request:', req.body) | |
// slack challenge | |
if (req.body.challenge) { |
syntax enable | |
set expandtab | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set autoindent | |
set smartindent | |
set number |
function date2str(date, sep) { | |
function pad(number) { | |
return number < 10 ? "0" + number : number.toString(); | |
} | |
return date.getYear() + sep + pad(date.getMonth()+1) + sep + pad(date.getDate()); | |
} | |
function toQif(date, desc, debit, credit, amount) { | |
return [ | |
"!Clear:AutoSwitch", |
#! /usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
require 'json' | |
require "net/https" | |
WH_URI = "https://hooks.slack.com/services/hoehoehoehoe~~~~~~~~" | |
uptime = `uptime`.chomp | |
hash = { |
.promoted-tweet, .promoted-account, .promoted-trend, .import-prompt, .promoted-heading, .has-profile-promoted-tweet { | |
display: none; | |
} |
;;; gc 間隔設定 128MB 使うまで走らなくなる * 4 | |
(setq gc-cons-threshold (* 4 134217728)) | |
(setq load-path (cons "~/.emacs.d/elisp" load-path)) | |
(require 'package) | |
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
("marmalade" . "https://marmalade-repo.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(package-initialize) |
(defun jump-to-github () | |
"Go to github code position at most recent commitl;" | |
(interactive) | |
(let (full_path) | |
(setq | |
full_path buffer-file-name | |
dir_name (shell-command-to-string (concat "echo " full_path "| xargs dirname")) | |
cd_dir (shell-command-to-string (concat "cd " dir_name)) | |
prefix (shell-command-to-string "git rev-parse --show-prefix | tr -d '\n'") | |
current_commit (shell-command-to-string "git show -s --format=%H | tr -d '\n'") |
// 文字列から ArrayBuffer への変換 | |
function string_to_buffer(src) { | |
return (new Uint16Array([].map.call(src, function(c) { | |
return c.charCodeAt(0) | |
}))).buffer; | |
} | |
// ArrayBuffer から文字列への変換 |
#!/usr/bin/ruby #Gistでハイライトされないので | |
## nginxのビルドとpassnegerのインストール | |
execute 'build nginx' do | |
command "passenger-install-nginx-module" << | |
" --auto" << | |
" --prefix=/opt/nginx" << | |
" --nginx-source-dir=/usr/src/nginx-#{node['nginx']['version']}" << | |
" --extra-configure-flags='--with-ipv6 --with-http_realip_module --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module'" | |
not_if do | |
File.exists?("/opt/nginx/sbin/nginx") |