Skip to content

Instantly share code, notes, and snippets.

@robsonsobral
robsonsobral / inline-block-example.html
Created July 29, 2011 04:29 — forked from necolas/inline-block-example.html
Inline-block layout component
<div class="ibw">
<div class="ib">inline block</div>
<div class="ib">inline block</div>
<div class="ib">inline block</div>
</div>
@robsonsobral
robsonsobral / dabblet.css
Created February 26, 2014 01:40
transition using width or height auto
/**
* transition using width or height auto
*/
ul,li {
display: block;
margin: 0;
padding: 0;
width: 250px;
}
li {
#!/bin/bash
# Location of the nginx config file that contains the CloudFlare IP addresses.
CF_NGINX_CONFIG="/etc/nginx/cloudflare"
# The URLs with the actual IP addresses used by CloudFlare.
CF_URL_IP4="https://www.cloudflare.com/ips-v4"
CF_URL_IP6="https://www.cloudflare.com/ips-v6"
# Temporary files.
CF_TEMP_IP4="/tmp/cloudflare-ips-v4.txt"
CF_TEMP_IP6="/tmp/cloudflare-ips-v6.txt"
# Download the files.
@robsonsobral
robsonsobral / bubble-range.js
Created March 23, 2017 20:14 — forked from dmolsen/bubble-range.js
jQuery-less version of Chris Coyier's Value Bubbles for Range Inputs
/**********************************************************
* jQuery-less version of Chris Coyier's
* Value Bubbles for Range Inputs
* http://css-tricks.com/value-bubbles-for-range-inputs/
**********************************************************/
function modifyOffset() {
var el, newPoint, newPlace, offset, siblings, k;
width = this.offsetWidth;
newPoint = (this.value - this.getAttribute("min")) / (this.getAttribute("max") - this.getAttribute("min"));
@robsonsobral
robsonsobral / cpf_cnpj_validator
Created July 17, 2017 18:10 — forked from igorcosta/cpf_cnpj_validator
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@robsonsobral
robsonsobral / Array.prototype.compare.js
Last active July 19, 2017 18:53 — forked from ain/Array.prototype.compare.js
JavaScript compare() method for Array
Array.prototype.compare = function(array) {
if (!array) {
return false;
}
if (this.length !== array.length) {
return false;
}
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] instanceof Array && array[i] instanceof Array) {
if (!this[i].compare(array[i])) {
@robsonsobral
robsonsobral / unused_img.sh
Created September 4, 2017 16:04
Delete unused image files
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please supply paths to search under"
exit 1
fi
IMG_PATH=$1
HTML_AND_CSS_PATH=$2
@robsonsobral
robsonsobral / hugoMarkdownBlock.html
Created December 18, 2017 22:11
hugoMarkdownBlock
{{ $markdown := . | markdownify }}
{{ if not ( strings.Contains $markdown "<p>" ) }}
<p>{{ $markdown }}</p>
{{ else }}
{{ $markdown }}
{{ end }}
/*
This function will take the scripts specified and load them in order
asynchronously. It will not continue until the specified type from
each file is loaded.
*/
(function () {
function loadScripts () {
/*
This loadScript function takes the name of the object as it
@robsonsobral
robsonsobral / example.html
Last active July 20, 2018 01:14 — forked from raulmangolin/example.html
postMessage example
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>postMessage Example</title>
<script type="text/javascript">
var popup;
function openWindow(){