Perform a spin

 @return [String]
   the printed data

 @api public
760642
def spin
      synchronize do
        return if @done
        emit(:spin)

        if @hide_cursor && !spinning?
          write(TTY::Cursor.hide)
        end

        data = message.gsub(MATCHER, @frames[@current])
        data = replace_tokens(data)
        write(data, true)
        @current = (@current + 1) % @length
        @state = :spinning
        data
      end
    end
619628
def execute
      return unless @start && @limit
      @next_to_insert = @start
      while @next_to_insert <= @limit
        stride = @throttler.stride
        affected_rows = @connection.update(copy(bottom, top(stride)))

        if @throttler && affected_rows > 0
          @throttler.run
        end

        @printer.notify(bottom, @limit)
        @next_to_insert = top(stride) + 1
        break if @start == @limit
      end
      @printer.end
    end
238987
def render
      # we do some normalization here
      status = normalize_status_code(@options[:status])

      base64 = normalized_base64_option(@options)

      headers = @options[:headers] || {}
      set_content_type!(status, headers)
      # x-jets-base64 to convert this Rack triplet to a API Gateway hash structure later
      headers["x-jets-base64"] = base64 ? 'yes' : 'no' # headers values must be Strings

      # Rails rendering does heavy lifting
      if drop_content_info?(status)
        body = StringIO.new
      else

        renderer = ActionController::Base.renderer.new(renderer_options)
        body = renderer.render(render_options)
        body = StringIO.new(body)
      end

      [status, headers, body] # triplet
    end
1192221
def print(self, *args, **kwargs):
        
        clear_len = max(len(self._prev_msg), len(self.msg)) + 4
        self.spinner.stream.write("%s\r" % (' ' * clear_len))
        print(*args, file=self.spinner.stream, flush=True, **kwargs)
763437
def print_subkey_and_value(key, value)
      print_label key
      value.each do |subkey, val|
        if val.is_a? Hash
          print_inner_subkey subkey
          inspect_inner_hash val
        elsif val.is_a? Array
          print_inner_subkey subkey
          extract_hashes_and_print val
        elsif val.is_a? String
          print_hash subkey, val
        end
      end
    end
1208711
def load_result
      if array_or_relation.is_a? Array
        result = array_or_relation[offset..(offset + per_page - 1)]
      else
        result = array_or_relation.limit(per_page).offset(offset).all
      end

      self.replace result.nil? ? [] : result
    end
926276
def load! parse_client=Parse::Client.default
      unless @objects
        pointer = @parent_object.pointer
        key = @column_name
        related_class = Parse::Object @raw_hash['className']
        @objects = related_class.find! :where => proc {
          related_to key, pointer
        }
      end
      @objects
    end
971552
def extract_hashes_and_print(array)
      array.each do |entry|
        if entry.is_a? String
          print_list entry
        else
          inspect_inner_hash entry
        end
      end
    end
853557
def show(request)
      # force load session because it can be lazy loaded
      request.env[@key].delete(:rack_session_access_force_load_session)

      # session hash object
      session_hash = request.env[@key].to_hash

      case File.extname(request.path)
      when ".raw"
        render do |xml|
          xml.h2 "Raw rack session data"
          xml.pre RackSessionAccess.encode(session_hash)
        end
      else
        render do |xml|
          xml.h2 "Rack session data"
          xml.ul do |ul|
            session_hash.each do |k,v|
              ul.li("#{k.inspect} : #{v.inspect}")
            end
          end
          xml.p do |p|
            p.a("Edit", :href => action_path(:edit))
          end
        end
      end
    end
1359476
def rotate a
      if a == nil
        Error.call "Angle is invalid"
      end

      rad = Math::PI * a.to_f / 180.0
      cpy = self # copy to have the same value in z
      cpy.z = 0.0
      s = Matrix.new [[ Math.cos(rad), -Math.sin(rad), 0], [Math.sin(rad), Math.cos(rad), 0], [0, 0, 1]]
      @matrix_op = s

      puts "rotation d'angle #{a.to_f}" if @verbose

      return (s * cpy.to_matrix).to_vector
    end
1002736
def get(path,data={},headers=nil)
      data_to_query(data)
      if headers == nil
        response = @http.send_request('GET', path, @defaults[:data])
      else
        response = @http.send_request('GET', path, @defaults[:data], headers)
      end
      response
    end
1296595
function main(input) {
  // instantiate spinners
  const spinners = new Multispinner(input, {
    preText: 'Downloading'
  })

  /**
   * consume promises (simultaneously)
   * note: then's error cb is unused because download() doesn't rethrow in its
   *   catch statement; its errs are intentionally returned to be formatted and
   *   printed later
   */
  Promise
    .all(
      // generate array of promises to download urls
      input.reduce((accum, url) => {
        accum.push(download(url, url, spinners))
        return accum
      }, [])
    )
    .then(results => spinners.on('done', () => print(results)))
    .catch(err => { throw err })
}
821769
def ror(self, bits, start=None, end=None):
        
        if not self.len:
            raise Error("Cannot rotate an empty bitstring.")
        if bits < 0:
            raise ValueError("Cannot rotate right by negative amount.")
        start, end = self._validate_slice(start, end)
        bits %= (end - start)
        if not bits:
            return
        rhs = self._slice(end - bits, end)
        self._delete(bits, end - bits)
        self._insert(rhs, start)
1047762
def spin_sz(self):
        """"""
        return conversions.secondary_spin(self.mass1, self.mass2, self.spin1z,
                                        self.spin2z)
52819
function spinner(){
    
    var opts = {
      lines: 13, 
      length: 8, 
      width: 2, 
      radius: 10, 
      corners: 1, 
      rotate: 0, 
      color: '#000', 
      speed: 2, 
      trail: 60, 
      shadow: true, 
      hwaccel: true, 
      className: 'spinner', 
      zIndex: 2e9, 
      top: 'auto', 
      left: 'auto' 
    }
    
    var spinner = new Spinner(opts).spin()
    
    $spin
      .append(spinner.el)
      .hide()
    
  }
964372
def execute
      # Here is the order of operations:
      # -> setting @data_sent
      # -> executing before_request_execution callback
      # -> executing the HTTP request
      # -> setting @response
      # -> setting @data_received
      # -> executing after_request_execution callback

      # Setting @data_sent
      params = Rack::Utils.parse_nested_query(URI.parse(@http_request.path).query)
      # Since that's how it will be interpreted anyway on the server, we merge the POST params to the GET params,
      # but it's not supposed to happen: either every params is prepared for GET/query params, or as POST body
      params.merge!(Rack::Utils.parse_nested_query(@http_request.body.to_s))

      # About: Hash[{}.map{|k,v| [k, v.join] }]
      # it transforms the following hash:
      # {"accept"=>["*/*"], "user-agent"=>["TheBigDB RubyWrapper/X.Y.Z"], "host"=>["computer.host"]}
      # into the following hash:
      # {"accept"=>"*/*", "user-agent"=>"TheBigDB RubyWrapper/X.Y.Z", "host"=>"computer.host"}
      # which is way more useful and cleaner.
      @data_sent = {
        "headers" => Hash[@http_request.to_hash.map{|k,v| [k, v.join] }],
        "host" => @http.address,
        "port" => @http.port,
        "path" => URI.parse(@http_request.path).path,
        "method" => @http_request.method,
        "params" => params
      }

      # Executing callback
      TheBigDB.before_request_execution.call(self)

      # Here is where the request is actually executed
      @http_response = TheBigDB.http_request_executor.call(@http, @http_request)

      # Setting @response
      begin
        # We parse the JSON answer and return it.
        @response = JSON(@http_response.body)
      rescue JSON::ParserError => e
        @response = {"status" => "error", "error" => {"code" => "0000", "description" => "The server gave an invalid JSON body:\n#{@http_response.body}"}}
      end

      # Setting @data_received
      @data_received = {
        "headers" => Hash[@http_response.to_hash.map{|k,v| [k, v.join] }],
        "content" => @response
      }

      # Executing callback
      TheBigDB.after_request_execution.call(self)

      # Raising exception if asked
      if TheBigDB.raise_on_api_status_error and @response["status"] == "error"
        raise ApiStatusError.new(@response["error"]["code"])
      end

      self
    end
739379
def debug_print(self):
        

        ring = self._fetch_all()

        print('Hash ring "{key}" replicas:'.format(key=self.key))

        now = time.time()
        n_replicas = len(ring)
        if ring:
            print('{:10} {:6} {:7} {}'.format('Start', 'Range', 'Delay', 'Node'))
        else:
            print('(no replicas)')

        nodes = collections.defaultdict(list)

        for n, (start, replica, heartbeat, expired) in enumerate(ring):
            hostname, pid, rnd = replica.split(':')
            node = ':'.join([hostname, pid])

            abs_size = (ring[(n+1) % n_replicas][0] - ring[n][0]) % RING_SIZE
            size = 100. / RING_SIZE * abs_size
            delay = int(now - heartbeat)

            nodes[node].append((hostname, pid, abs_size, delay, expired))

            print('{start:10} {size:5.2f}% {delay:6}s {replica}{extra}'.format(
                start=start,
                replica=replica,
                delay=delay,
                size=size,
                extra=' (EXPIRED)' if expired else ''
            ))

        print()
        print('Hash ring "{key}" nodes:'.format(key=self.key))

        if nodes:
            print('{:8} {:8} {:7} {:20} {:5}'.format('Range', 'Replicas', 'Delay', 'Hostname', 'PID'))
        else:
            print('(no nodes)')

        for k, v in nodes.items():
            hostname, pid = v[0][0], v[0][1]
            abs_size = sum(replica[2] for replica in v)
            size = 100. / RING_SIZE * abs_size
            delay = max(replica[3] for replica in v)
            expired = any(replica[4] for replica in v)
            count = len(v)
            print('{size:5.2f}% {count:8} {delay:6}s {hostname:20} {pid:5}{extra}'.format(
                start=start,
                count=count,
                hostname=hostname,
                pid=pid,
                delay=delay,
                size=size,
                extra=' (EXPIRED)' if expired else ''
            ))