Skip to content

Instantly share code, notes, and snippets.

let range = function*(start, end){
let current = start;
while(current < end){
let newValue = yield current;
current = newValue ? newValue : current + 1;
}
};
let stuff = range(0,3)
let range = function*(start, end){
for(var i = start; i <= end; i++){
yield i;
}
};
let n = [for (x of range(0,3)) x];
expect(n).toEqual([0,1,2,3]);
// this:
var foo = "hi!";
var length = foo?.Length;
// will create this:
string str = "hi!";
int? nullable = str != null ? new int?(str.Length) : new int?();
// while this:
var foo = "hi!";
var generatedCode = generator.TransformText();
var comparer = DesktopAssemblyIdentityComparer.Default;
var options = new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
assemblyIdentityComparer:comparer);
var tree = SyntaxFactory.ParseSyntaxTree(generatedCode);
var compilation = CSharpCompilation
.Create("measures.dll")
protected override IEnumerable<IValueSetCode> GetEntries(bool negation)
{
// we currently are not importing allergies, but they should be here soon ...
if (DateTime.Now > new DateTime(2015, 3, 1))
{
throw new NotSupportedException("We still have no allergies imported!");
}
return Enumerable.Empty<IValueSetCode>();
}
<configuration>
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
</configuration>
public class Employee
{
public Employee()
{
HomeAddress = new Address();
}
public int Id { get; set; }
public string Name { get; set; }
public Address HomeAddress { get; set; }
npm install foo --msvs_version=2012
public class Foo
{
public Foo(int value)
{
_value = value;
}
int _value;
}
using static System.Console;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
WriteLine("This works...");
}