http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| var nock = require('nock'); | |
| var low = require('lowdb'); | |
| // lowdb is a great straight-to-json minidb. | |
| var db = low('integration_test_nock_records.json'); | |
| writeToFileLog = function(object) { | |
| console.log("writing nock to json...."); | |
| db('records').push(object); | |
| } |
| import axios from 'axios'; | |
| // You can use any cookie library or whatever | |
| // library to access your client storage. | |
| import cookie from 'cookie-machine'; | |
| axios.interceptors.request.use(function(config) { | |
| const token = cookie.get(__TOKEN_KEY__); | |
| if ( token != null ) { | |
| config.headers.Authorization = `Bearer ${token}`; |
| let isRefreshing = false; | |
| let refreshSubscribers = []; | |
| const instance = axios.create({ | |
| baseURL: Config.API_URL, | |
| }); | |
| instance.interceptors.response.use(response => { | |
| return response; | |
| }, error => { |
| # Puma can serve each request in a thread from an internal thread pool. | |
| # The `threads` method setting takes two numbers: a minimum and maximum. | |
| # Any libraries that use thread pools should be configured to match | |
| # the maximum value specified for Puma. Default is set to 5 threads for minimum | |
| # and maximum; this matches the default thread size of Active Record. | |
| # More: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#threads | |
| # | |
| threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } | |
| threads threads_count, threads_count |
| # mysql db backup and restore for rails | |
| # by David Lowenfels <[email protected]> 4/2011 | |
| require 'yaml' | |
| namespace :db do | |
| def backup_prep | |
| @directory = File.join(RAILS_ROOT, 'db', 'backup') | |
| @db = YAML::load( File.open( File.join(RAILS_ROOT, 'config', 'database.yml') ) )[ RAILS_ENV ] | |
| @db_params = "-u #{@db['username']} #{@db['database']}" |
| require 'net/ftp' | |
| def scan(ftp, dir) | |
| ftp.chdir(dir) | |
| puts ftp.pwd + "/." | |
| entries = ftp.list('*') | |
| entries.each do |entry| | |
| if entry.split(/\s+/)[0][0,1] == "d" then | |
| scan(ftp, entry.split.last) | |
| else |
| import Ember from 'ember'; | |
| import { inject as service } from '@ember/service'; | |
| export default Ember.Component.extend({ | |
| redirection: service(), | |
| tagName: '' | |
| }); |
http://guides.rubyonrails.org/migrations.html
| # | |
| # A: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.subscribe do |data| | |
| # puts "data: #{data} is coming!" | |
| # end | |
| # | |
| # B: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.publish("hello world") |
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/