Skip to content

Instantly share code, notes, and snippets.

View cezarsmpio's full-sized avatar
🌚
Hi!

Cezar Sampaio cezarsmpio

🌚
Hi!
View GitHub Profile
@cezarsmpio
cezarsmpio / gatsby-config.js
Last active July 13, 2021 13:37
Rendering Contentful rich text tables with the React renderer with Gatsby
module.exports = {
// ... all your other configs
plugins: [
// ... all your other plugins
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: process.env.CONTENTFUL_SPACE_ID,
accessToken: process.env.CONTENTFUL_API_KEY,
environment: process.env.CONTENTFUL_SPACE_ENVIRONMENT,
@cezarsmpio
cezarsmpio / postal-codes.json
Created August 13, 2018 10:21
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$" }, { "Note":
@cezarsmpio
cezarsmpio / .gitconfig
Created January 15, 2018 10:42 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
@cezarsmpio
cezarsmpio / docker_0.md
Created May 5, 2017 17:16 — forked from goyalankit/docker_0.md
Docker Commands

Docker cheatsheet.

  • To get the list of commands:

      $ docker
    
  • To search for images in docker index:

      $ docker search tutorial
    
@cezarsmpio
cezarsmpio / color.js
Created December 16, 2016 03:03
Color temperature
import colr from 'colr';
let colorTemperature = function(t)
{
// Map the temperature to a 0-1 range
var a = (t + 30)/60;
a = (a < 0) ? 0 : ((a > 1) ? 1 : a);
// Scrunch the green/cyan range in the middle
var sign = (a < .5) ? -1 : 1;
@cezarsmpio
cezarsmpio / index.html
Created December 12, 2016 21:18
Overflow Text JS
<p data-overflow>Olá Daniel Nass, como está você meu filho?</p>
@cezarsmpio
cezarsmpio / package.json
Last active January 6, 2017 20:56
Monkberry boilerplate
{
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --config webpack.dev.js"
},
"devDependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"html-webpack-plugin": "^2.22.0",
@cezarsmpio
cezarsmpio / css.js
Created August 24, 2016 16:29
Add CSS with object
HTMLElement.prototype.css = function (style) {
for (let k in style) {
this.style[k] = style[k];
}
};
// Example 1
document.body.css({
backgroundColor: 'rgb(20,20,20)',
fontFamily: 'Arial, sans-serif',
{
"config": {
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "upper",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
@cezarsmpio
cezarsmpio / functions.php
Created July 26, 2016 02:56
Wordpress - Get page permalink by slug
<?php
/**
* The page permalink by slug
* @param string $slug The page slug
* @return string The permalink
*/
function page_permalink_by_slug($slug) {
return get_permalink( get_page_by_path( $slug ) );
}