Skip to content

Instantly share code, notes, and snippets.

@DominicWatts
DominicWatts / Magento-2-VScode-XML-validation
Created February 24, 2021 21:42
Magento 2 : VSCode xml validation #magento2
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml
https://marketplace.visualstudio.com/items?itemName=viperet.vscode-magento-wizard
php bin/magento dev:urn-catalog:generate ./.vscode/catalog_tmp.xml
MagentoWizard: Generate XML Catalog command
select catalog_tmp.xml
@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@M165437
M165437 / db-connect-test.php
Last active November 7, 2024 10:11 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@cheuerde
cheuerde / recursive_sed
Last active May 16, 2023 20:58
Recursively replace string in all files in current folder and subfolders #unix #tools
# take from http://serverfault.com/questions/172806/use-sed-recursively-in-linux
find . -type f -print0 | xargs -0 sed -i 's/foo/bar/g'
@taldanzig
taldanzig / gitpushpull.md
Created January 23, 2013 06:38
Make push/pull work with a remote non-bare repository

Make push/pull work with a remote non-bare repository

Sometimes it is necessary (and desireable) to work on a git repository on multiple development machines. We want to be able to push and pull between repositories without having to use an intermediary bare repository, and for this to work symetrically in both repositories.

First clone we clone an existing repository:

git clone ssh://user@hostname:/path/to/repo

By default this will name the remote as origin, but let's assume we want to reserve that name for a master repository that commits will eventually get pushed to:

@lmammino
lmammino / curlStreamedDownload.php
Created December 21, 2012 15:15
Download a large file (streaming) with php and curl extension
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
@jakebellacera
jakebellacera / ICS.php
Last active March 11, 2025 21:41
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*