Skip to content

Instantly share code, notes, and snippets.

View leggetter's full-sized avatar

Phil Leggetter leggetter

View GitHub Profile
@leggetter
leggetter / gist:769688
Created January 7, 2011 16:23
How to get the body of a HTTP Request using C#
private string GetDocumentContents(System.Web.HttpRequestBase Request)
{
string documentContents;
using (Stream receiveStream = Request.InputStream)
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
documentContents = readStream.ReadToEnd();
}
}

Keybase proof

I hereby claim:

  • I am leggetter on github.
  • I am leggetter (https://keybase.io/leggetter) on keybase.
  • I have a public key ASBKejKymaKZqsk278jz5L22rzoH4blY3ihyRFErUtdwaQo

To claim this, I am signing this object:

@leggetter
leggetter / auth.php
Created August 30, 2011 10:31
Pusher PHP Auth example
<?php
// https://github.com/squeeks/Pusher-PHP
require('squeeks-Pusher-PHP-0defb40/lib/Pusher.php');
$key = 'APP_KEY';
$secret = 'APP_SECRET';
$app_id = 'APP_ID';
$pusher = new Pusher($key, $secret, $app_id);
$channel_name = $_POST['channel_name'];
@leggetter
leggetter / nexmo-call-with-retry.js
Created March 21, 2017 10:45
An example of making calls and handling retries when 429 responses are detected in Node.JS
var Nexmo = require('../lib/Nexmo');
var nexmo = new Nexmo({
apiKey: config.API_KEY,
apiSecret: config.API_SECRET,
applicationId: config.APP_ID,
privateKey: config.PRIVATE_KEY
},
{debug: config.DEBUG}
);
@leggetter
leggetter / inbound-sms-headers.txt
Created August 14, 2016 10:15
Nexmo Inbound SMS Webhook
Accept */*
Content-Length 145
Content-Type application/x-www-form-urlencoded; charset=UTF-8
User-Agent Nexmo/MessagingHUB/v1.0
X-Forwarded-For 174.36.197.202
X-Forwarded-Proto https
BladeRunnerJS is an open source developer toolkit and lightweight front-end framework for building modular large-scale HTML5 single page apps.
  1. Go to https://github.com/BladeRunnerJS/brjs-plugin-bootstrap
  2. Either:
    • Copy the "Download ZIP" url and In terminal: curl -L <zip_url> > start.zip
    • Copy BRJS.zip and brjs-plugin-bootstrap-master.zip from network path
  3. If copied BRJS.zip, unzip
  4. unzip brjs-plugin-bootstrap-master.zip
  5. mv brjs-plugin-bootstrap-master ListAppsPlugin
  6. cd ListAppsPlugin
  7. ls -la to show contents of directory
  8. ./gradlew init -Pbrjs= to create the required project files
( function() {
function trackOutboundLink( ev ) {
var el = jQuery( ev.srcElement || ev.target );
var href = el.attr( 'href' ) || '';
var fullUrl = /^https?:\/\//.test( href );
var leggetterLink = /^https?:\/\/www.leggetter.co.uk/.test( href );
if( !fullUrl || leggetterLink ) {
log( 'not tracking internal link' );
return;

No worries if you don't have time to review this - thanks for your input so far


layout: docs title: Testing BRJS Applications permalink: /docs/concepts/testing/

The BRJS toolkit and application architecture encourages you to implement tests at a number of different levels. The focus is to push testing down the testing triangle as much as possible as this results in faster contextual feedback, and faster and more reliable tests.

function Rimmer() {
this._testFailText = 'I AM A FISH.';
this._testFailIterations = 400;
}
Rimmer.prototype.takeTest = function( testName ) {
if( testName.toLowerCase() === 'engineering exam' ) {
var count = 0;
do {
this.write( this._testFailText );