Skip to content

Instantly share code, notes, and snippets.

View leightkt's full-sized avatar

Kat Leight leightkt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am leightkt on github.
  • I am kit_kat (https://keybase.io/kit_kat) on keybase.
  • I have a public key ASCi2V7EpSXrHhKM1Xrf2kdOiw0_dhrqeHZznpg8QMTE8Qo

To claim this, I am signing this object:

myCakeRecipe = [flour, sugar, salt, bakingPowder, eggs, blueberries]
wetIngredients = myCakeRecipe.splice(4, 2)
// start at index 4 (eggs) and remove two items
dryIngredients = myCakeRecipe
// [flour, sugar, salt, bakingPowder]
// OK pretend we reset myCakeRecipe to the original Array
myCake = [chocolateLayer, whippedCream, vanillaLayer, fruitFilling, strawberryLayer, frosting]
wholeSlice = myCake.slice()
// gives me ALL the good cakey goodness
bottomSlice = myCake.slice(0, 3)
// gives me the bottom half [chocolateLayer, whippedCream, vanillaLayer]
justTheFrosting = myCake.slice(-1, 1)
// give me just the last item - the frosting!
let BelayChain = {}
const loadBelayChain = () => {
Block.find({})
.then(blocks => {
BelayChain = new Blockchain(blocks)
return BelayChain
})
.then(BelayChain => {
Node.find({})
app.get('/blockchain', function (req, res) {
res.send(BelayChain)
})
app.post('/addcert', function (req, res) {
const data = {
gym_id: req.body.gym_id,
user_member_number: req.body.user_member_number,
cert_type: req.body.cert_type
}
class Blockchain {
constructor(chain){
this.chain = chain
this.difficulty = 4
this.nodeUrl = nodeURL
this.networkNodes = []
}
createGenesisBlock() {
class Block {
constructor(index, timestamp, data, previousHash = '', nonce = 0) {
this.index = index
this.timestamp = timestamp
this.data = data
this.previousHash = previousHash
this.hash = this.calculateHash()
this.nonce = nonce
}
}
this.state.characteristic.writeValue(
new Uint8Array ([0x0F, 0xFF, 0x00, 0x0A, 0x0A, 0x03, 0x00, 0x00])
)
@leightkt
leightkt / Bluetooth.js
Created March 13, 2021 19:39
Bluetooth Component for React
function Bluetooth({ setDevice, setCharacteristic, setServer, setService }) {
const connectToDevice = async () => {
const device = await navigator.bluetooth
.requestDevice({
filters: [
{ namePrefix: "Device Name" },
{ services: [ 'Service ID' ]}
]
})
Need to include search location as part of the results because the gps API will do a degree of correcting- may not pull up same location as searched
Need to add route location to data displayed by each route
Mountain Project API is not returning top 10 results- why?