Skip to content

Instantly share code, notes, and snippets.

View Pawan-Bishnoi's full-sized avatar

Pawan Bishnoi Pawan-Bishnoi

  • India
View GitHub Profile
@Pawan-Bishnoi
Pawan-Bishnoi / core.js
Created November 10, 2017 19:18
FabricJS := Send real time data of free hand drawing to remote users
/*
* We keep two canvases to mimic remote user behaviour
* Events from canvas_left should also reach canvas_right
*/
var canvas_left = new fabric.Canvas ('canvas1');
var canvas_right = new fabric.Canvas ('canvas2');
// is_down := keeps track if the mouse is down
// to distinguish mousemove and mousedrag
@Pawan-Bishnoi
Pawan-Bishnoi / longest_pali_string.cpp
Last active August 14, 2017 09:07
FInding longest palindromic substring using DP. Complexity : O(n^2) Space complexity: O(n^2)
/*
* Longest palindromic string
* This is 0n^2 complexity
* space complexity is also 0n^2
* Although a solution with 0n^2 with constant space is also possible */
string longestPalindrome(char *A) {
int **table;
int n = A.length();
int i, j, len;
@Pawan-Bishnoi
Pawan-Bishnoi / paperjs-textarea.js
Created March 20, 2017 12:13
Emulating text tool with paperjs pointText and an HTML textarea element
/**
* Add an textarea, this is to be used as 'the editor'
* We will place it over some pointText that we want to edit
**/
var $anchor = $('body');
$anchor.append ('<textarea class="text-box" maxlength="50"' +
' style="position: absolute; color: black; display:none" type="text">' +
'</textarea>'); // hidden initially
var editor = $anchor.find ('.text-box');