Skip to content

Instantly share code, notes, and snippets.

View 73nko's full-sized avatar
💭
👨‍💻

73NKo 73nko

💭
👨‍💻
View GitHub Profile
<html>
<head>
<style>
h1 {
fonst-size: clamp(1em, 1em + 2vw, 3em);
}
</style>
</head>
<body>
<h1>Fluid font-size headline</h1>
* {
/*prevents tabing highlight issue in mobile */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
}
@73nko
73nko / .zshrc
Created April 14, 2020 07:47
Oh my zsh config
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export FZF_DEFAULT_OPTS='--height 40% --reverse --border --inline-info --color=dark,bg+:235,hl+:10,pointer:5'
export ENHANCD_FILTER="fzf:peco:percol"
export ENHANCD_COMMAND='c'
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
const express = require('express');
const graphqlHTTP = require('express-graphql');
const { buildSchema } = require('graphql');
const jwt = require('jsonwebtoken');
const unless = require('express-unless');
const schema = buildSchema(`
type Query {
hostname: String
}
`);
npx create-react-app my-app --template redux-typescript
const createInterceptorMiddleware = (interceptors) => (store) => (next) => (action) => {
Promise.all(
interceptors
.filter(interceptor => interceptor.type === action.type)
.map(interceptor => {
const result = interceptor.handler(action, store.dispatch, store.getState);
return result instanceof Promise ? result : Promise.resolve(result);
})
)
.then((afterDispatchHandlers) => {
// the family class is going to behave as tho
// its a JavaScript array internally so we can leverage
// the functionality of JavaScript arrays
class Family {
constructor() {
// Arrays have a length prop so we should too!
this.length = 0;
}
addFamilyMember = (name) => {
@73nko
73nko / firebase-hook.js
Created January 16, 2020 20:43 — forked from dsafreno/firebase-hook.js
React Hooks for loading Firebase Data
import React, { useReducer, useEffect, useRef } from 'react';
import firebase from 'firebase/app';
import equal from 'deep-equal';
function filterKeys(raw, allowed) {
if (!raw) {
return raw;
}
let s = new Set(allowed);
return Object.keys(raw)
@73nko
73nko / random-id.ts
Created January 16, 2020 20:41
Generate a random ID without libraries
// random.ts
function randomId(): string {
const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];
return uint32.toString(16);
}
jest.mock('moment', () => {
const moment = jest.requireActual('moment');
return {default: moment };
});