Skip to content

Instantly share code, notes, and snippets.


Victor Kareh vkareh

  • Red Hat
  • Quebec, Canada
View GitHub Profile
View .gitconfig
ui = true
default = simple
editor = vim
excludesfile = ~/.gitignore
autocrlf = input
lineNumber = true
vkareh / commicrosoftteams.desktop
Last active Sep 10, 2022
Put this file in `~/.local/share/applications/`
View commicrosoftteams.desktop
[Desktop Entry]
Name=Microsoft Teams
Exec=webapp-container --webappUrlPatterns=https?://*.microsoft*.com/* --app-id=commicrosoftteams --name="Microsoft Teams" --icon=~/.local/share/applications/commicrosoftteams.ico --store-session-cookies --enable-media-hub-audio --user-agent-string="Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
[Desktop Action teams]
View .ctags
--regex-Css=/^[ \t]*(.+)[ \t]*\{/\1/f,functions/
--regex-Css=/^[ \t]*(.+)[ \t]*,[ \t]*$/\1/f,functions/
--regex-Css=/^[ \t]*([#.]*[a-zA-Z_0-9]+)[ \t]*$/\1/f,functions/
vkareh / dbFields.js
Last active Dec 3, 2021
MongoDB script that returns a flattened list of all fields ever used on a specific collection
View dbFields.js
// Return a flattened list of all fields ever used on a MongoDB collection.
// Usage: `mongo --quiet <database> dbFields.js`
// Collection for which to get fields
var collection = 'users';
// Determines how to represent the keys of an array of objects.
// This allows for differentiating between nested objects and nested arrays of objects.
// e.g. for a document
vkareh / node-async-json.js
Created Nov 14, 2014
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()
View node-async-json.js
module.exports = {};
module.exports.parse = function parse() {
var args =;
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 / trello-highlight.js
Last active Aug 29, 2015
Highlights Trello cards in which you are a member
View trello-highlight.js
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 / noop.js
Created Aug 15, 2014
(a)synchronous noop function for node.js
View noop.js
module.exports = function(callback) {
if (callback) {
View indexOf.js
if (!('indexOf' in Array.prototype)) {
Array.prototype.indexOf= function(find, i) {
if (i===undefined) i= 0;
if (i<0) i+= this.length;
if (i<0) i= 0;
for (var n= this.length; i<n; i++)
if (i in this && this[i]===find)
return i;
return -1;
vkareh / passport-drupal-middleware.js
Last active Dec 19, 2015
passport-drupal express middleware
View passport-drupal-middleware.js
var passport = require('passport')
, express = require('express')
, app = express();
// Passport session setup.
passport.serializeUser(function(user, done) {
done(null, user);
passport.deserializeUser(function(user, done) {
done(null, user);
vkareh / console.js
Last active Dec 18, 2015
console.log() of object snapshots... needs jQuery
View console.js
var consoleLog = console.log;
console.log = function() {
consoleLog.apply(this, $.map(arguments, function(obj) {
return $.isPlainObject(obj) ? $.extend(true, {}, obj) : obj;