Skip to content

Instantly share code, notes, and snippets.

@markasoftware
markasoftware / enterprise_token.rb
Last active June 2, 2024 16:00
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@arei
arei / 10ThingsWrongWebComponents.md
Last active February 20, 2024 03:16
10 Things You Are Doing Wrong in your Web Components

10 Things You Are Doing Wrong in your Web Components

Web Components enable custom element creation and sharing on a whole new level that has not really been seen to date but is so desperately needed. Developers of everything from simple webpages to complex applications are using Web Components to deliver new functionality, new behaviors, and new designs. Web Components are a big part of the future of the web.

There are lots of articles detailing how to build a basic Web Component, but almost no article details how to solve some of the gotchas once you start down that road. That's what this article serves to do; point out some of the things every Web Component developer is overlooking and to which they should probably be giving more consideration.

1). Not Using a Web Component Framework

The APIs which make up the Web Components standards (Custom Elements, ShadowDOM, etc) are intentionally low level APIs. As such they are not always the most clear or concise in their understandability. Additionally,

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@amielucha
amielucha / wp-query-uses.php
Last active November 2, 2018 16:55
WP_Query() usage examples - WordPress custom post types (keywords: query, loop)
<?php
/*
* Display 4 items from Member post type.
* Posts are organized by menu order.
* Use https://wordpress.org/plugins/simple-page-ordering/ or similar to easily sort items.
*/
$the_query = new WP_Query( array(
'post_type' => 'member',
'posts_per_page' => 4,
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@paulirish
paulirish / what-forces-layout.md
Last active June 3, 2024 04:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@fuyuko
fuyuko / functions.php
Last active July 21, 2023 13:06
Cheatsheet - WooCommerce Customization in functions.php
//Add a stylesheet after default style.css
wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style'));
//WooCommerce - Sort products by SKU
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
return $args;
@bhubbard
bhubbard / jetpack_prefetch_hook.php
Last active October 22, 2015 23:14
Hook into Jetpack for DNS Prefetch
if (class_exists('Jetpack')) {
Jetpack::dns_prefetch( array(
'//example.com',
) );
}