Skip to content

Instantly share code, notes, and snippets.

View pahund's full-sized avatar

Patrick Hund pahund

View GitHub Profile
@pahund
pahund / dabblet.css
Created April 24, 2012 13:08
CSS animation - glowing black box
/**
* CSS animation - glowing black box
*/
@keyframes rainbow {
from, to { box-shadow: 0 0 15px 0 red }
16% { box-shadow: 0 0 15px 0 yellow }
32% { box-shadow: 0 0 15px 0 green }
48% { box-shadow: 0 0 15px 0 aqua }
64% { box-shadow: 0 0 15px 0 blue }
80% { box-shadow: 0 0 15px 0 fuchsia }
@pahund
pahund / unit-tests.sh
Created May 25, 2017 08:16
Bash script to run Mocha unit tests using a setup file
#!/usr/bin/env bash
mocha \
--compilers js:./test/setup.js \
--recursive \
'./test/**/*Test.js'
@pahund
pahund / setup.js
Last active April 20, 2022 04:35
Using Chai and Jest assertions together with Jest's expect (thanks Ruben Oostinga!)
import chai from 'chai';
import sinonChai from 'sinon-chai';
import chaiAsPromised from 'chai-as-promised';
import chaiEnzyme from 'chai-enzyme';
chai.use(sinonChai);
chai.use(chaiAsPromised);
chai.use(chaiEnzyme());
// Make sure chai and jasmine ".not" play nice together
'../node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/src/selectModular.js\nModule not found: Error: Can\'t resolve \'redux-saga/effects\' in \'/Users/pahund/git/move-webapp/node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/src\'\nresolve \'redux-saga/effects\' in \'/Users/pahund/git/move-webapp/node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/src\'\n Parsed request is a module\n using description file: /Users/pahund/git/move-webapp/node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/package.json (relative path: ./src)\n Field \'browser\' doesn\'t contain a valid alias configuration\n resolve as module\n /Users/pahund/git/move-webapp/node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/src/node_modules doesn\'t exist or is not a directory\n /Users/pahund/git/move-webapp/node_modules/@modular-toolkit/bricks/node_modules/@modular-toolkit/selectors/node_modules d
{
"name": "polly",
"version": "9.3.0",
"description": "MOTOR-TALK discussion forum",
"main": "index.js",
"scripts": {
"build": "npm-run-all --parallel build:client build:server",
"build:client": "NODE_ENV=production ./scripts/build.js client",
"build:client:stats": "NODE_ENV=production ./scripts/build.js client --stats > client-stats.json",
"build:debug": "NODE_ENV=development ./scripts/build.js all",
@pahund
pahund / index.js
Last active October 16, 2018 09:44
Root module of a Brick package
export { default as MyBrick } from './src/components/MyBrick';
export * from './src/actions';
export { default as reducer } from './src/reducer';
export { default as saga } from './src/saga';
export { default as selectors } from './src/selectors';
@pahund
pahund / createInitialState.js
Last active October 14, 2018 20:14
Creating an application's initial state, including a Brick's initial state
import { createInitialState as createInitialHackerNewsState } from '@modular-toolkit/demo-module';
export default config => ({
cookieDomain: config.cookieDomain,
bricks: {
hackerNews: createInitialHackerNewsState({
topStories: [
/* …some top stories data objects… */
]
})
@pahund
pahund / reducer.js
Last active October 14, 2018 20:14
Creating the application's reducer
import { combineReducers } from 'redux';
import { reducer as hackerNews } from '@modular-toolkit/demo-module';
import { reducer as home } from './pages/home';
import { reducer as about } from './pages/about';
import { reducer as contact } from './pages/contact';
export default combineReducers({
bricks: combineReducers({
@pahund
pahund / saga.js
Last active October 14, 2018 20:13
Creating a root Redux Saga for the application
import { all, fork } from 'redux-saga/effects';
import { saga as hackerNews } from '@modular-toolkit/demo-module';
import { saga as home } from './pages/home';
import { saga as about } from './pages/about';
import { saga as contact } from './pages/contact';
const sagas = [hackerNews, home, about, contact];
@pahund
pahund / registerSelectors.js
Last active October 14, 2018 20:13
Registering selectors for use with global state
import { registerSelectorsForUseWithGlobalState } from '@modular-toolkit/selectors';
import { selectors as hackerNews } from '@modular-toolkit/demo-module';
import { selectors as home } from './pages/home';
import { selectors as about } from './pages/about';
import { selectors as contact } from './pages/contact';
const selectorMapping = {
'bricks.hackerNews': hackerNews,