Skip to content

Instantly share code, notes, and snippets.

View stevebauman's full-sized avatar

Steve Bauman stevebauman

View GitHub Profile
@pmhoudry
pmhoudry / trixUpload.js
Last active May 7, 2021 16:37
Trix upload button in VanillaJs
(function() {
// Adding upload button to Trix toolbar on initialization
document.addEventListener('trix-initialize', function(e) {
trix = e.target;
toolBar = trix.toolbarElement;
// Creation of the button
button = document.createElement("button");
button.setAttribute("type", "button");
button.setAttribute("class", "attach");
@Paradoxis
Paradoxis / findReplace.php
Last active March 14, 2022 13:30
Find and replace double curly braces in PHP, example: findReplace("Hello, {{ name }}", "name", "John"); // "Hello, John" Raw
<?php
/**
* Parses a template argument to the specified value
* Template variables are defined using double curly brackets: {{ [a-zA-Z] }}
* Returns the query back once the instances has been replaced
* @param string $string
* @param string $find
* @param string $replace
* @return string
@dmongeau
dmongeau / .travis.yml
Last active April 27, 2022 10:16
Example of travis configuration for Laravel Package testing (5.1 to 5.8) on multiple versions of PHP (5.5 to 7.3) with code coverage (coveralls)
language: php
cache:
directories:
- $HOME/.cache/pip
- $HOME/.composer/cache/files
php:
- 5.6
- 7.0
@Vinze
Vinze / calendar.php
Last active October 17, 2023 19:29
Create an HTML calendar with PHP and Carbon
<?php
// Make sure Carbon is available
function renderCalendar($dt) {
// Make sure to start at the beginnen of the month
$dt->startOfMonth();
// Set the headings (weeknumber + weekdays)
$headings = ['Weeknumber', 'Mondag', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saterday', 'Sunday'];
@AntonioPrimera
AntonioPrimera / html_purifier_config_for_trix_editor.php
Created January 12, 2018 12:56
HTML Purifier config for Trix-Editor
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.DefinitionID', 'basecamp-trix-editor');
$config->set('HTML.DefinitionRev', 1);
$config->set('HTML.TidyLevel', 'none');
if ($def = $config->maybeGetRawHTMLDefinition()) {
$def->addElement('figure', 'Inline', 'Inline', 'Common');
$def->addAttribute('figure', 'class', 'Text');
@nasrulhazim
nasrulhazim / webpack.mix.js
Created February 18, 2018 11:44
Laravel: Datatables Webpack Setup
mix.js('resources/assets/js/app.js', 'public/js')
.scripts([
'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-bs4/js/dataTables.bootstrap4.js'
], 'public/js/datatable.js')
.styles(['node_modules/datatables.net-bs4/css/dataTables.bootstrap4.css'], 'public/css/datatable.css')
.sass('resources/assets/sass/app.scss', 'public/css');
Continent_Name Continent_Code Country_Name Two_Letter_Country_Code Three_Letter_Country_Code Country_Number
Asia AS Afghanistan, Islamic Republic of AF AFG 4
Europe EU Albania, Republic of AL ALB 8
Antarctica AN Antarctica (the territory South of 60 deg S) AQ ATA 10
Africa AF Algeria, People's Democratic Republic of DZ DZA 12
Oceania OC American Samoa AS ASM 16
Europe EU Andorra, Principality of AD AND 20
Africa AF Angola, Republic of AO AGO 24
North America NA Antigua and Barbuda AG ATG 28
Europe EU Azerbaijan, Republic of AZ AZE 31
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 29, 2025 12:18
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@tanthammar
tanthammar / HasLinks.php
Last active July 5, 2022 18:22
No more controllers! Only Laravel LiveWire routes and a handy Eloquent Model trait.
@PhiloNL
PhiloNL / .env
Last active August 7, 2024 20:19
Simple, fast, and resilient open-source WebSockets server using Soketi with SSL in less than 5 minutes
PUSHER_HOST=socket.yourdomain.com
PUSHER_APP_ID=unlock
PUSHER_APP_KEY=123
PUSHER_APP_SECRET=456
PUSHER_PORT=443
PUSHER_SCHEME=https