Skip to content

Instantly share code, notes, and snippets.

View rodrigocnascimento's full-sized avatar
🐯
i'm a turtle

Rodrigo Nascimento rodrigocnascimento

🐯
i'm a turtle
View GitHub Profile
<div class="col-xs-12 col-sm-4">
<div class="form-group col-xs-12">
<label for="SECAO" class="">SEÇÃO</label>
<select name="secao" id="SECAO" class="col-xs-12 select">
<option value="NULL">Todas as Seções</option>
<option value="2100">EMPREGOS</option>
<option value="1100">IMOVEIS ALUGUEL</option>
<option value="1200">IMOVEIS VENDA</option>
<option value="8100">MAQ. E EQUIPAMENTOS</option>
<option value="7100">MAT DE CONSTRUCAO</option>
@rodrigocnascimento
rodrigocnascimento / gist:1338736c0cb8af0c8ef8
Created December 2, 2014 15:46
Impedir o usuário sair da página, sem gravar os dados
$( function(){
var init_form = $('#id_form').serialize();
// Result example: "name=&email=&message="
// Cancel event onbeforeunload when Submit form
$(':submit').click(function() {
window.onbeforeunload = null;
});

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@rodrigocnascimento
rodrigocnascimento / gist:dee476f5af863f0d4220
Created September 14, 2014 19:13
mime_type_functions.php
<?php
define('APACHE_MIME_TYPES_URL','http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
function generateUpToDateMimeArray($url){
$s=array();
foreach(@explode("\n",@file_get_contents($url))as $x)
if(isset($x[0])&&$x[0]!=='#'&&preg_match_all('#([^\s]+)#',$x,$out)&&isset($out[1])&&($c=count($out[1]))>1)
for($i=1;$i<$c;$i++)
$s[]='&nbsp;&nbsp;&nbsp;\''.$out[1][$i].'\' => \''.$out[1][0].'\'';
return @sort($s)?'$mime_types = array(<br />'.implode($s,',<br />').'<br />);':false;
@rodrigocnascimento
rodrigocnascimento / check_ports.c
Created July 21, 2014 14:56
Check if port are opened to connections in C maybe a future php module
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@rodrigocnascimento
rodrigocnascimento / app
Created February 21, 2014 00:09
dentro de app
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@rodrigocnascimento
rodrigocnascimento / webroot
Created February 21, 2014 00:09
colocar dentro de webroot
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com

#DIRETRIZES DE SEGURANÇA PARA WORDPRESS

###IMEDIATAS

  • Criar senhas únicas de autenticação e salt: https://api.wordpress.org/secret-key/1.1/salt/
  • Não usar 'admin' como usuário e senhas fáceis. De preferência senhas com caracteres minúsculos, maiúsculos e, quando possível, caracteres especiais.
  • Permissões corretas em diretórios e arquivos
  • todos os aquivos - 644
  • diretórios 755
  • themes 555
@rodrigocnascimento
rodrigocnascimento / gist:8547108
Created January 21, 2014 19:53
Gerando XML com ASP
'GERANDO XML ------------------------------------------------------------------------------------------------
ArquivoXML = "lance_a_lance.xml" 'adicionando um nome no arquivo
timestamp = DateAdd("h", 3, Time)
Set FSO = CreateObject("Scripting.FileSystemObject") 'criando o objeto FSO
Set Linhas = FSO.CreateTextFile(Server.MapPath(ArquivoXML), True) 'salvando o arquivo no servidor através do método "CreateTextFile"
'gerando linas
Linhas.WriteLine("<?xml version=""1.0""?>")
Linhas.WriteLine("<LANCE_A_LANCE>")
Linhas.WriteLine("<TEMPO_JOGO>"&titulo&"</TEMPO_JOGO>" )
@rodrigocnascimento
rodrigocnascimento / gist:7082935
Created October 21, 2013 12:17
Git ignore to cakephp projects
# Test URI
# Ignore netbeans folder
nbproject/*
# Ignore private folder
/app/private/*
!/app/private/empty
# Ignore packed asset files
/app/webroot/css/packed/*