Skip to content

Instantly share code, notes, and snippets.

View AviAvni's full-sized avatar

Avi Avni AviAvni

View GitHub Profile
object GeoHash{
val base32 = "0123456789bcdefghjkmnpqrstuvwxyz"
def encode( longtitude:Double, latitude:Double, range:Double) = {
def asBit( d:Double,max:Double,min:Double ) : List[Boolean] = {
val mid = ( max + min ) / 2
var res = ( d >= mid )
val (m,n) = if( res ) (max,mid) else (mid,min)
if( Math.abs( m - n ) <= range )
res :: Nil
@debasishg
debasishg / gist:8172796
Last active August 30, 2026 15:18
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, TemplateHaskell, FlexibleInstances #-}
{-# OPTIONS_GHC -Wall -fno-warn-missing-signatures #-}
module QQAST where
import Control.Applicative
import Control.Exception
import Control.Monad.State
import Data.Data (Data)
import Data.Generics (extQ)
import Data.IORef
@bryanedds
bryanedds / Vsync.fs
Last active October 24, 2016 21:32
The 'Vsync' (AKA, 'Variable Synchronization') computation expression that coheres into the Sync comp. expr. when SYNC is #defined, and into the Async comp. expr. otherwise.
namespace YourNamespaceHere
open System
open System.Diagnostics
open System.Threading
open System.Threading.Tasks
/// The 'Sync' builder for evaluating expressions in a synchronous style to aid debugging.
type [<Sealed>] Sync () =
member inline this.Bind (x, f) = f x
member inline this.Return x = x
/// <summary>
/// Stops keystrokes on a WPF Window or Adornment from propagating to the Visual Studio code editor.
///
/// "The reason that keys like Backspace and Delete do not work in your WPF windows/Adornments is due to Visual Studio's usage of IOleComponentManager and IOleComponent.
/// Visual Studio and WinForms both use IOleComponent as a way of tracking the active component in the application.
///
/// WPF does not implement IOleComponent or use the IOleComponentManager for its windows. This means that when your WPF window is active, Visual Studio doesn't know that its
/// primary component should not be processing command keybindings. Since "Backspace", "Delete", and several other keys are bound to commands for the text editor,
/// Visual Studio continues processing those keystrokes as command bindings."
///
@bishboria
bishboria / springer-free-maths-books.md
Last active September 1, 2026 09:56
Springer made a bunch of books available for free, these were the direct links
#time
let inline sum list =
match list with
| [] -> LanguagePrimitives.GenericZero< 'T >
| t ->
let mutable acc = LanguagePrimitives.GenericZero< 'T >
for x in t do
acc <- Checked.(+) acc x
acc
type Next<'T> =
| Done of 'T
| Jump of Trampoline<'T>
and Trampoline<'T> = unit -> Next<'T>
module Trampoline =
let Return v : Trampoline<'T> =
fun () ->
Done v
@mrange
mrange / ADT.tt
Last active May 24, 2016 21:16
Reusable ADT generator for C#/T4
<#
var model = new Model ()
{
Namespace = "MyNameSpace" ,
Unions = new []
{
U ( "CustomerKind"
, UC ("Person" , F ("string", "FullName"), F ("string", "SocialNo" ), F ("DateTime", "BirthDate" ))
, UC ("Company", F ("string", "Name" ), F ("string", "CompanyNo"), F ("string" , "TaxNo" ))
),

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x