this is currently not used.  It is to download a url that is saved to a model and download that file and prepare the parameters to save.  I am not sure where the best place to put this code, I was thinking of adding it to the middleware.
488394
function(next) {
    var self = this;
    var obj                   = {};
    obj.path                  = path.join(os.tmpdir,  randomstring.generate());
    obj.original_name         = self.document[self.has_attached_file].original_url.split('/').pop();

    this.downloadUrl(self.document[self.has_attached_file].original_url, obj.path, function() {
      self.identify({input: obj.path}, function(err, identity) {
        fs.stat(obj.path, function(err, stats) {
          obj.file_size       = stats.size;
          obj.content_type    = 'image/'+identity.format.toLowerCase();
          next(err, obj);
        })      
      })
    });
  }
504276
function(url, param, args) {
        var index;
        var name;
        var urlArgs = '?';

        var i;
        var oldCount;
        var arrayUrl = url.split('/');

        var res = {
            url : '',
            count : 0
        };

        // For each arguments.
        for (index in args) {
            // Create the name, :argument or name from param in routing.
            name = (typeof(param[index]) != 'undefined') ? param[index] : ':'+index;
            i = 0;
            // Saving count each iteration.
            oldCount = res.count;
            for (; i < arrayUrl.length; ++i) {
                // If an argument match.
                if (arrayUrl[i] == name) {
                    // Replace data with the argument value.
                    arrayUrl[i] = args[index];
                    ++res.count
                }
            }
            // If equal, the argument was not a param url, add in get request.
            if (oldCount == res.count) {
                urlArgs = urlArgs + index + '=' + args[index] + '&'
            }
        }
        // Remove the last character '?' if empty or '&' if filled.
        urlArgs = urlArgs.slice(0, -1);
        // Create the new url.
        res.url = arrayUrl.join('/');
        // Add get arguments.
        res.url = res.url+urlArgs;

        // Return result.
        return res
    }
441761
function save(callback) {
            var model, request;

            model = this;

            this.constructor.dispatch('beforeSave', {
                data : {
                    model : this
                }
            });
            this.dispatch('beforeSave');

            this.isValid(function (isValid) {
                if (isValid) {
                    if (model.hasOwnProperty('id') && model.id !== '') {
                        request = {
                            action : 'update',
                            data : model,
                            model : model.constructor
                        };
                        model.constructor.storage.update(request, function updateCallback(data) {
                            model.constructor.dispatch('afterSave', {
                                data : {
                                    model : model
                                }
                            });

                            model.dispatch('afterSave');
                            if (callback) {
                                callback(data);
                            }
                        });
                    }
                    else {
                        request = {
                            action : 'create',
                            data : model,
                            model : model.constructor
                        };
                        model.constructor.storage.create(request, function createCallback(data) {
                            model.constructor.dispatch('afterSave', {
                                data : {
                                    model : model
                                }
                            });

                            model.dispatch('afterSave');
                            if (callback) {
                                callback(data);
                            }
                        });
                    }
                } else {
                    if (callback) {
                        callback(data);
                    }
                }
            });

        }
20522
def download_from_link(self, link, **kwargs):
        
        # old:new format
        old_arg_map = {'save_path': 'savepath'}  # , 'label': 'category'}

        # convert old option names to new option names
        options = kwargs.copy()
        for old_arg, new_arg in old_arg_map.items():
            if options.get(old_arg) and not options.get(new_arg):
                options[new_arg] = options[old_arg]

        if type(link) is list:
            options['urls'] = "\n".join(link)
        else:
            options['urls'] = link

        # workaround to send multipart/formdata request
        # http://stackoverflow.com/a/23131823/4726598
        dummy_file = {'_dummy': (None, '_dummy')}

        return self._post('command/download', data=options, files=dummy_file)
568176
def code_object(url)
      sha = url_key url
      if o = @url_bucket.get(sha, :r => 1)
        fix_url_object(o)
      end
    rescue Riak::FailedRequest => err
      raise unless err.not_found?
    end
506789
function( absUrl, triggerData, settings, deferred ) {
            var fileUrl = this._createFileUrl( absUrl );

            return $.proxy(function( html, textStatus, xhr ) {
                //pre-parse html to check for a data-url,
                //use it as the new fileUrl, base path, etc
                var content,

                    // TODO handle dialogs again
                    pageElemRegex = new RegExp( "(<[^>]+\\bdata-" + this._getNs() + "role=[\"']?page[\"']?[^>]*>)" ),

                    dataUrlRegex = new RegExp( "\\bdata-" + this._getNs() + "url=[\"']?([^\"'>]*)[\"']?" );

                // data-url must be provided for the base tag so resource requests
                // can be directed to the correct url. loading into a temprorary
                // element makes these requests immediately
                if ( pageElemRegex.test( html ) &&
                    RegExp.$1 &&
                    dataUrlRegex.test( RegExp.$1 ) &&
                    RegExp.$1 ) {
                    fileUrl = $.mobile.path.getFilePath( $("<div>" + RegExp.$1 + "</div>").text() );

                    // We specify that, if a data-url attribute is given on the page div, its value
                    // must be given non-URL-encoded. However, in this part of the code, fileUrl is
                    // assumed to be URL-encoded, so we URL-encode the retrieved value here
                    fileUrl = this.window[ 0 ].encodeURIComponent( fileUrl );
                }

                //dont update the base tag if we are prefetching
                if ( settings.prefetch === undefined ) {
                    this._getBase().set( fileUrl );
                }

                content = this._parse( html, fileUrl );

                this._setLoadedTitle( content, html );

                // Add the content reference and xhr to our triggerData.
                triggerData.xhr = xhr;
                triggerData.textStatus = textStatus;

                // DEPRECATED
                triggerData.page = content;

                triggerData.content = content;

                triggerData.toPage = content;

                // If the default behavior is prevented, stop here!
                // Note that it is the responsibility of the listener/handler
                // that called preventDefault(), to resolve/reject the
                // deferred object within the triggerData.
                if ( this._triggerWithDeprecated( "load", triggerData ).event.isDefaultPrevented() ) {
                    return;
                }

                // rewrite src and href attrs to use a base url if the base tag won't work
                if ( this._isRewritableBaseTag() && content ) {
                    this._getBase().rewrite( fileUrl, content );
                }

                this._include( content, settings );

                // Remove loading message.
                if ( settings.showLoadMsg ) {
                    this._hideLoading();
                }

                deferred.resolve( absUrl, settings, content );
            }, this);
        }
165077
def url
      @url ||= begin
        base = if @collection.nil?
                 cleaned_relative_path
               else
                 Jekyll::URL.new(
                   :template     => @collection.url_template,
                   :placeholders => placeholders
                 )
               end.to_s.chomp("/")
        base << extname
      end
    end
1023597
function() {
  var args = Array.from(arguments)
  var url = _.get(args, '[0]', '')
  var params = _.get(args, '[1]', {})

  // if we specify all of the options as a param object, we're basically done
  // and we can skip all of the parameterization checks below
  if (_.isPlainObject(_.get(args, '[0]', {})))
  {
    params = _.get(args, '[0]', {})
  }
   else
  {
    params = _.assign({}, { url }, params)
  }

  return _.assign({}, params, { op: 'request' })
}
701598
function(url, callback) {
        var parsedUrl = urlparse(url, true);
        var method = this._normalizeSpecMethod(this.spec, {
            base_url: parsedUrl.protocol +'//' + parsedUrl.hostname,
            headers: {},
            method: 'GET',
            path: parsedUrl.pathname + parsedUrl.search
        });
        var request = this._createRequest(method, {}, null);
        this._callRequestMiddlewares(this.middlewares.slice(0), method, request, [], callback);
    }
243065
function (module, action, params) {
        "use strict";
    
        var log = localStorage.getItem('log');
        if (log) {
            if (!params) params = {};
            params.log = log;
        }
    
        Object.defineProperty(this, 'action', {
            'get': function () {
                return action;
            }
        });
    
        var serialized = {
            'moduleID': module.ID,
            'action': action,
            'params': params
        };
    
        Object.defineProperty(this, 'params', {
            'get': function () {
                return params;
            }
        });
    
        if (module.ID.substr(0, 10) === 'libraries/') {
            serialized.version = module.library.version;
        }
        else {
            serialized.version = beyond.params.version;
        }
    
        Object.defineProperty(this, 'serialized', {
            'get': function () {
    
                var output = {};
                $.extend(output, serialized, true);
                return output;
    
            }
        });
    
    }
487887
function getObjectUrl (data) {
  let blob;

  if (typeof data === 'object' && data.constructor.name === 'Blob') {
    blob = data;
  } else if (typeof data === 'string') {
    blob = new Blob([getTextEncoder().encode(data).buffer], {
      type: 'application/octet-stream'
    });
  } else if (typeof data === 'object' && data.constructor && data.constructor.name === 'ArrayBuffer') {
    blob = new Blob([data], {
      type: 'application/octet-stream'
    });
  } else {
    throw new Error('in-browser-download: Data must either be a Blob, a string or an ArrayBuffer');
  }

  return URL.createObjectURL(blob);
}
1322250
def get_url(self, obj, view_name, request, format):
        
        # Unsaved objects will not yet have a valid URL.
        if obj.pk is None:
            return None

        lookup_value = getattr(obj, self.lookup_field)
        lookup_kwargs = {
            self.lookup_field: lookup_value,
        }

        # Try to lookup parent attr
        parent_lookup_value = None
        for attr in self.parent_lookup_field.split("__"):
            if not hasattr(obj, attr):
                break
            parent_lookup_value = getattr(parent_lookup_value or obj, attr)
        if parent_lookup_value:
            lookup_kwargs.update({self.parent_lookup_field: parent_lookup_value})

        return self.reverse(view_name, kwargs=lookup_kwargs, request=request, format=format)
445173
function initModelRead (args) {
    var controller = this
    var model = this.model
    // if model does not have id column then cannot use default controller
    if (!model.columnName('id')) {
        return
    }
    // make sure args is object
    args = requireValidOptionalObject(args)
    // make sure read is defined
    args.read = requireValidOptionalObject(args.read)
    // make sure query args are object
    var queryArgs = requireValidOptionalObject(args.read.query)
    // if specific with records not specified then default to model relations
    if (!defined(queryArgs.with)) {
        queryArgs.with = {}
        // load related records
        _.each(model.relations, (relation, relationName) => {
            // add all related models - limit results to 20
            queryArgs.with[relationName] = {
                limit: 20,
            }
        })
    }
    // if with is false do not load any related records
    if (queryArgs.with === false) {
        delete queryArgs.with;
    }
    // get role
    var role = args.defaultRole || 'all'
    // save forms
    var forms = args.read && args.read.forms
    // index inputs
    var input = {
        // get current revision of instance
        current: 'query.current',
        // get record even if deleted
        deleted: 'query.deleted',
        // instance id
        id: 'params.id',
    }
    // links to display at top of page
    var links
    // use links from read view
    if (Array.isArray(args.read.links)) {
        links = _.cloneDeep(args.read.links)
    }
    // use global controller links
    else if (Array.isArray(args.links)) {
        links = _.cloneDeep(args.links)
    }
    // set default links
    else {
        links = []
    }
    // create path if it does not exist
    if (!this.paths['/:id']) {
        this.paths['/:id'] = {}
    }
    // add handler for GET /:id to get model instance
    this.paths['/:id'].get = [
        {
            before: function (args) {
                return beforeRead(controller, args, forms, queryArgs)
            },
            input: input,
            method: function (args) {
                // format response
                return read(controller, args, links)
            },
            methodName: 'read',
            role: role,
            template: 'instance',
        },
    ]
}
819225
function Saver() {
    var _saver;

    // Properties
    this.defaultFilename = 'artoo_data';
    this.defaultEncoding = 'utf-8';
    this.xmlns = 'http://www.w3.org/1999/xhtml';
    this.mimeShortcuts = {
      csv: 'text/csv',
      tsv: 'text/tab-separated-values',
      json: 'application/json',
      txt: 'text/plain',
      html: 'text/html',
      yaml: 'text/yaml'
    };

    // Methods
    this.createBlob = function(data, mime, encoding) {
      mime = this.mimeShortcuts[mime] || mime || this.defaultMime;
      return new Blob(
        [data],
        {type: mime + ';charset=' + encoding || this.defaultEncoding}
      );
    };

    this.createBlobFromDataURL = function(url) {
      var byteString = atob(url.split(',')[1]),
          ba = new Uint8Array(byteString.length),
          i,
          l;

      for (i = 0, l = byteString.length; i < l; i++)
        ba[i] = byteString.charCodeAt(i);

      return new Blob([ba.buffer], {
        type: url.split(',')[0].split(':')[1].split(';')[0]
      });
    };

    this.blobURL = function(blob) {
      var oURL = URL.createObjectURL(blob);
      return oURL;
    };

    this.saveResource = function(href, params) {
      var a = document.createElementNS(this.xmlns, 'a');
      a.href = href;

      a.setAttribute('download', params.filename || '');

      // Firefox needs the link attached to the page's DOM
      if ('document' in _root)
        document.body.appendChild(a);

      a.click();

      if ('document' in _root)
        document.body.removeChild(a);
      a = null;

      // Revoking the object URL if we want to
      if (params.revoke)
        setTimeout(function() {
          URL.revokeObjectURL(href);
        });
    };

    // Main interface
    this.saveData = function(data, params) {
      params = params || {};

      // Creating the blob
      var blob = this.createBlob(data, params.mime, params.encoding);

      // Saving the blob
      this.saveResource(
        this.blobURL(blob),
        {
          filename: params.filename || this.defaultFilename,
          revoke: params.revoke || true
        }
      );
    };

    this.saveDataURL = function(url, params) {
      params = params || {};

      // Creating the blob
      var blob = this.createBlobFromDataURL(url);

      // Saving the blob
      this.saveResource(
        blob,
        {filename: params.filename || this.defaultFilename}
      );
    };
  }
677061
function createResource(url, params, methods) {
      var resource;

      params = _.defaults({}, params, defaultParams);
      methods = _.defaults({}, methods, defaultMethods);
      resource = $resource(url, params, methods);

      // overwrite $save to automatically call $create or $update
      resource.prototype.$save = function save() {
        if (!this._id) {
          return this.$create();
        }

        return this.$update();
      };

      return resource;
    }
13267
function(url, paramsObj) {
    if(!paramsObj || typeof paramsObj !== "object") {
        return url;
    }
    
    _.each(_.keys(paramsObj), function(paramName) {
        var string = paramsObj[paramName];
        if (typeof string === 'object') {
            string = JSON.stringify(string);
        }
        url = addParam(url, encodeURIComponent(paramName), encodeURIComponent(string));
    });
    
    return url;
}
246336
function buildModelUrl (protocol, host, apiRoot, modelName, id) {
  var result

  try {
    result = url.format({
      protocol: protocol,
      host: host,
      pathname: url.resolve('/', [apiRoot, modelName, id].join('/'))
    })
  } catch (e) {
    return ''
  }

  return result
}