~/

Entries from 2013-01-01 to 1 year

Use local npm package for develpment

"dependencies": { "foo-bar": "*", }, "scripts": { "preinstall": "npm install /path/to/foo-bar", I'd like to Ruby's gem 'foo', path: '/path/to/foo-bar' in node. It works but not sure if there's any way.

@$el.find('#foo') is equivalent to @$('#foo')

If jQuery is included on the page, each view has a $ function that runs queries scoped within the view's element. http://backbonejs.org/#View-dollar @$ is shortcut and preferrable.

Resructuring

foo = 1 new Bar {foo} can be var foo; foo = 1; new Bar({ foo: foo }); res.render 'profile', { user photos csrfToken: req._csrf } can be res.render('profile', { user: user, photos: photos, csrfToken: req._csrf }); refs: http://aseemk.com/ta…

%i, %I

%w(foo bar baz).map(&:to_sym) can be written with %i from Ruby2.0 %i(foo bar baz) http://doc.ruby-lang.org/ja/2.0.0/doc/spec=2fliteral.html %i!STRING! : 要素がシンボルの配列(空白区切り) %I!STRING! : 要素がシンボルの配列(空白区切り)。式展開…

Destructuring assignments

These are Destructuring assignments. someObject = a: 'foo' b: 'bar' { a, b } = someObject console.log a # -> 'foo' console.log b # -> 'bar' class Foo constructor: (a) -> @a = a class Foo constructor: (@a) -> # is equivalant to above class …

Tips for Vagrantfile of nfs_settings

Good way to use nfs or not, this is from discourse's Vagrantfile nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => nfs_setting

We have lots of workshops in our company.

In our company (paperboy&co.), we have lots of workshops or semminars everyday. One of them is "Association to the interpretation in English with everyone". It's held during lunch time. First we pronounce, and translate the given part. The…

Proc and ===

even = ->(x) { (x % 2) == 0 } # we can use Proc#call even.call(2) even.call(3) # also available to use ===, instead of using Proc#call even === 2 even === 3 # we can use === in case statement as well. fizzbuzz = ->(x) { (x % 3) == 0 && (x …

Misunderstanding about the configuration of of znc

I love znc, A irc bouncer. Today, i introduce znc to younger colleague. Then i realized i was wrong to configure of znc. When we $ znc --makeconf, it generates .znc/configs/znc.conf. It's something like this. <User freenode> Pass = sha256#foobarfoobarfoo</user>…

Webistrano settings for lazy assets:precompile (if assets are not changed, don't invoke rake assets:precompile)

1, install capistrano-lazy-assets in webistrano environment. 2, add recipe at webistrano load 'deploy/assets' require 'capistrano-lazy-assets' 3, deploy_via by remote_cache deploy_via :remote_cache repository_cache cached-copy That's it. i…

Released fluent-plugin-filter_keys #fluentd

fluent-plugin-filter_keys has been released. https://github.com/banyan/fluent-plugin-filter_keys Some of the plugin assumes the key is always exists, so this plugin help to check if the given key is exists in the event log. <match test.**> type filter_ke</match>…

links of online education

Coursera https://www.coursera.org/ EDX https://www.edx.org/ udacity https://www.udacity.com/ khanacademy https://www.khanacademy.org/

proc

options = { transform: -> s {"<#{s}>"}, upcase: true } filters = [] if options[:upcase] filters << -> string { string.upcase } end if options[:transform] filters << options[:transform] # callback function end results = %w(foo bar) filters.…

rails3_acts_as_paranoid is no longer rails3_acts_as_paranoid, it becomes acts_as_paranoid again!

I'm using rails3_acts_as_paranoid with current project. gem 'rails3_acts_as_paranoid' I couldn't update to rails4.0.0.beta1 because of the problem of dependency, so I checked repo of rails3_acts_as_paranoid. then I found this PR, I asked r…

cheat sheet to send pull request quickly

$ git clone [url] $ git co -b feature $ hub fork $ pr # function for zsh function pr { git push -u $GITHUB_USER `git rev-parse --abbrev-ref HEAD` url=`hub pull-request` open $url } confirm if current repo is already forked. $ git remote ba…

bundle update で無限ループに入る時のメモ

dependency API が解決できずに無限ループに入ってしまうことがある https://github.com/carlhuda/bundler/issues/1450 $ DEBUG_RESOLVER=1 bundle update --verbose |& tee bundle.log こんな感じで実行して無限ループに入ることを確認できる。 で、Gemfile…

Extensions API: windows.create() "focused" option はうまく動かない

chrome extention こういうのあって不毛感ある https://code.google.com/p/chromium/issues/detail?id=88841

github+travis 便利

https://github.com/lostisland/faraday/commit/ac1b537f49bf110e87fe50679d80764367fb2d13 README.md に Travis のバッチ貼って誰が気にするの?視覚的にも汚いし、オフラインで README 読むときに意味ないよね? Being a developer, I prefer not to rely …

znc password 変更する

znc --makepass で generate して、config に上書き znc の server の後ろのパスワードも変更 (Server = hogehoge.co.jp +6668 foobar) irc client のパスワードも変更 znc 再起動