Skip to content

Instantly share code, notes, and snippets.

View tondol's full-sized avatar

tondol tondol

View GitHub Profile
@tondol
tondol / vuejs-propchange.html
Last active August 29, 2015 14:10
Vue.js: viewから配列の要素を参照する
<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/0.11.0/vue.min.js"></script>
<div id="container">
<div>
0:{{array[0].name}}, {{array[0].prop}}
</div>
<div v-repeat="array" v-show="$index > 0">
{{$index}}:{{name}}, {{prop}}
</div>
</div>
<script>
<div id="renderer">
<svg id="svg"></svg>
<canvas id="canvas"></canvas>
</div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/StackBlur.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/canvg.js"></script>
@tondol
tondol / mactex2013-emb-fonts.md
Last active August 29, 2015 14:03
MacTex2013環境でPDFに日本語フォントを埋め込む

PDFに日本語フォントを埋め込む

pdffontsの導入

brew install xpdf
@tondol
tondol / array_at.php
Last active August 29, 2015 14:02
PHPのNoticeを消すのに便利な奴
// 第1引数に配列もしくはオブジェクトを,
// 第2引数以降に配列のキー名もしくはプロパティ名を与える
// 指定した要素やプロパティが存在しなければNULLが返却される
function array_at()
{
$numargs = func_num_args();
$args = func_get_args();
$arr = array_shift($args);
foreach ($args as $index) {
if (is_array($arr)) {
@tondol
tondol / linkify.js
Last active August 29, 2015 14:02
Twitter APIが返すJSONのlinkify処理
function h(s) {
var map = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'\'' :'&#39;',
'"' :'&quot;'
};
function f(s) { return map[s]; }
return s.replace(/<|>|&|'|"/g, f);
@tondol
tondol / brewfile
Created April 16, 2014 02:10
brewfile
tap phinze/homebrew-cask || true
tap homebrew/versions|| true
update || true
install brew-cask || true
install git || true
install openssl || true
install wget || true
install jq || true
install python3 || true
@tondol
tondol / macaron.md
Last active August 29, 2015 13:57
スクフェスのマカロン計算

マカロン計算

前提

イベント曲HARD1回で加算されるptが約230
ミス分を考慮して加算ptを225とする
また,プレイ1回に必要なマカロンが45

変数

# 5578864439
# ENV: Ruby
# POINT: 順列をすべて数え上げようと思うと計算量が大きくなりすぎるので,メモ化により枝刈りする
### この問題で出現する宝石列は,
### 与えられた宝石の順列を(辞書順で昇順となるような順序で)すべて求め,
### 各順列に対して先頭から1個,先頭から2個,先頭から3個……を取り出して,
### 重複するものを取り除きながら並べていくことで得ることができます。
###
### 例題(minis.txt)の場合は,出現する宝石の個数が少ないことから,
# -*- coding: utf-8 -*-
require 'net/http'
require 'twitter'
client = Twitter::REST::Client.new {|config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
@tondol
tondol / idol_sort.rb
Last active December 31, 2015 08:39
スタドリ効率でモバマスのアイドルをソートする
# -*- coding: utf-8 -*-
require 'open-uri'
require 'nokogiri'
# 下記サイトから相場データを取得する
# http://imascg.info/
url = "http://imascg.info/idol/?targetDate=ALL"
accept_language = "ja,en;q=0.8"
html = open(url, "accept-language" => accept_language).read