Skip to content

Instantly share code, notes, and snippets.

Avatar
🏒

Chasen Bettinger chasen-bettinger

🏒
View GitHub Profile
View docker-compose.yml
version: '3'
services:
db:
image: mysql:5.7
ports:
- "8081:3306"
volumes:
- ./sql:/docker-entrypoint-initdb.d
restart: always
environment:
View gist:3a77154ff674d4972182424a65549019
Verifying my Blockstack ID is secured with the address 1Ak8np9dvD8ytQ7zL2E77kSecbUCCQbfea https://explorer.blockstack.org/address/1Ak8np9dvD8ytQ7zL2E77kSecbUCCQbfea
@chasen-bettinger
chasen-bettinger / 0_reuse_code.js
Created Mar 25, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View isArray.js
// check to see if a variable is an array
// from [Douglas_Crockford]_JavaScript_The_Good_Parts
var is_array = function (value) {
return value &&
typeof value === 'object' &&
typeof value.length === 'number' &&
typeof value.splice === 'function' &&
!(value.propertyIsEnumerable('length'));
};
View astronautArrays.js
var moonWalkers = [
"Neil Armstrong",
"Buzz Aldrin",
"Pete Conrad",
"Alan Bean",
"Alan Shepard",
"Edgar Mitchell",
"David Scott",
"James Irwin",
"John Young",
@chasen-bettinger
chasen-bettinger / numberOfBytes.js
Created Feb 24, 2017
Parse a JSON with JavaScript
View numberOfBytes.js
// Iterate through the localizedRuleNames in ruleResults and
// return an array of their strings.
function ruleList(results) {
var localizedRuleNamesArr = [];
var locationToIterate = results.formattedResults.ruleResults
for(var rule in locationToIterate) {
if(locationToIterate.hasOwnProperty(rule)) {
localizedRuleNamesArr.push(locationToIterate[rule].localizedRuleName);
}
}
@chasen-bettinger
chasen-bettinger / getRelationship.js
Created Feb 24, 2017
Compare the relationship between two variables
View getRelationship.js
function getRelationship(x, y) {
if(x !== x) {
return "Can't compare relationships because " + x + " and undefined are not numbers";
}
if (typeof x != 'number' || typeof y != 'number') {
if(arguments.length === 2) {
if(typeof x != 'number' && typeof y != 'number') {
return "Can't compare relationships because " + x + " and " + y + " are not numbers";