Skip to content

Instantly share code, notes, and snippets.

View kbingman's full-sized avatar

Keith Bingman kbingman

  • Vancouver, BC Canada
View GitHub Profile
var client = webdriverjs.remote({
desiredCapabilities: {
browserName: browserName
},
logLevel: 'silent'
});
// Extensions to Webdriver
client.addCommand('loginAndPreview', function(callback) {
@kbingman
kbingman / gist:6557074
Created September 13, 2013 22:49
external include for casper.js login and preview
var require = patchRequire(require);
var loginAndPreview = function(baseUrl, bundleLocation, test){
casper.start('http://preview.mobify.com/', function suite() {
// Add a title comment so that you know what's happening and when
casper.test.comment('Lululemon - 2013 Refresh');
// Log out what we are doing
@kbingman
kbingman / gist:6557116
Created September 13, 2013 22:54
lululemon Webdriver.js tests
describe('lululemon', function(){
this.timeout(99999999);
before(function(){
client.init();
});
it('should login', function(done){
client
@kbingman
kbingman / gist:6557121
Created September 13, 2013 22:56
Basic casper.js test
casper.test.begin('Home Page', function(test) {
loginAndPreview(baseUrl, bundleLocation, test);
casper.then(function() {
// Home body Class
test.assertExists('.x-home', 'Home body class');
// Main content
test.assertExists('.x-main', 'Main content');
@kbingman
kbingman / google.feature
Last active August 5, 2019 16:51
A basic test runner to use Yadda with the Nightwatch selenium testing framework.
Feature: Google Demo
Scenario: Google home page
When I open http://google.com
and I should see #viewport
@kbingman
kbingman / gist:c9579ed68bb996b24e68
Last active August 29, 2015 14:19
Building Event Driven Applications with Javascript

Overview of Event Driven Patterns (1hr)

  • Large Scale Applications…
  • Event Driven vs. jQuery and Plugins
  • Get NPM and Dev Environment Setup
  • React in a few lines of jQuery
  • jQuery and DOM events
  • Observer Pattern

Exercises

  • Build a simple Instagram API
@kbingman
kbingman / nodes.ts
Last active October 18, 2019 21:58
Demo Node structure
type UUID = string;
interface BaseNode {
uuid: UUID;
path: string; // parent-uuid/uuid
type: "node" | "section" | "group" | "text";
allowedChildren?: ContentNodes; // Optional because the actual instances of Nodes do not need this
children?: UUID[]; // not all Nodes have children
}
@kbingman
kbingman / fake-listing.ts
Created October 18, 2019 23:23
Fake Listing
import faker from 'faker';
import { makes } from '../../../../test/makes';
import { Listing } from '../../src/types';
faker.seed(42);
export const createFakeListing = (attr?: any): Listing => {
const [make, model] = makes[faker.random.number(makes.length)];
/**
* Fetches a model from the State first, then the API.
* returns a tuple with the data from the API and an updater function that
* updates the server
*/
export const useLens= (
uuid: string
): [Response, SetResponse] => {
// This could be `useSelector` and `useDispatch` if we are using Redux
const [initialData, setData] = useRecoilState(
@kbingman
kbingman / machine.js
Created June 15, 2021 18:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions