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 APIconfig from "./api-config"; | |
// SECTION 1: Create Your endpoints. | |
// For separation of concerns, you can create these in a separate file | |
// and import them wherever you create your `APIConfig` instance. | |
// | |
// Note: the following is entirely mocked (i.e. not a real API that | |
// I know of), but is meant to convey the idea of using `APIConfig`. | |
const MY_BASE_URL = "https://api.example.com" |
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 React, { Component } from 'react'; | |
/** | |
* HOC for asynchronously loading a component dependency. | |
* | |
* Use: replace | |
* import MyComponent from './path/to/my-component'; | |
* | |
* With: | |
* const MyComponent = AsyncLoader(() => import('./path/to/my-component')); |
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
#!//bin/bash | |
# Helper script to install and initialize @jackcom libraries and subdirectories | |
# after create-react-app install. `chmod 700` and run from app's `package.json` layer. | |
# | |
# Note: Installs @jackcom/raphsducks and @jackcom/app-network-layer | |
function makeIndexFile { | |
if [ ! -e $1 ] | |
then |
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
/****************************************** | |
* File : Animations.scss | |
*******************************************/ | |
@keyframes beacon { | |
0% { | |
transform: scale(1, 1); | |
opacity: 1; | |
} | |
100% { | |
transform: scale(4, 4); |
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
// Inspiration from: https://www.fullstackreact.com/articles/Declaratively_loading_JS_libraries/index.html | |
// ================================================================================ | |
// Summary: a handy class for dynamically loading and using async JS libs in a ReactJS app | |
// ================================================================================ | |
// | |
// Usage: | |
// 1. create a `ScriptCache` instance: | |
// const scriptCache = new ScriptCache(["http://remote.cdn.com/myLibrary.min.js", "http://..."]); | |
// 2. pass any functions that depend on window globals (from your script) into `scriptCache.onLoad` | |
// ================================================================================ |
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
// This syntax reflects changes made to the Swift language as of Aug. '16 | |
extension UIView { | |
// Example use: myView.addBorder(toSide: .Left, withColor: UIColor.redColor().CGColor, andThickness: 1.0) | |
enum ViewSide { | |
case Left, Right, Top, Bottom | |
} | |
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
extension UIView { | |
/* Example use: myView.addBorder( | |
toSide: .Left, | |
withColor: UIColor.redColor().CGColor, | |
andThickness: 1.0 | |
) | |
*/ | |
enum ViewSide { |
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
/** | |
* Params below: use as-is to generate a hollow two-figure pie chart (donut chart) | |
* @var[width]: pie chart width | |
* @var[height]: pie chart height | |
* @var[innerRadius]: inner (hollow) circle radius | |
* @var[colorRange]: first and second (respective) colors rendered in pie chart | |
* @var | |
*/ | |
var width = 90, | |
height = 90, |
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
'use strict'; | |
/** | |
* 'FIX ELEMENT': Locks element to specified coordinates (or window top) | |
* Optional Directive Attributes: | |
* [number] top: Fixed Element's distance from top (px), | |
* [number] left: Fixed Element's distance from left (px), | |
* [number] right: Fixed Element's distance from right (px), | |
* [number] padStart: Additional px padding used to calculate when the fix should be triggered | |
* [string] target: CSS selector of a sibling element. |