Skip to content

Instantly share code, notes, and snippets.

View dscape's full-sized avatar

Nuno Job dscape

View GitHub Profile
let $l := ('a','b','c','d','e','f','g','h')
let $c := count($l)
let $n := 4
let $m := if ($n > $c) then $c else $n
let $step := ceiling( $c div $m )
return (
concat("l=", string-join($l, ", "), " c=", $c, " n=", $n, " step=", $step),
for $i in (1 to $m)
let $s := xs:integer( 1 + ( ( $i - 1 ) * $step ) )
let $f := xs:integer( $s + $step - 1 )
(: better approach as allows you to use xdmp:estimate :)
declare function local:partition-range($list-size, $nr-partitions) {
let $m := if ($nr-partitions > $list-size)
then $list-size
else $nr-partitions,
$step := ceiling( $list-size div $m )
return
for $i in (1 to $m)
let $s := xs:integer( 1 + ( ( $i - 1 ) * $step ) )
let $f := xs:integer( $s + $step - 1 )
[user]
name = Nuno Job
email = nunojobpinto@gmail.com
[color]
ui = auto
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
@dscape
dscape / .bashrc
Created September 16, 2010 01:03
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
<?xml version="1.0" encoding="UTF-8"?><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating applications with XML.</description></book><?xml version="1.0" encoding="UTF-8"?><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating applications with XML.</description></book><?xml version="1.0" encoding="UTF-8"?><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating applications with XML.</description></book><?xml version="1.0" encoding="UTF-8"?><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Comp

SAUCE

heat up a little bit of olive oil with chopped onions. (almost all portuguese recipes start like this). when onions are golden add tomatoes (many) add 2 bay leaves, beer, one chili pepper (chopped for extra spicyness), a little meat or sausage for meat flavour, a knorr thingy (either chicken or beef according to what your cooking in the sandwich), and a little smell of a strong drink like whiskey, brandy, port or one you would think would fit. all sauce recipes are a bit different, because some people like different flavours, stronger or less strong, spicy or not so spicy. some like to add a little bit of seafood sauce, wich gives a slightly different taste but works fine for some people (im one of them) :P you have to look out for it not to be to liquid. thats where you could add the cornstarsh to mke it thicker. This provides a quick fix for not getting it right i suppose in terms of thickness.

PER SANDWICH

@dscape
dscape / The-Innovators-Dilemma-Summary.md
Created February 22, 2011 21:02
Notes on The Innovator’s Dilemma: When New Technologies Cause Great Firms to Fail

Notes on The Innovator’s Dilemma: When New Technologies Cause Great Firms to Fail

  • Book by: Clayton M. Christensen, Cambridge, Massachusetts: Harvard Business School Press, 1997
  • Prepared by: B.B. McBreen. See [PDF][1] (more readable but it's not plain text)

Summary

  1. Market progress is separate from technology progress. Customers do not always know what they need.
  2. Innovation requires resource allocation which is extraordinarily difficult for disruptive technologies.
  3. Disruptive technology needs a new market. Old customers are less relevant. Disruptive technology is a marketing problem, not a technological one.
@dscape
dscape / coocurrence.xqy
Created March 23, 2011 14:29
Sample Co-occurence Index
for $c in cts:element-value-co-occurrences(
fn:QName("http://marklogic.com/MLU/top-songs", "genre"),
fn:QName("http://marklogic.com/MLU/top-songs", "artist")
, ("frequency-order",
"collation-1=http://marklogic.com/collation/en/S1/AS/T00BB",
"collation-2=http://marklogic.com/collation/en/S1/AS/T00BB"), cts:and-query(()))
return <i c="{cts:frequency($c)}">{
for $v in $c
return (attribute fst {fn:string($v//*:value[1])},
attribute snd {fn:string($v//*:value[2])})}</i>
@dscape
dscape / apr28.md
Created April 28, 2011 07:39
Meetup tomorrow

#sfodocdb drinks tomorrow.

Place: RickHouse - 246 Kearny St. SF, CA 94108 Time: 8PM

  • People: @csanz, @nitin, @janl, @dscape, @johndmitchell
  • Maybe: @mikeal, @jchris, @scissorjammer, @tilgovi, @hunterhacker
  • No: @hackingdata
@dscape
dscape / nodemailer-to-postmark.js
Created August 3, 2011 16:16
Make the postmark api look like node_mailer
var request = require('request')
, _ = require('underscore');
function send_mail(message, callback) {
if(typeof exports.SMTP.api_key !== "string") {
console.log(exports.SMTP)
callback(new Error("No API Key was given"));
return;
}
if(typeof exports.SMTP !== "object") {