This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # https://gist.github.com/robwierzbowski/5430952/ | |
| # Create and push to a new github repo from the command line. | |
| # Grabs sensible defaults from the containing folder and `.gitconfig`. | |
| # Refinements welcome. | |
| # Gather constant vars | |
| CURRENTDIR=${PWD##*/} | |
| GITHUBUSER=$(git config github.user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| The MIT License | |
| Copyright 2020 Thomas Aylott <oblivious@subtlegradient.com> | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const compareColor = (color, property) => (targetElement) => { | |
| const tempElement = document.createElement('div'); | |
| tempElement.style.color = color; | |
| tempElement.style.display = 'none'; // make sure it doesn't actually render | |
| document.body.appendChild(tempElement); // append so that `getComputedStyle` actually works | |
| const tempColor = getComputedStyle(tempElement).color; | |
| const targetColor = getComputedStyle(targetElement[0])[property]; | |
| document.body.removeChild(tempElement); // remove it because we're done with it |
#Create a redirect server in Node.js
'use strict'
var http = require('http');
var mappings = {
g: 'http://www.google.com'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Simple proxy/forwarding server for when you don't want to have to add CORS during development. | |
| // Usage: node proxy.js | |
| // Open browser and navigate to http://localhost:9100/[url] | |
| // Example: http://localhost:9100/http://www.google.com | |
| // This is *NOT* for anything outside local development. It has zero error handling among other glaring problems. | |
| // This started as code I grabbed from this SO question: http://stackoverflow.com/a/13472952/670023 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A function to take a string written in dot notation style, and use it to | |
| * find a nested object property inside of an object. | |
| * | |
| * Useful in a plugin or module that accepts a JSON array of objects, but | |
| * you want to let the user specify where to find various bits of data | |
| * inside of each custom object instead of forcing a standardized | |
| * property list. | |
| * | |
| * @param String nested A dot notation style parameter reference (ie "urls.small") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function slugify (str) { | |
| var map = { | |
| '-' : ' ', | |
| '-' : '_', | |
| 'a' : 'á|à|ã|â|À|Á|Ã|Â', | |
| 'e' : 'é|è|ê|É|È|Ê', | |
| 'i' : 'í|ì|î|Í|Ì|Î', | |
| 'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', | |
| 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', | |
| 'c' : 'ç|Ç', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function slugify (str) { | |
| var map = { | |
| '-' : ' ', | |
| '-' : '_', | |
| 'a' : 'á|à|ã|â|À|Á|Ã|Â', | |
| 'e' : 'é|è|ê|É|È|Ê', | |
| 'i' : 'í|ì|î|Í|Ì|Î', | |
| 'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', | |
| 'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü', | |
| 'c' : 'ç|Ç', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.StringReader; | |
| import java.io.StringWriter; | |
| import java.util.ArrayList; | |
| import java.util.Hashtable; | |
| import javax.xml.bind.JAXBContext; | |
| import javax.xml.bind.JAXBException; | |
| import javax.xml.bind.Marshaller; | |
| import javax.xml.bind.Unmarshaller; |