Skip to content

Instantly share code, notes, and snippets.

Takayuki Miwa tkyk

  • Kyoto, Japan
Block or report user

Report or block tkyk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tkyk
tkyk / dotr.rb
Created Aug 12, 2018
Minimal wrapper for Graphviz dot language
View dotr.rb
# Minimal wrapper for Graphviz dot language
#
# dotr = Dotr.digraph
#
# # Any ruby objects can be nodes.
# # Node id is `#hash` and default label is `#to_s`.
# dotr.node(1)
# dotr.node(:foo)
# dotr.node(Set[1, 2], label: 'set(1,2)')
# dotr.node({ x: 1 }, label: 'x1')
View dropbox_paper_character_count.js
require('isomorphic-fetch');
const ACCESS_TOKEN = '<YOUR_ACCESS_TOKEN>';
const sleep = require('sleep');
const Dropbox = require('dropbox').Dropbox;
//検索APIはalpha版なので手動でメソッド追加
Dropbox.prototype.paperDocsSearch = function (arg) {
return this.request('paper/docs/search', arg, 'user', 'api', 'rpc');
View wp_char_count.php
<?php
//日記をつけ始めた日
define('START_DATE', '2018-03-26');
$args = array(
'date_query' => array(
array(
'after' => START_DATE,
'inclusive' => true,
@tkyk
tkyk / sf34.rb
Created Mar 13, 2014
ストレングスファインダーで、6人中5人以上資質が被る確率
View sf34.rb
#!/usr/bin/env ruby
STRENGTHS = (1..34).to_a
TOP = 5
NUM_PEOPLE = 6
def check(max_tries, &pass_checker)
num_pass = 0
max_tries.times do
View parent_constructor.coffee
class Parent
constructor: (options) ->
{@foo, @bar} = options
class Child extends Parent
constructor: (param, args...) ->
@param = param
super args...
a = new Child "aaa", foo: "F", bar: "B"
@tkyk
tkyk / config.ru.diff
Created Sep 26, 2012
Octopress does not unescape the path by default
View config.ru.diff
diff --git a/config.ru b/config.ru
index b1b746b..2035cb1 100644
--- a/config.ru
+++ b/config.ru
@@ -1,5 +1,7 @@
+# coding: utf-8
require 'bundler/setup'
require 'sinatra/base'
+require 'uri'
@tkyk
tkyk / convert_assertions.sh
Created Feb 26, 2012
Convert assertion methods from SimpleTest to PHPUnit
View convert_assertions.sh
#!/bin/sh
# Usage: convert_assertions.sh file1 file2 ...
perl -i -p \
-e 's/assertEquals?/assertEquals/g;' \
-e 's/assertNotEquals?/assertNotEquals/g;' \
-e 's/assertPattern/assertRegExp/g;' \
-e 's/assertIdentical/assertSame/g;' \
-e 's/assertNotIdentical/assertNotSame/g;' \
-e 's/assertNoPattern/assertNotRegExp/g;' \
-e 's/assertReference/assertSame/g;' \
@tkyk
tkyk / README.md
Created Feb 9, 2012
Create a new CakePHP project with git, and manage the cake core with git submodule.
View README.md

CakePHP 2.0 + Git starter script

A small shell script to bake a new CakePHP project, initialize it as a git repository, and install the cake core as its submodule.

Download

https://github.com/tkyk/cakephp-git-starter

Requirements

View example.coffee
{EventEmitter} = require 'events'
util = require 'util'
class Example
# We can refer to the class we are now defining,
# because it is implemented as a FunctionDeclaration.
util.inherits Example, EventEmitter
constructor: ->
View gist:1518878
# nvm alias wcoffee v0.6.6
alias wcoffee="nvm run wcoffee $(which coffee) --watch"
function wcoffee_compile_tree() {
if [ $# -ne 2 ]; then
echo "wcoffee_build_tree <src_dir> <dest_dir>"
return 1
fi
wcoffee --bare --output $2 --compile $1
You can’t perform that action at this time.