Skip to content

Instantly share code, notes, and snippets.

@arirawr
arirawr / spotify-implicit-grant.js
Last active December 3, 2021 15:43
Basic implicit grant implementation for Spotify API OAuth
// Get the hash of the url
const hash = window.location.hash
.substring(1)
.split('&')
.reduce(function (initial, item) {
if (item) {
var parts = item.split('=');
initial[parts[0]] = decodeURIComponent(parts[1]);
}
return initial;
@mnishiguchi
mnishiguchi / n-times-loop-in-React.js
Last active February 16, 2024 03:36
n-times loop in React
import React from 'react'
const Stars = ({n}) => {
let stars = []
for (let i = 0; i < n; ++i) {
stars.push(<i className="fa fa-star" key={i}></i>)
}
return (
<div className="Stars">
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';