Skip to content

Instantly share code, notes, and snippets.

View jayeshcp's full-sized avatar
🏎️

Jayesh Chandrapal jayeshcp

🏎️
View GitHub Profile
@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 / 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

To discard changes in working directory:

git checkout -- < file >

To unstage file:

> git reset HEAD < file >

@jayeshcp
jayeshcp / index.html
Created May 13, 2016 00:09 — forked from anonymous/index.html
JS BinGroupBy example using angular.filter// source http://jsbin.com/vucivacuqa
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.4.7/angular-filter.js"></script>
<meta name="description" content="GroupBy example using angular.filter"/>
<meta charset="utf-8">
@jayeshcp
jayeshcp / curl.md
Created August 25, 2016 00:06
Notes

REST Requests using curl

GET:

curl 
  -X "GET" 
  http://localhost:3000/api
@jayeshcp
jayeshcp / .gitconfig
Created November 9, 2016 14:07
Using WinMerge as Git Diff/Merge tool
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@jayeshcp
jayeshcp / GreetingController.java
Created June 3, 2019 12:25
Spring Custom Annotation to process request body
package hello;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
@jayeshcp
jayeshcp / javascript_questions_with_answers.md
Created June 15, 2020 13:50
Javascript Questions with Answers

JavaScript Questions

1. What's the output?
function sayHi() {
 console.log(name);
@jayeshcp
jayeshcp / k-means-clustering.py
Created October 17, 2020 13:52
K Means Clustering in Python
from numpy import unique
from numpy import where
from matplotlib import pyplot
from sklearn.datasets import make_classification
from sklearn.cluster import KMeans
if __name__ == '__main__':
# initialize the data set we'll work with
training_data, _ = make_classification(
n_samples=2000,
@jayeshcp
jayeshcp / soduku.js
Created October 23, 2020 15:29
Soduku checker
// In this implementation it is assumed that grid is always 9x9
function sudoku2(grid) {
// check rows
for(let row = 0; row < grid.length; row++) {
const numbersMap = new Set();
for(let column = 0; column < grid[row].length; column++) {
if(grid[row][column] === ".") continue;
if (numbersMap.has(grid[row][column])) {
return false;
} else {