Skip to content

Instantly share code, notes, and snippets.

View pocojang's full-sized avatar
🐢

Poco pocojang

🐢
View GitHub Profile
var todo = (function(){
var tasks = [];
var addTask = (function(){
var id = 0;
return function(title){
var result = id;
tasks.push({id: id++, title: title, state: STATE.PROGRESS()});
render();
return result;
@jonathan-fulton
jonathan-fulton / build-url.js
Created June 15, 2017 16:48
build-url: the good way
function buildUrl(url, options) {
const baseUrl = _getBaseUrl(url);
const opts = _getOptions(url, options);
if (!opts) {
return baseUrl;
}
urlWithPath = _appendPath(baseUrl, opts.path);
urlWithPathAndQueryParams = _appendQueryParams(urlWithPath, opts.queryParams)
@jonathan-fulton
jonathan-fulton / build-url.js
Last active May 14, 2018 00:59
build-url: the bad way
function buildUrl(url, options) {
var queryString = [];
var key;
var builtUrl;
if (url === null) {
builtUrl = '';
} else if (typeof(url) === 'object') {
builtUrl = '';
options = url;
var todo = (function(){
var tasks = [];
var STATE_P = '진행';
var STATE_C = '완료';
var mode = 'html';
var addTask = (function(){
var id = 0;
var todo = (function(){
var tasks = [];
var STATE_P = '진행';
var STATE_C = '완료';
var addTask = (function(){
var id = 0;
return function(title){
var result = id;
anonymous
anonymous / S70 To-Do 02
Created June 2, 2017 07:58
var todo = (function(){
var tasks = [];
var STATE_P = '진행';
var STATE_C = '완료';
var addTask = (function(){
var id = 0;
return function(title){
var tasks = [];
var STATE_P = '진행';
var STATE_C = '완료';
var addTask = (function() {
var id = 0;
return function(title) {
tasks.push({
@woowawebui
woowawebui / s70_1_0.js
Created May 10, 2017 12:23
구구단
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= 9; j++) {
console.log(i, 'X', j, '=', i * j);
}
}
eachDan(7);
for (var i = 8; i <= 18; i += 2) eachDan(i);
printDan([3, 7, 9, 13]);
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?