Skip to content

Instantly share code, notes, and snippets.

@hagi4u
hagi4u / getNumberSIPrefix.js
Created March 13, 2020 05:26
getNumberSIPrefix.js
export function getNumberSIPrefix(x, options = {}) {
const FLOAT_POINT = options.floatLength || 1;
const METIRC_GAP = options.metircGap || 1;
const UNITS_STRING = [
'million',
'billion',
'trillion',
'quadrillion',
'quintillion',
'sextillion',
/*
* 쉼표 단위의 숫자로 아웃픗을 내야 하는 헬퍼
*/
export function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
/*
* [A,B,C,D] 배열이 있을 때
* 'A, B, C and D' 형태로 영어에서 여러가지 문자들을 나열할 때 필요한
* 아웃풋을 내 주는 헬퍼
*/
export function getEnglishListUpString(x) {
return x.join(', ').replace(/, ([^, ]*)$/, ' and $1');
}
@hagi4u
hagi4u / gulpfile.js
Created February 8, 2019 04:05 — forked from leymannx/gulpfile.js
Gulp Sass with autoprefixer and minify.
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
cssmin = require('gulp-cssnano'),
prefix = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
sassLint = require('gulp-sass-lint'),
sourcemaps = require('gulp-sourcemaps');
// Temporary solution until gulp 4
@hagi4u
hagi4u / chromiumpackages.config
Created October 2, 2018 16:56 — forked from chimmelb/chromiumpackages.config
.ebextensions config file to load NodeJS EB instance with packages needed for Puppeteer/Chromium
packages:
yum:
cups-libs: []
dbus-glib: []
libXrandr: []
libXcursor: []
libXinerama: []
cairo: []
cairo-gobject: []
pango: []
@hagi4u
hagi4u / gist:7a3a9827ca0d77c097fde9478af73b48
Created October 28, 2016 07:51 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@hagi4u
hagi4u / ie8Events.js
Created April 21, 2016 01:22 — forked from chriswrightdesign/ie8Events.js
Polyfill for IE8 Javascript Event Listeners
(function() {
if (!Event.prototype.preventDefault) {
Event.prototype.preventDefault=function() {
this.returnValue=false;
};
}
if (!Event.prototype.stopPropagation) {
Event.prototype.stopPropagation=function() {
this.cancelBubble=true;
};
@hagi4u
hagi4u / inspiration
Created December 23, 2015 08:30 — forked from meodai/inspiration
Sexy Frontend
One-pager / Scroll:
- http://www.leannebentley.co.uk/
- http://forrestlesssleepers.com/
- http://swaywater.com/
- http://mediacityseoul.kr/2016/pre/
- https://ustwo.com/
- http://mailchimp.com/2015/
- http://molamil.com/
- http://www.watchyulelog.com/#/
- http://www.creationsnamale.com/