Skip to content

Instantly share code, notes, and snippets.

Noj Vek (Manoj P) nojvek

Block or report user

Report or block nojvek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View words2num.js
const wordsToNumMap = {
zero: 0,
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8,
@nojvek
nojvek / diff_asset_manifests.py
Last active Mar 23, 2019
diff asset manifests
View diff_asset_manifests.py
import codecs
import json
import os
import sys
from os import path
from urllib import urlopen
asset_diff_dir = '/tmp/_asset_diff'
def load_file(file):
@nojvek
nojvek / createElem.js
Created Mar 14, 2019
createEleme - simple dom helper for creating dom nodes
View createElem.js
/**
* A simple helper for creating nested dom tree inspired by snabbdom-jsx syntax
* @param {string} name
* @param {{[attr: string]: any}} attrs
* @param {Array<HTMLElement | string>} children
* @returns {HTMLElement}
*/
export function createElem(name, attrs, children) {
const elem = document.createElement(name);
@nojvek
nojvek / bundler.py
Last active Feb 4, 2019
Bundler interview question
View bundler.py
/**
* **********
* ** TIPS **
* **********
* Please write high level pseudocode approach before writing actual code.
* Use meaningful variables, comments and indent your code.
* Your code should compile, run and produce the correct output.
* Don't need to test extensively but describe what kind of tests you'll add as 'TODO:' comments
* You are totally free to use google and stackoverflow.
* Talk about O(n) CPU and memory requirements. Best case and worst case.
@nojvek
nojvek / Tinder Auto-liker
Last active Jan 25, 2019
Tinder Auto-liker script
View Tinder Auto-liker
<?php
// Licence: WTFPL ! http://www.wtfpl.net/about/
$fbAuth = array("facebook_id" => "123456789", "facebook_token" => "<Use charles proxy to do man-in-middle SSL sniffing and extract fb token>");
// Do the magic.
$tinderToken = tinderCall("auth", "token", $fbAuth); // Authenticate
$authToken = "X-Auth-Token: $tinderToken\r\nAuthorization: Token token=\"$tinderToken\"\r\n";
@nojvek
nojvek / nested_iterator.js
Created Nov 27, 2018
Nested iterator in javascript
View nested_iterator.js
/*
Problem: Write a class that implements the following iterator interface:
bool hasNext()
int next()
The iterator is used to sequentially iterate over a collection. Given an implementation of this iterator MyIterator, its usage can be summarized by the following snippet:
input = [1,2,3]
@nojvek
nojvek / line_counter.js
Created Nov 26, 2018
Count lines by file extension and path and output csv ready to be sql-analyzed
View line_counter.js
/* eslint-env node */
const fs = require(`fs`);
const path = require(`path`);
const filePaths = fs.readFileSync(`${__dirname}/file_list.txt`, `utf-8`).trim().split(`\n`);
console.log(`Total files`, filePaths.length);
for (let i = 0, len = filePaths.length; i < len; ++i) {
const filePath = filePaths[i];
let lines = null;
View backbone-debug.js
var $bbSetElement = Backbone.View.prototype.setElement;
Backbone.View.prototype.setElement = function setElement(element) {
if (this.el && this.el !== element) {
delete this.el.$bbView;
}
const domElem = element.jquery ? element[0] : element;
domElem.$bbView = this;
domElem.setAttribute(`data-backbone-view`, `true`);
return $bbSetElement.apply(this, arguments);
@nojvek
nojvek / tsc watch
Created Jun 18, 2016
tsc watch terminal notifier
View tsc watch
tsc --watch | xargs -L1 -I{} terminal-notifier -message '{}'
View Little Alchemy Cheats
{
"air + air": "pressure",
"air + cloud": "sky",
"air + dinosaur": "pterodactyl",
"air + earth": "dust",
"air + egg": "bird",
"air + energy": "wind",
"air + fire": "energy",
"air + lava": "stone",
"air + life": "bird",
You can’t perform that action at this time.