Skip to content

Instantly share code, notes, and snippets.

Working from home

Joe Chasinga jochasinga

Working from home
Block or report user

Report or block jochasinga

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
jochasinga / bst.es6
Created Feb 6, 2017
Binary search tree implemented in ES6
View bst.es6
'use strict';
class Node {
constructor(data) { = data;
this.left = undefined;
this.right = undefined;
jochasinga / bin_search.es6
Created Feb 5, 2017
Binary search a sorted array.
View bin_search.es6
function search(dst, arr) {
// sort the input array
arr.sort((a, b) => a-b);
// if array is reduced to a member and still no match, return false
if ((arr.length == 1) && (arr[0] !== dst))
return false;
// define a middlebound
jochasinga / buttonsWithInput.elm
Created Jan 2, 2017
Simple user input and buttons example
View buttonsWithInput.elm
-- Modified button example
-- Added a reset button and a field to indicate step size to increment or decrement
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import String
jochasinga / session.go
Last active Oct 1, 2017
Example of middlewares in Go
View session.go
package main
import (
type Session struct {
Email string
Password string
jochasinga / curry.go
Created Nov 20, 2016
Example of currying (higher order functions) in Go
View curry.go
package main
import "fmt"
type List struct {
Inner []int
func NewList(s []int) List {
return List{Inner: s}
jochasinga / server.go
Created Nov 9, 2016
Database server in Go that uses url.Value as temporary key-value store and path parameter + query string to set and get data.
View server.go
/* Database server */
package main
import (
jochasinga / printTime.ino
Created Oct 3, 2016
Get and print local time from an Arduino Yun.
View printTime.ino
#include <Process.h>
Process date; // process used to get the date
int dates, month, years, hours, minutes, seconds; // for the results
int lastSecond = -1; // need an impossible value for comparison
void setup() {
Bridge.begin(); // initialize Bridge
Serial.begin(9600); // initialize serial
jochasinga / di_3.go
Last active May 31, 2016
Example of dependency injection in action
View di_3.go
package di
import (
// This is a pretty dumb function. It can only works
// if you want to stay with "Hello" forever.
func PrintIfMatchedHello(msg string) {
jochasinga / di_test.go
Last active Jun 1, 2016
Dependency injection in unit testing
View di_test.go
package di
import (
// Watcher takes an io.Writer as an attribute
type Watcher struct {
View di_2.go
package main
import "log"
// An interface for an abstraction between structs
type StringWriter interface {
// LogWriter now implements StringWriter
You can’t perform that action at this time.