Skip to content

Instantly share code, notes, and snippets.

View deankarn's full-sized avatar
That's it I'm getting 100 cups of coffee starting now.

Dean Karn deankarn

That's it I'm getting 100 cups of coffee starting now.
View GitHub Profile
@deankarn
deankarn / decode_seo_params.go
Created April 20, 2017 11:35
decode seo params in pure
package main
import (
"fmt"
"log"
"net/http"
"github.com/go-playground/pure"
mw "github.com/go-playground/pure/examples/middleware/logging-recovery"
"github.com/go-playground/pure/middleware"
@deankarn
deankarn / std-http-PI.go
Last active April 26, 2017 14:07
std net/http is enough PI
package main
import (
"fmt"
"net/http"
"strings"
)
func main() {
@deankarn
deankarn / std-http-PII.go
Created April 26, 2017 14:09
std net/http is enough PII
package main
import (
"fmt"
"net/http"
"strings"
)
func main() {
@deankarn
deankarn / download.rs
Created May 5, 2017 18:43
download.rs
extern crate hyper;
extern crate crypto;
use std::{env, result};
use std::path::Path;
use std::{io, fs};
use std::io::{Read, Write, Seek, SeekFrom};
use hyper::Client;
use hyper::status::StatusCode;
extern crate download;
use std::{io, fs};
use std::io::{Read, Write};
#[test]
fn test_open(){
let mut file = download::open("http://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz").unwrap();
println!("{:?}",file);
extern crate image;
extern crate num_cpus;
use std::fs::File;
use std::thread;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::channel;
use std::cell::RefCell;
const WIDTH: u32 = 2048;
@deankarn
deankarn / do-things-library-example.go
Created July 12, 2018 16:04
Do Things Library Example
package lib
import (
"errors"
"strings"
)
// DoThings ...
func DoThings(s string) error {
if strings.Contains(s, "thing") {
@deankarn
deankarn / do-things-library-tests.go
Created July 12, 2018 16:10
tests for the do things Library
package lib
import (
"testing"
"os"
"github.com/stretchr/testify/require"
)
package mylib
import "net/http"
// Config contains all library configuration data
type Config struct {
Username string
Password string
}
package mylib
import "net/http"
// New create a new Instance of mylib
func New(someAlwaysRequiredValue string) (*Instance, error) {
return &Instance{
client: new(http.Client), // default no auth client
}, nil
}