Skip to content

Instantly share code, notes, and snippets.

View stephenjbarr's full-sized avatar

Stephen Jeffrey Barr stephenjbarr

View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@sevennineteen
sevennineteen / example.json
Created December 28, 2012 18:16
Example using Jinja2 to populate a JSON payload template
{ "path": "/content/geometrixx/my-first-jinja-page",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:Page" }],
"nodes": [
{ "path": "jcr:content",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:PageContent"},
@benhsu
benhsu / collect-ips.el
Created January 17, 2013 04:33
code to grab all the strings matching a given regex and put them in a buffer, along with sample use for IPs
(defun collect-regexp-results (regex)
;;; collects all the matches of regex in a buffer called *collect-result*
;;; then switches to that buffer
;;; TODO refactor this to take the region as a parameter
(interactive "Mregex to search for: ")
(let ((curmin (region-or-buffer-beginning))
(curmax (region-or-buffer-end)))
(save-excursion
(goto-char curmin)
;; (goto-char (region-or-buffer-beginning))
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

(defun wc/narrow-window ()
(let (( new-right
(max 0 (+ (or (cdr (window-margins)) 0)
(- (window-body-width) fill-column)))))
(set-window-margins nil (car (window-margins)) new-right)
(set-window-fringes nil (car (window-fringes)) 2)))
(define-minor-mode wrap-column-mode
"Wrap the text at `fill-column'.
Works by adjusting the right margin."
@geoff-parsons
geoff-parsons / live-update-chartjs.html
Created June 1, 2013 05:36
Example of live updating Chart.js charts.
<!DOCTYPE html>
<html>
<head>
<title>Chart.js Redraw Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="chart.min.js"></script>
<script type="text/javascript" charset="utf-8">
window.chartOptions = {
segmentShowStroke: false,
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@cwvh
cwvh / .ghci
Last active December 23, 2015 15:39
Read header comment on how to setup.
{-
Place contents of this file in $HOME/.ghci then run
$ cabal install -j2 hoogle
$ hoogle data
-}
let ghciEscapeShellArg arg = "'" ++ concatMap (\c -> if c == '\'' then "'\"'\"'" else [c]) arg ++ "'"
:def! h return . (":! hoogle --color --count=20 " ++) . ghciEscapeShellArg
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.