Skip to content

Instantly share code, notes, and snippets.

View padcom's full-sized avatar

Matthias Hryniszak padcom

View GitHub Profile
@padcom
padcom / insanity.js
Created July 6, 2018 16:33
Insane code in a polyfill
/*
Details Element Polyfill 1.1.0
Copyright © 2017 Javan Makhmali
*/
(function() {}).call(this),
function() {
if (document.querySelector('body').getAttribute('class').indexOf('on-page-editor') > -1) {
return;
}
@padcom
padcom / index.html
Last active June 20, 2018 00:54
Vue implementation of defocuser (as a directive)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Dropdowns</title>
<script type="text/javascript" src="http://unpkg.com/vue"></script>
<style>
.label {
@padcom
padcom / Example.vue
Last active April 6, 2018 21:22
Vue.js animation example for modal overlay
<template>
<div>
<button @click="show = !show">Toggle</button>
<transition name="slide">
<div class="fs" v-if="show">
<button @click.stop="show = false">Close me</button>
<div v-html="popupContent" />
</div>
</transition>
<div v-html="content" />
@padcom
padcom / dump.txt
Created December 10, 2017 19:46
NAV 1.8.0 F4 OMNIBUS-PRO Setup
# version
# INAV/OMNIBUSF4PRO 1.8.0 Nov 1 2017 / 06:34:32 (912d1315)
# resources
# mixer
mixer FLYING_WING
mmix reset
@padcom
padcom / dump.txt
Created December 10, 2017 17:46
iNAV 1.8.0 F3 OMNIBUS Setup
Entering CLI Mode, type 'exit' to return, or 'help'
# dump
# version
# INAV/OMNIBUS 1.8.0 Nov 1 2017 / 06:14:28 (912d1315)
# resources
@padcom
padcom / index.js
Created November 6, 2017 22:58
VueJS 2 component for dynamically compiling template passed on in props
import Vue from 'vue'
import { compileToFunctions } from 'vue-template-compiler'
// Here we define a DynamicContent component that will serve as wrapper
// for the body that will actually be "dynamic"
const DynamicContent = Vue.extend({
template: '<DynamicContentBody :template="template" :data="data" />',
// There are 2 required properties for this component to work
props: {
@padcom
padcom / rfrecv.lua
Created October 14, 2017 11:30
NodeMCU RF receiver and decoder
local BUFFER_SIZE = 512
local timings = { }
local write = 0
local read = 0
local max = 0
local function count(pos)
if pos == read then
return 0
elseif pos > read then
@padcom
padcom / Chart.cs
Created October 11, 2017 17:19
C#.NET - drawing a spider chart
public class Chart {
private readonly Brush b = new SolidBrush(Color.FromArgb(200, 255, 0, 255));
private readonly Pen p1 = new Pen(Color.Black, 2);
private readonly Pen p2 = new Pen(Color.Black, 1);
private readonly Pen p3 = new Pen(Color.Red, 2);
public Bitmap Draw(Point center, int radius, int max, decimal[] v) {
var width = center.X * 2;
var height = center.Y * 2;
var chart = new Bitmap(width, height);
@padcom
padcom / type-a-codes.gsh
Created March 11, 2017 18:12
Display all codes of type A
#!/usr/bin/env groovy
noru2bit = [ '0': '00', '1': '11', 'F': '01', 'X': '10' ]
def getCodeWord(String group, String device, Boolean status) {
char[] result = new char[12];
int idx = 0
for (int i = 0; i < 5; i++) {
result[idx++] = (group[i] == '0') ? 'F' : '0'
@padcom
padcom / init.lua
Created March 4, 2017 21:41
Minimalist NodeMCU application that sends GEFL logs to Graylog2
mqtt_connected = false
source = 'NodeMCU' .. node.chipid()
data = {
version = '1.1',
source = source,
short_message = 'Sensor data (temperature and pressure)',
_temperature = 0,
_pressure = 0
}