Skip to content

Instantly share code, notes, and snippets.

View mattboldt's full-sized avatar

Matt Boldt mattboldt

View GitHub Profile
tell application "UA Mixer Engine"
if it is running then
quit
else
launch
end if
end tell
@mattboldt
mattboldt / creative-cloud-disable.md
Created November 6, 2021 18:22 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@mattboldt
mattboldt / textfield.js
Created June 2, 2021 23:07 — forked from roshangautam/textfield.js
Override Default textfield.js to remove is-invalid by default for required textfields.
(function() {
'use strict';
MaterialTextfield = window['MaterialTextfield'];
/**
* Handle lost focus.
*
* @private
*/
@mattboldt
mattboldt / MyComponent.js
Last active May 3, 2020 23:59
ES6 Set and Map with React Hooks
import React from 'react'
import useRefProxy from './useRefProxy'
const MyComponent = () => {
const [state, setProxy] = useRefProxy(new Set([1, 2, 3, 4]))
const [mapState, mapProxy] = useRefProxy(
new Map([
[1, { foo: 1 }],
[2, { foo: 2 }],
])
@mattboldt
mattboldt / react form with FormData.jsx
Last active February 7, 2020 16:59
React Form refactor
// And option B: leveraging `FormData`
handleSubmit = (e) => {
e.preventDefault()
// Use our this.form ref we set in `<form>` below
const form = this.form
// Use the `FormData` API
const data = new FormData(form)
// Translate our `FormData` object to api-friendly json
@mattboldt
mattboldt / ActiveModel.ts
Created January 30, 2020 16:53
TypeScript OOP Bullshit
class MapProxy {
public map = new Map<string, any>()
keys() {
return this.map.keys()
}
values() {
return this.map.values()
}
get(key: string) {
return this.map.get(key)
@mattboldt
mattboldt / class-vs-hooks.jsx
Last active September 25, 2019 18:03
React Classes v.s. Hooks when communicating with a REST api
const List = () => {
// Items would come from an API
const items = [{ id: 1, active: true, complete: false }, ...]
return (
<ul>
{items.map((item) => (
<ListItem item={item} />
))}
</ul>
)
@mattboldt
mattboldt / s3-updater.rb
Last active July 5, 2019 13:20
Update S3 object metadata of an entire bucket using the AWS Ruby SDK
require 'aws-sdk'
require 'active_support'
require 'active_support/core_ext'
# http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#copy_to-instance_method
COPY_TO_OPTIONS = [:multipart_copy, :content_length, :copy_source_client, :copy_source_region, :acl, :cache_control, :content_disposition, :content_encoding, :content_language, :content_type, :copy_source_if_match, :copy_source_if_modified_since, :copy_source_if_none_match, :copy_source_if_unmodified_since, :expires, :grant_full_control, :grant_read, :grant_read_acp, :grant_write_acp, :metadata, :metadata_directive, :tagging_directive, :server_side_encryption, :storage_class, :website_redirect_location, :sse_customer_algorithm, :sse_customer_key, :sse_customer_key_md5, :ssekms_key_id, :copy_source_sse_customer_algorithm, :copy_source_sse_customer_key, :copy_source_sse_customer_key_md5, :request_payer, :tagging, :use_accelerate_endpoint]
Aws.config.update({
region: 'us-east-1',
credentials: Aws::Credentials.new(AWS_ACCESS_KEY, AWS_SECRET_KEY)
@mattboldt
mattboldt / putonglasses.txt
Created December 4, 2018 22:00 — forked from cheeaun/putonglasses.txt
put on glasses unicode
•_•)
( •_•)>⌐■-■
(⌐■_■)
@mattboldt
mattboldt / route-differ.md
Created August 13, 2018 18:57
Route differ
git checkout ams_master
rake routes | cat > routes1.txt

git checkout organize_routes
rake routes | cat > routes2.txt

diff -u routes1.txt routes2.txt
#=&gt; no diff results!