Skip to content

Instantly share code, notes, and snippets.

View tuckcodes's full-sized avatar

Tucker Blue tuckcodes

View GitHub Profile

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 January 1, 2019 10:16
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=
pragma solidity 0.5.1;
contract DogContract {
struct Dog {
string name;
uint age;
}
@tuckcodes
tuckcodes / even-odd-without-modulo.js
Last active December 22, 2018 08:13
Discern even or odd WITHOUT using the modulo operator
// 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 December 22, 2018 07:13
Simple triangle thing
// 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 December 22, 2018 07:12
Rebuild the math.min method
// 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 December 22, 2018 07:10
Count the specific letter occurrence in a string with the string and letter being a parameter each
// 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 December 22, 2018 07:09
Traditional fizz buzz but with a switch statement for fun
// 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 December 22, 2018 07:08
Make a chess board kinda thing with a row amount parameter
// 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);
}
}