Skip to content

Instantly share code, notes, and snippets.

Avatar

Radu Chiriac raduchiriac

  • Bruxelles, Belgium
View GitHub Profile
@raduchiriac
raduchiriac / prepare-commit-msg
Last active Jun 22, 2020
Hook: Prepend Jira ticket ID to the git commit message
View prepare-commit-msg
#!/bin/bash
# Get the current branch name
current_branch=`git rev-parse --abbrev-ref HEAD`
# Search Jira ID in a pattern such a "feature/ABCD-123-my-feature"
id=$(echo $current_branch | sed -nE 's,[a-z]+/([A-Z]+-[0-9]+)-.+,\1,p')
# only prepare commit message if pattern matched and jiraId was found
if [[ ! -z $id ]]; then
@raduchiriac
raduchiriac / Convert to MP3.sh
Last active Aug 2, 2019
Basic workflow for converting FLAC and WAV files to MP3 straight from the context menu
View Convert to MP3.sh
# Make sure you have ffmpeg installed (`brew install ffmpeg`)
#!/bin/bash
for f in "$@";
do
if [[ $f == *.flac ]]; then
/usr/local/bin/ffmpeg -i "$f" -vn -ab 320k -map_metadata 0 -id3v2_version 3 "${f%.flac}.mp3"
fi
if [[ $f == *.wav ]]; then
@raduchiriac
raduchiriac / agnosterated.zsh-theme
Last active Mar 28, 2019
Custom oh-my-zsh theme with line separator
View agnosterated.zsh-theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@raduchiriac
raduchiriac / closures.js
Last active Mar 10, 2016
Understandable Closures
View closures.js
function buildFun(n){
var res = [];
for (var i = 0; i< n; i++){
(function(number){
res.push(function(){
return number;
});
})(i)
}
return res;
View main.scss
// Referencing
.adidas {
.shoe &.dirty {
color: red;
}
}
// Logs
@warn "Key not found.";
@raduchiriac
raduchiriac / ch1.js
Last active Feb 22, 2016
JavaScript is Beautiful (w/ a little ES6 make-up)
View ch1.js
// Smart decider
var age = 20;
age >= 18 && console.log( "You are allowed to play this game" ); // TRUE
age >= 18 || console.log( "The game is restricted to 18 and over" ); // FALSE
function fn( cb ) {
cb && cb();
};
// Configuring a new Object