Skip to content

Instantly share code, notes, and snippets.

View juno's full-sized avatar
💰
writing code (almost) every weekday

Junya Ogura juno

💰
writing code (almost) every weekday
View GitHub Profile
@voluntas
voluntas / trello.rst
Last active August 20, 2020 14:55
Trello のススメ
@PWSdelta
PWSdelta / rspec_model_testing_template.rb
Last active July 29, 2025 13:52
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# This skeleton also assumes you're using the following gems:
#
# rspec-rails: https://github.com/rspec/rspec-rails
@masakielastic
masakielastic / bacon.js_README.md
Last active May 2, 2018 05:07
bacon.js の README の翻訳 (原文は2013年7月1日時点のものを取得)。最新の内容は https://github.com/raimohanska/bacon.js を参照。ライセンスは原文と同じです。

Bacon.js

JavaScript のための小さな FRP (Functional Reactive Programming) ライブラリです。

手続き型から関数型に切り替えることで、イベントスパゲッティのコードがクリーンで宣言スタイルの「風水の bacon」(feng shui bacon)に変わります。入れ子のループを mapfilter のような関数型プログラミングのコンセプトに置き換えることに似ています。個別のイベントに取り組むことを止め、イベントストリームを扱います。mapfilter でデータを変換します。mergecombine でデータを combine します。重火器に切り替え、上司のように flatMapcombineTemplate を掌握します。

このライブラリはイベントのアンダースコア( _ )です。残念なことに ~ の記号は JavaScript では認められていないからです。

資料です。

@afeld
afeld / gist:5704079
Last active June 6, 2025 21:03
Using Rails+Bower on Heroku
@JEG2
JEG2 / struct.md
Created June 3, 2013 21:50
Thinking out loud about the merits and drawbacks of two different usages of Struct…

How Should We Use Struct?

The Choice

It's common in Ruby to see some code setup a Struct like this:

class Specialized < Struct.new(:whatever)
  # ... define custom methods here...
end

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@iguu
iguu / gist:5575105
Created May 14, 2013 10:47
Chrome Firefoxでfocus出来ないと思ったら setTimeoutが居るらしい、理屈がよくわからん。 クリックイベントの最中にfocus()を他に移すのがNGなんだろうか
//クリックイベントの中で
if(target.find("input").size()>=1){
setTimeout(function(){
//webkit,geckoにはfocus()にsetTimeoutが必要
target.find("input").focus();//入力欄にフォーカス
},0);
}
@turadg
turadg / subdomains.rb
Last active January 21, 2024 19:45 — forked from rtekie/subdomains.rb
Drop-in utility to test your app subdomains with Capybara, Rspec, and a Javascript driver (Poltergeist, Webkit, or Selenium)
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end
@froop
froop / index.html
Created April 12, 2013 07:21
Web ブラウザのポップアップブロック問題
<body>
<script>
function popupNonBlock() {
var win = window.open("", "child", "width=400, height=300");
win.document.body.innerHTML = "loading...";
location.href = 'opener.html';
}
</script>
<a href="opener.html">block</a>
@repeatedly
repeatedly / storm_book_errata.md
Last active December 15, 2015 14:29
"Stormをはじめよう"のerrata

Stormをはじめようのerrata

インデントのずれがかなり多くて,本当にずれてるのか自分のviewer(MacのKitabu)でずれてるのか正直あまり自信がない

2章

スパウト

this.collector.emit(new Values(str),str);