Skip to content

Instantly share code, notes, and snippets.

View zzzarius's full-sized avatar
👋

Darius Zivertas zzzarius

👋
View GitHub Profile
@miZyind
miZyind / get-valuable.ts
Last active July 16, 2024 17:13
A helper function to remove blank attributes from an object in TypeScript with type-safe
type Valuable<T> = { [K in keyof T as T[K] extends null | undefined ? never : K]: T[K] };
function getValuable<
// eslint-disable-next-line @typescript-eslint/ban-types
T extends {},
V = Valuable<T>,
>(obj: T): V {
return Object.fromEntries(
Object.entries(obj).filter(
([, v]) =>
@ffdead
ffdead / WistiaEmbed.js
Created November 2, 2020 09:43
React component for Wistia embed
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import classNames from 'classnames/bind'
import s from './WistiaEmbed.module.scss'
const cn = classNames.bind(s)
const WistiaEmbed = ({ id, play = false, style, options }) => {
// const el = useRef()
@malarkey
malarkey / custom-properties-boilerplate.css
Created March 14, 2019 20:02
CSS Custom Properties boilerplate
/* CSS Custom Properties */
:root {
--font-family: 'Georgia', serif;
--font-family-alt: 'Helvetica', Arial, sans-serif;
--font-weight: 400;
--font-weight-bold: 700;
--font-weight-black: 900;
/* 3:4 perfect fourth scale */
@MatthieuScarset
MatthieuScarset / .lando.yml
Last active January 4, 2024 15:03
Correct settings for XDebug + VSCode + Lando (+3.0)
# Lando version is at least +3.0
name: drupal-nine
recipe: drupal9
services:
appserver:
webroot: web
xdebug: debug
config:
php: .vscode/php.ini
@neolitec
neolitec / BasicAuthenticationFilter.java
Created February 12, 2014 11:09
HTTP Basic authentication Java filter
package com.neolitec.examples;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;