Skip to content

Instantly share code, notes, and snippets.

View dstroot's full-sized avatar
:octocat:
Slingin' Code

Dan Stroot dstroot

:octocat:
Slingin' Code
View GitHub Profile
@ericelliott
ericelliott / env-examples.md
Last active February 6, 2024 20:57
env-examples

Most configuration really isn't about the app -- it's about where the app runs, what keys it needs to communicate with third party API's, the db password and username, etc... They're just deployment details -- and there are lots of tools to help manage environment variables -- not the least handy being a simple .env file with all your settings. Simply source the appropriate env before you launch the app in the given env (you could make it part of a launch script, for instance).

env files look like this:

SOMEVAR="somevalue"
ANOTHERVAR="anothervalue"

To source it:

$ source dev.env # or staging.env, or production.env, depending on where you're deploying to

@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@christopheranderton
christopheranderton / homebrew-github-api-token.md
Last active January 2, 2024 13:07
Set your Github API Token If you hit a ”GitHub API rate limit exceeded” when searching with Homebrew (http://brew.sh/).

Description

PLEASE SCROLL DOWN AND READ THE COMMENTS FOR A MORE UP TO DATE WAY (AND EASIER) TO DO THIS
When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

PLEASE SCROLL DOWN AND READ THE COMMENTS FOR A MORE UP TO DATE WAY (AND EASIER) TO DO THIS

package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@renestalder
renestalder / README.md
Last active April 22, 2024 21:58
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@paulirish
paulirish / bling.js
Last active April 20, 2024 17:39
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;