Skip to content

Instantly share code, notes, and snippets.

@nailkhasipov
nailkhasipov / quick-find.js
Created September 15, 2015 19:10
Quick-find implementation of Princeton Union-Find algorithm on JavaScript
var items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var id_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var union = function (p, q) {
var pId = id_array[p];
var qId = id_array[q];
if (items[p] === items[q]) {
return;
@nailkhasipov
nailkhasipov / gist:5686588
Last active December 17, 2015 23:09
AngularJS directive for contenteditable that clear clipboard data on paste event
app.directive('contenteditable', function () {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
// clear paste data
elm.bind('paste', function(e){
setTimeout(function() {
scope.$apply(function() {
ctrl.$setViewValue(e.target.innerText);
});
[debug] application - Got dbo: { "className" : "com.mls.iapi.SetStoryCoverRequest" , "params" : { "className" : "com.mls.iapi.SetStoryCover" , "storyId" : { "$oid" : "512f5c7103641c73a5397c63"} , "newCover" : { "$oid" : "512f3b2c44ae322f6b49c82f"}}}
[debug] application - Skipping conversion of `effectiveAccountId` field
[debug] application - Restored dbo to request { "effectiveAccountId" : null , "params" : { "storyId" : { "$oid" : "512f5c7103641c73a5397c63"} , "newCover" : { "$oid" : "512f3b2c44ae322f6b49c82f"} , "className" : "com.mls.iapi.SetStoryCover"} , "className" : "com.mls.iapi.SetStoryCoverRequest"}
[debug] application - Account in session: { "birthday" : null , "emailVerified" : false , "location" : null , "email" : "[email protected]" , "master" : true , "accountName" : "Noel" , "_id" : { "$oid" : "512f5c5503641c73a5397c50"} , "discoverable" : true , "ACL" : { } , "siteURL" : null , "lastName" : null , "firstName" : null , "phoneVerified" : false , "nikname" : null , "className" : "com.ml