Skip to content

Instantly share code, notes, and snippets.

View imnuvi's full-sized avatar
🪄
recursing

Ram Prakash Ayyam Perumal imnuvi

🪄
recursing
View GitHub Profile
// this is a side helper class to perform vector calculations, that are useful for certain movement and calculations
function Vector2(x,y){
this.x = (x === undefined) ? 0 : x;
this.y = (y === undefined) ? 0 : y;
}
Vector2.prototype = {
unit: function(){
@imnuvi
imnuvi / double_sort
Created October 26, 2020 17:14
sorting based on different indices
# code to sort a list based on second index
lst = [[1,"e"],[2,"t"],[9,"a"][5,"r"][4,"b"]]
ans = sorted(lst,key=lambda x: (x[1], x[0]))