Skip to content

Instantly share code, notes, and snippets.

View bkeepers's full-sized avatar

Brandon Keepers bkeepers

View GitHub Profile
@bkeepers
bkeepers / application.rb
Created May 13, 2020 15:26
Add methods to `rails console`
module SailboatGuide
class Application < Rails::Application
console do
require 'console_helpers'
TOPLEVEL_BINDING.eval('self').extend ConsoleHelpers
end
end
end
@bkeepers
bkeepers / delete-comment.js
Created September 14, 2017 23:40
Probot app to delete 👍 and single emoji comments.
// :+1: comments and single emoji
const pattern = /^\W*(:[\w-\+]+:|[\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])\W*$/g;
module.exports = robot => {
robot.on('issue_comment.created', context => {
if(context.payload.comment.body.match(pattern)) {
context.github.issues.deleteComment(context.issue());
}
})
}
@bkeepers
bkeepers / .env
Last active November 2, 2020 17:32
Probot plugin that ensures every commit message has the word "bananas"
# The ID of your GitHub App
APP_ID=
WEBHOOK_SECRET=development
# Uncomment this to get verbose logging
# LOG_LEVEL=trace # or `info` to show less
# Go to https://smee.io/new set this to the URL that you are redirected to.
# WEBHOOK_PROXY_URL=
// Turn any function calls on a promise into function calls on the result.
//
// For example:
//
// serialPromise(promise).foo();
//
// Is the same as calling:
//
// promise.then(result => result.foo());
//
@bkeepers
bkeepers / opensource-career.md
Last active January 20, 2018 01:39
Tell me your story about how open source has impacted your career.

I’m working on a talk about the relationship between community participation and careers, and want to hear from people who feel like open source has impacted their career. Tell me your story!

Below are some questions related to get you started. Feel free to either fork this gist, blog your answers and send me the link, or email them directly to me at bkeepers@github.com. I will ask your permission before sharing anything about your story publicly.

  • How do you feel your participation in open source has impacted your career, both good and bad?

  • How did you first get exposed to open source? Why did you decide to learn more about it?

  • Do you code? If so, were you a coder when you got started with open source? Why did you learn to code?

>> require 'org-ruby'
>> puts Orgmode::Parser.new(File.read('/tmp/test.org')).to_html
<ul>
<li>Item 1</li>
<li>Item 2
<pre class="example">
Example
Example
Example
</pre>
@bkeepers
bkeepers / modelines.rb
Last active August 29, 2015 14:14
Regular expression for vim and emacs modelines.
/
(?:
(-\*- \s* (?:mode:)? \s*) | # $1: Emacs
(\/\* \s* vim: \s* set \s* (?:ft|filetype)=) # $2: Vim
)
(\w+) # $3: language
(?:
(?(1) # If $1 matched...
;?\s* -\*- | # then close Emacs syntax
: \s* \*\/ # otherwise close Vim syntax

Issue and Pull Request Age

@bkeepers
bkeepers / dabblet.css
Created September 15, 2014 03:43
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@bkeepers
bkeepers / twitnoise
Created June 3, 2014 12:29
Signal & Noise lists on Twitter
#!/bin/bash
#
# This script encapsulates my process for keeping up with Twitter:
#
# 1. Create a private list called Signal, add everyone you currently follow to
# it, and begin curating it.
# 2. Follow everyone you meet or find interesting.
# 3. Create a private list called Noise, containing everyone you follow that are
# not in Signal.
# 4. Use Signal as your timeline in tweetbot. Switch to Noise when you are bored