This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @jsx React.DOM */ | |
| // http://jsfiddle.net/prabir/x2VX7/5/ | |
| var ReactBindTo = { | |
| bindTo: function (key, defaultValue) { | |
| var self = this; | |
| return { | |
| value: this.state[key] || defaultValue, | |
| requestChange: function (value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (isNode) { | |
| var public = {}; | |
| if (isNode) { | |
| module.exports = public; | |
| } else { | |
| window.public = public; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://stackoverflow.com/a/19282657/157260 | |
| var pg = require('pg'), | |
| cn = 'pg://prabirshrestha@localhost:5432/test'; | |
| pg.defaults.poolSize = 10; | |
| pg.connect(cn, function (err, client, done) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PropertyInfo writeStreamBuffering = typeof(HttpWebRequest).GetProperty("AllowWriteStreamBuffering"); | |
| ReflectionUtils.GetDelegate getter = null; | |
| ReflectionUtils.SetDelegate setter = null; | |
| if (writeStreamBuffering != null) | |
| { | |
| getter = ReflectionUtils.GetGetMethod(writeStreamBuffering); | |
| setter = ReflectionUtils.GetSetMethod(writeStreamBuffering); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Hapi = require('hapi'), | |
| routes, | |
| products = [ | |
| { id: 1, name: 'Guitar' }, | |
| { id: 2, name: 'Banjo' } | |
| ]; | |
| routes = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IMyAppBuilder { | |
| public IDictionary<string, object> Properties { get; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public AppFunc Configuration(IDictionary<string, object> startupEnv) | |
| { | |
| return async env => | |
| { | |
| var responseBody = (Stream) env["owin.ResponseBody"]; | |
| var bytes = Encoding.UTF8.GetBytes("hello world"); | |
| await responseBody.WriteAsync(bytes, 0, bytes.Length); | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var n = Require<Nake>(); | |
| var msbuild = Require<NakeMsBuild>().init(n); | |
| var nunit = Require<NakeNUnit>().init(n); | |
| n.defaults(new { | |
| configuration = "Release", | |
| output = "output" | |
| }); | |
| nunit.defaults(new { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public AppFunc App(IDictionary<string, object> startupEnv) { | |
| var nginxVersion = (string)startupEnv["nginx.version"]; | |
| return async env => await env.WriteStringAsync(nginxVersion); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // config.csx | |
| return new { | |
| greeting = "hello world", | |
| valediction = "goodbye world" | |
| }; | |
| // config library | |
| public class Config { | |
| public object LoadScriptFile(string path) { | |
| returns IDictionary<string,object> .... |