Skip to content

Instantly share code, notes, and snippets.

View sawyerh's full-sized avatar

Sawyer Hollenshead sawyerh

View GitHub Profile
@elirousso
elirousso / gist:3d5892eaa5d3b15dd901
Last active December 4, 2020 03:56
Dark Minimal Slack Theme
#Paste in Preferences > Sidebar Theme > Click thing at the bottom to expose the input and copy pasta this guy in there
#111111,#111111,#333333,#FFFFFF,#444444,#FFFFFF,#FFFFFF,#FF0000
@grvhi
grvhi / gist:fbda7c0afed03ae1ef8c
Created February 23, 2015 18:30
AWS Lambda Function to Trigger ElasticTranscoder Job on S3 Upload
console.log('Checking newly uploaded file');
var AWS = require('aws-sdk');
var s3 = new AWS.S3({apiVersion: '2006-03-01'});
var eltr = new AWS.ElasticTranscoder({
apiVersion: '2012-09-25',
region: 'us-east-1'
});
// ID of pipeline
var pipelineId = 'myID';
// ID of ET's web output preset

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@francolaiuppa
francolaiuppa / express-controller.js
Last active April 21, 2023 17:31
Express JS + Amazon S3 + DropzoneJS Code Snippet
// Requires https://www.npmjs.org/package/s3-policy and https://www.npmjs.org/package/node-uuid
var config = require('env/' + process.env.NODE_ENV),
policy = require('s3-policy'),
uuid = require('node-uuid');
// SETUP S3
const AWS_ACCESS_KEY = config.s3.accessKey;
const AWS_SECRET_KEY = config.s3.secret;
const S3_BUCKET = config.s3.bucket;
@Rob--W
Rob--W / html5-formdata-polyfilll.js
Created May 27, 2014 22:07
FormData polyfill for Web Workers.
/*
* FormData for XMLHttpRequest 2 - Polyfill for Web Worker
* (c) 2014 Rob Wu <rob@robwu.nl>
* License: MIT
* - append(name, value[, filename])
* - XMLHttpRequest.prototype.send(object FormData)
*
* Specification: http://www.w3.org/TR/XMLHttpRequest/#formdata
* http://www.w3.org/TR/XMLHttpRequest/#the-send-method
* The .append() implementation also accepts Uint8Array and ArrayBuffer objects
@ethnt
ethnt / _rainbows.sass
Last active December 24, 2015 12:39
Make a rainbow border like on CreativeMornings.com.
@import compass/css3
// A lot of this is taken from Hugo Giraudel's post on CSS Tricks
// about this: http://css-tricks.com/striped-background-gradients/
// Create a rainbow-style border before or after an element.
//
// rainbows([$position, $size, $colors...])
@mixin rainbows($position, $size, $colors...)
$stripe-width: 100% / length($colors)
$ = jQuery
$.fn.lineHeight or= ->
if height = @data('lineHeight')
return height
# Create a hidden div with the same font
# properties, then measure its height
$shadow = $('<span />')
$shadow.css({
@robinsloan
robinsloan / langoliers.rb
Last active April 7, 2024 13:22
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@faisalman
faisalman / analytics-regexp.js
Created April 18, 2011 08:06
Regular Expression snippets to validate Google Analytics tracking code (in PHP, JavaScript)
/**
* Regular Expression snippets to validate Google Analytics tracking code
* see http://code.google.com/apis/analytics/docs/concepts/gaConceptsAccounts.html#webProperty
*
* @author Faisalman <movedpixel@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://gist.github.com/faisalman
* @param str string to be validated
* @return Boolean
*/