Skip to content

Instantly share code, notes, and snippets.

View zdne's full-sized avatar

Z zdne

View GitHub Profile
zdne / Google Chrome Incognito.applescript
Last active January 31, 2023 19:38
Google Chrome Incognito – AppleScript to always run chrome in incognito mode. Save as an application to your Application folder. Optionally drag a and drop Google Chrome Icon in between Get Info panes (⌘+I)
View Google Chrome Incognito.applescript
if application "Google Chrome" is running then
tell application "Google Chrome" to make new window with properties {mode:"incognito"}
do shell script "open -a /Applications/Google\\ --args --incognito"
end if
tell application "Google Chrome" to activate
zdne /
Last active January 20, 2023 15:43
Install phantomjs 1.9.1 x64 on Ubuntu Precise
$ sudo apt-get install libfontconfig
$ cd /usr/local/share
$ sudo wget
$ sudo tar xjf phantomjs-1.9.1-linux-x86_64.tar.bz2
$ sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
$ sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
$ sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
zdne / gist:5f8295642af18aff27ec
Created June 17, 2015 10:47
Working with multiple API Blueprint files
View gist:5f8295642af18aff27ec

Working with multiple blueprint files

This document describes 4 different solutions to work APIs that consist of multiple blueprint files. Every of this solution work with all features but editing. To edit a blueprint you have to do it outside of Apiary as Apiary editor does not support working with multiple files. In other words if you are using one of the solutions below avoid editing the blueprint in Apiary.

1. Hercule

Hercule is a CLI tool written in Node.js – available as an NPM package. It uses markdown referencing and linking syntax to transclude other files into a blueprint file. This solution is universal and would work with any Markdown files not just API Blueprint.

The major benefit – unlike any other solutions here – is also that the references are rendered as HTML links in any Markdown editor so the result is HTML that can be browsed!

zdne / mutlipart-example
Last active March 25, 2021 03:44
API Blueprint multipart request example. Raw HTTP source:
View mutlipart-example
# POST /path/to/script.php
+ Request (multipart/form-data, boundary=AaB03x)
+ Headers
Content-Length: $requestlen
+ Body
zdne /
Last active June 5, 2019 12:47
Explanation of HAL+JSON embedding

Embedding Related Resoruces in HAL

Often, I get questions about embedding resources with HAL Here is some of my recommendation illustrated on an example.

First of all, think of the _embedded as a courtesy of HAL so the API user does not have to make one more call to retrieve a resource that has a link relation with the current (self resource). Let's illustrate it on an example: A collection of applications and one application, where an application might have related, child applications. The link relations are as follow:

collection of applications resource ——application relation——> application resource

application resource ——child relation——> application resource


Keybase proof

I hereby claim:

  • I am zdne on github.
  • I am zdenek ( on keybase.
  • I have a public key ASBe1huF1XGh7mDwe5wbzdbPAShqtgw56p1S0n22kXYAyQo

To claim this, I am signing this object:

zdne / gist:6366103
Created August 28, 2013 13:31
Install GCC 4.7 on Ubuntu Precise
View gist:6366103
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-4.7 g++-4.7
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
$ sudo update-alternatives --config gcc
zdne / schemaUtils.js
Created January 14, 2017 06:59 — forked from jarwol/schemaUtils.js
GraphQL diff() and merge() extensions
View schemaUtils.js
'use strict';
* This module extends the graphql.js schema and types by adding diff and merge functions.
(function () {
const GraphQLSchema = require('graphql/type/schema').GraphQLSchema,
GraphQLObjectType = require('graphql/type/definition').GraphQLObjectType,
GraphQLScalarType = require('graphql/type/definition').GraphQLScalarType,
GraphQLUnionType = require('graphql/type/definition').GraphQLUnionType,
zdne / gist:7361466
Created November 7, 2013 20:38
This is the full listing to
View gist:7361466