Skip to content

Instantly share code, notes, and snippets.

💭
bambielli.com

Brian Ambielli bambielli

💭
bambielli.com
Block or report user

Report or block bambielli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View npx-test.js
#!/usr/bin/env node
const secret = 'npx rox';
console.log(`the secret is: ${secret}`);
View map-set-weakmap-weakset.js
// 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 / README.md
Last active Jul 21, 2018
Survey Results
View README.md

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.

View Home.jsx
import React, { Component } from 'react';
// react 16.1.1
class Home extends Component {
constructor(props) {
super(props);
this.state = {
counter: 0,
};
@bambielli
bambielli / map-filter-worksheet.js
Last active Aug 15, 2017
Worksheet to Practice Map / Filter Transformations on Arrays
View map-filter-worksheet.js
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***'
@bambielli
bambielli / es6-primer.js
Last active Aug 15, 2017
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.
View es6-primer.js
/****************
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
****************/
View queries.sql
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 / webpack.conf.js
Last active Apr 30, 2017
Webpack Config for Blog Posts (www.bambielli.com)
View webpack.conf.js
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'],
You can’t perform that action at this time.