Skip to content

Instantly share code, notes, and snippets.

const { resolve } = require('path');
const { readdir } = require('fs').promises;
const fs = require('fs');
const result = [];
async function* getFiles(dir) {
const dirents = await readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = resolve(dir, dirent.name);
if (dirent.isDirectory()) {
@mariofink
mariofink / pinboard.stylish.css
Last active April 7, 2021 06:18
Pinboard.in Stylish CSS
@-moz-document url-prefix("https://pinboard.in") {
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
line-height: 1.4em;
}
#banner {
width: 100%;
padding-bottom: 1rem;
@mariofink
mariofink / web.config
Last active April 25, 2017 07:06
Microsoft Azure web server configuration for running Laravel
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>
@mariofink
mariofink / pre-push.sh
Created April 3, 2017 12:29
Git pre-push hook to avoid pushing tags
#!/bin/sh
while read -d $'0' arg ; do
echo $arg
if [[ $arg == *"/tags/"* ]]; then
echo "Pushing tags is not allowed!"
exit 1
fi
done

VIM cheatsheet

Insert

  • i – before cursor
  • a – after cursor
  • O – above current line
  • o – below current line
  • I – beginning of line
  • A – end of line
module.exports = function (grunt) {
grunt.initConfig({
/**
* Build JS code from AMD modules with Browserify
*/
browserify: {
testspecs: {
src: ["scripts/test/spec/<%= browserifySpecs %>.js"],
dest: 'scripts/test/specs-built.js'
}
@mariofink
mariofink / gist:3dbeb9e206933885bab8
Created May 3, 2014 15:27
SASS Find unused variables
#! /usr/bin/env bash
#
# checks your scss files for unused variables
#
if [ -z "$1" ]; then
echo "Please specify a directory as the first argument."
exit 1
fi
if [ ! -d "$1" ]; then
#! /usr/bin/env bash
#
# checks how many times SASS variables have been used inside a project
#
if [ -z "$1" ]; then
echo "Please specify a directory as the first argument."
exit 1
fi
if [ ! -d "$1" ]; then
# Editors/IDEs #
################
*.swp
.idea
# Node/NPM #
############
node_modules
npm-debug.log
@mariofink
mariofink / mydotfiles
Created March 5, 2014 19:04
My dot files
# .aliases
alias search='find . -iname '
alias changelog='svn log -l 10 -v | more'
alias mychangelog="svn log -l 50 | sed -n '/mario.fink/,/-----$/ p'"
alias uservm='source /Users/mariofink/.rvm/scripts/rvm'
########################################################################
# .profile
PS1="\n\w\n> "