Skip to content

Instantly share code, notes, and snippets.

View dannevang's full-sized avatar

Mathias Dannevang dannevang

View GitHub Profile
@dannevang
dannevang / secure_install.sh
Last active August 29, 2015 14:18 — forked from Realetive/secure_install.sh
Install script for MODX
#!/bin/bash
##############
echo "
//////////////////////////////////////
// //
// Welcome to MODx autoinstaller. //
// //
//////////////////////////////////////
<html>
<head>
<title>Select styles with CSS only</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background-color: #fff;
font-family: helvetica, sans-serif;
margin: 4% 10%
}
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@dannevang
dannevang / navigation.phtml
Created August 27, 2014 17:16
Remove Magento Dashboard Links
<!--
Step 1: Go To ( YourTemplate/customer/account/navigation.phtml )
Step 2: Replace This Line: <?php $_count = count($_links); ?>
-->
<?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
unset($_links['account']); /* Account Info */
unset($_links['account_edit']); /* Account Info */
unset($_links['tags']); /* My Tags */
<?php
$default = realpath(dirname(__FILE__).'/core/lexicon/en').'/';
$local = realpath(dirname(__FILE__).'/core/lexicon/nl').'/';
$showSame = false;
// find default files
$theFiles = array();
if($handle = opendir($default)) {
while(false !== ($file = readdir($handle))) {
@dannevang
dannevang / showChunk
Created May 15, 2014 23:18
Show MODX chunk based on usergroup membership
<?php
/* ShowChunk snippet : Credit: Bob Ray */
$subChunks = explode(',', $scriptProperties['subscriberChunks']);
$otherChunks = explode(',', $scriptProperties['otherChunks']);
if ($modx->user->isMember('paid-members')) {
foreach ($subChunks as $subChunk) {
$output .= $modx->getChunk($subChunk);
}
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@dannevang
dannevang / fullHeight.js
Created March 10, 2014 10:20
jQuery Full height columns
//CALL THIS IN THE FOOTER, AFTER THE DOM HAS BEEN LOADED AND ANY OTHER DOM MANIPULATING JS HAS BEEN EXECUTED
function updateSidebar() {
var $width = document.documentElement.clientWidth,
$height = document.documentElement.clientHeight,
$main = jQuery('#main').height();
$sidebar = jQuery('#sidebar').height();
if($width > 755) {
if($main > $sidebar) {
jQuery('#sidebar').css({'min-height': $main});
@dannevang
dannevang / Full Height
Last active December 21, 2015 22:42 — forked from joanhard/index
Full height sidebar
<div class="row">
<div class="large-8 column">
My Content
</div>
<div class="large-4 column full-height">
<aside class="sidebar">
My Sidebar
</aside>
</div>
</div>