Skip to content

Instantly share code, notes, and snippets.

@jonguenther
jonguenther / collection_uno.js
Last active Sep 24, 2020
Jon's Javascript collection
View collection_uno.js
// get array of unique keys in array of objects
const getUniqueKeys = (ArrayOfObjects) => new Set(ArrayOfObjects.reduce((acc, cur) => [...acc, ...Object.keys(cur)], []));
// conditional properties inside objects
const fooCondition = false;
const conditionalObject = {
someProperty: 'foo',
...(fooCondition && { bar: true }),
anotherProperty: 'bar',
@jonguenther
jonguenther / pastebin.sh
Last active Nov 25, 2019 — forked from ktmud/pastebin.sh
Bash Script to upload files and data to Pastebin.com
View pastebin.sh
#!/bin/sh
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010
# revised on June 22, 2018 by Jonathan Guenther
# see README for more information (if I have time to create one...)
echo +--------------------------------------------+
@jonguenther
jonguenther / pastebin.sh
Created Jun 22, 2018 — forked from ktmud/pastebin.sh
Pastebin Bash Script.
View pastebin.sh
#!/bin/bash
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010
#help function
howto()
{
echo "\
Pastebin.com Bash Script \
@jonguenther
jonguenther / ajax.html
Created Jan 20, 2018
Send an Ajax request to an API using Jquery
View ajax.html
<?php
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Import jquery and Ajax script-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="ajax.js"></script>