Skip to content

Instantly share code, notes, and snippets.

@rockschtar
rockschtar / windows-wsl2-docker-lando-php-xdebug.md
Last active August 2, 2023 13:34
Windows 10/11 + WSL2 + Docker + Lando + PHP XDebug (PHPStorm, IntelliJ & Visual Studio Code (vscode))
  1. Install WSL
  2. Install your preferred WSL Linux Distro vom Microsoft Store. In my case I used Ubuntu 20.04.
  3. Install Docker for Windows
  4. Enable Docker WSL2 Integration image
  5. Install Lando inside WSL
wget https://github.com/lando/lando/releases/download/v3.6.0/lando-x64-v3.6.0.deb
dpkg -i --ignore-depends=docker-ce lando-x64-v3.6.0.deb
@noelbundick
noelbundick / LICENSE
Last active May 16, 2024 21:09
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@samthor
samthor / undoer.js
Last active March 9, 2019 02:26
Native Undo & Redo helper
// This code now lives at https://github.com/samthor/undoer (or 'undoer' on NPM).
@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@jonathanconway
jonathanconway / radioTabbable.jquery.js
Created June 26, 2015 06:38
jQuery plugin that makes individual radio-buttons focusable using the keyboard only. (Useful for accessibility, on a case-by-case basis.)
$.fn.radioTabbable = function () {
var groups = [];
// group the inputs by name
$(this).each(function () {
var el = this;
var thisGroup = groups[el.name] = (groups[el.name] || []);
thisGroup.push(el);
});
@b00gizm
b00gizm / LoginOrSignupType.php
Created July 12, 2013 13:21
Adding a validation constraint in Symfony2 based on the existence and value of a form field via Symfony's form events. Good idea (best practice?) or dirty hack..?
<?php
namespace T7\Bundle\OAuthBundle\Form;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\ExecutionContextInterface;
@mathewbyrne
mathewbyrne / CsvResponse.php
Created March 21, 2013 22:54
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
<?php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;
@sgmurphy
sgmurphy / url_slug.php
Created July 12, 2012 15:52
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.