Skip to content

Instantly share code, notes, and snippets.

View dschinkel's full-sized avatar
💻

Dave Schinkel dschinkel

💻
View GitHub Profile
import android.content.res.Resources;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
/**
* Created by bapspatil
*/
@pixelprodev
pixelprodev / wallaby.config.js
Created August 27, 2017 04:07
wallaby config
module.exports = function (wallaby) {
return {
files: [
{pattern: 'src/**/*.js'},
{pattern: 'src/**/*.jsx'},
{pattern: 'src/**/*.spec.js', ignore: true},
{pattern: 'src/**/*.json', instrument: false}
],
tests: [
@chengjianhua
chengjianhua / .setup.js
Created March 29, 2017 09:11
The setup for mocha test environment
import { jsdom } from 'jsdom';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
import { shallow, mount, render } from 'enzyme';
chai.use(chaiEnzyme());
global.should = chai.should();
global.shallow = shallow;
@jschomay
jschomay / NestedList.elm
Created March 21, 2017 03:38
Nested List example in Elm
import Html exposing (text)
import List
{- Challenge: flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
(This is a little tricky in Elm because the type system does not allow for lists with different element types. So we have to make a whole new data structure...)
-}
@dschinkel
dschinkel / example-tests-wedotdd.js
Last active December 12, 2017 12:18
Example Tests from Private Repo for WeDoTDD.com
/*
Tools: mocha, chai-enzyme, jsdom, airbnb enzyme
Using WebStorm test runner and WebStorm to write code.
For the prod code, using Flow for type checking
These are isolated unit tests (not integration) that test behavior for particular React components
A big reason why I like React.js vs Vue, Angular, or other types of frameworks or
libraries is the simplicity at which you can test behavior. Also there's no magic going on here in terms of
/*
This list will be continually updated with new templates.
If you have requests for any, please add a comment using the comment box at the bottom of this page.
NOTE: the comments are just to facilitate reading this gist, don't include those in your IntelliJ Live Templates.
some comments are just suggested template abbreviations for the live templates once you add them to your IDE
OSX templates file location examples:
@up1
up1 / LoadingView.java
Last active February 12, 2021 17:13
Android Testing :: Custom View with Robolectric
public class LoadingView extends RelativeLayout {
public LoadingView(Context context) {
super(context);
}
public LoadingView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LoadingView(Context context, AttributeSet attrs, int defStyle) {
@montanaflynn
montanaflynn / CONCURRENCY.md
Last active April 20, 2024 17:00
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.

@markerikson
markerikson / redux-saga-poll-loop.js
Last active February 21, 2023 07:25
Redux-Saga controllable long-polling loop
import { take, put, call, fork, cancel, cancelled } from 'redux-saga/effects'
import {EVENT_POLLING_START, EVENT_POLLING_STOP} from "constants/eventPolls";
import {ClientEventType} from "constants/serverEvents";
function* handleEventA(serverEvent) {
yield put({type : serverEvent.type, payload : {name : serverEvent.eventAData}});
}