Skip to content

Instantly share code, notes, and snippets.

View DinoChiesa's full-sized avatar

Dino Chiesa DinoChiesa

View GitHub Profile
@DinoChiesa
DinoChiesa / try-request.el
Created April 17, 2014 19:24
Invoke Apigee Edge Mgmt API to list APIs, from elisp
(defun my-produce-basic-auth-header-value (username password)
"produce an HTTP Basic Auth header value for a given username and password."
(concat "Basic "
(base64-encode-string
(concat username ":" password))))
(request
"https://api.enterprise.apigee.com/v1/o/deecee/apis"
:headers `(("authorization" . ,(my-produce-basic-auth-header-value username password))
("accept" . "application/json"))
@DinoChiesa
DinoChiesa / flycheck-csharp.el
Created April 21, 2014 19:56
enable flycheck for csharp
(defun csharp-set-flycheck-command ()
"Set the flycheck command, dynamically, as a side effect.
This function is intended for use as a before-syntax-check-hook with
flycheck. Use it like this:
(add-hook 'flycheck-before-syntax-check-hook #'csharp-set-flycheck-command)
Then, in your csharp file, specify this in the comments at the header.
// WinFormsHello.cs
//
// flycheck: gmcs /t:module /debug+ -pkg:dotnet %f
//
// ------------------------------------------------------------------
//
using System;
using System.Windows.Forms;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; fixup path
;; for each directory in the list, if it exists, and is not already
;; present on the path, add it to path.
(let ((path-elts (split-string (getenv "PATH") ":")))
(dolist (path '("/usr/local/bin"
"/Library/Frameworks/Mono.framework/Versions/Current/bin"))
(and (file-directory-p path)
(not (member path path-elts))
(setenv "PATH" (concat (getenv "PATH") ":" path)))))
#!/bin/bash
# -*- mode:shell-script; coding:utf-8; -*-
#
# exercise-apigee-admin-APIs.sh
#
# A bash script for demonstrating the use of the administrative APIs for
# Apigee Edge, to deploy new APIs and invoke them.
#
#
# created: 2014-February-04
// xformResponse.js
// ------------------------------------------------------------------
//
// pre-transform the response before the XML-to-JSON step.
//
// created: Wed Jan 7 08:06:03 2015
// last saved: <2015-January-07 10:41:38>
// expected input:
//
/*
* ugCollectionForEach
*
* Iterates through all items IN A SINGLE PAGE of a collection within
* Apigee Edge BaaS. Uses the Usergrid client object from the usergrid
* module. Notice - this logic does not call {has,get}NextPage().
*
* @param ugClient - the authenticated client object
* @param options - the options for a collection. Pass type and qs.
* @param f - function called with each UG entity. Accepts a single argument.
/*
* ugCollectionForEachPaging
*
* Iterates through all items in a collection within
* Apigee Edge BaaS. Uses the Usergrid client object from the usergrid
* module. Notice - this logic calls {has,get}NextPage().
*
* @param ugClient - the authenticated client object
* @param options - the options for a collection. Pass type and qs.
* @param f - function called with each UG entity. Accepts a single argument.
@DinoChiesa
DinoChiesa / local.screenshot.fixup.plist
Last active August 29, 2015 14:24
plist for a watcher that renames screenshots
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.screenshot.fixup</string>
<key>Program</key>
<string>/Users/YOURSELF/dev/bash/fixupScreenshotName.sh</string>
<key>RunAtLoad</key>
<false/>
var express = require('express'), // 4.x
bodyParser = require('body-parser'), // express 4.x requires this
yql = require('yql'),
urlparse = require('url');
// Set up Express environment and enable it to read and write JSON bodies
var app = express();
app.use(bodyParser.json()); // for parsing application/json
// Generic Send Error Function