Skip to content

Instantly share code, notes, and snippets.

View masiorama's full-sized avatar
🏠
Working from home

masiorama

🏠
Working from home
View GitHub Profile

Pass Alpine.js Bound Attributes To Blade Component

If you need to pass a bound Alpine.js attribute to a Laravel Blade component, you can prefix the attribute name with two colons instead of a single colon to tell Blade to not evaluate the attribute as a PHP expression.

<div x-data="{ isActive: true }">
    <x-some-blade-component ::is-active="isActive" />
</div>
@renekreijveld
renekreijveld / sphp
Last active January 10, 2024 15:54
Easy PHP version switching command-line script for devilbox
#!/bin/bash
# sphp - Easy PHP version switching command-line script for devilbox
# Written by: René Kreijveld, email[at]renekreijveld.nl
# Version
version=1.1
# Available PHP versions in devilbox
php_array=(5.2 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0)
# Devilbox folder
devilbox=/Users/yourusername/devilbox
@janhenckens
janhenckens / Module.php
Last active June 28, 2023 13:37
Make first & last name required for Craft CMS users
<?php
use craft\base\Element;
use craft\elements\User;
use craft\events\ModelEvent;
use yii\base\Event;
Event::on(User::class, Element::EVENT_BEFORE_SAVE, function(ModelEvent $event) {
/** @var User $user */
$user = $event->sender;
if(!$user->firstName || !$user->lastName) {
@dgrigg
dgrigg / webpack.config.js
Created May 30, 2019 18:19
Webpack + Twig setup
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const TailwindCss = require('tailwindcss');
const AutoPrefixer = require('autoprefixer');
const path = require('path');
@prestarocket
prestarocket / .gitignore
Last active July 19, 2023 16:04
Gitignore PrestaShop 1.7
# Cache, temp and personal files
/.htaccess
*.log
npm-debug.log.*
.sass-cache/
/cache/*
download/*
/img/*
/log/*
@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';
@aaronwaldon
aaronwaldon / 1) readme.md
Last active March 24, 2023 14:25
How to set up Gulp for Craft CMS. Includes SASS compilation and minification, JavaScript minification, livereloading, and browser sync.

How to set up Gulp with a Craft CMS project

I freaking love working with technologies like Gulp, and wanted to share how to get my current Craft front-end workflow set up. With a few tweaks, this can also be used with virtually any other sites (I've used it with Laravel, static sites, ExpressionEngine, etc).

Project Directory Structure

  • project root/
    • craft/
      • templates/
  • (your craft template files)
@s-leroux
s-leroux / fixtures_promotions.js
Created March 28, 2016 00:04
"Introduction to Server-side Development" course by Jogesh Muppala on Coursera -- test file for assignment 3
/* test/fixtures/fixtures_promotions.js */
module.exports = [
{
"_id" : "000000000000000000001100",
"updatedAt" : "2016-03-21T23:18:37.283Z",
"createdAt" : "2016-03-21T23:14:53.548Z",
"name" : "Grand buffet",
"image" : "images/buffet.png",
@s-leroux
s-leroux / test_models.js
Created March 21, 2016 00:18
"Introduction to Server-side Development" course by Jogesh Muppala on Coursera -- test file for assignment 2
var mongoose = require('mongoose');
var url = 'mongodb://localhost:27017/conFusion';
mongoose.connect(url);
var db = mongoose.connection;
var assert = require('assert');
var Dishes = require('../models/dishes');
var Promotions = require('../models/promotions');
var Leaders = require('../models/leadership');
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();