- 1 lb spaghetti or linguine
- 1 lb shrimp, cleaned and deveined
- 1/4 cup olive oil
- 1/2 cup butter (1 stick)
- 1 cup white wine
- finely chopped garlic, as desired (4-5 gloves is good)
- 1 medium shallot, finely chopped
- sliced mushrooms, as desired (~2-3 cups)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function epic(action$) { | |
return Observable.ofType('FETCH_FOO') | |
.mergeMap(() => | |
ajax('/api/foos') | |
.map((data) => ({ | |
type: 'FETCH_FOO_SUCCESS', | |
data, | |
})) | |
.catch((err) => [{ | |
type: 'FETCH_FOO_ERROR', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is something I threw together as a quick test. | |
* It's a contrived example because you'd likely just have one component for message and include something like: | |
* <p>{message.body || 'No message.'}</p> | |
* | |
* However, when I'm writing components, I often have to handle different UI treatments depending on the data. | |
* It's the same overall component, same logical chunk of UI, but it might take on three different forms, and | |
* those differences may have drastically different markup. Those situations make it easy start writing a lot | |
* of imperative code, and I always feel dissatisfied when I have to include if statements in my render functions. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configureMockStore from 'redux-mock-store'; | |
import { createEpicMiddleware, combineEpics } from 'redux-observable'; | |
import { Observable } from 'rxjs'; | |
import userEpic from './userEpic.js'; | |
import { fetchUser } from '../actionCreators/users.js'; | |
describe('userEpic', () => { | |
// set up our mock data and mock request function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { actionCreatorFactory } from 'typescript-fsa' | |
import { ajaxGetJSON, ajaxPost, ajaxPut, ajaxDelete } from 'rxjs' | |
import { combineEpics } from 'redux-observable' | |
const createEpic = (fsa, request, prepare) => | |
(action$, store) => | |
action$.ofType(fsa.started.type) | |
.map( | |
action => (typeof prepare === 'function' ? prepare(action, store.getState() : action.payload) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Downshift from 'downshift'; | |
import Rx from 'rxjs'; | |
import { ajax } from 'rxjs/observable/dom/ajax'; | |
const makeUrl = search => | |
`https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srsearch=${encodeURIComponent(str)}`; | |
const input$ = new Rx.Subject(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require("assert"); | |
function matchingBrackets(str) { | |
// TODO: implement me! | |
} | |
// Test cases | |
assert.strictEqual(matchingBrackets("{}"), true); | |
assert.strictEqual(matchingBrackets("{"), false); | |
assert.strictEqual(matchingBrackets(""), true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
redis: | |
image: "redis:alpine" | |
ports: | |
- 6379:6379 | |
postgres: | |
image: "postgres:13.1" | |
ports: | |
- 5432:5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -s redirects && -z "$(tail -c 1 redirects)" ]]; then exit 1; else echo "redirects file newline check OK."; fi; |