This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'); |