Skip to content

Instantly share code, notes, and snippets.

View imlucas's full-sized avatar
⚒️

Lucas Hrabovsky imlucas

⚒️
View GitHub Profile
/**
* @param {mongodb#Database} db
* @param {String} ns `${db}.${collection}` See http://npm.im/mongodb-ns
* @param {String} name - The index name to get progress on.
*
* @see https://docs.mongodb.com/v3.0/reference/method/db.currentOp/#active-indexing-operations
*/
function getIndexBuildProgress(db, ns, name) {
/**
* TODO (imlucas) Update query to constrain on `name`.
const CHANNELS = [
{
/**
* This is available from the mongodb.com download center.
*/
id: 'stable',
name: 'MongoDB Compass',
version: '1.0.0',
productVersion: '1.0.0' // <- What's displayed to the user.
},
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.tlsd = macgap.app.host(); // top level slack domain
var destination = 'https://'+tlsd+'/ssb';
macgap.teams.updateTitleBarColor("#ffffff");
</script>
<title>Slack</title>
<style>
var LessCache = require('less-cache');
var dest = path.join(CONFIG.resources, 'app', 'less-compile-cache');
var src = path.join(CONFIG.resources, 'app', 'index.less');
var lessCache = new LessCache({
cacheDir: dest,
resourcePath: path.join(CONFIG.resources, 'app'),
importPaths: []
});
var asar = require('asar');
function createApplicationAsar(CONFIG, done) {
var opts = {
// ordering: path.resolve(__dirname, '..',
// 'resources', 'asar-ordering-hint.txt'),
unpack: '{' + [
'*.node',
'**/vendor/**'
].join(',') + '}'
};
@imlucas
imlucas / ampersand-collection-pipe.js
Last active October 20, 2015 21:38
piping ampersand.js collections
var View = require('ampersand-view');
var Base = require('../models/connection-collection');
var debug = require('debug')('connect:multi-collection-example');
var ConnectionCollection = Base.extend({
initialize: function(models, options){
options = options || {};
Base.prototype.initialize.call(this, models, options);
},
pipe: function(dest){
socket.io-stream:socket read: "f0491280-248d-4b6c-8da1-70939396ea7b" +9ms
mongodb-collection-sample has native $sample? +2ms false
mongodb-collection-sample:reservoir-sampler using query `{"_id":{"$oid":"560061ed4d9d6a0000e45474"}}` +1ms
/Users/lucas/scout-ci/scout-server/node_modules/mongodb/lib/utils.js:98
process.nextTick(function() { throw err; });
^
MongoError: unknown operator: $oid
at Function.MongoError.create (/Users/lucas/scout-ci/scout-server/node_modules/mongodb-core/lib/error.js:31:11)
at /Users/lucas/scout-ci/scout-server/node_modules/mongodb-core/lib/topologies/server.js:754:66
@imlucas
imlucas / nix.sh
Created August 4, 2015 16:17
Adhoc node.js installs
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash;
source ~/.profile;
nvm use 0.12.7;
npm install -g node-gyp;
@imlucas
imlucas / osx-computer-name.js
Last active August 29, 2015 14:26
How to get "Computer Name"
// Using the node -> objective-c bridge
var $ = require('nodobjc');
var pool = $.NSAutoreleasePool('alloc')('init');
$.framework('Foundation');
var host = $.NSHost('currentHost');
var name = host('name');
console.log('NSHost.currentHost.name: `%s`', name);
// -> NSHost.currentHost.name: `lucas-macbook-pro.local`