Snippets created by devshorts

  • Binary search

    Simple binary search of an array. Tests the array at the middle and divides the search space by half each time it looks for the target item. Returns the target item and how many iterations it took to get there

    2 people like this

    Posted: 4 years ago by devshorts

  • String palindrome

    Tests if a string is a palindrome (whitespace independent)

    1 people like this

    Posted: 4 years ago by devshorts

  • Extract script blocks from html page

    This module extracts all the blocks out of an html page's header. This can be useful if you are writing tools to merge all the js for future minifaction, or for otherwise manipulating the files.

    4 people like this

    Posted: 3 years ago by devshorts

  • Byte to bit list

    Converts a byte list to a bit list. Takes a list of bytes and transforms it all into a flattened array of bits. For example, > bytesToBits [|byte(0x0F);byte(0xF0)|] 16 ;; val it : byte [] = [|0uy; 0uy; 0uy; 0uy; 1uy; 1uy; 1uy; 1uy; 1uy; 1uy; 1uy; 1uy; 0uy; 0uy; 0uy; 0uy|]

    0 people like this

    Posted: 3 years ago by devshorts

  • Print a list in a spiral

    Prints a list in a spiral

    3 people like this

    Posted: 3 years ago by devshorts