Skip to content

Instantly share code, notes, and snippets.

View Andy-set-studio's full-sized avatar

Andy Bell Andy-set-studio

View GitHub Profile
@Andy-set-studio
Andy-set-studio / _triangle.scss
Last active October 23, 2017 20:05
CSS triangle mixin. Probably best to use SVG these days - but if this floats your boat, I wont judge.
@mixin triangle($colour, $size, $direction, $multiplier: 1.5) {
width: 0;
height: 0;
@if ($direction == "up") {
border-top: none;
border-right: $size solid transparent;
border-bottom: ($size * $multiplier) solid $colour;
border-left: $size solid transparent;
}
@Andy-set-studio
Andy-set-studio / _video-player.scss
Last active October 23, 2017 20:09
Responsive video player Sass component
.video-player {
width: 100%;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
position: relative;
&__embed {
position: absolute;
@Andy-set-studio
Andy-set-studio / _table.scss
Last active October 23, 2017 20:17
Table with radius corners and stripes #usefulSCSS
.table {
width: auto;
max-width: 100%;
border-collapse: separate;
border-spacing: 0;
th {
&:first-child {
border-radius: $radius 0 0 0;
@Andy-set-studio
Andy-set-studio / _break.scss
Created July 15, 2016 09:39
Add a line break with CSS. Useful for keeping labels inline/inline-block
// Create a line break
&:after {
content: "\A";
white-space: pre;
}
@Andy-set-studio
Andy-set-studio / _system-font.scss
Last active October 23, 2017 20:10
Set base family as system font. Apple San Francisco etc etc
// Set base font family as system fonts as outlined in this article: https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/#what-to-do-today
$base-font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
@Andy-set-studio
Andy-set-studio / .eslintrc
Last active July 9, 2017 21:14
ESLINT template
{
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
@Andy-set-studio
Andy-set-studio / css-for-sup-and-sub.scss
Last active October 23, 2017 20:01 — forked from unruthless/CSS for <sup> and <sub>
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@Andy-set-studio
Andy-set-studio / font-ligatures.scss
Created October 23, 2017 20:18
Disable font ligatures
.no-ligatures {
font-variant-ligatures: none;
}
@Andy-set-studio
Andy-set-studio / .htaccess
Created October 23, 2017 20:19
.htaccess rules to place site in maintenance mode, but allow certain IP Address through
RewriteEngine On
# Allow through given IP Address
RewriteCond %{REMOTE_ADDR} !^95\.128\.11\.149
# Check for presence of Maintenance Page
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
# Check for presence of enable file
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
@Andy-set-studio
Andy-set-studio / command.sh
Last active October 23, 2017 20:20
[Git changes between hashes] Get the changes between two commit hashes. This will create a file called "changes.txt" in the root of your repo with a list of changes. Andy's tip of the day: go one commit back for OLD_HASH because it'll miss the first commit of your changes otherwise 👍 #gitTricks
git diff --name-only OLDEST_HASH NEWSEST_HASH > changes.txt