Skip to content

Instantly share code, notes, and snippets.

@wagenet
wagenet / Assetfile.rb
Created January 13, 2012 20:37
Ember Handlebars Precompile
require 'execjs'
class HandlebarsFilter < Filter
class << self
def contents
@@contents ||= [File.read("headless-ember.js"), File.read("ember.js")].join("\n")
end
def context
@@context ||= ExecJS.compile(contents)
@rosskevin
rosskevin / Col.js
Last active December 11, 2022 18:15
material-ui `next` responsive layout/grid using JSS (originally based on flexboxgrid.com)
// @flow
import React, {Component, Element, PropTypes} from 'react'
import classNames from 'classnames'
import pure from 'recompose/pure'
import merge from 'lodash/merge'
import {createStyleSheet} from 'jss-theme-reactor'
import Logger from '../../util/Logger'
import {capitalizeFirstLetter} from '../../util/strings'
type DefaultProps = {
@ronkorving
ronkorving / ios6-timers.js
Last active March 9, 2022 03:40
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is released in the public domain. Do with it what you want, without limitations. I do not promise
// that it works, or that I will provide support (don't sue me).
// Author: rkorving@wizcorp.jp
var timeouts = {};
@mattsahr
mattsahr / native.scroll.html
Created November 17, 2011 02:47
IOS Webkit - native internal scroll - a fix for the document page-top-bounce
<!DOCTYPE html>
<html>
<!-- NOTES
Demo - uses IOS native scroll available in IOS5, but sidestep the document-bounce behavior. Tested on iPad 1, using IOS 5.1.
This approach uses a set of 3 nested divs.
OuterDiv -- fixed height, width, overflow-scrolling: touch;
MiddleDiv -- fixed height width, overflow-scrolling: touch; fits inside OuterDiv
InnerDiv -- fixed height width, bigger than MiddleDiv, so it kicks in the overflow behavior
@getify
getify / auto-ga.js
Created November 24, 2010 15:25
create an auto-loader for Google Analytics (using LABjs)
/*! LAB.js v1.0.3 (c) Kyle Simpson MIT License */
/* INCLUDE THE MINIFIED LAB.js CODE HERE */
$LAB
.script('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js')
.wait(function(){
var scripts = document.getElementsByTagName("script"),
src, i, len,
acct = "UA-XXXXX-X",
@rosskevin
rosskevin / Box.js
Created September 23, 2016 17:30
Samples for material-ui `next` responsive layout/grid using JSS (originally based on flexboxgrid.com)
// @flow
import React, {Element, PropTypes} from 'react'
import pure from 'recompose/pure'
import {createStyleSheet} from 'jss-theme-reactor'
import classNames from 'classnames'
import Logger from '../../../util/Logger'
type Props = {
type: ?string,
children: ?Element<any>
@sompylasar
sompylasar / Viewport.js
Last active March 18, 2017 11:16
Viewport React component with animated scrolling and overlay handling.
import React, { Component, PropTypes } from 'react';
import verge from 'verge';
import { Motion, spring } from 'react-motion';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import styles from './styles.scss';
@getify
getify / gist:713779
Created November 24, 2010 15:09
loading google analytics using LABjs
<!DOCTYPE html>
<html>
<head>
<title>LABjs Demo</title>
</head>
<body>
<!-- some stuff -->
<script src="/js/LAB.js"></script>
@charlesjolley
charlesjolley / dev_view.coffee
Created August 21, 2012 03:57
Adding event locks to Ember
# example view implements a simple dragging for mouse events.
Wall.DevView = Ember.View.extend
mouseDown: (ev) ->
ev.dispatcher.lock @, 'mouseMove', 'mouseUp'
@_mouseDown = @$().offset()
@_mouseDown.pageX = ev.pageX
@_mouseDown.pageY = ev.pageY
@_mouseDown.dispatcher = ev.dispatcher
console.log 'mouseDown'
@ppcano
ppcano / logo_switch_button.css
Created July 10, 2012 08:32
Flip Switch Button with Ember on Touch Environment
@white00:#fefefe;
@white01:#f9f9f9;
@white02:#fbfbfb;
@white03:#f0f0f0;
@white04:#efefef;
@grey00:#919191;
@grey01:#7d7d7d;
@grey02:#7f7f7f;
@grey03:#b6b6b6;