Skip to content

Instantly share code, notes, and snippets.

View dmitric's full-sized avatar

Dmitri Cherniak dmitric

View GitHub Profile
@dmitric
dmitric / video_links.py
Created August 19, 2013 09:21
Misaka based HtmlRenderer that lets you embed youtube and vimeo videos
@dmitric
dmitric / amazon_signing.py
Last active December 24, 2015 13:38
Signing AWS requests
def _sign_params(self, params, host, uri="/", action="GET"):
buffer = "%s\n" % action
buffer += "%s\n" % host
buffer += "%s\n" % uri
buffer += '&'.join("%s=%s" % (self._quote(i[0]), self._quote(i[1])) for i in sorted(params.items()))
signature = base64.b64encode(
hmac.new(self.secret_access_key, buffer, hashlib.sha256).digest()
)
return signature
@dmitric
dmitric / README.md
Last active August 29, 2015 14:06
A nice way to generate external apis

I hate using third party language libraries because they are often just a crappier more OOP'd version of a nice rest api. Here's a sample framework for automatically generating call chains that map to the RESTful url.

Just define the verbs and nouns you want to use in the resources set. And when the API changes or adds new endpoint, just toss em in there too!

POST /buttons maps to api.buttons.post

or

Keybase proof

I hereby claim:

  • I am dmitric on github.
  • I am dmitric (https://keybase.io/dmitric) on keybase.
  • I have a public key ASA_hdjGryyH4aXeTpn4vr5AHZFlqhgPvOrbjh0ftsrUago

To claim this, I am signing this object:

import { svgPathProperties } from "svg-path-properties"
calculateConnectionsBetweenPaths (d, lastd, segments) {
// Take in two "d" attribute string and break then down into N segements
// and return a list of those points
const connections = []
// Given a path's value of d, get the total length of the path
const pp = new svgPathProperties(d)