Skip to content

Instantly share code, notes, and snippets.

View kyungw00k's full-sized avatar
👋

Kyungwook, Park kyungw00k

👋
View GitHub Profile
@kyungw00k
kyungw00k / jquery.postmessage.js
Created October 31, 2016 16:03 — forked from zachleat/jquery.postmessage.js
postMessage polyfill for IE < 8 that uses window.name and queues messages so they aren't lost while polling. Requires a JSON.parse polyfill (like JSON.js).
/*!
* jQuery postMessage - v1.0 - 8/26/2011
*
* Copyright (c) 2011 "zachleat" Zach Leatherman
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://jquery.org/license
*/
/* Forked from http://benalman.com/projects/jquery-postmessage-plugin/
@kyungw00k
kyungw00k / assertions-compareScreenshot.js
Created November 7, 2016 01:58 — forked from richard-flosi/assertions-compareScreenshot.js
Nightwatch with Visual Regression testing
// assertions/compareScreenshot.js
var resemble = require('resemble'),
fs = require('fs');
exports.assertion = function(filename, expected) {
var screenshotPath = 'test/screenshots/',
baselinePath = screenshotPath + 'baseline/' + filename,
resultPath = screenshotPath + 'results/' + filename,
diffPath = screenshotPath + 'diffs/' + filename;
@kyungw00k
kyungw00k / load-script.js
Last active November 7, 2016 10:48
handle onload/onfail callback on script tag
function loadScript (src, cb) {
var userAgent = navigator.userAgent.toLowerCase()
var isIE = (userAgent.indexOf('msie') !== -1) ? parseInt(userAgent.split('msie')[1], 10) : false
var doc = document
var tag = 'script'
var el = doc.createElement(tag)
el.done = false
el.async = true
el.charset = 'utf-8'
@kyungw00k
kyungw00k / iframe_contents.html
Created April 26, 2017 05:00 — forked from bprosnitz/iframe_contents.html
iframe origin security: dispatchEvent vs postMessage
<script>
window.addEventListener('message', function(event) {
console.log('iframe: Got postmessage in origin ' + location.origin + ' from origin: ' + event.origin + '(' + event.data + ')');
});
window.addEventListener('dispatchToIframe', function() {
console.log('iframe: Got dispatchEvent() in origin ' + location.origin + '(from index.html)');
});
setTimeout(function() {
window.dispatchEvent(new CustomEvent('dispatchFromIframe'));
@kyungw00k
kyungw00k / response.json
Last active August 14, 2017 06:02
Facebook Native Ad Response
{
"type": "ads",
"code": 0,
"placements": [
{
"definition": {
"placement_id": "310278599393096_320154578405498",
"type": "native",
"refresh": "0",
"refresh_threshold": "-1",
@kyungw00k
kyungw00k / cloudSettings
Last active March 15, 2022 23:33
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-03-15T23:33:12.571Z","extensionVersion":"v3.4.3"}
@kyungw00k
kyungw00k / sf-register-viewability-beacon.js
Last active December 27, 2017 10:27
Register viewability beacon using SafeFrame
/**
* register viewability beacon
*
* @param {number} adWidth - ad width
* @param {number} adHeight - ad height
* @param {string} vimpUrl - beacon url to be sent when ad is shown
* @param {object} options
* @param {number} [options.percent = 50] - in view percent
* @param {number} [options.duration = 1000] - in view duration
* @throws {Error} throws error if `SafeFrame` is not supported
@kyungw00k
kyungw00k / USAGE.md
Last active February 2, 2018 05:58
SafeFrame External API Wrapper

register

sfApi = sfExtAPI()

// register

sfApi.register(250, 250)
@kyungw00k
kyungw00k / index.html
Created November 13, 2018 15:51
JS Bin RxJS 연습 // source https://jsbin.com/vudatux
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="RxJS 연습">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.3.3/rxjs.umd.js"></script>
@kyungw00k
kyungw00k / is-private-mode.js
Created May 13, 2019 13:48 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode
// uncomment if you are transpiling with Babel + Webpack
// const { window, document } = global;
/**
* Lightweight script to detect whether the browser is running in Private mode.
*
* You should use a polyfill for Promise.
* @see https://ourcodeworld.com/articles/read/316/top-5-best-javascript-promises-polyfills
*
* @returns {Promise}