Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dakotabryant on github.
  • I am dakotabryant (https://keybase.io/dakotabryant) on keybase.
  • I have a public key whose fingerprint is 5473 42BB 1599 201F B771 07F1 0D18 E7DB A560 7A6C

To claim this, I am signing this object:

@dakotabryant
dakotabryant / cloudSettings
Last active November 18, 2021 20:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-05-22T03:23:08.425Z","extensionVersion":"v2.9.2"}
function runServer(databaseUrl = DATABASE_URL, port = PORT) {
return new Promise((resolve, reject) => {
mongoose.connect(databaseUrl, err => {
if (err) {
return reject(err);
}
server = app.listen(port, () => {
console.log(`Your app is listening on port ${port}`);
resolve();
})
function isBalanced(string) {
let stack = [];
let character;
let parenthesesPos;
for (var i = 0; character = string[i]; i++) {
parenthesesPos = parentheses.indexOf(character);
if(parenthesesPos === -1) {
continue;
}
if(parenthesesPos % 2 === 0) {
//Creates a node containing the data and a reference to the next item
function createNode(data = null, next = null) {
return {
data,
next
};
}
class Stack {
constructor() {
import React from 'react';
import {connect} from 'react-redux';
import {setPrincipal, setInterest, setYears} from '../actions';
// Update this component
export function InterestCalculator(props) {
return (
<form className="interest-calculator"
onSubmit={e => e.preventDefault()}>
db.restaurants.find().pretty();
db.restaurants.find().limit(10).sort({name: 1}).pretty();
db.restaurants.find({_id: ObjectId('5907534d4d2d80aebe4775c8')});
db.restaurants.find({borough: 'Queens'});
db.restaurants.find().count();
db.restaurants.find({'address.zipcode': '11206'}).count();
db.restaurants.remove({_id: ObjectId('5907534b4d2d80aebe471480')});
db.restaurants.updateOne({_id: ObjectId('5907534b4d2d80aebe471481')}, {$set: {name: 'Bizz Bar Bang'}});
db.restaurants.updateMany({'address.zipcode': '10035'}, {$set: {'address.zipcode': '10036'}});
db.restaurants.find({'address.zipcode': '10035'}).count();
@dakotabryant
dakotabryant / blog.sql
Created April 24, 2017 20:29
Blog SQL Drills
CREATE TABLE users(
id serial PRIMARY KEY,
first_name text,
last_name text,
email_address text NOT NULL,
screen_name text NOT NULL
);
CREATE TABLE posts(
author_id int REFERENCES users,
post_id serial PRIMARY KEY,
@dakotabryant
dakotabryant / test.sql
Created April 24, 2017 16:43
SQL Drills for Dakota and Tachyla
-- -- 1. Get all restaurants
-- -- Write a query that returns all of the restaurants, with all of the fields.
SELECT * FROM restaurants;
--
-- 2. Get Italian restaurants
-- Write a query that returns all of the Italian restaurants, with all of the fields
SELECT * FROM restaurants WHERE cuisine = 'Italian';
--
-- 3. Get 10 Italian restaurants, subset of fields
-- Write a query that gets 10 Italian restaurants, returning only the id and name fields.