$ npm install -g create-react-app
$ create-react-app my-app
var queryParams = window.location.search.substr(1).split('&').reduce(function (qs, query) { | |
var chunks = query.split('='); | |
var key = chunks[0]; | |
var value = decodeURIComponent(chunks[1] || ''); | |
var valueLower = value.trim().toLowerCase(); | |
if (valueLower === 'true' || value === 'false') { | |
value = Boolean(value); | |
} else if (!isNaN(Number(value))) { | |
value = Number(value); | |
} |
When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).
When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.
Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.
So let's go through the one query that's worth memorizing to handle your eager loading.
Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});
{ | |
"AWSEBDockerrunVersion": "1", | |
"Image": { | |
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>", | |
"Update": "true" | |
}, | |
"Ports": [ | |
{ | |
"ContainerPort": "443" | |
} |
#!/usr/bin/env python | |
# Source: http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/#c1 | |
import time | |
from functools import wraps | |
class MWT: | |
"""Memoize With Timeout""" | |
_caches = {} | |
_timeouts = {} |
import datetime | |
import time | |
from functools import wraps | |
from wsgiref.handlers import format_date_time | |
from flask import make_response | |
def cache(expires=None, round_to_minute=False): | |
""" | |
Add Flask cache response headers based on expires in seconds. |
#!/bin/bash | |
# GTK+ and Firefox for Amazon Linux | |
# Written by Joseph Lawson 2012-06-03 | |
# http://joekiller.com | |
# http://joekiller.com/2012/06/03/install-firefox-on-amazon-linux-x86_64-compiling-gtk/ | |
# chmod 755 ./gtk-firefox.sh | |
# sudo ./gtk-firefox.sh | |