Skip to content

Instantly share code, notes, and snippets.

View zdne's full-sized avatar
💭
🚀

Z zdne

💭
🚀
View GitHub Profile
@zdne
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)
if application "Google Chrome" is running then
tell application "Google Chrome" to make new window with properties {mode:"incognito"}
else
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito"
end if
tell application "Google Chrome" to activate
@zdne
zdne / install.sh
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 https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
$ 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
zdne / gist:5f8295642af18aff27ec
Created June 17, 2015 10:47
Working with multiple API Blueprint files

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 Apiary.io 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
zdne / mutlipart-example
Last active March 25, 2021 03:44
API Blueprint multipart request example. Raw HTTP source: http://chxo.com/be2/20050724_93bf.html.
# POST /path/to/script.php
+ Request (multipart/form-data, boundary=AaB03x)
+ Headers
Content-Length: $requestlen
+ Body
@zdne
zdne / hal-embedding.md
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 http://stateless.co/hal_specification.html. 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 (https://keybase.io/zdenek) on keybase.
  • I have a public key ASBe1huF1XGh7mDwe5wbzdbPAShqtgw56p1S0n22kXYAyQo

To claim this, I am signing this object:

@zdne
zdne / gist:6366103
Created August 28, 2013 13:31
Install GCC 4.7 on Ubuntu Precise
$ 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
zdne / schemaUtils.js
Created January 14, 2017 06:59 — forked from jarwol/schemaUtils.js
GraphQL diff() and merge() extensions
'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
zdne / gist:7361466
Created November 7, 2013 20:38
This is the full listing to http://docs.urlencoded.apiary.io