Skip to content

Instantly share code, notes, and snippets.

link: function(scope, element, attrs, scrollViewCtrl) {
var el = element[0],
parent = el.parentNode,
trigger = false,
topIndicator = document.createElement("div"),
bottomIndicator = document.createElement("div"),
topText = "Pull to load more…",
bottomText = "Scroll to load more…",
loadMoreText = "Release to load more…",
loadingText = "Loading…";
scope.$watch("ptrLoading", function(val) {
if(val === true) {
topIndicator.className += "loading-class"
topIndicator.innerText = loadingText;
bottomIndicator.innerText = loadingText;
} else {
resetIndicators();
}
});
@karlwestin
karlwestin / angular-injector-examples.js
Created August 22, 2014 15:48
Access components using the angular.js injector
// When you bootstrapped your app manually,
// angular.bootstrap returns the injector for the app:
var myApp = angular.boostrap(element, "app");
// Now you can require modules that's been
// defined and play around with them separately
var myApp = rfzApp.get("app.services.confirm");
confirm("Details were saved");
// To see more what you can do with the injector (the rfzApp object)
@karlwestin
karlwestin / all.js
Created September 3, 2014 18:10
selenimum reporting from jasmine tests
// in all.html, change the 'done' function at the bottom to this
function done() {
//document.getElementById("currentTest").innerHTML = "";
//var res = _.reduce(results, function(sum, item) {
// sum.totalCount += item.totalCount;
// sum.failedCount += item.failedCount;
// sum.passedCount += item.passedCount;
// sum.fails = sum.fails.concat(item.fails);
// return sum;
/*
* Tests for sticky notifications
*/
define([
"./stickyNotifications",
"lib/RFZ.pubsub",
//"widgets/billpay/billpay"
], function(Stickies, pubSub, BP) {
var models = [{
"lib/date",
"lib/local-jquery",
"lib/local-underscore",
"lib/local-backbone",
"appModel",
"lib/RFZ.pubsub",
"models/userModel",
"widgets/tools/iframeView",
"widgets/bpaccounts/iframe",
"widgets/bplib/bplib",
app.qa.core=> (run-test-command ["mobile-signup" "local-mobile-app" "web" "karl@readyforzero.com"])
INFO nREPL-worker-44 20140911 174719,922 app.qa.core ] Running tests: [:mobile-signup] from spec: mobile-signup
INFO nREPL-worker-44 20140911 174719,924 app.qa.core ] running tests [[:mobile-signup]]
INFO clojure-agent-send-off-pool-240 20140911 174719,925 app.qa.core ] STARTING: :mobile-signup {:browserName , :platformName Android, :platformVersion 4.4.2, :deviceName , :appium true, :app /Users/doncarlos/Development/RFZ-dev/mobile/phonegap/platforms/android/ant-build/ReadyForZero-debug.apk}
done w test (creating appium driver #clj_webdriver.remote.server.RemoteServer{:connection-params {:host localhost, :port 4723, :path-spec /wd/*, :existing true}, :webdriver-server nil} {:test mobile-signup, :browserName , :platformName Android, :platformVersion 4.4.2, :deviceName , :app /Users/doncarlos/Development/RFZ-dev/mobile/phonegap/platforms/android/ant-build/ReadyForZero-debug.apk}
slee
app.qa.core=> (run-test-command ["account-manual" "chrome" "web" "karl@readyforzero.com"])
INFO nREPL-worker-45 20140911 175831,673 app.qa.core ] Running tests: [:account-manual] from spec: account-manual
INFO nREPL-worker-45 20140911 175831,678 app.qa.core ] running tests [[:account-manual]]
INFO clojure-agent-send-off-pool-246 20140911 175831,684 app.qa.core ] STARTING: :account-manual {:browser :chrome, :platform :win7}
INFO clojure-agent-send-off-pool-246 20140911 175837,252 app.qa.internal.core ] INITIALIZING DRIVER WITH OPTIONS: {:test-id 40720cf33e2e47eda04171f9ee354233, :base-url https://stage.readyforzero.net/, :local false}
INFO clojure-agent-send-off-pool-246 20140911 175837,253 app.qa.commands ] Starting browser at https://stage.readyforzero.net/
INFO clojure-agent-send-off-pool-246 20140911 175846,058 app.qa.commands ] went to url https://stage.readyforzero.net/no-mobile
INFO clojure-agent-send-off-pool-246 20140911 175846,264 app.qa.commands ] Starting browser
/*
*
* Just a copy/pasted function
* to save base64 encoded data to a buffer
* http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript
*
*/
angular.module('eha.biometricregistration')
.factory('base64ToBuffer', function($window) {
return function b64toBlob(b64Data, contentType, sliceSize) {
@karlwestin
karlwestin / About.md
Created June 30, 2015 16:29
Porting the erlang checkpoint comparison to JS

Porting CouchDB checkPoints from erlang to javascript

This is an attempt to implement CouchDB checkpoint comparison for PouchDB, to be able to pick up interrupted replications even though checkpoint writing is in an unknown state. Mismatching checkpoints causes replication to start over from change 0

This gist is a request for comments from people familiar with both JS and Erlang, to see if they are functionally identical