Skip to content

Instantly share code, notes, and snippets.

Johnwook Choi johnwook

View GitHub Profile
@johnwook
johnwook / index.js
Created Jan 31, 2018
micro with apollo-graphql-server
View index.js
const { microGraphiql, microGraphql } = require("apollo-server-micro");
const { makeExecutableSchema } = require("graphql-tools");
const { send } = require("micro");
const { get, post, router } = require("microrouter");
// Some fake data
const books = [
{
title: "Harry Potter and the Sorcerer's stone",
author: 'J.K. Rowling',
@johnwook
johnwook / test_without_interface.ts
Last active Nov 25, 2016
Why I like TypeScript — 1 Reliable Mocking with Interface
View test_without_interface.ts
describe('sendSMS()', () => {
it('returns status code of smsClient.singleSend method', async () => {
// given
const verification = new Verification();
const mockSMSClient = jest.fn();
// which mocks real response from thir party request
const fakeSMSResponse = {
code: 0,
msg: 'dummy message',
};
@johnwook
johnwook / compareBabelPlugins.js
Last active Nov 8, 2016
Check which es2015 feature babel-preset-react-native dose not have
View compareBabelPlugins.js
const rnKeys = [ 'babel-plugin-react-transform',
'babel-plugin-syntax-async-functions',
'babel-plugin-syntax-class-properties',
'babel-plugin-syntax-trailing-function-commas',
'babel-plugin-transform-class-properties',
'babel-plugin-transform-es2015-function-name',
'babel-plugin-transform-es2015-arrow-functions',
'babel-plugin-transform-es2015-block-scoping',
'babel-plugin-transform-es2015-classes',
'babel-plugin-transform-es2015-computed-properties',
@johnwook
johnwook / README.md
Last active Jun 21, 2018
Spree test environment setting with rspec, factory_girl_rails and spring
View README.md

Environment

  • rspec-rails (3.3.3)
  • factory_girl_rails (4.5.0)
  • spring (1.4.0)
  • spring-commands-rspec (1.0.4)

Problem

  • spring rspec generates errors with spree-generated-factories when it is used the way like require 'spree/testing_support/factories')

Solution

@johnwook
johnwook / README.md
Created Oct 23, 2015
Spree test environment setting with rspec, factory_girl_rails and spring
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

You can’t perform that action at this time.