Skip to content

Instantly share code, notes, and snippets.

View daftspunk's full-sized avatar

daft daftspunk

View GitHub Profile
@scottjbarr
scottjbarr / .goconfig
Last active June 12, 2021 14:52
Install a particular version of Go, and a .goconfig to setup your shell
# source this file from your .bash_profile
export GOROOT=~/.go/versions/go1.10.3
export GOPATH=~/p/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@johanobergman
johanobergman / 1. Info.md
Last active February 7, 2019 21:01
Laravel-style DI in JavaScript

Laravel-style DI in JavaScript

Honestly, coming from PHP, I really don't like the way dependencies are handled in JavaScript. Using require() or import either gives me a singleton object, or a class that I have to instantiate myself.

The DI container in Laravel is wonderful, and allows you to basically just ask for a dependency in a class constructor and it hands it to you. You can bind things to the container, but you can also resolve things without explicitly binding them, which I think is awesome.

@emcode
emcode / form-script.html
Created May 13, 2012 14:59
How to convert HTML form data to JS object (for using with AJAX)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>How to convert HTML form data to JS object (for using with AJAX)</title>
</head>
<body>
<form id="contact-form" action="/" method="post">