Skip to content

Instantly share code, notes, and snippets.

View roundhill's full-sized avatar
🎮

Dan Roundhill roundhill

🎮
View GitHub Profile
@roundhill
roundhill / mongo-dump-csv.sh
Last active January 11, 2017 23:25 — forked from mderazon/mongo-dump-csv.sh
Export all of Mongodb collections as csv without the need to specify fields
OIFS=$IFS;
IFS=",";
# fill in your details here
dbname=DBNAME-HERE
host=MONGOHOST-HERE
# first get all collections in the database
collections=`./mongo --host=$host $dbname --eval "rs.slaveOk();db.getCollectionNames();"`;
collectionArray=($collections);

API Changes

1.1

  • For the cv command, if the supplied parameter is not formatted properly or we cannot return all the changes from that cursor, the response will now be cv:?. Previously, the server responded with c:?

  • If the server determines the supplied connection credentials are no longer valid, previously the server responded with two messages:

    • auth:expired
    • auth:{"msg":"Token invalid","code":401}
  • Now, the server will only respond in the error case with the second message (the JSON error object).

@roundhill
roundhill / XMLRPCClient.java
Created April 12, 2013 22:12
Async XMLRPC client for WPAndroid
package org.xmlrpc.android;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.SequenceInputStream;
import java.io.StringWriter;
import java.net.URI;
import java.net.URL;
Index: Classes/Page.m
===================================================================
--- Classes/Page.m (revision 3991)
+++ Classes/Page.m (working copy)
@@ -58,16 +58,17 @@
return nil;
}
+ (Page *)findOrCreateWithBlog:(Blog *)blog andPageID:(NSNumber *)pageID {
Page *page = [self findWithBlog:blog andPageID:pageID];
Index: NotificationsViewController.m
===================================================================
--- NotificationsViewController.m (revision 3991)
+++ NotificationsViewController.m (working copy)
@@ -128,6 +128,9 @@
#pragma mark - Public methods
- (void)refreshFromPushNotification {
+ if (IS_IPHONE)
+ [self.panelNavigationController popToRootViewControllerAnimated:YES];
@@ -31,7 +31,7 @@
android:theme="@style/Gravatar">
<activity
android:name=".activity.Login"
- android:label="@string/login"
+ android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="adjustResize">
<intent-filter>
@roundhill
roundhill / gist:2700928
Created May 15, 2012 11:17
Remove junk characters before xml in an InputStream
int bomCheck = -1;
int stopper = 0;
while ((bomCheck = is.read()) != -1 && stopper <= 5000) {
stopper++;
String snippet = "";
//60 == '<' character
if (bomCheck == 60) {
for (int i = 0; i < 4; i++) {
byte[] chunk = new byte[1];
is.read(chunk);