Skip to content

Instantly share code, notes, and snippets.

Ken Egozi kenegozi

Block or report user

Report or block kenegozi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View applicationhost
<add name="fcgi-golang" path="*.go" verb="*" modules="FastCgiModule" scriptProcessor="c:\w\playground\go-iis\std.exe" resourceType="Either" requireAccess="Read" />
<fastCgi>
<application fullPath="c:\w\playground\go-iis\std.exe"
arguments=""
maxInstances="1"
idleTimeout="300"
activityTimeout="30"
requestTimeout="90"
@kenegozi
kenegozi / SimpleChannelPatterns.cs
Created Jan 16, 2015
Mimicking some of the samples from the talk "Go Concurrency Patterns" in c# (slides at https://talks.golang.org/2012/concurrency.slide#1) , to help illustrate the GO Channel concept to C# developers.
View SimpleChannelPatterns.cs
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace GoPatterns
{
class Program
{
static void Main()
View keybase.md

Keybase proof

I hereby claim:

  • I am kenegozi on github.
  • I am kenegozi (https://keybase.io/kenegozi) on keybase.
  • I have a public key whose fingerprint is 4233 DAB9 6173 B1E4 E3D0 6263 B290 B45A ABB9 35CD

To claim this, I am signing this object:

View gist:38efab4ef3a810efb0d8
private func validateInputs() -> Bool {
let nonEmpty = {
(data:String!) -> Bool in
return count(data) != 0
}
func inRange (min: Int!, max:Int!) -> (String!) -> Bool {
return { (data:String!) -> Bool in
let dataAsInt = data.toInt()
return (dataAsInt! >= min && dataAsInt! <= max)
@kenegozi
kenegozi / EnvThenConfigSettings.cs
Created Jun 1, 2015
Env based appSettings overrides, plus DictionaryAdapter fun
View EnvThenConfigSettings.cs
using System;
using System.Configuration;
using System.Collections;
using Castle.Components.DictionaryAdapter;
namespace Demo {
class MainClass {
public static void Main (string[] args) {
var ageString = (string)ConfigurationManager.AppSettings ["Age"];
@kenegozi
kenegozi / fix_crlf.bat
Created Sep 16, 2010
fixing text files to DOS style line endings (CRLF)
View fix_crlf.bat
c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe fix_crlf.cs
fix_crlf.exe
@kenegozi
kenegozi / RandomAd.cs
Created Jul 5, 2011
Super dumbed-down ad server - serving a random image every-time.
View RandomAd.cs
using Manos;
using System;
using System.IO;
public class RandomAd : ManosApp {
public RandomAd () {
var ads = Directory.GetFiles(".", "*.gif");
var random = new Random();
Route ("/", ctx=> {
@kenegozi
kenegozi / use_inheritance.cs
Created Oct 8, 2011
Pass compositioned data to views
View use_inheritance.cs
// adding GeneralView class with IsCurrentUserAdmin bool field,
// Derive LayoutView from GeneralView
// Derive HomepageView and PostPageView from LayoutView
public ActionResult ViewPost(string permalink) {
var post = magic.GetPostBy(permalink);
var view= new PostView {Post=post};
GetLayoutData(view);
view.Related = magic.GetContentRelatedTo(post);
Return View(view);
View javascript-proxying-example.js
var x = {
doThis : function() { console.log('doThis'); },
whatIsThat : function(i) { console.log('whatIsThis'); return 'that is ' + i; },
name : 'I am x'
};
for (methodName in x) {
var method = x[methodName];
if (typeof method !== 'function') continue;
x[methodName] = (function(method, methodName) {
@kenegozi
kenegozi / static-latency-logging.cs
Created Jul 22, 2012
Statically logging method call latencies
View static-latency-logging.cs
interface IDoWork {
void DoThis();
string WhatsThat(int that);
}
class DoWork : IDoWork {
public void DoThis() {
Log.Action("DoWork.DoThis", () => DoThisImpl() );
}
You can’t perform that action at this time.