Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile
@silasrm
silasrm / phpstorm-vs-sublimetext-shortcuts.md
Last active April 23, 2024 20:05
Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

#Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

Sublime Text PHPStorm Função
CMD+P CMD+Shift+O Busca por arquivos no projeto
CMD+R CMD+F12 (1) Lista os métodos da classe e outros símbolos
CMD+F CMD+F Busca no arquivo
CMD+Option+F CMD+R Busca e troca os valores no arquivo
CMD+Shift+F CMD+Shift+F Busca, busca e troca e outros em um determinado caminho com várias regras.
CMD+D (2) Option+Up (2) Seleciona palavra
@silasrm
silasrm / WSSoapClient.php
Created June 9, 2017 18:24 — forked from Turin86/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*
@silasrm
silasrm / index.js
Last active December 3, 2023 15:28
Entendendo a api do bibliaonline.com.br (http://jsbin.com/debagax/1/edit?html,js,output)
// Total de capítulos por livro, na ordem
var totalCapitulos = [50,40,27,36,34,24,21,4,31,24,22,25,29,36,10,13,10,42,150,31,12,8,66,52,5,48,12,14,3,9,1,4,7,3,3,3,2,14,4,28,16,24,21,28,16,16,13,6,6,4,4,5,3,6,4,3,1,13,5,5,3,5,1,1,1,22];
// Livros da bíblia
var livros = [
{
number: 1,
name: "Gênesis",
slugByLang:
{
@silasrm
silasrm / nginx.conf
Created July 22, 2016 05:07 — forked from atma/nginx.conf
Nginx + nodejs + socket.io websockets
# Add to nginx.conf http section
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@silasrm
silasrm / gist:3da655045b899a858eae4f4463755f5c
Last active January 31, 2023 16:03 — forked from maccath/gist:3981205
Split PDF to individual pages using FPDI and FPDF
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/
@silasrm
silasrm / get-zap-contacts-and-download-csv.js
Last active December 28, 2022 18:50
Run this code in developer tools from Whatsapp Web. Get contacts phone number using image profile URL
// @gist https://gist.github.com/silasrm/2f5e87926d08ce21e25c1aed5b9ffae9
// Get contacts phone number using image profile URL
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
var csvData = [];
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
#############################################################################
## data source definitions
#############################################################################
source users
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type = mysql
@silasrm
silasrm / cap-first.sql
Created November 26, 2014 22:38
Função para MySQL para mudar a caixa do texto para Título (CamelCase) Ref: http://joezack.com/2008/10/20/mysql-capitalize-function/
DELIMITER $$
CREATE FUNCTION CAP_FIRST (input VARCHAR(255))
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE len INT;
DECLARE i INT;
@silasrm
silasrm / pagination.php
Last active August 14, 2020 00:38
Paginação com PHP e MySQL puro com slider com padrõa bootstra 4
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows = 15;
$pageNum = 1;
if (isset($_GET['page'])) {
$pageNum = $_GET['page'];
}
$startRow = ($pageNum - 1) * $maxRows;
@silasrm
silasrm / TimeAgo.js
Last active July 7, 2020 12:47
A vue-timeago (https://github.com/egoist/vue-timeago/) version using luxon
// directives/TimeAgo.js
import DateTime from 'luxon/src/datetime.js';
/**
* Need Luxon https://moment.github.io/luxon/
* @usage import Timeago from '../directives/TimeAgo';
Vue.use(Timeago, {locale: 'pt-BR'}); // or Vue.use(Timeago);
* @param opts
*/