Skip to content

Instantly share code, notes, and snippets.

View hbd's full-sized avatar
💭
:)

Zak hbd

💭
:)
View GitHub Profile
for (i = r; i < r+8; i++) {
for (j = c; j < c+8; j++) {
...
tmp = A[i][j];
B[j][i] = tmp;
...
}
}
I hereby claim: [15/76896]
* I am hbd on github.
* I am mister (https://keybase.io/mister) on keybase.
* I have a public key ASBD9YjzUdtA_MMMkI4GUJ45IDk7FMMbYsWNpzX3geOHdAo
To claim this, I am signing this object:
```json
{
@hbd
hbd / xss alert test
Last active November 25, 2016 16:22
alert();
# taken from discussion -- not original code
n = int(input().strip())
bucket = defaultdict(list) # bucket, actually a list with 1 key/n values
# store each input in the appropriate sub-bucket location
# use the string's length as the index (key), and appends it at that sub-bucket location
# this collects all string of the same length in the same sub-bucket location
for _ in range(n):
number = input().strip()
bucket[len(number)].append(number)
@hbd
hbd / pr-template.md
Created October 24, 2018 14:27
[WIP] PR Template

What's this PR do?

Where should the reviewer start?

Test output?

/*
Instructions:
To enable dark mode in Slack, add this to bottom of /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://gist.githubusercontent.com/hbd/04bdcb1af1658230374279c9013b91f0/raw/acbca2a4b40d892f44b65d62ce49626848351b15/slack-dark-mode.css',
success: function(css) {
let overrides = `
code { background-color: #535353; color: #85c5ff; } // Change color: to whatever font color you want
@hbd
hbd / main.go
Created January 11, 2020 03:52
h3ll0, w0rld!
package main
import (
"fmt"
)
func main() {
fmt.Println("h3ll0, w0rld!")
}
@hbd
hbd / bing.go
Created January 22, 2020 06:34
Writing Clients in Go: Redundancy and the `*iface` Package
package bing
func (c *Client) DriveTime(ctx context.Context, locations ...Location) (float64, error) {
// Call external API.
driveTime, err := c.httpclient.Post(ctx, c.config.Endpoint+"/routing/time", ...)
...
return driveTime, nil
}
package locationiface
type Client interface {
DriveTime(context.Context, ...Location) (float64, error)
}
package location
type Client struct {
clients []locationiface.Client
}
func NewClient(clients ...locationiface.Client) *Client {
return &Client{clients: clients}
}