Skip to content

Instantly share code, notes, and snippets.

View jeremylenz's full-sized avatar

Jeremy Lenz jeremylenz

  • New York, NY
View GitHub Profile
@gaearon
gaearon / Classes.js
Created May 27, 2020 17:38
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@johnpmitsch
johnpmitsch / blah.sh
Last active January 31, 2020 20:28
vagrant/virsh snapshot commands bashrc
# virsh-snapshot-create mybox mysnap
function virsh-snapshot-create {
cd ~/forklift
vagrant halt $1
sudo virsh snapshot-create-as forklift_$1 $2
vagrant up $1
}
# virsh-snapshot-list mybox
function virsh-snapshot-list {
@jlsherrill
jlsherrill / minitest_bisect.md
Last active October 11, 2019 14:38
using minitest-bisect with foreman/katello/plugins or really any rails project

Using minitest-bisect to debug tranient test failures

When to use?

  1. You have a test that is failing occasionally locally or in jenkins
  2. It doesn't fail when you run just one test, it requires the entire test suite to run

How to use minitest-bisect

Note that many of these instructions will be katello specific, but will work with slight modifications for foreman or other rails projects.

1. Find a failing seed number

@vibin
vibin / OpenInSafari.scpt
Created January 20, 2017 05:51
Open Chrome's Current URL in Safari
tell application "Google Chrome"
set visibleUrl to get URL of active tab of window 1
end tell
tell application "Safari"
open location visibleUrl
activate
end tell
## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
@yograterol
yograterol / gist:99c8e123afecc828cb8c
Created January 8, 2016 05:45
"gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory" workaround
"gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory" CentOS's and Fedora +22 workaround
Install `redhat-rpm-config`
$ sudo dnf install redhat-rpm-config
@kovacshuni
kovacshuni / hmac-sha1.rb
Last active March 12, 2022 15:05
Ruby HMAC-SHA1 digest creation
require 'base64'
require 'cgi'
require 'openssl'
base = 'POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1318622958%26oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26oauth_version%3D1.0%26status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521'
key = 'kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE'
puts CGI.escape(Base64.encode64("#{OpenSSL::HMAC.digest('sha1', key, base)}\n"))
@bluefuton
bluefuton / lion_patch.rb
Last active April 18, 2024 20:47
Quick example of how to override an instance method in an existing Ruby library. We use this approach when producing Redmine plugins.
#!/usr/bin/env ruby -rubygems
module Zoo
module Animal
class Lion
def make_noise
"rawr"
end
end
end