benutzt von dropBox2
436870
public static function attachLabel($element, $label, $type = self::LABEL_TOP) {
    Code::value($type, self::LABEL_TOP, self::LABEL_CHECKBOX);

    if ($label != NULL) {
      $element->templateContent->label = fHTML::label($label, $element)
        ->addClass('\Psc\label')
      ;
    
      if ($type == self::LABEL_TOP) {
        $element->templatePrepend('%label%');  // nicht überschreiben sondern prependen
      }
    
      if ($type == self::LABEL_CHECKBOX) {
        $element->template = '%self% %label%';
        $element->templateContent->label->addClass('checkbox-label');
      }
    }
    
    return $element;
  }
220356
protected function setupDropboxHeaders()
    {
        $headers = [
            'Dropbox-API-Arg' => json_encode(
                $this->request
            ),
        ];
        if (!empty($this->content) ||
               $this->apiEndpoint == 'files/upload_session/finish') {
            // The upload_session/finish API requires a Content-Type, always
            $headers['Content-Type'] = 'application/octet-stream';
        }

        return $headers;
    }
1152357
public function sendRequest(DropboxRequest $request, DropboxResponse $response = null)
    {
        //Method
        $method = $request->getMethod();

        //Prepare Request
        list($url, $headers, $requestBody) = $this->prepareRequest($request);

        $options = [];
        if ($response instanceof DropboxResponseToFile) {
            $options['sink'] = $response->getFilePath();
        }

        //Send the Request to the Server through the HTTP Client
        //and fetch the raw response as DropboxRawResponse
        $rawResponse = $this->getHttpClient()->send($url, $method, $requestBody, $headers, $options);

        //Create DropboxResponse from DropboxRawResponse
        $response = $response ?: new DropboxResponse($request);
        $response->setHttpStatusCode($rawResponse->getHttpResponseCode());
        $response->setHeaders($rawResponse->getHeaders());
        if (!$response instanceof DropboxResponseToFile) {
            $response->setBody($rawResponse->getBody());
        }

        //Return the DropboxResponse
        return $response;
    }
148613
public function dropStreams() : void
    {
        $files = $this->toArray();

        foreach ($files as $k => $v) {
            if (is_array($v) === false) {
                $v->dropStream();
            } else {
                foreach ($v as $f) {
                    $f->dropStream();
                }
            }
        }
    }
1071245
function onDroppableReturnedDefaultAnnouncement({dragEvent, dropzone}) {
  const sourceText = dragEvent.source.textContent.trim() || dragEvent.source.id || 'draggable element';
  const dropzoneText = dropzone.textContent.trim() || dropzone.id || 'droppable element';

  return `Returned ${sourceText} from ${dropzoneText}`;
}
589711
function zip() {
  var dist = 'dist';
  var ext = '.html';

  function getHtmlFiles(dir) {
    return fs.readdirSync(dir)
      .filter(function(file) {
        var fileExt = path.join(dir, file);
        var isHtml = path.extname(fileExt) == ext;
        return fs.statSync(fileExt).isFile() && isHtml;
      });
  }

  var htmlFiles = getHtmlFiles(dist);

  var moveTasks = htmlFiles.map(function(file){
    var sourcePath = path.join(dist, file);
    var fileName = path.basename(sourcePath, ext);

    var moveHTML = gulp.src(sourcePath)
      .pipe($.rename(function (path) {
        path.dirname = fileName;
        return path;
      }));

    var moveImages = gulp.src(sourcePath)
      .pipe($.htmlSrc({ selector: 'img'}))
      .pipe($.rename(function (path) {
        path.dirname = fileName + path.dirname.replace('dist', '');
        return path;
      }));

    return merge(moveHTML, moveImages)
      .pipe($.zip(fileName+ '.zip'))
      .pipe(gulp.dest('dist'));
  });

  return merge(moveTasks);
}
391041
@Override
    public boolean propagateValue(String destPath, String valueString, boolean tryToCreate, boolean allowOverwrite) {
        boolean ret = false;

        // wenn dieses de gemeint ist
        if (destPath.equals(getPath())) {
            if (this.value != null) { // es gibt schon einen Wert
                if (!allowOverwrite) { // überschreiben ist nicht erlaubt
                    throw new OverwriteException(getPath(), value.toString(), valueString);
                }
            }

            setValue(valueString);
            ret = true;
        }

        return ret;
    }
788819
public function export() {
    $export = parent::export();
    $export->url = $this->getURL(); // url für die response hinzufügen
    $export->size = $this->getFile()->getSize();
    unset($export->file);
    
    return $export;
  }
1322349
def dropEvent(self, event):
        """"""
        urls = mimedata2url(event.mimeData())
        if urls:
            event.setDropAction(Qt.CopyAction)
            event.accept()
            self.sig_files_dropped.emit(urls)
        else:
            event.ignore()
319740
byte[] getBytes() {

        byte[] ret = new byte[48];

        ret[0] =
            (byte) (
                (this.leapIndicator << 6)
                | (this.version << 3)
                | this.mode
            );

        // wird nie ausgewertet, da nur auf die Client-Message angewandt
        if (this.mode != 3) {

            ret[1] = (byte) this.stratum;
            ret[2] = (byte) this.pollInterval;
            ret[3] = this.precision;

            int rdelay = (int) (this.rootDelay * BIT16);
            ret[4] = (byte) ((rdelay >> 24) & 0xFF);
            ret[5] = (byte) ((rdelay >> 16) & 0xFF);
            ret[6] = (byte) ((rdelay >> 8) & 0xFF);
            ret[7] = (byte) (rdelay & 0xFF);

            long rdisp = (long) (this.rootDispersion * BIT16);
            ret[8] = (byte) ((rdisp >> 24) & 0xFF);
            ret[9] = (byte) ((rdisp >> 16) & 0xFF);
            ret[10] = (byte) ((rdisp >> 8) & 0xFF);
            ret[11] = (byte) (rdisp & 0xFF);

            for (int i = 0; i < 4; i++) {
                ret[12 + i] = this.refID[i];
            }

            encode(ret, 16, this.referenceTimestamp);
            encode(ret, 24, this.originateTimestamp);
            encode(ret, 32, this.receiveTimestamp);

        }

        encode(ret, 40, this.transmitTimestamp);

        return ret;

    }
639846
private void addToList__() {
    //Theman suchen
    final String MUSTER_START = "<div class=\"mediaCon\">";
    final String MUSTER_STOPP = "<h2 class=\"rasterHeadline\">OFT GESUCHT</h2>";
    final String MUSTER_URL = "<a href=\"tvshow.htm?show=";
    final String MUSTER_THEMA = "title=\"";
    MSStringBuilder strSeite = new MSStringBuilder(Const.STRING_BUFFER_START_BUFFER);
    GetUrl getUrlIo = new GetUrl(getWartenSeiteLaden());
    strSeite = getUrlIo.getUriWithDelay(SENDERNAME, "http://swrmediathek.de/tvlist.htm", StandardCharsets.UTF_8, 2, strSeite, "", 4, TimeUnit.SECONDS);
    int pos = 0;
    String url;
    String thema;
    int stop = strSeite.indexOf(MUSTER_STOPP);
    while (!Config.getStop() && (pos = strSeite.indexOf(MUSTER_START, pos)) != -1) {
      if (stop > 0 && pos > stop) {
        break;
      }
      pos += MUSTER_START.length();
      url = strSeite.extract(MUSTER_URL, "\"", pos);
      thema = strSeite.extract(MUSTER_THEMA, "\"", pos);
      thema = StringEscapeUtils.unescapeHtml4(thema.trim()); //wird gleich benutzt und muss dann schon stimmen
      if (thema.isEmpty()) {
        Log.errorLog(915263078, "kein Thema");
      }
      if (url.isEmpty()) {
        Log.errorLog(163255009, "keine URL");
      } else {
        //url = url.replace("&amp;", "&");
        String[] add = new String[]{"http://swrmediathek.de/tvshow.htm?show=" + url, thema};
        listeThemen.addUrl(add);
      }
    }
  }
730946
function createDownloadList() {
		uploadFiles = [];
	

		files.forEach(function(item, i, arr) {
			var preg = new RegExp(item);
			var check = false;    
			serverFonts.forEach(function(item, i, arr) {
				if (preg.test(item)) {
					uploadFiles.push(item);
					check = true;
					// serverFonts.remove(item);
				}
			});
			if (!check){
				grunt.log.warn('You have no suitable fonts at pattern ' + item);
			}
		});

		downloadFiles();
	}
790173
def df2chucks(din,chunksize,outd,fn,return_fmt='\t',force=False):
    
    from os.path import exists#,splitext,dirname,splitext,basename,realpath
    from os import makedirs
    din.index=range(0,len(din),1)

    chunkrange=list(np.arange(0,len(din),chunksize))
    chunkrange=list(zip([c+1 if ci!=0 else 0 for ci,c in enumerate(chunkrange)],chunkrange[1:]+[len(din)-1]))

    chunk2range={}
    for ri,r in enumerate(chunkrange):    
        chunk2range[ri+1]=r

    if not exists(outd):
        makedirs(outd)
    chunks=[]
    chunkps=[]
    for chunk in chunk2range:
        chunkp='{}/{}_chunk{:08d}.tsv'.format(outd,fn,chunk)
        rnge=chunk2range[chunk]
        din_=din.loc[rnge[0]:rnge[1],:]
        if not exists(chunkp) or force:
            if return_fmt=='list':
                chunks.append(din_)
            else:
                din_.to_csv(chunkp,sep=return_fmt)
            del din_
        chunkps.append(chunkp)
    if return_fmt=='list':
        return chunks
    else:
        return chunkps
199463
public function php() {
    $cr = "\n";
    
    $php = $this->phpDocBlock(0);
    
    $ms = array(self::MODIFIER_ABSTRACT => 'abstract',
                self::MODIFIER_FINAL => 'final'
               );
    
    foreach ($ms as $const => $modifier) {
      if (($const & $this->modifiers) == $const)
        $php .= $modifier.' ';
    }
    
    $php .= 'class '.$this->getClassName().' ';
    
    /* Extends */
    if (isset($this->parentClass)) {
      if ($this->parentClass->getNamespace() === $this->getNamespace()) {
        $php .= 'extends '.$this->parentClass->getClassName().' '; // don't prefix namespace
      } else {
        $php .= 'extends '.'\\'.$this->parentClass->getFQN().' ';
      }
    }
    
    /* Interfaces */
    if (count($this->getInterfaces()) > 0) {
      $php .= 'implements ';
      $that = $this;
      $php .= A::implode($this->getInterfaces(), ', ', function (GClass $iClass) use ($that) {
        if ($that->getNamespace() === $iClass->getNamespace()) {
          return $iClass->getClassName();
        } else {
          return '\\'.$iClass->getFQN();
        }
      });
      $php .= ' ';
    }
    
    $php .= '{'.$cr;
    /* Die Funktionen machen immer den Abstand nach oben. Also vor jedem Property und jeder Methode macht dies ein "\n" */

    /* Constants */
    $php .= A::joinc($this->getConstants(), '  '.$cr.'%s;'.$cr, function ($constant) {
      return $constant->php(2);
    });
    
    /* Properties */
    $php .= A::joinc($this->getProperties(), '  '.$cr.'%s;'.$cr, function ($property) {
      return $property->php(2); // hier jetzt auch wegen DocBlock einrücken
    });

    /* Methods */
    $php .= A::joinc($this->getMethods(), '  '.$cr.'%s'.$cr, function ($method) {
      return $method->php(2); // rückt selbst zwischen den Klammern ein, aber wir wollen ja den body z.b. auf 4 haben nicht auf 2
    });
    
    $php .= '}'; // kein umbruch hinten, immer abstand nach oben!
    return $php;
  }
405186
public function get() {
    $__html = NULL;
    
    if ($this->validate()) {
    
      /* dies ersetzt variablen die durch das template verändert werden können: $$__varName */
      extract((array)$this->vars);
      
      $tpl = $this;

      /* get as String */
      try {
        ob_start();
        require $this->file;
        $__html = ob_get_contents();
        ob_end_clean();
      } catch (\Psc\Exception $e) {
        $e->setMessage(sprintf('in TPL(%s): %s',$this->getDisplayName(),$e->getMessage()));
        throw $e;
      }
  
      /* testen ob noch variablen übrig sind */
      //if (DEV) {
      //  $__matches = array();
      //  if (preg_match_all('/\{\$([a-zA-Z_0-9]*)\}/',$__html,$__matches,PREG_SET_ORDER) > 0) {
      //    foreach ($__matches as $__match) {
      //    //throw new Exception('in Template: '.$__fileName.' ist Variable "'.$__match[1].'" nicht definiert');
      //      trigger_error('in Template: '.$__fileName.' wird die Variable "'.$__match[1].'" nicht definiert (die von einem anderen Template benötigt wird)',E_USER_WARNING);
      //    }
      //  }
      //}
  
      if ($this->indent !== NULL) {
        $__html = S::indent($__html, $this->indent);
      }
    }

    return $__html;
  }
223985
public List<Blob> batchUpdate(String bucketName, String blobName1, String blobName2) {
    // [START batchUpdate]
    Blob firstBlob = storage.get(bucketName, blobName1);
    Blob secondBlob = storage.get(bucketName, blobName2);
    List<Blob> updatedBlobs =
        storage.update(
            firstBlob.toBuilder().setContentType("text/plain").build(),
            secondBlob.toBuilder().setContentType("text/plain").build());
    // [END batchUpdate]
    return updatedBlobs;
  }
142954
function() {

      var x, dz, arr, card, list, item, path, url, title, description,
        params, xhr, value, el, options;

      // check for dropzone
      if(Dropzone != undefined && Dropzone != null) {

        // set dropzone options
        var options = {
          url: hashedit.uploadUrl
        };

        // setup token headers
        if(hashedit.useToken == true) {
          options.headers = {};
          options.headers[hashedit.authHeader] = hashedit.authHeaderPrefix + ' ' + localStorage.getItem(hashedit.tokenName);
        }

        // create the dropzone
        dz = new Dropzone("#hashedit-dropzone", options);

        dz.on("complete", function(file) {
          dz.removeFile(file);
        });

        dz.on("success", function(file, response) {

          var value = 'files/' + file.name;

          // set value
          el = document.getElementById('hashedit-image-src');
          el.value = value;

          // add item to list
          list = document.getElementById('images-list');

          item = document.createElement('div');
          item.setAttribute('class', 'hashedit-list-item');
          item.innerHTML = 'images/' + value;
          item.setAttribute('data-value', 'images/' + value);

          list.appendChild(item);

          // fire input event
          el.dispatchEvent(new Event('input', {
            'bubbles': true
          }));

          // flip card
          card = document.getElementById('hashedit-image-settings-modal');
          card.removeAttribute('hashedit-card-flipped');

        });

      }

      // handle click on images list
      list = document.getElementById('images-list');

      ['click'].forEach(function(e) {
        list.addEventListener(e, function(e) {

          if (e.target.hasAttribute('data-value') === true) {
            value = e.target.getAttribute('data-value');

            // set value
            el = document.getElementById('hashedit-image-src');
            el.value = value;

            // fire input event
            el.dispatchEvent(new Event('input', {
              'bubbles': true
            }));

            // flip card
            card = document.getElementById(
              'hashedit-image-settings-modal');
            card.removeAttribute('hashedit-card-flipped');
          }

        });
      });

      // handle click on images list
      list = document.getElementById('pages-list');

      ['click'].forEach(function(e) {
        list.addEventListener(e, function(e) {

          if (e.target.hasAttribute('data-value') === true) {
            value = e.target.getAttribute('data-value');

            // set value
            el = document.getElementById('hashedit-link-href');
            el.value = value;

            // fire input event
            el.dispatchEvent(new Event('input', {
              'bubbles': true
            }));

            // flip card
            card = document.getElementById('hashedit-link-settings-modal');
            card.removeAttribute('hashedit-card-flipped');
          }

        });
      });

      // setup config events
      arr = document.querySelectorAll('.toggle-select-image');

      for (x = 0; x < arr.length; x += 1) {

        // delegate on .hashedit-config
        ['click'].forEach(function(e) {

          arr[x].addEventListener(e, function(e) {

            // flip the card
            card = document.querySelector(
              '#hashedit-image-settings-modal');

            if(card.hasAttribute('hashedit-card-flipped')) {
              card.removeAttribute('hashedit-card-flipped');
            } else {
              card.setAttribute('hashedit-card-flipped', 'true');
            }

            if (hashedit.imagesListLoaded === false) {

              // set default auth
              var obj = {
                credentials: 'include'
              }

              // enable token based auth
              if(hashedit.useToken) {

                // set obj headers
                obj = {
                  headers: {}
                };

                obj.headers[hashedit.authHeader] = hashedit.authHeaderPrefix + ' ' + localStorage.getItem(hashedit.tokenName);
              }

              // load the images
              fetch(hashedit.imagesListUrl, obj)
                .then(function(response) {

                  return response.json();

                }).then(function(json) {

                  list = document.getElementById('images-list');
                  list.innerHTML = '';

                  for (x = 0; x < json.length; x += 1) {
                    item = document.createElement('div');
                    item.setAttribute('class',
                      'hashedit-list-item');
                    item.innerHTML = json[x];
                    item.setAttribute('data-value', json[x]);

                    list.appendChild(item);
                  }

                  hashedit.imagesListLoaded = true;

                }).catch(function(ex) {
                  console.log('parsing failed', ex);
                });
            }

          });

        });
      }

      // setup config events
      arr = document.querySelectorAll('.toggle-select-url');

      for(x = 0; x < arr.length; x += 1) {

        // delegate on .hashedit-config
        ['click'].forEach(function(e) {

          arr[x].addEventListener(e, function(e) {

            // flip the card
            card = document.querySelector('#hashedit-link-settings-modal');

            if(card.hasAttribute('hashedit-card-flipped')) {
              card.removeAttribute('hashedit-card-flipped');
            }
            else {
              card.setAttribute('hashedit-card-flipped', 'true');
            }

            if(hashedit.pagesListLoaded === false) {

              // set default auth
              var obj = {
                credentials: 'include'
              }

              // enable token based auth
              if(hashedit.useToken) {

                // set obj headers
                obj = {
                  headers: {}
                };

                obj.headers[hashedit.authHeader] = hashedit.authHeaderPrefix + ' ' + localStorage.getItem(hashedit.tokenName);
              }

              // load the pages
              fetch(hashedit.pagesListUrl, obj)
                .then(function(response) {

                  return response.json();

                }).then(function(json) {

                  list = document.getElementById('pages-list');
                  list.innerHTML = '';

                  for (x = 0; x < json.length; x += 1) {
                    item = document.createElement('div');
                    item.setAttribute('class', 'hashedit-list-item');
                    item.innerHTML = json[x].url;
                    item.setAttribute('data-value', json[x].url);

                    list.appendChild(item);
                  }

                  hashedit.pagesListLoaded = true;

                }).catch(function(ex) {
                  console.log('parsing failed', ex);
                });


            }

          });

        });
      }

    }