Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Lowell cowboyd

View GitHub Profile
@cowboyd
cowboyd / wat.rs
Created Oct 28, 2020
Do stuff on windows
View wat.rs
use neon::prelude::*;
use winapi::shared::minwindef::{TRUE, FALSE};
use winapi::um::winnt::LPSTR;
//use winapi::um::synchapi::{WaitForSingleObject};
//use winapi::um::handleapi::CloseHandle;
use winapi::um::processthreadsapi::*;
use winapi::um::consoleapi::*;
use winapi::um::wincon::*;
use std::process::Command;
@cowboyd
cowboyd / signin.test.json
Created Oct 7, 2020
BigTest suite and its raw JSON equivalent
View signin.test.json
{
"description": "Sign In",
"steps": [
{
"description": "visiting \"/\""
},
{
"description": "click on link \"Sign in\""
}
],
@cowboyd
cowboyd / checkin.interactors.js
Created Aug 26, 2020
One-off interactors I wrote for ui-courses and ui-checkin FOLIO modules
View checkin.interactors.js
import { createInteractor, App } from '@bigtest/interactor';
export const Input = createInteractor('Input')({
selector: 'input',
defaultLocator: (elem) => elem.name,
locators: {
byAriaLabel: element => element.ariaLabel
},
actions: {
type: (elem, val) => {
@cowboyd
cowboyd / index.ts
Created Aug 4, 2020
Setup Browser Simulation
View index.ts
import { Server } from 'miragejs';
import { createGraphQLHandler } from '@miragejs/graphql';
import { schema as schemaSource } from '@self/graphql';
import { factories } from './factories';
export interface Simulation {
create<T>(modelName: string, data?: Record<string, unknown>): T;
createList<T>(modelName: string, count: number): T[];
@cowboyd
cowboyd / schema.graphql
Last active Jul 30, 2020
Try to get factories working with mirage graphql
View schema.graphql
type Company{
id: ID!
name: String!
}
type Query {
companies: [Company!]!
}
@cowboyd
cowboyd / lsp-start-plain.el
Created Jul 24, 2020
Enhanced version of start plain that includes typescript-mode and json-mode
View lsp-start-plain.el
;;; lsp-start-plain.el --- LSP mode quick starter -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Ivan Yonchovski
;; Author: Zhu Zihao <all_but_last@163.com>
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@cowboyd
cowboyd / index.feature
Last active Jul 21, 2020
BigTest Cucumber plugin
View index.feature
Feature: Dashboard
Scenario: Viewing the Index
Given I navigate to /
Then I see the logo in the header
@cowboyd
cowboyd / operation.ts
Last active Jul 10, 2020
Proposed Effection operations that are non-ambiguous
View operation.ts
// Operation is an un-ambiguous union.
export type Operation<T = unknown> = Promise<T> | OperationIterator<T> | OperationConstructor<T> | AtomicOperation<T>;
// Any generator, any iterator that produces operations can be used.
export type OperationIterator<T> = Iterator<Operation<unknown>, T, any>;
// used anywhere we currently have to use a control function.
// the evaluator never yields control when evaluating this one, so operation
// is guaranteed to be executed in the same tick of the runloop as its caller
interface AtomicOperation<T> {
@cowboyd
cowboyd / calculator-intermediate.ts
Created Jun 23, 2020
An intermediate module describing a gherkin feature
View calculator-intermediate.ts
// compile step definitions into some importable file
import { TestImplementation, Context } from '@bigtest/suite';
import stepDefinitions from './step-definitions';
const feature: TestImplementation = {
description: "Feature: Calculator",
steps: [],
@cowboyd
cowboyd / run-command.js
Last active Jun 23, 2020
catch exceptions in async computations
View run-command.js
function* runCommand({
pkg,
command,
cwd,
pkgPath,
log = `running command for ${pkg}`,
}) {
try {
yield function*() {
console.log(log);
You can’t perform that action at this time.