Skip to content

Instantly share code, notes, and snippets.

View lohfu's full-sized avatar
💭
what does this do?

Linus Miller lohfu

💭
what does this do?
View GitHub Profile
<h1>I am doing stuff</h1>
article,
aside,
nav,
section {
article,
aside,
nav,
section {
article,
aside,
@lohfu
lohfu / any.css
Created May 28, 2020 17:17
vendor specific :any
/* does not work: */
:-moz-any(article, aside, nav, section) > h1,
:-webkit-any(article, aside, nav, section) > h1 {
font-size: 2rem;
}
/* works: */
:-webkit-any(article, aside, nav, section) > h1 {
@lohfu
lohfu / remove_ancestor_topics.sql
Last active February 14, 2020 14:50
ancestor_topics
delete from links_topics where (link_id, topic_id) in (
select
j_parent.link_id,
j_parent.topic_id
from (
select
lt.link_id,
lt.topic_id,
t.path
select
child_link_id,
child_topic_id,
parent_link_id,
parent_topic_id,
child_path,
parent_path
from (
select
lt_child.link_id as child_link_id,
@lohfu
lohfu / webpack.config.js
Created December 19, 2018 14:23
webpack config supporting css modules and normal css
'use strict'
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const isDev = process.env.NODE_ENV === 'development'
// style files regexes
@lohfu
lohfu / render-dust.js
Last active December 23, 2017 12:17
render
'use strict'
const Promise = require('bluebird')
const dust = require('dustjs-linkedin')
dust.renderPromise = Promise.promisify(dust.render, { context: dust })
module.exports = async function (template, master) {
const locals = Object.assign({}, this.app.locals, this.locals)
console.log(locals)
@lohfu
lohfu / .js
Last active April 28, 2017 14:13
'use strict';
const _ = require('lodash');
module.exports = (permissions, requiredPermissions) => {
if (!_.isPlainObject(requiredPermissions)) {
throw new TypeError('`requiredPermissions` is not an object');
} else if (!_.isPlainObject(permissions)) {
throw new TypeError('`permissions` is not an object');
} else {
@lohfu
lohfu / login.js
Last active April 28, 2017 13:27
'use strict';
// modules > 3rd party
const redirect = require('midwest/factories/redirect');
const createError = require('midwest/util/create-error');
const router = new (require('express')).Router();
const { getAuthenticationDetails, authenticate, login } = require('../config');
const responses = {
@lohfu
lohfu / acl-compare.js
Last active April 28, 2017 14:37
authentication
'use strict';
const _ = require('lodash');
module.exports = (permissions, requiredPermissions) => {
if (!_.isPlainObject(requiredPermissions)) {
throw new TypeError('`requiredPermissions` is not an object');
} else if (!_.isPlainObject(permissions)) {
throw new TypeError('`permissions` is not an object');
} else {