Skip to content

Instantly share code, notes, and snippets.

Ondrej Brinkel der-On

Block or report user

Report or block der-On

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@der-On
der-On / run_cron.php
Last active Aug 22, 2016
Syncs all files for contao metamodels openimmo
View run_cron.php
<?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 Jan 29, 2016
Express middleware to create a dynamic HTML page using metalsmith.
View metalsmith_express_dynamic_page.js
'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 / improve_model_assocs.js
Created Jun 20, 2015
Improve model associations with loader methods and promises
View improve_model_assocs.js
/**
* 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];
@der-On
der-On / promisify_models.js
Last active Aug 29, 2015
promisify geddy models
View promisify_models.js
"use strict";
/*
Usage:
require('./promisify_models')(geddy.model);
geddy.model.allPromise()
.then(function(result) { ... })
.catch(function(err) { throw err; });
@der-On
der-On / formatters.js
Last active Aug 29, 2015
Chainable formatters
View formatters.js
"use strict";
/*
Chainable formatters
Usage:
function trim(value) {
return value.trim();
}
@der-On
der-On / db.js
Last active Aug 29, 2015
Geddy unit testing mocks and helpers
View db.js
"use strict";
var exec = require('child_process').exec;
var sqlAdapters = ['mysql', 'sqlite', 'postgres'];
var utils = require('utilities');
function noop() {}
function getAdapter()
{
@der-On
der-On / rivets_formatters.js
Created Dec 19, 2014
Rivets.js general purpose formatters
View rivets_formatters.js
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 / fn_prototype.js
Last active Aug 29, 2015
JS prototype with immediatly called function
View fn_prototype.js
// define constructor
function User() {
}
// define prototype using "this"
User.prototype = new (function() {
this.name = 'new User';
var pass = 'secret'
@der-On
der-On / xp2b_3-20-6_manip_type_fix.py
Created May 3, 2014
XPlane2Blender 3.20.6 to 3.20.7 manipulator type fix
View xp2b_3-20-6_manip_type_fix.py
'''
This script fixes manipulator types in blends that have been created with XPlane2Blender <= 3.20.6.
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 == 'command':
@der-On
der-On / application.js
Last active Jan 3, 2016
RESTfull controllers in geddy.js
View application.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
*
You can’t perform that action at this time.