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 | |
# Usage: `. color-run.sh` | |
# To perform dry run set `EXEC_DRY_RUN=1` | |
function colors { | |
# check if stdout is a terminal... | |
if test -t 1; then | |
# see if it supports colors... |
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
git config --global alias.broom '!git branch --merged | egrep -v "(^\*|master|dev|release/next)" | xargs git branch -d' |
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
<?php | |
class Stopwatch | |
{ | |
/** | |
* @var array[] | |
*/ | |
private $marks = []; | |
/** |
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
#!/usr/bin/env php | |
<?php | |
$commitMsgFile = $argv[1]; | |
$commitMsg = file_get_contents($commitMsgFile); | |
if(!\in_array(substr($commitMsg, 0, 1), ["\n", "\r"], true)) { | |
return; | |
} |
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
<?php | |
function array_permute($arrays) { | |
$set = array_shift($arrays); | |
foreach($arrays as $sub) { | |
$newSet = []; | |
foreach($set as $prefix) { | |
foreach($sub as $suffix){ | |
$newSet[] = $prefix.$suffix; | |
} | |
} |
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
<?php | |
function render($template, $vars) { | |
return \preg_replace_callback("!{{\s*(?P<key>[a-zA-Z0-9_-]+?)\s*}}!", function($match) use($vars){ | |
return isset($vars[$match["key"]]) ? $vars[$match["key"]] : $match[0]; | |
}, $template); | |
} |
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 logColor(color, args) { | |
console.log(`%c ${args.join(' ')}`, `color: ${color}`); | |
} | |
const log = { | |
aliceblue: (...args) => { logColor('aliceblue', args)}, | |
antiquewhite: (...args) => { logColor('antiquewhite', args)}, | |
aqua: (...args) => { logColor('aqua', args)}, | |
aquamarine: (...args) => { logColor('aquamarine', args)}, | |
azure: (...args) => { logColor('azure', args)}, |
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/sh | |
git log --graph --all --pretty=oneline --decorate --abbrev-commit --shortstat | |
# git config --global alias.tree "log --graph --all --pretty=oneline --decorate--abbrev-commit --shortstat" |
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/sh | |
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d |
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
image: golang:latest | |
stages: | |
- build | |
- test | |
before_script: | |
- go get github.com/tools/godep | |
- mkdir -p /go/src/gitlab.com | |
- cp -r /builds/$CI_PROJECT_NAMESPACE /go/src/gitlab.com/ | |
- cd /go/src/gitlab.com/$CI_PROJECT_PATH |
NewerOlder