Skip to content

Instantly share code, notes, and snippets.

@BretFisher
BretFisher / docker-for-mac.md
Last active May 15, 2024 05:19
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@vincent99
vincent99 / README.md
Created May 24, 2016 18:57
Rancher on docker-for-mac with xhyve

Install Docker for Mac (http://beta.docker.com)

Install docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve)

brew install docker-machine-driver-xhyve sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Deploy the latest release

docker run -d --privileged -p 8080:8080 --name=rancher-server rancher/server:latest

or a build-master

@opengeek
opengeek / src-Middleware-MODSlim.php
Created June 9, 2015 15:52
This is a proof of concept for using MODX 2.x as a dependency in a Slim application
<?php
/*
* This file is part of the MODSlim package.
*
* Copyright (c) Jason Coward <jason@opengeek.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@christianseel
christianseel / introRTE
Created August 14, 2014 14:52
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>');
@DESIGNfromWITHIN
DESIGNfromWITHIN / Gulpfile.js
Created June 27, 2014 07:56
MODX Gulp, SASS, NEAT & Browser-Sync build file
var gulp = require('gulp');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifycss = require('gulp-minify-css');
var concat = require('gulp-concat');
var neat = require('node-neat').includePaths;
var browserSync = require('browser-sync');
var paths = {
@sepiariver
sepiariver / cloneResource.php
Last active January 8, 2019 20:58
A Snippet to clone a Resource into multiple, user-defined parent containers in arbitrary contexts
<?php
// get user-defined source document and target parents
$source = intval($modx->getOption('sourceId', $scriptProperties, ''));
$targets = array_map('trim', explode(',', $modx->getOption('targetIds', $scriptProperties, '')));
// to prevent accidents...
$_allowedUsers = explode(',', 'username1,username2');
// check stuff, and if passed then get the source document object
if ( !in_array($modx->user->get('username'), $_allowedUsers) || empty($source) || $source == 0 || !is_array($targets) || empty($targets) ) return;
$sourceDoc = $modx->getObject('modResource', $source);
@terryjbates
terryjbates / txt2dbm.pl
Created September 27, 2012 02:58
Perl program to generate a .dbm file given a .txt file to be used by RewriteMap directive. Faster!
#!/usr/bin/perl -w
##
## txt2dbm -- convert txt map to dbm format
##
use SDBM_File;
use Fcntl;
($txtmap, $dbmmap) = @ARGV;
@fomigo
fomigo / defaultTemplateByParentTv.plugin.php
Created April 9, 2012 15:37 — forked from bfncs/defaultTemplateByParentTv.plugin.php
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@bfncs
bfncs / defaultTemplateByParentTv.plugin.php
Created December 13, 2011 23:55
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@larscwallin
larscwallin / visioncart.getorders.php
Created June 16, 2011 10:49
visioncart.getorders
<?php
$query = $modx->newQuery('vcOrder');
$query->where(array(
'shopid' => $shopid
));
$query->sortby($sortBy, $sortOrder);