Skip to content

Instantly share code, notes, and snippets.

View wyattjoh's full-sized avatar
🏳️‍🌈

Wyatt Johnson wyattjoh

🏳️‍🌈
View GitHub Profile
db.users.find({}).forEach(function(user) {
db.users.update({id: user.id}, {$set: {
username: user.displayName,
lowercaseUsername: user.displayName
}});
});
@wyattjoh
wyattjoh / deploy.sh
Last active November 4, 2016 23:19
Talk Deployment Script
#!/bin/bash
#
# Deploys an instance of talk using docker.
#
# Usage:
#
# bash deploy.sh 1.0.0
#
# This deploys a version 1.0.0.
paths:
/comments:
post:
request:
body:
- Comment
response:
- Comment
/comments/:comment_id/actions:

TODO Rundown

Task 1: Seperate implementation from librairy

Seperate your code into a new structure matching the following:

cmd
 `- todo
lib
type Database interface {
Execute(c *mgo.Collection) error
}
type Result struct{}
func MyService(db Database) (*Result, error) {
var result Result
f := func(c *mgo.Collection) error {
package main
import (
"fmt"
"time"
)
func main() {
const value = "2015-08-04 14:33:21.89115181 -0600 MDT"
const layout = "2006-01-02 15:04:05.999999999 -0700 MST"
func test() {
semaphore := make(chan struct{}, internalGoRoutineAsyncMax)
for i := 0; i < 1000; i++ {
go func() {
semaphore <- struct{}{}
defer func() { <-semaphore }()
// process...
}()
}
@wyattjoh
wyattjoh / cli_provider.go
Created July 21, 2016 16:10
CLI Config Provider
package main
import (
"flag"
"strings"
"github.com/urfave/cli"
)
// CLIProvider provides configuration from the cli.Context passed into an
class Node:
def __init__(self, parent, name):
self.parent = parent
self.name = name
def get(self, name):
return Node(self, ".".join([self.name, name]))
def root(self):
node = self
postgres=# EXPLAIN SELECT name FROM categories WHERE similarity(name, 'cr') > 0.3;
QUERY PLAN
----------------------------------------------------------------------------
Seq Scan on categories (cost=0.00..208.55 rows=2323 width=9)
Filter: (similarity((name)::text, 'cr'::text) > '0.3'::double precision)
(2 rows)