Skip to content

Instantly share code, notes, and snippets.

View GianlucaGuarini's full-sized avatar
🎸
Rocking the world with few lines of code

Gianluca Guarini GianlucaGuarini

🎸
Rocking the world with few lines of code
View GitHub Profile
@GianlucaGuarini
GianlucaGuarini / test2.tag
Last active November 27, 2015 22:44 — forked from madfriend/test2.tag
<my-tag>
<p>{ opts.msg }</p>
</my-tag>
String.prototype.template = function (object) {
// Andrea Giammarchi - WTFPL License
var
stringify = JSON.stringify,
re = /\$\{(.*?)\}/g,
evaluate = [],
i = 0,
m
;
while (m = re.exec(this)) {
@GianlucaGuarini
GianlucaGuarini / commit-msg
Last active March 17, 2021 23:08 — forked from remi/commit-msg
Commits typos checker hook
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
Handlebars.getTemplate = function(name) {
if (Handlebars.templates === undefined || Handlebars.templates[name] === undefined) {
$.ajax({
url : 'templatesfolder/' + name + '.handlebars',
success : function(data) {
if (Handlebars.templates === undefined) {
Handlebars.templates = {};
}
Handlebars.templates[name] = Handlebars.compile(data);
},