Skip to content

Instantly share code, notes, and snippets.

View VxJasonxV's full-sized avatar
💻
Using GitHub

Jason Salaz VxJasonxV

💻
Using GitHub
  • Castle Rock, CO, USA
View GitHub Profile
@stevenharman
stevenharman / erb_now.rb
Last active December 16, 2020 17:28
Render Ruby ERB templates, inline, with variables bound and available local variables in the template. ✨ This technique is useful for rendering test fixtures via ERB, for example.
require "ostruct"
# A wrapper around a single ERB template that will bind the given Hash of values,
# making them available as local variables w/in the template.
class ErbNow < OpenStruct
# Render a given ERB +template+ string, binding the entries in the given +attrs+ Hash
# as local variables in the template, with the key as the variable name.
#
# @example
#
@stevenharman
stevenharman / restart-network-services
Created June 16, 2020 16:25
Restart Active Network Services on your Mac. You know, for the VPN!
#! /usr/bin/env bash
# shellcheck disable=SC2059
set -euo pipefail
# Toggle all currently 'Active' network servcies (e.g., Wi-Fi, Ethernet
# connections, etc...) to "restart" them. We'll ignore any already 'Disabled'
# services, and toggle all of the others to 'Disabled' and then back to
# 'Enabled'. This has been found helpful when your VPN won't re-connect after
# undocking and re-docking your MacBook, for example.
@jmccartie
jmccartie / instructions.md
Created May 3, 2016 22:03
Patch ImageMagick on Heroku

Patch ImageMagick on Heroku

  • Create a new file on your project: .magick/policy.xml
  • Add the following to its contents:
<policymap>
  <policy domain="coder" rights="none" pattern="EPHEMERAL" />
  <policy domain="coder" rights="none" pattern="URL" />
  <policy domain="coder" rights="none" pattern="HTTPS" />
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@BoldBigflank
BoldBigflank / gist:254fb6a148918fa89119
Last active September 15, 2015 04:53
Drawful Colors
javascript: {
var color = null;
var c = $('canvas.sketchpad')[0];
var swidth = 32;
var sheight = 32;
var emojiX = 0;
var emojiY = 0;
function changeColor(newColor) {
@ericlevine
ericlevine / migrate_repo.rb
Last active August 29, 2015 13:56
GitHub to GitHub repository migration script
require "json"
require "typhoeus"
require "pp"
# MigrateRepo usage instructions:
#
# The way this is used at Airbnb for migrating from GitHub to GHE is by
# creating a separate organization with no members called "migration",
# adding that as the target organization, and then once the migration
# has finished, moving it over to the intended location.
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh