Skip to content

Instantly share code, notes, and snippets.

function fun1() {
setTimeout(function () { //normal
console.log("normal (setTimeOut)", this);
}, 0);
}
function fun2() {
setTimeout(() => { //arrow
console.log("arrow (setTimeOut)", this);
}, 0);
@ritwickdey
ritwickdey / AppletDemo.java
Last active November 25, 2017 03:41
Everything in one place - Applet Life Cycle, Parameter Passing ,Drawing, ButtonEvent, MouseEvent & DialogBox
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
<applet code="AppletDemo" width="320" height="320">
<param name="myName" value="ritwick dey"/>
</applet>
*/
@ritwickdey
ritwickdey / Sorts.c
Last active November 29, 2017 07:02
Few Sorts in one place : Bubble Sort, Selection Sort, Insertion Sort, Marge Sort, Quick Sort, Heap Sort
/*
---------------------
Bubble Sort,
Selection Sort,
Insertion Sort,
Marge Sort,
Quick Sort,
Heap Sort
----------------------
*/
@ritwickdey
ritwickdey / JobScheduling.c
Created November 28, 2017 15:48
JobScheduling Algorithm (Greedy Approach) implemented with C
#include <stdio.h>
#include <stdlib.h>
typedef struct job
{
int id;
int deadLine;
float profit;
int isPossible;
} job;
@ritwickdey
ritwickdey / Fractional_Knapsack.c
Created November 28, 2017 16:47
Fractional Knapsack (Greedy Approach) is implemented with C language
#include <stdio.h>
#include <stdlib.h>
typedef struct Item
{
int itemId;
int weight;
int profit;
float pByw; // profit/weight
float xi;
@ritwickdey
ritwickdey / gist:72c3e68a2366b57188a50b1a552c4190
Created December 21, 2017 11:05 — 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:
@ritwickdey
ritwickdey / ExampleOfDependencyInjection.cs
Last active January 10, 2018 10:42
Example Of Dependency Injection in C#. (BTW, I'm not 100% sure :p )
namespace SomeNamespace
{
public interface ITest
{
void hello();
}
//NO Singleton Class, Simple One.
public class Test1 : ITest
{
@ritwickdey
ritwickdey / face-detection-chrome-api.js
Last active December 1, 2023 12:27
Face Detection using Google Chrome API (Experimental)
const detectFace = () => {
if(!window.FaceDetector) return console.log('Unsupported Version or Feature is not enabled')
const img = document.querySelector('#targetImg');
const faceDetector = new FaceDetector();
const scale = img.width / img.naturalWidth;
faceDetector
.detect(img)
.then(faces =>
faces.map(face => face.boundingBox)
)
@ritwickdey
ritwickdey / GetRandomColorWithRandomOpacity.js
Last active August 6, 2018 09:30
Get Random Color with Random Opacity (Useful for Charts)
const hexColors = [
'#3366CC',
'#DC3912',
'#FF9900',
'#109618',
'#990099',
'#3B3EAC',
'#0099C6',
'#DD4477',
'#66AA00',
{
"eslint.autoFixOnSave": true,
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "One Dark Pro",
"editor.fontSize": 14,
"window.zoomLevel": 0,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [