Skip to content

Instantly share code, notes, and snippets.

View philkeys's full-sized avatar

Phil Keys philkeys

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
-- code for https://youtu.be/tp_5c6jaNQE
create table users (
id serial primary key,
first_name varchar(255) not null,
last_name text,
age int,
email text unique not null
);
@philkeys
philkeys / providerCompose.js
Created May 10, 2019 17:31 — forked from stolinski/providerCompose.js
ProviderComposer
function ProviderComposer({ contexts, children }) {
return contexts.reduceRight(
(kids, parent) =>
React.cloneElement(parent, {
children: kids,
}),
children
);
}

Keybase proof

I hereby claim:

  • I am philkeys on github.
  • I am keys2design (https://keybase.io/keys2design) on keybase.
  • I have a public key ASDV3kn66wXcwMfNlsiIwXiYTGXAr8zOnWOytbXpsDCEqgo

To claim this, I am signing this object:

@philkeys
philkeys / airbnb.md
Created October 21, 2015 19:25 — forked from ha404/airbnb.md
Airbnb JavaScript Style Guide() {

Make an .eslintrc file in your project directory:

// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
  "extends": "airbnb"
}

Run this cmd in your shell:

@philkeys
philkeys / WDNE-partials-and-sections-example.js
Last active August 29, 2015 14:26
Web Dev with Node and Express => A partials and sections example
////////////////////
// Partials Example
////////////////////
<div class="weatherWidget">
{{#each partials.weatherContext.locations}}
<div class="location">
<h3>{{name}}</h3>
<a href="{{forecastUrl}}">
<img src="{{iconUrl}}" alt="{{weather}}">
@philkeys
philkeys / WDNE-layouts.js
Created July 29, 2015 04:16
Web Dev with Node and Express => Layouts
// setting up the standard layout
var handlebars = require('express-handlebars')
.create({defaultLayout: 'main' });
// To use the default layout with a view
app.get('/foo', function(req, res) {
res.render('foo');
});
@philkeys
philkeys / WDNE-handlebar-express-include.handlebars
Created July 29, 2015 03:50
Web Dev with Node and Express => Handlebar Basics - Including into an Express Project
// npm install --save express-handlebars
var handlebars = require('express-handlebars')
.create({ defaultLayout: 'main' });
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');
@philkeys
philkeys / WDNE-handlebar-basics.handlebars
Last active August 29, 2015 14:26
Web Dev with Node and Express => Handlebar Basics
{
currency: {
name: 'United States dollars',
abbrev: 'USD'
},
tours: [
{ name: 'Hood River', price: '$99.95' },
{ name: 'Oregon Coast', price: '$159.99' }
],
specialsUrl: '/january-specials',
@philkeys
philkeys / providing-an-api.js
Last active August 29, 2015 14:26
WebDev with Node and Express => Providing an API
// When providing an API, the parameters will most likely be in req.query,
// though you can use req.body. You'll usually return JSON, XML, or plaintext
// and you'll often be using less common HTTP methods like PUT, POST, and DELETE.
////////////////
// GET Endpoint
////////////////
var tours = [
{ id: 0, name: 'Hood River', price: 99.99 },