Skip to content

Instantly share code, notes, and snippets.

View LukeTowers's full-sized avatar
❄️
Building a snowman

Luke Towers LukeTowers

❄️
Building a snowman
View GitHub Profile
# Get Remote URL
git config --get remote.origin.url
# Set Remote URL
git remote set-url origin ssh://git@github.com/captive/repository
# Initialize submodules
@LukeTowers
LukeTowers / .0 - cheatsheet.sh
Last active February 6, 2023 20:58
Introduction to OctoberCMS
# Setup symlinks in local development copy of Winter to the local development copy of Winter.Workshop
ln -s ~/LocalRepositories/WinterCMS/Themes/Winter/Workshop ~/LocalRepositories/WinterCMS/Core/winter/themes/workshop
# Setup external symlink (for mac, outside of vagrant) to the local development copies of my plugins
ln -s ~/Repositories/WinterCMS/Themes/Winter/Workshop ~/Repositories/WinterCMS/Core/winter/themes/workshop-src
# Setup symlinks in local development copy of Winter to the local development copies of my plugins
ln -s ~/LocalRepositories/WinterCMS/Plugins ~/LocalRepositories/WinterCMS/Core/winter/plugins
# Setup external symlink (for mac, outside of vagrant) to the local development copies of my plugins
$data = array_dot(\Lang::get('iacea.exchanges::lang'));
$options = [];
/*
* Parse options
*/
$defaultOptions = [
'firstRowTitles' => true,
'useOutput' => false,
'fileName' => 'export.csv',
@LukeTowers
LukeTowers / .gitignore
Last active February 27, 2021 23:40
OctoberCMS Tricks
/bootstrap/compiled.php
/vendor
composer.phar
.DS_Store
.idea
.env
.env.*.php
.env.php
php_errors.log
nginx-error.log
@LukeTowers
LukeTowers / StaticPage.php
Created August 14, 2017 19:27
Static Page display component
<?php namespace LukeTowers\Examples\Components;
use Config;
use Cms\Classes\Theme;
use Cms\Classes\ComponentBase;
use RainLab\Pages\Classes\Page as StaticPage;
class StaticPage extends ComponentBase
{
@LukeTowers
LukeTowers / Froala extension JS
Created June 13, 2017 23:55
October Tricks
/*
|------------------
| Extend Richeditor
|------------------
*/
+function ($) {
var Plugins = {
init: function () {
$.FroalaEditor.DefineIcon('buttonIcon', {NAME: 'star'});
$.FroalaEditor.RegisterCommand('myButton', {
@LukeTowers
LukeTowers / block-profile.htm
Created May 12, 2017 19:59
Render Repeater Groups
<div class="profile-square">
<h2 class="profile-title">{{ data.title }}</h2>
<div class="profile-description">{{ data.description }}</div>
<img class="profile-image" src="{{ data.image | media }}">
</div>
StaffMembersController::extendFormFields(function($form, $model, $context) {
if (!$model instanceof StaffMemberModel) {
return;
}
// Get the model's profile, including any that may have been deferred already
$profile = $model->profile()->withDeferred($form->getSessionKey())->first();
// If the profile object for this user doesn't exist yet, then create it and add it via deferred binding if necessary
if (!$profile) {
/**
* Group messages by thread id pulling message and thread ids from the provided $queryScopes Query object
*
* @param QueryBuilder $query QueryBuilder object to apply the scope to
* @param QueryBuilder $queryScopes QueryBuilder object to use to get the message ids from
* @return QueryBuilder $query
*/
public function scopeGroupedByThread($query, $queryScopes = null)
{
$queryScopes = $queryScopes ?: $this->newQuery();
@LukeTowers
LukeTowers / Frontend Flash Message Test
Created February 4, 2017 03:40
OctoberCMS Snippets
==
<?php
function onHandle() {
Flash::success('test');
}
?>
==
{# Doesn't work because no 'data-request' or 'data-request-flash' is set on the containing form #}
{{ form_open() }}