This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create table with same csv headers. | |
CREATE TABLE table_name ( id mediumint(9) NOT NULL, {..}, PRIMARY KEY (id) ); | |
# Load csv into table. | |
LOAD DATA INFILE '{abspath}/my-data.csv' | |
INTO TABLE table_name | |
FIELDS TERMINATED BY ',' | |
ENCLOSED BY '"' | |
LINES TERMINATED BY '\n' | |
IGNORE 1 ROWS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u{user} -p{pass} -h{host} {database} -e "{sql}" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /{path}/my-export-{time}.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin { | |
public function remove_profile_page_options( $subject ) { | |
$subject = preg_replace( '#<h2>Opções pessoais</h2>.+?/table>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<h2>Nome</h2>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<h2>Sobre o usuário</h2>.+?/table>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<div class="yoast yoast-settings">.+?/div>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<tr class="user-url-wrap">.+?/tr>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<tr class="user-googleplus-wrap">.+?/tr>#s', '', $subject, 1 ); | |
$subject = preg_replace( '#<tr class="user-twitter-wrap">.+?/tr>#s', '', $subject, 1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$masked_input = '30.029.920-19'; | |
preg_replace('/[^0-9]/', '', $masked_input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git archive -o <repo.zip> HEAD $(git diff --name-only <release-branch> master) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<title>Demo Máscara Telefone</title> | |
</head> | |
<body> | |
Telefone: <input onkeypress="mascaraTelefone(this)"/><br /> | |
<script> | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function title_case($string, $delimiters = array(" ", "-", ".", "'", "O'", "Mc"), | |
$exceptions = array( | |
"de", "da", "dos", "das", "do", "I", "e","II", "III", "IV", | |
"V", "VI", "MBA", "AADM", "em", "in", "and", "or", "of", "EMBA" | |
)){ | |
$string = mb_convert_case($string, MB_CASE_TITLE, "UTF-8"); | |
foreach ($delimiters as $dlnr => $delimiter) { | |
$words = explode($delimiter, $string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* WpAllImport - Fill parent term in taxonomy | |
* Ex: | |
* 1 - [match_pattern({grauacadmico[1]}, array("string1","string2"), "Parent Term")] | |
* 2 - [match_pattern({grauacadmico[1]}, array("string1","string2"))] | |
* | |
*/ | |
function match_pattern($my_field, $my_array, $parent = null) { | |
$result = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
.video-container { | |
position: relative; | |
padding-bottom: 56.25%; | |
padding-top: 30px; height: 0; overflow: hidden; | |
} | |
.video-container iframe, | |
.video-container object, | |
.video-container embed { |
NewerOlder