Skip to content

Instantly share code, notes, and snippets.

@nandub
nandub / prepare-commit-msg
Last active July 19, 2016 22:21 — forked from patrickkettner/prepare-commit-msg
This git hook appends "[ci skip]" to your commit message if the readme file is the only thing being touched. Read more about it here - http://about.travis-ci.org/docs/user/how-to-skip-a-build/
#!/usr/bin/env bash
# a list of all files that are changing with this commit
FILES_CHANGING=$(git diff --cached --name-only --diff-filter=ACM)
# if there is only one file changing
if [ $(echo "$FILES_CHANGING" | wc -l) -eq 1 ]; then
# and that file is a readme
README_CHANGING=$(echo $FILES_CHANGING | grep -Ei "readme(.md|.txt)?$")
@nandub
nandub / phantomjs.rb
Created March 30, 2012 22:41 — forked from fabiomcosta/phantomjs.rb
proposed phantomjs formula
require 'formula'
class NeedsSnowLeopardOrNewer < Requirement
def satisfied?
MacOS.snow_leopard?
end
def message
"phantomjs requires Mac OS X 10.6 (Snow Leopard) or newer."
end
@nandub
nandub / ProtobufEnvelope.java
Created May 1, 2011 05:52
ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically.
import com.google.protobuf.DescriptorProtos;
import com.google.protobuf.Descriptors;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import java.util.HashMap;
/**
* ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically.
*