Skip to content

Instantly share code, notes, and snippets.

View pmoelgaard's full-sized avatar

Peter Andreas Moelgaard pmoelgaard

View GitHub Profile
@pmoelgaard
pmoelgaard / index.html
Created June 8, 2012 01:28
preloader-directive
<html ng-app="application" preloader="splash">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Preloader Experiment</title>
<script src="http://code.angularjs.org/angular-1.0.0rc10.min.js"></script>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="preloader-0.0.1.js"></script>
@pmoelgaard
pmoelgaard / device-publisher.js
Created July 9, 2012 15:17
CommonJS Module Client for the Podio API
var Podio = require('./podio');
Podio.getAccessToken(function(accessToken) {
deviceInfoList.forEach( function( deviceInfo ) {
Podio.search( deviceInfo.properties[ 0 ].value, accessToken, function( searchResult ) {
console.log( searchResult );
});
@pmoelgaard
pmoelgaard / Display the current call stack
Created October 4, 2013 01:27
Display the current call stack
function Stack() { try { throw Error() } catch(ex) { return ex.stack } }
print( Stack() );
/*
PRINTS:
Error()@:0
Stack()@test.js:1
@test.js:3
/*
@pmoelgaard
pmoelgaard / 0_reuse_code.js
Created May 24, 2014 15:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/****************************************************************************
**
** Reference: https://bitbucket.org/gregschlom/qmlscrollbar/src/tip/ScrollBar.qml
**
****************************************************************************/
import QtQuick 1.1
Rectangle {
@pmoelgaard
pmoelgaard / boot.whoami.js
Last active October 26, 2015 17:45
Simple WhoAmI for Loopback
module.exports = function (server) {
var router = server.loopback.Router();
router.get('/whoami', function (req, res) {
var AccessToken = server.models.AccessToken;
AccessToken.findForRequest(req, {}, function (aux, accesstoken) {
if (accesstoken == undefined) {
res.status(401);
@pmoelgaard
pmoelgaard / designer.html
Last active August 29, 2015 14:18
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="bbb-songkran2015">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<App Theme="Basic">
<JavaScript File="fuse-resource/fuse-resource.js" ux:Global="fuseResource" />
<DockPanel>
<JavaScript>
var Observable = require("FuseJS/Observable");
@pmoelgaard
pmoelgaard / random.ts
Created October 26, 2015 18:34
Random MySQL Mixin for Loopback
/// <reference path='../../typings/tsd.d.ts' />
/// <reference path='../../local_modules/tsd.d.ts' />
import path = require('path');
import async = require('async');
import _ = require('lodash');
import IRemoteMethodCallbackFunction = loopback.IRemoteMethodCallbackFunction;
import IMySQLTableDefinition = loopback.IMySQLTableDefinition;
import IPersistenceModelItem = loopback.IPersistenceModelItem;
@pmoelgaard
pmoelgaard / hooks.ts
Created February 21, 2016 09:51
Hook Harvester - Early Version
/// <reference path='../../typings/tsd.d.ts' />
import path = require('path');
import async = require('async');
function ModuleDef(server:any, next:Function):void {
var glob:any = require("glob");
glob('local_modules/**/hooks/**/*.js', function (err:Error, hooks:Array<string>):void {