Skip to content

Instantly share code, notes, and snippets.

💭
Geeking out on React Native

Christopher Pedersen topherPedersen

💭
Geeking out on React Native
Block or report user

Report or block topherPedersen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@topherPedersen
topherPedersen / count_instances.sql
Created Feb 21, 2020
Count the Number of Instances a Particular Value Appears in a MySQL Table
View count_instances.sql
SELECT column_with_recurring_value, count(*) as `count`
FROM my_database.my_table
GROUP BY column_with_recurring_value;
View mysql_on_digitalocean_quickstart_guide.txt
How to Setup MySQL on DigitalOcean
Step 1: Spin up MySQL Droplet
Step 2: Log in to server from command line using password sent via email
$ ssh root@123.45.67.891
// Enter Password
// Change Password
@topherPedersen
topherPedersen / define_struct_and_append.go
Created Feb 20, 2020
Define a Struct in Golang, Instantiate an Instace of that Struct, and Append Items to the Struct
View define_struct_and_append.go
package main
import "fmt"
type ServerResponse struct {
Songs []string
}
func main() {
View mystruct.go
package main
import(
"fmt"
)
func main() {
fmt.Println("It's time to learn about Structs...")
View funkyfunc.go
package main
import(
"fmt"
)
func main() {
var favoriteNumbers []float64
@topherPedersen
topherPedersen / working_reducer.js
Last active Feb 16, 2020
Working Redux Reducer
View working_reducer.js
const initialState = {
snacks: []
}
const logCaloriesReducer = (state, action) => {
// check for state undefined to prevent
// redux from crashing app on load
if (typeof state === 'undefined') {
return initialState;
}
@topherPedersen
topherPedersen / broken_reducer.js
Last active Feb 16, 2020
Broken Redux Reducer
View broken_reducer.js
const initialState = {
snacks: []
}
const logCaloriesReducer = (state, action) => {
// check for state undefined to prevent
// redux from crashing app on load
if (typeof state === 'undefined') {
return initialState;
}
@topherPedersen
topherPedersen / index.html
Created Feb 10, 2020
HTML Page for Simple Golang Webserver Demo
View index.html
<!DOCTYPE html>
<html>
<body>
<h1>My Super Sweet Homepage</h1>
<button onclick="doStuff()">CLICK HERE</button>
<script>
@topherPedersen
topherPedersen / webserver.go
Created Feb 10, 2020
Simple Web Server for Hosting Static HTML in Golang
View webserver.go
// REFERENCE (Simple Static Web Server in Go): https://stackoverflow.com/questions/26559557/how-do-you-serve-a-static-html-file-using-a-go-web-server
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("./")))
http.ListenAndServe(":3000", nil)
View weather.json
{
"@context": [
"https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld",
{
"wx": "https://api.weather.gov/ontology#",
"geo": "http://www.opengis.net/ont/geosparql#",
"unit": "http://codes.wmo.int/common/unit/",
"@vocab": "https://api.weather.gov/ontology#"
}
],
You can’t perform that action at this time.