Skip to content

Instantly share code, notes, and snippets.

@joewanko
joewanko / php-logging.php
Last active April 7, 2017 09:01
PHP Logging Function
if(!function_exists('_log')){
function _log($message) {
if(is_array($message) || is_object($message)) {
error_log(print_r($message, true));
} else {
error_log($message);
}
}
}
javascript: (function() {
$('#header').remove();
$('#infobar').remove();
$('.side').remove();
$('.spacer')[1].remove();
$('#sharelink_').remove();
$('#report-action-form').remove();
$('.gold-wrap').remove();
$('.footer-parent').remove();
$('.debuginfo').remove();
@joewanko
joewanko / file.scss
Last active April 7, 2017 08:58
Trick to imitate `background-size: cover;` on img tags. Parent can be any element type.
.parent {
overflow: hidden;
position: relative;
.child {
bottom: -9999px;
left: -9999px;
margin: auto;
min-height: 100%;
min-width: 100%;
@joewanko
joewanko / responsiveWidthHeight.scss
Last active April 7, 2017 09:02
SCSS Responsive height to width ratio trick.
.item {
background-attachment: inherit;
background-position: center;
background-size: cover;
display: inline-block;
height: auto;
position: relative;
width: 100%;
&::before {
@joewanko
joewanko / socialPopups.js
Last active April 7, 2017 08:53
Javascript functions that create Facebook and Twitter pop ups for sharing. No APIs are necessary.
'use strict';
/**
* Popup with a Facebook share page without the need of the JS API.
* @param {string} url URL of the page to share.
* @param {?number} opt_height Height of the popup.
* @param {?number} opt_width Width of the popup.
*/
facebookShare = function(url, opt_height, opt_width) {
var href = url;