This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
RSpec.configure { |c| c.filter_run_excluding mass_assignment: true } | |
module MassAssignment | |
class List < ActiveRecord::Base | |
self.table_name = :mass_assignment_lists | |
has_many :items, class_name: 'MassAssignment::Item' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailValidator < ActiveModel::EachValidator | |
# Email address regex is copied from http://emailregex.com on "Ruby (simpler version)" | |
def validate_each(record, attr_name, value) | |
if ! ( value.blank? && options[:allow_blank] ) | |
record.errors.add(attr_name, :invalid_email, options) unless value =~ /\A([\w+\-][\w+\-.]*[\w+\-]|[\w+\-.])@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config valid only for current version of Capistrano | |
lock '3.4.0' | |
set :application, 'application' | |
set :repo_url, 'repository' | |
# Default branch is :master | |
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp | |
# Default deploy_to directory is /var/www/my_app_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install | |
### CentOS 7.x | |
#### Install basic packages | |
``` | |
yum update -y | |
rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm | |
yum install -y nginx openssl openssl-devel mariadb-server mariadb-devel groonga groonga-tokenizer-mecab nodejs npm mongodb mongodb-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HEAD https://api.rubygems.org/api/v1/dependencies | |
200 OK | |
GET https://api.rubygems.org/api/v1/dependencies?gems=rroonga | |
200 OK | |
GET https://api.rubygems.org/api/v1/dependencies?gems=archive-zip,groonga-client,json,pkg-config | |
200 OK | |
GET https://api.rubygems.org/api/v1/dependencies?gems=gqtp,groonga-command,io-like | |
200 OK | |
Downloading gem io-like-0.3.0.gem | |
GET https://api.rubygems.org/gems/io-like-0.3.0.gem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
import pluralize from 'pluralize' | |
import ApiRequest from 'lib/ApiRequest' | |
import { SubmissionError } from 'redux-form' | |
const ADD_API_RESOURCE = '@api/ADD_RESOURCE' | |
const REMOVE_API_RESOURCE = '@api/REMOVE_RESOURCE' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support' | |
module A | |
extend ::ActiveSupport::Concern | |
class_methods do | |
def sample=value | |
@sample = value | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
「車輪の再発明」という言葉があります。 | |
これは「すでによく知られている物事の解決手段である車輪のことを知らないために、車輪を自らのエネルギーで再発明してしまう」ことの無駄を揶揄した言葉です。 | |
ぼくたちは無知故に、すでに解決された問題に再挑戦することがあり、そしてそれは多くの場合、徒労に終わります。なぜなら、この世界にはすでに、車輪の設計図があるからです。 | |
設計図のとおりに車輪を作れば、誰もが、重い荷物を運ぶ時の摩擦係数から解放されます。 | |
車輪とは何でしょうか? | |
ぼくたちはパッケージされた無数のライブラリを、gemやyarnやpipやyumやcocoa-podsで管理し、ダウンロードし、インストールし、メモリ上にロードし、実行しています。 | |
これらのライブラリたちは、ぼくたちを多くの苦難から救ってくれる便利な武器であると同時に、「なにかを実装しなくても良い」という甘い誘惑でもあります。 | |
すでに実装を終えたライブラリは、ぼくたちがそれをインストールしさえすれば、何らかの手段でぼくたちの課題を解決してくれます。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://nlftp.mlit.go.jp/isj/agreement.html | |
const csv2json = require('csv2json'); | |
const iconv = require("iconv-lite") | |
const fs = require('fs') | |
const path = require('path') | |
const items = fs.readdirSync(__dirname) | |
const promises = items.map(async (name) => { | |
const filepath = path.join(__dirname, name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HexCell { | |
let coordinate: HexCoordinate | |
private(set) var field: Field = .none | |
private var isFreezed: Bool = false | |
init(coordinate: HexCoordinate) { | |
self.coordinate = coordinate | |
} | |
OlderNewer