Skip to content

Instantly share code, notes, and snippets.

@lyrixx
lyrixx / index.php
Last active February 19, 2024 06:37
How to call private command method in Symfony ?
#!/usr/bin/env php
<?php
require __DIR__ . '/../../vendor/autoload.php';
use Castor\Console\Command\CompileCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
// We extends the CompileCommand, to be able to remove the constructor, because

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@acfatah
acfatah / index.js
Last active March 27, 2024 04:40
Quasar Vue Router Middleware Pipeline Example
// router/index.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import middlewarePipeline from './middleware-pipeline'
Vue.use(VueRouter)
@julienbourdeau
julienbourdeau / clean-prestashop-db.sql
Last active March 20, 2024 13:06
Clean PrestaShop database - Drop old and unless data
# Delete all logs
TRUNCATE ps_log;
# Delete old connection data (only used for stats)
# change 2016-02-01 00:00:00 according to you needs
DELETE c, cs
FROM ps_connections c
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections)
WHERE c.date_add < '2016-02-01 00:00:00';
<?php
function slugify($string) {
$string = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $string);
$string = preg_replace('/[-\s]+/', '-', $string);
return trim($string, '-');
}
echo slugify("Я люблю PHP!");
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active April 13, 2024 12:22
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@kevinruscoe
kevinruscoe / wordpress-editor.scss
Last active November 2, 2023 18:55
Sass default WordPress editor styles.
/**
* WordPress WYSIWYG Editor Styles
*
* Some nice SCSS styles. Fixes the alignment left/right issues when using them in the editor.
* There's a load of more 'defaults' over at http://digwp.com/2010/05/default-wordpress-css-styles-hooks/
* which is where this was original 'borrowed' from. Cheers Jeff Starr (@perishable)!
*
* @author Kevin Ruscoe (@kevdotbadger)
* @link http://digwp.com/2010/05/default-wordpress-css-styles-hooks/ Original author
* @link https://twitter.com/perishable Twitter of original author
@Lewiscowles1986
Lewiscowles1986 / lc-svg-upload.php
Last active August 4, 2016 13:45
SVG Media Plugin for WordPress (Works since 4.1.2!)
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@xero
xero / irc.md
Last active March 29, 2024 13:30
irc cheat sheet

IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
  • Leaves the specified channel.
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active April 22, 2024 17:19
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php