NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
#!! | |
# put the file to /lib/capistrano/tasks | |
# Resolve the conflict between local precompile as production mode and webpack/hot/dev-server | |
# you must edit config/webpacker.yml | |
# development: | |
# <<: *default | |
# public_output_path: packs-dev | |
# | |
# Clear existing task so we can replace it rather than "add" to it. |
I hereby claim:
To claim this, I am signing this object:
module CachingHelper | |
def with_caching | |
cache_store_type_origin = Rails.application.config.cache_store | |
cache_store_origin = Rails.cache | |
Rails.application.config.cache_store = [ | |
:memory_store, {:size => 64.megabytes } | |
] | |
Rails.cache = ActiveSupport::Cache::MemoryStore.new( | |
:expires_in => 1.minute | |
) |
import { | |
useRef, useLayoutEffect, useCallback, useState, | |
} from 'react'; | |
import Clipboard from 'clipboard'; | |
/** | |
* 复制到粘贴板 | |
* @usage | |
* const clipboard = useClipboard({ | |
* copiedTimeout: 1000, |
需要阅读的文章: https://overreacted.io/zh-hans/a-complete-guide-to-useeffect/ # 作者是 Dan Abramov,React 核心开发者 https://github.com/dt-fe/weekly/tree/master #
如果只是需要使用更改的数据:
const { loading, data, error } = useQuery(SOME_QUERY)
if (loading) return <Loader />
if (error) return <Error />
#encoding: utf-8 | |
require "fileutils" | |
namespace :my_db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7" | |
desc "usage - bundle exec rake my_db:backup RAILS_ENV=production MAX=15 DIR=db/db.bak" | |
task :backup => [:environment] do | |
# config base dir | |
datestamp = Time.now.strftime("%Y%m%d%H%M") | |
base_path = Rails.root | |
backup_folder = File.join(base_path, ENV["DIR"] || "backups") | |
FileUtils.mkdir_p(backup_folder) unless File.exist?(backup_folder) |
# install build dependencies | |
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel | |
# clone and install rbenv environment | |
cd ~ | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile |
CULTURE SPEC.CULTURE ENGLISH NAME | |
-------------------------------------------------------------- | |
Invariant Language (Invariant Country) | |
af af-ZA Afrikaans | |
af-ZA af-ZA Afrikaans (South Africa) | |
ar ar-SA Arabic | |
ar-AE ar-AE Arabic (U.A.E.) | |
ar-BH ar-BH Arabic (Bahrain) | |
ar-DZ ar-DZ Arabic (Algeria) | |
ar-EG ar-EG Arabic (Egypt) |
# ========================================================== | |
# NPM | |
# ========================================================== | |
npm set registry https://r.npm.taobao.org # 注册模块镜像 | |
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像 | |
## 以下选择添加 | |
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像 | |
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像 |