Skip to content

Instantly share code, notes, and snippets.

@waako
waako / rowspan.js
Created February 24, 2023 16:03 — forked from erd0s/rowspan.js
Turn an HTML table with rowspans into a csv with rowspan data duplicated
View rowspan.js
var rows = document.querySelectorAll("table div table > tbody tr");
var records = [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cells = row.querySelectorAll("td");
cells.forEach((o, j) => {
// Put in the forward rows data
if (o.rowSpan > 1) {
@waako
waako / thermostat.yaml
Last active February 7, 2023 10:25 — forked from Cadair/thermostat.yaml
esphome configuration for my Open Energy Monitor thermostat
View thermostat.yaml
# This is an esphome configuration file for the OpenEnergyMonitor Thermostat
# The primary objectives of this configuration file are:
# 1) The temperature used as the sensor for the thermostat should be read from
# homeassistant, this lets you use an average or change the room the
# temperature is based on depending on the time of day etc.
# 2) If homeassisant goes offline the thermostat keeps working.
# To this end there is a sensor "average_temperature" which is recieved from hass
# and a second sensor "combined_temperature" which decides based on if a device
# is connected to the native API or not to use this sensor or the local sensor
# attached to the thermostat.
@waako
waako / babel.config.js
Last active October 20, 2020 09:29 — forked from zkat/index.js
npx is cool
View babel.config.js
{ "comments": false, "minified": true, "plugins": [ "minify-mangle-names", "transform-merge-sibling-variables", "transform-minify-booleans", "transform-remove-console" ], "presets": [ [ "@babel/preset-env", { "targets": { "ie": "11" } } ] ] }
@waako
waako / _instructions.md
Last active April 6, 2020 14:01
Copy trello card title, url, attachments & checklists for pasting into CSV
View _instructions.md
@waako
waako / _info.md
Last active April 6, 2020 14:14 — forked from niallsmart/copy-checklist.js
Copy Card title, url, attachments and checklists to clipboard
View _info.md
@waako
waako / .stylelintrc.json
Last active March 7, 2019 09:06
Attempt at converting Drupal's CSSComb order to stylelint-order (not tested) - achieved with parsing .csscomb with jq then grouping manually.
View .stylelintrc.json
{
"extends": [
"stylelint-config-standard",
],
"plugins": [
"stylelint-order"
],
"rules": {
"order/properties-order": [
{
@waako
waako / pre-commit
Created March 6, 2019 14:28 — forked from KeyboardCowboy/pre-commit
Check for Drupal Debugging Statements Before Committing Code
View pre-commit
#!/bin/bash
#
# Check for debugging statements before commiting your code.
# Place this file in the .git/hooks directory of your project.
# List of function names to search for in regex format
FUNCTIONS='dpm|kpr|qpr|kint|dd|console\.log'
# If any functions are found as executable, prevent the commit.
DIEONFAIL=true
@waako
waako / domain-from-url.twig
Created April 18, 2018 09:43 — forked from olets/domain-from-url.twig
get the domain from a url (twig)
View domain-from-url.twig
{% set no_protocol = url|split('//')[1] ?: url %}
{% set only_domains = no_protocol|split('/')[0] ?: no_protocol %}
{% set url_domain = '' %}
{% if only_domains|split('.')[2] %}
{% set url_domain = only_domains|split('.')[1] %}
{% else %}
{% set url_domain = only_domains|split('.')[0] %}
{% endif %}
@waako
waako / gulpfile.js
Created June 15, 2017 03:46
Gulp workflow for optimising and compressing static site html and assets.
View gulpfile.js
/* Load plugins */
var gulp = require('gulp'),
watch = require('gulp-watch'),
notify = require('gulp-notify'),
uncss = require('gulp-uncss'),
zopfli = require("gulp-zopfli"),
connect = require('gulp-connect'),
htmlmin = require('gulp-htmlmin'),
inlinesource = require('gulp-inline-source'),
imagemin = require('gulp-imagemin'),
@waako
waako / gulpfile.js
Created February 20, 2017 18:42
Build Script for SideCarMT.com
View gulpfile.js
var gulp = require('gulp');
var fs = require('fs');
var del = require('del');
var htmlreplace = require('gulp-html-replace');
var uglify = require('gulp-uglify');
var minifyHTML = require('gulp-minify-html');
var minifyCSS = require('gulp-minify-css');
var rename = require("gulp-rename");
var bowerSrc = require('gulp-bower-src');
var gulpFilter = require('gulp-filter');