Skip to content

Instantly share code, notes, and snippets.

@psbolden
psbolden / xmlToJson.js
Created June 26, 2017 18:56 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {
@psbolden
psbolden / xmlToJson.js
Last active June 26, 2017 18:52 — forked from feedmypixel/xmlToJson
Convert XML to JSON. This is a version that provides a JSON object without the attributes and places textNodes as values rather than an object with the textNode in it.
/**
* Originally from http://davidwalsh.name/convert-xml-json
* This is a version that provides a JSON object without the attributes and places textNodes as values
* rather than an object with the textNode in it.
* 27/11/2012
* Ben Chidgey
*
* @param xml
* @return {*}
*/
@psbolden
psbolden / gist:fccf39210879e81a6fe83ef418a12c52
Created June 26, 2017 18:44 — forked from bhurlow/gist:3861616
Better XML to JSON parsing for cdata
// Changes XML to JSON
// fixed some bugs from http://davidwalsh.name/convert-xml-json
// October 9, 2012
// Brian Hurlow
function xmlToJson(xml) {
// Create the return object
var obj = {};
// console.log(xml.nodeType, xml.nodeName );
{
"application_id":"YOUR_APP_ID",
"src":"http://cdn.blitline.com/filters/boys.jpeg",
"functions":[
{
"name":"convert_command",
"params":{
"-function":"polynomial 3.5,-5.05,2.05,0.3",
"-channel":"R"
},
// use jQuery shipped with Uploadcare
$ = uploadcare.jQuery;
var widget = uploadcare.MultipleWidget('input');
// disable submit button
$('#submit').attr('disabled', true);
widget.onUploadComplete(function(info) {
// upload is complete
console.log(info);
@psbolden
psbolden / index.html
Last active January 21, 2017 19:44 — forked from anonymous/index.html
Vue 2 Router Example - source https://jsbin.com/bikadol/7
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="app">
<router-view class="view"></router-view>
@psbolden
psbolden / sample_svg.json
Created October 26, 2016 22:25 — forked from blitline-dev/sample_svg.json
sample_svg.json
{
"application_id":"YOUR_APP_ID",
"src":"https://s3.amazonaws.com/dev.blitline/sample.svg",
"functions":[
{
"name":"resize_to_fit",
"params":{
"width" : 400
},
"save":{
{
"application_id": "YOUR_APP_ID",
"src": "https://s3.amazonaws.com/img.blitline/filters/boys.jpeg",
"functions": [
{
"name": "composite",
"params": {
"src": "https://s3.amazonaws.com/img.blitline/grad_vignette_index.png"
},
"functions": [
@psbolden
psbolden / 0_reuse_code.js
Created June 30, 2016 15:45
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