Skip to content

Instantly share code, notes, and snippets.

View sagarjhaa's full-sized avatar
🎯
Focusing

Sagar Jha sagarjhaa

🎯
Focusing
  • Stanford University School of Medicine
  • Palo Alto, California
View GitHub Profile
@sagarjhaa
sagarjhaa / canvas_drawing.js
Created April 7, 2019 03:15
How to draw using canvas
var mousePressed = false;
var lastX, lastY;
var ctx;
var li = [];
function Draw(x, y, isDown) {
if (isDown) {
ctx.beginPath();
ctx.strokeStyle = $('#selColor').val();
ctx.lineWidth = $('#selWidth').val();
@sagarjhaa
sagarjhaa / reactComponentTemplate.js
Last active May 2, 2019 18:06
React component template
import React, { Component } from 'react';
import { connect } from 'react-redux';
class TemplateComponent extends Component {
constructor(props) {
super(props);
}
render() {
return (
@sagarjhaa
sagarjhaa / split_file.py
Created November 11, 2019 16:53
How to split large json file into multiple files.
import json
import datetime
import multiprocessing
SPLIT_SIZE = 100000
OUTPUT_FILE_NAME = 'output_file_'
print('started reading file....'+str(datetime.datetime.now()))
file = open('event_export_customer.json','r')
data = json.load(file)
print('finish reading file....' + str(datetime.datetime.now()))
@sagarjhaa
sagarjhaa / lead_macro.vba
Last active November 12, 2019 20:32
Example of macro for excel.
Option Explicit
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
@sagarjhaa
sagarjhaa / gist:cedb70c5b06d1bfb217545b2c75e30e9
Created November 18, 2019 21:44 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@sagarjhaa
sagarjhaa / View your redmines
Created March 6, 2020 00:23
python script to list all your redmines for a year
import requests
from datetime import datetime
from collections import defaultdict
def get_redmines(username,password,redmineurl,projectname):
response = None
url = """https://{}:{}@{}/projects/{}/issues.json?utf8=✓s
'&limit=1000
'&set_filter=1
'&sort=assigned_to,id:desc
@sagarjhaa
sagarjhaa / closure.js
Created April 14, 2020 22:04
Gist on understanding closures - Javascript
// http://csbin.io/closures
// Type JavaScript here and click "Run Code" or press Ctrl + s
console.log('Hello, world!');
// CHALLENGE 1
function createFunction() {
return function(){
console.log('hello');
}
}
@sagarjhaa
sagarjhaa / Async.js
Created April 15, 2020 00:14
How to work with Async
// http://csbin.io/async
/*
-Async functions calls methods in browser.
-They reutrn a promise.
-Once promise is resolved or rejected the methods related to .then are called.
-This methods are put in the micro-queue which the event loop check after the global space is cleared and before checking
the callback queue.
|---> Global Space (stack
|
|