Skip to content

Instantly share code, notes, and snippets.

View camman3d's full-sized avatar

Joshua Monson camman3d

View GitHub Profile
@camman3d
camman3d / svg-to-png.js
Last active April 27, 2024 16:33
Convert SVG to PNG. Verified in Chrome, Safari, and Firefox
// let svg = document.querySelector('svg');
function svgToPng(svg) {
let svgData = new XMLSerializer().serializeToString(svg);
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');
let DOMURL = window.URL || window.webkitURL || window;
let img = new Image();
let blog = new Blob([svgData], {type: 'image/svg+xml'});
let url = DOMURL.createObjectURL(blog);
@camman3d
camman3d / Driver.scala
Created March 23, 2015 14:52
Extracts data from http://www.nuforc.org and writes it to a .CSV file
import java.io.{File, PrintWriter}
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import collection.JavaConversions._
/**
* Created by josh on 3/20/15.
*
* Extracts data from http://www.nuforc.org and writes it to a .CSV file
@camman3d
camman3d / colorpicker.directive.js
Last active August 29, 2015 14:16
Color Picker directive
'use strict';
angular.module('myApp')
.directive('colorpicker', function () {
return {
templateUrl: 'app/colorpicker/colorpicker.html', // Replace with your path
restrict: 'EA',
require: 'ngModel',
scope: {
colors: '=?',
@camman3d
camman3d / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@camman3d
camman3d / GoogleAPILoader.js
Created June 29, 2013 04:05
Google API and Google Drive JavaScript helpers. See my blog post for more information. http://joshmonson.com/blog/2013/06/27/google-drive/
var GoogleAPILoader = (function() {
"use strict";
function GoogleAPILoader(config) {
this.clientId = config.clientId;
this.apiKey = config.apiKey;
this.scopes = config.scopes;
this.clientLibraries = config.clientLibraries || [];
}