Skip to content

Instantly share code, notes, and snippets.

View leemartin's full-sized avatar

Lee Martin leemartin

View GitHub Profile
@leemartin
leemartin / sign.js
Created August 10, 2019 20:08
Get presigned upload url for S3 compatible with Uppy and Netlify Functions
const AWS = require('aws-sdk')
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET,
useAccelerateEndpoint: true
})
const getSignedUrlPromise = (operation, params) => {
return new Promise((resolve, reject) => {
@leemartin
leemartin / Static.vue
Last active August 8, 2019 13:23
Vue Static Component
<template>
<canvas ref="canvas"></canvas>
</template>
<script>
export default{
methods: {
generateNoise() {
this.noise = document.createElement('canvas')
this.noise.height = window.innerHeight * 2
@leemartin
leemartin / spotify-client-credentials.js
Created January 5, 2019 15:01
Generate Spotify client credentials
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',
@leemartin
leemartin / create-apple-music-playlist.js
Created December 8, 2018 20:26
Create Apple Music Playlist
// 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 December 8, 2018 20:24
Create Spotify Playlist with Artwork
// 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 September 20, 2018 00:31
Turn Palette Color Picker
<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 September 11, 2018 22:51
Download Instagram Videos
// 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 September 7, 2018 21:44
Figma x Turn x Codepen
const app = new Vue({
el: '#app',
data() {
return {
figmaToken: '',
baseUrl: 'https://api.figma.com/v1',
fileId: '',
nodeId: '',
images: null,
nodes: null
@leemartin
leemartin / logo.sass
Created February 5, 2013 21:40
My new personal logo can be created completely with CSS borders.
$white: #FFFFFF
$grey: #CCC
$logo: 75px
#logo
height: $logo
width: $logo * 2
&:before, &:after
border-style: solid
@leemartin
leemartin / sprites.coffee
Created January 25, 2013 17:33
WebRTC Sprites Generator
$ ->
# 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" }