Skip to content

Instantly share code, notes, and snippets.

@jamiepittock
jamiepittock / CollapseSidebarAsset.php
Created February 21, 2024 08:50 — forked from wsydney76/CollapseSidebarAsset.php
Make sections of Craft 5 element indexes collapsible
<?php
namespace modules\main\web\assets\collapsesidebar;
use craft\web\AssetBundle;
/**
* Collapse Sidebar asset bundle
* Experimental!
*
@jamiepittock
jamiepittock / fullNameToFirstName.php
Created November 24, 2022 10:46 — forked from stilliard/fullNameToFirstName.php
PHP - Get a users first name from the full name
<?php
/**
* Get a users first name from the full name
* or return the full name if first name cannot be found
* e.g.
* James Smith -> James
* James C. Smith -> James
* Mr James Smith -> James
* Mr Smith -> Mr Smith
<?php
// Stripped down for brevity
class BPlugin {
public function init () {
// Trigger Google Shopping updates
// =====================================================================
if (!craft()->config->get('devMode')) {
@jamiepittock
jamiepittock / craftblockwrap.twig
Created February 2, 2018 21:58 — forked from Chrisedmo/craftblockwrap.twig
Craft CMS matrix blocks intelligent wrapping
{# _partials/blocks/blocks.html #}
{#
Blocks component
Outputs a matrix field blocks, intelligently wrapping blocks that need to be inset from the edges
@param {object} contentBlocks (MatrixBlockModel)
#}
{# Parameters #}
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# NOTE:
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to reamea.com, and your
# ssh public key associated with the account 'mboza@reamea.com'