Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Deyvid Nascimento deyvin

🏠
Working from home
View GitHub Profile
View wordpress.nginx.conf
server {
root /var/www/promo;
index index.php index.html index.htm;
server_name example.com.br;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
View project.rb
puts "w h a t s a p p"
puts "22981691431"
View transacao_firebird_php.php
<?php
$db = ibase_connect ('localhost:/usr/db/db.gdb', 'SYSDBA', 'masterkey');
$tr = ibase_trans( IBASE_DEFAULT, $tr ); #abre a transação do firebird
$insert = "INSERT INTO CLIENTES (ID, NOME) VALUES (1, 'JOSE')";
ibase_query($tr, $insert);
$insert = "INSERT INTO CLIENTES (ID, NOME) VALUES (1, 'JOSE')";
@deyvin
deyvin / acrescimo.php
Last active Jan 4, 2016
Como chegar a um valor de acréscimo aplicando um percentual de desconto para chegar ao valor fixo.
View acrescimo.php
<?php
$valor_desejado = 500;
$percentual = 20;
echo ($valor_desejado * 100) / (100$percentual);
View sum_rand_values_php.php
<?php
define('TOTALAPLICADO', 1000);
define('PERC_RENDIMENTO', 15);
define('DIAS', 31);
$total_por_dia = ((TOTALAPLICADO * PERC_RENDIMENTO) / 100) / DIAS;
@deyvin
deyvin / mysql_count_all_tables.php
Created Oct 17, 2013
Dynamic sql count - all mysql database tables
View mysql_count_all_tables.php
<?php
mysql_connect("localhost", "root", "1234");
$banco = 'ecommerce';
$db_selected = mysql_select_db($banco);
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_assoc($result)) {
@deyvin
deyvin / ecommerce.rb
Last active Dec 20, 2015
Script para pesquisar preço dos ecommerce a partir do código interno do produto
View ecommerce.rb
require 'nokogiri'
require 'open-uri'
require 'mysql2'
class Ecommerce
attr_accessor :id, :name, :price, :bank_price, :con
@@con = Mysql2::Client.new(:host => 'localhost', :username => 'root', :password => '1234', :database => 'ecommerce')
def acessar_site(url)
Nokogiri::HTML(open(url, :proxy_http_basic_authentication => ['http://192.168.254.200:8080', 'deyvin', 'fdcsistemas123'] ))
View bebeu_agua.php
<?php
$bebeu_agua = "Não";
$ta_com_sede = "To";
if($bebeu_agua == "Não") {
if($ta_com_sede == "To") {
echo "Água, Água, Água mineral, Água mineral...";
}
}
@deyvin
deyvin / dynamic_thumbnail_with_php.php
Created Jan 14, 2013
This script is a perfect method to create thumbnail with uploaded images. Enjoy us!
View dynamic_thumbnail_with_php.php
<?php
# ----------------------------------------------------------------------
# DFN Thumbnailer
# http://www.digifuzz.net
# digifuzz@gmail.com
# ----------------------------------------------------------------------
# Constants
View relative_time.php
<?php
function plural($num) {
if ($num != 1)
return "s";
}
function getRelativeTime($date) {
$diff = time() - strtotime($date);
You can’t perform that action at this time.