Skip to content

Instantly share code, notes, and snippets.

@alanning
alanning / iscroll-registerYHook.html
Last active May 19, 2016 11:34
An extension to IScroll [1] which enables callbacks to be registered for a given Y position. Callbacks are called when the user scrolls past or back above the given position. Modified IScroll probe example [2]. To run locally, git clone IScroll repo and add this file to the demos/probe folder. 1. https://github.com/cubiq/iscroll 2. https://githu…
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>iScroll demo: probe</title>
<script type="text/javascript" src="../../build/iscroll-probe.js"></script>
@alanning
alanning / root_url_path_prefix.patch
Created November 25, 2013 14:39
Patch to apply James Gill's suggestion to allow environment variable for easier CDN integration. Tested with Meteor 0.6.6.3.
--- bundle/programs/server/packages/meteor.js 2013-11-25 08:41:18.000000000 -0500
+++ meteor-patched.js 2013-11-25 08:55:41.000000000 -0500
@@ -922,7 +922,8 @@
if (process.env.ROOT_URL && // 1
typeof __meteor_runtime_config__ === "object") { // 2
__meteor_runtime_config__.ROOT_URL = process.env.ROOT_URL; // 3
- var pathPrefix = Npm.require('url').parse(__meteor_runtime_config__.ROOT_URL).pathname; // 4
+ var pathPrefix = process.env.ROOT_URL_PATH_PREFIX ||
+ Npm.require('url').parse(__meteor_runtime_config__.ROOT_URL).pathname; // 4
__meteor_runtime_config__.ROOT_URL_PATH_PREFIX = pathPrefix === "/" ? "" : pathPrefix; // 5
// fix bootstrap dropdown unclickable issue on iOS
// https://github.com/twitter/bootstrap/issues/4550
$(document).on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) {
e.stopPropagation()
})
@alanning
alanning / in-sources-git.js
Last active December 28, 2015 04:39
rolling timeout for child processes. Test via `mrt update` on a system with `git 1.7.1` installed. `rm -rf ~/.meteorite/source/meteor` to clear local cache so clone is invoked.
GitSource.prototype._clone = function(fn) {
var self = this,
timeout = 5000,
handle,
child,
errOutput = [];
//console.log('git clone')
if (!fs.existsSync(this.sourcePath)) {
child = exec('git clone --progress ' + self.url + ' "' + this.sourcePath + '"', function(err, stdout, stderr) {
@alanning
alanning / webdriverjs-helpers.js
Last active January 25, 2018 10:18
WebDriverJS Helper functions
var flow = webdriver.promise.controlFlow();
var finish = function (done) {
driver.quit().then(function () {
done();
});
};
var error = function (e) {
driver.quit().then(function () {
@alanning
alanning / mini-pages transparent template rendering
Created February 3, 2013 22:53
meteor-mini-pages - Before callback hack to transparently render a different template than originally defined.
var beforeFilters = {
authenticate: function (context, page) {
var user
if (Meteor.loggingIn()) {
console.log('authenticate: loading')
//context.redirect( Meteor.loadingPath() )
if (!page.origTemplate) {
page.origTemplate = page.templateName
}
@alanning
alanning / yui-hello-app.html
Created July 18, 2012 13:53
YUI App Framework Hello World Example
<!DOCTYPE HTML>
<html>
<head>
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="app"></div>
<script>
@alanning
alanning / yui-hello.html
Created July 17, 2012 13:17
YUI App Framework Hello World Example
<!DOCTYPE HTML>
<html>
<head>
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="app"></div>
<script>
@alanning
alanning / gist:1097634
Created July 21, 2011 17:03
Example of model backed YUI 3.3 Datatable
<!DOCTYPE html>
<html>
<head>
<!--
Example of YUI 3.3.0 DataTable with Row Selection, Copy, Add, and Delete
Copyright 2011 Adrian Lanning
License: MIT, GPL
-->