Skip to content

Instantly share code, notes, and snippets.

View pk11's full-sized avatar

Peter Hausel pk11

  • Silicon Valley, CA
View GitHub Profile
$ dotnet -v watch
Telemetry is: Enabled
Running /usr/local/share/dotnet/dotnet exec --depsfile /Users/phausel/.nuget/packages/.tools/Microsoft.DotNet.Watcher.Tools/1.0.0-preview1-final/netcoreapp1.0/Microsoft.DotNet.Watcher.Tools.deps.json --additionalprobingpath /Users/phausel/.nuget/packages /Users/phausel/.nuget/packages/Microsoft.DotNet.Watcher.Tools/1.0.0-preview1-final/lib/netcoreapp1.0/dotnet-watch.dll
Process ID: 2013
[DotNetWatcher] info: Running dotnet with the following arguments: run
[DotNetWatcher] info: dotnet process id: 2019
Project asp (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
/Users/phausel/workspace/asp/bin/Debug/netcoreapp1.0/asp.dll
/Users/phausel/workspace/asp/bin/Debug/netcoreapp1.0/asp.pdb
/Users/phausel/workspace/asp/bin/Debug/netcoreapp1.0/asp.deps.json
@pk11
pk11 / reactjs.js
Last active August 29, 2016 17:42
/** @jsx React.DOM */
/**
* Our component structure will look like the following:
* - WikiBox
* -- AutoCompleteBox
* --- AutoComplete
*/
// this component renders a single entity coming from wikipedia
@pk11
pk11 / gist:6797500
Last active December 24, 2015 12:28
var sys = require("sys"),
my_http = require("http");
my_http.createServer(function(request,response){
sys.puts("yay");
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8080);
sys.puts("Server Running on 8080");
@pk11
pk11 / gist:6755555
Last active December 24, 2015 06:09
var avatar = require("org/glassfish/avatar");
var getTime = function() {
var result = new Date();
return {
time: result.toISOString(),
h: result.getHours(),
m: result.getMinutes(),
s: result.getSeconds(),
d: result.getDate(),
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/>
</head>
<body>
<script data-model="rest">
var Server = function() { this.name = ''; };
</script>
@pk11
pk11 / gist:6179319
Last active December 20, 2015 18:58
//imports excluded for brevity
var websocket = new BaseWebSocketHandler() {
connectionCount: 1,
//note: webbit is single-threaded
//you may need to change this to ConcurrentHashMap
//if `connections` is accessed from worker threads
connections: new HashMap(),
onOpen: function (connection) {
<html>
<body>
<!-- Send text to websocket -->
<input id="userInput" type="text">
<button onclick="ws.send(document.getElementById('userInput').value)">Send</button>
<h1>Websockets demo</h1>
<!-- Results -->
@pk11
pk11 / binding.ts
Last active December 19, 2015 14:08
typescript - binding
class B {
boo: string = "yay!";
foo(): string {
return this.boo;
}
}
var b = new B();
console.log(b.foo()); // prints boo
var ref = b.foo;
@pk11
pk11 / mvn2sbt.scala
Created December 14, 2012 16:25
mvn2sbt - generates an sbt file based on a simple (java) pom.xml
import scala.xml._
import java.io._
/**
* based on https://gist.github.com/388334
*/
object mvn2sbt {
private def printToFile(f: java.io.File)(op: java.io.PrintWriter => Unit) {
@pk11
pk11 / gist:4258783
Created December 11, 2012 14:03
iteratee impl
package boo {
object Iteratee {
import Implicits.internal
//clientAPI does not take an implicit, so the closest in scope is resolved
def clientAPI(): Unit = println(Future.future)
}
object Future {
def future(implicit ex: String): String = ex