Skip to content

Instantly share code, notes, and snippets.

View jayeshcp's full-sized avatar
🏎️

Jayesh Chandrapal jayeshcp

🏎️
View GitHub Profile

To discard changes in working directory:

git checkout -- < file >

To unstage file:

> git reset HEAD < file >

@jayeshcp
jayeshcp / singleton.js
Created May 3, 2016 21:33
Javascript: Singleton Pattern
var mySingleton = (function () {
// Instance stores a reference to the Singleton
var instance;
function init() {
// Singleton
// Private methods and variables
@jayeshcp
jayeshcp / Template001.md
Last active April 30, 2016 17:03
Ionic Templates

Basic list template with button at the bottom

Screenshot:

screenshot 2016-04-30 12 36 35

Code:

HTML:

@jayeshcp
jayeshcp / index.html
Created April 16, 2016 21:48
Responsive Grids
<div class="col-12">
<h1>Header</h1>
</div>
<div class="col-3">
<ul>
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
@jayeshcp
jayeshcp / QueryBoard.java
Last active September 22, 2015 11:53
Basic jUnit Test Case
/**
* Sample class file for above unit tests
*/
public class QueryBoard {
int[] nums;
QueryBoard() {
nums = new int[10];
}
@jayeshcp
jayeshcp / barchartinR.md
Last active August 29, 2015 14:22
Plotting simple bar chart in T

Script:

# Read table data from csv file
data <- read.table("data.csv", header=T, sep=",")

# Start PDF device driver to save output to skills.pdf
pdf(file="skills.pdf", height=3.5, width=5)

# Draw bar chart

Tech Interview Cheat Sheet

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. Originally forked from Tristan Siegel's Gist.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@jayeshcp
jayeshcp / ConvertSec2DaysHoursMinsSecs.java
Last active September 22, 2015 12:00
Convert seconds to Days, Hours, Mins, Secs
public static void ConvertSec2DaysHoursMinsSecs(int timeDiff) {
int days = (int) Math.floor(timeDiff / 86400);
int hour = (int) Math.floor((timeDiff % 86400) / 3600);
int min = (int) Math.floor((timeDiff % 3600) / 60);
int sec = (int) (timeDiff % 60);
System.out.println("(" + days + " " + hour + " " + min + " " + sec + ")");
}
@jayeshcp
jayeshcp / Unit Testing in Python.md
Last active April 4, 2016 15:37
Unit Testing in Python
  • A testcase is created by subclassing unittest.TestCase.
  • Individual tests are defined with methods whose names start with the letters "test". This naming convention informs the test runner about which methods represent tests.
  • Following is a typical example of unit test:
# PythonUnitTest.py

import unittest

class Sort(unittest.TestCase):
    def setUp(self):