Fetch twitter image and show in one up
324522
function twitterOneUpClickHandler(e){

    closeOneUp()    
    
    var standardResUrl = $(e.target).attr('data-standard-resolution') // e.target.dataset.standardResolution
    var img = new Image()

    $spin.show()

    img.src = standardResUrl
    img.onload = function(){
      
      $spin.hide()
      
      $oneUpTwitter
        .prepend(img)
        
      var $oneUpContainer = $photoPickerTwitter.find('.one-up-wrapper')

      positionFromTop( $photoPickerTwitter, $oneUpContainer )

      showOverlay()

      $oneUpTwitter
        .find('> .close-one-up:first')
        .show()
        .end()
        .show()
        
    }
    
  }
375164
def auto_retweet(bot):
    """"""
    conn = bot.get_social_connection(id='twitter')
    dirname = os.path.expanduser('~/.irc3/twitter/{nick}'.format(**bot.config))

    if not os.path.isdir(dirname):
        os.makedirs(dirname)

    filename = os.path.join(dirname, 'retweeted')
    if os.path.isfile(filename):
        with open(filename) as fd:
            retweeted = [i.strip() for i in fd.readlines()]
    else:
        retweeted = []

    for user in ('pypi', 'gawel_'):
        results = conn.search.tweets(
            q=user + ' AND irc3',
            result_type='recent')
        for item in results.get('statuses', []):
            if item['user']['screen_name'] == user:
                if item['id_str'] not in retweeted:
                    res = conn(getattr(conn.statuses.retweet, item['id_str']))
                    if 'id' in res:
                        with open(filename, 'a+') as fd:
                            fd.write(item['id_str'] + '\n')
970037
public function twitterCardImage()
    {
        $context = $this->contextObject();

        $img = null;
        if ($context instanceof HasTwitterCardInterface) {
            $img = (string)$context['twitter_card_image'];
        }

        if (!$img) {
            $img = (string)$this->fallbackTwitterCardImage();
        }

        if ($img) {
            $uri = $this->baseUrl();
            return $uri->withPath(strval($img));
        }

        return $this->metaImage();
    }
1363620
def main(args):
    """"""
    global logging, log

    args = parse_args(args)
    logging.basicConfig(format=LOG_FORMAT,
                        level=logging.DEBUG if args.verbose else logging.INFO,
                        stream=sys.stdout)
    df = cat_tweets(path=args.path, verbosity=args.verbose + 1, numtweets=args.numtweets, ignore_suspicious=False)
    log.info('Combined {} tweets'.format(len(df)))
    df = drop_nan_columns(df)
    save_tweets(df, path=args.path, filename=args.tweetfile)
    geo = get_geo(df, path=args.path, filename=args.geofile)
    log.info("Combined {} tweets into a single file {} and set asside {} geo tweets in {}".format(
        len(df), args.tweetfile, len(geo), args.geofile))
    return df, geo
74758
def url(self):
        """"""
        if self.is_unicode_emoji():
            return Asset(self._state)

        _format = 'gif' if self.animated else 'png'
        url = "https://cdn.discordapp.com/emojis/{0.id}.{1}".format(self, _format)
        return Asset(self._state, url)
1273175
def render_twitter(text, **kwargs):
    
    author = render_author(**kwargs['author'])
    metadata = render_metadata(**kwargs['metadata'])
    image = render_image(**kwargs['image'])

    html = """
        <div class="attachment attachment-twitter">
            {author}
            <p class="twitter-content">{text}</p>
            {metadata}
            {image}
        </div>
    """.format(
        author=author,
        text=text,
        metadata=metadata,
        image=image
    ).strip()

    return html
918065
def show_image(self, key):
        """"""
        data = self.model.get_data()
        data[key].show()
1192277
def search_fetch_force(request, id, redirect_to):
    """"""
    search = Search.objects.get(id=id)
    search.fetch(force=True)
    msg = _("Fetched tweets for %s" % search.criteria)
    messages.success(request, msg, fail_silently=True)
    return HttpResponseRedirect(redirect_to)
699343
function() {

      var id, cssClass, src, target, link, alt, title;

      // populate link values
      if (hashedit.current.node !== null) {

        // get  attributes
        id = hashedit.current.node.getAttribute('id') || '';
        cssClass = hashedit.current.node.getAttribute('class') || '';
        src = hashedit.current.node.getAttribute('src') || '';
        alt = hashedit.current.node.getAttribute('alt') || '';
        title = hashedit.current.node.getAttribute('title') || '';


        // show the link dialog
        link = document.querySelector('#hashedit-image-settings-modal');
        link.setAttribute('visible', '');

        // sets start values
        document.getElementById('hashedit-image-id').value = id;
        document.getElementById('hashedit-image-cssclass').value = cssClass;
        document.getElementById('hashedit-image-src').value = src;
        document.getElementById('hashedit-image-alt').value = alt;
        document.getElementById('hashedit-image-title').value = title;

      }

    }
1008164
function crawlImage ($,result, img, callback) {
      var parentUrl = result.url;

      var link = $(img).attr('src');
      var alt = $(img).attr('alt');
      if (link) {
          var linkUri = URI.linkToURI(parentUrl, link);
          pm.crawlImage(parentUrl, linkUri, alt, function(){
            addLinkToQueue(result, parentUrl, linkUri, null, null, callback);
          });
      }
      else {
        callback();
      }
}
1161511
function() {
        if (this.layer.async) {
            // Asynchronous image requests call the asynchronous getURL method
            // on the layer to fetch an image that covers 'this.bounds'.
            var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
            this.layer.getURLasync(this.bounds, function(url) {
                if (id == this.asyncRequestId) {
                    this.url = url;
                    this.initImage();
                }
            }, this);
        } else {
            // synchronous image requests get the url immediately.
            this.url = this.layer.getURL(this.bounds);
            this.initImage();
        }
    }
1085079
function twitterClickHandler(){
    
    var url = $twitter.attr('href') 
    
    $
    .get(url)
    .success(function(data){ 
      
      $spin.hide()
      
      // console.dir(data)
      
      var sorted = []
      var thumbs = ""
      
      if(data.error){
        console.dir(data.error)
        alert(data.error_message)
        return false
      }
      
      $.each(data.media,function(i,el){
        
        thumbs += "<img data-standard-resolution='"
                  + el.full_url
                  +"' src='"+ el.thumb_url+"' />"

      }) // end $.each()
      
      // Add to photoPicker div
      $oneUpTwitterWrapper
        .before(thumbs)

      // Show the photo picker fb section
      $photoPickerTwitter
        .show()

      // Wire up the events to the images...
      wireTwitterGalleryPicker()

      // Progress to Step 2
      progressToNextStep($stepOne, function(){

        $stepTwo.slideDown(333)

      })
      
      // console.dir(sorted)
      
    })
    .error(function(e,b){
      $spin.hide()
      if(e.status === 400) alert(e.responseText || 'Bad request.')
      if(e.status === 401) alert(e.responseText || 'Unauthorized request.')
      if(e.status === 402) alert(e.responseText || 'Forbidden request.')
      if(e.status === 403) alert(e.responseText || 'Forbidden request.')
      if(e.status === 404) alert(e.responseText || 'Images were not found.')
      if(e.status === 405) alert(e.responseText || 'That method is not allowed.')
      if(e.status === 408) alert(e.responseText || 'The request timed out. Try again.')
      if(e.status === 500) alert(e.responseText || 'Something went really wrong.')
    })
    
    return false
    
  }
617594
def parse_binlinks_from_tweet(tweetdict):
    

    urls = []

    if "user" in tweetdict.keys():
        urls.append(tweetdict["user"]["profile_image_url_https"])
        urls.append(tweetdict["user"]["profile_background_image_url_https"])

    if "extended_entities" in tweetdict.keys():
        urls.extend(parse_extended_entities(tweetdict["extended_entities"]))
    return urls
719107
def fetch_image(self,rtsp_server_uri = _source,timeout_secs = 15):
        
        
        self._check_ffmpeg()
        cmd = "ffmpeg -rtsp_transport tcp -i {} -loglevel quiet -frames 1 -f image2pipe -".format(rtsp_server_uri)

        #stdout = _sp.check_output(ffmpeg_cmd,timeout = timeout_secs)
        with _sp.Popen(cmd, shell=True,  stdout=_sp.PIPE) as process:
            try:
                stdout,stderr = process.communicate(timeout=timeout_secs)
            except _sp.TimeoutExpired as e:
                process.kill()
                raise TimeoutError("Connection to {} timed out".format(rtsp_server_uri),e)
        
        return _Image.open(_io.BytesIO(stdout))
1357440
function fetchGitHub(url) {
  return fetch(url).then(res => {
    if (res.status === STATUS_NOT_FOUND) {
      throw new Error('USER_NOT_FOUND');
    } else if (res.status !== STATUS_OK) {
      throw new Error('CANNOT_FETCH_DATA');
    }
    return res.text();
  });
}
320010
def expand_tweet_urls(tweet):
    
    if 'retweeted_status' in tweet:
        text = 'RT @{user}: {text}'.format(user=tweet['retweeted_status']['user']['screen_name'],
                                           text=tweet['retweeted_status']['text'])
        urls = tweet['retweeted_status']['entities']['urls']
    else:
        text = tweet['text']
        urls = tweet['entities']['urls']

    for url in urls:
        text = text.replace(url['url'], '<a href="%s">%s</a>' % (url['expanded_url'], url['display_url']))
    tweet['html'] = text
    return tweet
241414
def show_image(kwargs, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_image action must be called with -f or --function.'
        )

    params = {'ImageId.1': kwargs['image'],
              'Action': 'DescribeImages'}
    result = aws.query(params,
                       setname='tagSet',
                       location=get_location(),
                       provider=get_provider(),
                       opts=__opts__,
                       sigver='4')
    log.info(result)

    return result