Skip to content

Instantly share code, notes, and snippets.

View Dangeranger's full-sized avatar
🦊
🍵 🐕 🚴

Joshua Burke Dangeranger

🦊
🍵 🐕 🚴
View GitHub Profile
@Dangeranger
Dangeranger / rbenv-linux-install.org
Last active May 31, 2019 19:14
Installation and setup of Rbenv and Ruby on Linux systems

Ruby Installation on Linux via Rbenv

Prerequisites

Make sure that you have the required build tools for Ruby.

sudo apt-get install autoconf automake bison build-essential curl \
 git-core libapr1 libaprutil1 libc6-dev libltdl-dev libreadline6  \
 libreadline6-dev libsqlite3-0 libsqlite3-dev libssl-dev libtool  \
@Dangeranger
Dangeranger / binary-search-algorithm-example.txt
Last active June 9, 2019 20:44
A quick example of the binary search algorithm zeroing in on a secret number.
// Example Binary Search Algorithm
// Secret Number = 17
// Guess is the midpoint of the Max and Min
// e.g. Math.floor((Max - Min) / 2) + 1
// ==============================================================
// Round-1
// Guess = 50
// Answer = 'lower'
// 1 50 100
// Min-----------------------Guess---------------------------- Max
var gridOne = {
cells: [
["x", "o", "o"],
["o", "x", "o"],
["x", "x", "o"],
],
column: function(number) {
number = number - 1;
return [
this.cells[0][number],
@Dangeranger
Dangeranger / index.html
Last active July 12, 2019 11:50
Code showing how to use Promises or Async/Await for making fetch requests.
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>Hello Promises!</h1>
<script>
async function getLatLongAsync(address) {
try {
// encodeURI(someString) converts the string to URL safe characters
const response = await fetch(`https://nominatim.openstreetmap.org/search/?q=${encodeURI(address)}&format=json`);
@Dangeranger
Dangeranger / vtCountyPolygons.js
Created July 19, 2019 15:11
GeoJSON which represents all the county borders in Vermont.
let countyData = {"type":"FeatureCollection", "features": [
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-71.89930556685702,45.007967038225665],[-71.90639495793083,44.972034737155035],[-71.91256962807861,44.941586303684424],[-71.92014649911405,44.901534959428105],[-71.88768224564625,44.88414402607262],[-71.87785847130161,44.87877145078154],[-71.89809815971485,44.85887096608518],[-71.91995085333807,44.83690375089462],[-71.92931744591431,44.82964832537888],[-71.93683910186412,44.822541420493785],[-71.97482609720078,44.78724062557453],[-71.93929273719223,44.76945013143421],[-71.95140936345551,44.757495286499],[-71.9750836685309,44.734647555007385],[-71.99123898495328,44.71882667502445],[-71.9995389566063,44.711086418730154],[-72.01145503900082,44.698841717258844],[-72.05216258622916,44.718994083231216],[-72.08972446262909,44.73767356435365],[-72.11436109432913,44.74982120146015],[-72.11197436534691,44.74320799587801],[-72.10194093000278,44.71773911466352],[-72.08929717635908,44.68509008796579]
@Dangeranger
Dangeranger / botium-heroku-build-errors.txt
Created August 16, 2019 16:31
Output of the Heroku build process following using the "Deploy to Heroku" button
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
@Dangeranger
Dangeranger / node.js.yml
Created July 31, 2020 15:28
The corrected workflow file for step.12 of the Github learning lab
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
@Dangeranger
Dangeranger / sleeper.js
Last active November 4, 2020 02:17
Code example from class on 2020-11-03, for showing objects from classes working together
class Room {
constructor() {
console.log('making the room');
this.secretItem = { note: 'in the dresser' };
this.key = 'painting hall piece';
}
look(awareness) {
console.log('as you look around the room.....');
console.log({ awareness });
@Dangeranger
Dangeranger / index.starter.js
Created April 8, 2021 23:48
Helper files for Guess the Number
const readline = require('readline');
const rl = readline.createInterface(process.stdin, process.stdout);
function ask(questionText) {
return new Promise((resolve, reject) => {
rl.question(questionText, resolve);
});
}
start();
@Dangeranger
Dangeranger / cakeMaker-starter.js
Created April 20, 2021 22:49
Some starter code for the cakeMaker lab. Please finish me.
let cakesToMake = [
{ flavor: "Chocolate", icing: "Peanut Butter", decoration: "Sprinkles" },
{ flavor: "Vanilla", icing: "Lime", decoration: "Coconut" },
{ flavor: "Strawberry", icing: "Vanilla", decoration: "Fruit" },
];
let cakeList = [
["Chocolate", "Peanut Butter", "Sprinkles"],
["Vanilla", "Lime", "Coconut"],
["Strawberry", "Vanilla", "Fruit"],