Skip to content

Instantly share code, notes, and snippets.

View lachlanjc's full-sized avatar
🏳️‍🌈
(they/them)

Lachlan Campbell lachlanjc

🏳️‍🌈
(they/them)
View GitHub Profile
//---------------------------
// Size function
// =============
// The size function returns a measurement determined by
// the (required) argument of level.
//
// Example: size(5);
// This will return 16rem.
//---------------------------
$__size-default: 2;
//-----------------------------
// Units functions
//-----------------------------
// Strip units from passed value
@function stripUnit($n) {
@return $n / ($n*0+1);
}
//---------------------------
//---------------------------
// Grid object
//---------------------------
$__col-values: (4, 6, 8, 9, 12);
@media #{$breakpoint-sm} {
@each $size in $__col-values {
.col-#{$size}--sm {
width: ($size/12 * 100%);
@lachlanjc
lachlanjc / Header.js
Created August 21, 2016 00:41
Styling multiple elements with react-cxs
const Header = () => {
const cx = {
root: {
backgroundColor: colors.blue,
color: colors.white,
paddingBottom: space[4],
paddingTop: space[4]
},
container: {
margin: 'auto',
@lachlanjc
lachlanjc / rehide.coffee
Created November 4, 2016 16:55
For when you need an element to be hidden on page load, but respond to jQuery's .show() or .toggle() later, use Rehide.
$(document).ready ->
# Assuming .hidden sets display: none
$('[data-behavior~=rehide]').hide().removeClass('hidden')
@lachlanjc
lachlanjc / home.html.erb
Created February 7, 2017 15:42
Make Schema metadata generation easy in Rails
<%= make_scheme org_schema %>
@lachlanjc
lachlanjc / start.md
Created March 26, 2018 15:30
Favorite Song site

Favorite Song site

1. Open Glitch

Open Glitch, click on "hello-webpage", and click "Remix your own."

2. Start your HTML

HTML is the language we use to write webpages. Every website you've ever visited uses HTML, and yours is no different.

import React from 'react'
const makeTitle = (title, name) =>
title === name ? title : `${title} – ${name}`
const Meta = ({
name = 'Hack Club', // site name
title = 'Hack Club', // page title
description,
image,
body {
font-family: 'Avenir Next', system-ui;
}
h1 {
color: #ec3750;
}
@lachlanjc
lachlanjc / apple_silicon.md
Created November 12, 2020 00:47
A quick explainer on the first wave of Apple Silicon

These first Apple Silicon Macs are to replace the lowest-end models of the Mac, but all the higher-end computers are coming in the next year or two. The 13” MacBook Pro has been two confusingly-similar computers for 4 years: the entry model is basically a thicker MacBook Air for people who want a Pro (in 2016, this was the MacBook Pro without a Touch Bar with two USB-C ports), they now have the Touch Bar but still 2 ports.

When you go to buy MacBook Air, all models have been replaced with M1—because the M1 models are faster & better in every way than the previous generation. Whereas when you buy the Mac mini & MacBook Pro, they’re still selling the higher-end models powered by Intel, including the 4-port models, because the first wave of Apple Silicon doesn’t replace those models. The inclusion of 2 USB-4 ports is because the M1 chip itself includes 2 USB-4 bridges built in, & by using the same chip across all the computers, since the MacBook Air only has the two ports, they had to standardize the design. (T