Skip to content

Instantly share code, notes, and snippets.

@zazapeta
zazapeta / auth.js
Created Nov 23, 2019
Password hashing/verifying in node.js using 'pbkdf2'
View auth.js
const crypto = require("crypto");
// larger numbers mean better security
const config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an
@zazapeta
zazapeta / How to make assiocation with sequelize + migration (umzug)
Last active Jun 20, 2019
How to make assiocation + migration - the programmatic way - with sequelize
View How to make assiocation with sequelize + migration (umzug)
Simple gist on how to make assiocation and migration (with umzug) - the programmatic way - with sequelize
View sobad.js
function getAllOffres() {
var partner = {
user_taskaction_partner_online: new Array(),
user_taskaction_partner_company: this.service.service_company,
user_taskaction_partner_xpto: new Array(),
}
for (let partenerindex in partner.user_taskaction_partner_company) {
partner.user_taskaction_partner_company[partenerindex].PRD_TITLE = partner.user_taskaction_partner_company[partenerindex].CMP_NAME;
@zazapeta
zazapeta / bonjour.sh
Created Jun 19, 2018
WCS_odyssey_unix_2 : Introduction au Shell
View bonjour.sh
#!/bin/sh
echo 'Bonjour' $1
@zazapeta
zazapeta / history.log
Created Jun 19, 2018
WCS_odyssey_unix_1 : Introduction à Unix
View history.log
1 ls *
2 ls
3 cat crimescene
4 head crimescene
5 head crimescene -20
6 head crimescene 20
7 head
8 head --help
9 head crimescene -n 20
10 head crimescene -n 50
@zazapeta
zazapeta / ga-cheatsheet.md
Last active May 11, 2021
Google analytics events cheatsheet
View ga-cheatsheet.md

This is a google analytics events cheatsheet.

Understanding deeply Events:

@zazapeta
zazapeta / flex.less
Created Dec 15, 2016 — forked from codler/flex.less
Prefix flex for IE10 and Safari / iOS in LESS
View flex.less
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {
@zazapeta
zazapeta / KeystoneApiExample.md
Last active Sep 7, 2016 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).
View KeystoneApiExample.md

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@zazapeta
zazapeta / bobp-python.md
Created Nov 11, 2015 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens