Skip to content

Instantly share code, notes, and snippets.

View stephenjfox's full-sized avatar

Stephen Fox stephenjfox

View GitHub Profile
@stephenjfox
stephenjfox / const-in-order.js
Last active November 25, 2022 12:35
const vs function declaration, showing why you must declare your work first
/*
This shows that, because of block-scoping, const function references must be
invoked in-order or else things will fail silently.
const's are added the name space serially (in the order in which they appear)
and much of the body isn't declared when we first try to invoke or functions
*/
const tryDoTheThing = () => {
console.log(`This is me trying to be awesome ${getAwesome()}`)
@stephenjfox
stephenjfox / quote-tweeter.js
Created January 22, 2017 09:46
Create and send a tweet for a Random Quote Machine
/* Read the text from our elements and compose a tweet POST request string*/
const formTweetUrl = () => {
// Element initializations elided
const text = mainQuoteElement.innerHTML;
const author = authorElement.innerHTML;
const tweetUrl = `https://twitter.com/share?text="${text}" - ${author}&url=http://codepen.io/stevemasta34/full/GrWmjJ/`;
return tweetUrl;
};
const sendTweet = () => {
@stephenjfox
stephenjfox / mdn-search.md
Created July 18, 2017 16:03 — forked from parshap/mdn-search.md
Chrome shortcut to search MDN

mdn Chrome Search Shortcut

Shortcut to perform a Google I'm Feeling Lucky search on https://developer.mozilla.org.

MDN search animation

1. Settings: Manage search engines...

Google Chrome Settings Page

@stephenjfox
stephenjfox / LedgerActivities.kt
Last active September 23, 2023 19:37
Parse XML in Kotlin with Jackson
import com.fasterxml.jackson.annotation.JsonAlias
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonRootName
import java.util.*
data class LedgerActivityDetail(
@set:JsonProperty("TransactionType")
var loanType: String? = null,
@stephenjfox
stephenjfox / data.json
Created November 4, 2018 17:37
An example of a Mongo-compatible document
{ "student_id" : 0, "type" : "exam", "score" : 54.6535436362647 }
@stephenjfox
stephenjfox / tensorflow-basics.ipynb
Last active January 14, 2019 02:54
TensorFlow Basics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.