Skip to content

Instantly share code, notes, and snippets.

@davisford
davisford / Setup MongoDB on localhost as Replica Set
Last active February 15, 2025 11:17
Setup MongoDB replica set on local host with only a single primary
Add the `replication` section to the mongod.conf file:
```
$cat /usr/local/etc/mongod.conf
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
engine: mmapv1
(use 'clojure.set)
(def data
{:Hailey {"Broken Bells" 4,
"Deadmau5" 1,
"Norah Jones" 4,
"The Strokes" 4,
"Vampire Weekend" 1}
:Veronica {"Blues Traveler" 3,
@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing
@pkuczynski
pkuczynski / LICENSE
Last active November 19, 2025 14:34
Read YAML file from Bash script
MIT License
Copyright (c) 2014 Piotr Kuczynski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@jbro-io
jbro-io / AngularJS: angular-eventutil.js
Last active September 12, 2017 07:37
Global event dispatcher/listener utility for AngularJS
angular.module('EventUtil', [])
.factory('broadcast', ['$rootScope', function($rootScope){
return function(eventName, payload){
$rootScope.$broadcast(eventName, payload);
};
}])
.factory('listen', ['$rootScope', function($rootScope){
return function(eventName, listener){
$rootScope.$on(eventName, listener);
};
@bminer
bminer / express_sessions_socket.io.js
Created September 13, 2011 02:51
Accessing/Manipulating Session Data in Socket.IO (Express + Sessions + Socket.IO)
var express = require('express');
var RedisStore = require('connect-redis')(express);
express.socketio = require('socket.io');
var app = express.createServer();
app.configure(function() {
app.use(express.cookieParser() );
app.sessionStore = new express.session.MemoryStore(); //Not recommended for production use
app.use(express.session({