Skip to content

Instantly share code, notes, and snippets.

@leandrowd
leandrowd / clean_code.md
Created November 25, 2022 06:53 — 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

@leandrowd
leandrowd / carousel-videos.js
Created September 14, 2016 10:36
carousel-videos
@leandrowd
leandrowd / vertical-carousel.js
Last active January 7, 2016 10:22
vertical-carousel
@leandrowd
leandrowd / carousel.js
Last active February 28, 2023 06:18
carousel
@leandrowd
leandrowd / clean-carousel.js
Last active January 7, 2016 10:20
clean-carousel
@leandrowd
leandrowd / demo-swiper.js
Last active January 29, 2017 08:27
Demo React Easy Swipe
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import Swipe from './react-swipe';
class MyComponent extends Component {
onSwipeStart(event) {
console.log('Start swiping...', event);
}
onSwipeMove(position, event) {
@leandrowd
leandrowd / demo-slider.js
Last active November 21, 2015 06:45
React responsive carousel - Slider example
// https://www.npmjs.com/package/react-responsive-carousel
var React = require('react');
var ReactDOM = require('react-dom');
var Carousel = require('react-responsive-carousel').Carousel;
var DemoSliderControls = function(){
return (
<Carousel type="slider" showControls={true} showStatus={true}>
<img src="assets/1.jpeg" />
<img src="assets/2.jpeg" />
@leandrowd
leandrowd / demo-gallery.js
Last active November 21, 2015 06:45
React responsive carousel - ImageGallery example
@leandrowd
leandrowd / demo-carousel-thumbs.js
Last active November 21, 2015 06:46
React responsive carousel - Carousel (only thumbs) example
@leandrowd
leandrowd / hijack-jquery-on.js
Last active August 29, 2015 14:25
Hijacking $.on to add namespace to every event
var oldFnOn = $.fn.on;
$.fn.on = function( types, selector, data, fn ) {
var currentType = types;
// 'click' will became 'click.plugin'
// 'click.deep' will became 'click.plugin.deep'
function addNamespace(type) {
var namespacedType = type.split('.');
namespacedType.splice(1, 0, 'plugin');
return namespacedType.join('.');
};