Skip to content

Instantly share code, notes, and snippets.

View jonasjohansson's full-sized avatar

Jonas Johansson jonasjohansson

View GitHub Profile
@jonasjohansson
jonasjohansson / glitch-https.js
Created September 8, 2020 05:39
Glitch HTTPS redirect
if (location.protocol != 'https:') {
location.href = 'https:' + window.location.href.substring(window.location.protocol.length)
}
(function(bitsy) {
"use strict";
bitsy = bitsy && bitsy.hasOwnProperty("default") ? bitsy["default"] : bitsy;
function inject(searchRegex, replaceString) {
// find the relevant script tag
var scriptTags = document.getElementsByTagName("script");
var scriptTag;
var code;
@jonasjohansson
jonasjohansson / normalize-igem.html
Last active December 7, 2019 14:30
normalize-igem
<html>
<script>
document.addEventListener("DOMContentLoaded", event => {
document.body.removeAttribute("class");
var elementsRemove = document.querySelectorAll("a#top, div#top_title");
for (var el of elementsRemove) {
el.parentNode.removeChild(el);
}
for (var id of [
"globalWrapper",
const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const robot = require('robotjs');
const parser = new Readline();
SerialPort.list(function(err, ports) {
var arduinos = ports.filter(isArduino);
if (arduinos.length !== 0) {
connect(
* {
padding: 0;
margin: 0;
border: 0;
background: none;
}
html {
font-size: 62.5%;
font-family: system-ui, -apple-system, sans-serif;
const lat = '56.937783';
const lon = '12.384565899999984';
const url = `https://api.met.no/weatherapi/locationforecastlts/1.3/?lat=${lat}&lon=${lon}`;
fetch(url)
.then(response => {
console.log('response', response);
console.log('response.status:', response.status);
console.log('response.statusText:', response.statusText);
console.log('response.ok:', response.ok);
var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight;
const createCam = (debug = false) => {
let arr = [];
for (let i = 0; i < 6; i++){
let camera = new THREE.PerspectiveCamera( 45, SCREEN_WIDTH / SCREEN_HEIGHT, 100, 2000000 );
arr.push( camera );
if (debug){
camera.updateProjectionMatrix();
var helper = new THREE.CameraHelper( camera );
-- Version 0.6
-- New In 0.5
-- Delay time is now in milliseconds
-- Unused vars deleted
-- New in 0.6
-- Saves artwork as comment
-- Original here: https://github.com/alexjohnj/spotijack/
set delay_time to 0.1
var els = document.querySelectorAll('.views-row');
var newEls = [];
for (const el of els){
let productName = el.querySelector('.prd-name').innerHTML;
let normalPrice = el.querySelector('span[data-normal-price]').getAttribute('data-normal-price');
let currentPrice = el.querySelector('span[data-cur-price]').getAttribute('data-cur-price');
newEls.push({
el: el,
item: productName,
normalPrice: normalPrice,
#include <Adafruit_NeoPixel.h>
#define DELAY 2000
#define NUM_FLASHES 30
bool strobing = false;
bool debug = true;
int pirState = LOW;
int powerPin = 6;