Skip to content

Instantly share code, notes, and snippets.

View harmstyler's full-sized avatar

Tyler Harms harmstyler

View GitHub Profile
@harmstyler
harmstyler / affixEvents.js
Created November 8, 2013 15:16
Code taken from comment by @gregjopa on how to add affix events to bootstrap.
$alert.on('unaffixed.bs.affix', function () {
// ... Code Here
});
$alert.on('affixed.bs.affix', function () {
// ... Code Here
});
@harmstyler
harmstyler / accessibleDropdown.coffee
Created August 2, 2013 16:13
Keyboard accessible dropdown menu.
$.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");
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 / caret.scss
Created June 26, 2013 19:02
Simple hack to give more caret options to bootstrap's caret class
/* ***** 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;
@harmstyler
harmstyler / rwdTables.coffee
Last active December 16, 2015 20:19
A Responsive Design Approach for Complex, Multicolumn Data Tables by filament group, moved to coffeescript.
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 / build_query_params.js
Created April 5, 2013 16:33
Build a query string when given the params object
url = $.url();
params = url.param();
if (params.q != null) {
qs = buildQueryString(params);
}
buildQueryString = function(params) {
var param, qs;
qs = '';
@harmstyler
harmstyler / ez-media.tpl
Created November 6, 2012 17:16
Javascript in eZ Templates with literals and variables
<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 / jw_player.html
Created November 5, 2012 20:18
Example of a JW Player install
<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 / embed-latest.tpl
Created October 30, 2012 18:22
Like if/else blocks?
{* 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 / addeztag.php
Created October 23, 2012 16:40
Storing eZ Tags
<?php
/**
 * Created by JetBrains PhpStorm.
 * User: tyler
 * Date: 1/6/12
 * Time: 4:33 PM
 * To change this template use File | Settings | File Templates.
 */
class AddeZTag
{