Skip to content

Instantly share code, notes, and snippets.

View boxxxie's full-sized avatar
👙
disrupting absurdism

Paul Iannazzo boxxxie

👙
disrupting absurdism
View GitHub Profile
@boxxxie
boxxxie / gist:3867111
Created October 10, 2012 17:33
success attachment curl PUT
[debug] [<0.1487.8>] 'PUT' /test/test/thumbs/small/181.png?rev=896-7eebd3868fba18653d3e352c48907b3a {1,
1} from "127.0.0.1"
Headers: [{'Accept',"*/*"},
{'Host',"localhost:5984"},
{'User-Agent',"curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"}]
[debug] [<0.1487.8>] OAuth Params: [{"rev",
"896-7eebd3868fba18653d3e352c48907b3a"}]
[info] [<0.1487.8>] 127.0.0.1 - - PUT /test/test/thumbs/small/181.png?rev=896-7eebd3868fba18653d3e352c48907b3a 201
@boxxxie
boxxxie / gist:3867096
Created October 10, 2012 17:30
failed couchdb attachment curl PUT
[info] [<0.1291.8>] 127.0.0.1 - - HEAD /test/test 200
{1,ug] [<0.1292.8>] 'PUT' /test/test/thumbs/small/181.png?rev=895-d11d3854fee8e91b8be879ed79e50192
1} from "127.0.0.1"
Headers: [{'Accept',"*/*"},
{'Host',"localhost:5984"},
{'User-Agent',"curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"}]
[debug] [<0.1292.8>] OAuth Params: [{"rev",
"895-d11d3854fee8e91b8be879ed79e50192\r"}]
[debug] [<0.1292.8>] Minor error in HTTP request: conflict
[debug] [<0.1292.8>] Stacktrace: [{couch_httpd_db,db_attachment_req,4,
#!/bin/bash
# These functions require a CouchDB instance
rawurldecode() {
# This is perhaps a risky gambit, but since all escape characters must be
# encoded, we can replace %NN with \xNN and pass the lot to printf -b, which
# will decode hex for us
@boxxxie
boxxxie / couchdb.sh
Created October 9, 2012 21:06
bash couch stuff
#!/bin/bash
# These functions require underscore-cli (npm install -g underscore-cli)
# a CouchDB instance
#host=$(<~/.couchrc)
host="$1"
couch-get() {
db="$1"
@boxxxie
boxxxie / gist:3820403
Created October 2, 2012 16:00
converting .ape files to .flac with vlc in ubuntu
for ape_file in *.ape; do
file_name="${ape_file%.*}"
vlc "$ape_file" --no-sout-video --sout '#transcode{acodec=flac}:std{access=file,mux=raw,dst='"$file_name.flac" vlc://quit
done
#i know that there is an unclosed bracket, however when i close it it is added to the file name (sometimes). i just don't care. someone fix this if they find it anything useful.
@boxxxie
boxxxie / gist:3796374
Created September 27, 2012 20:46
couch backbone sync
var con,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Backbone.couch_connector = con = {
config: {
db_name: "backbone_connect",
ddoc_name: "backbone_example",
view_name: "byCollection",
var express = require('express');
var app = express();
const port = 8080;
app.get('/explorer', function(req,res) {
var base = 'attachments/explorer_new/';
res.sendfile(base + 'explorer.html');
});
$(document).on("click", "a:not([data-bypass])", function(evt) {
// Get the absolute anchor href.
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
// Get the absolute root.
var root = location.protocol + "//" + location.host + app.root;
// Ensure the root is part of the anchor href, meaning it's relative.
if (href.prop && href.prop.slice(0, root.length) === root) {
// Stop the default event to ensure the link will not cause a page
// refresh.
@boxxxie
boxxxie / gist:3406017
Created August 20, 2012 17:37
my on has a bind and oh my
ideas_view.bindTo(ideas_view,'itemview:delete-idea',
function(view){
var idea = view.model;
idea.set({"#deleted":true});
save_idea_to_db(idea);
idea.on('save', _.bind(ideas_collection.remove, ideas_collection, idea));
});
Request URL:http://mrci.pppaul.me/db/librarian/test2
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Authorization:Basic cHBwYXVsOkVQdGE3TldxUnIxS2pRZTBXaXU3VmNJWkNldnRQRHdodWZwUGdQOGRla1VJRk5DSDdYTVU2dFkxa3E4OHlBTnlZUUVBOEg3cUNDd1NmSld1bUttY2h3bmQxb0xvbXJ4VU9sRWQ=
Connection:keep-alive