Skip to content

Instantly share code, notes, and snippets.

View lean8086's full-sized avatar

Leandro Linares lean8086

View GitHub Profile
<article itemscope itemtype="https://schema.org/Product">
<meta itemprop="brand" content="Bose"/>
<meta itemprop="color" content="Black"/>
<h3 itemprop="name">Bose QuietComfort 35 II</h3>
<p itemprop="offer">$217.99</p>
<a href="...">See all options</a>
<img itemprop="image" src="..." alt="...">
</article>
#include "MIDIUSB.h"
const byte TOTAL_BUTTONS = 16;
const byte BUTTONS_PIN[TOTAL_BUTTONS] = {2,3,4,5,6,7,8,9,10,11,12,A0,A1,A2,A3,A4};
const byte BUTTONS_PITCH[TOTAL_BUTTONS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
byte channel = 0; // 16 channels (0-15) Reported to the user as 1-16
void setup() {
for (byte i = 0; i < TOTAL_BUTTONS; i++) {
pinMode(BUTTONS_PIN[i], INPUT_PULLUP);
// Before
<div class="card">
<div class="message">
<p class="warning-text">...</p>
</div>
</div>
// After
<div class="card">
<p class="message warning-text">...</p>
<style>
.card {
background-color: var(--card-color);
}
</style>
<ul>
<li class="card" style="--card-color: red;"></li>
<li class="card" style="--card-color: blue;"></li>
</ul>
#include "MIDIUSB.h"
const int BUTTON_PIN = 2;
// Note "C2"! See https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h
const int BUTTON_PITCH = 36;
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
#include "MIDIUSB.h"
const byte TOTAL_BUTTONS = 16;
// All the Arduino pins used for buttons, in order.
const byte BUTTONS_PIN[TOTAL_BUTTONS] = {2,3,4,5,6,7,8,9,10,11,12,A0,A1,A2,A3,A4};
// Every pitch corresponding to every Arduino pin. Each note has an associated numeric pitch (frequency scale).
// See https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h
const byte BUTTONS_PITCH[TOTAL_BUTTONS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
// Current state of the pressed buttons.
byte currentRead[TOTAL_BUTTONS];
@lean8086
lean8086 / navigation-menu.js
Last active August 29, 2015 13:57
Improve the #navigation-menu behavior
(function (doc) {
var input = doc.getElementById('ml-header-user');
// Only works when a user menu exists (for logged users)
if (!input) return;
// Listen for every click on <html>
// The support for IE8+ was dropped because of lack of support of :checked pseudo-selector
doc.documentElement.addEventListener('click', function (ev) {
// Avoid to close if I click on the trigger. In that case, it will use CSS
if (input.checked && ev.target !== input && ev.target !== input.previousElementSibling) input.checked = false;
});