This file contains 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
#!/bin/zsh | |
# Bind BackSpace key for Caps_Lock. | |
/usr/bin/xmodmap -e 'keycode 66 = BackSpace' | |
/usr/bin/xmodmap -e 'remove Lock = BackSpace' | |
/usr/bin/xset r 66 | |
# Bind Caps_Lock key for BackSpace. | |
/usr/bin/xmodmap -e 'keycode 22 = Caps_Lock' | |
/usr/bin/xmodmap -e 'add Lock = Caps_Lock' |
This file contains 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
function! SearchOpenParenForward() | |
let l:_ = search("\\((\\|\\[\\|{\\|<\\|「\\|『\\)\\zs") | |
endfunction | |
function! SearchOpenParenBackward() | |
let l:_ = search("\\((\\|\\[\\|{\\|<\\|「\\|『\\)\\zs", 'b') | |
endfunction | |
noremap <silent> ) :call SearchOpenParenForward()<CR> | |
noremap <silent> ( :call SearchOpenParenBackward()<CR> |
This file contains 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
(global-set-key (kbd "C-a") | |
'(lambda () | |
(interactive) | |
(if (= (point) (line-beginning-position)) | |
(scroll-down 1)) | |
(beginning-of-line))) | |
(global-set-key (kbd "C-e") | |
'(lambda () | |
(interactive) |
This file contains 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
#include <iostream> | |
class Foo { | |
public: | |
Foo() {} | |
void say() { | |
std::cout << data_ << std::endl; | |
} |
This file contains 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
// echo in C++11 | |
#include <algorithm> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char* argv[]) | |
{ | |
std::vector<std::string> strings(argv + 1, argv + argc); |
This file contains 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
" smartchr 的な動作は改行時にまとめてやれば済むでしょ、と思って簡単に作ってみた。 | |
" どうも実用的にできなかったのでgistに晒して終わりにする。 | |
function! StylizeLine(modifyBuffer) | |
let l:line = getline(".") | |
" Skip if comment line or preprocessor directive. | |
if (match(l:line, "^\\s*#") != -1) || (match(l:line, "^\\s*\/\/") != -1) | |
return l:line | |
endif |
This file contains 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
" StylizeLine | |
" include guard | |
"if exists("g:loaded_StylizeLine") && g:loaded_StylizeLine | |
" finish | |
"endif | |
"let g:loaded_StylizeLine = 1 | |
function! StylizeLine(modifyBuffer, lineOffset) | |
let l:line = getline(line(".") + a:lineOffset) |
This file contains 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
" GoUp | |
" include guard | |
"if exists("g:loaded_GoUp") && g:loaded_GoUp | |
" finish | |
"endif | |
"let g:loaded_GoUp = 1 | |
" Go to the next (or previous) line with the same indentation to the | |
" current line (or less than), ignoring empty lines. |
This file contains 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
% pure -i | |
Pure 0.52 (x86_64-unknown-linux-gnu) Copyright (c) 2008-2012 by Albert Graef | |
(Type 'help' for help, 'help copying' for license information.) | |
Loaded prelude from /usr/local/lib/pure/prelude.pure. | |
> sum = foldl (+) 0; | |
> dot x::matrix y::matrix = sum $ zipwith (*) (rowvector x) (rowvector y); | |
> x::matrix * y::matrix = {dot u v | u = rows x; v = cols y}; | |
> a = {1, 2, 3; 1, 2, 3; 1, 2, 3}; | |
> b = {1, 2, 3, 4; 1, 2, 3, 4; 1, 2, 3, 4}; |
This file contains 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
fn main(_args: [str]) { | |
uint::range(1u, 21u) {|i| | |
let msg = alt (i % 3u, i % 5u) { | |
(0u, 0u) { "fizzbuzz" } | |
(0u, _) { "fizz" } | |
(_, 0u) { "buzz" } | |
(_, _) { #fmt("%u", i) } | |
}; | |
io::println(msg); | |
}; |
OlderNewer