Skip to content

Instantly share code, notes, and snippets.

@leemartin
leemartin / spotify-client-credentials.js
Created Jan 5, 2019
Generate Spotify client credentials
View spotify-client-credentials.js
const axios = require('axios')
let CLIENT_ID="YOUR_CLIENT_ID"
let CLIENT_SECRET="YOUR_CLIENT_SECRET"
let auth = Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString('base64')
axios({
method: 'post',
url: 'https://accounts.spotify.com/api/token',
View create-apple-music-playlist.js
// initialize axios instance
let apple = axios.create({
baseURL: 'https://api.music.apple.com/v1',
headers: {
'Authorization': `Bearer ${developerToken}`,
'Music-User-Token': `${musicUserToken}`
}
})
// create playlist
@leemartin
leemartin / create-spotify-playlist-with-artwork.js
Last active Dec 8, 2018
Create Spotify Playlist with Artwork
View create-spotify-playlist-with-artwork.js
// initialize axios instance
let spotify = axios.create({
baseURL: 'https://api.spotify.com',
headers: {
'Authorization': `Bearer ${token}`
}
})
// get user id for playlist creation
spotify.get('/v1/me').then(res => {
@leemartin
leemartin / Palette.vue
Created Sep 20, 2018
Turn Palette Color Picker
View Palette.vue
<template>
<ul>
<li v-for="color in colors" :style="{ background: `rgb(${color[0]},${color[1]},${color[2]})`}" @click="selectColor(color)"></li>
</ul>
</template>
<script>
export default{
props: ['colors'],
methods: {
@leemartin
leemartin / instagram-dl.js
Created Sep 11, 2018
Download Instagram Videos
View instagram-dl.js
// node instagram-dl.js BnmcJ-tnAey
const rest = require('restler')
const fs = require('fs')
const request = require('request')
rest.get(`https://www.instagram.com/p/${process.argv.slice(2)[0]}/?__a=1`).on('complete', function(data) {
var videoUrl = data.graphql.shortcode_media.video_url
var videoFilename = videoUrl.split("/")[videoUrl.split("/").length - 1]
@leemartin
leemartin / listen.js
Created Sep 7, 2018
Figma x Turn x Codepen
View listen.js
const app = new Vue({
el: '#app',
data() {
return {
figmaToken: '',
baseUrl: 'https://api.figma.com/v1',
fileId: '',
nodeId: '',
images: null,
nodes: null
@leemartin
leemartin / musickit-token-encoder.js
Last active Feb 20, 2021
Apple Music API Token for MusicKit
View musickit-token-encoder.js
"use strict";
const fs = require("fs");
const jwt = require("jsonwebtoken");
const privateKey = fs.readFileSync("AuthKey.p8").toString();
const teamId = "ABCDE12345";
const keyId = "ABCDE12345";
const jwtToken = jwt.sign({}, privateKey, {
@leemartin
leemartin / artwork
Last active Aug 29, 2015
Artwork FM YouTube Embed
View artwork
<iframe frameborder='0' height='320' src='http://www.youtube.com/embed/VIDEO_ID?autoplay=1&rel=0&autohide=1&controls=1&fs=0&modestbranding=1&showinfo=0&hd=1&vq=hd1080&color=white' width='320'></iframe>
@leemartin
leemartin / logo.sass
Created Feb 5, 2013
My new personal logo can be created completely with CSS borders.
View logo.sass
$white: #FFFFFF
$grey: #CCC
$logo: 75px
#logo
height: $logo
width: $logo * 2
&:before, &:after
border-style: solid
@leemartin
leemartin / sprites.coffee
Created Jan 25, 2013
WebRTC Sprites Generator
View sprites.coffee
$ ->
# Variables
photo = 0
size = 150
directions =
center: { x: size, y: size, i: "straight ahead" }
north: { x: size, y: 0, i: "up" }
northwest: { x: 0, y: 0, i: "up over your right shoulder" }
west: { x: 0, y: size, i: "right" }
southwest: { x: 0, y: size * 2, i: "at your right shoulder" }