This blog is based on gistblog.
It is currently hosted on azure as Rarely updated.
var myNamespace = myNamespace || {}; | |
myNamespace.MyConstructor = function(opts) { this.options = opts; }; | |
(function () { | |
function myPrivateMethod(t) { | |
console.log("myPrivateMethod" + t.options.a); | |
} |
public class ViewModelRenderer : IEnableLogger | |
{ | |
public string RenderViewModel(string interfaceCode) | |
{ | |
var tree = SyntaxTree.ParseCompilationUnit(interfaceCode, "foo.cs"); | |
var root = tree.GetRoot(new CancellationToken()); | |
if (!root.ChildNodes().Any()) { | |
throw new ArgumentException("Compilation failed or code is badly formatted"); | |
} |
This blog is based on gistblog.
It is currently hosted on azure as Rarely updated.
This blog exists purely a learning experience. See the source code here.
As you may notice, the blog posts are actually github gists (http://gist.github.com/). It is based on gistblog (see also http://withouttheloop.com/).
Software
// An implementation of IPortableTask which wraps an actual Task. | |
// This has to go in a project targeting a platform or platforms which support Task and async/await | |
using System; | |
using System.Threading.Tasks; | |
namespace PortableTasks | |
{ | |
public class AsyncPortableTask : IPortableTask | |
{ |
Recently we had a tricky defect raised where, under certain circumstances, the user-entered values were not being persisted. The page was a somewhat complex data entry form, with many fields, lots of validation, and a complex hierarchy of view model objects and controls/helpers.
After reproducing the issue (which itself was difficult), the first thing we did was to attach the debugger and set a break point on the first line of the controller action.
import sublime, sublime_plugin | |
import sys,os,re | |
#script should go in Pacakges/FSharpAutocomplete/FSharpAutocomplete.py | |
#pexpect should go in Packages/FSharpAutocomplete/lib | |
#to make it load 'everything' from the lib folder. | |
def installpath(path): | |
if path not in sys.path: | |
sys.path.insert(0, path) | |
__file__ = os.path.normpath(os.path.abspath(__file__)) |
Task flushingTask = null; | |
public override Task FlushAsync(CancellationToken cancellationToken) | |
{ | |
Interlocked.CompareExchange( | |
ref flushingTask, | |
Task.Delay(200, cancellationToken).ContinueWith( | |
async (t) => | |
{ | |
await write.FlushAsync(cancellationToken); |
//========================================== | |
// Working fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// Note you don't need to have _anything_ installed before starting with this script. Nothing | |
// but F# Interactive and this script. | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. |