Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Tyler Harms harmstyler

😀
View GitHub Profile
@harmstyler
harmstyler / embed-latest.tpl
Created Oct 30, 2012
Like if/else blocks?
View embed-latest.tpl
{* Custom Embed template: Embed-Latest *}
{* User inserts an object, chooses embed-latest as view *}
{* Page viewer is then shown the most recent article or media_page under that object *}
{cache-block expiry=300 keys=array($object.id, $object.modified,$object.main_node_id)}
{def $article = fetch( 'content', 'list',
hash( 'parent_node_id', $object.main_node_id ,
'sort_by', array( 'published', false() ),
'class_filter_type', 'include',
'class_filter_array', array('media_page', 'article', 'link', 'blog_post'),
'limit', 1))}
@harmstyler
harmstyler / jw_player.html
Created Nov 5, 2012
Example of a JW Player install
View jw_player.html
<script type="text/javascript">
jwplayer("csps-video-0").setup({
logo: {hide: true},
height: 314,
width: 480,
controlbar: "bottom",
plugins: {
"timeslidertooltipplugin-1": {
displayhours: "true",
marginBottom: "22",
@harmstyler
harmstyler / ez-media.tpl
Created Nov 6, 2012
Javascript in eZ Templates with literals and variables
View ez-media.tpl
<div class="landing-video-surround">
<div class="audio-player" id="LandingPageVideo"></div>
</div>
<script type="text/javascript">
var videoURL = '{$video-url|trim}',
videoHeight = '{$player_height}',
videoWidth = '{$player_width}',
jwPlayer = {'javascript/player.swf'|ezdesign},
titleCard = '{$title-card-url}',
rtmpFile = '{$rtmp-file|trim}',
@harmstyler
harmstyler / build_query_params.js
Created Apr 5, 2013
Build a query string when given the params object
View build_query_params.js
url = $.url();
params = url.param();
if (params.q != null) {
qs = buildQueryString(params);
}
buildQueryString = function(params) {
var param, qs;
qs = '';
@harmstyler
harmstyler / rwdTables.coffee
Last active Dec 16, 2015
A Responsive Design Approach for Complex, Multicolumn Data Tables by filament group, moved to coffeescript.
View rwdTables.coffee
rwdTables = ->
container = $('<div class="table-menu table-menu-hidden"><ul /></div>')
$( "thead th" ).each (i) ->
th = $(this)
id = th.attr("id")
classes = th.attr("class"); # essential, optional (or other content identifiers)
# assign an ID to each header, if none is in the markup
if id is undefined
id = ( "col-" ) + i;
@harmstyler
harmstyler / caret.scss
Created Jun 26, 2013
Simple hack to give more caret options to bootstrap's caret class
View caret.scss
/* ***** Carets and other CSS icons ***** */
.caret {
&.up {
border-bottom: 4px solid #000000;
border-top: none;
}
&.left {
border-top: 4px solid transparent;
border-right: 5px solid #000000;
border-bottom: 4px solid transparent;
View enablescrollmenu.coffee
enableScrollMenu = ->
$(".bottomscrollbar").hover (->
$this = $(this)
windowHeight = $this.prev().children().length * $this.prev().children().height()
$this.prev().animate(
scrollTop:windowHeight
,600)
), ->
# stop on unhover
$(this).prev().stop()
@harmstyler
harmstyler / accessibleDropdown.coffee
Created Aug 2, 2013
Keyboard accessible dropdown menu.
View accessibleDropdown.coffee
$.fn.accessibleDropDown = ->
el = $(this);
enter = -> $(this).addClass('hover')
leave = -> $(this).removeClass('hover')
# Hover dropdown
$("li", el).hoverIntent(enter,leave)
# Make dropdown menus keyboard accessible
$("a", el).focus( ->
$(this).parents("li").addClass("hover");
@harmstyler
harmstyler / affixEvents.js
Created Nov 8, 2013
Code taken from comment by @gregjopa on how to add affix events to bootstrap.
View affixEvents.js
$alert.on('unaffixed.bs.affix', function () {
// ... Code Here
});
$alert.on('affixed.bs.affix', function () {
// ... Code Here
});
@harmstyler
harmstyler / statics.py
Created Nov 14, 2013
django 1.5 Project and Base Directory variables
View statics.py
import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.abspath(os.path.join(PROJECT_DIR, '../../'))
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files