Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Isaac Borup MFFunmaker

🏠
Working from home
Block or report user

Report or block MFFunmaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View image-flip.css
img {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
View mobile-detect-barf.js
window.mobilecheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|j
@MFFunmaker
MFFunmaker / woocommerce-autoadd-product.php
Created May 17, 2017
Automatically Add Items to WooCommerce Cart
View woocommerce-autoadd-product.php
/*
* Add item to cart on visit
*/
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
@MFFunmaker
MFFunmaker / ninja-sass.scss
Last active Apr 23, 2017
A collection of things you can do with Sass that are pretty cool
View ninja-sass.scss
/*
* Dynamically grab a partial based on a class name
*/
@function get-class-partial() {
$className: str-slice(#{&}, 2);
@return "../partials/_#{$className}.scss";
}
.signup {
content: "#{get-class-partial()}";
View dynamic-sass-imports.scss
@function trump-url() {
$className: str-slice(#{&}, 2, str-length(#{&}));
@return "../trump/#{$className}.scss";
}
.signup {
$googleapi: 'googleapis';
@import url('https://fonts.#{$googleapi}.com/css?family=UnifrakturCook:700');
@import "#{trump-url()}";
}
View scopeless-sass-placeholder
$breakpoints: (sm:576px, md:768px, lg:992px, xl:1200px);
%button-reset {
$media: sm; // declare which screen size this is for
appearance: none;
border: none;
outline: none;
@each $screen-size, $breakpoint-value in $breakpoints {
@if ( index($media,$screen-size) ) {
@media (min-width: $breakpoint-value) {
@MFFunmaker
MFFunmaker / calculate-height.js
Last active Jan 31, 2017
JS Height Calculate
View calculate-height.js
var containerHeight = 0;
var outerContainerWidth = $('#outerContainer').width();
$('body').append('<div id="tempCloneItems" style="width:'+outerContainerWidth+'px;"></div>');
// iterate over the topic filter item containers
$('.heightAutoItemsThatHaveNoNumericalHeight').each(function(i,e){
// a little trick I learned in 'nam to get the computed height of any element
// regardless of the height being specified in CSS. Works everywhere.
var cloneHeight = $(e).clone().addClass('someTempClass').appendTo('#tempCloneItems').height();
containerHeight += cloneHeight;
$('.someTempClass').remove();
View conditional-session-start.php
// version check and then corresponding session check
if ( ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) && ( session_status() == PHP_SESSION_NONE ) ) {
session_start();
}
elseif ( session_id() == '' ) {
session_start();
}
@MFFunmaker
MFFunmaker / secureSessionStart.inc.php
Created Aug 27, 2014
PHP - Securely start a session
View secureSessionStart.inc.php
<?php
/***** 1. Start off with some php.ini setup *****/
// Increases the randomness of the session ids.
// NOTE: This feature is supported on Windows since PHP 5.3.3.
// In Windows, setting session.entropy_length to a non zero value will make PHP use the Windows Random API as entropy source.
ini_set('session.entropy_file', '/dev/urandom');
// Sets how many bytes or characters are used from the above line's entropy file. 512 is pretty damn solid (27 August 2014)
You can’t perform that action at this time.