Skip to content

Instantly share code, notes, and snippets.

@lolmaus
lolmaus / 01.md
Last active March 21, 2024 19:50
Prettier is uglier

Before:

  plugins: [
    "@typescript-eslint",
    "ember",
    "prettier",
  ],
@Symbianx
Symbianx / darkify-slack-for-windows.sh
Last active August 1, 2019 14:07
Changes the Slack for Windows theme to dark.
#!/bin/bash
set -e
# Darkify Slack on Mac OS or Linux.
# curl https://gist.githubusercontent.com/Symbianx/7624c96102b9fc8d1ff396e8fe0c12e6/raw/darkify-slack-for-windows.sh | sh
cd "/c/Users/`cmd.exe /c 'echo %username%' | tr -d '\r\n'`/AppData/Local/slack/"
for VERSION_DIR in app-*; do
if [ -d "${VERSION_DIR}" ]; then
# Will not run if no directories are available
@ryanpcmcquen
ryanpcmcquen / darkify_slack.sh
Last active February 23, 2023 16:08
Darkify your Slack.
#!/bin/sh
# Darkify Slack on Mac OS or Linux.
# curl https://gist.githubusercontent.com/ryanpcmcquen/8a7ddc72460eca0dc1f2dc389674dde1/raw/darkify_slack.sh | sh
if [ "`uname -s`" = "Darwin" ]; then
SLACK_INTEROP_JS="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
else
SLACK_INTEROP_JS="/usr/lib/slack/resources/app.asar.unpacked/dist/ssb-interop.bundle.js"
fi
@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 21:32
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ryasmi
ryasmi / gruntfile.js
Created January 22, 2014 22:58
A grunt file for web development. Demonstrates watching multiple files, but only running a task on changed files (FYI makefiles are really good at that).
module.exports = function (grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
build: {
files: [{
expand: true,
@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});