Skip to content

Instantly share code, notes, and snippets.

/*
Canbe edited for Bootstrap 3
Not originally my idea but I haven't been able to find the article I got the idea from.
Makes more sense to use this than manual media queries.
John Camacho
Nov 2 2018
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@jcamachott
jcamachott / .htaccess-maintenance
Created May 29, 2016 16:48
htaccess maintenance mode with IP exceptions
RewriteEngine On
RewriteBase /
# Add all the IP addresses of people that are helping in development
# and need to be able to get past the maintenance mode.
# One might call this the 'allow people list'
RewriteCond %{REMOTE_HOST} !^77\.234\.42\.555
RewriteCond %{REMOTE_HOST} !^190\.213\.189\.555
<div id="mini-calendar">
<div class="clndr">
<div class="clndr-controls">
<div class="clndr-control-button"><span class="clndr-previous-button">previous</span>
</div>
<div class="month">February 2016</div>
<div class="clndr-control-button rightalign"><span class="clndr-next-button">next</span>
</div>
</div>
<table class="clndr-table" border="0" cellspacing="0" cellpadding="0">
@jcamachott
jcamachott / responsive-table.css
Last active February 11, 2016 16:09
Responsive tables - css only
/*
Taken from https://css-tricks.com/responsive-data-tables/
*/
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
@jcamachott
jcamachott / hasChildren
Last active August 29, 2015 14:25
hasChildren
<?php
/*
Gist: https://gist.github.com/jcamachott/031e60748bb06314758d
Version: 1.0.20150718
hasChildren: returns 1 or 0 if specified ID has children
Options:
&id=`` // use current doc id - [[*id]] or if in tpl, use [[+id]]
*/
@jcamachott
jcamachott / randomString
Last active August 29, 2015 14:25
randomString
<?php
// ver 1.1.20150717
//
// Most recent: https://gist.github.com/jcamachott/dfddd63605a375f29e77
//
// Usage:
// [[randomString? &strings=`one|two|three|four`]]
//
// $strings: string
<?php
/**
* Snippet for displaying Image+ thumbnails in Collections views
*
* Based on snippet ImagePlus from @package imageplus by Alan Pich <alan.pich@gmail.com>
* @author John Camacho
*
* @snippet ImagePlus_collections
* @var string $tvname Name of your TV
* @var string $phpThumbParams Phpthumb parameters
Verifying that +jcamacho is my openname (Bitcoin username). https://onename.com/jcamacho
@jcamachott
jcamachott / isAdmin
Last active November 5, 2020 15:08
isAdmin: MODx snippet for displaying content if user is logged into mgr or has a specified IP address
<?php
// ver 1.1.20201105a
//
// Most recent: https://gist.github.com/jcamachott/6126869
//
// should always be called uncached
// Usage:
// [[!isAdmin:is=`1`:then=`Do this`:else=`Do that`? &check=`mgr` &disable=`0`]]
//
// $check - get (has GET var admin=1) or mgr (manager logged in) or ip (ip address set in ++admin_ip)