Skip to content

Instantly share code, notes, and snippets.

View mitchdowney's full-sized avatar
🌎
hello world

Mitch Downey mitchdowney

🌎
hello world
View GitHub Profile
const str = "Jane Doe<https://jane.doe.homepage>,Joe Bloggs,Juan Perez<https://some.socialmedia/juan>"
const splits = str.split(",")
const translators = []
for (const split of splits) {
const name = split
const regexResults = name.match(new RegExp('<(.*?)>'))
const url = regexResults && regexResults[1]
const translator = {
name: url ? name.substr(0, regexResults.index) : name,
url
import axios from 'axios'
import { PV } from '~/resources'
axios.defaults.withCredentials = true
type PVRequest = {
endpoint?: string
query?: {}
body?: any
headers?: any
import OmniAural, { useOmniAural } from "omniaural"
import { useTranslation } from "react-i18next"
import Modal from 'react-modal'
import { ButtonClose, ButtonLink, ButtonRectangle, TextInput } from "~/components"
import { login } from "~/services/auth"
type Props = {}
export const LoginModal = (props: Props) => {
const [login] = useOmniAural("modals.login")
retrieveUserAndAllSubscribedPodcasts(id, params = {}) {
const {
MediaRef,
Playlist
} = this.Models;
if (id && id !== params.userId) {
throw new errors.Forbidden();
}
describe('feedParser', function () {
describe('when an invalid RSS URL is provided', function () {
it('should throw an error', function (done) {
feedParser.parseFeed('http://www.podverse.fm/fakepage')
.catch(err => {
console.log(err);
expect(err).to.equal('Bad Status Code');
done();
@mitchdowney
mitchdowney / app.js
Last active February 13, 2016 19:20
How do we parse a JSON object passed to the player.html template, then store it in a window variable?
var env = nunjucks.configure(__dirname + '/templates', {
autoescape: true,
cache: false,
express: app
});
env.addFilter('stringify', function(str) {
return JSON.stringify(str);
});
@mitchdowney
mitchdowney / SavePlaylistToServer.swift
Created February 12, 2016 03:16
How can we POST a playlist object from the mobile app to the server?
import Foundation
class SavePlaylistToServer: WebService {
internal init(playlist:Playlist, completionBlock: (response: Dictionary<String, AnyObject>) -> Void, errorBlock: (error: NSError?) -> Void) {
super.init(name:"playlist", completionBlock: completionBlock, errorBlock: errorBlock)
setHttpMethod(.METHOD_POST)
addHeaderWithKey("Content-Type", value: "application/json")
addParamWithKey("playlistTitle", value: playlist.title ?? "")
@mitchdowney
mitchdowney / playlist.json
Created February 10, 2016 02:48
revised playlist.json
{
"playlist": [
{
"title": "#265 - The episode where some stuff happened",
"duration": "50:25",
"pubDate": "2016-02-07 22:30:55 +0000",
"mediaURL": "http://traffic.libsyn.com/lavenderhour/DTFH_183_Aaron_Frank.mp3",
"podcast": {
"title": "The Best Podcast Ever Show",
"imageURL": "https://pbs.twimg.com/profile_images/483390499030450177/tMc95Jty_400x400.jpeg"
@mitchdowney
mitchdowney / playlst.json
Created February 10, 2016 02:34
Revised playlst.json
{
items: [
{
title: "#265 - The episode where some stuff happened",
duration: "50:25",
pubDate: "2016-02-07 22:30:55 +0000",
mediaURL: "http://traffic.libsyn.com/lavenderhour/DTFH_183_Aaron_Frank.mp3",
podcast: {
title: "The Best Podcast Ever Show",
imageURL: "https://pbs.twimg.com/profile_images/483390499030450177/tMc95Jty_400x400.jpeg"
@mitchdowney
mitchdowney / playlist.json
Created February 9, 2016 04:16
what's an efficient way to POST playlists to the web app?
{
playlist: {
episode: {
title: "#265 - The episode where some stuff happened",
duration: "50:25",
pubDate: "2016-02-07 22:30:55 +0000",
podcast: {
title: "The Best Podcast Ever Show"
}
},