Skip to content

Instantly share code, notes, and snippets.

View liuliangsir's full-sized avatar
💻
Coding

流浪大法师 liuliangsir

💻
Coding
View GitHub Profile

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@nokidding
nokidding / updateNpm.bat
Created March 31, 2020 13:08
Windows batch file which updates npm for nvm-windows
rem see https://github.com/coreybutler/nvm-windows/issues/300
@echo off
SETLOCAL EnableDelayedExpansion
if [%1] == [] (
echo Pass in the version you would like to install, or "latest" to install the latest npm version.
) else (
set wanted_version=%1
@tanhauhau
tanhauhau / my-webpack-plugin.js
Created February 20, 2020 00:55
Webpack additional compilation pass
const PLUGIN_NAME = 'MY_WEBPACK_PLUGIN';
class MyWebpackPlugin {
constructor() {
this.cssReady = false;
this.cssFiles = [];
}
apply(compiler) {
compiler.hooks.watchRun.tap(PLUGIN_NAME, () => {
this.cssReady = false;
@silver-xu
silver-xu / ts-boilerplate.md
Last active April 28, 2024 02:07
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@CSTDev
CSTDev / auto-increment-version.sh
Last active May 1, 2024 01:57
Script that will find the last Git Tag and increment it. It will only increment when the latest commit does not already have a tag. By default it increments the patch number, you can tell it to change the major or minor versions by adding #major or #minor to the commit message.
#!/bin/bash
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
#get number parts and increase last one by 1
VNUM1=${VERSION_BITS[0]}
@ChrisDobby
ChrisDobby / canvasDraw.jsx
Last active March 9, 2023 09:23
React component to redraw a canvas when resized
import React from "react";
const scaleWidth = 500;
const scaleHeight = 500;
function draw(canvas, scaleX, scaleY) {
const context = canvas.getContext("2d");
context.scale(scaleX, scaleY);
context.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight);
@lvxianchao
lvxianchao / npm.taobao.sh
Last active April 20, 2024 00:15
设置 npm 和 yarn 的镜像源为淘宝镜像源
# ==========================================================
# NPM
# ==========================================================
npm set registry https://registry.npmmirror.com # 注册模块镜像
npm set disturl https://npmmirror.com/mirrors/node # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://registry.npmmirror.com/mirrors/electron/ # electron 二进制包镜像
@rikvermeer
rikvermeer / emautomake.sh
Last active August 31, 2022 06:18
Emscripten compilation
#example for making jq
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
. ~/workspace/emsdk/emsdk_env.sh
autoreconf -fi
emconfigure ./configure
emmake make LDFLAGS=-all-static
#emcc -O2 jq.obj -o jq.js -s ERROR_ON_UNDEFINED_SYMBOLS=0
emcc -O3 -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE_INSTANCE=1 -s EXPORT_NAME="jq" -s WASM=1 --pre-js ./pre.js --post-js ./post.js jq.o -o ./jq.wasm.js -s ERROR_ON_UNDEFINED_SYMBOLS=0
@winuxue
winuxue / puppeteer-ubuntu-1804.md
Created May 22, 2019 01:15
Solution for common dependences issues using puppeteer in ubuntu 18.04 (Bionic)

puppeteer dependeces in ubuntu 18.04 (Bionic)

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

sudo apt-get install libnss3

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

sudo apt-get install libxss1
@Gustavo-Kuze
Gustavo-Kuze / force-ctrl-c-v.md
Last active April 30, 2024 13:22
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})();