Skip to content

Instantly share code, notes, and snippets.

@bytefade
bytefade / ffmpeg.convert.mv.sh
Created January 8, 2016 19:09
ffmpeg convert and rename
#!/bin/bash
#
#RUN: find ../uploads/videos/ -iname "*.mp4" -exec ./ffmpeg.sh {} ";"
dir_atual=$(dirname $1)
filename=$(basename $1)
extension=${filename##*.}
filename=${filename%.*}
@bytefade
bytefade / wp-mail.php
Last active January 21, 2016 13:00
Simple mail wordpress for tests
<?php
// 3 - Se der erro me envia uma mensagem
$message = "Postagem atualizado no site:\n\n";
$message .= $post->post_title . ": " . $post_url . "\n\n";
$message .= "URL pequena: " . $short_url . " URL Expand" . $long_url . "\n\n";
$message .= "VAR_DUMP: " . var_dump($response);
if (!$response) {
$subject = 'ERRRO - Teste criar/atualizar post e API short url';
@bytefade
bytefade / 0_reuse_code.js
Created February 12, 2016 11:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bytefade
bytefade / phpkey
Created March 1, 2016 14:33
Colocar no .bashrc
alias phpkey='php -r "echo md5(uniqid()).\"\n\";"'
@bytefade
bytefade / foreach.php
Last active April 13, 2016 13:31
Foreach php array
<?php
$params = ['id' => 0];
try {
$api = new Gerencianet($options);
$subscription = $api->detailSubscription($params, []);
// var_dump($subscription); die;
foreach ($subscription as $value) {
// Array simples
@bytefade
bytefade / number_format_alternative.php
Created April 13, 2016 17:21
number_format_alternative
<?php
echo number_format(substr("11990", 0, -2),0,"",".").','.substr("11990", -2);
@bytefade
bytefade / wp-config.php
Created October 21, 2016 23:55
Wordpress wp-config, style Dotenv
<?php
require_once(__DIR__ . '/vendor/autoload.php');
(new \Dotenv\Dotenv(__DIR__))->load();
define('WP_DEBUG', getenv('WP_DEBUG'));
$table_prefix = getenv('DB_TABLE_PREFIX');
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
@bytefade
bytefade / .env.example
Created October 21, 2016 23:55
Wordpress .env example
WP_DEBUG=false
DB_TABLE_PREFIX=wp_
DB_NAME=wordpress
DB_USER=root
DB_PASSWORD=root
DB_HOST=localhost
AUTH_KEY='put your unique phrase here'
LOGGED_IN_KEY='put your unique phrase here'
@bytefade
bytefade / ativar_popup_wp.php
Last active November 17, 2016 21:38
Ativar popup usando wordpress e magnifig popup
<!-- Ativar popup -->
<script type="text/javascript">
<?php global $wp, $post;
$current_url = home_url(add_query_arg(array(),$wp->request));
// $current_url = home_url();
$meta_popup = get_post_meta($post->ID, 'popupsite', true);
?>
//sim: liga popup nao ou '' desliga popup
@bytefade
bytefade / cores.txt
Created December 21, 2016 18:26
Cores
#F44336
#E91E63
#9C27B0
#673AB7
#3F51B5
#2196F3
#03A9F4
#00BCD4
#009688
#4CAF50