Skip to content

Instantly share code, notes, and snippets.

Madeline Trotter spicydonuts

Block or report user

Report or block spicydonuts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@spicydonuts
spicydonuts / Ref.js
Created May 31, 2018
react-basic Ref component
View Ref.js
"use strict";
var React = require("react");
var ReactDOM = require("react-dom");
exports.makeRef = function(toMaybe) {
var Ref = function(props) {
this.DOMNode = null;
return this;
};
View keybase.md

Keybase proof

I hereby claim:

  • I am spicydonuts on github.
  • I am spicydonuts (https://keybase.io/spicydonuts) on keybase.
  • I have a public key ASDB7aF8V6QL-8_f2qdmR1L58WYnWWJDOdvVBHep9kgmLgo

To claim this, I am signing this object:

View Client.purs
module Client
( Url
, LoggerConfig
, Logger
, Action
, ActionType
, Queue
, ClientEffects
, defaultLoggerConfig
, createLogger
@spicydonuts
spicydonuts / cookies_normal_.test.ts
Last active Jun 2, 2017
Comparing your usual unit tests to snapshot tests. The output on failure is the same. If I'd been lazier on the normal version and only checked a couple properties the snapshot test would be much more thorough by comparison. You can see why it becomes more beneficial as the data size grows (like a React element tree or an API response).
View cookies_normal_.test.ts
import * as sinon from 'sinon'
import { setCookie, clearCookie } from './cookies'
describe('cookies', () => {
it('setCookie (defaults)', () => {
const spy = sinon.spy()
const ctx = { cookies: { set: spy } }
setCookie(ctx as any, 'test', 'val')
expect(spy.callCount).toBe(1)
expect(spy.firstCall.args).toEqual([
@spicydonuts
spicydonuts / scroll-manager.js
Last active Aug 7, 2019
Scroll Manager for React Router v4
View scroll-manager.js
import React from 'react'
import { func, node, number, object, shape, string } from 'prop-types'
import { withRouter } from 'react-router'
import debounceFn from 'lodash/debounce'
class ScrollManager extends React.Component {
static propTypes = {
children: node.isRequired,
history: shape({
action: string.isRequired,
@spicydonuts
spicydonuts / cloudSettings
Last active Jan 26, 2018
Visual Studio Code Sync Settings Gist
View cloudSettings
{"lastUpload":"2018-01-26T18:05:10.909Z","extensionVersion":"v2.8.7"}
View ReactRouterReduxStaleLinkExample.jsx
import React, { PropTypes } from 'react'
import { createStore } from 'redux'
import { Provider, connect } from 'react-redux'
import Router from 'react-router/BrowserRouter'
import Match from 'react-router/Match'
import Link from 'react-router/Link'
import { compose, getContext } from 'recompose';
const store = createStore((s = {}, a) => s)
View ReactRouterReduxStaleLinkExample.jsx
import React from 'react'
import { createStore } from 'redux'
import { Provider, connect } from 'react-redux'
import Router from 'react-router/BrowserRouter'
import Match from 'react-router/Match'
import Link from 'react-router/Link'
const store = createStore((s = {}, a) => s)
const BasicExample = () => (
View maskedInputValidator.coffee
module = angular.module 'inputHelpers', []
if not Bacon?
console.log 'window.Bacon not found, skipping input validator initialization'
return
module.constant 'bacon', Bacon
_masks =
ssn: 'ddd-dd-dddd'
@spicydonuts
spicydonuts / Module.js
Created May 27, 2016
PureScript: proposed changes to currying
View Module.js
exports.add2Ints = function(a, b) {
return a + b;
};
You can’t perform that action at this time.