Skip to content

Instantly share code, notes, and snippets.

View romot-co's full-sized avatar

Romot romot-co

View GitHub Profile
@romot-co
romot-co / file0.txt
Created June 30, 2016 10:50
Mithril.jsとC3.js(d3.jsベースのチャートライブラリ)を組み合わせて使う ref: http://qiita.com/futosu/items/fbaca172e9d40520f84d
// 線チャートコンポーネント
var SequenceChart = {
controller: function() {
var ctrl;
ctrl = this;
ctrl.renderChart = function(data, element, isInit, context) {
// 初期化されていないなら、チャートを初期化
if(!isInit) {
ctrl.initChart(element, data);
@romot-co
romot-co / file0.txt
Created April 25, 2016 12:57
Elixir+Phoenixでorder_byで昇順・降順で更新日順に並び替える ref: http://qiita.com/futosu/items/80572608d122d0cae38a
schema "posts" do
field :title, :string
field :body, :string
timestamps
end
@romot-co
romot-co / file0.txt
Created April 23, 2016 11:40
Elixir+PhoenixFrameworkでSASSを使う ref: http://qiita.com/futosu/items/9899edbf6e013d7be407
npm i -S sass-brunch
@romot-co
romot-co / file0.txt
Last active April 23, 2016 08:50
Elixir+Phoenix FrameworkをMacにインストールし、Hello WorldページとDB作成&マイグレーションまで ref: http://qiita.com/futosu/items/22901eb5954f782e16e6
brew update
@romot-co
romot-co / file0.txt
Last active December 5, 2015 08:47
JavaScriptでCSSアニメーションの@Keyframesを使う ref: http://qiita.com/futosu/items/74812f6a4ab4eae5ed2a
(function() {
var css, rules, fadein, fadeout;
// styleタグを作成
css = document.createElement('style');
css.media = 'screen';
css.type = 'text/css';
@romot-co
romot-co / file0.txt
Last active August 29, 2015 14:20
Mithril.jsでタップイベント(fastclick)を使う(Paw.js使用) ref: http://qiita.com/futosu/items/f1da812e7b62565513ec
new Paw(document.body)
tapRoute = (element, isInitialized, context) ->
routeHook = (e) ->
`var e`
e = e or event
# デフォルトのイベントを抑制
if e.preventDefault
@romot-co
romot-co / file0.txt
Created April 17, 2015 16:08
CSSのみでモーダルな要素をフェードアウトアニメーション ref: http://qiita.com/futosu/items/2d2585369305844be32e
.modal {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10000;
}
.modal-off {
@romot-co
romot-co / file1.js
Last active August 29, 2015 14:14
Ractive.jsで画像ギャラリーを作る(ドラッグ&ドロップでの並び替えとファイル読み込みを行う…プラグインをつくる) ref: http://qiita.com/futosu/items/c1bdb259d0d96f9a9f05
var ImageGallery = Ractive.extend({
isolated: false,
template: '#imagegallery',
onrender: function() {
this.on({
AddImage: function( event ) {
var input = this.find('.imagegallery_add_input');
var filereaders = [];
@romot-co
romot-co / file0.txt
Last active August 29, 2015 14:13
Golangでメソッドチェーン ref: http://qiita.com/futosu/items/b4f7f20c0af64065b944
package main
import (
"fmt"
)
type Term struct {
}
func (e *Term)ex1() *Term {
@romot-co
romot-co / file0.txt
Last active August 29, 2015 14:13
GolangでXMLHttpRequestLevel2+CORSのプリフライトが通るサーバーを立てる(BasicAuth付き) ref: http://qiita.com/futosu/items/b49f7d9e28101daaa99e
import (
"net/http"
)
func routeHandler(w http.ResponseWriter, r *http.Request) {
実際にはここで各ヘッダのチェックが必要です
//リモートアドレスからのアクセスを許可する
w.Header().Set( "Access-Control-Allow-Origin", r.RemoteAddr )