Skip to content

Instantly share code, notes, and snippets.

View dandgerson's full-sized avatar
⚛️
what the actual hell happens in this damn component

Dmitry Anderson dandgerson

⚛️
what the actual hell happens in this damn component
View GitHub Profile
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 5, 2024 15:15
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@rveitch
rveitch / sass-7-1-pattern.scss
Last active April 23, 2024 08:10
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@janily
janily / Breakpoints
Created January 16, 2014 11:36
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@agragregra
agragregra / button.sass
Last active April 2, 2024 12:36
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600
@gaearon
gaearon / minification.md
Last active March 4, 2024 12:45
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

'use strict';
// Требует node.js и пакета mkdirp
// Пакет mkdirp: https://www.npmjs.com/package/mkdirp#install — установить глобально или прописать установку в package.json, в секции devDependencies
// Использование:
// - поместить этот файл в корень проекта
// - исправить пути к генерируемым папкам и файлам, если блоки проекта лежат не в ./src/blocks/
// - в терминале, будучи в корневой папке проекта, выполнить node createBlock.js [имя блока] [доп. расширения через пробел]
const fs = require('fs'); // будем работать с файловой системой
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<?php endwhile; endif; wp_reset_query(); ?>
@Haraldson
Haraldson / usage.js
Last active March 11, 2023 13:53
Lodash useDebounce React Hook
import React, { useState, useEffect } from 'react'
import { useDebounce } from './use-debounce'
const MySearchComponent = props => {
const [search, setSearch, {
signal,
debouncing
}] = useDebounce('')
const [results, setResults] = useState([])