Skip to content

Instantly share code, notes, and snippets.

View dmnemec's full-sized avatar

Devin Nemec dmnemec

  • Walmart Global Tech
  • Cedar Falls, IA
View GitHub Profile
@dmnemec
dmnemec / incoming_mux_example.go
Created September 15, 2020 22:32
Example of handling incoming http requests
package main
import (
"io"
"log"
"net/http"
"os/exec"
)
func main() {
package isogram
import (
"strings"
)
func IsIsogram(w string) bool {
if len(w) <= 1 {
return true
}
package scrabble
import "strings"
func Score(word string) (score int) {
var points = map[string]int{"A": 1,
"B": 3,
"C": 3,
"D": 2,
"E": 1,
@dmnemec
dmnemec / hamming.go
Created June 21, 2019 17:57
Hamming solution
package hamming
import (
"errors"
)
//Distance returns the hamming distance of two segments of DNA represented as strings
func Distance(a, b string) (int, error) {
if len(a) != len(b) {
@dmnemec
dmnemec / hamming.go
Created June 21, 2019 17:56
Hamming solution 2
package hamming
import (
"errors"
)
//Distance returns the hamming distance of two segments of DNA represented as strings
func Distance(a, b string) (int, error) {
la := len(a)
lb := len(b)
@dmnemec
dmnemec / space-age.go
Created June 21, 2019 16:39
Space Age solution
// packge space
// Contains outter-space related functions for gathering information based on planets
package space
import "math"
const (
//Ratios that I typed as constants first and didn't want to type out a second time in the map
meR = 0.2408467
veR = 0.6159726
@dmnemec
dmnemec / two-fer.go
Created June 21, 2019 16:34
two-fer solution
// This is a "stub" file. It's a little start on your solution.
// twofer
// Contains a function about sharing
package twofer
import "strings"
// ShareWith
// returns a string about sharing
func ShareWith(name string) string {
@dmnemec
dmnemec / vim-cheat-sheet.md
Created February 19, 2016 03:29 — forked from ummahusla/vim-cheat-sheet.md
Vim Cheat Sheet

Modes

Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.

Quitting

  • :x Exit, saving changes
  • :q Exit as long as there have been no changes
  • ZZ Exit and save changes if any have been made
  • :q! Exit and ignore any changes

Inserting Text