$ npm install --save-dev babel-cli babel-preset-es2015 babel-preset-stage-3
$ ./node_modules/.bin/babel-node --presets es2015,stage-3 application.js
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
| # | |
| # A simple theme. | |
| # | |
| # Authors: | |
| # kami <kami30k@gmail.com> | |
| # | |
| # Load dependencies. | |
| pmodload 'helper' |
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
| " | |
| " dein.vim | |
| " | |
| let s:dein_dir = expand('~/.vim/dein') | |
| let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim' | |
| if &compatible | |
| set nocompatible | |
| endif |
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 Post < ActiveRecord::Base | |
| scope :disable_paging, -> { except(:limit, :offset, :order) } | |
| 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
| def f(foo:, bar:) | |
| a = {} | |
| self.class.instance_method(:f).parameters.map do |_, key| | |
| a[key] = eval(key.to_s) | |
| end | |
| a | |
| end | |
| p f(foo: 1, bar: 2) #=> {:foo=>1, :bar=>2} |
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
| #!/bin/bash | |
| base_dir=`pwd` | |
| wget https://mecab.googlecode.com/files/mecab-0.996.tar.gz | |
| tar zxfv mecab-0.996.tar.gz | |
| cd mecab-0.996 | |
| ./configure --enable-utf8-only | |
| make | |
| make check |
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
| a = { a: 1, b: 2, c: 3 } | |
| a.each_with_index do |(k, v), i| | |
| puts "#{k}, #{v}, #{i}" | |
| end | |
| #=> a, 1, 0 | |
| # b, 2, 1 | |
| # c, 3, 2 |
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
| add = fn a, b -> a + b end | |
| add.(1, 2) |
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
| sed -i '' 's/PRAGMA foreign_keys=OFF;/-- PRAGMA foreign_keys=OFF;/' dump.sql | |
| sed -i '' 's/INTEGER PRIMARY KEY AUTOINCREMENT/SERIAL PRIMARY KEY/' dump.sql | |
| sed -i '' 's/datetime/timestamp/g' dump.sql | |
| sed -i '' 's/DELETE FROM sqlite_sequence/-- DELETE FROM sqlite_sequence/' dump.sql | |
| sed -i '' 's/INSERT INTO "sqlite_sequence"/-- INSERT INTO "sqlite_sequence"/' dump.sql | |
| -- INSERT INTO "sqlite_sequence" VALUES('users',101); | |
| select setval('users_id_seq',101); |
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
| namespace :db do | |
| desc 'Import SQL' | |
| task import: :environment do | |
| sql = File.read('db/import.sql') | |
| statements = sql.split(/;$/) | |
| statements.pop | |
| connection = ActiveRecord::Base.connection |