Skip to content

Instantly share code, notes, and snippets.

View iamnewton's full-sized avatar
🏠
Working from home

Newton iamnewton

🏠
Working from home
View GitHub Profile
@iamnewton
iamnewton / bash-colors.md
Last active May 2, 2024 22:42
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@iamnewton
iamnewton / tput-hex-table.md
Created July 18, 2014 23:39
A table of the tput values and their equivalent hex value

Primary 3-bit (8 colors). Unique representation!

tput hex
00 000000
01 800000
02 008000
03 808000
04 000080
05 800080
@iamnewton
iamnewton / bash_prompt-ps1-privileges.sh
Created January 15, 2014 21:46
Changes the prompt (PS1) to green text for a normal user, red for root, and yellow for any other user attained via sudo.
color_root=$(tput setaf 1)
color_user=$(tput setaf 2)
color_sudo=$(tput setaf 3)
color_reset=$(tput sgr0)
// root user
if (( EUID == 0 )); then
PS1="\\[$color_root\\]$PS1\\[$color_reset\\]"
// sudo user
elif [[ $SUDO_USER ]]; then

Keybase proof

I hereby claim:

  • I am iamnewton on github.
  • I am chrisopedia (https://keybase.io/chrisopedia) on keybase.
  • I have a public key whose fingerprint is 6AE7 083D 4404 07C0 7EB1 18EA 3802 412D 8420 6E38

To claim this, I am signing this object:

// I provide a logging API that has some special sauce for formatting.
const echo = (function() {
let queue = [];
var ECHO_TOKEN = {};
const RESET_INPUT = "%c ";
var RESET_CSS = "";
// Attach formatting utility method.
function alertFormatting (value) {
queue.push({
@iamnewton
iamnewton / what-forces-layout.md
Last active October 13, 2022 22:11 — forked from paulirish/what-forces-layout.md
What forces layout/reflow in Chrome. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()

Body

Medium Font Size Line Height Characters
Print 12pt 1.25em 60-75
Desktop (lg) 1em (16px) 1.375em 60-75
Desktop 1em (16px) 1.375em 60-75
Tablet (lg) 1em (16px) 1.375em 60-75
Tablet (sm) 1em (16px) 1.25em 60-75
Phone 1em (16px) 1.25em 35-40
@iamnewton
iamnewton / media-queries.css
Created January 1, 2014 03:29
A boilerplate or starter template of media queries for various device widths and orientations.
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@iamnewton
iamnewton / format-stock-spreadsheet.js
Last active March 14, 2021 18:29
Runs a few scripts to format the Gain & Loss sheets from stock data.
/*
* get the active selected sheet;
*/
const SHEET = SpreadsheetApp.getActiveSheet();
// ranges are equivalent to rows in this context, but in reality are more
// like A2:B2 which means Column A, Row 2 through Column B, Row 2
// this method pulls back all information from the first column, first row
// to the last column, last row
// | | A | B | C |
@iamnewton
iamnewton / _images.scss
Created January 24, 2020 00:36
Some SCSS helpers
/// Rounded corners on images
/// @author Newton Koumantzelis
/// @since 1.0.0 - The Sith
/// @example html
/// <img src="" class="img-broken" alt="Generic image">
.img-broken {
position: relative;
min-height: 3rem;
&::before,