Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
hodzanassredin / html_get_parse_print.go
Last active December 20, 2015 01:08
parsing and printing of html pagewith custom encoding
package main
import (
"code.google.com/p/go.net/html"
"fmt"
iconv "github.com/sloonz/go-iconv"
"io"
"io/ioutil"
"log"
"net/http"
@hodzanassredin
hodzanassredin / mono-install.sh
Last active December 12, 2016 07:26
mono ubuntu
# Add this 3 lines to your software sources /etc/apt/sources.list:
#deb http://debian.meebey.net/experimental/mono /
#deb http://http.us.debian.org/debian/ unstable main contrib non-free
#deb-src http://http.us.debian.org/debian/ unstable main contrib non-free
sudo apt-get remove mono-complete
sudo apt-get autoremove
sudo apt-get install debian-archive-keyring
sudo apt-get update
sudo apt-get install mono-complete
sudo apt-get install fsharp
<script type="text/javascript">
var scrollEnabled = "@Model.CurrentPageItemsCount" == "@Consts.PageSize";
var page = 1;
$(window).bind('scroll', function () {
if (scrollEnabled) {
if ($(this).scrollTop() + $(this).height() >= ($(document).height() - 100)) {
scrollEnabled = false;
var link = '@Model.PagedLink'.replace("page", page);
$.get(link, function (html) {
var data = $(html).find('.item');
@hodzanassredin
hodzanassredin / static-check.fsx
Created May 6, 2013 20:37
fsharp play with static constraints
type Wrap<'a>(a:'a)
type System.Int32 with
static member Show(i:int) =
System.Console.Write(i);;
let inline show< ^a when ^a : (static member Show: ^a -> Unit) > (a:^a) =
(^a: (static member Show: ^a -> Unit) a);;
show<System.Int32>(1);;
@hodzanassredin
hodzanassredin / union.cs
Created April 20, 2013 19:36
union in cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Union
{
class Union<A,B>
{
@hodzanassredin
hodzanassredin / WcfVersioning.cs
Created February 20, 2013 13:10
wcf api versioning
class DtoUser { }
class DtoUser2 : DtoUser
{
}
//версионирование wcf с заменой dto
interface Iapi1
{
[ServiceKnownType(typeof(DtoUser2))]
DtoUser GetUser(); //change returned dto in v2
DtoUserOld GetUserOld();//remove method in v2
@hodzanassredin
hodzanassredin / MetaphoneRu.cs
Created January 16, 2013 21:53
metaphone implementation for russian language
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Metaphone
{
static class Helpers
@hodzanassredin
hodzanassredin / NaiveBayes.cs
Last active April 21, 2023 20:23
simple naive bayes classifier in c#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
//original https://github.com/bazhenov/naive-bayes-example
namespace NaiveBayesianClasisifier
{
@hodzanassredin
hodzanassredin / TwitterStreamRx.cs
Created January 10, 2013 20:19
c# observable twitterstream
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Text;
using System.Web.Helpers;
namespace TwitterStreamRX
@hodzanassredin
hodzanassredin / CakeDi.cs
Created November 25, 2012 12:08
cake di in csharp
using System;
//http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di/
namespace CakeDI
{
class MainClass
{
public static void Main (string[] args)
{
TestComponentRegistry.Current.UserService.Authenticate("hodza", "pass");
TestComponentRegistry.Current.UserService.Authenticate("hodza2", "pass");