Skip to content

Instantly share code, notes, and snippets.

View teolopez's full-sized avatar
🤓

Teodoro Lopez teolopez

🤓
View GitHub Profile
@teolopez
teolopez / WordPress Redirect all non-logged-in users
Last active October 5, 2018 23:52 — forked from daltonrooney/gist:1737771
Redirect all non-logged-in users to the login page (private site). Add to functions.php.
<?php
// ----------------------------------------------------------------------------------------
// Redirect all non-logged-in users to the login page (private site). Add to functions.php.
// ----------------------------------------------------------------------------------------
function admin_redirect() {
if ( !is_user_logged_in()) {
wp_redirect( home_url('/wp-admin/') );
exit;
}
// -----------
// Debugger that shows view port size. Helps when making responsive designs.
// -----------
function showViewPortSize(display) {
if(display) {
var height = jQuery(window).height();
var width = jQuery(window).width();
jQuery('body').prepend('<div id="viewportsize" style="z-index:9999;position:fixed;top:40px;left:5px;color:#fff;background:#000;padding:10px">Height: '+height+'<br>Width: '+width+'</div>');
jQuery(window).resize(function() {
@teolopez
teolopez / gist:7482961
Created November 15, 2013 11:30 — forked from max/gist:5708466
// I needed flatuicolors.com as Sass variables...
// In your console, run:
$('.color').get().map(function(el) { return "$" + el.classList[1] + ": " + el.getAttribute('data-clipboard-text') + ';' }).join('\r\n');
// Output:
// $turquoise: #1abc9c;
// $emerland: #2ecc71;
// $peter-river: #3498db;
// $amethyst: #9b59b6;
// $wet-asphalt: #34495e;
$lightgray : #819090;
$gray : #708284;
$mediumgray : #536870;
$darkgray : #475B62;
$darkblue : #0A2933;
$darkerblue : #042029;
$paleryellow : #FCF4DC;
$paleyellow : #EAE3CB;
$yellow : #A57706;
$orange : #BD3613;
// Opacity should be on a 100 point scale (0-100 instead of 0.0-1.0)
// This should be used to supplement a normal border definition as it
// only deals with the 'border-color' property.
@mixin border-opacity($color, $opacity) {
$opacity: $opacity / 100;
// Unsupporting browsers get this
border-color: $color;
// Browsers that support RGBA will get this instead

Contract Killer

  • Revised date: 02/12/2014

Between us [company name] and you [customer name]

@teolopez
teolopez / 0_reuse_code.js
Created June 30, 2014 23:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public