Skip to content

Instantly share code, notes, and snippets.

View dapetcu21's full-sized avatar

Marius Petcu dapetcu21

View GitHub Profile
@dapetcu21
dapetcu21 / style-guide.md
Created April 27, 2018 14:28
Interrogation Style Guide

Lua style guide

Linting

This project makes use of [Luacheck] for catching common mistakes. Install it and configure it for your text editor.

Editor configuration

We recommend [Atom] for editing Lua code along with the following packages:

  • [linter-luacheck]: [Luacheck] integration
@dapetcu21
dapetcu21 / staff.ino
Created April 5, 2020 22:20
RGB magical staff, with hue selector
// ATTiny 85
#define LED_B 0 // DIP 5
#define LED_G 1 // DIP 6
#define LED_R 4 // DIP 3
#define BUTTON 3 // DIP 2
// ATMega 1284p
//#define LED_R 6
//#define LED_G 13
//#define LED_B 15
@dapetcu21
dapetcu21 / synth.py
Created March 14, 2018 19:47
Raspberry Piano synth
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import subprocess
from os import path
from os import listdir
import sys
import threading
@dapetcu21
dapetcu21 / hs_err_pid30047.log
Created January 2, 2017 09:22
Defold Crash
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000134de8132, pid=30047, tid=0x0000000000000307
#
# JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C 0x0000000134de8132
#
@dapetcu21
dapetcu21 / lfa-modularization.md
Last active August 29, 2015 14:23
LFA Modularization

#LFA Modularization

Impact

###CSS

  • We'll have to separate Stylus execution contexts even further, taking it from a vendor/user unified model to a per-module model. This will certainly be much cleaner and faster, but it will have the downside of the userland not being able to override Stylus variables from the core or from lfa-classroom and vice-versa. We weren't doing this too much anyway and were overriding CSS rules instead, so I guess this is fine. This translates to the disappearance of config.styl.
  • This new level of separation can open the path to very easy support for other CSS precompilers (SASS, LESS, etc.)

###JS

  • No more require('lfa-classroom/view/NameView'). Modules will have to explicitly export functionality. require('lfa-classroom').NameView Again, this might actually be a tad cleaner.
@dapetcu21
dapetcu21 / bp_training.md
Last active August 29, 2015 14:17
British Parliamentary Training

British Parliamentary

Position nuances

OG OO CG CO
Strategy Good setup. Preemptive rebuttal Fine line between rebuttal and constructive Clear cut. Destroy OO Destroy everything
Extension Carpet-bombing Carpet-bombing Most important point, but deeply developed Interweaved with counterarg
POI Strategy Bring attention to your case OG: Destroy. CG: Bring attention to case Don't reveal your extension. OO: Draw blood. CO: Clash strongly Hook
var child_process = require('child_process');
var fs = require('fs');
var JSONStream = require('JSONStream');
var Thread = {};
// Run this to fork a child process that quits when the parent quits
Thread.fork = function fork(moduleName, opts) {
opts = opts || {};
opts.silent = opts.silent || false;
@dapetcu21
dapetcu21 / convert.js
Last active August 29, 2015 14:13
LFA 0.5 -> 0.6 format conversion tool
#!/usr/bin/env node
var path = require('path');
var yaml = require('js-yaml');
var fs = require('fs');
var filewalker = require('filewalker');
var nodefn = require('when/node');
var _ = require('lodash');
var project = path.resolve(process.argv[2] || '.');

Build Status

Orchestrator-like task management with event stream integration.

Gulp advocates the philosophy that disk I/O should be kept to the minimum: the initial read and the final write. To this end, it popularized event streams and the stream piping pattern.

Unfortunately, orchestrator is blatantly stream-unaware. A .pipe() chain can only be contained to one orchestrator task and in most complex gulpfiles, you end up with either huge or function-fragmented tasks, either tasks that write temporary files (or to global variables).

Affluent tries to solve this issue by treating tasks as streams. Tasks can be run in sequence with access to the previous tasks' output and merged. Also, tasks don't have to wait for their dependencies to finish their whole .pipe() chain, as they can add themselves

@dapetcu21
dapetcu21 / routes.geojson
Last active August 29, 2015 14:05
Routes for Delta
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.