Skip to content

Instantly share code, notes, and snippets.

View elutz's full-sized avatar

Lutz Epperlein elutz

  • ]init[ AG
  • Berlin, Germany
View GitHub Profile
@elutz
elutz / controller.js
Created November 27, 2012 08:56
File Upload with AngularJS & File-Upload jQuery Plugin
function AttachmentCtrl($scope, $location, $timeout, Docs) {
$(function() {
$('#detail-form-doc').fileupload({
dataType: 'json',
url: '/angular-ib/app/fileupload?id=' + $location.search().id,
add: function(e, data) {
$scope.$apply(function(scope) {
// Turn the FileList object into an Array
for (var i = 0; i < data.files.length; i++) {
$scope.project.files.push(data.files[i]);
@elutz
elutz / csv2coll.4dm
Last active August 26, 2020 14:37
4D: Converts CSV data to collection based on https://gist.github.com/bennadel/9753411
// ----------------------------------------------------
// Method: csv2coll
// Description
// Converts CSV data to collection
// Source: https://gist.githubusercontent.com/bennadel/9753411/raw/a8e6f25f15fc78d1ef2d187e4f4864c4b528f885/code-1.htm
// This will parse a delimited string into a collection of
// collections. The default delimiter is the semicolon, but this
// can be overriden in the second argument.
// Parameters
// ----------------------------------------------------
@elutz
elutz / 4D.xml
Created November 18, 2020 17:08
4D file type .4dm in JetBrains IDE
<filetype binary="false" description="4D *.4dm files" name="4D">
<highlighting>
<options>
<option name="LINE_COMMENT" value="//" />
<option name="COMMENT_START" value="/*" />
<option name="COMMENT_END" value="*/" />
<option name="HEX_PREFIX" value="0x" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
@elutz
elutz / Allg_XML_ParseElement.4dm
Last active December 17, 2021 14:33
4D: XML to Object, main method is "Allg_XML_toObject"
// Method: Allg_XML_ParseElement
// Parameters:
// Description
// Parsen eines XML-Elements
// wird rekursiv aufgerufen
// siehe auch Allg_XML_toObject
C_TEXT($1; $xmlRef) // XML-Referenz auf den Wurzelknoten
C_OBJECT($2; $obj) // Return, Object wenn Element, enthält alle Elemente des Wurzelknotens, nicht den Wurzelknoten selbst
C_TEXT($0; $retText) // Return: text, wenn Textknoten
@elutz
elutz / heating.yaml
Created March 5, 2023 11:59
Home assistant: Set heating temperature to a configurable value for a certain amount of time
blueprint:
name: Heat for certain time
description: Turn on heating for a given amount of time. https://community.home-assistant.io/t/set-heating-temperature-to-a-configurable-value-for-a-certain-amount-of-time/255742
domain: automation
input:
datetime:
name: Turn-on-time
description: A datetime input that defines the time at which the heating is turned on.
selector:
entity: