Skip to content

Instantly share code, notes, and snippets.

View janl's full-sized avatar
🛋️
Drop ICE

Jan Lehnardt janl

🛋️
Drop ICE
View GitHub Profile
module.exports.checkStorage = function () {
try {
global.mozSimpleStorage = require('sdk/simple-storage');
} catch() {
global.mozSimpleStorage = false;
}
if (chrome.storage) { // We're running inside the Chrome/Web Extension context
return 'chromeOrWebExt';
} else if (window.localStorage) { // We're running inside a normal webpage
Title:
Service Orientated Architecture to scale to infinity and beyond
or
Service Orientated Architecture for robust and scalable systems
Proposal:
Software Architecture is hard. And when your business grow, its getting even harder because scaling doesn’t come out the box and it’s not only the software which grows it’s also the team. So you have to find a way how to scale your software in a way that it stays easy maintainable for growing teams and scalable. I’d like to talk about Service Orientated Architecture in general and also share some experience and give some examples where SOA would save your ass and maybe places where SOA isn’t the best idea to implement.
@janl
janl / hu.md
Created November 3, 2013 14:08 — forked from OleMchls/gist:7290586

Title: Service Orientated Architecture to scale to infinity and beyond or Service Orientated Architecture for robust and scalable systems

Proposal: Software Architecture is hard. And when your business grow, its getting even harder because scaling doesn’t come out the box and it’s not only the software which grows it’s also the team. So you have to find a way how to scale your software in a way that it stays easy maintainable for growing teams and scalable. I’d like to talk about Service Orientated Architecture in general and also share some experience and give some examples where SOA would save your ass and maybe places where SOA isn’t the best idea to implement.

# list by how many inhabitants all in all
select district, sum(quantity) from inhabitants group by district order by sum(quantity);
# list by how many women per district
select district, sum(quantity) from inhabitants where gender = 'f' group by district order by sum(quantity);
# list by how many children per district pre-school (0-5)
select district, sum(quantity) from inhabitants where age_low = '0' group by district order by sum(quantity);
# is indeed Prenzlauer Berg the district with the most children implying as many parents as well?
<h1>Maintenance Releases of Apache CouchDB 1.0.4, 1.1.2, and 1.2.1</h1>
<p>The Apache CouchDB project is pleased to announce a set of maintenance releases</p>
<h2>CouchDB 1.0.4</h2>
<ul>
<li>Fix file descriptor leak in _log.</li>
<li>Fix missing revisions in _changes?style=all_docs.</li>
<li>Fix validation of attachment names.</li>
var cradle = require('cradle');
var usersdb = new(cradle.Connection)().database('users');
var documentsdb = new(cradle.Connection)().database('documents');
/*
* GET users listing.
*/
exports.user = getUser;
var cradle = require('cradle');
var usersdb = new(cradle.Connection)().database('users');
var documentsdb = new(cradle.Connection)().database('documents');
/*
* GET users listing.
*/
exports.user = getUser;
@janl
janl / rss-subscribers.sh
Created September 25, 2012 17:11
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/sh -e
# sh for portability, -e for halt on errors
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/var/log/httpd/access_log"
@janl
janl / gist:552288
Created August 26, 2010 21:24 — forked from mikeal/gist:552181

Using CouchDB with node.js

First, get yourself a CouchDB! You can get a free hosted CouchDB in seconds or download a binary from the Couchio downloads page.

Next, install npm because all awesome node packages are in npm :)

Node has better support for HTTP than any language I've ever worked with and coincidentally CouchDB's interface is solely accessible via HTTP. First, let's just talk to CouchDB using an HTTP library and later we'll look at some higher level abstractions.

Talking to CouchDB using request

> rake
(in /Users/jan/Work/mustache.js)
..FFFFFFFFFFFF....FFF.F.FFFFFFFFFF.F.FFFFFFFFFFFFFFFFFFF
1)
'mustache array_of_strings should generate the correct html' FAILED
expected: "hello world \n",
got: "\n hello world \n" (using ==)
./test/mustache_spec.rb:71: