Skip to content

Instantly share code, notes, and snippets.

View jperl's full-sized avatar

Jon Perl jperl

View GitHub Profile
@jperl
jperl / gist:09e1b38b64404c2bf84a
Created May 4, 2014 18:15
Force a scrollview to a position
/**
* Force a scrollview to a position
*/
var forcePosition = function (scrollview, position, noSpring) {
if (noSpring) {
scrollview._springState = 0;
scrollview._physicsEngine.detachAll();
}
scrollview.setVelocity(0);
### Keybase proof
I hereby claim:
* I am jperl on github.
* I am jperl (https://keybase.io/jperl) on keybase.
* I have a public key whose fingerprint is 943D 6154 9F38 1087 C45A C154 17FB BF31 554A 8E5C
To claim this, I am signing this object:
@jperl
jperl / gist:c9df45a0c6e24f338de3
Last active August 29, 2015 14:01
Force a scrollview to a page index
/**
* Force a scrollview to a position
*/
Tools.forcePosition = function (scrollview, position, noSpring) {
if (noSpring) {
scrollview._springState = 0;
scrollview._physicsEngine.detachAll();
}
scrollview.setVelocity(0);
@jperl
jperl / cordova-app
Last active August 29, 2015 14:02
Meteor Rider with Offline Support / Caching
var CordovaApp = {
/**
* Load the meteor app with meteor-rider.
* @param {Boolean} [force] Overwrite the cache.
*/
loadMeteor: function (force) {
if (force) {
CordovaApp.loaded = false;
MeteorRider.clearCache();
}
@jperl
jperl / layout.html
Last active August 29, 2015 14:04
Meteor Transitioner Example
<template name="layout">
{{#transitioner transitionIn=transitionIn transitionOut=transitionOut}}
{{> yield}}
{{/transitioner}}
</template>
@jperl
jperl / gist:19d1322187b1756fe3e2
Created August 27, 2014 19:14
Grunt tasks to add and build crosswalk for cordova project using grunt shell
var crosswalk = {
folder: {
arm: 'tools/crosswalk-cordova-7.36.154.13-arm',
x86: 'tools/crosswalk-cordova-7.36.154.13-x86'
}
};
// https://crosswalk-project.org/#documentation/cordova/migrate_an_application
var addCrosswalk = {
command: [
@jperl
jperl / Sizes.md
Created October 30, 2014 17:40
Meteor App Icon and Launch Screen Size Guide

###Icons

Name Size
iphone_2x 120x120
iphone_3x 180x180
ipad 76x76
ipad_2x 152x152
android_ldpi 36x36
android_mdpi 48x48
@jperl
jperl / cors.txt
Created November 2, 2014 16:35
CORS configuration for AWS
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
@jperl
jperl / gist:d4d505005549165ab1d9
Last active August 29, 2015 14:12
Track previous route in iron router
Routes = {};
/**
* The current route's name
*/
Routes.name = function () {
return Router.current().route.getName();
};
var routeNameAfterLastAction = null;
@jperl
jperl / gist:408119f2fbd190eabb7f
Created March 12, 2015 21:57
Impersonate meteor user for development
// Server
Meteor.methods({
/**
* Login as a userId. Must be an admin.
*/
impersonate: function (options) {
var self = this;
if (Settings.isProduction) {
var currentUser = Meteor.users.findOne(self.userId);