An alternate view of the solar terminator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Map as M | |
import Data.List (find) | |
import Data.Maybe (fromMaybe) | |
firstNonRep :: String -> Maybe Char | |
firstNonRep xs = let m = M.fromListWith (+) . map (\c -> (c,1)) $ xs | |
lookup = flip (M.findWithDefault 0) m | |
in find ((== 1) . lookup) xs | |
main = print $ case firstNonRep "faabcbcdee" of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bush in Scala | |
package tests | |
object Bush { | |
def main(args : Array[String]) : Unit = { | |
val states = "Alabama\nAlaska\nArizona\nArkansas\nCalifornia\nColorado\nConnecticut\nDelaware\nFlorida\nGeorgia\nHawaii\nIdaho\nIllinois\nIndiana\nIowa\nKansas\nKentucky\nLouisiana\nMaine\nMaryland\nMassachusetts\nMichigan\nMinnesota\nMississippi\nMissouri\nMontana\nNebraska\nNevada\nNew Hampshire\nNew Jersey\nNew Mexico\nNew York\nNorth Carolina\nNorth Dakota\nOhio\nOklahoma\nOregon\nPennsylvania\nRhode Island\nSouth Carolina\nSouth Dakota\nTennessee\nTexas\nUtah\nVermont\nVirginia\nWashington\nWest Virginia\nWisconsin\nWyoming".lines | |
val georgewbush = Set.empty ++ "georgewbush" | |
printf("It's sweet home %s!%n", (states find { state => !(state.toLowerCase exists { georgewbush contains _ }) }).get) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Cocoa accessibility framework for intercepting Spotlight user input. */ | |
#import <Cocoa/Cocoa.h> | |
#import <AppKit/NSAccessibility.h> | |
static void searchFieldCallback(AXObserverRef observer, | |
AXUIElementRef element, | |
CFStringRef notification, | |
void *data) { | |
CFTypeRef subrole, value; | |