Skip to content

Instantly share code, notes, and snippets.

View saxsir's full-sized avatar
💭
🍻

saxsir saxsir

💭
🍻
View GitHub Profile
@saxsir
saxsir / a.html
Last active September 8, 2023 02:53
live-reload
<html>
<head>
</head>
<body>
aaaa
</body>
</html>
" Clipboard Copy
copyText (text) -> {{
Clipboard.copy(text);
Status.setMessage('copied: ' + text, 2);
}}
copyUrl (format) -> {{
let text = format.replace("%URL%", location.href).replace("%TITLE%", document.title);
Clipboard.copy(text);
Status.setMessage('copied: ' + text, 2);
}}
$ go test -v -bench=. -benchmem
testing: warning: no tests to run
PASS
BenchmarkLimitPointer-8 2000000000 0.63 ns/op 0 B/op 0 allocs/op
BenchmarkLimitCopy-8 2000000000 0.55 ns/op 0 B/op 0 allocs/op
BenchmarkSortPointer-8 20000 67867 ns/op 48 B/op 2 allocs/op
BenchmarkSortCopy-8 20000 62706 ns/op 48 B/op 2 allocs/op
BenchmarkCountUniqWordsPointer-8 30000 61876 ns/op 32996 B/op 4 allocs/op
BenchmarkCountUniqWordsCopy-8 20000 61679 ns/op 32991 B/op 4 allocs/op
BenchmarkCountUniqWordsPointer2-8 20000 61550 ns/op 32988 B/op 4 allocs/op
@saxsir
saxsir / a.go
Last active July 11, 2016 08:32
package main
import (
"fmt"
"sort"
)
type FeatureWord struct {
Count int
Score float64
@saxsir
saxsir / prepare-commit-msg
Created November 10, 2015 14:33
git commitする時にissue番号を自動で入力するgit hooks
#!/bin/sh
#
if [ "$2" == "" ] ; then
mv $1 $1.tmp
echo "(issue #`git branch | grep "*" | awk '{print $2}' | sed -e "s/[^0-9]//g"`)" > $1
cat $1.tmp >> $1
fi
@saxsir
saxsir / Makefile
Last active November 2, 2015 15:33
コマンドラインからファイルを1行ずつ読んで逐次処理するワンライナー
run:
cat foo.txt | while read line; do echo $$line; done
@saxsir
saxsir / memo.md
Created October 27, 2015 15:34
FizzBuzzの三項演算子判定(PHP)

一番最初に思いついたやつ

($n % 15 === 0) ? "FizzBuzz" : (($n % 3 === 0) ? "Fizz" : (($n % 5 === 0) ? "Buzz" : (string) $n));

頑張って短く書いたやつ

$n%15 ? $n%3 ? $n%5 ? (string)$n : "Buzz" : "Fizz" : "FizzBuzz";
$n%15 ? ($n%3 ? $n%5 ? (string)$n : "Buzz" : "Fizz") : "FizzBuzz";
$n%15 ? ($n%3 ? ($n%5 ? (string)$n : "Buzz") : "Fizz") : "FizzBuzz";
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
uglify = require('gulp-uglify');
gulp.task('default', function() {
return gulp.watch(['./src/*.js', './gulpfile.js'], ['jshint']);
});
@saxsir
saxsir / 2015spring-ronpro-schedule
Created April 10, 2015 07:10
[メモ] 2015年度論プロの講義スケジュールとか
# 講義の説明
## 講義スケジュール
- 中間試験
* 6回目
- 期末試験
* 14回目
- 作品づくり
* 10回目あたりから(前コマは授業, 後コマは作品づくり時間)
@saxsir
saxsir / Vagrantfile
Last active August 29, 2015 14:14
1つのVagrantfileで複数のVMを立ち上げる
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Refs http://www.vagrantbox.es/
config.vm.box = "https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box"