Skip to content

Instantly share code, notes, and snippets.

View raduchiriac's full-sized avatar

Radu Chiriac raduchiriac

  • Bruxelles, Belgium
View GitHub Profile
@raduchiriac
raduchiriac / ch1.js
Last active February 22, 2016 21:33
JavaScript is Beautiful (w/ a little ES6 make-up)
// 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
@raduchiriac
raduchiriac / main.scss
Last active April 16, 2016 20:48
Sass Magic
// Referencing
.adidas {
.shoe &.dirty {
color: red;
}
}
// Logs
@warn "Key not found.";
@raduchiriac
raduchiriac / closures.js
Last active March 10, 2016 19:44
Understandable Closures
function buildFun(n){
var res = [];
for (var i = 0; i< n; i++){
(function(number){
res.push(function(){
return number;
});
})(i)
}
return res;
@raduchiriac
raduchiriac / agnosterated.zsh-theme
Last active March 28, 2019 10:53
Custom oh-my-zsh theme with line separator
# 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 / Convert to MP3.sh
Last active August 2, 2019 07:46
Basic workflow for converting FLAC and WAV files to MP3 straight from the context menu
# 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 / prepare-commit-msg
Last active April 17, 2024 13:43
Hook: Prepend Jira ticket ID to the git commit message
#!/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