Skip to content

Instantly share code, notes, and snippets.

@jareware
jareware / SCSS.md
Last active October 12, 2024 17:11
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@JoshBarr
JoshBarr / Carousel.js
Last active January 20, 2019 23:21
Flickity React integration
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@jacob-beltran
jacob-beltran / requestAnimationFrame.js
Last active April 17, 2020 04:05
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
@mxstbr
mxstbr / Component.js
Last active August 24, 2021 20:26
styled-components ❤ tachyons
// There's two ways to use Tachyons together with styled-components
// Both are valid, which one you use depends if you want to always apply a tachyons class when a certain component
// is rendered or if you want to apply it for specific instances.
// 1. Use .attrs to define classNames that should always be applied to a styled component
// Whenever you use <Component /> now it'll have both the styled-components as well as the Tachyons class
// See the docs for more info: https://www.styled-components.com/docs/basics#attaching-additional-props
const Component = styled.div.attrs({
className: 'bw0-l',
})`
@baptistebriel
baptistebriel / gist:29e761fbc7cc5923cf6b99444a2935c4
Created August 9, 2017 17:44
compress mp4 video using ffmpeg
// http://ericholsinger.com/install-ffmpeg-on-a-mac
ffmpeg -i input.mp4 -vcodec h264 -acodec mp3 output.mp4
@ayamflow
ayamflow / numbers.css
Created February 15, 2018 18:06
Prevent animated counters numbers to shift
font-feature-settings: "tnum";
font-variant-numeric: tabular-nums;
@bjoerge
bjoerge / translate.js
Last active April 21, 2021 23:01
Translate all locale strings with missing translations in a Sanity dataset - https://sanity.io
/* eslint-disable no-console */
import client from 'part:@sanity/base/client'
import reduce from 'json-reduce'
// see https://github.com/sanity-io/sanity/blob/next/packages/example-studio/schemas/languages.js for an example
import {SUPPORTED_LANGUAGES} from '../schemas/languages'
import Translate from '@google-cloud/translate'
const translateAPI = new Translate({
@ayamflow
ayamflow / update.js
Created June 20, 2018 23:21
Threejs - Rendering 2 scenes on top of each other without breaking render targets
// Need to toggle the autoClear flag to avoid breaking rendering to RenderTarget
function update(dt) {
renderer.render(scene, camera);
renderer.autoClear = false;
renderer.clearDepth();
renderer.render(orthoScene, orthoCamera);
renderer.autoClear = true;
}
////////////////////////////////////////////////////////////////////////////////
// Create a directory called "pages" next to
// this file, put markdown files in there, and
// then run:
//
// ```
// $ node build.mjs
// ```
//
// Then deploy the "build" directory somewhere.