Skip to content

Instantly share code, notes, and snippets.

@chx
chx / gist:22372925d1db05e19e76d7438262a575
Last active March 15, 2024 12:46
Remove the new Slack "rail" containing activity and other useless things
const domObserver = new MutationObserver(() => {
let rail = document.querySelector('div.p-tab_rail');
if (rail) {
rail.remove();
let old_strip = document.querySelector('div.p-workspace_switcher_prototype div.p-control_strip')
if (old_strip) {
old_strip.remove()
}
let strip = document.querySelector('div.p-control_strip');
document.querySelector('div.p-workspace_switcher_prototype').appendChild(strip);
@revmischa
revmischa / DockerfileLambdaChromium
Created April 1, 2020 18:45
Build chromium on amazon linux 2
FROM lambci/lambda:build-python3.8
# ref: https://chromium.googlesource.com/chromium/src.git/+refs
ARG VERSION
ENV VERSION ${VERSION:-master}
LABEL maintainer="Mischa Spiegelmock <[email protected]>"
LABEL chromium="${VERSION}"
WORKDIR /
@akorn
akorn / runcached
Last active September 3, 2024 22:15
Run specified (presumably expensive) command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
#!/bin/zsh
#
# Purpose: run specified command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
# Also cache exit status and stderr.
# Copyright (c) 2019-2023 András Korn; License: GPLv3
# Use silly long variable names to avoid clashing with whatever the invoked program might use
RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300}
RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0}
RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0}
@stdavis
stdavis / gist:3915515
Created October 19, 2012 00:08
Mock Dojo AMD Dependencies Using Jasmine
var dojoConfig = {
has: {'dojo-undef-api': true}
};
function stubModule(modulePath, stubs, forcedRefreshModules) {
// inspired by: http://stackoverflow.com/questions/11439540/how-can-i-mock-dependencies-for-unit-testing-in-requirejs
// and https://github.com/mattfysh/testr.js
var aliases = [],
key,
stubname,
returnModule,
@mklabs
mklabs / pre-commit
Created November 15, 2011 17:28
run jshint as git/hg hooks, NO COMMIT IF NO LINT FREE.
#!/usr/bin/env node
// todo: try to require jshint here, instead of spawning process, then fallback to spawning process.
var jshint = nrequire('jshint');
if (jshint) return process.exit(0);
// jshint not installed locally, spawn process instead.
// basically the same, but less pretty.
var exec = require('child_process').exec;