Skip to content

Instantly share code, notes, and snippets.

View sebastian-marinescu's full-sized avatar
🤓

Sebastian G. Marinescu sebastian-marinescu

🤓
View GitHub Profile
@sebastian-marinescu
sebastian-marinescu / flat_color.sass
Last active February 21, 2016 20:29 — forked from sdeluce/flat_color.scss
Flat UI Colors Sass
/*--------------------------*\
Flat UI Colors
\*--------------------------*/
$turquoise : #1ABC9C
$greensea : #16A085
$emerald : #2ECC71
$nephritis : #27AE60
@sebastian-marinescu
sebastian-marinescu / project-setup-backend.bat
Created May 22, 2016 11:41
Use Gitify to install MODX inside the relative "www" folder
@echo OFF
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
mode con:cols=68 lines=26
color 2F
echo.
@sebastian-marinescu
sebastian-marinescu / project-check.bat
Created May 22, 2016 11:44
Check frontend and backend dependencies on current machine
@echo OFF
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
mode con:cols=64 lines=55
color 02
echo.
<?php
/* Set plugin to run on "OnManagerPageBeforeRender"
*/
$user = $modx->getUser();
$restricted = true;
if($user) {
$restricted = (!$user->isMember(array('Administrator')));
}
if($restricted){
$modx->regClientStartupHTMLBlock('<style type="text/css">.deleted{display:none;}</style>');
@sebastian-marinescu
sebastian-marinescu / introRTE
Created June 30, 2016 16:21 — forked from christianseel/introRTE
RTE for introtext #modx
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
@sebastian-marinescu
sebastian-marinescu / install-CB-import-Fields-Layouts-Templates.php
Created January 11, 2018 18:53 — forked from carnevlu/install-CB-import-Fields-Layouts-Templates.php
MODX install package __ContentBlock__ and import Fields,Layouts,Templates from multiple export files
<?php
define('MODX_API_MODE', true);
// Full path to the index
require_once('index.php');
$modx = new modX();
$modx->initialize('mgr');
######################## Variables
@sebastian-marinescu
sebastian-marinescu / LanguageMatch.php
Last active April 23, 2021 12:09
A PHP snippet for MODX to redirect to accepted client-languages (adapted so it trims prefix/suffix before matching)
<?php
/**
* LanguageMatch
*
* Based on https://gist.github.com/christianseel/504302ce8ddfcde009c0
* Original code by http://stackoverflow.com/a/3771447
*
* Updated by Indigo74 & x-vance for prefix/suffix and default context
*/
@sebastian-marinescu
sebastian-marinescu / SortTabs.php
Created September 19, 2018 10:22
PHP snippet for MODX, that is used as a plugin to sort the resource-tabs
<?php
switch ($modx->event->name) {
case 'OnBeforeManagerPageInit':
$modx->controller->addHtml('
<script>
// This should be a component that registers late
Ext.ComponentMgr.onAvailable("emptifier", function(){
@sebastian-marinescu
sebastian-marinescu / cbContentEditor.php
Created October 28, 2018 14:13 — forked from jonleverrier/cbContentEditor.php
This MODX plugin hides certain Content Blocks buttons from a specific MODX user group. It also disables the drag and drop functionality, so that you can provide some users with a more locked down version of Content Blocks.
<?php
/**
* Content Blocks cbContentEditor Plugin
*
* This plugin hides certain CB buttons from certain MODX user groups
* and disables the drag and drop functionality, so that you can provide
* some clients with a more locked down version of CB.
*
* I would suggest setting up CB templates and defaults in the CB component manager,
* so that predefined layouts are loaded automatically when a new resource is created.
@sebastian-marinescu
sebastian-marinescu / JSMin.class.php
Created November 15, 2018 01:31 — forked from justindmartin/JSMin.class.php
JSMin -- Ryan Grove <[email protected]> (PHP port) -- Steve Clay <[email protected]> (modifications + cleanup) -- Andrea Giammarchi <http://www.3site.eu> (spaceBeforeRegExp) -- 2002 Douglas Crockford <[email protected]> (jsmin.c) -- 2008 Ryan Grove <[email protected]> (PHP port) -- http://opensource.org/licenses/mit-license.php MIT License -- http:…
<?php
/**
* JSMin.php - modified PHP implementation of Douglas Crockford's JSMin.
*
* <code>
* $minifiedJs = JSMin::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*