This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file should be a repo but oh well.. | |
* This code will check a magnetic sensor value and send a text message via twilio if the circuit remains open for an extended amount of time | |
* Used Koa for an http server so I could read the current state via clients. | |
**/ | |
const Koa = require("koa") | |
const Router = require("koa-router") | |
const rpio = require("rpio") | |
const cors = require("@koa/cors") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { render } from "react-dom"; | |
import React from "react"; | |
import { Stage, Text, Layer, Line, Circle } from "react-konva"; | |
const originalPoints = [ | |
{ x: 294, y: 344 }, | |
{ x: 322, y: 451 }, | |
{ x: 547, y: 379 }, | |
{ x: 505, y: 251 }, | |
{ x: 417, y: 317 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resolve(path, obj=self, separator='.') { | |
return (Array.isArray(path) ? path : path.split(separator)).reduce((prev, curr) => prev && prev[curr], obj) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatten = (obj, prefix = '') => { | |
return Object.keys(obj).reduce((acc, key) => { | |
const value = obj[key] | |
const prefixedKey = `${prefix}${prefix !== '' ? '.' : ''}${key}` | |
if (typeof value === "string") { | |
return { | |
...acc, | |
prefixedKey]: curr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example Usage: | |
import React from "react" | |
import Pagination, { withPagination } from "components/Pagination" | |
const DeviceList = ({ data, setCurrentPage, currentPage }) => { | |
const perPage = 25 | |
const lastIndex = currentPage * perPage | |
const firstIndex = lastIndex - perPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POWERLEVEL9K_MODE='nerdfont-complete' | |
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{cyan}\u256D\u2500%f" | |
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{014}\u2570%F{cyan}\uF460%F{073}\uF460%F{109}\uF460%f " | |
POWERLEVEL9K_STATUS_VERBOSE=false | |
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true | |
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status dir vcs) | |
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(time) | |
POWERLEVEL9K_PROMPT_ON_NEWLINE=true |