Skip to content

Instantly share code, notes, and snippets.

View chrisdempsey's full-sized avatar

Chris Dempsey chrisdempsey

View GitHub Profile
@chrisdempsey
chrisdempsey / cross-browser-opacity.css
Created June 11, 2020 12:41 — forked from arnoldc/cross-browser-opacity.css
css: cross browser opacity
selector {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
-moz-opacity: 0.3;
-khtml-opacity: 0.3;
opacity: 0.3;
}
@chrisdempsey
chrisdempsey / fa-bounce.css
Created June 10, 2020 11:45 — forked from gubi/fa-bounce.css
Pulse animation for FontAwesome icons
.fa-bounce {
display: inline-block;
position: relative;
-moz-animation: bounce 1s infinite linear;
-o-animation: bounce 1s infinite linear;
-webkit-animation: bounce 1s infinite linear;
animation: bounce 1s infinite linear;
}
@-webkit-keyframes bounce {
@chrisdempsey
chrisdempsey / hosts
Created June 18, 2018 09:06
Hosts File to Block Facebook from my Machine
127.0.0.1 api.ak.facebook.com
127.0.0.1 api.connect.facebook.com
127.0.0.1 api.facebook.com
127.0.0.1 app.facebook.com
127.0.0.1 apps.facebook.com
127.0.0.1 ar-ar.facebook.com
127.0.0.1 badge.facebook.com
127.0.0.1 blog.facebook.com
127.0.0.1 connect.facebook.com
127.0.0.1 connect.facebook.net
@chrisdempsey
chrisdempsey / wp-basic-http-authentication.php
Created May 12, 2018 23:28 — forked from jamesmorrison/wp-basic-http-authentication.php
Adding HTTP Authentication to a WordPress site
<?php
/**
* Plugin Name: WP Basic HTTP Authentication
* Plugin URI:
* Description: Adds HTTP Authentication to a WordPress site
* Author: James Morrison
* Version: 1.0.2
* Author URI: https://www.jamesmorrison.me
**/
<?php
function send_http_auth_headers(){
header('WWW-Authenticate: Basic realm="Your Website Name Restricted"');
header('HTTP/1.0 401 Unauthorized');
echo 'Please speak to an administrator for access to the this feature.';
exit;
}
add_action('template_redirect', 'maybe_add_http_auth_basic', 0);
function maybe_add_http_auth_basic(){
# Add your specific URI segment (i.e. http://example.com/segment-string/)
@chrisdempsey
chrisdempsey / sessionmanager.class.php
Created August 1, 2017 13:36
SessionManager: A script that can be used for easy control over your session variables
<?php
/**
* SessionManager
* A script that can be used for easy control over your session variables.
* Put this script in your core/components/ folder, inside a sessionman/ subdirectory.
*
* Load this one in your snippets/plugins like;
*
* $sessman = $modx->getService('session','SessionManager', $modx->getOption('sessman.core_path',null,$modx->getOption('core_path').'components/sessionman/'), $scriptProperties);
* if(!($sessman instanceof SessionManager)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Session manager could not be loaded..'); return ''; }
@chrisdempsey
chrisdempsey / in_arrayi.php
Created June 24, 2017 23:05 — forked from sepehr/in_arrayi.php
PHP: Case-insensitive in_array()
<?php
/**
* Case-insensitive in_array() wrapper.
*
* @param mixed $needle Value to seek.
* @param array $haystack Array to seek in.
*
* @return bool
*/
@chrisdempsey
chrisdempsey / Bezumkin equivalent plugin.php
Last active March 23, 2022 15:19
Automatically resizes images uploaded through the MODX File Manager if they exceed the dimensions specified in the config settings below and the file extension is included in the upload_images System Setting. Provides basic filename sanitization. Dependancies: Resizer Extra (http://modx.com/extras/package/resizer)
<?php
/**
* ResizeOnUpload Plugin
*
* Events: OnFileManagerUpload
* Author: Vasiliy Naumkin <bezumkin@yandex.ru>
* Required: PhpThumbOf snippet for resizing images
*/
if ($modx->event->name != 'OnFileManagerUpload') {return;}
<?php
/**
* activateAssets
*
* DESCRIPTION
*
* Activates assets registered in placeholder.
*
* PROPERTIES:
*
<?php
/**
* registerAssets
*
* DESCRIPTION
*
* Registers assets to MODX Placeholder.
*
* Requires call to [[activateAssets]] before closing body tag in template. This grabs files list from the Placeholder and outputs a javascript block
* of assets to be injected after page load.