Skip to content

Instantly share code, notes, and snippets.

View Jessidhia's full-sized avatar

Jessica Franco Jessidhia

  • @pixiv Inc, pixiv desktop
  • Tokyo, Japan
View GitHub Profile
@Jessidhia
Jessidhia / esm-example.js
Last active February 14, 2017 01:28 — forked from bmeck/esm-example.js
// // given
//
// import foo from "bar"
// export let a
// export { a as b }
// export function hoisted() {}
// export {readFile} from "fs"
// export * from "path"
//
// console.log(foo)
@Jessidhia
Jessidhia / webpack.config.snippet.js
Created November 4, 2016 02:35
CommonsChunkPlugin setting to make a sync common chunk of async child chunks
// having `entry: { main: path.resolve('src') }`:
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
chunks: ['main'],
// "children" does not actually select all the children of "chunks",
// but completely ignores all "chunks" and selects the children of "name"
// instead, so it's useless for our use case, as we're making a new chunk.
minChunks: (() => {
const tag = `${__filename}-common-minChunks`
// the count argument will always be "1" as there's only one chunk in
export {}
if (typeof Array.prototype.flatMap !== 'function') {
// eslint-disable-next-line no-extend-native
Object.defineProperty(Array.prototype, 'flatMap', {
enumerable: false,
// https://bterlson.github.io/proposal-flatMap/#sec-Array.prototype.flatMap
value: function flatMap (callback, thisArg = undefined) {
const O = toObject(this)
const A = arraySpeciesCreate(O, 0)
// Removes all files from outputPath that are not in webpack's output
// @this webpack
function cleanArtifacts () {
const result = new Set()
// globs to ignore when deleting
const cleanIgnore = [ '.gitignore' ]
this.plugin('done', () => {
if (result.size > 0) {
// eslint-disable-next-line no-console
[{"key":"AccountsDisplayDensity","value":false},{"key":"AccountsEmphasizedInflows","value":false},{"key":"AccountsEmphasizedOutflows","value":false},{"key":"AccountsStripedRows","value":false},{"key":"AccountsStripedRowsColor","value":"#fafafa"},{"key":"AccountsStripedRowsDarkColor","value":"#1e1e1f"},{"key":"AutoDistributeSplits","value":false},{"key":"AutoEnableRunningBalance","value":true},{"key":"AutomaticallyMarkAsCleared","value":false},{"key":"BetterScrollbars","value":false},{"key":"BottomNotificationBar","value":false},{"key":"BudgetProgressBars","value":false},{"key":"BulkEditMemo","value":true},{"key":"BulkManagePayees","value":false},{"key":"CalculateIRR","value":false},{"key":"CalendarFirstDay","value":false},{"key":"CategoryActivityCopy","value":false},{"key":"CategoryActivityPopupWidth","value":false},{"key":"ChangeEnterBehavior","value":false},{"key":"ChangeMemoEnterBehavior","value":false},{"key":"CheckCreditBalances","value":false},{"key":"CheckNumbers","value":false},{"key":"CollapseInspect
@Jessidhia
Jessidhia / code.sh
Created June 30, 2016 05:27
VS Code's launch script modified to work when called from inside Cygwin
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
NAME="Code"
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
ELECTRON="$VSCODE_PATH/$NAME.exe"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
if [ "$OSTYPE" = "cygwin" ] && which cygpath &>/dev/null; then
import React from 'react'
import classNames from 'classnames'
// I am trying to write a React version of an internal library's component.
// They share the CSS and class names, so the internal library's jquery event handler will capture clicks,
// thus I have to use a ref and attach handlers directly to it.
class Test extends React.Component {
constructor (props) {
super(props)
import $ from 'jquery'
// jQuery Deferreds don't have a prototype, so patching them is more complicated
// than the native Promises.
const origDeferred = $.Deferred
const sym = module.hot && module.hot.data
? module.hot.data
: Symbol('deferred-finally')
@Jessidhia
Jessidhia / zsh-history-search-with-peco.zsh
Last active April 29, 2016 05:17 — forked from jimeh/zsh-history-search-with-peco.zsh
Use peco (https://github.com/peco/peco) to search ZSH's history via ctrl+R
# Search shell history with peco: https://github.com/peco/peco
# Adapted from: https://github.com/mooz/percol#zsh-history-search
if [ "$(which peco &>/dev/null && echo 'a' | peco --select-1)" = 'a' ]; then
function peco_select_history() {
local lbuf="$LBUFFER"
BUFFER=
zle -c -U "$(print -rl - $history | peco --layout=bottom-up --query "$lbuf")"
}
zle -N peco_select_history
bindkey '^R' peco_select_history
@Jessidhia
Jessidhia / AutoHotkey.ahk
Last active January 21, 2020 07:19
Script to enable JIS keys on Windows Dvorak layout
#SingleInstance force
#InstallKeybdHook
#UseHook On
; HACK: KBDDV.DLL doesn't deal with the IME keys, so map them by scancode
; Yen key: 07d, assign to \ :(
; Backslash key: 073, assign to `
; Hankaku/Zenkaku key: working as tilde key, don't touch
; Muhenkan: 07B, disable IME
; Henkan: 079, enable IME