Skip to content

Instantly share code, notes, and snippets.

View http-redirect.go
package main
import (
"flag"
"fmt"
"log"
"net/http"
"net/url"
"os"
"strings"
@holman
holman / emoji_test.rb
Last active Jun 18, 2020
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
View emoji_test.rb
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@ciaranarcher
ciaranarcher / example.go
Created Jul 27, 2014
Wrapping a ResponseWriter to capture the status code
View example.go
// Create our own MyResponseWriter to wrap a standard http.ResponseWriter
// so we can store the status code.
type MyResponseWriter struct {
status int
http.ResponseWriter
}
func NewMyResponseWriter(res http.ResponseWriter) *MyResponseWriter {
// Default the status code to 200
return &MyResponseWriter{200, res}
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname