Skip to content

Instantly share code, notes, and snippets.

@jasonkeene
jasonkeene / before_onpar_test.go
Last active December 24, 2021 03:14
Golang Test Setup
// Before method that runs before each test and can communicate values via arguments
// Pros: Consolidate setup code
// Pros: No sharing of memory between tests, can run in parallel
// Pros: Use symbols for dependencies
// Cons: A little bit magical with using reflection.
func TestSomething(t *testing.T) {
t.Before(func (t *testing.T) (*db.Conn, map[string]interface{}) {
return createDBConn(t), createFixture()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Font
:set guifont=Source\ Code\ Pro:h14
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hide pointless junk at the bottom, doesn't work in .vimrc for some reason?
:set laststatus=0
:set noshowmode "don't show --INSERT--
:set noruler "don't show line numbers/column/% junk
let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 1, 2024 19:36
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@nrollr
nrollr / Commands.sh
Last active January 10, 2023 11:55
Install PHP and NGINX on Amazon Linux AMI
## Install NGINX
## when installing on Amazon Linux AMI, use:
$ sudo yum install nginx -y
## when installing on Amazon Linux 2 AMI, use
$ sudo amazon-linux-extras install nginx1.12 -y
## Install PHP and PHP-FPM
# for PHP version 7.1 use php71 and php71-fpm instead
$ sudo yum install php -y
$ sudo yum install php-fpm -y
@jinzhu
jinzhu / main.go
Created October 1, 2015 00:07
handle postgres json with gorm
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {