Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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.

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 / 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 {