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 / 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 / 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 / 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">