Skip to content

Instantly share code, notes, and snippets.

@cvburgess
cvburgess / README.md
Last active October 30, 2018 14:23
Readme Boilerplate

Getting started

Running Locally

Note: Make sure you have the node and npm versions listed in package.json

  1. Install dependencies: npm install
  2. Start a dev server server: npm run dev (watches for changes and restarts automatically )
  3. ...or start a production server: npm start
@cvburgess
cvburgess / SQLCache.js
Created August 28, 2018 02:23
Knex - caching
const { InMemoryLRUCache } = require("apollo-server-caching");
class SQLCache {
constructor(cache = new InMemoryLRUCache()) {
this.cache = cache;
}
async knexPlugin(knexThen, ctx, args) {
const isSelectStatement = ctx._method === "select";
@cvburgess
cvburgess / SQLCache.js
Created August 28, 2018 02:13
Knex - caching and batching
const { InMemoryLRUCache } = require("apollo-server-caching");
const DataLoader = require("dataloader");
class SQLCache {
constructor(cache = new InMemoryLRUCache(), knex) {
this.cache = cache;
this.loader = new DataLoader(queries =>
Promise.all(queries.map(query => knexInstance.raw(query)))
);
}
@cvburgess
cvburgess / Data-demo.jsx
Last active March 5, 2018 21:11
Demo of withData useage for internal presentation
import { withData } from 'perch-data';
import ChartWidget from '../Shared/ObservableDashboard/ChartWidget';
import { getObservableResults } from '../../actions/search';
class ActivityByCommunity extends React.Component {
constructor(props) {
super(props);
this.state = { sortDirection: 'desc' };
}
@cvburgess
cvburgess / create_branch_from_tag
Created September 29, 2015 19:15 — forked from nickfloyd/create_branch_from_tag
To create a branch from a tag
-Go to the starting point of the project
>> git checkout origin master
-fetch all objects
>> git fetch origin
-Make the branch from the tag
>> git branch new_branch tag_name
-Checkout the branch
>> git checkout new_branch
-Push the branch up
>> git push origin new_branch
@cvburgess
cvburgess / tetrad.m
Created September 16, 2015 18:02
Creates a tetrad color palette from a single UIColor
+ (NSArray*)tetradPaletteFromUIColor:(UIColor*)color {
NSMutableArray *palette = [[NSMutableArray alloc] init];
CGFloat primary_hue;
CGFloat saturation;
CGFloat brightness;
CGFloat alpha;
BOOL success = [color getHue:&primary_hue saturation:&saturation brightness:&brightness alpha:&alpha];
@cvburgess
cvburgess / Backpacking_Essentials.md
Last active August 29, 2015 14:02
Backpacking Essentials

Safety

  • Compass
  • Sunscreen
  • Headlamp
  • Extra batteries
  • First-aid kit
  • Bear spray

Things to Wear

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grid Template for Bootstrap</title>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
</head>
<body>