Skip to content

Instantly share code, notes, and snippets.

☕️
Working from Starbucks... probably.

Austin Paquette pqt

View GitHub Profile
@pqt
pqt / TextColorFromBase.ts
Last active Apr 4, 2019
Validate a hexadecimal value, Convert hexadecimal to HSL, determine if the color needs a light or dark foreground.
View TextColorFromBase.ts
/**
* Remove all hashes from the begining of a hexadecimal string
*
* @param value Hexidecimal value that needs the Hash (#) removed
*/
export const RemoveHashes = (value: string) => {
return value.replace(/#{0,}/g, '');
};
/**
View async-await.js
// https://i.imgur.com/V0PNlIZ.png
(async () => {
const a = await getData();
const b = await getMoreData(a);
const c = await getMoreData(b);
const d = await getMoreData(c);
const e = await getMoreData(d);
console.log(e)
})();
@pqt
pqt / Geolocation.ts
Last active Nov 1, 2018
Geolocation class that can be used to store information based on connected IP about estimated locale to localStorage
View Geolocation.ts
import axios from 'axios'
export default class Geolocation {
constructor(
protected prefix: string = 'geolocation:',
protected url: string = 'https://ipapi.co/json',
protected fields: string[] = [
'ip',
'city',
'region',
@pqt
pqt / index.jade
Created Jun 16, 2018 — forked from CodeMyUI/index.jade
Sticky Avatars Dashboard
View index.jade
- var images = [ 'https://static.pexels.com/photos/5938/food-salad-healthy-lunch-medium.jpg', 'https://static.pexels.com/photos/5927/food-salad-red-lunch-large.jpg', 'https://static.pexels.com/photos/6118/food-water-corn-cooking-medium.jpg', 'https://static.pexels.com/photos/5876/food-salad-healthy-vegetables-medium.jpg', 'https://static.pexels.com/photos/5928/salad-healthy-diet-spinach-medium.jpg'];
.container
ul.posts
each img in images
li.post
.post-content
header: a(href="https://twitter.com/@kamciesla") @kamciesla posted this
img(src=img)
footer
a(href="https://kamilciesla.pl")
@pqt
pqt / position.scss
Last active Mar 21, 2018
One of those helpers I should have made a loooooong time ago
View position.scss
// @include position(absolute, 5%, 1px, initial, inherit);
@mixin position($position, $top: null, $right: null, $bottom: null, $left: null) {
position: $position;
@if($top != null) { top: $top }
@if($right != null) { right: $right }
@if($bottom != null) { bottom: $bottom }
@if($left != null) { left: $left }
}
// Produces
@pqt
pqt / _helpers.scss
Created Dec 21, 2017
Helper classes that apply a padding or margin depending on the class - works via direction and axis flags
View _helpers.scss
$spacer: .125rem !default;
$spacers: (
0: 0,
1: $spacer,
2: $spacer * 2,
3: $spacer * 3,
4: $spacer * 4,
5: $spacer * 5,
6: $spacer * 6,
7: $spacer * 7,
@pqt
pqt / helpers.js
Last active Nov 25, 2017
ES6 Helper Functions - Just a general set of functions that I come across or need, simplified as much as possible
We couldn’t find that file to show.
@pqt
pqt / noswitch.js
Last active Oct 10, 2017
Cause I hate switch statements with a passion
View noswitch.js
var cases = {
1: doX,
2: doY,
3: doN
};
if (cases[something]) {
cases[something]();
}
@pqt
pqt / Strut.js
Last active Oct 2, 2017
Found this hidden gem tucked away in the Stripe JS, seems like a generally useful utility.
View Strut.js
var Strut = {
random: function(e, t) {
return Math.random() * (t - e) + e
},
arrayRandom: function(e) {
return e[Math.floor(Math.random() * e.length)]
},
interpolate: function(e, t, n) {
return e * (1 - n) + t * n
},
View Connector.js
import React from 'react'
const bgStyles = {
strokeWidth: 3,
strokeLinejoin: 'round',
strokeLinecap: 'round',
fill: 'none',
stroke: '#c3fdff'
}
You can’t perform that action at this time.