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
| #!/usr/bin/env bash | |
| git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
| git fetch --all | |
| git pull --all |
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
| { | |
| "repository": {}, | |
| "description": " ", | |
| "license": "MIT", | |
| "scripts": { | |
| "deploy": "webpack --mode production", | |
| "watch": "webpack --mode development --watch" | |
| }, | |
| "dependencies": { | |
| "@tailwindcss/forms": "^0.2.1", |
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
| from sqlalchemy import (String, | |
| Integer, | |
| engine_from_config, | |
| Column) | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| Base_1 = declarative_base() | |
| Base_2 = declarative_base() |
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 | |
| # Initialize MySQL database. | |
| # ADD this file into the container via Dockerfile. | |
| # Assuming you specify a VOLUME ["/var/lib/mysql"] or `-v /var/lib/mysql` on the `docker run` command… | |
| # Once built, do e.g. `docker run your_image /path/to/docker-mysql-initialize.sh` | |
| # Again, make sure MySQL is persisting data outside the container for this to have any effect. | |
| set -e | |
| set -x |
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
| defmodule ModuleToBeUsed do | |
| defmacro __using__(_) do | |
| IO.puts __MODULE__ # COMPILATION STAGE | |
| quote do # needed to prevent execution on compilation stage | |
| IO.inspect(__MODULE__, label: "__MODULE__") | |
| IO.inspect(unquote(__MODULE__), label: "unquote(__MODULE__)") | |
| import unquote(__MODULE__) | |
| def test, do: IO.puts "I am test" # EXECUTION STAGE | |
| end | |
| 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
| /** | |
| Ref: https://jonasjancarik.medium.com/handling-those-unhandled-promise-rejections-when-using-javascript-async-await-and-ifee-5bac52a0b29f | |
| Placement of catch BEFORE and AFTER then: https://stackoverflow.com/questions/42013104/placement-of-catch-before-and-after-then | |
| */ | |
| // 1. Work | |
| (async()=>{ | |
| return Promise.reject("a").catch((_error) =>{}) |
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
| // | |
| // To install these snippets, select "User Snippets" under "File > | |
| // Preferences" ("Code > Preferences" on macOS), and then select | |
| // elixir.json. Paste the snippets below into that file. If you already | |
| // have snippets in that file, you'll need to put all the snippets in one | |
| // top-level JavaScript object, so remove the outer braces in the code | |
| // below. | |
| // | |
| // JSON doesn't allow comments, so you must remove these comment lines! :-) | |
| // |
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
| # inside an ecto Schema, adding this: | |
| defimpl Jason.Encoder, for: [__MODULE__] do | |
| def encode(struct, opts) do | |
| Enum.reduce(Map.from_struct(struct), %{}, fn | |
| ({k, %Ecto.Association.NotLoaded{}}, acc) -> acc | |
| ({k, v}, acc) -> Map.reject(acc, fn {k, v} -> k === :__meta__ end) |> Map.put(k, v) | |
| end) | |
| |> Jason.Encode.map(opts) | |
| 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
| dfdfdfd |
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
| irb(main):015:0> ["1",2,3,4,5].select {|val| val.is_a? Numeric } | |
| => [2, 3, 4, 5] | |
| irb(main):016:0> ["X","-",3,4,5].select {|val| val.is_a? Numeric or val == "X"} | |
| => ["X", 3, 4, 5] |