Skip to content

Instantly share code, notes, and snippets.

View rwisner's full-sized avatar
👋
Hello World

Rob Wisner rwisner

👋
Hello World
  • Star Publishing
  • Tucson, AZ
View GitHub Profile
@rwisner
rwisner / create_evernote_entry.rb
Created December 26, 2014 05:57
Create a new Evernote note
#!/usr/bin/ruby
require 'evernote-thrift'
# create the time vars
time_now = Time.new
time_tmp = time_now + (60 * 60 * 24)
time_tom = Time.local(time_tmp.year,time_tmp.mon,time_tmp.day,10,0,0)
time_sec = time_tom.to_i * 1000
#!/bin/bash
# =========================
# Add User OSX Command Line
# =========================
# An easy add user script for Max OSX.
# Although I wrote this for 10.7 Lion Server, these commands have been the same since 10.5 Leopard.
# It's pretty simple as it uses and strings together the (rustic and ancient) commands that OSX
# already uses to add users.
@rwisner
rwisner / Swift3JSONStructs.swift
Created August 22, 2017 16:23 — forked from stinger/Swift3JSONStructs.swift
Swift 3: JSON-serializable structs using protocols
//: # Swift 3: JSON-serializable structs using protocols
//: Most of the implementation is based on the code in [this blog post](http://codelle.com/blog/2016/5/an-easy-way-to-convert-swift-structs-to-json/)
import Foundation
//: ### Defining the protocols
protocol JSONRepresentable {
var JSONRepresentation: Any { get }
}
protocol JSONSerializable: JSONRepresentable {}
@rwisner
rwisner / restaurant_sort.html
Created April 28, 2019 17:32
Firebase Restaurant List Sort
<script src="https://www.gstatic.com/firebasejs/4.12.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyBDNw-JYXcsGxmoy3VR3nIoCpgBMuFtWqw",
authDomain: "restaurant-f0492.firebaseapp.com",
databaseURL: "https://restaurant-f0492.firebaseio.com",
projectId: "restaurant-f0492",
storageBucket: "restaurant-f0492.appspot.com",
messagingSenderId: "531297456626"
<h1>Heading one</h1>
<h2>Heading two</h2>
<h3>Heading three</h3>
<h4>Heading four</h4>
<h5>Heading five</h5>
<h6>Heading six</h6>
In this sentance <strong>these words are bold</strong>
@rwisner
rwisner / displaygreeting.js
Created September 27, 2020 20:45
Display good morning, afternoon or evening based on the time
// display good morning, afternoon or evening based on the time
function displayGreeting() {
var date = new Date();
var hour = date.getHours();
var description = "";
if (hour < 12) {
description = "morning";
} else if (hour < 17) {
description = "afternoon";
} else {
@rwisner
rwisner / displayrssfeed.js
Last active September 27, 2020 20:46
Fetch an RSS feed and display the title and description
// fetch an RSS feed and display the title and description
function displayRSSFeed() {
var origURL = 'https://tucson.com/search/?f=rss&t=article&c=news/local&l=5&s=start_time&sd=desc';
// feednami doesn't like & so replace with %26
var replacedURL = origURL.replace(/&/g, "%26");
feednami.load(replacedURL,function(result) {
if (result.error) {
console.log(result.error);
} else {
var entries = result.feed.entries
@rwisner
rwisner / fetchweather.js
Created September 27, 2020 20:48
Get weather data from openweathermap and display the current temp
// get weather data from openweathermap and display the current temp
function fetchWeather() {
fetch("https://api.openweathermap.org/data/2.5/weather?zip=85705,US&appid=APIKEYHERE&units=imperial")
.then(function(resp) { return resp.json() })
.then(function(data) {
document.getElementById("weather").innerHTML = "It is currently " + data.main.temp + "&deg; in Tucson, AZ";
})
.catch(function() {
document.getElementById("weather").innerHTML = "Error in fetchWeather function";
});
@rwisner
rwisner / listSheet.js
Last active October 1, 2020 18:13
List Google Sheet rows
function listSheet() {
fetch('https://api.sheetson.com/v2/sheets/SHEET_NAME_HERE', {
withCredentials: true,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY_HERE',
'X-Sheetson-Spreadsheet-Id': 'SHEET_ID_HERE'
}
})
.then(function(resp) { return resp.json() })