Skip to content

Instantly share code, notes, and snippets.

[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
@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);
});
@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;
var items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var parent = [];
var size = [];
for (i = 0; i < items.length; ++i){
parent[i] = i;
size[i] = 1;
}
var json = $( "form" ).serializeArray();
$.each( json, function( index, elem ){
$( "[name='" + elem.name + "']" ).val( elem.value );
});
/*
Write a loop that makes seven calls to console.log to output the following triangle:
#
##
###
####
#####
######
#######
*/
/*
Write a program that uses console.log to print all the numbers from 1 to 100,
with two exceptions. For numbers divisible by 3, print "Fizz" instead of the number,
and for numbers divisible by 5 (and not 3), print "Buzz" instead.”
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
*/
for (var n = 1; n <= 100; n++) {
var output = "";
if (n % 3 == 0)
var size = 8;
var board = "";
for (var y = 0; y < size; y++) {
for (var x = 0; x < size; x++) {
if ((x + y) % 2 == 0)
board += " ";
else
board += "#";
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function() {
'use strict';
/**
* T-Rex runner.
* @param {string} outerContainerId Outer containing element id.
* @param {Object} opt_config
* @constructor
var mustache = require("mustache");
var fs = require("fs");
fs.readFile("app/views/index.mustache", function (err, data) {
if (err) throw err;
var output = mustache.render(data.toString(), {});
fs.writeFile('public/index.html', output, function (err) {
if (err) throw err;
});