Skip to content

Instantly share code, notes, and snippets.

🐌
Break time

redgoose redgoose-dev

🐌
Break time
Block or report user

Report or block redgoose-dev

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
@redgoose-dev
redgoose-dev / ajax.js
Last active Dec 6, 2019
비동기 통신을 위한 `XMLHttpRequest` 객체의 인터페이스
View ajax.js
/**
* ajax
* 비동기 통신을 위한 `XMLHttpRequest` 객체의 인터페이스
*
* @param {string} url
* @param {string} method
* @param {object} data `xhr.send()` 메서드의 인자값. `formData`같은값을 넣음
* @param {function} progress 통신중에 호출되는 함수
* @param {function} before 통신을 시작하기전 xhr 객체를 추가 조작을 위한 중간에 실행하는 함수로 사용할 수 있다.
* @return {promise}
View printf.js
/**
* printf
*
* @param {String} str
* @param {String} values
* @return {String}
*/
export function printf(str, ...values)
{
for (let i = 0; i < values.length; i++)
@redgoose-dev
redgoose-dev / findIndexWithKey.js
Last active Oct 17, 2017
Object, Array utils
View findIndexWithKey.js
/**
* find index with key in array
* 배열속에 들어있는 객체의 값을찾는 함수
*
* @param {Array} array
* @param {String} key key name
* @param {String} search search value
* @return {Number}
*/
function findIndexWithKey(array=[], key='', search='')
@redgoose-dev
redgoose-dev / index.html
Created Dec 27, 2016
printf function with javascript
View index.html
<section>
<h1>Command</h1>
<pre class="source">printf('apple:{0}, banana:{1}, mango:{2}', 'red', 'yellow', 'green');</pre>
</section>
<section>
<h1>Result</h1>
<pre class="result"></pre>
</section>
@redgoose-dev
redgoose-dev / resizeImageInCanvas.js
Last active Nov 10, 2016
Resize image in canvas
View resizeImageInCanvas.js
function log(o) {console.log(o);}
function Canvas(width, height, bgColor)
{
this.el = document.createElement('canvas');
this.ctx = this.el.getContext('2d');
var size = {
width : (width) ? width : 150,
height : (height) ? height : 100
@redgoose-dev
redgoose-dev / CSS3.js
Last active Jan 18, 2016
CSS3 Util class
View CSS3.js
/**
* CSS3 class
*/
var CSS3 = {
eventNames : {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
View DisabledTouchscroll.js
/**
* Disabled touch scroll for ios
* ios 디바이스에서의 스크롤은 튕기는 방식 때문에 html,body엘리먼트에서 overflow:hidden을 적용해봤자 튕기는 스크롤을 막을 필요가 있었는데 스크립트로 터치를 막아버리는 방법으로 인터페이스를 만들게 되었다.
* 특히 사이드바 네비게이션을 사용할때 사용하면 도움이 될것이다.
* body 엘리먼트 스크롤을 막는 역할을 한다. 다른 특정 엘리먼트는 -webkit-overflow-scrolling: auto;로 처리가 가능하다고 봄
*/
function DisabledTouchscroll()
{
var self = this;
var $body = $(document.body);
@redgoose-dev
redgoose-dev / hairline.html
Created Jul 23, 2015
border hair line. border-width: 0.5px
View hairline.html
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>hair line demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="./style.css"/>
</head>
<body>
View rg-icon.html
<section>
<h1>Icons</h1>
<ul class="items">
<li>
<div>
<span class="rg-icon hamburger"><i>list</i></span>
</div>
</li>
<li>
<div><span class="rg-icon cross"><i>add/close</i></span></div>
@redgoose-dev
redgoose-dev / copyClipboard.js
Last active Aug 29, 2015
Copy the text to the clipboard
View copyClipboard.js
/**
* Copy the text to the clipboard
*
* @Param {String} : copy text
* @Param {String} : prompt message
* @Return void
*/
var copyClipboard = function(str, msg)
{
if (window.clipboardData)
You can’t perform that action at this time.