Skip to content

Instantly share code, notes, and snippets.

Avatar
🐝
Out of box, Pay it forward

Jbee JaeYeopHan

🐝
Out of box, Pay it forward
View GitHub Profile
View .zshrc
export ZSH=/Users/user/.oh-my-zsh
ZSH_THEME="powerlevel9k/powerlevel9k"
# ZSH_THEME="bullet-train"
# ZSH_THEME="agnosterzak"
# ZSH_THEME="agnoster"
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
View progress-bar.jsx
import React from 'react'
import { throttle } from 'lodash-es'
import './index.scss'
export class ProgressBar extends React.Component {
constructor(props) {
super(props)
this.state = {
scrollY: 0,
@JaeYeopHan
JaeYeopHan / util.scss
Created Sep 12, 2018
Utility of scss
View util.scss
// ------------------------------------- //
// Style of Utilities
// ------------------------------------- //
:global(.blind) {
font-size: 0;
height: 0;
left: 0;
line-height: 0;
overflow: hidden;
@JaeYeopHan
JaeYeopHan / externals.config.js
Created Aug 29, 2018
Useful external option of webpack config
View externals.config.js
externals: [
function(context, request, callback) {
if ((/packages\/[^\/]+\//g).test(context)){
if (!/^\./g.test(request)) {
console.log("exclude", request);
return callback(null, 'commonjs ' + request);
}
}
callback();
}],
View helper_types.d.ts
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
@JaeYeopHan
JaeYeopHan / simple_redux.js
Created May 4, 2018
Sample code of simple redux
View simple_redux.js
const counter = (state = 0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
@JaeYeopHan
JaeYeopHan / Card.tsx
Created Apr 24, 2018
Example code react version to Card component in post of state management posting
View Card.tsx
class Card extends React.Component<CardProps> {
do() {
// do something...
}
render() {
const { index } = this.props;
return ( ... );
}
}
@JaeYeopHan
JaeYeopHan / Marker.ts
Last active Apr 24, 2018
Example code to Marker component in post of state management posting
View Marker.ts
export class Marker extends EventEmitter {
constructor(
private id: number,
) {
super();
document.querySelector("marker").addEventListener("click", () => {
// do something
this.trigger("card_action", this.id);
});
@JaeYeopHan
JaeYeopHan / store.js
Created Apr 20, 2018
Simple store sample code
View store.js
class Store {
constructor(state = {}, actions = {}) {
this.state = state;
this.actions = actions;
this.dispatch = (action, data) => {
const newMergedData = this.actions[action](this.state, data);
Object.assign(this.state, newMergedData);
};
}
}
View delay.ts
export const delay = (time: number) => {
return new Promise((resolve, reject) => {
setTimeout(resolve, time);
});
};
You can’t perform that action at this time.