Skip to content

Instantly share code, notes, and snippets.

View adamabernathy's full-sized avatar
👋

Adam C. Abernathy adamabernathy

👋
View GitHub Profile
@adamabernathy
adamabernathy / linspace.js
Created December 2, 2016 17:30
Creates a linearly spaced array
/**
* Create a linearly spaced array
*
* @param {number} start - starting integer
* @param {number} nvalues - how many values
* @param {number} interval - interval (optional)
*/
function __linspace(start, nvalues, interval) {
if (typeof interval === "undefined") { interval = 0; }
var i;
@adamabernathy
adamabernathy / d3-bs-tooltip
Created January 3, 2017 16:14
Calls BS tooltip from a D3 event
.on("mouseover", function (d) {
// Call Bootstrap tooltip, this is one of the few jQuery dependencies
$(this).tooltip({
"title": "Tooltip text or function call",
"placement": "right",
"html": true,
"container": "body"
}).tooltip("show");
});
@adamabernathy
adamabernathy / table.js
Created January 12, 2017 21:36
additive search problem
var Excel = React.createClass({
displayName: 'Excel',
__preSearchData: null,
_log: [],
propTypes: {
headers: React.PropTypes.arrayOf(
React.PropTypes.string
),
initialData: React.PropTypes.arrayOf(
@adamabernathy
adamabernathy / simple_test.py
Created February 6, 2017 16:14
Simple assertion test
# encoding: utf-8
"""
TESTING SCRIPT for Time Rate of Change - QC Flag Test
"""
def assert_(statement, result, caption='*'):
"""
Simple assertion test
"""
@adamabernathy
adamabernathy / index.html
Last active February 13, 2017 16:12
Image viewer for brian
<!DOCTYPE html>
<!--
Photo Viewer
View all images in a directory by clicking buttons.
This allows you to stay on the same page rather than clicking the back button every time you want to see a different image.
Image name can not have any spaces!!
Created by Brian Blaylock
Date: November 30, 2015
Updated with bootstrap style: February 10, 2017
http://home.chpc.utah.edu/~u0553130/Brian_Blaylock/home.html
@adamabernathy
adamabernathy / latest.html
Last active June 14, 2017 22:07
Simple example using Mesonet Latest
<html>
<body>
<h2>Simple Latest Example</h2>
<p>See the console for the full data response.</p>
<hr/>
<div id="result"></div>
</body>
<script>
@adamabernathy
adamabernathy / weather-ticker.html
Last active June 27, 2017 16:34
Scrolling Weather Ticker
<html>
<head>
<title>Scrolling Weather Ticker</title>
<style>
@-webkit-keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
@adamabernathy
adamabernathy / mesonet_example.py
Created August 19, 2017 17:22
Python example using urllib, urllib2 and json to interface with the SL Mesonet API
from urllib import urlencode
from urllib2 import Request, urlopen, URLError, HTTPError
import json
def fetch_data(service, parameters={}, debug=False):
'''Calls the Mesonet API service and returns data as a dictionary'''
baseurl = 'https://api.mesowest.net/v2/'
_parameters = urlencode(parameters)
payload = None # Set default to None, so you can catch errors later
<html>
<head>
<style>
h1 {
text-align: center;
}
.container {
padding: 0 5em 5em 5em;
@adamabernathy
adamabernathy / grades.html
Last active December 22, 2017 15:07
Nathan's grade calculator
<html>
<head>
<style>
ul {
list-style: none;
}
label {
margin-right: 1em;