Skip to content

Instantly share code, notes, and snippets.

@takehiko
takehiko / 0_reuse_code.js
Created December 20, 2013 01:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# hubcalc.rb : "Hub Calculation Board" Generator
# by takehikom (http://d.hatena.ne.jp/takehikom/)
$svg_skel = DATA.read
module HubCalc
class Generator
\documentclass[12pt,a4paper]{jsarticle}
\def\labelenumi{(\arabic{enumi})}
\def\maru#1{\textcircled{\scriptsize #1}}
\tabcolsep=2pt
\parindent=0pt
\begin{document}
\section{MathPubより}
#include <stdio.h>
void print_field(char field[4][6])
{
int i;
for (i = 0; i < 4; i++) {
printf("%s\n", field[i]);
}
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
./4x5_nostar 5 => uldll:11
./4x5_nostar 6 => uldruu:10
./4x5_nostar 7 => llulurr:8
./4x5_nostar 8 => llulurur:6
./4x5_nostar 9 => llulururu:6
@takehiko
takehiko / mintty.sh
Created January 19, 2014 21:02
zsh/screen launcher on Cygwin (32/64 bit) + mintty
#!/bin/sh
# Cygwin (32/64 bit) + mintty + zsh/screen
# 1. Save this file as ~/bin/mintty.sh (if necessary,
# modify environmental variables).
# 2. Create a shortcut for mintty.exe.
# 3. Open the properties of the shortcut and
# append the full pathname of ~/bin/mintty.sh to
# the link.
// 「ようかいしりとり」の状態遷移図
// 作成者: takehikom (http://d.hatena.ne.jp/takehikom/)
// 歌詞参照: http://plaza.rakuten.co.jp/ribbon1976/diary/201311210002/
digraph youkaishiritori {
// node[fontname="ms gothic"]; // Windowsではコメントを外す
"ようかいはかせの ところに" ->
"ろくろっくびが やってきた" ->
"ようかいしりとり しようかい?" ->
// 「ようかいしりとり」の状態遷移図2
// 作成者: takehikom (http://d.hatena.ne.jp/takehikom/)
// 歌詞参照: http://plaza.rakuten.co.jp/ribbon1976/diary/201311210002/
digraph youkaishiritori {
// node[fontname="ms gothic"]; // Windowsではコメントを外す
n1 [label = "ようかいはかせの ところに"]; n1 ->
"ろくろっくびが やってきた" ->
"ようかいしりとり しようかい?" ->
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>トライアングル3分割</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style type="text/css" >
.thinline { fill:none; stroke:black; stroke-width:1; }
.thickline { fill:none; stroke:black; stroke-width:2; }
</style>
@takehiko
takehiko / regularpolygons.html
Created March 21, 2014 13:16
Regular Polygons
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Regular Polygons</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">