Skip to content

Instantly share code, notes, and snippets.

View j-greig's full-sized avatar

James Greig j-greig

View GitHub Profile
@adityaruplaha
adityaruplaha / LoginCommand.php
Last active August 22, 2023 11:57
Telegram Login Widget not working on certain browsers. - Investgation and workarounds.
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@chapmanjacobd
chapmanjacobd / alpine_url_params.md
Last active June 16, 2020 05:58
Alpine.js + Spruce URL Query Params

Very lightweight way to get query params on your Alpine.js page. Good for storing data in the URL

store.ts

import Spruce from '@ryangjchandler/spruce'

Spruce.store('settings', {})

export default Spruce
@terryupton
terryupton / modal.twig
Created April 9, 2020 18:18
Ajax Loading a page into a modal with Alpine JS
<section x-data="{showModal: false, html: ''}">
<button
@click="html='loading...'; showLoading = true; showModal = !showModal;
fetch('{{ entry.url }}', {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
})
@huylift
huylift / tachyons-to-tailwind-transform.js
Last active March 14, 2023 04:24 — forked from knoopx/tachyons-to-tailwind-transform.js
Transform tachyons classes to tailwind css (using babel-codemod)
// Installation:
// yarn add -D @codemod/cli @babel/plugin-syntax-jsx @babel/generator
import jsx from '@babel/plugin-syntax-jsx';
import generate from '@babel/generator';
const COLOR_MAP = {
'white': 'white',
'near-white': 'gray-100',
'light-gray': 'gray-200',
@piotrpog
piotrpog / emailLinks.twig
Created April 25, 2019 23:04
Twig macro converting email addresses in text into links secured from spambots. More info: http://craftsnippets.com/articles/converting-email-addresses-into-links-using-twig-macro
@philipboomy
philipboomy / gist:b4f22c26cca62f0779714ac97ebe7cb2
Last active October 25, 2019 17:17
Laravel Mix 4 with Tailwind and Purge
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');
mix.setPublicPath('./web')
.postCss('src/css/main.css', 'css')
.options({
postCss: [tailwindcss('tailwind.config.js'), require('autoprefixer')],
processCssUrls: false,
})
.calendar {
tbody td {
border: 1px solid #dedede;
}
&__day {
&--available {
}
@simonswiss
simonswiss / index.md
Created October 18, 2018 08:02
A Real-Life Journey into the Opinionated World of "Utility-First" CSS - Links & Resoures
@terdelyi
terdelyi / craft_validate_public_user_registration.php
Last active September 11, 2021 03:18
CraftCMS 3 - Extending the validation on the public user registration form
<?php
use Craft;
use craft\base\Element;
use craft\elements\User;
use craft\events\ModelEvent;
use yii\base\Event;
<?php
namespace modules;
use Craft;
use craft\elements\Asset;
use yii\base\Event;
/**
* Custom module class.
*