NSDictionary* headers = [NSDictionary dictionaryWithObjectsAndKeys:@"application/json", @"accept", nil];
NSDictionary* parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"value1", @"param1", @"value2", @"param2", nil];
HttpJsonResponse* response = [[Unicorn post:^(MultipartRequest* request) {
[request setUrl:@"http://httpbin.org/post"];
[request setHeaders:headers];
[request setParameters:parameters];
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
############################################################## | |
# Make sure you have the dependencies for building OpenResty # | |
############################################################## | |
BUILD_DIR=/tmp | |
OPENRESTY_VERSION=1.7.10.2rc0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
OPENRESTY_VERSION=1.7.10.2rc0 | |
OPENSSL_VERSION=1.0.2a | |
OPENRESTY_CONFIGURE_PARAMS="" | |
# Preparing environment | |
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
echo "Current directory is: "$DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo luarocks install ansicolors --verbose | |
os.execute: unzip -n '/Users/marco/.cache/luarocks/https___rocks.moonscript.org/manifest-5.1.zip' | |
Archive: /Users/marco/.cache/luarocks/https___rocks.moonscript.org/manifest-5.1.zip | |
inflating: manifest-5.1 | |
Results: 1 | |
1 (number): 0 | |
Installing https://rocks.moonscript.org/ansicolors-1.0.2-3.src.rock... | |
Using https://rocks.moonscript.org/ansicolors-1.0.2-3.src.rock... switching to 'build' mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# perl v5.18.2 on MacOSX v10.10.2 | |
echo "hello" > /tmp/file | |
alias realpath="perl -MCwd -e 'print Cwd::realpath ($ARGV[0]), qq<\n>'" | |
cd /tmp && realpath file | |
# Outputs: /private/tmp/ARRAY(0x7fb6518042e8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.UnknownHostException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.junit.Test; | |
import com.mongodb.BasicDBObject; | |
import com.mongodb.DB; | |
import com.mongodb.MongoClient; | |
import com.mongodb.MongoClientOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var unirest = require('unirest'); | |
function get(url, callback) { | |
unirest.get(url).end(function (response) { | |
var result, entity = response.body; | |
if (entity.data) { | |
result =[]; | |
for(var t=0;t<entity.data.length;t++) { | |
result.push(_prepare(entity.data[t])); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mashape.unirest.http.HttpResponse; | |
import com.mashape.unirest.http.JsonNode; | |
import com.mashape.unirest.http.Unirest; | |
import com.mashape.unirest.http.exceptions.UnirestException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.test</groupId> | |
<artifactId>test</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>test</name> | |
<dependencies> | |
<!-- Unirest --> |