Skip to content

Instantly share code, notes, and snippets.

View ingoradatz's full-sized avatar
🎯
Focusing

Ingo Radatz ingoradatz

🎯
Focusing
View GitHub Profile
@ingoradatz
ingoradatz / index.js
Created September 17, 2013 05:55 — forked from max-mapper/index.js
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

(function(){
var currentETag;
onLoad(function pageLoaded() {
console.log('starting live reload');
if (window.EventSource) return eventsource();
else setInterval(polling, 1500);
});
1) have the couchdb source available, geocouch needs some headerfiles
2) get and unpack the appropriate branch of geocouch suited for your couchdb version -
I have 1.3.0 so I got
https://github.com/couchbase/geocouch/tree/couchdb1.3.x
3) set environment:
export COUCH_SRC=/WHEREVER/apache-couchdb-1.3.0/src/couchdb/
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
sub usage { die "usage: git-large-blob <size[b|k|m]> [<git-log arguments ...>]\n" }
@ARGV or usage();
my ( $max_size, $unit ) = ( shift =~ /^(\d+)([bkm]?)\z/ ) ? ( $1, $2 ) : usage();
// Short module explanation // Something to gather my thoughts
// // I think this looks cool.
//
module.exports = the_exported_function // Modules are a function. Always.
//
module.exports.extra = extra // Additional API entry points if
module.exports.other = other // desired.
//
var util = require('util') // Other packages from npm or core
var assert = require('assert') // No comma-first due to lots of
@ingoradatz
ingoradatz / index.js
Created November 27, 2012 06:10 — forked from max-mapper/index.js
link to lat/lon in native maps app on ios and android from webview (phonegap)
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon
// assumes you have zepto and zepto.detect loaded
// also you should use target=_blank on your <a> tags
@ingoradatz
ingoradatz / simple-file-attachment-for-couchdb.html
Created November 17, 2012 17:43 — forked from rjcorwin/simple-file-attachment-for-couchdb.html
A very basic example in Javascript of how to attach a file to a CouchDB document. This will work wether or not the Document ID you define exists.
<!DOCTYPE html>
<! --
A very basic example in Javascript of how to attach a file to a CouchDB document. This will work wether or not the Document ID you define exists.
Log in at /_utils, upload this file to a document, and then view it for your own uploader. See the code for comments. ajaxSubmit() is the magic that attaches
as long as the Couch Doc exists because you can't submit a new Couch Document with an attachment.
by @rjsteinert http://rjsteinert.com
-->
<html xmlns="http://www.w3.org/1999/xhtml">
@ingoradatz
ingoradatz / proxy.sh
Created September 12, 2012 07:31 — forked from mafo5/proxy.sh
npm/proxy skript
#!/bin/sh
proxy=proxy.clust:3128
export http_proxy=http://$proxy
export https_proxy=http://$proxy
export ftp_proxy=http://$proxy
export socks_proxy=http://$proxy
export no_proxy="127.0.0.1,localhost"
@ingoradatz
ingoradatz / README.markdown
Created July 23, 2012 18:31 — forked from rn0/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is an extension to Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string