Skip to content

Instantly share code, notes, and snippets.

@lgellert
lgellert / functions.php
Last active February 27, 2017 05:17
WordPress function for Facebook OG meta tags
<?php
// put this into your theme's functions.php file
// swap out the default image online 10
// build the facebook og meta tags based on defaults
// or if on a page or post, pull information off that object
function opengraph_tags() {
// defaults
$title = get_bloginfo('title');
$img_src = get_stylesheet_directory_uri() . '/images/your_default_image_here.jpg';
@lgellert
lgellert / AutoSlugifyOnSaveModel.py
Last active January 2, 2020 06:43
Django 1.8x + compatible automatic slug creator abstract model
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.db import IntegrityError
from django.template.defaultfilters import slugify
class AutoSlugifyOnSaveModel(models.Model):
"""
/**
* Copyright 2011 Laurence Gellert
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/**
* Copyright 2011 Laurence Gellert
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@lgellert
lgellert / Gruntfile.js
Created May 6, 2014 19:26
Grunt build example with JavaScript and CSS concatentation and minification
'use strict';
module.exports = function (grunt) {
// load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
/* loads the package json file, which can then be used as the pkg. variable */