Skip to content

Instantly share code, notes, and snippets.

View goesbysteve's full-sized avatar

Steve Jordan goesbysteve

  • SANS Institute
  • Sevenoaks, uk
View GitHub Profile
@CarloCattano
CarloCattano / pi_MIDI_Brain.md
Last active April 17, 2024 00:00
Raspberry pi UART MIDI Serial

rp3.+ raspberry OS lite (or better PatchboxOS as a starting point)

https://blokas.io/patchbox-os/

testing notes
Disable bluetooth or send bt to another serial port
    sudo nano /boot/config.txt

    enable_uart=1    
   
 dtoverlay=midi-uart0
@mattheu
mattheu / templating.md
Created March 14, 2016 14:42
Templating

Using handlebars in WordPress.

One approach we have taken is to mix handlebars templates into the standard WordPress theme templates.

We have a template function available in WordPress render_hbs_template which will render a handlebars template using the data provided. Under the hood render_hbs_template uses this PHP class https://github.com/zordius/lightncandy

The render function handles some logic around caching the compiled templates to improve performance using these.

Here is an example single.php template of how this might be used to render an article.

@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@carlosefr
carlosefr / RPi2c.ino
Last active December 4, 2020 18:18
Raspberry Pi to Arduino communication using I2C and interrupts.
/*
* RPi2c - test i2c communication between an Arduino and a Raspberry Pi.
*
* Copyright (c) 2013 Carlos Rodrigues <cefrodrigues@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@WebReflection
WebReflection / Object.setPrototypeOf.js
Last active February 24, 2018 04:13
Object.setPrototypeOf(O, proto) full/complete polyfill with boolean flag for partial implementation.
/*jslint devel: true, indent: 2 */
// 15.2.3.2
if (!Object.setPrototypeOf) {
Object.setPrototypeOf = (function(Object, magic) {
'use strict';
var set;
function checkArgs(O, proto) {
if (typeof O !== 'object' || O === null) {
throw new TypeError('can not set prototype on a non-object');
}