Skip to content

Instantly share code, notes, and snippets.

Avatar
🏳️‍🌈
so tired...

Ada Rose Cannon AdaRoseCannon

🏳️‍🌈
so tired...
View GitHub Profile
View DomQuery.js
// This is just the worst don't use it.
function $(...s) {
if (s.length === 0) return document.childNodes;
// Handle it being used as a template tag
const inString = (typeof s[0] === 'string' ? s[0] : String.raw(...s)).trim();
if (inString[0].includes('<')) {
return document.createRange().createContextualFragment(inString);
} else {
@AdaRoseCannon
AdaRoseCannon / Simple Sky Shader
Created Jan 21, 2020
There is probably an easier way to create a gradient skybox but I am lazy.
View Simple Sky Shader
const skygeometry = new SphereGeometry( 25, 50, 50 , 0, 2 * Math.PI);
const skymaterial = new MeshBasicMaterial();
skymaterial.side = BackSide;
skymaterial.onBeforeCompile = function (shader) {
shader.vertexShader = shader.vertexShader.replace('#include <common>', '#include <common>\n#define USE_UV');
shader.fragmentShader = shader.fragmentShader.replace('#include <common>', '#include <common>\n#define USE_UV');
shader.vertexShader = shader.vertexShader.replace('#include <uv_vertex>', `
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
`)
shader.fragmentShader = shader.fragmentShader.replace('#include <map_fragment>', `
View code-server-update.sh
#!/bin/bash
DIR="$HOME/bin"
cd /tmp
curl -s https://api.github.com/repos/cdr/code-server/releases/latest \
| grep "browser_download_url.\+linux-x86_64.tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
@AdaRoseCannon
AdaRoseCannon / next_agenda.sh
Last active Jun 19, 2019
Add next agenda to terminal
View next_agenda.sh
Add this line to the crontab to cache the agenda every 10 minutes
*/10 * * * * OUT=$(/usr/bin/gcalcli --tsv --nostarted agenda "`date`") && echo "$OUT" > $HOME/.gcalcli-agenda-cache
This is part of my tmux config to include it:
tmux_conf_theme_status_left='  #($HOME/bin/next_agenda.sh) | #{prefix}#{pairing}#{synchronized}'
tmux_conf_theme_status_right='#{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} | #{username}#{root} | #{hostname} |'
set -g status-interval 10
View todo-repl
#!/bin/bash
tput smcup
# Turn user input off
stty -echo
display() {
BUFFER=$(
tput clear
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active Sep 29, 2020
HTML Element Plus for Web Components
View HTMLElementPlus.js
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {
View HTMLElementWithRefs
class HTMLElementWithRefs extends HTMLElement {
constructor () {
super();
this.refs = new Proxy({}, {
get: this.__getFromShadowRoot.bind(this)
});
}
__getFromShadowRoot (target, name) {
View Finished polyfill.js
if (document.body.animate && typeof Animation === 'undefined') {
window.Animation = document.body.animate({}).constructor;
}
if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefined) {
Object.defineProperty(Animation.prototype, 'finished', {get: function () {
if (this.__finishPromise) return this.__finishPromise;
if (this.playState === 'finished') {
this.__finishPromise = Promise.resolve();
} else {
@AdaRoseCannon
AdaRoseCannon / equirectangular.js
Last active Mar 26, 2019
Run this on an AFRAME scene to export it as an equirectangular image.
View equirectangular.js
/* eslint no-var:0 */
/* global AFRAME */
'use strict';
// Now out of date, use:
AFRAME.scenes[0].components.screenshot.capture()
// OLD METHOD BELOW:
@AdaRoseCannon
AdaRoseCannon / grr
Last active Mar 10, 2016
grr script
View grr
#!/bin/bash
if [ "$#" == "0" ]; then
ag
exit 1
fi
ag -S --nobreak --noheading --color-line-number='1;31' --color-path='0;31' --color-match='1;36' --depth=15 --ignore '*~' "$@"
You can’t perform that action at this time.