Skip to content

Instantly share code, notes, and snippets.

@robotzhang
robotzhang / Tailwindcssunreset.scss
Created April 27, 2022 01:28 — forked from swyxio/Tailwindcssunreset.scss
Tailwind CSS Un-Reset - un-reset Tailwind's Preflight CSS Reset so that autogenerated HTML looks consistent with the rest of your Tailwind site. - https://www.swyx.io/writing/tailwind-unreset
.unreset {
a {
@apply text-blue-700 underline;
}
p {
@apply my-4;
}
blockquote,
figure {
@robotzhang
robotzhang / npm.taobao.sh
Created April 21, 2022 06:44 — forked from lvxianchao/npm.taobao.sh
设置 npm 和 yarn 的镜像源为淘宝镜像源
# ==========================================================
# 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 二进制包镜像
@robotzhang
robotzhang / html-languages.txt
Created January 25, 2021 12:28 — forked from JamieMason/html-languages.txt
HTML lang attribute / ISO language code reference / Culture names
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)
# 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
@robotzhang
robotzhang / my_db.rake
Created March 26, 2020 15:50 — forked from jay16/my_db.rake
rails backup DB
#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)
@robotzhang
robotzhang / local_precompile.rake
Last active August 4, 2017 17:55 — forked from tyler-boyd/deploy.rb
Compile assets locally with Capistrano 3.8.1 and Rails 5.1.1
#!!
# 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.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/