Skip to content

Instantly share code, notes, and snippets.

View xavier83ar's full-sized avatar
🏠
Working from home

Javier xavier83ar

🏠
Working from home
  • Soluciones yPunto
  • Santa Fe, Argentina
View GitHub Profile
@xavier83ar
xavier83ar / readme.md
Last active December 20, 2024 07:38
Setting up dnsmasq + NetworkManager + systemd-resolved to support wildcard domain resolution for development Ubuntu 20.04

Motivation

The goal is to have our local dns resolution resolves to localhost any host name ended by certain tld (top level domain), e.g. if we want to use *.loc as tld, then example.loc should resolve to localhost, as well as any hostname ending by .loc.

This is very convenient for local development, having the chance to use different host names resolving localhost without the need of setting them up individually.

Background

Ubuntu, as of version 20.04, uses systemd-resolved as name resolution service, and NetworkManager to handle pretty much everything related to connectivity. NetworkManager includes dnsmasq which in the past used to be enabled by default, but as now name resolution is handled by systemd-resolved, is disabled by default.

@xavier83ar
xavier83ar / ExampleController.php
Created April 23, 2021 21:46
Export big data volumes. PHP + CakePHP (3-4) + CSV
<?php
/**
* Created by javier
* Date: 23/4/21
* Time: 18:35
*/
namespace App\Controller;
/**
@xavier83ar
xavier83ar / some_view.ctp
Last active February 13, 2019 15:14
CakePHP separate form radio example
<?= $this->Form->radio('field', [1 => __('label for this')]) ?>
<?= $this->Form->radio('field', [2 => __('another label')], ['hiddenField' => false]) ?>
without labels
<?= $this->Form->radio('field', [1], ['label' => false]) ?>
<?= $this->Form->radio('field', [2], ['hiddenField' => false, 'label' => false]) ?>
@xavier83ar
xavier83ar / DateTimeWidget.php
Last active December 6, 2018 03:29
Cakephp 3 translated month names in Form helper
<?php
/**
* File: src/View/Widget/DateTimeWidget.php
* Overwriting this file should be enough, as cakephp class look up system would find this class before the framework's one.
*/
namespace App\View\Widget;
use Cake\I18n\FrozenDate;
use Cake\View\Widget\DateTimeWidget as CakePhpDateTimeWidget;
@xavier83ar
xavier83ar / ItemsController.php
Last active August 25, 2022 21:12
DataTables + CakePHP 2.x Ajax integración
<?php
// controller file
class ItemsController {
public function index()
{
// nada que hacer, solo renderizar la vista
}