Skip to content

Instantly share code, notes, and snippets.

Avatar

Tucker Blue tuckcodes

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am tuckcodes on github.
  • I am tuckcodes (https://keybase.io/tuckcodes) on keybase.
  • I have a public key ASBkr47X56OI9DmqWoSQhzQXr0iOLV02-hSxo66cyC-fago

To claim this, I am signing this object:

@tuckcodes
tuckcodes / 0.5.1_solidity.sol
Created Jan 1, 2019
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
View 0.5.1_solidity.sol
pragma solidity 0.5.1;
contract DogContract {
struct Dog {
string name;
uint age;
}
@tuckcodes
tuckcodes / even-odd-without-modulo.js
Last active Dec 22, 2018
Discern even or odd WITHOUT using the modulo operator
View even-odd-without-modulo.js
// Even or Odd
// Determine even or odd WITHOUT the modulo operator
// My aim is to add or subtract two from the input until I reach 0 or 1
// If it concludes on 0 it is even, and if on 1 it is odd
function determineIfEven(num1) {
switch (!isNaN(num1)) {
case (num1 == 0): // If the input is 0 then even
console.log(true); // Output boolean true
break;
case (num1 == 1): // If the input is 1 then not even
@tuckcodes
tuckcodes / stupid-triangle.js
Created Dec 22, 2018
Simple triangle thing
View stupid-triangle.js
// Triangle Loop
// Just making a triangle kinda thing in the console
let charPound = "#";
for (let index = 0; index < 8; index++) {
console.log(charPound.repeat(index));
}
@tuckcodes
tuckcodes / math-min-rebuild.js
Created Dec 22, 2018
Rebuild the math.min method
View math-min-rebuild.js
// Min rebuild
// Rebuild the min function
function smallestNum(...numbersArray) {
lowestNumber = true;
numbersArray.forEach(number => {
if (lowestNumber == true) {
lowestNumber = number;
}
if (lowestNumber > number) {
lowestNumber = number
@tuckcodes
tuckcodes / bean-counter.js
Created Dec 22, 2018
Count the specific letter occurrence in a string with the string and letter being a parameter each
View bean-counter.js
// Bean Counter
// Determine how many matching letters there are in an input string from an input character
function countChar(stringInput, charSelect) {
stringInput = String(stringInput);
let letterArray = Array.from(stringInput), count = 0;
letterArray.forEach(letter => {
if (letter == charSelect) {
count++;
@tuckcodes
tuckcodes / fizz-buzz.js
Created Dec 22, 2018
Traditional fizz buzz but with a switch statement for fun
View fizz-buzz.js
// FizzBuzz
// Good ol'fashioned fizz buzz
// Decided to use a switch statement to mix it up a little
for (let numStart = 0; numStart<100; numStart++) {
switch (true) {
case ((numStart>0) && (numStart%3 == 0)):
console.log("Fizz");
break;
case ((numStart>0) && (numStart%5 == 0)):
@tuckcodes
tuckcodes / chess-board.js
Created Dec 22, 2018
Make a chess board kinda thing with a row amount parameter
View chess-board.js
// Chess Board
// Create a chess board with a congigurable row amount parameter
let size = prompt(Number("How many rows?")), board = "# # # #";
for (let count = 0; count < size; count++) {
if (count%2==0) {
console.log(" " + board)
} else {
console.log(board);
}
}