Skip to content

Instantly share code, notes, and snippets.

View cherrykoda's full-sized avatar
🦊
Crafting the Crafts

Shawna O'Neal cherrykoda

🦊
Crafting the Crafts
View GitHub Profile
@cherrykoda
cherrykoda / _entry.twig
Created July 13, 2020 13:11
[Medium] Macros v Partials - Macro Scoping
{# Define Page #}
{% set bodyClass = "article" %}
{% extends "_layouts/main" %}
{# Includes #}
{% import "_macros/designer.twig" as _designer %}
{% import "_macros/actions.twig" as _actions %}
{% import "_macros/ads.twig" as _ads %}
{% block content %}
@cherrykoda
cherrykoda / actions.twig
Created July 13, 2020 13:21
[Medium] Macros v. Partials - Action Macro
{# This file contains macros for calculating text values #}
{##
# CREATE RESOURCE ACTION
# - Creates an unlinked span of text for use on cards etc.
#
# @param resource
# An entry object, i.e. an Activity or Resource
#
# Required Fields: resourceType (dropdown)
@cherrykoda
cherrykoda / _entry.twig
Created July 13, 2020 13:34
[Medium] Macros v. Partials - Related Resources
<div class="container">
<div class="cards">
{% for activity in relatedActivities %}
{% set activityLink = _action.determineResourceLink(activity) %}
<a href="{{ activityLink }}" class="card -icon {% if loop.length < 4 %}-tight{% endif %}">
{% set activityImage = activity.resourceThumbnail|length ? activity.resourceThumbnail[0] : null %}
<div class="card__icon lazyload" data-bgset="{{ activityImage ? activityImage.url('thumbnail') : '/images/placeholder.jpg' }}" role="img" title="{{ activityImage ? activityImage.imageAltText : '' }}"></div>
<div class="card__content">
<p class="card__topic topic">{{ activity.resourceTopics.one }}</p>
<h3 class="card__headline">{{ activity.title }}</h3>
@cherrykoda
cherrykoda / contactBarBlock.twig
Created July 13, 2020 13:42
[Medium] Macros v. Partials - Contact Bar Partial
{# contact bar partial #}
<section class="contact-bar">
<div class="container">
<div>
<a href="#contact-form" class="modal">
<img class="lazyload" data-src="/img/icons/contact-icon.svg" alt="">
<h4>Contact<br>us Today</h4>
</a>
<a href="#demo-form" class="modal">
<img class="lazyload" data-src="/img/icons/demo-icon-colorful.svg" alt="">
@cherrykoda
cherrykoda / _excerpt.twig
Last active July 13, 2020 13:50
[Medium] Macros v. Partials - Solutions Excerpt
<main>
<section id="overview">
<div class="container">
<div class="intro">
{% if entry.overviewIcon and entry.overviewIcon.one %}
<div class="icon">
{% set img = entry.overviewIcon.one %}
<img src="{{ img.getUrl('iconMedium') }}" alt="{{ img.imageAltText|length ? img.imageAltText : img.title }}">
</div>
{% endif %}
@cherrykoda
cherrykoda / _popular-now.twig
Created July 13, 2020 14:03
[Medium] Macros v. Partials - Popular Now
@cherrykoda
cherrykoda / _overview.twig
Created July 13, 2020 14:10
[Medium] Macros v. Partials - State Sport Articles
{% set sportArticles = craft.entries.section('articles').relatedTo(['and',
{ element : state },
{ element : sport }
]) %}
{# Set Popular Articles #}
{% do craft.views_work.sortPopular(sportArticles, 'month') %}
{% set popularArticles = sportArticles.limit(6).all %}
<div class="hero" {% if sport %}style="background: url({{ sport.sportBackground.one.url('sportBg') }}) center center no-repeat; background-size: cover;"{% endif %}>
$ns = '{http://example.org/}';
$service->write('{http://example.org/}root',[
$ns . 'title' => 'Foundation',
$ns . 'author' => [
$ns . 'firstname' => 'Isaac',
$ns . 'lastname' => 'Asimov',
]
]);
@cherrykoda
cherrykoda / sabre-verbose.php
Created March 20, 2021 01:09
Sabre XML Verbose Naming
$ns = '{http://www.w3.org/2005/Atom}';
$service->namespaceMap['http://www.w3.org/2005/Atom'] = '';
$service->write($ns . 'feed', [
$ns . 'title' => 'Example Feed',
[
'name' => $ns . 'link',
'attributes' => ['href' => 'http://example.org/']
],
$ns . 'updated' => '2003-12-13T18:30:02Z',
@cherrykoda
cherrykoda / ax-input.xml
Last active March 22, 2021 02:04
Working AX XML
<?xml version="1.0" encoding="UTF-8"?>
<x:Envelope
xmlns:x="http://schemas.xmlsoap.org/soap/envelope/">
<x:Header/>
<x:Body>
<SalesOrderServiceCreateRequest
xmlns="http://schemas.microsoft.com/dynamics/2008/01/services">
<SalesOrder
xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder">
<SalesTable class="entity">