Skip to content

Instantly share code, notes, and snippets.

View ericdfields's full-sized avatar
🏠
Working from home in Baltimore, sometimes in DC

Eric Brookfield ericdfields

🏠
Working from home in Baltimore, sometimes in DC
View GitHub Profile
cleanUpNotifications: function() {
var now = Date.now()
var _this = this;
this.state.notifications.map(function(notification,i) {
if (now - notification.added > _this.props.cleanUpInterval) {
_this.handleRemove(i)
}
})
},
@ericdfields
ericdfields / backspace_nav_handler_mixins.js
Last active August 29, 2015 14:19
Disable backspace navigation when textarea has content react mixin
module.exports = {
disableBackspaceNavEvent: function(event) {
if (event.keyCode == 8) {
if (event.target.type && event.target.type.match(/text/)) {
return true
} else {
event.preventDefault()
}
}
},
@ericdfields
ericdfields / app.js
Last active August 29, 2015 14:21
Resolving local UI state with Flux using Flummox and Promises
import Flux from 'path/to/flux.js'
window.MyApp.flux = new Flux()
$controls.find('a').each(function(index){
var $this = $(this)
$this.data('active',false)
$this.bind('click',function(e){
e.preventDefault()
if (!$this.data('active')) {
$this.data('active',true)
switch (index) {
case 0:
// up
.new-deals-indicator {
-webkit-animation-name: gentleBounce;
-webkit-animation-duration: 3s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
}
@-webkit-keyframes gentleBounce {
0% {
@include translateY(0)
}
asdfasfd
$('#client_catalog-category-view').live('pagecreate',function(event){
// alert('This page was just enhanced by jQuery Mobile!');
viewToggles.init()
loadMore.init()
});
// Product Array - View as Toggles
var viewToggles = {
init: function() {
$('#filters_view-as').find('a').bind('click',function(e){
@ericdfields
ericdfields / gist:1022957
Created June 13, 2011 15:13
jQuery Mobile Sass for preventing flash of unstyled content when jqm is loaded outside of head
/* Prevents flash of unstyled content as jqm loads */
body {
background: black;
[data-role="page"] {
visibility: hidden;
}
}
.ui-mobile-viewport {
[data-role="page"] {
visibility: visible;
@for $i from 1 through 5 {
article:nth-child(2n + $i) {
top: $i*20px;
opacity: 0.5;
}
}
# my helper
def logged_in()
"\#{request.boolean_param(logged_in)}"
end
# my template code
<% if !logged_in %>
<script type="text/javascript" charset="utf-8">
alert('done')
</script>