Skip to content

Instantly share code, notes, and snippets.

View rafecolton's full-sized avatar
👨‍💻
Infrastructure @ Expensify

Rafe Colton rafecolton

👨‍💻
Infrastructure @ Expensify
View GitHub Profile
@justinpersaud
justinpersaud / gist:6993832c26c2359fba1ac6245ddb77c4
Created April 21, 2020 14:01
Expand all hidden github comments on issues
function loadAllComments() {
let needRescheduling = false;
const buttons = Array.from(document.querySelectorAll('button'));
buttons.forEach((button) => {
if (button.classList.contains('ajax-pagination-btn')) {
if(!button.hasAttribute('disabled') && button.innerText === 'Load more…') {
console.log("found", button);
needRescheduling = true;
button.dispatchEvent(new MouseEvent('click', {
bubbles: true,
#!/bin/env python
import yaml
import sys
import json
import argparse
from subprocess import Popen, PIPE
import argparse
import os
@alexeychikk
alexeychikk / ReactComment.jsx
Last active September 5, 2022 17:35
Simple React HTML comment
/*
Usage (I however think that the code is self explanatory)
<ReactComment text={`
Very long comment with html link
<a href="https://gist.github.com/alexeychikk/bfe72a072a9a962f2da900b6151e4aae">Star me :)</a>
`} />
*/
import React, {Component, PropTypes} from 'react';
@solidsnack
solidsnack / logtee.bash
Created June 9, 2015 22:52
Log STDOUT and STDERR to both syslog and the console.
#!/bin/bash
set -o errexit -o pipefail -o nounset
# Log STDOUT and STDERR to both syslog and the console.
exec 3>&1
exec 4>&2
exec 1> >(tee >(logger -p user.info) 1>&3)
exec 2> >(tee >(logger -p user.notice) 2>&4)
"$@"
@theeventscalendar
theeventscalendar / exclude events category.php
Last active November 27, 2022 03:30 — forked from elimn/tribe_exclude_events_category.php
Excludes specified categories from List and Month views. Add you own categories in line 9.
<?php
/*
* Removes categories "meetup" and "shindig" from list and month views
*/
function tribe_exclude_events_category( $wp_query ) {
// Slugs for the categories you wish to hide
$exclude_cats = array('meetup', 'shindig');
@nh2
nh2 / git-signoff-rebase.gitconfig
Last active April 13, 2018 18:04
How to sign off a whole branch in git
[alias]
# Usage: git signoff-rebase [base-commit]
signoff-rebase = "!EDITOR='sed -i -re s/^pick/e/' sh -c 'git rebase -i $1 && while test -f .git/rebase-merge/interactive; do git commit --amend --signoff --no-edit && git rebase --continue; done' -"
# Ideally we would use GIT_SEQUENCE_EDITOR in the above instead of EDITOR but that's not supported for git < 1.7.8.
@mattetti
mattetti / multipart_upload.go
Last active July 18, 2024 17:31
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@mpouleijn
mpouleijn / shared_example.rb
Created July 25, 2012 07:41
Minitest shared example
class MiniTest::Spec
def self.shared_examples
@shared_examples ||= {}
end
end
module MiniTest::Spec::SharedExamples
def shared_examples_for(desc, &block)
MiniTest::Spec.shared_examples[desc] = block
end
@bmc
bmc / rfc1918.rb
Created May 19, 2012 01:06
Quick and dirty Ruby module to determine if IP address (as string) is RFC-1918 address
module RFC1918
def is_rfc1918_address(ip)
unless ip =~ /^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})$/
raise "#{ip} is not an IP address"
end
octets = [$1, $2, $3, $4].map &:to_i
raise "#{ip} is a bad IP address" unless octets.all? {|o| o < 256}
# The Internet Assigned Numbers Authority (IANA) has reserved the
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active May 17, 2024 08:05
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,