Skip to content

Instantly share code, notes, and snippets.

View mtvillwock's full-sized avatar

Matthew Villwock mtvillwock

View GitHub Profile
#take array of items, use hash table to look up prices and return prices as a float
def get_amount(items)
total = 0.00
prices = {
"taco" => 6.00,
"burrito" => 7.00,
"coke" => 1.25,
"iced" => 1.50
}
@cookiengineer
cookiengineer / console-polyfill.js
Last active August 25, 2021 15:06
A better console API for node.js, with support for all data types and pretty-printing using shell color codes
(function() {
let _std_out = '';
let _std_err = '';
/*
* HELPERS
@bshishov
bshishov / forecasting_metrics.py
Last active April 20, 2024 04:29
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@justsml
justsml / fetch-api-examples.md
Last active February 24, 2024 18:05
JavaScript Fetch API Examples
#!/bin/sh
# Set up Rails app. Run this script immediately after cloning the codebase.
# Exit if any subcommand fails
set -e
# Copy over configs
if ! [ -f .env ]; then
cp .sample.env .env
@mtvillwock
mtvillwock / Gemfile
Created January 19, 2017 05:46 — forked from iamvery/Gemfile
source "https://rubygems.org"
gem "gnuplot"
gem "highline"
@crizstian
crizstian / solid.js
Last active March 15, 2023 02:40
Code examples of SOLID principles for JavaScript
/*
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa
*/
const shapeInterface = (state) => ({
type: 'shapeInterface',
area: () => state.area(state)
})
@zeuxisoo
zeuxisoo / guess-number.go
Last active September 25, 2019 21:42
A simple program ask user to guess the number
package main
import (
"os"
"fmt"
"bufio"
"strings"
"strconv"
"time"
"math/rand"
@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active May 3, 2024 01:51
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer