This file contains 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
# Inspired by Paul Fenwick (https://gist.github.com/pjf) | |
# See https://gist.github.com/pjf/051aa4ef326d493beec950823f7edfd8#file-bashrc | |
# Reset | |
Color_Off='\[\e[0m\]' # Text Reset | |
# Regular Colors | |
Black='\[\e[0;30m\]' # Black | |
Red='\[\e[0;31m\]' # Red | |
Green='\[\e[0;32m\]' # Green | |
Yellow='\[\e[0;33m\]' # Yellow |
This file contains 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
definitions: | |
JSONAPI_BasicDoc: | |
title: JSONAPI_BasicDoc | |
type: object | |
description: | | |
A basic JSON API document. | |
The document MUST contain at least one of the following top-level members: `data`, `errors`, `meta`. | |
The members `data` and `errors` MUST NOT coexist in the same document. | |
The `Self Link` will open a view displaying all existing orders. | |
properties: |
This file contains 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
<!-- https://html.spec.whatwg.org/multipage/webstorage.html --> | |
<p style="font-size:0.7em;margin:5%"> | |
You have viewed this page | |
<span id="count">an untold number of</span> | |
time(s). | |
</p> | |
<script> | |
if (!localStorage.pageLoadCount) | |
localStorage.pageLoadCount = 0; |
This file contains 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
<?php | |
// http://www.aerisweather.com/support/docs/api/reference/endpoints/observations/ | |
// fetch Aeris API output as a string and decode into an object | |
$CLIENT_ID = ""; | |
$CLIENT_SECRET = ""; | |
$location = "duesseldorf,germany"; | |
$response = file_get_contents("http://api.aerisapi.com/observations/". $location ."?client_id=" . $CLIENT_ID . "&client_secret=" . $CLIENT_SECRET); | |
$json = json_decode($response); | |
if ($json->success == true) { | |
// create reference to our returned observation object |
This file contains 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
<?php | |
/** | |
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or | |
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below). | |
* | |
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/ | |
* | |
* INSTRUCTIONS: | |
* 1. Edit the variables below | |
* 2. Upload this script to your server somewhere it can be publicly accessed |
This file contains 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
// http://krazydad.com/tutorials/makecolors.php | |
// Sinwave | |
var frequency = 1; | |
for (var i = 0; i < 32; ++i) { | |
console.log(Math.sin(frequency * i)); | |
} | |
// Rainbow colors | |
var frequency = .3; |
This file contains 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
// Copied from http://stackoverflow.com/questions/10535817/javascript-round-up-and-down-to-the-nearest-5-then-find-a-common-denominator | |
// Rounding to nearest common denominator | |
x = 73; | |
x_rounded = 15 * Math.round( x / 15); | |
console.assert(x_rounded === 75, "Expecting x_rounded to be 75"); | |
function sigfig(n, sf) { | |
sf = sf - Math.floor(Math.log(n) / Math.LN10) - 1; |
This file contains 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
/** | |
* @param {object} data | |
* @param {number} minutes | |
* @returns {object} date | |
*/ | |
var addMinutes = function (date, minutes) { | |
return new Date(date.getTime() + minutes * 60000); | |
} | |
var now = new Date(); |
This file contains 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 getSecondsForTheDay | |
* @param {Object} thetime | |
* @returns {Int} seconds | |
*/ | |
getSecondsForTheDay = function (theTime) { | |
return theTime.getSeconds() + (60 * theTime.getMinutes()) + (60 * 60 * theTime.getHours()); | |
}; | |
var theTime = new Date(2015, 9, 14, 10, 0, 0); |
This file contains 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
var start = new Date(new Date().setMinutes(45)); | |
var end = new Date(new Date().setMinutes(15)); | |
minutesBetweenEndStart = Math.abs(end.getTime() - start.getTime()) / 1000 / 60; | |
console.assert(minutesBetweenEndStart === 30, "minutesBetweenEndStart should be 30"); |