Skip to content

Instantly share code, notes, and snippets.

View Abdelkrim's full-sized avatar

Abdelkrim from Brussels Abdelkrim

View GitHub Profile
@Abdelkrim
Abdelkrim / prepare-commit-msg
Created February 11, 2019 22:27 — forked from aemonge/prepare-commit-msg
Angular Commit Message Conventions git hook, so you got your commit prepared to with the messages they expect ;)
firstLine=`head -2 $1 | tail -1`
if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;)
echo '<type>(<component>): <subject>' > .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '<body>' >> .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '# types: feat, fix, docs, style, refactor, test, chore(maintain)' >> .prepare-commit-msg-temp
{ cat .prepare-commit-msg-temp; cat $1; } > .prepare-commit-msg-temp2
cat .prepare-commit-msg-temp2 > $1
@Abdelkrim
Abdelkrim / lat1.json
Last active May 16, 2017 12:54
Combine 2 JSON files into 1 file using Python (i.e. longitude and latitude)
{
"tags": [{
"name": "LATITUDE_deg",
"results": [{
"groups": [{
"name": "type",
"type": "number"
}],
"values": [
[1123306773000, 46.9976859318, 3],
Verifying that +abdelkrim is my Bitcoin username. You can send me #bitcoin here: https://onename.io/abdelkrim
var url = require('url');
var nodedump = require('nodedump').init({ expand: true }).dump;
var stripeKPIs = require('../lib/stripeKPIs.js');
var async = require('async');
module.exports = function (app) {
app.get('/stripe/dashboard', function (req, res) {
@Abdelkrim
Abdelkrim / customerPaysPlanWithStripe.js
Last active January 3, 2016 03:29
0. create a customer 1. retrieve selected plan 2. charge a customer ISSUE: 1. Stripe charges twice the user with ±3 seconds delay between the charges 2. The second charge' token isn't not displayed on the web server logs
app.post('/stripeGotoStep02', function (req, res) {
var transaction = req.body;
var newCustomer = {
email: transaction.stripeCustomer.email,
plan: transaction.selectedStripePlan.id,
card: transaction.stripeToken,
description: transaction.stripeCustomer.email,
@Abdelkrim
Abdelkrim / gist:6155469
Created August 5, 2013 12:11
how to call it inside the code: "debug('showAccessibleTabSelector')" src: http://www.youtube.com/watch?v=bntNYzCrzvE (minute 38:00)
//private methods
function debug(msg,info){
if(debugMode && window.console && window.console.log){
if (info){
window.console.log(info+': ',msg);
}
else{
window.console.log(msg);
}
}