Skip to content

Instantly share code, notes, and snippets.

@johnwook
johnwook / rename.fish
Last active April 15, 2020 09:06 — forked from premek/mv.sh
Rename files in fish using mv command without typing the full name two times
function rename
if test (count $argv) -ne 1
or test ! -f $argv[1]
command mv $argv
return
end
set newfilename $argv[1]
vared newfilename
command mv -v -- $argv[1] $newfilename
@johnwook
johnwook / index.js
Created January 31, 2018 05:03
micro with apollo-graphql-server
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 November 25, 2016 05:03
Why I like TypeScript — 1 Reliable Mocking with Interface
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 November 8, 2016 05:42
Check which es2015 feature babel-preset-react-native dose not have
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 June 21, 2018 07:20
Spree test environment setting with rspec, factory_girl_rails and spring

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 October 23, 2015 06:27
Spree test environment setting with rspec, factory_girl_rails and spring

Hi

@johnwook
johnwook / introrx.md
Last active August 29, 2015 14:18 — forked from staltz/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.

@johnwook
johnwook / introrx.md
Last active August 29, 2015 14:16 — forked from staltz/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.