Skip to content

Instantly share code, notes, and snippets.

View theNotoriousHxc's full-sized avatar

theNotoriousHxc theNotoriousHxc

View GitHub Profile
@theNotoriousHxc
theNotoriousHxc / cors.md
Created March 20, 2018 03:36 — forked from jesperorb/cors.md
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
@theNotoriousHxc
theNotoriousHxc / coverage.js
Created February 27, 2018 02:00 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
@theNotoriousHxc
theNotoriousHxc / cloudSettings
Last active August 18, 2018 04:18
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-18T04:18:29.873Z","extensionVersion":"v3.0.0"}
@theNotoriousHxc
theNotoriousHxc / auto_config_zsh_tmux_powerline.sh
Created August 1, 2017 01:01 — forked from pcyan/auto_config_zsh_tmux_powerline.sh
A script for ubuntu 16.04, auto install zsh, oh-my-zsh, tmux and powerline, and config powerline
echo "--- start update ---"
sudo apt-get update
echo "--- end update ---"
echo "--- apt install zsh tmux python-pip ---"
sudo apt-get install zsh tmux python-pip
echo "--- end apt install ---"
echo "--- install oh-my-zsh ---"
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
@theNotoriousHxc
theNotoriousHxc / vanilla-js-cheatsheet.md
Created February 5, 2017 05:13 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet