Skip to content

Instantly share code, notes, and snippets.

View peizguo's full-sized avatar

Peizong Guo peizguo

View GitHub Profile
@peizguo
peizguo / NumberExtension.js
Last active September 26, 2017 15:26
JavaScript Number Extension for more object-oriented expression
(function(global) {
"use strict";
let log = global.console && global.console.log || function(){};
function extend(target, source) {
for(var prop in source) {
if(source.hasOwnProperty(prop)) {
if(typeof(target[prop]) !== "undefined") {
target["_origin_" + prop] = target[prop];
@peizguo
peizguo / mongodb_collection_sizes.js
Created September 25, 2017 16:08 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.