Skip to content

Instantly share code, notes, and snippets.

View croxton's full-sized avatar
💭
Up to my elbows, as usual

Mark Croxton croxton

💭
Up to my elbows, as usual
View GitHub Profile
@av01d
av01d / ColorSteps.js
Last active February 27, 2024 15:42
Javascript calculate color steps (gradient) between two colors
const ColorSteps = (() => {
/**
* Convert any color string to an [r,g,b,a] array.
* @author Arjan Haverkamp (arjan-at-avoid-dot-org)
* @param {string} color Any color. F.e.: 'red', '#f0f', '#ff00ff', 'rgb(x,y,x)', 'rgba(r,g,b,a)', 'hsl(180, 50%, 50%)'
* @returns {array} [r,g,b,a] array. Caution: returns [0,0,0,0] for invalid color.
* @see https://gist.github.com/av01d/8f068dd43447b475dec4aad0a6107288
*/
const colorValues = color => {
@peteheaney
peteheaney / craft-guzzle.twig
Last active September 10, 2024 17:12
Use Guzzle in a Craft CMS twig template. No need for a plugin!
{# Create Guzzle instance #}
{% set client = create({
'class': 'GuzzleHttp\\Client'
}) %}
{# Send API request #}
{% set response = client.request('GET', 'https://jsonplaceholder.typicode.com/posts') %}
{# Check the response status #}
{% set status = response.getStatusCode() %}
@IanColdwater
IanColdwater / twittermute.txt
Last active September 2, 2024 06:19
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@monachilada
monachilada / gatsby-config.js
Last active October 16, 2020 19:03
Sample gatsby-config.js enabling live preview in Craft CMS
const { createHttpLink } = require('apollo-link-http');
const fetch = require('node-fetch');
const store = require('store');
const sourceNodes = require('gatsby/dist/utils/source-nodes');
require('dotenv').config();
const craftGqlUrl = process.env.CRAFT_GQL_URL;
const craftGqlToken = process.env.CRAFT_GQL_TOKEN;
module.exports = {
@JacobLett
JacobLett / gist:a62a9bc4c644c31f9f99190d29abc02e
Created March 11, 2019 18:05
HubSpot Form Conversion Tracking - Google Analytics Event Script
######## Add to HEAD
<!-- Global site tag (gtag.js) - Google Ads: 802890537 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-802890537"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-ID');
@nicooprat
nicooprat / main.scss
Last active March 1, 2024 07:36
Sharing Tailwind config with SASS (Tailwind beta & Tailwind 1.0)
// Setting variables like this wouldn't be possible because SASS would
// get through this file before Tailwind does (because it's PostCSS)
$--color-primary: theme('colors.blue');
$--font-serif: theme('fontFamily.serif');
body {
color: rgba($--color-primary, .5);
font-family: $font-serif;
}
@dennisfrank
dennisfrank / Buddy-craft3-atomic-deployment-pipeline.yml
Last active July 31, 2019 18:09
Buddy.works Craft 3 Atomic Deployment Pipeline
- pipeline: "Build and deploy to [environment]"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "develop"
actions:
- action: "Init: Atomic Deployment"
type: "SSH_COMMAND"
working_directory: "${remote_path}/"
login: "${user}"
host: "${host}"
port: "22"
@leevigraham
leevigraham / Generate ssl certificates with Subject Alt Names on OSX.md
Last active June 11, 2024 09:48
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

We're going to generate a key per project which includes multiple fully qualified domains. This key can be checked into the project repo as it's intended for local development but never used on production servers.

Save ssl.conf to your my_project directory.

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

@mrw
mrw / paypal_cert_test.php
Last active April 9, 2018 22:42
PHP PayPal new certificate test
<?php
/*
File prepared by Matt Weinberg, www.vectormediagroup.com and www.cartthrob.com
EXPLANATION:
In 2018, PayPal will be updating their Live/Production environment.
Many servers, especially older ones, will not be able to connect to PayPal after the settings are changed.
@rsanchez
rsanchez / gist:9549396
Last active August 29, 2015 13:57
Deep + Resource Router
<?php
use rsanchez\Deep\Deep;
use rsanchez\Deep\App\Entries;
$config['resource_router'] = array(
'json' => function($router) {
Deep::bootEloquent(ee());
$entries = Entries::channel('blog')->limit(10)->get();