Skip to content

Instantly share code, notes, and snippets.

View tondol's full-sized avatar

tondol tondol

View GitHub Profile
@tondol
tondol / LazyIconView.java
Created April 12, 2012 17:21
LazyIconView
package jp.tondol.sample;
import java.net.HttpURLConnection;
import java.net.URL;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
@tondol
tondol / entry.rb
Created April 12, 2012 17:30
Markov Twitter Bot
# -*- coding: utf-8 -*-
require_relative 'twitterbot'
Twitter.configure {|config|
config.consumer_key = 'consumer key'
config.consumer_secret = 'consumer secret'
config.oauth_token = 'oauth token'
config.oauth_token_secret = 'oauth token secret'
}
@tondol
tondol / markdown.rb
Created August 13, 2012 15:50
karmdownでmarkdown2html
#!/usr/bin/env ruby
#-*- encoding: utf-8 -*-
$VERBOSE = nil
$KCODE = 'u'
usage = <<END_OF_USAGE
#{$0}
=========================
@tondol
tondol / RoundedFrameLayout.java
Created August 14, 2012 04:40
ICSのHWAccelerationで死なない角丸効果
public class RoundedFrameLayout extends FrameLayout {
private Path path;
private static final int HONEY_COMB = 11;
private static final int LAYER_TYPE_SOFTWARE = 1;
public RoundedFrameLayout(Context context) {
super(context);
useSoftwareLayer();
}
public RoundedFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@tondol
tondol / tumblr_hook.user.js
Last active December 14, 2015 03:49
dashboardのショートカットキーをカスタマイズする
// ==UserScript==
// @name tumblr_hook.user.js
// @namespace http://tondol.com
// @description dashboardのショートカットキーをカスタマイズする
// @include http://www.tumblr.com/dashboard
// @include http://www.tumblr.com/dashboard/*
// @version 0.1
// ==/UserScript==
// 参考:
@tondol
tondol / distance.txt
Last active December 17, 2015 04:58
点と平面の距離
平面 := ax + by + cz + d = 0
点P := (x0, y0, z0)
点Q := (x1, y1, z1) = 点Pから平面に下ろした垂線が平面と交差する点
平面の法線ベクトル := (a, b, c)
l := 点Pと平面の距離
ベクトルPQは法線ベクトルと平行だから: (x1, y1, z1) - (x0, y0, z0) = t・(a, b, c) …… [1]
点Qは平面上の点だから: ax1 + by1 + cz1 + d = (a, b, c)・(x1, y1, z1) + d = 0 …… [2]
[1]より
@tondol
tondol / NSCollection+TypeSafe.h
Last active December 20, 2015 04:39
動的型検査付きNSArray/NSDictionary
//
// NSCollection+TypeSafe.h
//
#import <Foundation/Foundation.h>
#define TYPESAFE_ARRAY(classname) \
@interface NSArray (TypeSafe ## classname) \
- (classname *)get ## classname:(int)index; \
- (classname *)get ## classname:(int)index none:(classname *)none; \
@tondol
tondol / nicovideo_rtmpe.md
Last active June 9, 2018 02:50
ニコニコ公式アニメポータルのrtmpeプロトコル動画をダウンロードする覚え書き

はじめに

http://www.nicovideo.jp/watch/1380872606

上記の動画を例にDL方法を解説する。

パラメータの取得

@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
# -*- 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 = ''