Save the file to .git/hooks
and make executable (chmod u+x prepare-commit-msg
)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
### | |
# Usage | |
# | |
# git pie <perl-script> [git grep options] | |
These are my thoughts on the Go 2 draft for error handling.
The example go program they give is:
func CopyFile(src, dst string) error {
r, err := os.Open(src)
if err != nil {
return fmt.Errorf("copy %s %s: %v", src, dst, err)
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, wait, immediate) { | |
var timeout, context, args; | |
return function() { | |
context = this, args = arguments; | |
if (immediate && !timeout) func.apply(context, args); | |
timeout = timeout || setTimeout(function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}, wait); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
## | |
# flatten takes an array of arbitrarily nested arrays of integers and returns a flattened array. | |
# Alternatively, if a block is given, the flattened version of the items is yielded | |
# | |
# :call-seq: | |
# flatten([[1,2,[3]],4]) -> [1,2,3,4] | |
# | |
# flatten([[1,2,[3]],4], &block) yields 1, 2, 3, 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.rb diff=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copy and paste this link in an Inbox tab. Prepend "javascript:" if that part didn't get copied. | |
Change EMAIL to your account if you want to work with multiple accounts. Can be removed to use the default one. | |
<a href='javascript:navigator.registerProtocolHandler("mailto","https://inbox.google.com/?authuser=EMAIL&mailto=%s","Inbox by Google")'>Mail to</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validator { | |
validate 'hello' | |
validate 'world' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Create the Dockins folder and Job DSL seed job from Groovy | |
* Adapted from javaposse.jobdsl.Run | |
*/ | |
import hudson.model.* | |
import jenkins.model.* | |
import javaposse.jobdsl.dsl.DslScriptLoader | |
import javaposse.jobdsl.dsl.JobManagement | |
import javaposse.jobdsl.plugin.JenkinsJobManagement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:( | |
function (){ | |
var json = JSON.parse(document.body.innerText); | |
var create = function(el, props) { | |
var e = document.createElement(el); | |
if (props) { | |
Object.keys(props).forEach(function(key) { | |
e[key] = props[key]; | |
}); |
NewerOlder