Skip to content

Instantly share code, notes, and snippets.

module.exports = {
entry: './src/index.js'
}
alias c="code"
alias d="docker"
alias gs="git status"
alias gl="git pull --rebase up"
alias gh="git push origin"
alias gr="git remote -v"
alias gc="git checkout"
alias gm="git commit -m"
alias gmm="git commit --amend"
@dhruvdutt
dhruvdutt / react.jsx
Last active June 10, 2018 19:30
React - optimise creation of new functions in render
class SayHi extends Component {
// We can't use showMessage directly because it creates
// a new event handler every time you call it.
showMessage = (msg) => (e) => {
console.log(`Say ${msg}`, e)
}
// So instead, we need to create the event handlers beforehand,
// then call those inside of `render`.
showHiMessage = this.showMessage('Hi')
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && (boot-repair &)
boot-repair
import HomePage from './HomePage.jsx';
import AboutPage from './AboutPage.jsx';
import UserPage from './UserPage.jsx';
import FourOhFourPage from './FourOhFourPage.jsx';
const PAGES = {
home: HomePage,
about: AboutPage,
user: UserPage,
};
// @define: Number of circles
const NO_OF_CIRCLES = 3;
// @define: All available colors
const ALL_COLORS = ["SlateBlue", "LightSteelBlue", "Crimson", "SeaGreen", "DarkMagenta", "DarkOrange", "DarkCyan", "SlateGray"];
class Hello extends React.Component {
constructor(props) {
super(props);
@dhruvdutt
dhruvdutt / linux_boot_process.md
Last active July 28, 2017 07:44
Linux Boot Process

1. BIOS or UEFI

2. MBR or GPT

1st sector of bootable disk. /dev/hda or /dev/sda

3. Bootloader

GRUB or Windows boot loader. Or custom bootloaders like Clover & Chameleon Detects multiple kernel images, has knowledge of file-system

@dhruvdutt
dhruvdutt / app.js
Created May 10, 2017 10:56
$q Promise Examples - Parallel & Chaining http://embed.plnkr.co/dkp507/
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('MainCtrl', function($scope, $q) {
$scope.text = '';
$scope.chain = false;
$scope.progressbars = [];
$scope.useQ = false;
var count = 1;
var currentPromise = null;
@dhruvdutt
dhruvdutt / flexbox-cheatsheet.md
Created May 6, 2017 09:41
flexbox-cheatsheet
display: flex

// Main Axis
flex-direction: row (default), row-reverse, column, column-reverse

// Main Axis Alignments / Spacing
justify-content: flex-start (default), flex-end, space-around, space-between
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };