Skip to content

Instantly share code, notes, and snippets.

View dleavitt's full-sized avatar

Daniel Leavitt dleavitt

  • Allumia
  • Seattle, WA
View GitHub Profile
@dleavitt
dleavitt / FirehoseHttpEndpointDestination.ts
Created May 23, 2024 22:58
Stream a CloudWatch Log Group to a HTTP Destination via Kinesis Firehose
// Firehose -> HTTP
import * as firehose from "@aws-cdk/aws-kinesisfirehose-alpha";
import {
CommonDestinationProps,
DestinationS3BackupProps,
} from "@aws-cdk/aws-kinesisfirehose-destinations-alpha";
import * as cdk from "aws-cdk-lib";
import * as iam from "aws-cdk-lib/aws-iam";
import * as s3 from "aws-cdk-lib/aws-s3";
@dleavitt
dleavitt / schema.json
Created October 30, 2023 06:19
Ruby JSON Schema
{
"title": "JSON schema for RuboCop configuration files",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"require": {
"$ref": "#/definitions/stringOrStrings"
},
"inherit_from": {
"$ref": "#/definitions/stringOrStrings"
{
"title": "JSON schema for RuboCop configuration files",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"require": {
"$ref": "#/definitions/stringOrStrings"
},
"inherit_from": {
"$ref": "#/definitions/stringOrStrings"
@dleavitt
dleavitt / keybase.md
Created January 12, 2022 19:58
keybase.md

Keybase proof

I hereby claim:

  • I am dleavitt on github.
  • I am dleavitt (https://keybase.io/dleavitt) on keybase.
  • I have a public key whose fingerprint is 1C14 D5B4 4BB7 B2DC 56DE 4734 26FF 959C 0213 8EAD

To claim this, I am signing this object:

<html>
<head>
<style type="text/css">
body {
margin: 0;
}
img {
cursor: pointer;
}
.back {
@dleavitt
dleavitt / actions.js
Last active August 29, 2015 14:27
Alt Actions Inheritance Example
import Alt from 'alt';
let alt = new Alt();
class AnimalActions {
run() {
// do some stuff
this.dispatch();
}
}
@dleavitt
dleavitt / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
CSV_SETTINGS = {
headers: true, # first row is headers
header_converters: :symbol, # convert headers to symbols
converters: [
-> (f) { f.present? ? f : nil }, # convert empty cells to nil
-> (f) { f.respond_to?(:gsub) ? f.gsub(/\s+$/, '') : f }, # convert whitespace to nil
:all # converts things to numbers and dates
]
}
@dleavitt
dleavitt / gist:7966550
Created December 14, 2013 23:41
Bulk rename git feature branches to "old" branches
%x{git branch | grep feature}.split("\n").map(&:strip).map {|o| [o, o.gsub(/^feature\//, "old/")] }.map {|(o, n)| %x{git branch -m #{o} #{n}} }
@dleavitt
dleavitt / image_processors.rb
Created June 4, 2013 01:01
Additional image processors for carrierwave+minimagick
module CarrierWave
module MiniMagick
module ImageProcessors
def store_dimensions(property_name)
# TODO: deal with default version
image = ::MiniMagick::Image.open(current_path)
model.send("#{property_name}=", {}) unless model.send(property_name)
ver = (version_name || "original").to_s
model.send(property_name)[ver] = image["dimensions"]
end