Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
// ==UserScript==
// @name github-build-badge
// @author linyows
// @namespace http://linyows.com/
// @description "Expand build status badge"
// @include https://github.com/*
// ==/UserScript==
(function() {
var match_witch_badge = /<a href="(http:\/\/ci[0-9]{0,3}\..*\.[a-z]{2,5}\/job\/.*)"><img src=".*" alt="Build Status" data-canonical-src=".*" style=".*"><\/a>/g;
#! /usr/bin/env ruby
# Pull all directory under current directory, if it's on master, has no local changes, can be pulled fast-forward.
def git_repo?
`git status`.chomp !~ /Not a git repository/
end
def not_changed?
`git status -s`.chomp.empty?
@fujimura
fujimura / spaghetti_and_neapolitan.hs
Last active December 20, 2015 17:08
spaghetti_and_neapolitan.hs
spaghetti :: String
spaghetti = "gtgtsgipgttptinggipsppaigsesgpetgstpatetisiesagaeaigttetepitiatsegssieeeeatepaaiagtpieataatppiitgiapsteitatiiatpetetetttgpetpaasipttssstpeeeggtiagtttegtiipestsasgpsepaasapttgattgiatppegitiatpasgatgepttggapesaeetaeissttggieietgspagesiipestipggstttpateptitiaetottissgggtttaipappgstsptttgtpispattgegstltiappseisapgistaiagteeiptptpisaieisagstapeteietgteiisgtiptstgtstasspeatspptitttatteastsgtptgtasggpniaaeteaisett"
neapolitan :: String
neapolitan = "neapolitan"
solve :: String -> String -> String
solve [] _ = ""
solve xs [] = xs
solve (x:xs) (y:ys)
@kyanny
kyanny / gist:6396592
Last active December 22, 2015 01:29
RubyConf 2013 CFP
Title
Tachikoma - Continuous gem dependency updating with pull request
Abstract
Today you manage gems of Ruby application with Bundler, but you often neglect to update.
Whatever gems your application depends on, you can get the most benefit by following cutting-edge. Eventually you have to update them, so if you do it more frequently you'll have less pain.
#!/usr/bin/env ruby
require 'pit'
require 'octokit'
org_name = ARGV[0]
unless org_name
abort "Usage #{$0} org_name"
end
@nikushi
nikushi / chunk-test.md
Last active December 30, 2015 02:39
Transfer-Encoding: chunkedを返答するときでもWebRickだとContent-Lengthが付いてしまう

WebRick

$ telnet localhost 9292
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost:9292
@dagezi
dagezi / github-url.el
Last active December 30, 2015 21:09
Create URL from current buffer and insert to kill-ring.
(defun github-url-decompose (file &optional partial)
(cond
((file-directory-p (expand-file-name ".git" file)) (cons file partial))
((equal "/" file) nil)
(t (github-url-decompose (directory-file-name (file-name-directory file))
(if partial
(concat (file-name-nondirectory file) "/" partial)
(file-name-nondirectory file))))))
(defun github-url-get-origin (dir)
@masatomo
masatomo / github-url.el
Last active December 31, 2015 09:58 — forked from dagezi/github-url.el
Create a url to github from your local code.
moved to https://github.com/quipper/github-url.el
# 私が考える安全なプログラムを書くために必要なこと
今も昔も「入力によって挙動が大幅に変わるAPI」が世の中には多数存在していて、プログラマが本来意図した挙動と異なる動作を引き起こしている。
- ファイルを開こうとしたらコマンドを実行できてしまったり
- CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり
- SELECT文を発行するつもりがDELETE文を発行できてしまったり
こういったときに
- 入力値検証をしないと危険になる
@syou6162
syou6162 / Difference_between_cl_and_clojure.md
Created August 19, 2012 11:09
On Lispを読んでいて分からなかったCommon LispとClojureの違いについて自分なりにまとめていきます

Common Lispの関数

dolist

(dolist (var init-form result) S式 ... )

dolist は名前が示すように、リストに関係があります。最初に init-form を評価します。このとき、評価結果はリストでなければいけません。リスト以外の場合はエラーとなります。dolist は、このリストの要素を順番に変数 var に代入して S 式を評価します。リストの要素がなくなったら result を評価し、その値が dolist の返り値になります。次の例を見てください。