A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
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
/*! 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) { |
This is a google analytics events cheatsheet.
Understanding deeply Events:
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 |
#!/bin/sh | |
echo 'Bonjour' $1 |
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; |
Simple gist on how to make assiocation and migration (with umzug) - the programmatic way - with sequelize |
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 |