Skip to content

Instantly share code, notes, and snippets.

View masaru-b-cl's full-sized avatar

TAKANO Sho / @masaru_b_cl masaru-b-cl

View GitHub Profile
@masaru-b-cl
masaru-b-cl / Charset.pm
Created August 10, 2016 00:48 — forked from anonymous/Charset.pm
Mojolicious::Plugin::Charset;でエンコーディングとキャラセット分けて指定できるようにする
package Mojolicious::Plugin::Charset;
use Mojo::Base 'Mojolicious::Plugin';
sub register {
my ($self, $app, $conf) = @_;
return unless my $c = $conf->{charset};
return unless my $e = $conf->{encoding};
$app->types->type(html => "text/html;charset=$c");
CommonLisp:
hash-table
Scheme:
hash-table (SRFI-69), hashtable (R6RS Scheme)
Haskell:
Map
OCaml:
Hashtbl, Map
SML:
hash_table (sml-nj-lib)
@masaru-b-cl
masaru-b-cl / gist:8036060
Last active December 31, 2015 19:49 — forked from leque/gist:8035729
Common Lisp Scheme Haskell OCaml F# SML Ruby Smalltalk C#
mapc for-each mapM_ iter iter app each do: ForEach (List<T>のみ)
mapcar map map map map map map, collect collect: Select
find-if find find find find find find, detect detect: First
remove-if-not filter filter filter, find_all filter filter find_all, select select Where
reduce fold, fold-left foldl fold_left fold foldl inject inject:into: Aggregate
reduce :from-end t fold-right foldBack foldr fold_right foldr - - -
some any, exists any exists exists exists any? anySatisfy: Any
every every, for-all all for_all forall all all? allSatisfy: All
@masaru-b-cl
masaru-b-cl / git-now
Last active January 24, 2024 02:22 — forked from mzp/git-now
#!/bin/sh
PREFIX="from now"
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
MAIN_BRANCH=${1:-master} # デフォルトは 'master'、第1引数で上書き可能
shift # 引数リストからメインブランチ名を除外
get_amend() {
if [ -z `git log --pretty=oneline --no-color -1 | cut -d " " -f 2- | grep "^\[${PREFIX}]"` ]
@masaru-b-cl
masaru-b-cl / git-master
Last active September 14, 2016 04:58 — forked from mzp/gist:1131618
git-master
#!/bin/sh
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
IFS_ORIG=$IFS
IFS=#
arr=($WORKING_BRANCH)
IFS=$IFS_ORIG
size=${#arr[@]}