`is:open is:pr repo:konciergeMD/hac-messenger repo:konciergeMD/integration-mock-factory repo:konciergeMD/hac-application repo:konciergeMD/hac-client-dashboard repo:konciergeMD/hac-api repo:konciergeMD/etp-front-end repo:konciergeMD/etp-common-ui repo:konciergeMD/koa-react-redux-template repo:konciergeMD/accolade-api repo:kon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://twitter.com/zkat__/status/878926190064668672 | |
npx json-server https://raw.githubusercontent.com/typicode/jsonplaceholder/master/data.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
// a quick example of "enhancing" the localstorage sync | |
// in order to use it like a specialized store. | |
// you're obviously going to get worse perf than a regular React.createContext, but you get some benefits. | |
const validDetails = ["name", "favColor"]; | |
export const usePlayerDetail = (key) => { | |
// check for valid inputs, ensure we're only using keys we care about. | |
// potential migration concerns | |
if (!validDetails.includes(key)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this could definitely be moved out to a helper/util. | |
// I'd consider this a better and less fallible approach to our previous ideas of using {{token}}. | |
const defaultValue = ''; | |
// see MDN reference on TaggedTemplates for how the strings&keys work. | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals | |
const urlTemplate = (strings, ...keys) => | |
// returns a function that accepts a property bag (presumably to fill in the tokens) | |
(props) => | |
// start with the first string, then map each tokenized Key to a tuple of: `Properties[Key], NextString` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext, useReducer } from 'react'; | |
const reducer = (initialValue) => (state, { type, key, value }) => { | |
switch (type) { | |
case 'SET_KEY': | |
return { ...state, [key]: value }; | |
case 'CLEAR': | |
return initialValue; | |
default: | |
return state; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.switch { | |
line-height: 1.5; | |
font-weight: normal; | |
font-family: Roboto,Helvetica,Arial,sans-serif; | |
-webkit-box-direction: normal; | |
list-style: none; | |
list-style-type: none; | |
font-size: .8rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// react & redux snippets for vscode | |
"react_component": { | |
"prefix": "comp", | |
"body": [ | |
"import React from 'react';", | |
"import PropTypes from 'prop-types';", | |
"", | |
"const ${1:ComponentName} = ({}) => (", | |
"\t<div>", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# README: remember to chmod +x this file, save the contents to `my-project/.git/hooks/pre-push` | |
echo "HOOK PRE-PUSH: Checking for describe.only in test files..." | |
count=$(grep describe.only src/**/*.test.js | wc -l) | |
if [ "$count" -eq 0 ] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.js*': | |
'react boilerplate': | |
'prefix': 'rbp' | |
'body': """ | |
import React, { PropTypes } from 'react'; | |
import { connect } from 'react-redux'; | |
import './${1:MyComponent}.less'; | |
const ${1:MyComponent} = ({$3}) => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
master="refs/heads/master" | |
read local_ref local_sha remote_ref remote_sha | |
echo $remote_ref | |
if [ "$remote_ref" = master ] | |
then | |
echo "attempting to push master branch, running tests..." | |
npm run test |
NewerOlder