Skip to content

Instantly share code, notes, and snippets.

View dfrdmn's full-sized avatar

David Friedman dfrdmn

  • Philadelphia, PA
View GitHub Profile
@dfrdmn
dfrdmn / gist:1336851
Created November 3, 2011 15:54
Unique token for model
class MyModel(models.Models):
token = models.CharField(max_length=22, unique=True, editable=False)
def save(self, *args, **kwargs):
if not self.token:
import uuid
import base64
self.token = base64.urlsafe_b64encode(uuid.uuid4().bytes).strip('=')
return super(MyModel, self).save(*args, **kwargs)
\version "2.19.20"
\score {
\relative c''
\new StaffGroup
\with {
\remove "System_start_delimiter_engraver"
\override SpanBar.glyph-name = #"!"
}
<<
@dfrdmn
dfrdmn / remarketing.liquid
Last active April 28, 2017 19:23
Google remarketing code for Shopify
{% comment %}Create a file called `google-remarketing.liquid` in the snippets subdirectory of your template with the following code. Be sure to insert your merchant ID.{% endcomment %}
{% if template contains 'index' %}
<script type="text/javascript">
var google_tag_params = {
ecomm_pagetype: 'home',
};
</script>
{% elsif template contains 'collection' %}
<script type="text/javascript">
var google_tag_params = {