Skip to content

Instantly share code, notes, and snippets.

View hergaiety's full-sized avatar
🐶
Arf?

Ava Gaiety Wroten hergaiety

🐶
Arf?
View GitHub Profile
@hergaiety
hergaiety / depth.scss
Created September 16, 2014 02:55
Google Material Design Shadow SASS Mixin Helper
/**
* Google Material Design style card depth
* Can receive an int between -5 and 5 (negatives use inset shadows) ex: @include depth(5); @include depth(-3)
*/
@mixin depth($layer) {
@if $layer > 0 {
$inset: 0;
$offset: null;
} @else {
$inset: inset;
@hergaiety
hergaiety / data_update.js
Created September 26, 2014 10:18
Ensures data-* updates the attribute when the real data is updated.
/**
* Ensures the data-* is updated visually when the data is updated by jQuery
* Example: $('.foo').data('bar', 'value').trigger('changeData');
*/
$(document).on('changeData', '.foo', function(e) {
$(this).attr('data-bar', $(this).data('bar'));
});
@hergaiety
hergaiety / rebindAfterAjax.js
Last active August 29, 2015 14:07
new html added via ajax can be triggered, or binded to
// Any new html added via ajax can be triggered, or binded to
$(document).ajaxComplete(function() {
setTimeout(function(){
// Magic, example: $('[data-tooltip]').tooltip();
}, 0);
});
@hergaiety
hergaiety / pauseHiddenVideos.js
Created October 28, 2014 20:00
Pause all hidden video elements.
$('video:not(:visible)').each(function() {
$(this).get(0).pause();
});
@hergaiety
hergaiety / emberfoundation.js
Last active August 29, 2015 14:13
Ember & Foundation... Play nice! Reflow Foundation on every new Ember Render.
// Thanks to @intuitivepixel for the original code to inspire this
/**
* EMBER APPLICATION DEFINITION
*/
window.App = Ember.Application.create();
/**
* INITIALIZE FOUNDATION
*/
$(document).foundation();
@hergaiety
hergaiety / tabs-fadein.scss
Created January 22, 2015 13:57
Foundation Tabs - Animated Fade In with AnimateCSS
.tabs-content > .content {
@extend .animated;
&.active {
@extend .fadeIn;
}
}
@hergaiety
hergaiety / ember-rangeslider.js
Last active January 5, 2016 17:28
Ember + rangeslider.js by andreruffert
/**
* Extend {{input}} to support html5 range.
* Example: {{input type="range" value=myProperty max="500"}}
* Uses rangeslider.js plugin for IE9 support and to look pretty
* Fires optional onInit, onSlide, and onSlideEnd events
*/
Ember.TextSupport.reopen({
attributeBindings: ['min', 'max', 'step'],
initRangeSlider: function() {
if (this.get('type') === 'range') {
@hergaiety
hergaiety / fdtn_close.js
Last active August 29, 2015 14:18
Foundation Don't Close on Esc key if Fullscreen anything is fullscreened
// Don't forget to turn off close_on_esc in your foundation initialization
// $(document).foundation({ reveal: { close_on_esc: false } });
$(document).on('keydown.reveal.custom', dom('reveal'), function(event) {
var isFullscreen = (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement);
if (event.keyCode === 27 && !isFullscreen) $(document).foundation('reveal', 'close');
});
a.upload {
display: inline-block;
position: relative;
input[type=file] {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
myBool: false,
actions: {
toggleBool: function() {
this.set('myBool', !this.get('myBool'));
}