Skip to content

Instantly share code, notes, and snippets.

// time and time end
console.time("This");
let total = 0;
for (let j = 0; j < 10000; j++) {
total += j
}
console.log("Result", total);
console.timeEnd("This");
// Memory
import q from 'q'
import passport from 'passport'
import { Strategy } from 'passport-github'
import Github from 'github'
passport.use(
new Strategy({ clientID: CLIENT_ID, clientSecret: CLIENT_SECRET },
async (req, accessToken, refreshToken, profile, done) => {
const github = new Github({ version: '3.0.0' })
github.authenticate({ type: 'token', token: accessToken })
@jimmywarting
jimmywarting / readme.md
Last active November 18, 2024 14:14
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@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
@funkyremi
funkyremi / music
Last active January 20, 2017 08:40
This script lets you play music (internet radio) from you terminal.
#!/bin/bash
# This script lets you play music from you terminal.
# 1) Install mplayer
# 2) chmod +x music
# 3) Put 'music' script in a folder on your PATH.
# 4) Enjoy ;)
if [ -z $1 ]; then
echo "Usage:"
@joeshub
joeshub / ST3-with-iCloud-Drive.sh
Last active May 17, 2023 05:20
Sync your Sublime Text 3 Settings using iCloud Drive on multiple Macs
# Notes
# Using iCloud Drive, you can sync your Sublime Text 3
# plugins and prefs so you can always have the same setup
# Prerequisites
# Make sure both machines have the latest version of OSX 10.10.x with
# Yosemite or higher and iCloud Drive turned on
# Quit ST3
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000