Skip to content

Instantly share code, notes, and snippets.

View vkareh's full-sized avatar

Victor Kareh vkareh

View GitHub Profile
@vkareh
vkareh / cradle.patch
Created February 28, 2012 16:31
patch for cradle
diff --git a/lib/cradle.js b/lib/cradle.js
index 7700ff6..db5e2a5 100644
--- a/lib/cradle.js
+++ b/lib/cradle.js
@@ -509,7 +509,9 @@ cradle.Connection.prototype.database = function (name) {
}
if (options && options.keys) {
- this.query('POST', path, {}, options, args.callback);
+ var keys = options.keys;
@vkareh
vkareh / .vimrc
Created January 26, 2012 19:35
Drupal-friendly .vimrc
"Enable filetype detection
:filetype on
"General settings
set incsearch "Find as you type
set ignorecase "Ignore case in search
set scrolloff=2 "Number of lines to keep above/below cursor
set smartcase "Only ignore case when all letters are lowercase
set number "Show line numbers
set wildmode=longest,list "Complete longest string, then list alternatives
@vkareh
vkareh / node-async-json.js
Created November 14, 2014 19:33
Wrapper around JSON.parse and JSON.stringify to make them run asynchronously. Also gets rid of having to use a try/catch on JSON.parse()
module.exports = {};
module.exports.parse = function parse() {
var args = Array.prototype.slice.call(arguments);
var callback = args.pop();
var _this = this;
process.nextTick(function() {
try {
var obj = JSON.parse.apply(_this, args);
return callback.apply(_this, [null, obj]);
@vkareh
vkareh / trello-highlight.js
Last active August 29, 2015 14:07
Highlights Trello cards in which you are a member
setTimeout(function() {
var name = $('.header-user img.member-avatar').attr('title');
$('.js-member-on-card-menu img[title="' + name + '"]').each(function() {
$(this).parents('.list-card-details').css('background-color', '#fcaf3e');
});
}, 2000);
@vkareh
vkareh / noop.js
Created August 15, 2014 18:00
(a)synchronous noop function for node.js
module.exports = function(callback) {
if (callback) {
process.nextTick(callback);
}
}