Skip to content

Instantly share code, notes, and snippets.

View paolocarrasco's full-sized avatar
🙌
Let's make development with quality again!

Paolo Carrasco paolocarrasco

🙌
Let's make development with quality again!
View GitHub Profile
@paolocarrasco
paolocarrasco / bower-grunt.md
Last active December 28, 2015 13:19
How to use the Bower installation command in Grunt before the execution of the tests.

As I needed to run the bower installation before my tests run in the CI (I use Travis-CI), I had to implement a custom task in Grunt to do so; the issues I had with the grunt tasks I found out there was that they didn't do the simplest thing: run the install command. This is an easy thing and it doesn't require any plugin. It's very important the event 'end' and the async method. The task won't finish successfully without it. You can see the complete gruntfile here

/*global require */
module.exports = function(grunt) {

 // ...
@paolocarrasco
paolocarrasco / mocha-test-with-modified-stringify.js
Last active December 28, 2015 15:38
A way to solve the problem of JSON.stringify "serialize cyclic structures" in mocha-phantomjs (https://github.com/metaskills/mocha-phantomjs/issues/104). Required only if you're printing in the console objects with cyclic structures (not very common).
describe('functionalityToTest', function() {
var stringify = JSON.stringify;
before(function() {
JSON.stringify = function(obj) {
var seen = [];
return stringify(obj, function(key, val) {
if (typeof val == "object") {
if (seen.indexOf(val) >= 0) { return; }
@paolocarrasco
paolocarrasco / commit-msg.rb
Last active December 29, 2015 05:39
A *commit-msg git hook* where I ask to enter the issue number, the Github usernames and then the description of the commit.
#!/usr/bin/env ruby
# Github usernames may only contain alphanumeric characters
# or dashes and cannot begin with a dash
$regex = /^(?:(?:fixes|closes|resolves)\s)?#\d+\s\[@[a-z0-9][a-z0-9\-]*(?:,\s@[a-z0-9][a-z0-9\-]*)*\]\s(?:\w+[\.\,]?\s)+/i
message_file = ARGV[0]
message = File.read(message_file)
if !$regex.match(message)
@paolocarrasco
paolocarrasco / post-commit.rb
Created November 24, 2013 23:47
Capture pictures in your commits. Save this file as post-commit (without extensions) in your .git/hooks directory of your repository. Needs https://github.com/rharder/imagesnap Reference: https://github.com/rharder/imagesnap#git-hook-usage There is other that allows you to put the commit message in the picture (http://mroth.github.io/lolcommits/)
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file}"
exit 0
@paolocarrasco
paolocarrasco / snippets.cson
Created November 13, 2014 22:07
Some snippets for Atom to create typical blocks in JS
'.source.js':
'\'Describe\' block jasmine in unit test':
'prefix': 'describe'
'body': """
describe(\'$1\', function() {
$2
});
""",
'\'It\' block in jasmine unit test':
'prefix' : 'it'
Válidos
--------
Teléfono internacional (prefijo adelante) de dos números
+51 (54) 430-23214
+51 (54) 43023214
Teléfono nacional
(54) 20 - 7291
(54) 207 291
Celular
938 298 123
@paolocarrasco
paolocarrasco / web-container.log
Created November 30, 2016 22:51
sass is not found for gulp-ruby-sass within docker-compose
web | npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
web | npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.15
web | Looking up npm:aurelia-bootstrapper
web | Looking up npm:aurelia-framework
web | Looking up npm:aurelia-history-browser
web | Looking up npm:aurelia-fetch-client
web | Looking up npm:aurelia-auth
web | Looking up npm:aurelia-http-client
web | Looking up npm:aurelia-materialize-bridge
web | Looking up npm:aurelia-router
@paolocarrasco
paolocarrasco / app.html
Created January 25, 2017 07:15 — forked from jdanyow/app.html
Minimum Aurelia with no build system
<template>
<h1>${message}</h1>
</template>
@paolocarrasco
paolocarrasco / README.md
Last active March 28, 2024 10:27
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@paolocarrasco
paolocarrasco / git-auto-sign-commits.sh
Last active October 11, 2022 11:44 — forked from mort3za/git-auto-sign-commits.sh
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# Set a gpg key for git (from previous step... the key_id is after the slash):
git config --global user.signingkey your_key_id