Skip to content

Instantly share code, notes, and snippets.

View ninetails's full-sized avatar
🏳️‍⚧️
traaa

Nina Kitsu ninetails

🏳️‍⚧️
traaa
View GitHub Profile
@ninetails
ninetails / createHOC.js
Created June 16, 2019 09:31
function to create High Order Component factories
// source: https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging
export function getDisplayName (Component) {
return Component.displayName || Component.name || 'Component'
}
export const createHOC = Component => params => BaseComponent => {
const WrappedComponent = props => (
<Component {...params}>
<BaseComponent {...props} />
</Component>
@ninetails
ninetails / test.css
Created April 26, 2019 23:20
24px vertical grid
.test {
background-image: linear-gradient(
to top,
rgba(155, 0, 65, 0.2) 1px,
transparent 1px
);
background-size: 100% 24px;
background-repeat-y: repeat;
background-position-y: 0px;
}
@ninetails
ninetails / package.json
Created April 3, 2019 19:56
Google Cloud Functions Emulator with Node.js
{
(...)
"scripts": {
"functions": "source $HOME/.nvm/nvm.sh; nvm exec lts/boron npx @google-cloud/functions-emulator",
"functions:deploy": "$npm_execpath run functions -- deploy",
"functions:deploy:hello": "$npm_execpath run functions:deploy -- hello --trigger-http",
"functions:status": "$npm_execpath run functions -- status",
"functions:start": "$npm_execpath run functions -- start",
"functions:stop": "$npm_execpath run functions -- stop"
}
@ninetails
ninetails / App.js
Created February 28, 2019 01:29
reset
import React, { Fragment, Suspense } from 'react'
import Head from '@ninetails-monorepo-react-ssr/react-kabocha'
import { Link, Route, Switch } from 'react-router-dom'
const UniversalSuspense = global.window ? Suspense : Fragment
const test = {
read (timeout, cache = global.window) {
if (this.value) {
if (cache) {
@ninetails
ninetails / inline.js
Created October 23, 2018 23:21
Remove style inside React Storybook
// @todo a way to revert to be a switch plugin
(() => {
Array.from(document.getElementById('storybook-preview-iframe').contentDocument.body.querySelectorAll('.sb-wrapper'))
.forEach(el => {
el.style.display = 'none'
})
// remove styles
Array.from(document.getElementById('storybook-preview-iframe').contentDocument.head.getElementsByTagName("*"))
@ninetails
ninetails / README.md
Created September 7, 2018 00:13
Make Chrome accept self-signed certificates

Enable this flag

chrome://flags/#allow-insecure-localhost

@ninetails
ninetails / build.js
Created September 5, 2018 00:54
Publishing transpiled npm package
const { promisify } = require('util')
const { readFile, writeFile } = require('fs')
const { join } = require('path')
const readFileAsync = promisify(readFile)
const writeFileAsync = promisify(writeFile)
const pkg = require('./package.json')
const packageJsonOutput = join(__dirname, 'dist', 'package.json')
const generatePackageJson = input => {
const copiedPkg = { ...input }
@ninetails
ninetails / foo.sh
Created April 13, 2018 20:16
Change fonts locally
mkdir ~/.local/share/fonts
cp *.ttf ~/.local/share/fonts
fc-cache -fv
@ninetails
ninetails / SimpleStore.js
Created April 11, 2018 16:38 — forked from ksafranski/SimpleStore.js
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve: