Skip to content

Instantly share code, notes, and snippets.

View ChristopherDosin's full-sized avatar
:octocat:
Out sick

Christopher Dosin ChristopherDosin

:octocat:
Out sick
View GitHub Profile
@joergmoldenhauer
joergmoldenhauer / contao-hello-world-bundle-tutorial.md
Last active September 10, 2023 16:50
Contao Hello World Bundle Tutorial

Contao Hello World Bundle Tutorial

Möchte man eine Contao Erweiterung in mehreren Projekten einsetzen und/oder der Allgemeinheit zur Verfügung stellen, legt man dazu am besten ein Bundle an und veröffentlicht es auf Packagist. Dann lässt sich die Erweiterung einfach über Composer oder den Contao Manager installieren. Dieses Tutorial beschreibt wie das unter Verwendung des Skeleton Bundles funktioniert. Dabei wird ein Bundle erstellt, das ein Inhaltselement erzeugt, das "Hello World" ausgibt. Folgendes werden wir machen.

  1. Einen Vendor- und Bundle-Namen wählen
  2. Das Skeleton Bundle verstehen und anpassen
  3. Ein Repository für das Bundle anlegen
  4. Das Bundle in der Entwicklungsinstallation installieren
  5. Die grundlegende Funktionalität implementieren
  6. Unit Tests schreiben
@mtwalsh
mtwalsh / deploy.php
Last active December 8, 2022 16:31
Deployer recipe for Craft CMS 3 projects.
<?php
namespace Deployer;
require 'recipe/common.php';
// Project name
set('application', 'enovate.co.uk');
// Project repository
set('repository', 'git@githosting.com:enovatedesign/project.git');

Contao 4 Lokales Bundle

Mit der folgenden Anleitung wird ein lokales Contao 4 Bundle angelegt, das ein Inhaltselement mit der Ausgabe "Hello World" erzeugt.

Das Bundle wird nicht über Composer installiert, sondern einfach in die Anwendung gelegt. Es wird nicht das AppBundle verwendet, sondern ein eigener Vendor und Bundle Name.

Der Vendor Name für das Beispiel ist "Acme" der Bundle Name "TestBundle". Diese Strings müssen bei einem eigenen Bundle entsprechend ersetzt werden.

Bundle Erstellung

@adamwathan
adamwathan / promise-take-at-least.js
Last active February 26, 2023 14:25
Promise.takeAtLeast
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@amityweb
amityweb / csv_to_xml.php
Last active May 12, 2022 18:22
CSV to XML using PHP
<?php
// Map CSV file to array
$rows = array_map('str_getcsv', file('data.csv'));
$header = array_shift($rows);
$data = array();
foreach ($rows as $row)
{
$data[] = array_combine($header, $row);
}
@barryvdh
barryvdh / lumen_ide_helper.php
Last active April 10, 2023 10:26
Lumen IDE Helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel Lumen (5.1.1) (Laravel Components 5.1.*) on 2015-08-18.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@brandonferens
brandonferens / margin-padding.less
Last active June 25, 2023 13:43
LESS Dynamic Margin and Padding Classes
// This set of mixins allows you to create margin and padding classes dynamically.
// In html, you would specify <div class="mr20-xs">Content</div> to give you margin-right: 20px
// It is based on the responsive capabilities of Bootstrap. <div class="mr20-sm"> would give you
// 20 pixels of right margin on screens small and larger.
// Mixin control
// .make-margins(@breakpoint, @size, @decrement)
// @breakpoint: To be used with Bootstrap. Must supply breakpoints: xs, sm, md or lg
@tronsha
tronsha / installphp7.sh
Last active October 13, 2023 00:13
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@Penderis
Penderis / Laravel Ajax.js
Last active August 29, 2015 14:13
Laravel ajax that works
jQuery( document ).ready( function( $ ) {
console.log("start");
$( '#form-add-setting' ).on( 'submit', function() {
//.....
//show some spinner etc to indicate operation in progress
//.....
console.log("Submitting");
$.post(
$( this ).prop( 'action' ),
@freekmurze
freekmurze / deploy.php
Last active February 5, 2021 02:43
A sample deploy.php file that can be used with Deployer (http://deployer.in)
<?php
/*
* Define the servers
*/
server('production-web', '<your server url>')
->path('<path to the project on your server>')
->user('<user on the server>')
->pubKey();
/*