Skip to content

Instantly share code, notes, and snippets.

View ohvitorino's full-sized avatar

Bruno Vitorino ohvitorino

View GitHub Profile
@ohvitorino
ohvitorino / laravel-queue.service
Created April 26, 2024 09:34 — forked from thomasjsn/laravel-queue.service
Laravel queue worker using systemd.
# Laravel queue worker using systemd
# ----------------------------------
#
# /lib/systemd/system/queue.service
#
# run this command to enable service:
# systemctl enable queue.service
[Unit]
Description=Laravel queue worker

Symfony 4 - cookbook

Initial installation

composer create-project symfony/website-skeleton ~/Sites/client/project

composer req encore

Add to config/services.yaml

@ohvitorino
ohvitorino / cartodb20_build.sh
Last active May 21, 2020 18:11 — forked from ericmagnuson/cartodb20_build.sh
CartoDB installation on Ubuntu 12.04
###################################
## CartoDB 2.0 Install [Working] ##
## Tested on Ubuntu 12.04 ##
###################################
sudo apt-get update
sudo apt-get safe-upgrade -y
# Install miscellaneous dependencies packages
sudo apt-get install -y git-core python-software-properties openmpi-bin libopenmpi-dev build-essential libxslt-dev zlib1g-dev ruby gems unzip
@ohvitorino
ohvitorino / ut8_to_utf8mb4_conversion.sql
Last active February 7, 2020 10:23
Generate ALTER statements to convert a database from utf8 to utf8mb4
use information_schema;
SELECT concat("ALTER DATABASE `",table_schema,"` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;") as _sql
FROM `TABLES` where table_schema like "database-name" group by table_schema;
SELECT concat("ALTER TABLE `",table_schema,"`.`",table_name,"` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") as _sql
FROM `TABLES` where table_schema like "database-name" group by table_schema, table_name;
SELECT concat("ALTER TABLE `",table_schema,"`.`",table_name, "` CHANGE `",column_name,"` `",column_name,"` ",data_type,"(",character_maximum_length,") CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",IF(is_nullable="YES"," NULL"," NOT NULL"),";") as _sql
FROM `COLUMNS` where table_schema like "database-name" and data_type in ('varchar','char');
# Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
<?php
// Pre-load all locale files to have a cache
function loadOtherTranslations() {
$existingTranslations = [];
$iterator = new RecursiveDirectoryIterator('src');
/** @var \SplFileInfo $file */
foreach(new RecursiveIteratorIterator($iterator) as $file){
@ohvitorino
ohvitorino / translation_helper.php
Created February 3, 2018 20:20
ForkCMS translation helper.
<?php
$document = new DOMDocument();
$document->load($argv[1]);
$existingTranslations = [];
function getUserInput() {
return readline("\nTranslation PT: ");
}
@ohvitorino
ohvitorino / jekyll-and-liquid.md
Created January 8, 2018 08:05 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@ohvitorino
ohvitorino / curl_basic_auth.php
Created August 10, 2017 07:19
This a example of a curl request with basic authentication and x-www-form-urlencoded.
<?php
$curl = curl_init();
$header = [];
$header[] = 'Content-type: application/x-www-form-urlencoded';
// user:password in base64
$header[] = 'Authorization: Basic xxxxxx';
curl_setopt($curl, CURLOPT_URL, 'http://url/user/add');
@ohvitorino
ohvitorino / CreateProduct.php
Last active May 19, 2017 11:58
Generator for entities
<?php
namespace ProductsBundle\Command;
final class CreateProduct extends ProductDataTransferObject
{
}