Skip to content

Instantly share code, notes, and snippets.

View irrationnelle's full-sized avatar
🎯
Focusing

irrationnelle irrationnelle

🎯
Focusing
View GitHub Profile
@irrationnelle
irrationnelle / browser-check.component.spec.ts
Created January 21, 2019 12:20
컴포넌트 테스트
import { async, TestBed, ComponentFixture } from '@angular/core/testing';
import { BrowserCheckComponent } from './browser-check.component';
describe('BrowserCheckComponent', () => {
let component: BrowserCheckComponent;
let fixture: ComponentFixture<BrowserCheckComponent>;
beforeEach(
async(() => {
TestBed.configureTestingModule({
@irrationnelle
irrationnelle / package.json
Created January 21, 2019 12:17
jest 설정
{
"name": "pagecall-for-tdd",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"test:jest" : "jest",
},
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts"
import { createSelector } from '@ngrx/store';
export interface State {
evenNums: number[];
oddNums: number[];
}
export const selectSumEvenNums = createSelector(
(state: State) => state.evenNums,
evenNums => evenNums.reduce((prev, curr) => prev + curr)
this.lines$.pipe(
filter(Boolean),
sample(this.frameControl$),
startWith([]),
pairwise()
)
.subscribe(([prev, next]) => {
this.canvasRender.drawDiff(prev, next);
});
@irrationnelle
irrationnelle / package-babel-7.json
Last active May 12, 2018 18:19
바벨 7 package.json
{
"name": "babel7-test",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"dev": "babel-node index.js"
},
"keywords": ["babel7"],
"license": "ISC",
@irrationnelle
irrationnelle / app-ramda-pipeline.js
Last active May 12, 2018 18:30
파이프라인 오퍼레이터 및 람다
import { curry } from 'ramda'; // webpack의 tree-shaking을 사용하기 위해 { curry } 만 추출
const double = n => n * 2;
const increment = n => n + 1;
const add = (x, y) => x + y;
const boundScore = (min, max, score) => Math.max(min, Math.min(max, score));
// pipeline operator 없이 함수들을 조합한 경우
const result1 = double(increment(double(double(5)))); // 42
@irrationnelle
irrationnelle / package.json
Last active August 16, 2018 04:04
webpack 설정과 package.json 모듈 목록
{
"name": "babel-webpack4-exercise",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack --config webpack.development.config.js"
},
"keywords": ["babel", "webpack4"],
"license": "ISC",
@irrationnelle
irrationnelle / fblogin.js
Created April 13, 2018 06:36
fblogin.js
async componentDidMount() {
const { type, token } = await Facebook.logInWithReadPermissionsAsync(
'2060058184212334',
{
permissions: ['public_profile', 'email'],
}
);
if (type === 'success') {
const response = await fetch(
`https://graph.facebook.com/me?access_token=${token}&fields=id,name,email,about,picture`
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
const twoDimensionArray2 = array.reduce((array, number, index) => {
const criteria = 4;
const arrayIndex = Math.floor(index / criteria);
if (!array[arrayIndex]) {
array[arrayIndex] = [];
}
array[arrayIndex] = [...array[arrayIndex], number];
return array;
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
const { length } = array;
const maxLength = 4;
const iteratorCount = length / maxLength;
let twoDimensionArray = [];
for (let i = 0; i < iteratorCount; i++) {
twoDimensionArray = [
...twoDimensionArray,