Skip to content

Instantly share code, notes, and snippets.

View MatthewStanciu's full-sized avatar

Matthew Stanciu MatthewStanciu

View GitHub Profile

Keybase proof

I hereby claim:

  • I am MatthewStanciu on github.
  • I am matthewstanciu (https://keybase.io/matthewstanciu) on keybase.
  • I have a public key whose fingerprint is A7A8 5FA9 5A1F A011 113D 4D16 3323 6044 6161 01D3

To claim this, I am signing this object:

@MatthewStanciu
MatthewStanciu / server.js
Created September 8, 2018 04:13
Collaborative Spotify Playlist
var express = require('express');
var app = express();
var http = require('http').Server(app);
var bodyParser = require('body-parser');
var request = require('request');
var refresh = require('spotify-refresh');
require('dotenv').config();
var redirect_uri = 'http://localhost:3000/callback'
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./public/style.css">
</head>
<body>
<h1><a href="link-to-playlist" target="_blank">
Your song has been added to the playlist!</a></h1>
</body>
</html>
@MatthewStanciu
MatthewStanciu / server.js
Created September 8, 2018 03:46
Post a new song to our collaborative spotify playlist
app.post('/song', function(req, res) {
refresh(process.env.REFRESH_TOKEN, process.env.CLIENT_ID, process.env.CLIENT_SECRET, function(err, res, body) {
if (err) return err;
request.post({
url: 'https://api.spotify.com/v1/playlists/your-playlist-id/tracks?uris=spotify%3Atrack%3A' +
getIDfromUrl(req.body.submiturl),
headers: {
'Authorization': 'Bearer ' + body.access_token,
'Host': 'api.spotify.com',
'Accept': 'application/json',
@MatthewStanciu
MatthewStanciu / server.js
Created September 8, 2018 03:39
get Spotify ID from url
function getIDfromUrl(url) {
var split1 = url.split('/');
var split2 = split1[4].split('?');
return split2[0];
}
@MatthewStanciu
MatthewStanciu / index.html
Last active September 8, 2018 03:11
Form for spotify collaborative playlist
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="./public/style.css">
</head>
<body>
<form action="/song" method="post" id="urlform">
<input class="url" name="submiturl" type="text" placeholder="Enter the Spotify URL" autofocus>
</form>
<button form="urlform"><strong>Add to playlist</strong></button>
var express = require('express');
var app = express();
var http = require('http').Server(app);
var bodyParser = require('body-parser');
var request = require('request');
var querystring = require('querystring');
var accessToken = '';
var refreshToken = '';
var trackUri = '';
@MatthewStanciu
MatthewStanciu / TheWritersBlock.sol
Last active July 31, 2018 13:24
Waiting until a transaction is confirmed to send an email
pragma solidity ^0.4.23;
contract TheWritersBlock {
address public owner;
mapping (address => uint256) public balance;
constructor() public {
owner = msg.sender;
}
@MatthewStanciu
MatthewStanciu / index.html
Last active July 31, 2022 14:09
Simple Ethereum transaction with Web3.js
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="./index.js"></script>
</head>
<body>
<div id="pay">
<form>
Verifying my Blockstack ID is secured with the address 19v2oMcDL7CMCajc8swZdCTsvK5xQfZDTd https://explorer.blockstack.org/address/19v2oMcDL7CMCajc8swZdCTsvK5xQfZDTd