Skip to content

Instantly share code, notes, and snippets.

View akimboyko's full-sized avatar
🙃

Akim Boyko akimboyko

🙃
View GitHub Profile
@akimboyko
akimboyko / EdgeJs2ClrSample.js
Created June 13, 2013 04:59
Edge.js samples: calling C# from Node.js, passing parameters and functions, and returning C# functions to be called by Node.js
var edge = require('edge');
// Call C# async lambda from node.js
// Compile source code on the fly
// Use C# dynamics to access objects passed from JavaScript
var funcCs = edge.func('cs', function() { /*
using System.Threading.Tasks;
async (dynamic input) =>
{
@akimboyko
akimboyko / SeleniumWebDriver.FireFox.csx
Last active December 18, 2015 10:09
Selenium WebDriver integration testing using ScriptCs. FireFox and PhantomJs drivers are used
// load all require references
#r "System.Drawing"
#r "D:\work\Courses\MetaProgramming\Snippets\Scripting\ScriptCs\SeleniumWebDriver\bin\WebDriver.dll"
#r "D:\work\Courses\MetaProgramming\Snippets\Scripting\ScriptCs\SeleniumWebDriver\bin\WebDriver.Support.dll"
#r "D:\work\Courses\MetaProgramming\Snippets\Scripting\ScriptCs\SeleniumWebDriver\bin\nunit.framework.dll"
#r "D:\work\Courses\MetaProgramming\Snippets\Scripting\ScriptCs\SeleniumWebDriver\bin\FluentAssertions.dll"
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
@akimboyko
akimboyko / 1readme.md
Last active October 22, 2018 08:45
ScriptCs as embedded scripting engine for .Net application with NuGet support

ScriptCs as embedded scripting engine for .Net application with NuGet support

This gist contains:

  • ExecuteScriptCs.cs — class that are able to execute ScriptCs from another .Net application
  • ScriptModule.cs — AutoFac configuration for ScriptCs/NuGet dependencies
  • Program.cs — command-line example
  • Sample.csx — sample ScriptCs script
  • packages.config — NuGet packages configuration

К завтрашнему тренингу по JavaScript просьба установить самостоятельно или с помощью Chocolatey:

  • Node JS; или cinst nodejs.install и cinst nodejs.commandline
  • Установить git: cinst git
  • Редактор или IDE на выбор:
  • Sublime Text или cinst sublimetext2
  • Live Reload + plugin для Вашего браузера
  • unzip itera-training.zip
  • cd itera-training
  • npm -g install bower
@akimboyko
akimboyko / test.html
Last active December 18, 2015 04:08
Sample for Mocha that supports both NodeJs Mocha runner and RequireJs + Browsers + LiveReload
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="css/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="scripts/require.js"></script>
<script>
@akimboyko
akimboyko / DynamicGetEnumeratorUsingDLR.cs
Last active December 18, 2015 04:08
Dynamic definition of `GetEnumerator` using DLR without implementing `GetEnumerator` at compile time. Inspired by http://hotcode.org/speeches/c-deep-dive/
void Main()
{
dynamic something = new DynamicEnumerable();
something.DynamicMethod = new Action<string>(str => str.Dump());
"First `dynamic` GetEnumerator".Dump();
something.GetEnumerator = new Func<IEnumerator>(() =>
"test of dynamic enumerator".ToCharArray().GetEnumerator());
@akimboyko
akimboyko / NinjectFactoryWithParameters.cs
Created June 6, 2013 15:26
Ninject.Extensions.Factory with parameters tested using FluentAssertions
void Main()
{
using(var kernel = new StandardKernel(new GameModule()))
{
kernel.Load<FuncModule>();
kernel
.Get<GameArtifact>()
.Should().NotBeNull();
// from http://www.slideshare.net/SergeyTeplyakov/c-sharp-deep-dive
// by @STeplyakov
void Main()
{
var s3 = new S3();
s3.S2.X = 42;
s3.Dump();
}
struct S1
@akimboyko
akimboyko / howto.md
Last active December 17, 2015 23:29
#HotCode conference: Metaprogramming in .Net

Как метапрограмировать используя .Net на конференции #HotCode

@akimboyko
akimboyko / Fault.n
Created May 31, 2013 05:29
Nemerle macro sample: new syntax keyword `fault`
using Nemerle;
using Nemerle.Collections;
using Nemerle.Compiler;
using Nemerle.Text;
using Nemerle.Utility;
using System;
using System.Collections.Generic;
using System.Linq;