Skip to content

Instantly share code, notes, and snippets.

View tk120404's full-sized avatar
🎯
Focusing

Arjunkumar tk120404

🎯
Focusing
View GitHub Profile

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array: T[] 🔒 ES3

In this article I will take a very simplistic approach in understanding memory leaks and I will also attempt to diagnose them.

In todays world of abundant memory, we seldom worry about memory leakages. But I hate to tell you that we live in a real world and nothing comes for free.

Oh my fancy functional programming

Disclosure: I absolutely love functional programming. Functional programming is cool and with the new ES6 syntax it becomes even cooler.

@tk120404
tk120404 / nginx-websocket-proxy.conf
Created January 20, 2018 14:46 — forked from uorat/nginx-websocket-proxy.conf
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
@tk120404
tk120404 / decimalAdjust.js
Created March 2, 2017 12:32
decimal Adjustment in javascript
function decimalAdjust(value)
{
value = value.toString().split('e');
value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + 2) : 2)));
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] - 2) : -2));
}
@tk120404
tk120404 / linkedlist.js
Last active October 4, 2016 13:45
LinkedList implemenation in Javascript
var LinkedList = function()
{
this._head = this._tail = null;
this._transverse = null;
this._size = 0;
}
function QEntry(prev, obj, next)
{
if (typeof obj === 'undefined' || obj === null) {
@tk120404
tk120404 / india.js
Last active October 4, 2016 13:23
Prints India Map as shown below in the india.txt node india.js
var a,b=0,c=10,qwer ="TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!";
while ((a = qwer.charCodeAt(b++)) != 0) {
while (a-- > 64) {
require('sys').print( ++c==90 ? String.fromCharCode(c = c/ 9):String.fromCharCode(33^b&1));
}
}
//Source : http://codepad.org/ngiITeZ4
*Handling performance for Progressive Web Apps at scale: Flipkart
PRPL
<link rel="preload">
https://developers.google.com/web/updates/2016/03/link-rel-preload?hl=en
requestAnimationFrame(function(){
performance.mark('first paint')});
https://developers.google.com/web/fundamentals/performance/critical-rendering-path/analyzing-crp?hl=en
First slide: tiny.cc/nxtgen
@tk120404
tk120404 / property.js
Last active December 29, 2015 07:59
Same property names in javascript
var a = {};
console.log(a);
Object {}
a.name = 'Object';
Object.prototype.name = 'Object';
@tk120404
tk120404 / v.js
Last active December 20, 2015 14:28
"v" in javascript
Got "v" from here
http://discogscounter.getfreehosting.co.uk/js-noalnum.php
(+(+[])+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+!+[]+[+[]]]
http://stackoverflow.com/questions/2343557/in-javascript
@tk120404
tk120404 / Answer
Created April 15, 2013 17:59
What is the student_id of the lowest exam score above 65? Mongodb
db.grades.aggregate({ $match : { score : { $gte : 65 }, type:'exam' }}, { $group:{_id:'$student_id',count:{$sum: 1}, score :{ $min:'$score'}}}, {'$sort':{'score':1}}, {'$limit':1});
Mongo Aggregration example http://docs.mongodb.org/manual/tutorial/aggregation-examples/
http://docs.mongodb.org/manual/reference/aggregation/match/