Skip to content

Instantly share code, notes, and snippets.

View davidhellmann's full-sized avatar
🤔
Focusing

David Hellmann davidhellmann

🤔
Focusing
View GitHub Profile
@davidhellmann
davidhellmann / zones.coffee
Created November 30, 2022 16:18 — forked from MatthewCallis/zones.coffee
ISO Language Codes, ISO Country Codes, Time Zones
values =
locale_country_code: [
{ title: "Andorra", value: "AD" },
{ title: "United Arab Emirates", value: "AE" },
{ title: "Afghanistan", value: "AF" },
{ title: "Antigua and Barbuda", value: "AG" },
{ title: "Anguilla", value: "AI" },
{ title: "Albania", value: "AL" },
{ title: "Armenia", value: "AM" },
{ title: "Angola", value: "AO" },
@davidhellmann
davidhellmann / input.scss
Created March 18, 2022 12:15 — forked from martinherweg/input.scss
Generated by SassMeister.com.
@use 'sass:map';
$themes: ['default', 'yellow', 'purple-yellow', 'gold', 'midnight-blue', 'purple-blue'];
$themeIcons: ();
@each $theme in $themes {
$index: index($themes, $theme);
$themeIcons: map.set($themeIcons, $theme, 'theme#{$index}')
}
@davidhellmann
davidhellmann / Craft Add Items To Cart
Created June 29, 2021 09:16 — forked from j2is/Craft Add Items To Cart
How to add items to the cart, this example is headless but can be modified for a regular setup by also posting a CSRF token.
import axios from "axios";
async function request(request) {
if (!request) {
return { data: undefined, error: "no request" };
}
const data = typeof FormData !== "undefined" ? new FormData() : {};
if (request.data) {
Object.entries(request.data).forEach(([key, value]) => {
@davidhellmann
davidhellmann / lazy.ts
Last active February 6, 2021 10:02 — forked from mauricerenck/lazy.ts
export const initLazyloading = (selector: string): void => {
let images = document.querySelectorAll(selector);
if ('IntersectionObserver' in window) {
// Create new observer object
let lazyImageObserver = new IntersectionObserver((entries, observer) => {
// Loop through IntersectionObserverEntry objects
entries.forEach((entry) => {
// Do these if the target intersects with the root
if (entry.isIntersecting) {
@davidhellmann
davidhellmann / Craft3ValetDriver.php
Created August 1, 2018 09:25 — forked from Chrisedmo/Craft3ValetDriver.php
Craft 3 Composer Install Valet Driver
<?php
class Craft3ValetDriver extends ValetDriver
/* https://github.com/laravel/valet/blob/master/cli/drivers/CraftValetDriver.php */
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
- pipeline: "Build and deploy to [environment]"
trigger_mode: "MANUAL"
ref_name: "develop"
actions:
- action: "Init Atomic Deployment"
type: "SSH_COMMAND"
working_directory: "${remote_path}/"
login: "${user}"
host: "${host}"
port: "22"
- pipeline: "Build and deploy to [environment]"
trigger_mode: "MANUAL"
ref_name: "develop"
actions:
- action: "Init Atomic Deployment"
type: "SSH_COMMAND"
working_directory: "${remote_path}/"
login: "${user}"
host: "${host}"
port: "22"
@davidhellmann
davidhellmann / bling.js
Created July 12, 2017 18:16 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@davidhellmann
davidhellmann / create_labels.sh
Created January 16, 2017 18:47 — forked from MatthiasKunnen/create_labels.sh
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@davidhellmann
davidhellmann / create_labels.sh
Created January 16, 2017 18:45 — forked from omegahm/create_labels.sh
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform