2015-07-01から1ヶ月間の記事一覧

サイトのfaviconを変更する

<body onload="changeFavicon();"> <script> function changeFavicon(){ $('link[rel="shortcut icon"]').attr("href","http://2.bp.blogspot.com/_Q6gn7ObdMNM/TFZjwdIAICI/AAAAAAAAAEA/0FCC-oqq_3Q/s320/heart.gif"); $('link[rel="apple-touch-icon"]').attr("href","http://2.bp.blogspot.com/_Q6</body>…

matlabでグラフを動画に保存

http://qiita.com/HA_qiita/items/6aa56912943888925efe メモ x = 0:100; y = sin(x); writerObj = VideoWriter('test.avi'); open(writerObj); fig = plot(x,y); set(fig, 'XDataSource', 'x'); set(fig, 'YDataSource', 'y'); set(gca, 'Xlim', [0 100], '…

サイトのDOMを削除する

<body onload="removeAds();" class=""> 最下端 <script> function removeAds(){ $("#WIX_ADSdesktopWADTop").empty(); $("#ibt8uwjh").empty(); $("#ibszoyvs").empty(); $("#ibtg0p5r").empty(); $("#WIX_ADSdesktopWADBottom").empty(); $("#SITE_FOOTER").empty(); } </script></body>

チューブフィッタの外し方

入れたらとれなくなった。なんだこのプラグ。 カプラ 外し方 でググってもヒットしない monotaroで「マイクロカプラ チューブフィッタ付き」って書いてあるのが形状が近い 「チューブフィッタ 外し方」でググってもでてこないGoogleでTube fitterでイメージ…

Arduino IDEからArduino ISP mkII経由でスケッチをアップロードする

Programmer>Arduino ISP mkII を選択シフトを押しながらアップロードする

Altiumのターミナルブロックのライブラリ

秋月で売ってるターミナルブロックのAltium Libraryが欲しい 寸法 ここに色々とライブラリが転がってる http://www.we-online.com/web/en/electronic_components/toolbox_pbs/Altium_Designer.php Terminal blocksを選択する http://www.we-online.com/web/e…

rubyのsampleで重みをつける

https://bugs.ruby-lang.org/issues/4147 Ruby自体ではサポートされてないらしい Gemを使う https://github.com/ryanlecompte/weighted_randomizer

rubyで配列の要素数をカウントする / injectを使う

arr = (1..1000).to_a.map{(1..10).to_a.sample}.sort; # (1..10).to_a.sample(1000)ではできない。(Array#sampleでは復元抽出はできない?) p arr; >[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …

railsのconfig/secrets.ymlを編集する

http://qiita.com/yukiko-kato-bass/items/6dfd8cd9d666a8ee3a77 RAILS_ENV=production rake secret

pryで返り値を表示しない

特に配列を操作するときにダンプを抑制したいことがある http://qiita.com/ainoya/items/0aea440faa5d78630c9a 行末に;(セミコロン)を置く

heroku runを環境ごとに実行する

http://humanwebdevelopment.com/rails-production-and-staging-environments-for-heroku/ $ heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote staging $ git push production master $ heroku run rake db:migrate --remote production

origin以外のherokuの環境(staging, production, ... etc.)をつくる

http://slowquery.hatenablog.com/entry/2014/04/06/114059 heroku create newapp --remote productiongit push production master

環境にあわせてrake db:seedを実行する

http://stackoverflow.com/questions/16808471/ruby-on-rails-way-to-create-different-seeds-file-for-environments db/seeds/development.rb db/seeds/test.rb db/seeds/production.rbload(Rails.root.join( 'db', 'seeds', "#{Rails.env.downcase}.rb")) …

masterブランチ以外をherokuにプッシュする

git push heroku devすると、Pushed to non-master branch, skipping build. といわれてビルドされない。 http://stackoverflow.com/questions/14593538/make-heroku-run-non-master-git-branch https://devcenter.heroku.com/articles/multiple-environment…

Windows 8でゴミ箱をタスクバーに出す

http://www.sevenforums.com/tutorials/6687-recycle-bin-pin-taskbar.html

agで検索してpecoで絞り込んでvimで開く

また一つpecoの神コマンドを見つけた http://qiita.com/fmy/items/b92254d14049996f6ec3 function agvim () { vim $(ag $@ | peco --query "$LBUFFER" | awk -F : '{print "-c " $2 " " $1}') }

Nano kontrol2使ったアイディア

Web MIDI APIつかってGrasshopper動かす WebGLと組合せて逆さ6軸のシミュレータ作りたい

GLSLの作例

おもしろい http://glslsandbox.com/

WebGLのオンラインエディタ

よいまとめ http://www.chimana.co/blog/webgl-online-editor/クールな作例が見れてforkできる http://threejsplaygnd.brangerbriz.net/archive/噴流のシミュレーションとかできそう http://jeromeetienne.github.io/sparkseditor/

Railsでソート可能なテーブルをつくる

Railscastsの説明がわかりやすそう http://railscasts.com/episodes/228-sortable-table-columnsコード(Rails4向けにstrong parameterなどを直した) https://github.com/shohei/table-sort

RailsでDBに連携しないモデルをつくる

http://qiita.com/metheglin/items/1cb602ae8bd18c0ef0f0 http://nextat.co.jp/staff/archives/56 複数のモデルを合成した独自のモデルを作りたくなったので ※ソート可能なテーブルのために、複数のモデルをまとめたモデルがあると便利かなと思ったけど、必…

Rubyのlambdaの記法 ->

http://docs.ruby-lang.org/ja/1.8.7/method/Kernel/m/lambda.html http://docs.ruby-lang.org/ja/2.1.0/doc/symref.html lambdaはProcオブジェクトを返す >()|| はlambdaの別記法 lambda {|a,b| p [a,b]} .call(2,3) #-> [2,3] ->(a,b){p [a,b]}.call(2,3) …