Skip to content

Instantly share code, notes, and snippets.

View kyleconroy's full-sized avatar
⌨️
Developing sqlc

Kyle Gray kyleconroy

⌨️
Developing sqlc
View GitHub Profile
package main
import (
"github.com/kyleconroy/dal"
)
type Conference struct {
Key int `dal:"id,auto"`
ID string `dal:"lookup"`
}
// write this
import (
"encoding/json"
"net/http"
)
func foo() (int, err) {
resp := try(resp.Get("http://api.stripe.com"))
body := try(ioutil.ReadAll(resp.Body))
@kyleconroy
kyleconroy / deauthorize.php
Created January 6, 2015 20:29
Stripe Connect deauthorize account
<?php
$url = "https://connect.stripe.com/oauth/deauthorize";
$data = array(
'client_secret' => "Replace me with your secret API key",
'client_id' => "Replace me with your client_id",
'stripe_user_id' => "Replace me with your stripe_user_id",
);
$body = http_build_query($data);
@kyleconroy
kyleconroy / po.go
Last active August 29, 2015 14:14
A godep replacement, in 35 lines
package main
import (
"flag"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
)

Go contributors,

When Go became an open source project 5 years ago, Mercurial was the best choice for us for a number of reasons, most important being the ability to support our choice of code review system.

Mercurial has served us well, but it's time to move on. The world today is quite different from the world then. Most members of the Go community use Git and host their work on GitHub, and we should join them. Thanks to the efforts of open source projects like Android, we now have access to a Git-based code review system that fits our workflow.

We are therefore pleased to announce that we plan to migrate the Go project and its subrepositories to GitHub. The issue tracker and the wiki will also be moved; all data will be preserved. We will use a Google-hosted instance of Gerrit for code reviews.

syntax = "proto3";
message SearchRequest {
int32 page_number = 2;
int32 result_per_page = 3;
}
all: blob_pb2.py blob.pb.go
blob.pb.go: blob.proto
protoc blob.proto --go_out=plugins=grpc:.
blob_pb2.py: blob.proto
protoc --python_out=. --grpc_out=. \
--plugin=protoc-gen-grpc=`which grpc_python_plugin` blob.proto
package foo
type Foo struct {
Bar string `json:"bar"`
}
@kyleconroy
kyleconroy / Gopkg.lock
Created July 15, 2017 17:49
example import from govendor
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/lib/pq"
packages = [".","oid"]
revision = "2704adc878c21e1329f46f6e56a1c387d788ff94"
source = "github.com/lib/pq"
[solve-meta]
type Renderer struct {
html *blackfriday.HTMLRenderer
}
func (r *Renderer) RenderHeader(w io.Writer, ast *blackfriday.Node) {}
func (r *Renderer) RenderFooter(w io.Writer, ast *blackfriday.Node) {}
func (r *Renderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus {
switch node.Type {
case blackfriday.CodeBlock:
lexer := lexers.Analyse(string(node.Literal))