LiveView upload directly to AWS China S3
If you just want to copy-paste this it should "just work", but you'll need to get yarn
set up. Follow the instructions at https://yarnpkg.com/getting-started/install OR just run:
npm install -g yarn
yarn set version berry
yarn install
# this should make a.yarn/
,yarn.lock
, and.pnp.js
If you want to run these outside of the context of a running phoenix server, you can also run the mix tasks, mix assets.install
and mix assets.compile
. They are a copy paste of some the CLI bits but you could abstract them out to point to a config/cmds.exs
or something if you wanted.
defmodule Model do | |
schema "models" do | |
field :foo, :string | |
has_many :children, Model, foreign_key: :parent_id | |
belongs_to :parent, Model, foreign_key: :parent_id | |
end | |
@doc """ | |
Recursively loads parents into the given struct until it hits nil | |
""" |
Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first | |
which breaks when you're using CommonJS with webpack. | |
Install DT core: npm install datatables.net | |
Install a DT style: npm install datatables.net-bs (bootstrap) | |
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd | |
Create a loader "exception" just for DT in webpack.config.js: | |
module: { | |
loaders: [ |
Here's how to make jQuery DataTables work with npm and webpack. This is the simplest way I found to do it. | |
See the previous revision of this gist for a way to do it with forcing AMD to be disabled if you need that. | |
Install DT core: npm install datatables.net | |
Install a DT style: npm install datatables.net-dt | |
Then to initialize DT in your app, do this in your main entry point: | |
// you can use import or require | |
import dt from 'datatables.net'; |
country_codes = [ | |
%{ iso_3166_1: "AF", name: "Afghanistan" }, | |
%{ iso_3166_1: "AX", name: "Aland Islands" }, | |
%{ iso_3166_1: "AL", name: "Albania" }, | |
%{ iso_3166_1: "DZ", name: "Algeria" }, | |
%{ iso_3166_1: "AS", name: "American Samoa" }, | |
%{ iso_3166_1: "AD", name: "Andorra" }, | |
%{ iso_3166_1: "AO", name: "Angola" }, | |
%{ iso_3166_1: "AI", name: "Anguilla" }, | |
%{ iso_3166_1: "AQ", name: "Antarctica" }, |
Note: $
denotes the start of a command. Don't actually type this.
- Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
- Go to https://repo.continuum.io/archive to find the list of Anaconda releases
- Select the release you want. I have a 64-bit computer, so I chose the latest release ending in
x86_65.sh
. If I had a 32-bit computer, I'd select thex86.sh
version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I choseAnaconda3-5.2.0-Linux-x86_64.sh
. - From the terminal run
wget https://repo.continuum.io/archive/[YOUR VERSION]
. Example:$ wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
- Run the installation script:
$ bash Anaconda[YOUR VERSION].sh
($ bash Anaconda3-5.2.0-Linux-x86_64.sh
) - Read the license
diff --git a/assets/js/App.svelte b/assets/js/App.svelte | |
new file mode 100644 | |
index 0000000..221cde6 | |
--- /dev/null | |
+++ b/assets/js/App.svelte | |
@@ -0,0 +1,5 @@ | |
+<script> | |
+ export let name; | |
+</script> |
#set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' | |
# Add truecolor support | |
#set-option -ga terminal-overrides ,xterm-256color:Tc"" | |
# Default terminal is 256 colors | |
set -g default-terminal "screen-256color" | |
set-option -sg escape-time 10 | |
set-option -g default-terminal "screen-256color" |
I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).
In Vim I have key bindings C-h/j/k/l
set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W
.) I'd like to use the same keystrokes for switching tmux panes.
An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\
.
Here's how it should work: