Skip to content

Instantly share code, notes, and snippets.

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

Miu Kobayashi miukoba

🏠
Working from home
View GitHub Profile
@miukoba
miukoba / gist:1601128
Created January 12, 2012 15:30
rvm使用時のrubyインストール先確認
miua$ rvm use 1.8.7-p357
Using /Users/miua/.rvm/gems/ruby-1.8.7-p357
miua$ rvm info | grep MY_RUBY_HOME
MY_RUBY_HOME: "/Users/miua/.rvm/rubies/ruby-1.8.7-p357"
miua$ export | grep MY_RUBY_HOME
declare -x MY_RUBY_HOME="/Users/miua/.rvm/rubies/ruby-1.8.7-p357"
miua$ rvm use 1.9.3-p0
@miukoba
miukoba / gist:1607010
Created January 13, 2012 15:37
はてなブログで編集フォームとプレビューを並べて表示するブックマークレット(2012-01-13時点,はてな記法モードのみ,Mac・Chromeのみ動作確認済)
javascript : (function ()
{
var d = document;
var t = d.getElementById('textarea').style;
var p = d.getElementById('preview').style;
document.getElementsByClassName('tab-preview')[0].childNodes[0].onclick = function ()
{
document.getElementsByClassName('ui-tabs-selected')[0].className = 'tab-edit ui-state-default ui-corner-top';
};
t.width = "39%", t.float = "left", t.display = "block", p.width = "60%", p.float = "right", p.display = "block";
@miukoba
miukoba / gist:2526160
Created April 29, 2012 02:49
Markdown template (cheat sheet)

Headers - 見出し

This is an H1

This is an H1

This is an H2

This is an H2

This is an H3

@miukoba
miukoba / ur_scraper.coffee
Created September 16, 2012 07:41 — forked from hosokawa0825/ur_scraper.coffee
URスクレイピングコード
casper = require('casper').create
verbose: true
logLevel: "debug"
clientScripts: ["../lib/jquery-1.7.1.min.js"]
pageSettings: [loadImages:false]
onError: ->
@echo arguments
#for i in [1..6]
@miukoba
miukoba / bookmarklet
Created October 10, 2012 09:40
全inputに文字列を入力するテスト用のブックマークレット
javascript:(function(){var str=prompt('テスト文字列を入力して下さい。',"<script>alert('XSS');</script>");if(str!=""&&str!=null){var text=document.getElementsByTagName("input");for(var i=0,l=text.length;i<l;i++){if(text[i].type=='text'){text[i].value=str}}var textarea=document.getElementsByTagName("textarea");for(var i=0,l=textarea.length;i<l;i++){textarea[i].value=str}}}())
@miukoba
miukoba / gist:4043586
Created November 9, 2012 03:51
inject jQuery
javascript:(function(){javascript:(function(){var src_url = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';var notice_style ='position:fixed;'+'z-index:10000;'+'top:0;'+'left:0;'+'background-color:red;'+'color:white;'+'padding:10px;'+'margin:10px;'+'font:bold 16px sun-serif;';var s=document.createElement('script');s.setAttribute('src',src_url);document.getElementsByTagName('body')[0].appendChild(s);var id = window.setInterval(function(){if (window['jQuery'] &&window['jQuery']['fn'] &&window['jQuery']['fn']['offset']){window.clearInterval(id);$('<div style=\''+notice_style+'\'><p>jQuery '+ jQuery.fn.jquery+' Loaded!<p></div>').appendTo('body').animate({opacity:1},2000).animate({opacity:'hide'},500,function(){jQuery(this).remove();});}},100);})();})();
@miukoba
miukoba / gist:7922295
Created December 12, 2013 02:23
Live Template for PhpStorm

登録の流れ

  • Abbereviation, Description, Template text を入力
  • Edit variables をクリックして、順番を変更
  • Reformat according to style にチェック
  • Defineをクリックして、PHPを選択

PHP

@miukoba
miukoba / performance.php
Created December 12, 2013 02:35
PHPのパフォーマンス簡易測定
<?php
$startTime = microtime(true);
// 処理
//for ($i = 0; $i < 10000; ++$i)
//{
//}
echo PHP_EOL . PHP_EOL;
echo '>>> result >>>>>>>>>>>>>>>>>>>>>>>>>>>' . PHP_EOL;
echo "process time: " . (microtime(true) - $startTime) . ' ms' . PHP_EOL;
@miukoba
miukoba / xhprof_setting.php
Created December 12, 2013 08:37
xhprof の設定
<?php
// フロントコントローラとかに仕込む
xhprof_enable();
// 処理
$xhprof_data = xhprof_disable();

マージ済みのリモートブランチを全て削除

git branch -r --merged master | grep -v -e master -e develop | sed -e 's% *origin/%%' | xargs -I% git push --delete origin %
  1. remote の master に merge済み の branch をすべて表示して
  2. master と develop は消えてほしくないので除外して
  3. origin/ を削除して
  4. xargs (-I% % で ブランチ名を渡しつつ、全て削除する)