Skip to content

Instantly share code, notes, and snippets.

View DonKoko's full-sized avatar
🏄‍♂️
...

Nikolay Bonev DonKoko

🏄‍♂️
...
View GitHub Profile
@rphlmr
rphlmr / index.ts
Last active July 30, 2024 03:11
Link XState and Remix fetcher
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node';
import {
ClientActionFunctionArgs,
ClientLoaderFunctionArgs,
useFetcher,
useLoaderData,
} from '@remix-run/react';
import { enqueueActions, fromPromise, setup } from 'xstate';
import { useActor } from '@xstate/react';
import { useEffect, useRef } from 'react';
var Meter = function (props) {
var {
percent = 0, // a number between 0 and 1, inclusive
width = 100, // the overall width
height = 10, // the overall height
rounded = true, // if true, use rounded corners
color = "#0078bc", // the fill color
animate = false, // if true, animate when the percent changes
label = null // a label to describe the contents (for accessibility)
} = props;
var Meter = function (props) {
var {
percent = 0, // a number between 0 and 1, inclusive
width = 100, // the overall width
height = 10, // the overall height
rounded = true, // if true, use rounded corners
color = "#0078bc", // the fill color
animate = false, // if true, animate when the percent changes
label = null // a label to describe the contents (for accessibility)
} = props;
function dm_display_wpjm_categories () {
$terms = get_terms( array(
'taxonomy' => 'job_listing_category',
'hide_empty' => false,
) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
@paulirish
paulirish / what-forces-layout.md
Last active March 13, 2025 03:22
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
@xero
xero / irc.md
Last active January 31, 2025 15:06
irc cheat sheet
@ryanb
ryanb / development.rb
Created November 27, 2012 21:38
Some rack middleware to add headers to asset pipeline.
class AssetHeaders
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
response = @app.call(env)
if request.path =~ /^\/assets\//
# there maybe a better way to add headers