Skip to content

Instantly share code, notes, and snippets.

View AmaiSaeta's full-sized avatar
👨‍💻
PROGRAMMING is the contemporary MAGIC!

天井冴太 AmaiSaeta

👨‍💻
PROGRAMMING is the contemporary MAGIC!
View GitHub Profile
@AmaiSaeta
AmaiSaeta / prepare-commit-msg
Created June 19, 2012 11:01
(for vimpr/vimperator-plugins issue #24) Insert commit file names to a commit-message by automatic.
#!/bin/sh
# Insert commit file names to a commit-message by automatic.
cp $1 $1.tmp
# [FIXME] ↓I'm not know other values...(Especially for "squash")
if [ "$2" = "message" ] ; then
t=$1.tmp
else
t=$1
fi
@AmaiSaeta
AmaiSaeta / gist:2989601
Created June 25, 2012 16:30
【解決】何故これでアクセストークンが取得出来ないのか。
# Twitter APIにアクセスするコードの一部
# このコード以前でリクエストトークン(reqToken)は取得出来ており、reqToken.authorize_urlにアクセス、ブラウザ上にPINコードを表示している物とする。
# 手元の環境(ruby 1.8.7 (2012-02-08 patchlebel 358) [i386-cygwin])では、正しいPINコードを入力しても、必ずOAuth::Unauthorizedが発生する
begin
print "Please input PIN:"
STDOUT.flush
pin = STDIN.gets
tokens = reqToken.get_access_token({:oauth_verifier => pin})
rescue OAuth::Unauthorized => e
// ==UserScript==
// @name ねえねえ今どんな気持ち?
// @namespace http://amaisaeta.seesaa.net/
// @description 国分太一fier
// @include https://www.facebook.com/*
// @version 1.00.20121213
// ==/UserScript==
(function () {
var aa = [ // {{{
@AmaiSaeta
AmaiSaeta / test.vimrc
Created March 23, 2013 20:01
For test vimproc. This file exists in the home directory. "~/vimbundles/" is a directory, Vim plugins are installed(copied) here.
set cpo&vim
set rtp^=~/vimbundles/vimproc,~/vimbundles/vesting,~/vimbundles/unite.vim
set rtp+=~/vimbundles/vesting/after
@AmaiSaeta
AmaiSaeta / gist:7874062
Created December 9, 2013 15:34
PATHから"HOGEHOGE"を含む物を取り除くPowerShellコマンド。 "HOGEHOGE"を適時変更すれば良し。
((Get-Content Env:Path) -Split ";" | Where-Object { $_ -notmatch "\b" + "HOGEHOGE" + "\b" }) -Join ";" | Set-Content Env:Path
@AmaiSaeta
AmaiSaeta / gist:8631399
Created January 26, 2014 11:34
(Vim) :ls の結果を、 Vim script から利用しやすい形にして返す関数
function! s:ls(all)
" Return the STRUCTURED all buffer informations that is similar :ls.
" @param[in] all Include "unlisted" buffer informations.
" @return
" Buffer informations. It's a List that contains Dictionary of a buffer
" informatin. Its Dictionary is composed these members:
" bufnr: Buffer number.
" unlisted: If 1, this buffer is "unlisted", otherwise 0.
" focus: "%" means in current window. "#" means alternate buffer.
" active: "a" means active buffer. "h" means hidden buffer.
@AmaiSaeta
AmaiSaeta / gist:9291862
Last active August 29, 2015 13:56
[JavaScript] Array.flatten()
function flattenArray() {
return this.reduce(function(lhs, rhs) {
// lhs is already flatten.
if((rhs instanceof Array) && rhs.some(Array.isArray)) rhs = flattenArray.call(rhs);
return lhs.concat(rhs);
}, []);
}
:HOGEコマンド:
これはhogehogeをfugafugaします:
actual: !vimexpression foo#bar#baz('hogehoge')
expected: EXPECTED
message: テスト失敗メッセージ
内部的にはpiyopiyoです:
attribute: [ドキュメント化しないよ]
actual: !vimscript |
Foo
Bar baz
#!/bin/bash
MUTE=`amixer -c 0 get Master|tail -1|cut -d '[' -f 4|sed s/\]//`
if [ $MUTE = "on" ] ; then
ICON="/usr/share/icons/HighContrast/scalable/status/audio-volume-medium.svg"
else
ICON="/usr/share/icons/HighContrast/scalable/status/audio-volume-muted.svg"
fi
--Awesome WM configuration
-- based /etc/xdg/awesome/rc.lua
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")