Skip to content

Instantly share code, notes, and snippets.

@baranga
baranga / pre-commit
Created June 21, 2017 09:32
eslint as git pre commit hook
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@baranga
baranga / vagrant
Last active August 29, 2015 14:13
use vagrant with empty ssh-agent
#!/bin/bash
# start vagrant without connection to ssh-agent to avoid problems regarding
# ed25519 keys
# see https://twitter.com/datagrok/status/552874864969654272
unset SHH_AGENT_PID
unset SSH_AUTH_SOCK
/usr/bin/vagrant $*
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>location hash test</title>
</head>
<body>
<h1>location hash test</h1>
<dl>
<dt>hash</dt>
@baranga
baranga / path_segment_encode.php
Created October 9, 2012 08:27
sample implementation of path segment encode with benchmark
<?php
class PathSegmentEncode
{
/**
* Map of allowed special chars in path segments.
*
* http://tools.ietf.org/html/rfc3986#appendix-A
* segement = *pchar
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"