<commit_before>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators.short-circuit http.client
images.loader images.loader.private images.viewer io.pathnames
kernel present sequences strings urls ;
IN: images.http

<PRIVATE

: content-type ( response -- type/f )
    content-type>> dup "image/" head?
    [ 6 tail ] [ drop f ] if ;

PRIVATE>

: load-http-image ( path -- image )
    [ http-get swap content-type ]
    [ present file-extension ] bi or
    (image-class) load-image* ;

M: string set-image
    dup { [ "http://" head? ] [ "https://" head? ] } 1||
    [ load-http-image ] [ load-image ] if >>image ;

M: url set-image
    protocol>> load-http-image >>image ;

: http-image. ( path -- )
    load-http-image image. ;<commit_msg>images.http: set retina on the mac<commit_after>! Copyright (C) 2009 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators.short-circuit http.client
images.loader images.loader.private images.viewer io.pathnames
kernel namespaces opengl present sequences strings urls ;
IN: images.http

<PRIVATE

: content-type ( response -- type/f )
    content-type>> dup "image/" head?
    [ 6 tail ] [ drop f ] if ;

PRIVATE>

: load-http-image ( path -- image )
    [ http-get swap content-type ]
    [ present file-extension ] bi or
    (image-class) load-image*
    gl-scale-factor get-global [ 2.0 = >>2x? ] when* ;

M: string set-image
    dup { [ "http://" head? ] [ "https://" head? ] } 1||
    [ load-http-image ] [ load-image ] if >>image ;

M: url set-image
    protocol>> load-http-image >>image ;

: http-image. ( path -- )
    load-http-image image. ;
{'fraction_non_alphanumeric': 0.15189125295508274, 'fraction_numerical': 0.008865248226950355, 'mean_word_length': 2.9463869463869465, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3840691', 'n_tokens_mistral': 580, 'n_tokens_neox': 563, 'n_words': 160}