Skip to content

Instantly share code, notes, and snippets.

irrationnelle irrationnelle

Block or report user

Report or block irrationnelle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View browser-check.component.ts
import { Component, OnInit } from "@angular/core";
@Component({
selector: "browser-check",
templateUrl: "./browser-check.component.html",
styleUrls: ["./browser-check.component.scss"]
})
export class BrowserCheckComponent implements OnInit {
constructor() {}
View browser-check.component.spec.ts
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({
View package.json
{
"name": "pagecall-for-tdd",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"test:jest" : "jest",
},
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts"
View ngrx-example-selectors.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)
View ngrx-example-rxjs.ts
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
바벨 7 package.json
View package-babel-7.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
파이프라인 오퍼레이터 및 람다
View app-ramda-pipeline.js
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 Aug 16, 2018
webpack 설정과 package.json 모듈 목록
View 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",
View 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`
View reduceFor2D.js
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;
You can’t perform that action at this time.