Skip to content

Instantly share code, notes, and snippets.

View ingoradatz's full-sized avatar
🎯
Focusing

Ingo Radatz ingoradatz

🎯
Focusing
View GitHub Profile

Using <details> in GitHub

Suppose you're opening an issue and there's a lot of noisy logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
@ingoradatz
ingoradatz / Ionic Notes.md
Last active September 2, 2015 20:30 — forked from denzildoyle/Ionic Notes.md
Ionic notes: How to get started with Ionic mobile application development framework.

##Getting Started with Ionic Framework

Ionic is a powerful, beautiful and easy to use open source front-end framework built on top of AngularJs (a client-side javascript framework), Sass Syntactically Awesome Style Sheets Apache Cordova for and developing hybrid (cross platform) mobile apps.

Ionic's ultimate goal is to make it easier to develop native mobile apps with HTML5, also known as Hybrid apps.

Install nodejs: http://nodejs.org/

    npm install -g cordova ionic
Verifying I am +llabball on my passcard. https://onename.com/llabball
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
var targetDB = 'db';
var blacklist = ['_design/']
$.couch.db(targetDB).allDocs({'success':function(all_docs){
for (var i = 0; i < all_docs.rows.length; ++i) {
var docId = all_docs.rows[i].id;
if (blacklist.indexOf(docID) === -1) {
$.couch.db(targetDB).openDoc(docId, {'success':function(doc){
$.couch.db(targetDB).removeDoc(doc);
}});
}

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics

#covert an image in the clipboard to a 57x57 rgb icon and store base64 version of it into the clipboard.
#if an image is not in the clipboard the base64 string 'b64str' will be loaded and displayed.
#after running the 1st time replace the contents of b64str with the clipboard.
from PIL import Image
import clipboard
from StringIO import *
import base64
b64str="""

Keybase proof

I hereby claim:

  • I am llabball on github.
  • I am llabball (https://keybase.io/llabball) on keybase.
  • I have a public key whose fingerprint is 85BB DB2D 4FD8 3667 79D3 6B20 697A A803 135D 447F

To claim this, I am signing this object:

var fs = require("fs");
var path = require("path");
var rmdir = function(dir) {
var list = fs.readdirSync(dir);
for(var i = 0; i < list.length; i++) {
var filename = path.join(dir, list[i]);
var stat = fs.statSync(filename);
if(filename == "." || filename == "..") {

Part 1

Proof of concept

Say, you want to save your D3 application in a CouchDB database. This is just a proof of concept that this is possible. I use the »Focus + Context« diagram by Mike Bostock (http://bl.ocks.org/1667367) as an example.

Prerequisites: