Skip to content

Instantly share code, notes, and snippets.

@carlosleonam
carlosleonam / consulta-api-procob.php
Created January 8, 2019 12:20
Consulta de retorno da API da PROCOB (https://api.procob.com)
<?php
/**
* @Author: SisSoftwares WEB (Sistemas PHP)
* @Date: 2019-01-08 08:16:58
* @Last Modified by: Usuario
* @Last Modified time: 2019-01-08 08:20:51
*/
$curl = curl_init();
@carlosleonam
carlosleonam / dialog.html
Last active February 21, 2021 23:25 — forked from coinsandsteeldev/dialog.html
Google Sheets script to allow multi-select in cells with data-validation, and auto check previous options selected in current cell (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
var content
var checked
function drawForm() {
@carlosleonam
carlosleonam / tag.php.json
Last active January 25, 2020 17:49
PHP snippets to use in VS code ( with extension PHP Awesome Snippets [https://github.com/h4kst3r/php-awesome-snippets] )
{
"<?php If ... endif": {
"prefix": "pifen",
"body": [
"<?php if (${1:condition}): ?>",
"\t${0:<!-- coding here -->}",
"<?php endif; ?>"
],
"description": "If endif block inside HTML"
},
@carlosleonam
carlosleonam / permissions.sh
Created October 27, 2019 14:47 — forked from rickhernandezio/permissions.sh
Permissions for Mautic
cd /var/www/mautic
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod -R g+w app/cache/
chmod -R g+w app/logs/
chmod -R g+w app/config/
chmod -R g+w media/files/
chmod -R g+w media/images/
chmod -R g+w translations/
chown -R $USER:www-data .
@carlosleonam
carlosleonam / SaleMultiValueForm.php
Last active April 20, 2024 01:36
Exemplo "Form mestre-detalhe de vendas" do Adianti Tutor 7 - (com algumas correções para funcionar)
<?php
/*
* link original: https://www.adianti.com.br/framework_files/tutor/index.php?class=SaleMultiValueForm
*/
/**
* SaleForm Registration
* @author <your name here>
*/
class SaleMultiValueForm extends TPage
@carlosleonam
carlosleonam / gist:2c44e49279d41ef056d495885a7282fd
Created September 26, 2020 16:33 — forked from niieani/gist:1213709
PHP Camel Case functions
<?php
// source: http://www.paulferrett.com/2009/php-camel-case-functions/
/**
* Translates a camel case string into a string with underscores (e.g. firstName -&gt; first_name)
* @param string $str String in camel case format
* @return string $str Translated into underscore format
*/
function from_camel_case($str) {
$str[0] = strtolower($str[0]);
DROP FUNCTION IF EXISTS proper;
SET GLOBAL log_bin_trust_function_creators=TRUE;
DELIMITER |
CREATE FUNCTION proper( str VARCHAR(128) )
RETURNS VARCHAR(128)
BEGIN
DECLARE c CHAR(1);
DECLARE s VARCHAR(128);
DECLARE i INT DEFAULT 1;
DECLARE bool INT DEFAULT 1;
@carlosleonam
carlosleonam / NavigationService.php
Created January 11, 2021 11:16 — forked from renatofrota/Navegacao.php
NavigationService - retain pages' state in Adianti Framework
<?php
/**
* NavigationService (app/service/NavigationService.php)
*
* Stores and retrieves grid related parameters
* (order, offset, limit, direction, page, first_page)
* to fully retain pages' state in Adianti Framework.
*
* @author Renato Frota <renatofrota@gmail.com>
@carlosleonam
carlosleonam / .htaccess
Created April 26, 2021 14:51 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
# shortform git commands
alias g='git'
# show contents of all git objects in a git repo
find .git/objects/ -type f \| sed 's/\.git\/objects\/\///' | sed 's/\///g' | xargs -n1 -I% echo echo "%" \$\(git cat-file -p "%"\) \0 | xargs -n1 -0 sh -c
# push all branches to all remotes
git remote | xargs -L1 git push --all
# count lines of .js code in a repo