Skip to content

Instantly share code, notes, and snippets.

View frozeman's full-sized avatar

Fabian Vogelsteller frozeman

View GitHub Profile
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 January 1, 2016 21:58
jQuery testing stubs. Where the stub can be overwritten e.g. by setting jQueryStub.prototype.find = ...;
var $, jQueryStub;
(function () {
"use strict";
var emptyFunction = function () {
};
var selfReturn = function(){
return new jQueryStub();
};
@frozeman
frozeman / gist:88a3e47679dd74242cab
Last active August 29, 2015 14:01
Meteor minimongo: Insert and Remove in bulk using an array
/*
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 August 29, 2015 14:04
Get the order sum in cryptsy.com
// 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');
Verifying myself: My Bitcoin username is +frozeman. https://onename.io/frozeman
@frozeman
frozeman / bitcoin-divisions
Last active August 29, 2015 14:08
Bitcoin divisions
0 . 0 0 0 0 0 0 0 0
^ ^ ^ ^
BTC mBTC? bits Satoshi
@frozeman
frozeman / gist:b3f016de58b04c99cfc3
Created November 11, 2014 20:27
Steps in phantomjs
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadStarted = function() {
loadInProgress = true;
console.log("load started");
};
# 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 January 21, 2015 08:44
List of all Meteor-platform packages
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 March 21, 2017 23:07
TAPi18n set default language
// 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);