Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
@nickcernis
nickcernis / mariadb-brew-macos.md
Created July 13, 2020 15:13
Install MariaDB with brew on macOS and fix the “access denied” issue

Attempting mysql -u root fails with Access denied for user 'root'@'localhost immediately after doing brew install mariadb and starting mariadb with brew services start mariadb.

To fix it (with MariaDB still running):

  1. sudo mysql then enter your Mac user password
  2. ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword'; replacing newrootpassword with the password you wish to use for the MariaDB root user.
  3. Ctrl-C to exit mysql.

You should then be able to connect to MariaDB with mysql -u root -p, then entering the root password when prompted.

@kentcdodds
kentcdodds / package.json
Last active April 5, 2024 02:13
setup script for my workshops
{
"name": "workshop-setup",
"version": "1.0.0",
"description": "This is the common setup script for most of my workshops",
"bin": "./setup.js"
}
@zvakanaka
zvakanaka / foam-pit-starfield.markdown
Created February 19, 2020 02:59
Foam Pit Starfield
var keepsHisWord;
keepsHisWord = true;
promise1 = new Promise(function(resolve, reject) {
if (keepsHisWord) {
resolve("The man likes to keep his word");
} else {
reject("The man doesnt want to keep his word");
}
});
console.log(promise1);
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@yangshun
yangshun / using-eslint-with-prettier.md
Last active March 22, 2023 13:50
Comparison between tools that allow you to use ESLint and Prettier together.
prettier-eslint eslint-plugin-prettier eslint-config-prettier
What it is A JavaScript module exporting a single function. An ESLint plugin. An ESLint configuration.
What it does Runs the code (string) through prettier then eslint --fix. The output is also a string. Plugins usually contain implementations for additional rules that ESLint will check for. This plugin uses Prettier under the hood and will raise ESLint errors when your code differs from Prettier's expected output. This config turns off formatting-related rules that might conflict with Prettier, allowing you to use Prettier with other ESLint configs like eslint-config-airbnb.
How to use it Either calling the function in your code or via [prettier-eslint-cli](https://github.co
@ryanoglesby08
ryanoglesby08 / server.js
Last active April 4, 2024 13:25
A node.js SPA server that serves static files and an index.html file for all other routes.
/*
Incredibly simple Node.js and Express application server for serving static assets.
DON'T USE THIS IN PRODUCTION!
It is meant for learning purposes only. This server is not optimized for performance,
and is missing key features such as error pages, compression, and caching.
For production, I recommend using an application framework that supports server-side rendering,
such as Next.js. https://nextjs.org
@BillBrower
BillBrower / kirby.conf
Last active March 26, 2024 19:47
Nginx configuration for Kirby CMS
server {
listen 80;
server_name kirby.dev www.kirby.dev;
root /path/to/www/kirby;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Route LetsEncrypt ACME Challenges to the right place
location ^~ /.well-known/acme-challenge/ {
@davej
davej / transitionToPromise.js
Last active January 31, 2023 15:49
Do a CSS transition and resolve promise when complete
const transitionToPromise = (el, property, value) =>
new Promise(resolve => {
el.style[property] = value;
const transitionEnded = e => {
if (e.propertyName !== property) return;
el.removeEventListener('transitionend', transitionEnded);
resolve();
}
el.addEventListener('transitionend', transitionEnded);
});
@nmec
nmec / gulp-modernizr.js
Last active January 31, 2019 17:15
A very simple gulp task for compiling a custom modernizr build.
'use strict';
var fs = require('fs');
var gulp = require( 'gulp' );
var modernizr = require('modernizr');
var config = require('./modernizr-config'); // path to JSON config
gulp.task( 'modernizr', function (done) {
modernizr.build(config, function(code) {