Skip to content

Instantly share code, notes, and snippets.

module BadQueriesFinder
def self.find
@codes = {}
File.open("#{Dir.pwd}/log/development.log", 'r') do |f|
f.each_line do |line|
if line.match(/ SELECT /)
# puts line.remove_color_codes
# puts "-------------------------------------------------------------------------------"
{
"bold_folder_labels": true,
"close_windows_when_empty": true,
"fade_fold_buttons": false,
"highlight_line": true,
"highlight_modified_tabs": true,
"indent_to_bracket": true,
"open_files_in_new_window": false,
"rulers":
[
@pedrobachiega
pedrobachiega / wp-functions.php
Last active August 29, 2015 13:57
Conjunto de utilidades para temas do Wordpress
<?php
// remove junk from head
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
@pedrobachiega
pedrobachiega / wp-plugins-list.txt
Last active December 16, 2015 01:49
Lista de plugins para Wordpress
http://downloads.wordpress.org/plugin/google-analytics-for-wordpress.4.3.5.zip
http://downloads.wordpress.org/plugin/akismet.2.6.0.zip
http://downloads.wordpress.org/plugin/disqus-comment-system.2.74.zip
http://downloads.wordpress.org/plugin/feedburner-plugin.zip
http://downloads.wordpress.org/plugin/contact-form-7.3.7.2.zip
http://downloads.wordpress.org/plugin/wordpress-gzip-compression.zip
http://downloads.wordpress.org/plugin/wp-smushit.1.5.0.zip
http://downloads.wordpress.org/plugin/wp-super-cache.1.0.zip
http://downloads.wordpress.org/plugin/force-strong-passwords.1.3.2.zip
http://downloads.wordpress.org/plugin/limit-login-attempts.1.7.1.zip
<?php
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME']);
define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
.nofloat, .noFloat {float:none;}
.fright, .fRight {float:right;}
.fleft, .fLeft {float:left;}
.cboth, .cBoth {clear:both;}
.cright, .cRight {clear:right;}
.cleft, .cLeft {clear:left;}
.dblock, .dBlock {display:block;}
.dinline, .dInline {display:inline; float:none;}
@pedrobachiega
pedrobachiega / gist:4117593
Created November 20, 2012 12:14
Reading and parsing GA Cookie UTMZ
cookie_ga_utmz = cookies['__utmz']
source, medium, campaign, value = nil
splited = cookie_ga_utmz.split("|")
splited.each do |token|
if token.include?("utmcsr=")
source = URI.unescape(token.split("utmcsr=")[1])
elsif token.include?("utmcmd=")
medium = URI.unescape(token.split("utmcmd=")[1])
elsif token.include?("utmccn=")
@pedrobachiega
pedrobachiega / index.markdown
Created August 8, 2012 21:34
Integrações RD Station - HTML puro

Integrações RD Station

HTML Puro

Para quem não tem conhecimento técnico, a integração via HTML Puro é a mais simples de integrar ao RD Station. Mas, infelizmente, ainda é preciso fazer algumas pequenas modificações no seu arquivo HTML.

Usando a API

Quatro coisas são necessárias editar/adicionar na sua página para a integração funcionar:

@pedrobachiega
pedrobachiega / gist:2691483
Created May 14, 2012 02:46
Regex to extract links from HTML ( http://rubular.com/r/ESweX4uBlb )
require "test/unit"
class HtmlLinkTagsRegex < Test::Unit::TestCase
def regex
regex = /<a.+?href=["']([^"']+)["'].*?>(.+?)<\/a>/im
end
def test_extract_links
html = <<-html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML template</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0">
<script type="text/javascript" src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<!--
<link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css" />