Skip to content

Instantly share code, notes, and snippets.

View bambielli's full-sized avatar
💭
bambielli.com

Brian Ambielli bambielli

💭
bambielli.com
View GitHub Profile
@bambielli
bambielli / webpack.conf.js
Last active April 30, 2017 18:52
Webpack Config for Blog Posts (www.bambielli.com)
const webpack = require('webpack')
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const buildPath = '/build/'
module.exports = {
entry: {
bundle: ['./static-assets/index.js'],
vendor: ['react'],
USE tutor_db;
-- Find the subjects that users teach
SELECT user.name, subject.name as subject_name
FROM user_subject
INNER JOIN user on user.id=user_subject.user_id
INNER JOIN subject on subject.id=user_subject.subject_id;
-- Get availability for users where they aren't already booked.
SELECT name, day, time, booked
@bambielli
bambielli / es6-primer.js
Last active August 15, 2017 01:59
A primer for es6. Meant to be run in a node environment. Make sure you're on node 8.3.0 if you want to test out the spread operator.
/****************
ES6 FEATURE
let && const: new ways to define variables more expresively
let --> defines a mutable variable
const --> defines an immutable variable
- NOTE: if a `const` is assigned to a reference type (an object), properties of that reference can still change.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
****************/
@bambielli
bambielli / map-filter-worksheet.js
Last active August 15, 2017 03:12
Worksheet to Practice Map / Filter Transformations on Arrays
const data = [{isSpecial: true, specialPoints: 10}, {isSpecial: false, specialPoints: 5}, {isSpecial: true, specialPoints: 15}];
// Using filter, return a new array of objects that are "special".
const specialArray = '***write code here***'
// Using map, return a new array that doubles the points of all items from the filtered 'specialArray'
const doublySpecialArray = '***write code here***'
import React, { Component } from 'react';
// react 16.1.1
class Home extends Component {
constructor(props) {
super(props);
this.state = {
counter: 0,
};
@bambielli
bambielli / README.md
Last active July 21, 2018 15:50
Survey Results

This gist contains survey results from a survey I created for my Human Computer Interaction course.

This survey was part of the execution of qualitative evaluation for a textual design alternative for an apple pay integration that would select the best credit card for you at purchase time, based on the amount of cash back you would receive from that purchase.

Here is the textual prototype survey participants evaluated:

“This idea is an apple pay integration. This integration will be smart enough that, when you select apple pay at checkout, it will choose the best credit card to use for the type of purchase you are about to make, based on the active cash back rewards you have available to you. It will update your active cash back rewards automatically as they change from quarter to quarter.”

The population for this survey was limited to students in my HCI class. These students are internationally located, but with a high concentration of US residents.

@bambielli
bambielli / map-set-weakmap-weakset.js
Created October 1, 2018 02:41
Map Set WeakMap WeakSet
// Today I learned about some intracicies of Map, Set, WeakMap and WeakSet
/**
Map
1. Maps can have non-string keys, even objects! Any value is valid, including NaN.
2. When iterating over Maps, insertion order is preserved for iteration.
3. Construct a Map from an object using Object.entries(obj). This converts an object to Map's expected format of nested arrays.
4. Has .keys(), .values(), and .entries() methods.
*/
@bambielli
bambielli / npx-test.js
Last active January 11, 2019 11:02
npx-test
#!/usr/bin/env node
const secret = 'npx rox';
console.log(`the secret is: ${secret}`);