Skip to content

Instantly share code, notes, and snippets.

View cs09g's full-sized avatar
🏠
Working from home

SeulGi Choi(Chase) cs09g

🏠
Working from home
View GitHub Profile
@cs09g
cs09g / gist:c5c265cfa14309901ce448d8a320a40a
Created May 2, 2016 08:18
일반 폼을 JSON 을 위한 형태로 변형하기
{
a0: {b0: c0},
a1: b1,
a2: {b2: {c1: d0, c2: d1}}
}
이런 형태의 JSON 을 보내야 하고, 입력 form을 다음과 같이 설정하였을 때 사용하기 위한 코드이다.
<input id="a0.b0">
<input id="a1">
<input id="a2.b2.c1">
<input id="a2.b2.c2">
@cs09g
cs09g / pinterest_grid.js
Last active October 2, 2016 09:48
Pinterest style grid
/*
Pinterest Grid Plugin
Copyright 2014 Mediademons
@author smm 16/04/2014
@modifier cs09g 02/10/2016
@comment:
In the original source, the class of grid element was updated all the time when the page is resized or not.
I added one condition to check the page is resized.
Referenced from: http://www.jqueryscript.net/layout/Simple-jQuery-Plugin-To-Create-Pinterest-Style-Grid-Layout-Pinterest-Grid.html
@cs09g
cs09g / prev.js
Last active September 13, 2018 01:26
vanilla script prev from jquery prev
/*
* It returns previous element sibling
* works like jquery's `prev` but combined selector is not supported
*
*/
var prev = function(target, selector) {
var siblings = target.parentNode.children;
var previousElementSibling;
for (var i = Array.prototype.indexOf.call(siblings, target) - 1; i >= 0; i--) {
@cs09g
cs09g / next.js
Last active September 13, 2018 01:27
vanilla script next from jquery next
/*
* It returns next element sibling
* works like jquery's `next` but combined selector is not supported
*
*/
var next = function(target, selector) {
var siblings = target.parentNode.children;
var nextElementSibling;
for (var i = Array.prototype.indexOf.call(siblings, target) + 1; i < siblings.length; i++) {
@cs09g
cs09g / README.md
Created February 19, 2019 04:10 — forked from roachhd/README.md
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@cs09g
cs09g / what-forces-layout.md
Created July 23, 2019 08:01 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@cs09g
cs09g / camel2kebab.js
Created February 18, 2020 07:39
Convert Camel case to Kebab case
/*
* convert camel case string to kebab case string
* e.g. camelCaseString => camel-case-string
*
* note:
* It doesn't support for weird camel case such as "HTMLElement"
* The first letter of camel case string should be with lower case.
*/
function convertStringCamelToKebab(camel) {
return camel.split("").reduce((acc, char) => [...acc, char < "a" ? `-${char.toLowerCase()}` : char], []).join("");
@cs09g
cs09g / parseCSV.js
Last active June 16, 2020 13:36
[nodejs] parsing remote csv (feat. csv-parser)
const http = require("http");
const csv = require("csv-parser");
const csvPath = "http://remoteurl/some.csv";
const results = [];
http.get(csvPath,
(response) => {
response
.pipe(csv())
@cs09g
cs09g / worker.js
Created August 12, 2020 23:53
Web Worker without creating new .js file
const workerScript = `
// your script here
`;
const blob = new Blob([
workerScript,
], {
type: "text/javascipt"
});
const worker = new Worker(window.URL.createObjectURL(blob));
@cs09g
cs09g / homebrew-permissions-issue.md
Created October 12, 2020 04:13 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*