Skip to content

Instantly share code, notes, and snippets.

View sslotsky's full-sized avatar
🌶️
Working from home

Sam Slotsky sslotsky

🌶️
Working from home
View GitHub Profile
[@bs.deriving abstract]
type context = {
mutable font: string,
mutable fillStyle: string,
};
[@bs.deriving abstract]
type measurement = {width: float};
[@bs.send]
let continue = left +. context->measureText(matching)->widthGet;
context->fillStyleSet(matchColor);
context->fillText(matching, left, bottom);
context->fillStyleSet(color);
context->fillText(rest, continue, bottom);
let (captured, falling) =
List.partition(w => w.text == ui.input(), state.words);
let (crashed, remaining) = List.partition(w => w.y > ui.height, falling);
let newWords =
remaining |> List.map(word => {...word, y: word.y +. word.velocity});
sam@sam-ThinkPad-T480s:~/till-react-electron$ manifold alias till-macabre-light-brown-cylinder
✔ Resource: till-macabre-light-brown-cylinder (till-macabre-light-brown-cylinder)
Choose from one of Till's credentials
✔ API_KEY
Creating alias for `API_KEY`
✔ Alias Name: REACT_APP_TILL_API_KEY
You have aliased till-macabre-light-brown-cylinder's config key `API_KEY` to `REACT_APP_TILL_API_KEY`.
sam@sam-ThinkPad-T480s:~/till-react-electron$ manifold alias till-macabre-light-brown-cylinder
✔ Resource: till-macabre-light-brown-cylinder (till-macabre-light-brown-cylinder)
import React, { Component } from "react";
import phone from "phone";
import { sendMessage } from "./api";
function isValidPhone(str) {
return phone(str).length > 0;
}
export default class Send extends Component {
state = {
function apiUrl(endpoint) {
const url = new URL(`https://platform.tillmobile.com/api/${endpoint}`);
url.searchParams.set("username", process.env.REACT_APP_TILL_USERNAME);
url.searchParams.set("api_key", process.env.REACT_APP_TILL_API_KEY);
return url;
}
function postData(url, data) {
return fetch(url, {
export function apiUrl(endpoint) {
const url = new URL(`https://platform.tillmobile.com/api/${endpoint}`);
url.searchParams.set("username", process.env.REACT_APP_TILL_USERNAME);
url.searchParams.set("api_key", process.env.REACT_APP_TILL_API_KEY);
return url;
}
function postData(url, data) {
return fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json; charset=utf-8"
},
body: JSON.stringify(data)
});
}
import React from "react";
import { IdentityConsumer } from "./identity";
import Login from "./login";
export default function Home() {
return (
<IdentityConsumer>
{ctx => {
if (ctx.user) {
describe("Greeting", () => {
describe("When logged in", () => {
before(() => {
cy.login(process.env.TEST_SINGLE_EMAIL, process.env.TEST_SINGLE_PASSWORD);
});
it("displays the greeting", () => {
cy.visit("/");
cy
.get('h1[data-cy="user"]')