Skip to content

Instantly share code, notes, and snippets.

View orbitmechanic's full-sized avatar
🎯
Focusing

Orbit Mechanic orbitmechanic

🎯
Focusing
  • Orbital Investments LLC
  • Florida, USA
  • 13:49 (UTC -04:00)
  • LinkedIn in/astrobob
View GitHub Profile
pragma solidity ^0.8.0;
// SPDX-License-Identifier: UNLICENSED
contract Kittycontract {
string public constant name = "TestKitties";
string public constant symbol = "TK";
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
@orbitmechanic
orbitmechanic / gist:006eb50d714fc24c668b4ea9df1f81ab
Created August 25, 2020 01:42
React: Render 2 sequential elements in one ReactDOM.render() call.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
@orbitmechanic
orbitmechanic / Lorum.jsx
Created August 24, 2020 21:25
Transform <div id='hello'> <p>Lorum, ipsum.</p> </div> into JSX
React.createElement(
"div", {
id: "hello"
},
React.createElement(
"p",
null,
"Lorem, ipsum."
)
);
@orbitmechanic
orbitmechanic / Prison.sol
Last active August 6, 2020 21:54
Bugged somehow....
pragma solidity 0.7.0;
// SPDX-License-Identifier: UNLICENSED
contract Prison{
/// A "judge" is just a privilaged address.
struct Prisoner{
uint256 number;
uint256 age;
@orbitmechanic
orbitmechanic / Lineup.sol
Created August 4, 2020 05:31
IoT BootCamp Solidity 101 Day 1 Exercise: Structs, Arrays, Maps.
pragma solidity 0.7.0;
// SPDX-License-Identifier: UNLICENSED
contract Lineup {
// Instead of having a mapping where we store people...
struct Person{
// Modify the person struct...
string name;
string species;
@orbitmechanic
orbitmechanic / arrayFuncts.js
Created July 14, 2020 23:42
Scratch-write the following 4 JS array functions: range(start, end, step), sum(), reverseArray(), and reverseArrayInPlace()
function range(start, end, step = 1){
// expand a range
// presumes integer inputs.
let pile = []; // typecast for members.
if (start > end){
end = [start, start = end][0];
}
do{ pile.push(start);
} while ((start+=Math.abs(step)) <=end);
if (step < 0) reverseArrayInPlace(pile);
@orbitmechanic
orbitmechanic / hideh1s.html
Created July 13, 2020 21:03
Using jQuery to enable a title hide/unhide button
<!DOCTYPE html>
<html>
<header>
<!-- Load jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script>
</header>
<body>
<!-- Define Buttons -->
@orbitmechanic
orbitmechanic / isGreaterThan.js
Created July 11, 2020 04:05
Write a function to return if num2 is greater than num1
function isGreaterThan(num1,num2){
return(num2 > num1);
}
@orbitmechanic
orbitmechanic / isOldEnoughToDrink.js
Created July 11, 2020 03:57
Bar age checker in JavaScript
// write a function called "isOldEnoughToDrink"
function isOldEnoughToDrink(age){
// Given a number, in this case an age
// return validity of drinking in the US
if (age >=21){
return (true);
}else {
return (false);
}
}