- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' } | |
*/ |
Prefer functional
, reactive
and declarative programming
instead of imperative programming.
Prefer Test Driven Development to ensure deterministic code base
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ============================================================= | |
" Map Leader | |
" ============================================================= | |
imap ,. <Esc> | |
vmap ,. <Esc> | |
" ============================================================= | |
" Bookmark | |
" ============================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |