Skip to content

Instantly share code, notes, and snippets.

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

Joshua Burke Dangeranger

🦊
🍵 🐕 🚴
View GitHub Profile
@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`);
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 / 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
@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 / open-collective-schema.json
Created February 12, 2019 00:27
Open Collective GraphQL Schema
{
"_queryType": "Query",
"_mutationType": null,
"_subscriptionType": null,
"_directives": [
{
"name": "include",
"description": "Directs the executor to include this field or fragment only when the `if` argument is true.",
"locations": [
"FIELD",
@Dangeranger
Dangeranger / index.html
Created October 3, 2018 15:48
BTVCA: Live demo of iterating over an HTML element collection, 2018-10-03T11-30-00-EST
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.column {
float: left;
}
.row {
clear: both;
@Dangeranger
Dangeranger / hackerNews.js
Created September 5, 2018 15:04
Some of the JavaScript that HackerNews uses for it's site
function $(id) { return document.getElementById(id); }
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] }
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] }
function allof (cl) { return byClass(document, cl) }
function hasClass (el, cl) { var a = el.className.split(' '); return afind(cl, a) }
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!afind(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} }
function remClass (el, cl) { if (el) { var a = el.className.split(' '); arem(a, cl); el.className = a.join(' ') } }
function html (el) { return el ? el.innerHTML : null; }
function attr (el, name) { return el.getAttribute(name) }
function tonum (x) { var n = parseFloat(x); return isNaN(n) ? null : n }

Notes from DevDocs team meeting March 30, 2018

Present:

Thibaut (GitHub: @thibaut) Alex Chafee (@alexch) Joshua Burke (?) Quincy Larson (@quincylarson)

During our 70-minute call, we talked about:

@Dangeranger
Dangeranger / postgres-upgrade-steps.md
Created October 14, 2017 15:00
Upgrading Postgres after brew upgrade
@Dangeranger
Dangeranger / alias_matchers.md
Created March 11, 2017 21:36 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value