Skip to content

Instantly share code, notes, and snippets.

View jthomas's full-sized avatar
💻
serverless all the things.

James Thomas jthomas

💻
serverless all the things.
View GitHub Profile
@jthomas
jthomas / README.md
Last active May 28, 2016 18:24
Building Cognitive Bots Talk @ Twilio Signal
<output id="output_2449884">
<prompt selectionType="RANDOM">
<item>Is there anything else I can help you with?</item>
</prompt>
<getUserInput>
<input>
<grammar>
<item>Yes</item>
</grammar>
</input>
@jthomas
jthomas / hello_name_1.0.0.yaml
Created May 3, 2016 08:16
Public APIs for OpenWhisk Actions using API Connect.
swagger: '2.0'
info:
version: 1.0.0
title: hello_name
x-ibm-name: hello_name
host: $(catalog.host)
basePath: /
paths:
/hello_name:
get:
@jthomas
jthomas / README.md
Created April 12, 2016 06:59
OpenWhisk JavaScript Client Library

openwhisk-client-js

JavaScript client library for the OpenWhisk platform. Provides a wrapper around the OpenWhisk APIs.

installation

$ npm install openwhisk // replace with package name....
@jthomas
jthomas / test.js
Last active January 31, 2016 16:38
Accessing variables from closure
var vm = require('vm');
var Debug = vm.runInDebugContext('Debug');
Debug.setListener(function (event, exec_state) {
if (event !== Debug.DebugEvent.Break) return;
try {
console.log(exec_state.frame(0).evaluate('inner'))
} catch (err) {
console.log(err)
}
@jthomas
jthomas / n-queens.js
Last active August 10, 2022 12:49
Solving "N Queens Problem" with JavaScript
var iterations = 0
var print_board = function (columns) {
var n = columns.length, row = 0, col = 0
while (row < n) {
while (col < n) {
process.stdout.write(columns[row] === col ? 'Q ' : '# ')
col++
}
@jthomas
jthomas / app.js
Created June 11, 2015 10:49
Phonebot mock API responses server
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded())
var requests = []
var store_request = function (req) {
requests.push({
@jthomas
jthomas / .nvimrc
Created March 30, 2015 21:46
NeoVim configuration
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'altercation/vim-colors-solarized'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'bling/vim-airline'
Plug 'jelera/vim-javascript-syntax'
input {
stdin {
type => "stdin-type"
}
tcp {
port => 5000
type => syslog
}
udp {
port => 5000
@jthomas
jthomas / nano.profile.js
Created July 23, 2012 11:05
Nano-build profile
var profile = (function(){
return {
layerOptimize: "closure",
releaseDir: "../../../release",
packages:[{
name:"dojo",
location:"../../../dojo"
}],