Skip to content

Instantly share code, notes, and snippets.

View AlexFrazer's full-sized avatar
🦊
🦊🦊🦊

Frazer AlexFrazer

🦊
🦊🦊🦊
View GitHub Profile
async function getX() {
let users = [];
try {
x = await getUsers();
} catch (e) { }
return x;
}
// vs
const path = require('path');
const webpack = require('webpack');
const HTMLPlugin = require('webpack-html-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const basePath = path.resolve(__dirname, './app/');
const outPath = path.resolve(__dirname, './dist');
module.exports = {
{
"extends": "airbnb",
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"envs": {
"es6": true,
import React, { Component, PropTypes } from 'react';
export default class List extends Component {
static propTypes = {
data: PropTypes.func.isRequired,
retrieve: PropTypes.func.isRequired,
children: PropTypes.func.isRequired,
isFetching: PropTypes.bool.isRequired,
};
import React, { Component, PropTypes } from 'react';
export default class LinkModal extends Component {
static propTypes = {
show: PropTypes.func.isRequired,
close: PropTypes.func.isRequired,
link: PropTypes.string.isRequired,
};
state = { clipboard: null };
// @flow
export const OPEN = 'sidebar/OPEN';
export const CLOSE = 'sidebar/CLOSE';
export function open(): { type: string } {
return { type: OPEN };
}
export function close(): { type: string } {
return { type: CLOSE };
// current user is { id: 1 }
[{
id: 1,
users: [{
id: 1,
name: 'Cat',
online: true,
}, {
id: 2,
name: 'Dog',
@AlexFrazer
AlexFrazer / migration.js
Created November 4, 2016 13:30
Basic initial migration
const config = require('../knexfile');
const env = process.env.NODE_ENV || 'development';
const { connection: { database, user, password } } = config[env];
exports.up = function (knex, Promise) {
return knex.raw(`CREATE USER ${user} WITH PASSWORD ${password} CREATEDB`)
.then(() => knex.raw(`CREATE DATABASE IF NOT EXISTS ${connection}`))
.then(() => Promise.all([
knex.schema.createTable('users', function (table) {
import click
from flask.cli import AppGroup
@click.command(cls=AppGroup)
def cli():
" Manage the regions "
@cli.command()
@click.argument('region_id')
def broadcast_weather_report(region_id):
import enum
from weather import db
class StatesType(enum.Enum):
Alabama = "Alabama"
Alaska = "Alaska"
Arizona = "Arizona"
Arkansas = "Arkansas"
California = "California"
Colorado = "Colorado"