Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Eden daneden

View GitHub Profile
View Color.extension.swift
//
// Color.extension.swift
// Zeitgeist
//
// Created by Daniel Eden on 30/12/2020.
// Copyright © 2020 Daniel Eden. All rights reserved.
//
import Foundation
import SwiftUI
View install-sketch-templates.sh
#!/bin/bash
# Let's get some color going!
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
# cd to cwd of the script (presumably in it's proper location)
cd "$(dirname "$0")"
printf "\nInstalling Sketch templates..."
View rename-branch.sh
#!/bin/bash
# Checkout master branch
git checkout master
# Rename "master" to "main"
git branch -m master main
# Unset the current upstream branch
git branch --unset-upstream
View rgbaToHexConsole.js
// $0 is web inspector's reference to the current element
$0.style.backgroundColor
// run a regex to get the values for r, g, b, and optionally a
.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})(, ?([0-9.]{1,3}))?\)/)
// filter out the regex results we don't care about
.filter((e, i) => {
switch (i) {
case 1: // red
case 2: // green
case 3: // blue
View Timer.swift
import SwiftUI
import Combine
struct HMS {
var h: Int
var m: Int
var s: Int
}
struct ContentView: View {
View Readme.md

git clone and cd function

A simple little alias function that lets you clone and cd into a GitHub repo in one command.

Installation

Add to your zsh or bash config (usually ~/.bash_profile or ~/.zshrc) and open a new terminal to be able to use the function.

Usage

gcd [github_repo_owner/repo_name]
View dabblet.css
/* <i> Cloud */
html {
min-height: 100%;
background: linear-gradient(#b4bcbf, #fff);
}
.cloud {
display: inline-block;
background-color: #fff;
View dabblet.css
/**
* X or Y
*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
View dabblet.css
/**
* Notepad
*/
html {
background-image: linear-gradient(rgba(70,0,0,0),rgba(170,50,0,.5)), url(http://subtlepatterns.com/patterns/wood_pattern.png);
min-height: 100%;
box-sizing: border-box;
font: 100%/1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
View grid-api.md

Grid Breakpoint API Dilemma

We want a responsive grid API that allows for an arbitrary number of breakpoints to be defined, but there's an issue with how the breakpoint extremities are treated. Given the following API:

<Grid breakpoints={[300, 600, 900]}>
  <Column width={[1, 1/2, 1/4]} />
</Grid>