Skip to content

Instantly share code, notes, and snippets.

View OttoH's full-sized avatar
🐱

otto huang OttoH

🐱
View GitHub Profile
@OttoH
OttoH / createExcelFile.ts
Last active September 18, 2024 05:56
excel.js example
import ExcelJS from 'exceljs';
async function createExcelFile() {
// Create a new workbook and worksheet
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Sheet1');
// Set column widths
worksheet.columns = [
{ header: 'ID', key: 'id', width: 10 },
@OttoH
OttoH / XLSXGenerator-dropdown-rowspan.ts
Last active September 11, 2024 02:43
xlsx generator
import React from 'react';
import * as XLSX from 'xlsx-js-style';
interface CellStyle {
font?: {
bold?: boolean;
color?: { rgb: string };
underline?: boolean;
};
fill?: {
@OttoH
OttoH / .eslintrc.json
Last active September 6, 2024 06:41
.eslintrc.json
{
"env": {
"es2021": true,
"jest/globals": true
},
"extends": [
"next",
"prettier",
"plugin:react-hooks/recommended"
],
{
"id": "uuid",
"layoutType": "_type",
"start_time": "_start_time",
"end_time": "_end_time",
"carousel": [{"id":11,"name":"w644 (18).jpeg","hash":"18e1a91e520345cc874a8d9fc60a62df","sha256":"mJUqJ1qwZTBnjY0kX2XAV-cipuL8EtLdtABan6lgPVY","ext":".jpeg","mime":"image/jpeg","size":"44.26","url":"https://obs-beta.line-scdn.net:443/0h7nJ8SXkSaEF3QUORmwMXFkUXZDBEJDEXQnMnd1pBYnVZcC0ST3V1LlREZngPeXhFTCZ3IFEUYQ","provider":"local","public_id":null,"created_at":"2019-10-29T06:49:58.011Z","updated_at":"2019-10-29T06:49:58.011Z"},{"id":12,"name":"w644 (19).jpeg","hash":"7e2ff84b516443c2821858a30c47ad73","sha256":"Svnyjfy0z-475JnlDAwpSqOb3Eo4ZT-GRQyzsgsV6NM","ext":".jpeg","mime":"image/jpeg","size":"26.69","url":"https://obs-beta.line-scdn.net:443/0hAd2cfaCWHksPGjWb49FhHD1MEjo8f0cbZ38GeiMfE38iLVwYMS5SJCkaSX8relscYXlXfX8cQg","provider":"local","public_id":null,"created_at":"2019-10-29T06:52:12.693Z","updated_at":"2019-10-29T06:52:12.693Z"}],
"tags": "camellia, spot",
"blocks": [
{
"type": "ly_title",
<template>
<svg
:style="_style"
:viewBox="_viewBox"
height="1em"
>
<use xlinkHref="`#${this.glyph}`" />
</svg>
</template>
<script>
const path = require('path')
const pascalCase = require('pascal-case')
const { stringifyRequest } = require('loader-utils')
const { stringifySymbol, stringify } = require('svg-sprite-loader/lib/utils')
module.exports = function runtimeGenerator({
symbol,
config,
context,
loaderContext
@OttoH
OttoH / GIF-Screencast-OSX.md
Created January 15, 2019 11:43 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
export PS1="\[\e[36;1m\][\h]\[\e[33;1m\]\t \[\e[0m\]\[\e[32;1m\]\w \[\e[0m\]\$(__git_ps1)\n $"
source ~/.git-completion.bash
source ~/.git-prompt.sh
//
https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
//
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
import React from 'react'
import fetch from 'isomorphic-unfetch'
// import styled from 'styled-components'
import { saveStories, getNewPostKeys } from '../lib/dbUtils'
import Layout from '../components/MyLayout.js'
// import { ResetButton } from '../components/Button'
export default class extends React.PureComponent {
static async getInitialProps (context) {