Skip to content

Instantly share code, notes, and snippets.

View der-On's full-sized avatar

der_On der-On

View GitHub Profile
@der-On
der-On / rivets_formatters.js
Created December 19, 2014 16:08
Rivets.js general purpose formatters
rivets.formatters['!'] = function(value)
{
return !value;
};
rivets.formatters.eq = function(value, args)
{
return value === args;
};
rivets.formatters.neq = function(value, args)
{
@der-On
der-On / run_cron.php
Last active August 22, 2016 08:34
Syncs all files for contao metamodels openimmo
<?php
// initialize the contao framework
define('TL_MODE', 'FE');
require('../system/initialize.php');
$cron = new \MetaModelsOpenImmo\Cron();
$cron->run();
@der-On
der-On / metalsmith_express_dynamic_page.js
Created January 29, 2016 21:58
Express middleware to create a dynamic HTML page using metalsmith.
'use strict';
var metalsmith = require('metalsmith');
var layouts = require('metalsmith-layouts');
var fs = require('fs');
var lorem = fs.readFileSync('./lorem.txt', 'utf8');
var n = 0;
// generates a single page
@der-On
der-On / application.js
Last active January 3, 2016 07:18
RESTfull controllers in geddy.js
/*
* Geddy JavaScript Web development framework
* Copyright 2112 Matthew Eernisse (mde@fleegix.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@der-On
der-On / testing.js
Last active December 27, 2015 17:29
possible geddy controller stubing
var EventEmitter = require('events').EventEmitter;
var util = require('utilities');
var MockRequest = function () {
this.headers = {
accept: '*/*'
}
};
module.exports.MockRequest = MockRequest;
@der-On
der-On / application.js
Last active December 26, 2015 05:49
execute this method in a geddy controller needing cross-domain CORS
var Application = function () {
// allow cross domain XHR
this.allowCORS = function()
{
this.options = function(req, resp, params)
{
if (req.method.toLowerCase() == 'options') {
resp.setHeaders(200,{
'Content-Type': 'text/plain',
'Access-Control-Allow-Origin': '*',
@der-On
der-On / DateUtil.php
Created June 28, 2013 12:48
DateUtil
<?php
class DateUtil
{
public static $weekday_names = array(
1 => 'Montag',
2 => 'Dienstag',
3 => 'Mittwoch',
4 => 'Donnerstag',
5 => 'Freitag',
@der-On
der-On / uploader.js
Created May 14, 2013 22:48
node.js uploader based on "formidable"
var formidable = require('formidable');
var path = require('path');
var fs = require('fs');
var UploaderException = function(message)
{
this.message = message;
this.toString = function()
{
return 'Uploader error: '+this.message;
@der-On
der-On / gist:5480130
Last active December 16, 2015 18:49
XPlane2Blender 3.20 manipulator type fix
'''
This script fixes manipulator types in blends that have been created with older versions of XPlane2Blender.
Usage: Select the objects with wrongly assigned manipulator types and then run this script in Blender's text-editor.
'''
import bpy
for object in bpy.context.selected_objects:
if object.xplane.manip.enabled:
if object.xplane.manip.type == 'delta':
@der-On
der-On / improve_model_assocs.js
Created June 20, 2015 07:20
Improve model associations with loader methods and promises
/**
* Adds a loader method to the model innstance that will automatically populate the property for the assoc after load
* Example: this.belongsTo('User') will add a "loadUser" method
* @param instance
*/
module.exports.improveAssocs = function(instance)
{
var model = getModel();
var type = instance.type;
var def = model.descriptionRegistry[type];