Skip to content

Instantly share code, notes, and snippets.

Piotr Mionskowski miensol

Block or report user

Report or block miensol

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
miensol / RazorHtmlFormatter.cs
Created Feb 27, 2012
Razor MediaTypeFormatter
View RazorHtmlFormatter.cs
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using RazorEngine;
miensol / Observable
Last active Dec 16, 2015
Javascript Observable
View Observable
var Observable = function(){
var that = this,
listeners = {},
callHandler = function(args){
this.handler.apply(this.scope, args);
on = function(eventName, handlerFun, scope){
var listenerList = [], handlerObj;
throw "cannot call 'on' with empty eventName";
miensol / Gruntfile.js
Created Jul 1, 2013
Grunt watching less and coffee Compiles individual files
View Gruntfile.js
var path = require('path');
module.exports = function(grunt) {
// Project configuration.
pkg: grunt.file.readJSON('package.json'),
coffee: {
all: {
files: [{
miensol / Global.asax.cs
Created Aug 27, 2013
Loading views from outside of mvc root directory
View Global.asax.cs
using System.Collections.Specialized;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.Routing;
namespace TestSamples.VirtualPath
View net-proxy.js
var net = require('net'),
http = require('http'),
Writable = require('stream').Writable,
parsers = http.parsers,
HTTPParser = process.binding('http_parser').HTTPParser,
util = require('util'),
EventEmitter = require('events').EventEmitter;
function freeParser(parser, req) {
if (parser) {
View generator_simple.harmony.js
var sequence = function *() {
yield 1;
yield 2;
var sequenceGenerator = sequence();
var current = null;
current =;
current =;
View generator_simple.harmony.js
var fibo = function *(){
var a = 0,
b = 1;
yield a;
yield b;
var next = a + b;
yield next;
a = b;
View generator_simple.harmony.js
var oracle = function *(){
var question = yield "Hello";
while(question != "Bye!"){
var answer = Math.random();
console.log(question, "oracle says: ", Math.random());
question = yield answer;
console.log("Thank you!")
miensol / generator_simple.harmony.js
Created Jun 14, 2014
generator throwing excaptions
View generator_simple.harmony.js
var throwing = function *(){
console.log('Generator entered, yielding first value');
yield 1;
console.log('Generator asked for second value - will go bum');
throw new Error("You can only call this generator once, sorry!");
console.log('Will never get here');
yield 3;
var throwingGenerator = throwing();
miensol / generator_simple.harmony.js
Created Jun 14, 2014
generator receiving exceptions
View generator_simple.harmony.js
var catchingGenerator = function *(){
console.log('I will stop when you tell me about error');
var error = null;
while(error === null){
try {
var value = yield null;
console.log("Got value from you: %s", value);
error = e;
You can’t perform that action at this time.