Skip to content

Instantly share code, notes, and snippets.

View davidrleonard's full-sized avatar

David Leonard davidrleonard

View GitHub Profile
@mixin eds-mx-text-crop($desired-line-height: $eds-global-line-height) {
$ratio: $desired-line-height / $eds-global-line-height;
&:before,
&:after {
content: '';
display: block;
width: 0;
height: 0;
}
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.50962930917739868,
"Red Component" : 0.44058024883270264,
"Blue Component" : 0.51685798168182373
},
@davidrleonard
davidrleonard / add-team-to-repos.js
Last active May 8, 2024 15:11
Add a new team to all Github repos in an organization
/*
* Adds a team to all the repos in a Github organization. This is a tedious
* process in the UI. You'll need a newer version of node to run this (e.g 9+)
* because it uses async/await.
*
* Instructions:
*
* 1. Copy this file somewhere on your computer, e.g. ~/addteamrepos.js
* 2. Fill in the uppercase variables below with the right values
* 3. Run this file: `$ node ~/addteamrepos.js`
@davidrleonard
davidrleonard / material-design-colors.scss
Last active September 7, 2023 15:37
Material Design color as a single file of SASS/SCSS variables
// Material Colors: Red
$color-red-50: #ffebee;
$color-red-100: #ffcdd2;
$color-red-200: #ef9a9a;
$color-red-300: #e57373;
$color-red-400: #ef5350;
$color-red-500: #f44336;
$color-red-600: #e53935;
$color-red-700: #d32f2f;
$color-red-800: #c62828;
@davidrleonard
davidrleonard / famous-women-in-stem.json
Last active February 15, 2018 00:35
A list of famous women scientists, computer scientists, engineers, mathematicians, scholars, and more formatted as JSON
[
{
"fullName" : "Diane Greene",
"firstName" : "Diane",
"lastName" : "Greene",
"fields" : "Computer Science",
"knownFor" : "CEO of VMware, Google board member",
"born" : "1955",
"birthplace": "United States"
},
@davidrleonard
davidrleonard / from-now.js
Last active February 18, 2024 11:23
moment.fromNow() implemented in vanilla JavaScript as a simple, standalone function. Runs in the browser. No dependencies required.
/**
* Implements all the behaviors of moment.fromNow(). Pass a
* valid JavaScript Date object and the method will return the
* time that has passed since that date in a human-readable
* format. Passes the moment test suite for `fromNow()`.
* See: https://momentjs.com/docs/#/displaying/fromnow/
*
* @example
*
* var pastDate = new Date('2017-10-01T02:30');
@davidrleonard
davidrleonard / addtoken.sh
Last active October 5, 2017 17:16
Add your Github token to existing remotes
## If you have to create a Github access token (e.g. if you enabled two-factor auth for the same time)
## and you used https:// formatted git remotes for all your local repos, you won't be able to push
## or pull anymore. This allows you to fix all your remotes whenever you need to with a simple
## bash alias.
##
## Put this in your ~/.bash_profile or ~/.zsh_profile, then run `$ fixremote` in a repo directory
## to fix it.
##
## P.S. You should use SSH remotes for your Github repos. But if you're behind a corporate proxy
## that messes up SSH to the public internet, you can't... :(
loader: 'vue-loader',
options: {
extractCSS: true,
loaders: {
sass: 'vue-style-loader!css-loader!sass-loader?'+
'{"includePaths":["bower_components"]}'
}
}
@davidrleonard
davidrleonard / node-crawling-utils.js
Last active September 1, 2017 17:44
Node utility functions for crawling files (for when you want to check a bunch of repos without bash)
/*
* Run in a directory with a bunch of subdirectories.
*
* Example: Get all subdirectories with names ending in '-design'
*
* ```
* const subdirs = getDirectories(__dirname).filter(isMatch.bind(null, /\-design$/));
* ```
*
* Example: Get all subdirectories that have any subfiles named *.es6.js
@davidrleonard
davidrleonard / build-css.js
Created July 14, 2017 16:45
Sass->CSS build task that can be run as an npm script (not done)
#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const sass = require('node-sass');
const importOnce = require('node-sass-import-once');
const postcss = require('postcss');
const autoprefixer = require('autoprefixer');
const cssmin = require('clean-css');