NodeでRailsのSprocketsを捨てる
npmは入っている前提。
- [] assets以下のファイルをpublicにコピーする
- [] coffeeをjsにする
- [] jsを繋げて1つのファイルにする
- [] assets以下のファイルにハッシュ値をつける
| % backup generate:model |
| class Bond<T> { | |
| typealias Listener = T -> Void | |
| var listener: Listener | |
| init(_ listener: Listener) { | |
| self.listener = listener | |
| } | |
| func bind(dynamic: Dynamic<T>) { | |
| dynamic.bondBoxes.append(BondBox(self)) |
| var AddingFeaturingButton = React.createClass({ | |
| propTypes: { | |
| addToFeatured: React.PropTypes.func.isRequired | |
| }, | |
| _addToFeatured: function() { | |
| this.props.addToFeatured(this.props.position); | |
| }, | |
| render: function() { | |
| return( | |
| <button className={this.props.isFeatured ? 'flat-button-success': 'flat-button'} onClick={this._addToFeatured}> |
| <%= f.text_area :body, rows:20, id:'js-storyForm__body', 'v-model' => 'body', 'v-on' => 'click: updatePreview, keydown: updatePreview, keyup: updatePreview, keypress: updatePreview' %> | |
| # Update record attributes when :current_password matches, otherwise returns | |
| # error on :current_password. It also automatically rejects :password and | |
| # :password_confirmation if they are blank. | |
| def update_with_password(params, *options) | |
| current_password = params.delete(:current_password) | |
| if params[:password].blank? | |
| params.delete(:password) | |
| params.delete(:password_confirmation) if params[:password_confirmation].blank? | |
| end |
| require 'rubygems' | |
| require 'capybara' | |
| require 'capybara/dsl' | |
| require 'capybara-webkit' | |
| class Driver | |
| Capybara.default_driver = :webkit | |
| include Capybara::DSL | |
| end | |
| d = Driver.new |
| #!/usr/bin/env python2.6 | |
| # encoding: utf-8 | |
| import sys | |
| import sqlite3 | |
| from collections import namedtuple | |
| conn = sqlite3.connect("wnjpn-0.9.db") | |
| Word = namedtuple('Word', 'wordid lang lemma pron pos') | |
| if __name__ == '__main__': | |
| left_double_quotation = '“' | |
| right_double_quotation = '”' | |
| single_quotation = '’' | |
| result = str() | |
| with open('word_to_tex.txt', 'r') as f: | |
| for row in f: | |
| row = row.replace(left_double_quotation, '``') | |
| row = row.replace(right_double_quotation, "''") |
| #coding:utf-8 | |
| # http://gihyo.jp/dev/serial/01/machine-learning/0003 のベイジアンフィルタ実装をPython3.3向けにリーダブルに改良 | |
| import math | |
| import sys | |
| import MeCab | |
| class NaiveBayes(): | |
| def __init__(self): | |
| self.vocabularies = set() |