Skip to content

Instantly share code, notes, and snippets.

View joshcartme's full-sized avatar

Josh Cartmell joshcartme

View GitHub Profile
@joshcartme
joshcartme / .swcrc
Created February 24, 2022 00:14
SWC issue
{
"jsc": {
"experimental": {
"plugins": [
["/path/to/test_plugin/target/wasm32-wasi/debug/test_plugin.wasm", {}]
]
}
}
}
@joshcartme
joshcartme / EmberJSNotes.md
Last active September 23, 2015 17:18
the case to use EmberJS

Ember is a framework that embraces convention over configuration. Even if you don't agree with every convention they have (I'm sure there are some things I wouldn't agree with) the convention means it will be easy for someone else to come in and understand what was going on.

I've read multiple places that every member of the Ember core team works on at least one production Ember site, keeping them in tune with how Ember is used, what developers need, what the pain points are, etc...

Features

  • Router
  • Handlebars templates w/two way binding
  • Components
  • Data abstraction layer
@joshcartme
joshcartme / 0001_form_add_field.py
Created July 15, 2015 16:06
Django migrations for Mezzanine EXTRA_MODEL_FIELD
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import mezzanine.core.fields
class AddExtraField(migrations.AddField):
def __init__(self, *args, **kwargs):
@joshcartme
joshcartme / admin.py
Last active August 29, 2015 14:21
Create and edit third level Django inlines
from django.contrib.admin.options import IS_POPUP_VAR
from django.template.response import SimpleTemplateResponse
from django.utils.html import escape, escapejs
from mezzanine.core.admin import TabularDynamicInlineAdmin
from mezzanine.pages.admin import PageAdmin
from .models import TopLevel, SecondLevel, ThirdLevel
@joshcartme
joshcartme / gist:5f13fc525189b5d22112
Created May 14, 2015 15:50
Updated Mezzanine import_wordpress.py to handle pub_date conversion error
from __future__ import unicode_literals
from future.builtins import int
from collections import defaultdict
from datetime import datetime, timedelta
from optparse import make_option
import re
from time import mktime, timezone
from xml.dom.minidom import parse

index.html

{% include "teaser.html" %}

teaser.html

{% load page_teaser_tags keyword_tags mezzanine_tags i18n %}

{% block page_teaser %}

{% page_teaser "about-us" as teased_page %}

@joshcartme
joshcartme / gist:9063054
Created February 18, 2014 01:50
Fixed jquery.tools.overlay.js for Mezzanine
// http://n33.co/2013/03/23/browser-on-jquery-19x-for-legacy-ie-detection
jQuery.browser={};
(function() {
jQuery.browser.msie = false;
jQuery.browser.version = 0;
if(navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
jQuery.browser.msie = true;
jQuery.browser.version = RegExp.$1;
}
})();
@joshcartme
joshcartme / editable_form.html
Last active December 28, 2015 06:48
Bootstrap modal Mezzanine editable form
{% load i18n future %}
<style>
.editable-form{
background: none!important;
}
</style>
{# Edit form #}
<form class="editable-form modal fade" method="post"
@joshcartme
joshcartme / extend_page_menu.py
Created April 23, 2013 17:16
Pull in a menu from a different site than the current in a Mezzanine multi site setup.
from mezzanine.utils.sites import current_site_id
from mezzanine.pages.templatetags.pages_tags import page_menu
from mezzanine import template
register = template.Library()
@register.render_tag
def page_menu_for_site(context, token):
@joshcartme
joshcartme / vimeo_api.py
Created April 19, 2013 20:12
Uploads a video to Vimeo using https://github.com/dkm/python-vimeo
import os
import time
import urllib2
try:
import simplejson as json
except ImportError:
import json
import vimeo