Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabian Vogelsteller frozeman

View GitHub Profile
View OfflineCollections.js
DB = {};
DB.movies = new Meteor.Collection('movies');
DB.ratings = new Meteor.Collection('ratings');
/*
* OfflineCollections, works as wrapper to easily clean your local collections
*/
OfflineCollections = (function(){
// PRIVATE
@frozeman
frozeman / gist:8206698
Last active Jan 1, 2016
jQuery testing stubs. Where the stub can be overwritten e.g. by setting jQueryStub.prototype.find = ...;
View gist:8206698
var $, jQueryStub;
(function () {
"use strict";
var emptyFunction = function () {
};
var selfReturn = function(){
return new jQueryStub();
};
@frozeman
frozeman / gist:88a3e47679dd74242cab
Last active Aug 29, 2015
Meteor minimongo: Insert and Remove in bulk using an array
View gist:88a3e47679dd74242cab
/*
These two functions provide a simple extra minimongo functionality to add and remove documents in bulk,
without unnecessary re-renders.
The process is simple. It will add the documents to the collections "_map" and only the last item will be inserted properly
to cause reactive dependencies to re-run.
*/
Models = {};
@frozeman
frozeman / CryptsyOrderSum
Last active Aug 29, 2015
Get the order sum in cryptsy.com
View CryptsyOrderSum
// in the console, to get the BUY/SELL order sum type:
var until = 9999; // until order
var sum = 0; $('#sellorderlist tr:lt('+until+')').each(function(){ sum += Number($(this).find('td:eq(2)').text())}); console.log('SEll: '+sum+' BTC by '+$('#sellorderlist tr').length+' orders');
var sum = 0; $('#buyorderlist tr:lt('+until+')').each(function(){ sum += Number($(this).find('td:eq(2)').text())}); console.log('BUY: '+sum+' BTC by '+$('#buyorderlist tr').length+' orders');
View gist:8b5a47033fd805e9f6bf
Verifying myself: My Bitcoin username is +frozeman. https://onename.io/frozeman
@frozeman
frozeman / bitcoin-divisions
Last active Aug 29, 2015
Bitcoin divisions
View bitcoin-divisions
0 . 0 0 0 0 0 0 0 0
^ ^ ^ ^
BTC mBTC? bits Satoshi
View gist:b3f016de58b04c99cfc3
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadStarted = function() {
loadInProgress = true;
console.log("load started");
};
View meteor.cheatsheet.coffee
# METEOR CORE:
Anywhere: Meteor.isClient
Anywhere: Meteor.isServer
Anywhere: Meteor.startup(func)
Anywhere: Meteor.absoluteUrl([path], [options])
Anywhere: Meteor.settings
Anywhere: Meteor.release
@frozeman
frozeman / gist:c6196adb840102ee0dfd
Created Jan 21, 2015
List of all Meteor-platform packages
View gist:c6196adb840102ee0dfd
application-configuration removed from your project
autoupdate removed from your project
base64 removed from your project
binary-heap removed from your project
blaze removed from your project
blaze-tools removed from your project
boilerplate-generator removed from your project
callback-hook removed from your project
check removed from your project
ddp removed from your project
@frozeman
frozeman / tapi18n-default-lanuage.js
Last active Mar 21, 2017
TAPi18n set default language
View tapi18n-default-lanuage.js
// SET default language
if(Cookie.get('TAPi18next')) {
TAPi18n.setLanguage(Cookie.get('TAPi18next'));
} else {
var userLang = navigator.language || navigator.userLanguage,
availLang = TAPi18n.getLanguages();
// set default language
if (_.isObject(availLang) && availLang[userLang]) {
TAPi18n.setLanguage(userLang);
You can’t perform that action at this time.