Skip to content

Instantly share code, notes, and snippets.

View carusog's full-sized avatar
📚
Learning something new

Giuseppe Caruso carusog

📚
Learning something new
View GitHub Profile
@carusog
carusog / clean_code.md
Created October 9, 2023 09:03 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

<link rel="shortcut icon" width=32px>
<canvas style="display: none" id="loader" width="16" height="16"></canvas>
<script>
class Loader {
constructor(link, canvas) {
this.link = link;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.context.lineWidth = 2;
@samselikoff
samselikoff / cloudSettings
Last active January 10, 2024 21:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-01T19:06:41.818Z","extensionVersion":"v3.4.3"}
@WebReflection
WebReflection / why-i-use-web-components.md
Last active December 5, 2023 17:47
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@LeaVerou
LeaVerou / dabblet.css
Last active July 2, 2018 13:28
Marching ants selection
/**
* Marching ants selection
*/
rect {
stroke: black;
stroke-width: 2px;
stroke-dasharray: 5px 3px;
animation: marching-ants .6s linear infinite;
fill: none;
@igor-arkhipov
igor-arkhipov / dabblet.css
Created December 3, 2016 04:11 — forked from csssecrets/dabblet.css
Marching ants border
/**
* Marching ants border
*/
@keyframes ants { to { background-position: 100% 100% } }
div {
padding: 1em;
border: 1px solid transparent;
background: linear-gradient(white, white) padding-box,
@thevangelist
thevangelist / convert-to-kebab-case.js
Created September 21, 2016 10:11
JS: convert to kebab-case
const convertToKebabCase = (string) => {
return string.replace(/\s+/g, '-').toLowerCase();
}
@kellishouts
kellishouts / gulp_sass_livereload.md
Last active January 24, 2022 06:40
Gulp + Sass + LiveReload 1.0

Gulp + Sass + LiveReload

This Gist goes over setting up a gulp workflow that will:

  1. watch for any sass changes, then compiles sass source into css
  2. watch for any changes in the public directory, and trigger live-reload
  3. serve static content in public/

@salcode
salcode / .gitignore
Last active July 10, 2024 14:28
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');