Skip to content

Instantly share code, notes, and snippets.

/*
A (very) WIP collection of optimized/recommended jQuery plugin patterns
from @addyosmani, @cowboy, @ajpiano and others.
Disclaimer:
-----------------------
Whilst the end-goal of this gist is to provide a list of recommended patterns, this
is still very much a work-in-progress. I am not advocating the use of anything here
until we've had sufficient time to tweak and weed out what the most useful patterns
@chrisneal
chrisneal / getLocalIP.go
Last active June 2, 2018 14:56
Fetch the prefered internal IP address
func getLocalIP() string {
conn, err := net.Dial("udp", "8.8.8.8:80")
if err != nil {
log.Fatal(err)
}
defer conn.Close()
localAddr := conn.LocalAddr().String()
idx := strings.LastIndex(localAddr, ":")
@chrisneal
chrisneal / clamav.go
Last active July 4, 2017 15:48
ClamAV Virus check
package main
import (
"bufio"
"encoding/binary"
"fmt"
"io"
"net"
"os"
"strings"
@chrisneal
chrisneal / linktogopath.sh
Created September 29, 2017 14:31
Bash function I use for symlinking the go projects outside of my GOPATH into my GOPATH
linktogopath() {
if [ "$1" = "" ]; then
local folder=${PWD##*/}
else
local folder=$1
fi
ln -s $(PWD) $GOPATH/src/$1
cd $GOPATH/src/$folder
}
@chrisneal
chrisneal / hex2rgb.go
Last active October 5, 2017 09:19
Create RGB values from a full length HEX color code
package main
import (
"fmt"
"strconv"
)
type Hex string
type RGB struct {

Keybase proof

I hereby claim:

  • I am chrisneal on github.
  • I am christoph2k (https://keybase.io/christoph2k) on keybase.
  • I have a public key whose fingerprint is C9ED 9F1E 59BE 8B66 2B91 4BA7 2222 8C5A 0BA9 732F

To claim this, I am signing this object:

@chrisneal
chrisneal / wilson.php
Created June 19, 2018 14:18 — forked from julienbourdeau/wilson.php
[PHP] 5 Star Rating - Lower bound of Wilson score confidence interval for a Bernoulli parameter
<?php
/*
|--------------------------------------------------------------------------
| 5 Star Rating
|--------------------------------------------------------------------------
|
| Lower bound of Wilson score confidence interval for a Bernoulli parameter (0.9604)
|
| See:
version: '2'
services:
redis:
image: redis
postgres:
image: 'postgres'
environment:
POSTGRES_USER: postgres
<?php
// TO DO: ADD VALIDATION ON EMAIL AND ZIP BEFORE REQUEST
$email = $_POST['email'];
$zip = $_POST['zip'];
$url = 'https://api.myngp.com/v2/contacts/findOrCreate';
$post_data = array(
@chrisneal
chrisneal / ender3v2_setup.gcode
Last active July 5, 2021 08:11
Ender 3 v2 Setup
; Purpose:
; Jyers 1.3.4 has a bug (which I think comes from Marlin), where
; you have to reset the EPROM before it will correctly create a mesh.
; This collection of GCODEs sets up my printer with the correct
; settings, does a PID Autotune and then creates a UBL mesh.
; I've also left in the G26 command, which creates a test print.
; Clear the EPROM
M502 ; Load defaults
M500 ; Save