Skip to content

Instantly share code, notes, and snippets.

@obfuscode
obfuscode / Movie Folder Parser
Created September 11, 2014 14:20
A script that recursively reads a drag-n-dropped folder of movies and retrieves TMDb info and posters for them. See Demo Here: https://www.dropbox.com/s/7mauwell3ribju0/MovieFolderParser.mov?dl=0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Movie Folder Parser</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style>
html, body {

Bigcommerce added microdata tags in early 2015. There is an issue with the reviewCount and ratingCount if there are no reviews for your product. I found a non-JS way to fix this error that validates in the Google Testing Tool.

To fix this issue, add the %%GLOBAL_HideRating%% template tag into your Panels/ProductDetails.html template file in the itemprop label for the ratingCount and reviewCount microdata tags. If there IS a rating to show, the HideRating tag is replaced with an empty string, if there is NO rating, then it adds the word "none" (as in display:none) which breaks the microdata tag causing Google to ignore it.

Template Code:

<meta itemprop%%GLOBAL_HideRating%%="ratingCount" content="%%GLOBAL_ProductNumReviews%%" />
<meta itemprop%%GLOBAL_HideRating%%="reviewCount" content="%%GLOBAL_ProductNumReviews%%" />
@obfuscode
obfuscode / expressionengine_gotchas.md
Last active July 21, 2016 15:51
ExpressionEngine Gotchas: A list of things I've encountered while learning expressionengine

#ExpressionEngine Gotchas#

Disclaimer: Most everything in this list are things most EE devs know but I've collected them here hoping to help speed up the learning process for someone else.

####Template Tags

  • Global template tags like {logged_in} {logged_out} must be INSIDE {layout=} {/layout} tags and OUTSIDE any {exp:XX} {/exp} tags; even if the tag contains a redirect (See Example 1).
  • ee()->TMPL->tagdata gets the content between the tags.
  • ee()->TMPL->tagparams gets the content of the tag itself.
  • Use logged_in_ to access member tags inside other tags. Ex: {email} shows the email of the entry author inside {exp:channel:entries} so use {logged_in_email} to get the email of the currently logged in member.
@obfuscode
obfuscode / nginx_provision_conf.md
Last active November 27, 2020 09:46
Maintain custom nginx config after provisioning homestead

NOTE: This is not my solution. I'm merely adding it here for my own future reference and so it could help someone else down the line.

Edit your homestead serve file:
~/.composer/vendor/laravel/homestead/scripts/serve.sh

Above the line that says:
location ~.php$ {

Add this code:
include /etc/nginx/conf.d/$1-custom;

@obfuscode
obfuscode / change_cart_count.js
Created March 23, 2016 19:27
Change cart count even when back button is pressed
$(function() {
if (location.href.indexOf('/purchase/cart') !== -1) {
items = $('#cart_count').html();
document.cookie = "cart_count="+items+";path=/";
} else {
var cart_count = readCookie('cart_count');
if (cart_count > 0 && cart_count !== null) {
$('#cart_count').html(cart_count).show();
} else {
@obfuscode
obfuscode / watch.sh
Created April 25, 2016 13:48
Modified version of Mike Smullin's Watch.sh to watch folder for changes, then execute command / script
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@obfuscode
obfuscode / ee_admin_login_fix
Created April 25, 2017 12:28
ExpressionEngine Admin Login Fix
ExpressionEngine Admin Login Fix
Add this to the control panel
$config['cookie_prefix'] = '';
$config['cookie_path'] = '';
$config['cookie_domain'] = '';
$config['user_session_type'] = 'c';
$config['admin_session_type'] = 's';
@obfuscode
obfuscode / ee_get_member_fields
Created November 29, 2018 14:15
ExpressionEngine - Member Model - Get all custom Member Fields
$member = ee('Model')->get('Member', $member_id)->first();
$fields = ee('Model')->get('MemberGroup', $member->group_id)->first()->getAllCustomFields();
@obfuscode
obfuscode / ee_get_channel_fields
Last active November 29, 2018 14:19
ExpressionEngine - Channel Model - Get all custom Channel Fields
$entry = ee('Model')->get('ChannelEntry', $entry_id)->first();
$fields = ee('Model')->get('Channel', $entry->channel_id)->first()->getAllCustomFields();
@obfuscode
obfuscode / ee_set_member_fields
Created November 29, 2018 15:04
ExpressionEngine - Member Fields - Set Custom Field Value
$member = ee('Model')->get('Member', $member_id)->first();
$member->set(['m_field_id_1' => 'Your Value']); // Where "1" is your custom field id
$member->save();