Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
@carlosleonam
carlosleonam / mysql_backup.sh
Created September 22, 2021 20:10 — forked from tleish/mysql_backup.sh
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am
#!/bin/bash
BACKUPTIME="$(date '+%Y%m%dT%H%M%S%z')"
BACKUPLOC=/home/backups
DBDIR=/var/lib/firebird/2.5/data
DBNAME=rsgdata
PASSLOC=/etc/firebird/2.5/SYSDBA.password
LEVEL=${1:-0}
COUNT=8
@carlosleonam
carlosleonam / .php
Created March 14, 2022 00:12 — forked from scriptdev/.php
MÁSCARA DINÂMICA AO DIGITAR DO TELEFONE e CELULAR NO TEntry
<?php
## ADICIONAR ANTES DO parent::add($container);##########################
TScript::create(
"$(document).on('keydown', 'input[name=\'celular\']', function (e) {
var digit = e.key.replace(/\D/g, '');
var value = $(this).val().replace(/\D/g, '');
var size = value.concat(digit).length;
$(this).mask((size <= 10) ? '(00) 0000-0000' : '(00) 00000-0000');