Skip to content

Instantly share code, notes, and snippets.

View bvenkatr's full-sized avatar
🏠
Working from home

Venkat bvenkatr

🏠
Working from home
View GitHub Profile
// this script will copy all AQL user functions from the _system database of an ArangoDB server
// into all other databases of the server. Database names and authentication credentials must
// be specified in the script in the "databases" variable
//
// invoke the script from ArangoShell like this:
// require("internal").load("copy-aqlfunctions.js");
(function () {
var db = require("org/arangodb").db;
var print = require("internal").print;
@bvenkatr
bvenkatr / app.coffee
Last active August 29, 2015 14:12 — forked from csexton/app.coffee
app = angular.module('angularjs-starter', [])
app.controller 'MainCtrl', ($scope) ->
$scope.name = 'World'
angular.bootstrap(document, ['angularjs-starter'])
Chrome Developer Tools: Search or navigate to files, methods or line numbers. Shortcuts for text search and beyond
The ability to quickly find or navigate to specific files, methods or line numbers in an web app can be important in your day to day workflow in the Chrome DevTools. Today we've got some useful tips to help with these when working in the Sources panel.
To search scripts, stylesheets and snippets by filename you can use:
* Ctrl + O (Windows)
* Cmd + O (Mac OSX)
To perform a text search within the current file you can use:
For Italic
*text* OR _text_
For Bold
**text** OR __text__
For both italic and bold
**_text_** or you can do above multiple combinations
For headers
#text
##text
.
@bvenkatr
bvenkatr / promise-example.js
Last active March 31, 2016 06:05
Basic promises using es6 promises
'use strict';
var fs = require('fs');
var request = require('request');
var d = new Promise(function(resolve, reject){
var result = [];
[1,2].forEach(function(item, index){
request.post(
'your_comple_post_url',
{ form: { key: 'value'} },// These are body parameters
var numbers = [1,2,3,4,5];
for(var i in numbers){
(function(){
var j = i;
setTimeout(function(){
console.log(j);
}, 2000);
})();
}
@bvenkatr
bvenkatr / jsbin.yecewaj.js
Created February 25, 2017 06:51 — forked from nsisodiya/jsbin.yecewaj.js
Promise Based processing with Array. sequentialProcess and parallelProcess
//Author - Narendra Sisodiya - http://narendrasisodiya.com
//WHeN to use ? when async result from One Element is needed in another.
var sequentialProcess = function(arr, callback){
var pp = Promise.resolve();
arr.forEach(function(v, i, A){
pp = pp.then(function(){
return callback(v, i, A);
});
@bvenkatr
bvenkatr / .babelrc
Created March 13, 2017 09:36 — forked from thejmazz/.babelrc
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
setInterval(function() {
console.log("foo");
while (true) {
}
}, 1000);
setInterval(function() {
console.log("bar");
}, 1000);
'use strict';
module.exports = function (Todos) {
Todos.validatesLengthOf('text', {min: 5, message: {min: 'text is too short'}});
//create a test remote method and do field validations using Validate object
Todos.saveTodosData = function (text, done, cb) {