Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
dstyle0210 / jquery.carousel.js
Last active August 29, 2015 14:21
[jquery] carousel
@dstyle0210
dstyle0210 / jquery.onoff.js
Created May 22, 2015 08:17
[jquery] 선택된 이미지 배열에서 특정 eq만 on으로 바꿔줌.
// onoff extend
(function($) {
$.fn.onoff = function(n, on, off) {
var n = n;
var on = (!on) ? "On." : on + ".";
var off = (!off) ? "Off." : off + ".";
$(this).each(function(i) {
this.src = (this.src).replace(on, off);
if (i == n) {
this.src = (this.src).replace(off, on);
@dstyle0210
dstyle0210 / colorbox_reset.js
Created October 28, 2015 05:00
colorbox 초기화 후에 다시 띄우기
// colorbox 초기화 한 후에 다시 띄우기.
function onlyCallOrderOpen(){
var colorboxOptions = {
inline : true,
width : "100%",
href : "#onlyCallOrder",
onClosed: function () {
clearInterval(timer);
$(".certiInput").hide();
$.colorbox.remove();
@dstyle0210
dstyle0210 / gulp-sass-used.js
Last active July 12, 2016 02:32
[gulp] gulp-sass 사용법.
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
// 자세한 옵션은 "https://github.com/sass/node-sass#options" 에서 확인 필요.
var sass_opt = {
/**
* outputStyle (Type : String , Default : nested)
* CSS의 컴파일 결과 코드스타일 지정
@dstyle0210
dstyle0210 / .csscomb.json
Last active July 11, 2016 05:59
마봉아빠's Gulp Setting
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"quotes": "double",
"color-case": "lower",
"exclude": [
".git/**",
"node_modules/**",
"bower_components/**"
],
@dstyle0210
dstyle0210 / node.getMyFolder.js
Last active July 12, 2016 02:12
[node] file path에서 자신의 바로상위 폴더명 가져오기.
var path = require('path');
function getFolder(file){
return path.parse( path.parse(file.path).dir ).base;
};
var pathUrl = "/src/css/test.css";
var myFolder = getFolder(pathUrl); // return "css"
console.log(myFolder);
@dstyle0210
dstyle0210 / codingdojang_study01.js
Created July 12, 2016 06:53
코딩도장 공부 : Multiples of 3 and 5
// 코딩도장 공부
// http://codingdojang.com/scode/350
var s = 0;
for(i=1;i<1000;i++){
s += (i%3==0 || i%5==0) ? i : 0;
}
console.log(s);
@dstyle0210
dstyle0210 / codingdojang_study02.js
Last active July 12, 2016 08:36
[코딩도장] 넥슨 입사문제 중에서
// 코딩도장 공부
// http://codingdojang.com/scode/365
var max = 5000;
// 숫자들의 합 구하기.
var total = 0;
(function(){
for(i=0;i<max;i++){
total += i;
};
@dstyle0210
dstyle0210 / codingdojang_study03.js
Created July 12, 2016 08:47
[코딩도장] 구글 입사문제 중에서
// 코딩도장 공부
// http://codingdojang.com/scode/393
var samText = "";
for(i=1;i<10000;i++){
samText += i+"";
};
var total = (samText.match(/8/g)).length;
console.log(total);
@dstyle0210
dstyle0210 / codingdojang_study04.js
Created July 12, 2016 09:08
[코딩도장] 게시판 페이징
// 코딩도장 공부
// http://codingdojang.com/scode/406
var m = Math.floor(Math.random()*100); // 총건수
var n = Math.floor(Math.random()*10)+1; // 한페이지에 보여줄 게시물수 (n은 1보다 크거나 같다)
var paging = (0<m) ? Math.floor(m/n) : 0; // 총건수가 0개면, 리턴도 0개.
paging = (paging!=0 && m%n!=0) ? paging + 1 : paging;
console.log(m+","+n+","+paging);