Skip to content

Instantly share code, notes, and snippets.

View wcandillon's full-sized avatar

William Candillon wcandillon

View GitHub Profile
declare function local:is_in_date_range($index_entry, $date_filter) {
let $now := if ($date_filter!='')
then $date_filter
else current-date() - xs:dayTimeDuration(concat('P',14,'D'))
return
let $results :=
for $program in $index_entry/program
return
if (not($program/@end_dt castable as xs:date))
then true()
@wcandillon
wcandillon / s3-xml.jq
Last active August 29, 2015 14:24
XML processing from S3
import module namespace s3 = "http://www.28msec.com/modules/s3";
import module namespace p = "http://zorba.io/modules/xml";
import schema namespace opt = "http://zorba.io/modules/xml-options";
(: In this example the XML files contains DTD declarations :)
let $parse-options := <opt:options>
<opt:DTD-validate/>
</opt:options>
let $manifest := s3:read-text({
[
{
"category": "MongoDB",
"name": "xbrl",
"credentials": {
"conn-string": "xxx.28.io",
"db": "japan",
"user": "xbrl",
"pass": "hello"
}
let con = tableau.makeConnector();
tableau.registerConnector(con);
{
profile: {
pictures: {
large: "http://path-to-image/uid.jpg",
medium: "http://path-to-image/uid.jpg",
small: "http://path-to-image/uid.jpg"
}
}
}
interface CachedImageProps {
uri: string;
style?: React.ImageStyle;
}
@observer
export class CachedImage extends Component<CachedImageProps, void> {
@observable private _path;
private handler = path => this.path = path;
/*
* Generated by https://github.com/wcandillon/react-native-static-images
*/
export default class Images {
static readonly resetPassword = require("../public/images/ResetPassword.jpg");
static readonly signIn = require("../public/images/SignIn.jpg");
static readonly signUp = require("../public/images/SignUp.jpg");
}
#Generate Typescript data model
firebase-bolt-transpiler < rules.bolt > src/Model.ts
docker run — rm -v $(pwd)/admin:/queries fcavalieri/zorba -q migrate.jq -f -i -e token:=$FIREBASE_SECRET
module namespace fb = "http://wcandillon.io/modules/firebase";
import module namespace http = "http://zorba.io/modules/http-client";
declare namespace an = "http://zorba.io/annotations";
declare variable $admin:firebase-endpoint := "https://myapp.firebaseio.com/";
declare %an:nondeterministic function fb:get($document-uri as string, $token as string) {
http:get(
$admin:firebase-endpoint || $document-uri || "?auth=" || $token
).body.content ! parse-json($$)