Skip to content

Instantly share code, notes, and snippets.

View rakuishi's full-sized avatar
🏠
Working from home

OCHIISHI Koichiro rakuishi

🏠
Working from home
View GitHub Profile
# -*- coding: utf-8 -*-
require 'fileutils'
Dir.glob('content/archives/*.md').each do |filename|
content = File.open(filename).read;
content = content.gsub('<pre class="prettyprint">', '<pre><code>')
content = content.gsub('</pre>', '</code></pre>')
File.binwrite(filename, content)
@rakuishi
rakuishi / deploy.sh
Created February 11, 2015 02:06
gh-pages
#!/bin/sh
git subtree push --prefix demo/ origin gh-pages
tell application "Google Chrome" to set the bounds of the front window to {0, 0, 728, 546}
@rakuishi
rakuishi / input.txt
Last active August 29, 2015 14:16
経路数
S---+---+
| | |
| x |
| | |
+---+---+
| | |
| | |
| | |
+---+---G
import android.content.Context;
import android.graphics.PorterDuff;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageButton;
public class TouchImageButton extends ImageButton {
public TouchImageButton(Context context) {
super(context);
package com.rakuishi.share;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@rakuishi
rakuishi / CircleTransform.java
Created October 2, 2015 00:56 — forked from julianshen/CircleTransform.java
CircleTransform for Picasso
/*
* Copyright 2014 Julian Shen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@rakuishi
rakuishi / MainActivity.java
Created October 22, 2015 00:10
Activity and Fragment handle same menu item.
public class MainActivity extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@rakuishi
rakuishi / DayOne-Roboto.css
Created January 31, 2016 14:57
Markdown 記法でいい感じに表示されるように CSS 調整
* {
font-family: 'Migu 1M', Hiragino Sans, 'ヒラギノ角ゴシック', Hiragino Kaku Gothic ProN, 'ヒラギノ角ゴ ProN W3', Meiryo, sans-serif;
line-height: 1.25;
}
h1, h2, h3, h4, h5 {
margin-top: 32px;
}
p {
@rakuishi
rakuishi / gist:5010ee819260cdd32a15
Last active February 4, 2016 00:51
Google Analytics: Custom dimension をフィルターに含める
$result = $this->service->data_ga->get(
'ga:' . $viewId,
@date('Y-m-d', strtotime('-3 day')), // 開始日
@date('Y-m-d', strtotime('-2 day')), // 終了日
'ga:screenviews',
array(
'dimensions' => 'ga:screenName,ga:dimension1',
'sort' => '-ga:screenviews',
'max-results' => '10', // 件数
'filters' => 'ga:dimension1=@user', // `user` を含むカスタムディメンション 1 の値を検索