Skip to content

Instantly share code, notes, and snippets.

View viniciuscenci's full-sized avatar

viniciuscenci

View GitHub Profile
@viniciuscenci
viniciuscenci / DKIM_SPF_Sendmail
Created May 29, 2023 14:08 — forked from artmouse/DKIM_SPF_Sendmail
DKIM + SPF + Sendmail for multiple domains (Ubuntu)
DKIM is DomainKeys Identified Mail and is used in mail servers, such as Postfix or Sendmail to sign e-mails and thus authenticating the sender so that a forgery can be detected. It also reduces the possibility of an e-mail being flagged as spam, but it's not a definite prevention.
A much simpler method is using SPF (Sender Policy Framework) which, in a nutshell, verifies the sender IP address.
According to the internet, using both should result to ????, PROFIT !!!.
SPF does not need a specific configuration. Whitelisted servers are listed in a DNS record, TXT or SPF, and an example record is:
example.com. IN TXT "v=spf1 a mx ~all"
@viniciuscenci
viniciuscenci / slug.js
Created May 18, 2020 17:06
Javascript Slug
// Taken from https://stackoverflow.com/a/5782563/4851476
var slug = function(str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆĞÍÌÎÏİŇÑÓÖÒÔÕØŘŔŠŞŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇğíìîïıňñóöòôõøðřŕšşťúůüùûýÿžþÞĐđ߯a·/_,:;";
var to = "AAAAAACCCDEEEEEEEEGIIIIINNOOOOOORRSSTUUUUUYYZaaaaaacccdeeeeeeeegiiiiinnooooooorrsstuuuuuyyzbBDdBAa------";
for (var i=0, l=from.length ; i<l ; i++) {
<?php
$html = '<ul>
<li><a href=""><img src="http://..."></a></li>
<li><a href=""><img src="http://..."></a></li>
<li><img src="http://..."></li>
<li><a href=""><img src="http://..."></a></li>
</ul>';
$dom = new DomDocument();
$dom->loadHTML($html);
@viniciuscenci
viniciuscenci / parseTable.php
Last active May 10, 2017 23:44
PHP parse HTML table -> Array
<?php
$html= 'oluna da esquerda, usando o botão "Adicionar mídia" (tamanho Médio).</li>
<li>Digite a descrição na coluna da direita.</li>
</ol>
<table width="500">
<tbody>
<tr>
<td valign="top" width="200"> <img class="alignnone size-medium wp-image-38" src="http://localhost/adriano/wp-content/uploads/2017/05/SAM_0187-300x225.jpg" alt="" width="300" height="225" /></td>
<td valign="top">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</td>
</tr>
@viniciuscenci
viniciuscenci / maskedinput.br.js
Last active August 17, 2016 17:02
jQuery MaskedInput plugin BR phone (9 digits) mask
//optimized
$(function(){
jQuery.fn.brTelMask = function () {
return this.each(function () {
var $el = $(this);
$el.mask("(99) 9999-9999?9");
$el.keyup(function () {