Skip to content

Instantly share code, notes, and snippets.

@LUN7
LUN7 / delete.sh
Created September 25, 2022 05:11
Delete all draft release with gh cli
gh release list | grep Draft | awk '{print $1 " \t"}' | while read -r line; do gh release delete -y "$line"; done
@LUN7
LUN7 / test.js
Last active August 20, 2021 07:45
unit test example
import toDoService from './toDo'
const TEST_USER_ID = "test-1212"
const NOW = String(Date.now())
const UPDATED_NOW = String(Date.now())
const SAMPLE_TODO = {
userId: TEST_USER_ID,
name: "TODO-1",
deadline: NOW,
@LUN7
LUN7 / index.html
Created March 13, 2021 16:55
A html starter with react
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script
src="https://unpkg.com/react@17/umd/react.development.js"
crossorigin
></script>
@LUN7
LUN7 / index.html
Created January 3, 2021 13:32
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>React App</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
@LUN7
LUN7 / index.js
Created January 3, 2021 13:32
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from "./App";
ReactDOM.render( <App/>, document.getElementById('root') );
@LUN7
LUN7 / App.js
Created January 3, 2021 13:31
App.js
import React from 'react';
class App extends React.Component {
render() {
return(
<div>
Hello World!
</div>
);
}
}
@LUN7
LUN7 / .babelrc
Created January 3, 2021 13:25
react babel config
{
presets: [
[
"@babel/preset-env",
{
modules: false,
targets: {
browsers: [
"last 2 Chrome versions",
"last 2 Firefox versions",
@LUN7
LUN7 / webpack.config.js
Created January 3, 2021 13:24
react webpack config
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname,'src'),
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
publicPath:'./',
@LUN7
LUN7 / processing.py
Created December 27, 2020 07:56
processing.py
import numpy as np
import os
import sys
def load_csv(csv_file_name):
print("loading csv @", csv_file_name)
buffer = np.loadtxt(csv_file_name, dtype=np.str, delimiter=",")
print("csv loaded succesfully")
@LUN7
LUN7 / user.js
Last active December 27, 2020 03:49
apidoc demo
/**
* @apiDefine admin admin title
* Only admin has permission to delete user <-- description
* apiDefine定義一個叫admin的block
* 可以再其他的註譯呼叫這個block
*/
/**
* @api {get} /user/:userId get user
* {method} {route} {desciption}