Skip to content

Instantly share code, notes, and snippets.

View akshay-ranganath's full-sized avatar

Akshay Ranganath akshay-ranganath

View GitHub Profile
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1">
<title>Simple Video Player</title>
</head>
<body>
<h3>Connection Aware Video Player</h3>
<video id="player" width="320" height="240" controls onclick="switchVideo" poster="https://res.cloudinary.com/demo/video/upload/w_320,h_240,f_auto,q_auto/test_video_r2tk5n.jpg" autoplay muted>
<source src="https://res.cloudinary.com/demo/video/upload/w_320,h_240,e_preview:duration_5,f_auto,q_auto/test_video_r2tk5n">
@akshay-ranganath
akshay-ranganath / migrate_to_cloudinary.py
Created February 4, 2020 00:07
Simple script to migrate images from within Github to Cloudinary in markdownpages
import cloudinary
import cloudinary.uploader
import cloudinary.api
import cloudinary.utils
import argparse
import sys, os, glob, re
import urllib.parse
cloudinary.config(
cloud_name = '<>',
@akshay-ranganath
akshay-ranganath / uploader.js
Created December 9, 2019 23:02
uploader.js - a helper method to support uploading the files to cloudinary
export const upload = (svgImage) => {
var url = uploadFile(svgImage)
console.log('Secure url is: ' + url)
return url.replace('.svg', '.png').replace('/upload/', '/upload/bo_3px_solid_rgb:00390b/b_white/l_cloudinary_icon,w_0.1,g_south_east,o_70/')
}
// *********** Upload file to Cloudinary ******************** //
function uploadFile (svgImage) {
var url = 'https://api.cloudinary.com/v1_1/mermaid/upload'
var xhr = new XMLHttpRequest() // eslint-disable-line
@akshay-ranganath
akshay-ranganath / Preview.js
Created December 9, 2019 23:00
Updated preview.js code for adding the download functionality
import React from 'react'
import { Divider, Card } from 'antd'
import { Link } from 'react-router-dom'
import moment from 'moment'
import { Base64 } from 'js-base64'
import mermaid from 'mermaid'
import { upload } from './uploader'
class Preview extends React.Component {
constructor (props) {