Skip to content

Instantly share code, notes, and snippets.

View YasuakiOmokawa's full-sized avatar
🐢
peaceful mind

Yasuaki Omokawa YasuakiOmokawa

🐢
peaceful mind
View GitHub Profile
@YasuakiOmokawa
YasuakiOmokawa / analytics_service.rb
Created May 28, 2014 08:04
Google Analytics API のデータをGarbで取得する場合 on Rails ref: http://qiita.com/omokawa_yasu/items/b418477e09639bddf670
require 'rubygems'
require 'garb'
require 'uri'
require 'active_support/time'
require 'yaml'
# 認証クラス
class AnalyticsService
def load_profile(user_data)
@YasuakiOmokawa
YasuakiOmokawa / config
Created May 19, 2014 00:31
Permission denied (publickey) が heroku で発生したとき ref: http://qiita.com/omokawa_yasu/items/3c4abeb820096deb927b
Host heroku.com
User git
port 22
Hostname heroku.com
IdentityFile ~/.ssh/heroku_rsa
TCPKeepAlive yes
IdentitiesOnly yes
@YasuakiOmokawa
YasuakiOmokawa / hello_analytics_api_v3.html
Created April 26, 2014 08:13
Google Analytics Query Explorer ライクにauth認証動作を行う ref: http://qiita.com/omokawa_yasu/items/939989d2b74918dcf0a2
<!DOCTYPE>
<html>
<head>
<title>Hello Google Analytics API</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<!-- 認証処理系ボタン -->
<button id="authorize-button" style="visibility: hidden">googleアカウント認証</button><br/>
<button id="logout-button" style="visibility: hidden" onclick="location.href='https://accounts.google.com/logout'">googleアカウント認証解除</button>
@YasuakiOmokawa
YasuakiOmokawa / hello_analytics_api_v3.html
Created April 19, 2014 08:41
[ I guess it ] まずはサンプルアプリケーションを試して機能を理解する ref: http://qiita.com/omokawa_yasu/items/4135b64b28079a098dd6
<!DOCTYPE>
<html>
<head>
<title>Hello Google Analytics API</title>
</head>
<body>
<!-- ユーザの実行ボタン -->
<button id="authorize-button" style="visibility: hidden">Authorize</button><br/>
<button id="make-api-call-button" style="visibility: hidden">Get Sessions</button>
@YasuakiOmokawa
YasuakiOmokawa / love_and_piece.pl
Created April 15, 2014 00:13
perl で時刻計算 - Time::Piece編 - 指摘されたのを修正したバージョン ref: http://qiita.com/omokawa_yasu/items/f6b7be63c29b7cc0af20
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
use Time::Seconds;
# Time::Pieceオブジェクトの取得
print "Time::Piece ",$Time::Piece::VERSION,"\n";
@YasuakiOmokawa
YasuakiOmokawa / Piece.pl
Created April 14, 2014 12:29
Perlで時刻計算を行う - Time::Piece 編 - ref: http://qiita.com/omokawa_yasu/items/7ef1b9782b619bde5699
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
use Time::Seconds;
# Time::Pieceオブジェクトの取得
my $t;
@YasuakiOmokawa
YasuakiOmokawa / Root.pm
Created April 7, 2014 06:27
Mojoliciousで、コントローラが受け取ったパラメータをJavaScriptへ渡す ref: http://qiita.com/omokawa_yasu/items/b0582c9fcb89185cce74
:
(中略)
:
$self->stash->{client_id} = $client_id;
$self->render('example/index');
@YasuakiOmokawa
YasuakiOmokawa / AtoA_solve.pl
Created March 25, 2014 17:29
配列のリファレンスの配列から値を取る ref: http://qiita.com/omokawa_yasu/items/fe7ab8481f625c8565a6
#!/usr/bin/env perl
use strict;
use warnings;
my $res = {
'rows_date' => [
['20121205', '1'],
['20121206', '2'],
],
@YasuakiOmokawa
YasuakiOmokawa / casper_download_ga.coffee
Created March 13, 2014 14:31
CasperJSでファイルダウンロード(途中まで) ref: http://qiita.com/omokawa_yasu/items/c9980d2be3a6c0a31bee
#!/usr/bin/env casperjs
# グーグルアナリティクスへログインし、日別PV数のTSVエクスポートデータを取得する
casper = require('casper').create
verbose: true
loglevel: 'debug'
pageSettings:
"webSecurityEnabled": false
"ignoreSslErrors": true
"userAgent": 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1'
@YasuakiOmokawa
YasuakiOmokawa / facebook_login.js
Created February 19, 2014 01:25
もう面倒くさいからPhantomJS単体でファイルをダウンロードする ref: http://qiita.com/omokawa_yasu/items/034d2c9c48927988ee46
// コマンドラインからparameter を受け取り、facebookにログインしてログイン後のホーム画面をキャプチャする
// 引数受け取り
var system = require("system");
var username = system.args[1];
var password = system.args[2];
// facebookログイン
var page = require("webpage").create();
page.open("https://ja-jp.facebook.com/",function(){