Skip to content

Instantly share code, notes, and snippets.

View dzuluaga's full-sized avatar

Diego Zuluaga dzuluaga

View GitHub Profile
apiproxy
├── policies
│   └── xmltojson-1.xml
├── proxies
│   └── default.xml
├── targets
│   └── default.xml
└── weather.xml
@dzuluaga
dzuluaga / parseAuthorizationHeader.js
Last active August 29, 2015 14:12
JavaScript Regular Expression to Parse OAuth 1.0a Authorization Headers
/**
* This function parses a string in a form of an authorization header and returns a string with two elements, the matching string and the
* value. The string has been escaped with http://www.freeformatter.com/javascript-escape.html#ad-output.
*
* @strHeader {string} string in a form of an authorization header
* @patternToMatch {rexexp} regular expression to match specific pattern
* @return {array} Returns an array with two elements: ["oauth_token="mHcOQ4lksgr1UUCcVzNYxNMSbr9Y"", "mHcOQ4lksgr1UUCcVzNYxNMSbr9Y"]
*/
function parseAuthorizationHeader(strHeader, patternToMatch){
@dzuluaga
dzuluaga / Retrieve Custom Attribute.xml
Last active August 29, 2015 14:14
How to Retrieve a Custom Attribute set at Developer App Level?
<AssignMessage name="AssignMessage.AppendTargetApiKeyToRequest">
<AssignTo createNew="false" transport="http" type="request">request</AssignTo>
<Set>
<QueryParams>
<QueryParam name="Key">{app.postcodeanywhere.targetapikey}</QueryParam>
</QueryParams>
</Set>
</AssignMessage>
@dzuluaga
dzuluaga / test.md
Last active August 29, 2015 14:14
Markdown

Title

####One Element Bold ELement

Subelement
curl http://example.com/test?ex=123

Analytics

@dzuluaga
dzuluaga / getCurrentPosition.js
Last active August 29, 2015 14:14
Here's a JavaScript function to obtain current position.
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
http://stackoverflow.com/questions/30631725/update-node-js-version-inside-cloud-9-ide
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'https://npmrepouser:passw0rd@testmyapi-test.apigee.net/npm-private-repo-proxy/npm-package1-1.0.0.tgz',
1 verbose cli '--save',
1 verbose cli '--verbose' ]
2 info using npm@3.3.9
3 info using node@v0.12.0
4 silly loadCurrentTree Starting
@dzuluaga
dzuluaga / nodemon.json that really works
Created February 5, 2016 19:39
I had to add include these entries to ignore and ignoreRoot entries to make it work.
{
"ignore": [".git", "node_modules/*/node_modules/**"],
"ignoreRoot": [".git", "node_modules/*/node_modules/**"]
}
@dzuluaga
dzuluaga / oas-datamodel-to-oas-generated.json
Created May 15, 2016 21:53
This file was generated by datamodel-to-json
{
"swagger": "2.0",
"x-db-models-var-name": "edge_models",
"produces": [
"application/json"
],
"host": "localhost:3000",
"basePath": "/edge",
"info": {
"title": "Apigee Nucleus API",
{
"id" : "8ac2f828-10aa-41bd-b99b-65351c6343f8",
"revisionNumber" : 2,
"baseUrl" : "https://api.enterprise.apigee.com/v1",
"resources" : [ {
"id" : "a5494eba-3bef-498d-9124-6116ed8511ca",
"name" : "deleteAPIMask",
"baseUrl" : "https://api.enterprise.apigee.com/v1",
"path" : "/organizations/{org_name}/apis/{api_name}/maskconfigs/{maskconfig_name}",
"parameters" : [ {