This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimal Ajax function https://gist.github.com/hyeonseok/604812e389aa9e74d346 | |
function ajax(u,c,d){var x=new(this.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");x.onreadystatechange=function(){this.readyState^4||c(this)};if(d){x.open('POST',u);x.setRequestHeader('Content-type','application/x-www-form-urlencoded')}else{x.open('GET',u)}x.send(d)} | |
/* | |
GET request | |
ajax('whatever.php?foo=bar', function (xhr) { | |
console.log(xhr.responseText); | |
}); | |
POST request | |
ajax('whatever.php', function (xhr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needs to be clean up. | |
var mainContent = document.getElementById('main'); | |
var open = function (target) { | |
var closeButton = target.querySelector('p.button button'); | |
mainContent.style.top = -1 * document.body.scrollTop + 'px'; | |
mainContent.style.position = 'fixed'; | |
target.setAttribute('aria-hidden', 'false'); | |
document.body.scrollTop = 0; | |
closeButton.addEventListener('click', close); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# blank | |
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 | |
# 10% black | |
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAADUExURQkJCQC1BbgAAAABdFJOUxq9hCEcAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg== | |
# 20% black | |
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAADUExURQoKBSBopAkAAAABdFJOUzP/NrlwAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg== | |
# 30% black | |
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAADUExURQ0JBpcDsPUAAAABdFJOU01Ii+VLAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg== | |
# 40% black |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>추첨기</title> | |
<style> | |
html, | |
body { | |
height: 100%; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = '~~ Android 2.2.1; ~~'; | |
function get_android_version($str) { | |
$start = strpos($str, ' Android '); | |
if ($start === false) { | |
return ''; | |
} | |
$remains = substr($str, $start); | |
$end = strpos($remains, ';'); | |
$remains = substr($remains, 0, $end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* UserCSS for Firefox. | |
* https://gist.github.com/hyeonseok/7243239 | |
* | |
* ln -s ~/Dropbox/src/firefox-usercss/userContent.css /Users/hyeonseok/Library/Application\ Support/Firefox/Profiles/{USER_PROFILE}/chrome/userContent.css | |
*/ | |
* { | |
-webkit-touch-callout: text !important; | |
-webkit-user-select: text !important; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function emphasisKeyword(keyword, string) { | |
var h = { e: "[eéê]", a: "[aáâ]" }; | |
var matched = keyword.match(/[\S\s]/g); | |
var res = []; | |
for (var i = 0; i < matched.length; i++) { | |
if (h[matched[i]]) { | |
res.push(h[matched[i]]); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tests($expect, $actual) { | |
if ($expect == $actual) { | |
echo('PASS'); | |
} else { | |
echo('FAIL'); | |
} | |
echo(': ' . $expect . '/' . $actual . PHP_EOL); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"snippets": | |
{ | |
"css": | |
{ | |
"snippets": | |
{ | |
"tf": "-webkit-transform: ${1:func};\n-moz-transform: $1;\n-ms-transform: $1;\n-o-transform: $1;\ntransform: $1;", | |
"ts": "-webkit-transition: ${1:func};\n-moz-transition: $1;\n-ms-transition: $1;\n-o-transition: $1;\ntransition: $1;" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var d = document; | |
d.oncontextmenu = null; | |
d.ondragstart = null; | |
d.onselectstart = null; | |
d.onmousedown = null; // gmarket.co.kr | |
d.body.style.MozUserSelect = ''; | |
})(); |