Skip to content

Instantly share code, notes, and snippets.

View raix's full-sized avatar
🚀
Starting up my own thing - focus time

Morten N.O. Nørgaard Henriksen raix

🚀
Starting up my own thing - focus time
View GitHub Profile
@raix
raix / meteor.extractProfile.model.js
Last active December 10, 2015 09:08
Meteor.users generalized function extractProfile - Returns a basic user information object
//@Param userObjId - expects either user object or id
//
//Returns a basic user information object:
// ._id - the Meteor.users id
// .id - service id
// .accessToken - service access token
// .serviceName - name of service eg. facebook, google etc.
// .email - user email, not to be expected from twitter service
// .username - profile username
// .twitterUsername - twitters @username
@raix
raix / apply.client.js
Last active December 10, 2015 20:18
Debug file transport
var timerTotal = self.startTimer();
var timerMeteorCall = self.startTimer();
Meteor.apply('saveChunck'+fileItem.collectionName, [
fileId = fileId,
currentChunk = chunkNumber,
countChunks = fileItem.countChunks,
data = data
],[
wait = true
@raix
raix / sessionExample.html
Last active December 13, 2015 19:19
Meteor nested session stuff
<head>
<title>sessionExample</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
@raix
raix / controllers-demo.html
Last active December 15, 2015 05:09
Controllers proto
<head>
<title>controllers-demo</title>
</head>
<body>
<div class="container">
{{> body}}
</div>
</body>
@raix
raix / getNode.js
Created April 12, 2013 23:08
getNode('console.log')('Write this to the log...') Run a command from string - no eval used for this
getNode = function(string) {
var splitString = string.split('.');
var nodeThis = window;
// Divein nodeThis
if (splitString.length)
for (var i = 0; i < splitString.length-1; i++)
if (nodeThis)
nodeThis = nodeThis[splitString[i]];
@raix
raix / debugRendered.js
Created May 17, 2013 13:10
Debuggin template rendering in Meteor. I had a template problem when creating a spreatsheet like app - optimizing usage of templates and dependenies is important when going mobile. I created this snippet of code to repport in on Template rendering.
var renderList = [];
var timer = 0;
var timeToLog = 100;
function debugRendered(templateName) {
// init renderList
renderList[templateName] = 0;
@raix
raix / syntaxTreeAfter
Last active December 20, 2015 00:09
Syntax tree Meteor.isClient = false
// code = 'server';
{
"type": "Program",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
@raix
raix / app.manifest
Last active December 20, 2015 13:59
Meteor and phonegap thoughts
CACHE MANIFEST
# cafd1417c9861bbd29cd844d8f380b340c70d316
CACHE:
/
http://grounddb.meteor.com/dbcdebadd4b96a6b5fd50c4cec204ed1f73a3398.js
http://grounddb.meteor.com/aa67ef88b25b2dba7b045b5f9307fc2f16573731.css
http://grounddb.meteor.com/green.png?cac3cc0143b7e79be4ce2682288ad2ec69882407
http://grounddb.meteor.com/red.png?d9d4f943b535801166a198aec7e28799475dc1e6
@raix
raix / argumentparser.js
Last active December 27, 2015 18:59
An idea for parsing arguments in Meteor.js With this code declaring interfaces and validating input just got a bit easier..
typeNames = function(type) {
if (Match.test(type, [Match.Any])) return 'array';
if (type === Object) return 'object';
if (type === String) return 'string';
if (type === Number) return 'number';
if (type === Boolean) return 'boolean';
if (type === Function) return 'function';
return typeof type;
};
@raix
raix / image-uploader.html
Last active October 13, 2023 00:08
cfs image uploader example
<template name="imageUploader">
<h2>Picture</h2>
<p>
{{#each images}}
<img src="{{url}}" alt="">
<input type="button" value="remove" class="btnRemove"/>
{{else}}
No files uploaded.
{{/each}}
</p>