Skip to content

Instantly share code, notes, and snippets.

@uiur
uiur / index.js
Created April 18, 2019 00:24
slack emoji -> github issue
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) {
@nna774
nna774 / vimrc
Last active May 24, 2020 06:23
syntax enable
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
set number
@nna774
nna774 / qif.gs
Last active July 16, 2018 13:07
かけいぼgoogle app script
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 = {
@non117
non117 / snipet.md
Last active February 21, 2016 14:28
golangお勉強

ifのよくあるパターン

break, continue, goto, returnで抜ける

f, err := os.Open(name)
if err != nil {
    return err
}
d, err := f.Stat()
if err != nil {
 return err
@nna774
nna774 / twitter-com.css
Last active September 29, 2016 07:16
魔法のカスタムCSS(徳が低い)
.promoted-tweet, .promoted-account, .promoted-trend, .import-prompt, .promoted-heading, .has-profile-promoted-tweet {
display: none;
}
@nna774
nna774 / .emacs
Last active January 23, 2018 07:46
;;; 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)
@drobune
drobune / jump-to-github.el
Created September 5, 2015 21:01
emacsでカーソル行のgithubページに飛ぶ
(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'")
@kawanet
kawanet / string_to_buffer.js
Last active April 16, 2024 09:05
String と ArrayBuffer の相互変換 JavaScript
// 文字列から ArrayBuffer への変換
function string_to_buffer(src) {
return (new Uint16Array([].map.call(src, function(c) {
return c.charCodeAt(0)
}))).buffer;
}
// ArrayBuffer から文字列への変換
@srockstyle
srockstyle / chef_nginx_passenger
Last active August 29, 2015 14:14
ChefでnginxのビルドからPassengerのビルドまで質問に答えず一発で終わらせる方法
#!/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")