Skip to content

Instantly share code, notes, and snippets.

🇺🇸
Out sick

hax0r webhacking

🇺🇸
Out sick
Block or report user

Report or block webhacking

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 tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"typeRoots": ["./node_modules/@types", "./src/@types"],
"baseUrl": "./",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
View webpack.config.js
// const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const slsw = require('serverless-webpack');
const isLocal = slsw.lib.webpack.isLocal;
module.exports = {
mode: isLocal ? 'development' : 'production',
// entry: slsw.lib.entries,
entry: './src/main.ts',
View gist:7fe4cf14210a72d7aac26bbcadcff3c0
/*
지방의 수는 3 이상 100,000 이하인 자연수입니다.
각 지방에서 요청하는 예산은 1 이상 100,000 이하인 자연수입니다.
총 예산은 지방의 수 이상 1,000,000,000 이하인 자연수입니다.
*/
function solution(budgets, M) {
var answer = 0,
mid = 0,
minimum = 0,
maximum = 100000,
View rxjs-example-05.ts
import {from} from 'rxjs/internal/observable/from';
import {distinctUntilChanged} from 'rxjs/operators';
const source = [
{x: 1, y: 1},
{x: 1, y: 2},
{x: 3, y: 5},
{x: 6, y: 9},
{x: 2, y: 1},
{x: 3, y: 5},
View rxjs-example-04.ts
import {from} from 'rxjs/internal/observable/from';
import {bufferCount, count, filter} from 'rxjs/operators';
const source = 'acbqibekboabkdnopenmenuckofqamdqlvopenmenuasdqweascqwekasdcnaskdeqweqwcasdopenmenu';
const sequence$ = from(source);
const matchSequence = 'openmenu';
sequence$
.pipe(
bufferCount(matchSequence.length, 1),
View rxjs-example-03.ts
import {fromEvent} from 'rxjs/internal/observable/fromEvent';
import {interval} from 'rxjs/internal/observable/interval';
import {buffer, filter, map} from 'rxjs/operators';
let stream$ = fromEvent(document.getElementById('hit-me') as HTMLElement, 'click');
stream$
.pipe(
buffer(interval(3000)),
map((val: number[]) => val.length),
View rxjs-example-02.ts
import {fromEvent} from 'rxjs/internal/observable/fromEvent';
import {buffer, map} from 'rxjs/operators';
import {interval} from 'rxjs/internal/observable/interval';
let stream$ = fromEvent(document.getElementById('hit-me'), 'click');
stream$
.pipe(
buffer(interval(3000)),
map((val) => val.length)
)
View rxjs-example-01.ts
import {fromEvent} from 'rxjs/internal/observable/fromEvent';
const source$ = fromEvent(document.getElementById('hit-me'), 'click');
source$.subscribe((event: Event) => {
const currentClicked = ( event.currentTarget.getAttribute('number-of-clicked') ) ? event.currentTarget.getAttribute('number-of-clicked') : 1;
event.currentTarget.setAttribute('number-of-clicked', parseInt(currentClicked) + 1);
console.log(parseInt(currentClicked))
});
View replay-subject.example1.ts
const subject = new ReplaySubject(1 /* buffer size */);
View replay-subject.example.ts
import {ReplaySubject} from 'rxjs/internal/ReplaySubject';
const subject = new ReplaySubject(2 /* buffer size */);
subject.next('a');
subject.next('b');
subject.next('c');
const subscription = subject.subscribe((x: string) => {
console.log(`Next: ${x}`);
You can’t perform that action at this time.