Skip to content

Instantly share code, notes, and snippets.

View theprincy's full-sized avatar

Notelseit.com theprincy

View GitHub Profile
@theprincy
theprincy / Scriptcase - Paginação automática
Created February 3, 2023 06:30 — forked from camilamoreiradev/Scriptcase - Paginação automática
Código criado para trocar a paginação da grid automaticamente a cada 10 segundos.
Requisitos:
- Precisa habilitar a opção "Linhas" na barra de ferramentas inferior.
- Precisa habilitar a opção "Navegação por página" na barra de ferramentas inferior.
- Precisa deixar a grid com a opção "Paginação = Parcial" com "10 registros" por vez.
- Este código deve ser jogado no evento onScriptInit da grid(consulta).
Atenção:
- Onde tiver "10000" você troca pela quantidade de segundos que deseja que a paginação aconteça.
- Essa quantidade equivale a 10 segundos.
$cnpj = {cnpj};
$webservice = "https://www.receitaws.com.br/v1/cnpj/".$cnpj;
$consulta = file_get_contents($webservice);
$retorno = json_decode($consulta,true);
if($retorno["status"] == "OK") {
if($retorno["situacao"] == "ATIVA") {
{razao_social} = $retorno["nome"];
{nome_fantasia} = $retorno["fantasia"];
{cep} = str_replace(".", "", str_replace("-", "", $retorno["cep"]));
?>
<style>
.scFormToolbar {
display: none !important;
}
.scFormBorder {
border-style: none !important;
}
td.scFormLabelOddMult.btnNovoCM {
padding: 0 10px !important;
//onScriptInit
[sw_i] = array();
echo <<<HTML
<style>
input#rec_f0_top {
width: 160px !important;
padding: 10px !important;
}
</style>
@theprincy
theprincy / calculateDifferenceBetweenTwoPeriods
Created February 3, 2023 06:24 — forked from camilamoreiradev/calculateDifferenceBetweenTwoPeriods
This function calculates the difference in hours between 2 complete periods.
function calculateDifferenceBetweenTwoPeriods($start, $end) {
$start = new DateTime($start);
$end = new DateTime($end);
$interval = $start->diff($end);
//Uncomment the line below to see all the returned values for the difference.
//print_r($interval);
$hour = str_pad($interval->h, 2, '0', STR_PAD_LEFT);
@theprincy
theprincy / Cookies JS
Created February 3, 2023 06:24 — forked from camilamoreiradev/Cookies JS
Adicionar opção de termos e condições dentro de uma página.
//criando cookies
function setCookie(nome, valor) {
valor = encodeURI(valor);
document.cookie = nome + '=' + valor;
}
//buscando cookies
function getCookie(nome) {
var cname = nome + '=';
var cookies = document.cookie;
@theprincy
theprincy / .htaccess
Created January 1, 2023 09:43 — forked from seoagentur-hamburg/.htaccess
UPDATE 2022/10: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.6 - 10/2022
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@theprincy
theprincy / readydedis.com.conf
Created March 26, 2021 11:26 — forked from Bharat-B/readydedis.com.conf
nGINX rewrite rules for whmcs 8
server {
listen 80 default_server;
server_name readydedis.com www.readydedis.com;
return 301 https://readydedis.com$request_uri;
}
# HTTPS server
#
server {
listen 443;
@theprincy
theprincy / install.php
Created February 9, 2021 14:51 — forked from tschoffelen/install.php
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
<?php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip'));
$zip = new ZipArchive();
$res = $zip->open('wp.zip');
if ($res === TRUE) {
@theprincy
theprincy / README.md
Last active February 9, 2021 13:41 — forked from mrrooijen/README.md
Setting up XEN on a Hetzner Dedicated Server

Setting up XEN on a Hetzner Dedicated Server

Author: Michael van Rooijen (@mrrooijen)

DISCLAIMER: I am a programmer, not a sysadmin in my day-to-day life. I provide this guide simply as a self-reference, and as a way to contribute to the community of developers. The main motivation for writing this guide is because of the lack of properly written guides/tutorials. They were either out-dated, inaccurate, in a non-English language or simply too vague to understand (at least for me, as a programmer and not a sysadmin).

I hope this guide helps getting you up and running with your own collection of VPS's on your own Dedicated Server over at Hetzner.de.

Requirements: