Skip to content

Instantly share code, notes, and snippets.

View mattparlane's full-sized avatar

Matt Parlane mattparlane

View GitHub Profile
@mattparlane
mattparlane / gist:a8c39260f034eedec820
Last active August 29, 2015 14:16
MongoDB/WiredTiger - compress all collections in a database.
colls = db.getCollectionNames();
for (var i = 0; i < colls.length; i++) {
var coll = colls[i];
if (coll.match(/^system/)) continue;
if (coll.match(/_old$/) || coll.match(/_comp$/)) {
db[coll].drop();
continue;
}
wg@wgdev:~$ ~/mongodb/bin/mongorestore -j 1 --drop dump/
2014-11-28T15:34:54.511+1300 building a list of dbs and collections to restore from dump/ dir
2014-11-28T15:34:54.528+1300 reading metadata file from dump/wg/files.metadata.json
2014-11-28T15:34:54.583+1300 restoring wg.files from file dump/wg/files.bson
2014-11-28T15:34:57.528+1300 [........................] wg.files 185998257/6710800085 (2.8%)
2014-11-28T15:35:00.527+1300 [#.......................] wg.files 334784905/6710800085 (5.0%)
2014-11-28T15:35:03.527+1300 [#.......................] wg.files 468518525/6710800085 (7.0%)
2014-11-28T15:35:06.528+1300 [##......................] wg.files 600753676/6710800085 (9.0%)
2014-11-28T15:35:09.528+1300 [##......................] wg.files 734770087/6710800085 (10.9%)
2014-11-28T15:35:12.528+1300 [###.....................] wg.files 868171415/6710800085 (12.9%)
@mattparlane
mattparlane / gist:9824481
Created March 28, 2014 03:11
gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
yaml = require('./js/gulp/regen-yaml.js');
var paths = {
coffee: ['coffee/**/*.coffee', 'coffee/**/*.litcoffee'],
yaml: ['structure.yaml', 'language-strings.yaml'],
};
@mattparlane
mattparlane / gist:9756123
Created March 25, 2014 06:20
done() handler not firing for DELETE request when Content-Type header is set
require 'sinatra'
get '/' do
'
<script src=//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js></script>
<script>
$(function() {
$("a").click(function() {
var url = $(this).data("url");
$.ajax({
@mattparlane
mattparlane / gist:9756121
Created March 25, 2014 06:19
done() handler not firing for DELETE request when Content-Type header is set
require 'sinatra'
get '/' do
'
<script src=//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js></script>
<script>
$(function() {
$("a").click(function() {
var url = $(this).data("url");
$.ajax({