This file contains 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
# | |
# Git | |
# | |
alias g='git' | |
alias gl="clear && git log" | |
alias gll="clear && git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" | |
alias glp="clear && git log -p" | |
alias gs="clear && git status -sb" |
This file contains 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
// Export a helper component that allows for easy translations in views w/o | |
// needing to use the context directly. Only handles simple key lookup at the | |
// moment. | |
function Translate({ id }: { | |
id: keyof T | |
}) { | |
return ( | |
<i18nContext.Consumer> | |
{ | |
({ translate }) => translate(id) |
This file contains 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 component": { | |
"prefix": "com", | |
"body": [ | |
"import React, { Component } from 'react';", | |
"", | |
"interface Props {", | |
" $3", | |
"}", | |
"", |
This file contains 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
/* | |
Concern 1: CUSTOM STYLES | |
Custom theme styles are given to us as json. | |
Object has one level of nesting, mostly grouped by the component w/ some higher level blocks like 'global'. | |
We are not allowing free reign custom styles, but highly targeted element+property styles. | |
We should have global 'theme color' properties so you don't need to specify the same color in 10 places. |
This file contains 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
// Current setup is a all styles go in a single file w/ a single flat `[element name]: { styles for that element }` block: | |
export const defaultStyles = { | |
quizHeader: { | |
display: 'flex', | |
}, | |
quizHeaderLogo: { | |
background: '', | |
}, |
This file contains 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 { tryJsonParse } from "./tryJsonParse"; | |
// Small wrapper around localStorage that converts to/from json. | |
// | |
// We also define all localStorage keys/values we store upfront here. | |
// This way all values are documented, and we get type saftey. | |
// | |
interface LocalStored { | |
device_info: string; | |
debugRedirects: boolean; |
This file contains 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
// Based on: https://github.com/JedWatson/classnames/blob/master/index.js | |
/*! | |
Copyright (c) 2018 Jed Watson. | |
Licensed under the MIT License (MIT), see | |
http://jedwatson.github.io/classnames | |
*/ | |
var hasOwn = {}.hasOwnProperty; | |
export function classNames(...args: any[]) { |
This file contains 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
class BaseballCards extends Component { | |
render() { | |
return <b onClick={this.onClick}> sup</b> | |
} | |
// class-level prop, gets .bind(this) when constructing the object so `this` is always the correct object instance. | |
onClick = (event) => { | |
console.log(this, 'rules!') | |
} | |
} |
This file contains 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
interface RequestOptions { | |
authToken?: string | |
} | |
interface Fun { | |
age: number; | |
} | |
const InitEndpoint = { | |
get({ id }: { id: string }, options?: RequestOptions): Promise<Fun> { | |
return Promise.resolve({ age: 1}) |
This file contains 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
{ | |
"currentFolderName": { | |
"color": "#ff0000", | |
"fontSize": 30, | |
"textAlign": "right" | |
}, | |
"childFolder": { | |
"fontSize": 20, | |
"marginBottom": 10 | |
}, |