Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Epictetus / Plea.markdown
Created June 28, 2012 19:42 — forked from justinko/Plea.markdown
Am I doing it wrong?

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

@Epictetus
Epictetus / gist:2984136
Created June 24, 2012 17:44 — forked from surkin/gist:60406
rails 2.3 template on heroku
# Based on:
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
#
# Template for www.heroku.com with Rails 2.3 support
# Freeze gems of rails 2.3
rake('rails:freeze:gems')
# Delete unnecessary files
@Epictetus
Epictetus / Plea.markdown
Created June 23, 2012 20:49 — forked from justinko/Plea.markdown
Am I doing it wrong?

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

@Epictetus
Epictetus / selectable_queue.rb
Created June 21, 2012 15:37 — forked from garybernhardt/selectable_queue.rb
A queue that you can pass to IO.select. This is for use in a GUI application. I'm not turning into a Node programmer.
# A queue that you can pass to IO.select.
#
# NOT THREAD SAFE: Only one thread should write; only one thread should read.
#
# Purpose:
# Allow easy integration of data-producing threads into event loops. The
# queue will be readable from select's perspective as long as there are
# objects in the queue.
#
# Implementation:
@Epictetus
Epictetus / README.md
Created June 17, 2012 17:33 — forked from yuya-takeyama/README.md
Face.com に AKB48 のメンバー一覧認識させた結果
@Epictetus
Epictetus / JettyLauncher.scala
Created June 17, 2012 03:40 — forked from lstoll/JettyLauncher.scala
Scalatra on Heroku
/*
* Starts jetty for scalatra programatically
*
* Replace YourApplicationEndpointFilter with the filter in your application
*/
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler}
object JettyLauncher {
def main(args: Array[String]) {
ja:
errors:
messages:
not_found: "は見つかりませんでした"
# not_found: "not found"
already_confirmed: "は既に登録済みです"
# already_confirmed: "was already confirmed"
not_locked: "は凍結されていません"
# not_locked: "was not locked"
not_saved:
@Epictetus
Epictetus / objective_c_bookmarklet.js
Created June 14, 2012 02:48 — forked from baado/objective_c_bookmarklet.js
@IT総合トップ > @IT CORE > Smart & Social > Objective-C初心者のためのiOS SDKコード例一覧だけのためのブックマークレット
javascript:(function(){var a=window.document.getElementById('centercol');a.style.width='auto';var b=a.getElementsByClassName('articleBox')[0];var c=b.getElementsByTagName('div');var d=c.length;for(i=0;i<d;i++){if(c[i].style.width=='480px')c[i].style.width='auto';}})();
//↓この記事を多少見やすくするためだけのブックマークレットです
//http://www.atmarkit.co.jp/fsmart/articles/iossdk_ref/01.html
//worked on
// Safari
// IE9(「javascript:」が勝手にちょん切られるので補完すべし)
// Opera
// Chrome(「javascript:」が勝手にちょん切られるので補完すべし)
//not worked on
// Firefox (何かセキュリティ設定がある?)
@Epictetus
Epictetus / config.ru
Created June 12, 2012 07:47 — forked from jugyo/config.ru
easy way to share files on heroku with basic auth
use Rack::Auth::Basic do |username, password|
username == 'username' && password == 'password'
end
run Rack::Directory.new "./foo"
@Epictetus
Epictetus / gist:2870255
Created June 4, 2012 19:15 — forked from kengos/gist:2464207
ActiveEnum i18n support patch
# In your config/initializers/active_enum.rb
# @see https://github.com/adzap/active_enum/pull/4
# @example
# * ja.yml
# active_enum:
# user:
# sex:
# male: '男性'
# female: '女性'
# * user.rb