Skip to content

Instantly share code, notes, and snippets.

View Jae-kwang's full-sized avatar
🥤

Jaekwang jung Jae-kwang

🥤
  • Line+ Corp
  • Republic of Korea
View GitHub Profile
@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@juliuscsurgo
juliuscsurgo / Bootstrap: no blue glow
Created January 3, 2013 01:29
Twitter Bootstrap: remove the blue glow in the form inputs
input[type="text"], textarea {
outline: none;
box-shadow:none !important;
border:1px solid #ccc !important;
}
@jhiebert
jhiebert / hacks.js
Created June 20, 2013 15:15 — forked from notmasteryet/hacks.js
Uint8Array Support for IE8
(function() {
try {
var a = new Uint8Array(1);
return; //no need
} catch(e) { }
function subarray(start, end) {
return this.slice(start, end);
}
@pbojinov
pbojinov / jquery.deferred.promise.js
Last active August 31, 2022 02:38
simple jQuery Deferred example
function getData() {
var deferred = $.Deferred();
$.ajax({
'url': 'http://google.com',
'success': function(data) {
deferred.resolve('yay');
},
'error': function(error) {
deferred.reject('boo');
@jays1204
jays1204 / postbodyEnc.md
Last active September 24, 2023 04:50
Http Method는 POST, Content-Type이 application/x-www-form-urlencoded인 경우 body를 encoding하는게 맞을까?

요즘의 Request

RestFul API를 사용하며 json을 많이 사용하게 됨에 따라 요즈음의 request의 Content-Type은 대부분이 application/json인 것이 많다.

아니면 파일 첨부를 위해 multipart/*를 사용한다. application/x-www-form-urlencoded는 form에서 default로 사용되는 것 이외에는 사실 잘 사용하지 않는 편으로 보인다.

요새 자주 사용하지 않지만, 하지만 여전히 application/x-www-form-urlencoded를 사용하는 경우가 존재한다.

Content-Type이 다름에 따라 뭐가 달라지겠느냐 하겠지만 다른 점이 분명히 있다.

@mangreen
mangreen / Youtube Get Current Second Api Demo.
Last active August 26, 2021 02:04
Youtube Get Current Second Api Demo.
<!DOCTYPE html>
<html>
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<div>Current Time: <span id="time"></span></div>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
@magnetikonline
magnetikonline / README.md
Last active October 26, 2023 05:10
AWS CLI S3 usage examples.
@robballou
robballou / someModule.js
Created October 29, 2014 23:04
Testing jQuery code in Mocha
// The hacky bit of this approach is that this module uses
// jQuery, but it is not referenced here. This is because I
// am populating it in the test via global namespace.
//
// In the browser this still works because I am adding jQuery
// via a Browserify transform (browserify-global-shim).
function someModule() {
}
modules.export = someModule;
@jodoherty
jodoherty / deploy_production.sh
Created December 18, 2014 21:20
Middleman S3 deployment script using aws cli tools
#!/bin/sh
BUCKET="james-odoherty.com"
set -e
bundle exec middleman build
find ./build \( -iname '*.html' -o -iname '*.css' -o -iname '*.js' -o -iname '*.txt' \) -exec gzip -9 -n {} \; -exec mv {}.gz {} \;
aws s3 rm s3://$BUCKET --recursive
aws s3 sync build/ s3://$BUCKET/ --acl=public-read --delete --cache-control="max-age=1576800000" --exclude "*.html" --exclude "*.css" --exclude "*.js" --exclude "*.txt"
@danharper
danharper / CancellationTokenSource.js
Last active January 7, 2024 17:58
JavaScript "CancellationToken" for cancelling Async/Promise functions
const CANCEL = Symbol();
class CancellationToken {
constructor() {
this.cancelled = false;
}
throwIfCancelled() {
if (this.isCancelled()) {