Skip to content

Instantly share code, notes, and snippets.

View ivikash's full-sized avatar

Vikash Agrawal ivikash

View GitHub Profile
@ivikash
ivikash / ps4devtools.js
Created November 14, 2017 10:36 — forked from kdzwinel/ps4devtools.js
Gamepad - Chrome DevTools integration
(function(){
let gamepad = null;
let loopInterval = null;
window.addEventListener("gamepadconnected", connectHandler);
window.addEventListener("gamepaddisconnected", disconnectHandler);
function connectHandler(e) {
if (!gamepad) {
@ivikash
ivikash / ps4devtools.js
Created November 14, 2017 10:35 — forked from kdzwinel/ps4devtools.js
Gamepad - Chrome DevTools integration
(function(){
let gamepad = null;
let loopInterval = null;
window.addEventListener("gamepadconnected", connectHandler);
window.addEventListener("gamepaddisconnected", disconnectHandler);
function connectHandler(e) {
if (!gamepad) {
@ivikash
ivikash / unistore.js
Created October 24, 2017 13:59 — forked from developit/unistore.js
dead simple centralized state container ("store"), with preact bindings.
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/

First Time

  • Cache Everything -- NGINX, CDN
  • Use CDN ( and multiple cdn's because generally broswer restricts concurrent connections)
  • Move scripts to body (i.e below the fold)
  • Minimize head tag because this is blocking
  • HTTP/2 - Stream and Push
  • Stream HTML and CSS
  • Use appropriate images
  • Server Side Rendering of First Page
  • Analyze Critical Rendering Path

Tech Stack

Type of Programming

Prefer functional, reactive and declarative programming instead of imperative programming.

Prefer Test Driven Development to ensure deterministic code base

Functional Programming

Ramda is a trusted library to write functional code. This will ensure composibility of functions and testability. Ramda gives you a lot of constructs to ensure that code is concise

git_rebase_onto_master () {
git fetch origin
commitID=`git log origin/master..HEAD --oneline --pretty=format:"%h" | tail -1`
git rebase --onto origin/master $commitID~1 -i --preserve-merges --autosquash
}
@ivikash
ivikash / .ideavimrc
Last active December 17, 2019 09:14
Configuration for ideavim used by IntelliJ editors like PyCharm, WebStorm etc
" =============================================================
" Map Leader
" =============================================================
imap ,. <Esc>
vmap ,. <Esc>
" =============================================================
" Bookmark
" =============================================================
@ivikash
ivikash / Webstorm Keymaps
Created April 14, 2017 08:16
Keymaps and Keycodes for webstorm
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
@ivikash
ivikash / Deep_Learning_functions.py
Created March 16, 2017 12:14
Some basic and important functions for deep learning
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def softmax(x):
return np.exp(x)/np.sum(np.exp(x))
def cross_entropy(y_vector, y_one_hot):
return -np.sum(y_one_hot * np.log(y_vector))
@ivikash
ivikash / hackerrank_javascript_input.js
Created February 27, 2017 12:53
This demonstrates how to take user input in Javascript -- recommended for Hackerrank Challenges / CodePari.
// HACKERANK - JAVASCRIPT INPUT
// start processing user input
process.stdin.resume();
process.stdin.setEncoding('ascii');
// declare global variables
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
// standard input is stored into input_stdin