Skip to content

Instantly share code, notes, and snippets.

View allmarkedup's full-sized avatar

Mark Perkins allmarkedup

View GitHub Profile
@scottwater
scottwater / clsx.rb
Created March 14, 2023 00:58
Quick Ruby implementation of https://www.npmjs.com/package/clsx
module Clsx
def clsx(*args)
process_args = args.map do |arg|
if arg.is_a?(Array)
clsx(*arg)
elsif arg.is_a?(Hash)
arg.map do |key, value|
key if value
end
else
@JoelQ
JoelQ / dollar.rb
Last active January 10, 2024 01:14
Implementing value object semantics as an RSpec shared_example.
class Dollar
attr_reader :cents
def initialize(cents:)
@cents = cents
end
def hash
[self.class, cents].hash
end
@dralletje
dralletje / awesome-line-wrapping.js
Created September 25, 2021 20:25
Codemirror 6 line wrapping that preserves indentation
import _ from "lodash"
import { StateEffect, StateField } from "@codemirror/state"
import { EditorView, Decoration } from "@codemirror/view"
/**
* Plugin that makes line wrapping in the editor respect the identation of the line.
* It does this by adding a line decoration that adds padding-left (as much as there is indentation),
* and adds the same amount as negative "text-indent". The nice thing about text-indent is that it
* applies to the initial line of a wrapped line.
*
@gwillem
gwillem / dell-xps-9310-linux-install-notes.md
Created November 25, 2020 09:43
Linux (Xubuntu 20.04) on Dell XPS 9310 install notes

Dell XPS 9310 Linux install notes (Ubuntu/Xubuntu 20.04)

My NL i7/16GB XPS 9310 has a Killer AX1650s WiFi chip, which eventually worked. Other Killer chips may not work.

I ordered the Windows Home edition, because developer edition with Linux was not available in my country. Apparently you can reclaim €100 from Dell if you don't use Windows.

Install

  • Bios:
  • Change the SATA Mode from the default "RAID" to "AHCI"
@mihkeleidast
mihkeleidast / preview.tsx
Created March 1, 2019 18:45
Fractal React preview template
import React from 'react';
export interface IPreviewEnv {
reactClass: string;
publicPath: string;
}
export interface IPreviewTargetMeta {
previewDisplay?: React.StyleHTMLAttributes<HTMLBodyElement>;
}
@mihkeleidast
mihkeleidast / preview.twig
Created March 1, 2019 18:44
Fractal twig preview
<!DOCTYPE html>
<html class="no-js" lang="{{ language }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/inc/favicon/apple-touch-icon.png'|path }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/inc/favicon/favicon-32x32.png'|path }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/inc/favicon//favicon-16x16.png'|path }}">
<link rel="manifest" href="{{ '/inc/favicon/manifest.json'|path }}">
@0x6a68
0x6a68 / index.js
Created November 7, 2016 09:56
fractal programmatically
const fractal = require('@frctl/fractal').create()
require('./setup')(fractal)
const server = require('./server')(fractal, {
port: 4000,
sync: true,
watch: true,
syncOptions: {
files: [
'files-i-want-to-watch-also.css',
@iest
iest / cleanup-svg.js
Created September 6, 2016 16:15
Couple utility functions to cleanup SVGs (especially from Sketch output)
// https://gist.github.com/MoOx/1eb30eac43b2114de73a
const generic = {
title: /<title>.*<\/title>/gi,
desc: /<desc>.*<\/desc>/gi,
comment: /<!--.*-->/gi,
defs: /<defs>.*<\/defs>/gi,
width: / +width="\d+(\.\d+)?(px)?"/gi,
height: / +height="\d+(\.\d+)?(px)?"/gi,
sketchMSShapeGroup: / +sketch:type=\"MSShapeGroup\"/gi,
sketchMSPage: / +sketch:type=\"MSPage\"/gi,
@plugnburn
plugnburn / README.md
Last active January 31, 2023 15:02
DaBi - live two-way DOM-to-data binding in 25 lines of JS

DaBi: data binding library that keeps it simple

DaBi (short for Data Binding) is a dead simple yet complete and self-contained DOM-to-JS and JS-to-DOM data binding library in just 25 lines of pure ES5 and 454 bytes when minified.

How to obtain

Download it right here or include it into your HTML:

@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;