Skip to content

Instantly share code, notes, and snippets.

View chanced's full-sized avatar

Chance chanced

  • Columbia, SC, USA
View GitHub Profile
export type BreakpointName = "sm" | "md" | "lg" | "xl" | "2xl";
export const breakpointNames: BreakpointName[] = ["sm", "md", "lg", "xl", "2xl"];
const pxRegex = /^(\d+)\s*(?:px)?$/i;
const remRegex = /^(\d+)\s*(?:rem)/i;
export interface Breakpoint {
name: BreakpointName;
export type BreakpointName = "sm" | "md" | "lg" | "xl" | "2xl";
export const breakpointNames: BreakpointName[] = ["sm", "md", "lg", "xl", "2xl"];
const pxRegex = /^(\d+)\s*(?:px)?$/i;
const remRegex = /^(\d+)\s*(?:rem)/i;
export interface Breakpoint {
name: BreakpointName;
@chanced
chanced / .eslintrc.cjs
Created October 7, 2021 03:20
eslint for svelte / kit with typescript
module.exports = {
root: true,
overrides: [
{
files: ["*.ts", "*.svelte"],
parser: "@typescript-eslint/parser",
plugins: ["svelte3", "@typescript-eslint"],
settings: {
"svelte3/typescript": () => require("typescript"),
},
@chanced
chanced / component-types.ts
Created October 4, 2021 05:25
Couple of utility types for extracting svelte constructor options & svelte component props
export type SvelteComponentConstructorOptions<T> = T extends abstract new (
opts: Svelte2TsxComponentConstructorParameters<infer P>,
) => any
? Svelte2TsxComponentConstructorParameters<P>
: never;
export type SvelteComponentProps<T> = T extends abstract new (
opts: Svelte2TsxComponentConstructorParameters<infer P>,
) => any
? Svelte2TsxComponentConstructorParameters<P>["props"]
@chanced
chanced / machine.js
Last active August 15, 2021 19:45
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine(
{
id: "auth",
initial: "initializing",
context: {
retries: 0,
user: undefined,
lastUpdated: undefined,
},
{
"categories": {
"form": {
"description": "Form-associated content is a subset of flow content comprising elements that have a form owner, exposed by a form attribute, and can be used everywhere flow content is expected. A form owner is either the containing <form> element or the element whose id is specified in the form attribute.",
"documentation": "https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#form-associated_content",
"elements": [
"button",
"fieldset",
"input",
"label",
@chanced
chanced / enum.go
Last active January 10, 2021 17:17
boilerplate for extending protoc-gen-star after making methods public
package genproto
import (
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/protoc-gen-go/descriptor"
pgs "github.com/lyft/protoc-gen-star"
)
// Enum describes an enumeration type. Its parent can be either a Message or a
@chanced
chanced / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
fieldset#account
legend Account Settings
ul
li#email
label
| Email
span.required *
input(type='text', name='account[email]')
li#password
label