Skip to content

Instantly share code, notes, and snippets.

Avatar
I may be slow to respond.

Prakhar Srivastav prakhar1989

I may be slow to respond.
View GitHub Profile
View attendance.py
#!/Users/prsrivastav/miniconda3/bin/python3.7
import csv
from dataclasses import dataclass
from datetime import datetime
from typing import List
DATE_FORMAT = "%d-%m-%Y"
View gist:9750df1142ddd6fa88dfcad3a8142c44
❯ npm run test
> react-tag-input@4.8.2 test /Users/prsrivastav/Code/react-tags
> jest --notify --coverage
FAIL test/suggestions.test.js
● Test suite failed to run
TypeError: Cannot read property 'ReactCurrentOwner' of undefined
@prakhar1989
prakhar1989 / uscis.js
Created Dec 16, 2016
OPT status check
View uscis.js
/**
* npm install superagent cheerio
* node index.js <your_case_number>
*/
const request = require('superagent');
const cheerio = require('cheerio');
const URL = "https://egov.uscis.gov/casestatus/mycasestatus.do";
const receipt = process.argv[2];
@prakhar1989
prakhar1989 / replify
Created Aug 19, 2016 — forked from danielrw7/ replify
replify - Create a REPL for any command
View replify
#!/bin/sh
command="${*}"
printf "Initialized REPL for [%s]\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "\n%s> " "$command"
@prakhar1989
prakhar1989 / hacker-rank.ml
Created Jul 28, 2016
Hacker Rank Prologue
View hacker-rank.ml
let (|>) v f = f v;;
let comp f g = (fun x -> f (g x));;
let read_ints () : int list =
let rec aux nums =
try let i = read_int () in aux (i :: nums)
with End_of_file -> nums
in
List.rev (aux [])
;;
@prakhar1989
prakhar1989 / java.md
Last active Apr 18, 2018
Java Reading Notes
View java.md

Java Lambdas and Closures

Chapter 1 - Intro

Google Guava Implementation of cloneWithoutNulls(List)

public static <A> List<A> cloneWithoutNulls(final List<A> list) {
    Collection<A> nonNulls = Collections2.filter(list, Predicates.notNull());
@prakhar1989
prakhar1989 / index.js
Last active Jul 9, 2016
requirebin sketch
View index.js
// Since RequireBin doesn't (yet) support JSX, you'll have to write JS in order
// for this to work. Quick hack: Head to http://babeljs.io/repl, write JSX, copy // paste the compiled JS here.
const React = require('react');
const ReactDOM = require('react-dom');
const ReactTags = require('react-tag-input').WithContext;
const _ = require('underscore');
const countries = require('country-list')();
const suggestions = _.pluck(countries.getData(), 'name');
@prakhar1989
prakhar1989 / bling.js
Created Jun 10, 2016 — forked from paulirish/bling.js
bling dot js
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@prakhar1989
prakhar1989 / core.cljs
Created May 13, 2016 — forked from nasser/core.cljs
rough sketch of reactive svg rendering
View core.cljs
(ns savage.core
(:require-macros [reagent.ratom :refer [reaction]])
(:require [reagent.core :as reagent :refer [cursor atom track track!]]
[reagent.ratom :refer [make-reaction]]
[clojure.set :as set]
[clojure.string :as string]))
(enable-console-print!)
(defn sqrt [x] (.sqrt js/Math x))
You can’t perform that action at this time.