Skip to content

Instantly share code, notes, and snippets.

View kjendrzyca's full-sized avatar
🖖

Krzysztof Jendrzyca kjendrzyca

🖖
View GitHub Profile
@sebmarkbage
sebmarkbage / The Rules.md
Last active June 26, 2024 12:55
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@wilsonchaney
wilsonchaney / config
Created February 23, 2018 16:42
Polybar config - Feb 23
[colors]
background = #222
background-alt = #444
foreground = #dfdfdf
foreground-alt = #555
primary = #FFFFFF
secondary = #e60053
alert = #bd2c40
[bar/example]
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active June 2, 2024 08:51
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@thornbill
thornbill / .gitlab-ci.yml
Created November 22, 2016 21:29
Example Node GitLab CI Yamlfile
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6
before_script:
- npm install
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@brandondurham
brandondurham / styles.less
Last active June 24, 2024 14:48
Using Operator Mono in Atom
/**
* Using Operator Mono in Atom
*
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
*
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png):
@diegoconcha
diegoconcha / redux_egghead_notes.md
Last active January 18, 2022 13:23
Redux Egghead.io Notes

###Redux Egghead Video Notes###

####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.

Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.

####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree

@ctolkien
ctolkien / gist:719c6ce5861c9155289c
Created June 3, 2015 13:00
ASP.Net 5 Gulp + Webpack
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var ts = require('gulp-typescript');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var dnx = require("gulp-dnx");
gulp.task('webpack', function(){
return gulp.src('./src/client/main.ts')
.pipe(webpack({
output:{
@limingjie
limingjie / 256 colors.md
Last active April 24, 2024 22:15
256 colors in putty, tmux/screen and vim

#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.

  • putty

    Set Connection -> Data -> Terminal-type string to xterm-256color

  • tmux

Add this line to ~/.tmux.conf

@gr0uch
gr0uch / CLASS_ANTIPATTERN.md
Last active May 29, 2018 09:44
Reconciling ES6 `class` and constructor anti-pattern.

The use of the new keyword in JavaScript is highly divisive, some say that you should avoid it entirely. ES6 classes may seem at odds with this line of thinking, but I will show how you can have your cake and eat it too. Consider a module that exports a class:

export default class {
  constructor () { /* Do stuff here. */ }
}

The only way to get an instance out of this module, or rather an object that inherits the prototype of the class object, is to use the new keyword, which some consider harmful. Personally, I am not against new, it provides implicit understanding that the returned value is an object with inherited properties.