Created by Tivie on 13-07-2015.
332698
function getDefaultOpts(simple) {
  'use strict';

  var defaultOptions = {
    omitExtraWLInCodeBlocks: {
      default: false,
      describe: 'Omit the default extra whiteline added to code blocks',
      type: 'boolean'
    },
    noHeaderId: {
      default: false,
      describe: 'Turn on/off generated header id',
      type: 'boolean'
    },
    prefixHeaderId: {
      default: false,
      describe: 'Specify a prefix to generated header ids',
      type: 'string'
    },
    headerLevelStart: {
      default: false,
      describe: 'The header blocks level start',
      type: 'integer'
    },
    parseImgDimensions: {
      default: false,
      describe: 'Turn on/off image dimension parsing',
      type: 'boolean'
    },
    simplifiedAutoLink: {
      default: false,
      describe: 'Turn on/off GFM autolink style',
      type: 'boolean'
    },
    literalMidWordUnderscores: {
      default: false,
      describe: 'Parse midword underscores as literal underscores',
      type: 'boolean'
    },
    strikethrough: {
      default: false,
      describe: 'Turn on/off strikethrough support',
      type: 'boolean'
    },
    tables: {
      default: false,
      describe: 'Turn on/off tables support',
      type: 'boolean'
    },
    tablesHeaderId: {
      default: false,
      describe: 'Add an id to table headers',
      type: 'boolean'
    },
    ghCodeBlocks: {
      default: true,
      describe: 'Turn on/off GFM fenced code blocks support',
      type: 'boolean'
    },
    tasklists: {
      default: false,
      describe: 'Turn on/off GFM tasklist support',
      type: 'boolean'
    },
    smoothLivePreview: {
      default: false,
      describe: 'Prevents weird effects in live previews due to incomplete input',
      type: 'boolean'
    }
  };
  if (simple === false) {
    return JSON.parse(JSON.stringify(defaultOptions));
  }
  var ret = {};
  for (var opt in defaultOptions) {
    if (defaultOptions.hasOwnProperty(opt)) {
      ret[opt] = defaultOptions[opt].default;
    }
  }
  return ret;
}
507064
function yy_r197(){
    $this->_retvalue = new _smarty_code($this, '('.$this->yystack[$this->yyidx + -1]->minor.')');
    }
484645
public function CreatePage() 
	{
		parent::CreatePage();
		
		$onlyGroup = ($this->_context->get("onlygroup") != "");
		$urlXml = "module:Xmlnuke.Admin.ManageXML";
		$urlGrp = "module:Xmlnuke.Admin.ManageGroup";

		$this->myWords = $this->WordCollection();
		$this->setTitlePage($this->myWords->Value("TITLE"));
		$this->setHelp($this->myWords->Value("DESCRIPTION"));
		
		if (!$onlyGroup)
		{
			$this->addMenuOption($this->myWords->Value("EDITALLXML"), $urlXml."?id=_all");
			$this->addMenuOption($this->myWords->Value("NEWXML"), $urlXml);
		}
		$this->addMenuOption($this->myWords->Value("NEWGROUP"), $urlGrp);
		
		// Open Index File
		$indexFile = new XMLFilenameProcessor("index");
		//XmlDocument 
		
		$index = $this->_context->getXMLDataBase()->getDocument($indexFile->FullQualifiedName(),null);

		$groupList = XmlUtil::SelectNodes($index->documentElement,"group");
		$table = new XmlTableCollection();
		foreach( $groupList as $node )					
		{				
			
			$groupText = XmlUtil::SelectSingleNode($node,"title")->nodeValue;
			$groupId = XmlUtil::SelectSingleNode($node,"id")->nodeValue;
			
			$row = new XmlTableRowCollection();

			$col = new XmlTableColumnCollection();
			$anchor = new XmlAnchorCollection($urlGrp."?id=".$groupId, "");
			$anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT"), true, false, false));
			$col->addXmlnukeObject($anchor);
			$row->addXmlnukeObject($col);
			
			$col = new XmlTableColumnCollection();
			$anchor = new XmlAnchorCollection($urlGrp."?id=".$groupId."&action=delete", "");
			$anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE"), true, false, false));
			$col->addXmlnukeObject($anchor);
			$row->addXmlnukeObject($col);

			$col = new XmlTableColumnCollection();
			$col->addXmlnukeObject(new XmlnukeText($groupText, true, false, false));
			$row->addXmlnukeObject($col);
			$table->addXmlnukeObject($row);

			if (!$onlyGroup)
			{
				$fileList = XmlUtil::SelectNodes($index->documentElement,"group[id='".$groupId."']/page");
				foreach( $fileList as $nodeFile )
				{
					$fileText = XmlUtil::SelectSingleNode($nodeFile,"title")->nodeValue;
					$fileId = XmlUtil::SelectSingleNode($nodeFile,"id")->nodeValue;
					$fileAbstract = XmlUtil::SelectSingleNode($nodeFile,"summary")->nodeValue;

					$row = new XmlTableRowCollection();
					
					$col = new XmlTableColumnCollection();
					$anchor = new XmlAnchorCollection($urlXml."?id=".$fileId, "");
					$anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_EDIT")));
					$col->addXmlnukeObject($anchor);
					$row->addXmlnukeObject($col);
					
					$col = new XmlTableColumnCollection();
					$anchor = new XmlAnchorCollection($urlXml."?id=".$fileId."&action=delete", "");
					$anchor->addXmlnukeObject(new XmlnukeText($this->myWords->Value("TXT_DELETE")));
					$col->addXmlnukeObject($anchor);
					$row->addXmlnukeObject($col);
	
					$col = new XmlTableColumnCollection();
					$col->addXmlnukeObject(new XmlnukeText($fileText));
					$col->addXmlnukeObject(new XmlnukeBreakLine());
					$col->addXmlnukeObject(new XmlnukeText($fileAbstract, false, true, false));
					$row->addXmlnukeObject($col);
					$table->addXmlnukeObject($row);

				}
			}
		
		}
		
		$block = new XmlBlockCollection($this->myWords->Value("WORKINGAREA"), BlockPosition::Center );

		$paragraph = new XmlParagraphCollection();
		$paragraph->addXmlnukeObject($table);
		$block->addXmlnukeObject($paragraph);
		$this->defaultXmlnukeDocument->addXmlnukeObject($block);
		
		return $this->defaultXmlnukeDocument->generatePage();
	}
1189807
function createIssue (items, repo, title, body, labels) {
  var item = todotxt.item({text: title, date: new Date(), number: items.length + 1});
  labels.forEach(item.addContext);

  if (items.options) {
    if (items.options.priority) {
      item.priority = items.options.priority;
    }
    if (items.options.context) {
      item.addContext(items.options.context);
    }
    if (items.options.project) {
      item.addProject(items.options.project);
    }
  }

  items.push(item);

  return write(items, repo).then(_.constant(convertIssue(item)));
}
705745
function () {
		// Create Layout
		this._el.container 				= TL.Dom.create("div", "tl-slide");

		if (this.has.title) {
			this._el.container.className = "tl-slide tl-slide-titleslide";
		}

		if (this.data.unique_id) {
			this._el.container.id 		= this.data.unique_id;
		}
		this._el.scroll_container 		= TL.Dom.create("div", "tl-slide-scrollable-container", this._el.container);
		this._el.content_container		= TL.Dom.create("div", "tl-slide-content-container", this._el.scroll_container);
		this._el.content				= TL.Dom.create("div", "tl-slide-content", this._el.content_container);
		this._el.background				= TL.Dom.create("div", "tl-slide-background", this._el.container);
		// Style Slide Background
		if (this.data.background) {
			if (this.data.background.url) {
		    var media_type = TL.MediaType(this.data.background, true);
		    if(media_type) {
          this._background_media = new media_type.cls(this.data.background, {background: 1});

          this.has.background.image 					= true;
          this._el.container.className 				+= ' tl-full-image-background';
          this.has.background.color_value 		= "#000";
          this._el.background.style.display 	= "block";
        }
			}
			if (this.data.background.color) {
				this.has.background.color 					= true;
				this._el.container.className 				+= ' tl-full-color-background';
				this.has.background.color_value 			= this.data.background.color;
				//this._el.container.style.backgroundColor = this.data.background.color;
				//this._el.background.style.backgroundColor 	= this.data.background.color;
				//this._el.background.style.display 			= "block";
			}
			if (this.data.background.text_background) {
				this._el.container.className 				+= ' tl-text-background';
			}

		}



		// Determine Assets for layout and loading
		if (this.data.media && this.data.media.url && this.data.media.url != "") {
			this.has.media = true;
		}
		if (this.data.text && this.data.text.text) {
			this.has.text = true;
		}
		if (this.data.text && this.data.text.headline) {
			this.has.headline = true;
		}

		// Create Media
		if (this.has.media) {
			// Determine the media type
			this.data.media.mediatype = TL.MediaType(this.data.media);
			this.options.media_name 	= this.data.media.mediatype.name;
			this.options.media_type 	= this.data.media.mediatype.type;
      this.options.autolink 		= this.data.autolink;

			// Create a media object using the matched class name
			this._media = new this.data.media.mediatype.cls(this.data.media, this.options);
		}

		// Create Text
		if (this.has.text || this.has.headline) {
			this._text = new TL.Media.Text(this.data.text, {title:this.has.title,language: this.options.language, autolink: this.data.autolink });
			this._text.addDateText(this.getFormattedDate());
		}



		// Add to DOM
		if (!this.has.text && !this.has.headline && this.has.media) {
			TL.DomUtil.addClass(this._el.container, 'tl-slide-media-only');
			this._media.addTo(this._el.content);
		} else if (this.has.headline && this.has.media && !this.has.text) {
			TL.DomUtil.addClass(this._el.container, 'tl-slide-media-only');
			this._text.addTo(this._el.content);
			this._media.addTo(this._el.content);
		} else if (this.has.text && this.has.media) {
			this._media.addTo(this._el.content);
			this._text.addTo(this._el.content);
		} else if (this.has.text || this.has.headline) {
			TL.DomUtil.addClass(this._el.container, 'tl-slide-text-only');
			this._text.addTo(this._el.content);
		}

		// Fire event that the slide is loaded
		this.onLoaded();

	}
681658
def created(self):
        ''
        return dateutil.parser.parse(str(self.f.latestRevision.created))
984330
private function writeEndereco(
        $t, $l, $w, $titulo, $nomeDestinatario, $logradouro, $numero1, $complemento, $bairro,
        $cidade, $uf, $cep = null
    )
    {
        // Titulo do bloco: destinatario ou remetente
        $this->pdf->SetFont('', 'B');
        $this->setFillColor(60, 60, 60);
        $this->pdf->SetFontSize(7);
        $this->pdf->SetXY($l + 3, $t);
        $this->t($w, $titulo, 2, '');

        $addressPadding = 5;
        $w = $w - $addressPadding;
        $l = $l + $addressPadding;

        // Nome da pessoa
        $this->pdf->SetFont('', '');
        $this->setFillColor(190, 190, 190);
        $this->pdf->SetX($l);
        $this->multiLines($w, $nomeDestinatario, 'L');

        //Primeria parte do endereco
        $address1 = $logradouro;
        $numero = $numero1;
        if (!$numero || strtolower($numero) == 'sn') {
            $address1 .= ', s/ nº';
        } else {
            $address1 .= ', ' . $numero;
        }
        if ($complemento) {
            $address1 .= ' - ' . $complemento;
        }
        $this->setFillColor(100, 190, 190);
        $this->pdf->SetX($l);
        $this->multiLines($w, $address1, 'L');

        //Segunda parte do endereco
        $this->pdf->SetX($l);
        $this->setFillColor(100, 130, 190);
        $this->multiLines($w, '' . $bairro, 'L');
        $this->setFillColor(100, 30, 210);
        $this->pdf->SetX($l);
        $this->multiLines($w, ($cep ? $cep . ' - ' : '') . $cidade . ' - ' . $uf, 'L');

        return $this->pdf->GetY();
    }
534972
def create_widget(self):
        
        d = self.declaration
        self.widget = DatePicker(self.get_context(), None,
                                 d.style or "@attr/datePickerStyle")
54215
function requestNew()
    {
        $db = new Db;

        //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours.
        $result = $db->query('SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid
                              FROM article
                              WHERE status = 6
                              OR (status = 5 AND editdate <=  STR_TO_DATE(\''.date('Y-m-d H:i:s', time()-86400).'\', \'%Y-%m-%d %H:%i:%s\'))');

        if (isset($result[0])) {
            $this->editdate = date('Y-m-d H:i:s');
            $this->pubdate = $this->editdate;


            //Criando novo registro
            if ($result[0]->get('id') == null) {
                $this->id = $result[0]->get('nid');

                $db->query('INSERT INTO articlecontent
                           SET article = '.$this->id.',
                           	   content = "",
            				   editdate = "'.$this->editdate.'"');

                $db->query('INSERT INTO article
                           SET id = '.$this->id.',
                               status = 5,
                               editdate = \''.$this->editdate.'\'');

            //Atualizando o registro
            } else {
                $this->id = $result[0]->get('id');

                $db->query('UPDATE article
                           SET status = 5,
                               pubdate = \''.$this->pubdate.'\',
            				   editdate = \''.$this->editdate.'\',
            				   rateup = 0,
            				   ratedown = 0,
            				   access = 0,
            				   link = "",
            				   tags = "",
            				   title = "",
            				   media = "{}",
            				   resume = ""
            				   
            			 WHERE id = '.$this->id.'');

                $db->query('UPDATE articlecontent
                           SET content = "",
            				   editdate = \''.$this->editdate.'\'
            			 WHERE article = '.$this->id.'');
            }

                //Make dir clean (delete all files)
                $this->clearDir();
                return $this;
        }

            return false;
    }
565253
def create_widget(self):
        
        d = self.declaration
        self.widget = TextClock(self.get_context(), None, d.style)
653811
function yy_r153(){
    $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array($this->yystack[$this->yyidx + 0]->minor));
    }
1025286
def recent(self):
        '''
        
        '''
        kwd = {
            'pager': '',
            'title': 'Recent Pages',
        }
        self.render('wiki_page/wiki_list.html',
                    view=MWiki.query_recent(),
                    format_date=tools.format_date,
                    kwd=kwd,
                    userinfo=self.userinfo)
308901
public static function createTemporary() {
    $file = File::createTemporary();
    $tempname = $file->getName();
    $file->delete();
    
    $dir = $file->getDirectory()->sub($tempname.'/');
    $dir->make();
    return $dir;
  }
542090
def create(ctx, to, amount, symbol, secret, hash, account, expiration):
    
    ctx.blockchain.blocking = True
    tx = ctx.blockchain.htlc_create(
        Amount(amount, symbol),
        to,
        secret,
        hash_type=hash,
        expiration=expiration,
        account=account,
    )
    tx.pop("trx", None)
    print_tx(tx)
    results = tx.get("operation_results", {})
    if results:
        htlc_id = results[0][1]
        print("Your htlc_id is: {}".format(htlc_id))
1117067
public function displayMyInterest(){
		$auth = new archiAuthentification();
		if($auth->estConnecte()){
			
		
			$html ="";
			$formulaire = new formGenerator();
			$utils = new archiUtils();
			$ajax = new ajaxObject();
			$html.=$ajax->getAjaxFunctions();
	
			$t = new Template($this->getCheminPhysique().$this->cheminTemplates."interest/");
			$t->set_filenames(array('myinterests'=>'myinterests.tpl'));
	
	
			$a = new archiAdresse();
	
			//Generate address form
			$formParam = array(
					'afficheNombreResultat' => 1,
					'modeAffichage_rue'=>1,
					'modeAffichage_sousQuartier'=>1,
					'modeAffichage_quartier'=>1,
					'modeAffichage_ville'=>1,
					'modeAffichage_pays='>1
			);
			
			$formAddressAddInterest=$a->afficheChoixAdresse(array('afficheNombreResultat' => 1,'affichageInteret'=>1));
			$paramsFields= array();
			$paramsFields[] = array('table' => 'pays' ,'value' => 'idPays','title'=>'nom');
			$paramsFields[] = array('table' => 'ville' ,'value' => 'idVille','title'=>'nom');
			$paramsFields[] = array('table' => 'quartier' ,'value' => 'idQuartier','title'=>'nom');
			$paramsFields[] = array('table' => 'sousQuartier' ,'value' => 'idSousQuartier','title'=>'nom');
			$paramsFields[] = array('table' => 'rue' ,'value' => 'idRue','title'=>'nom');
	
	
	
			$formActionUrl = $this->creerUrl('','saveInterest',array());
	
			foreach ($paramsFields as $params){
				$options[] = $this->getAllField($params);
			}
	
	
			$paramsRequest[]=array('table'=> '_interetRue','field' =>'idRue' , 'associateTable' => 'rue');
			$paramsRequest[]=array('table'=> '_interetSousQuartier','field' =>'idSousQuartier', 'associateTable' => 'sousQuartier');
			$paramsRequest[]=array('table'=> '_interetQuartier','field' =>'idQuartier', 'associateTable' => 'quartier');
			$paramsRequest[]=array('table'=> '_interetVille','field' =>'idVille', 'associateTable' => 'ville');
			$paramsRequest[]=array('table'=> '_interetPays','field' =>'idPays', 'associateTable' => 'pays');
	
			$userInterest = $this->getAllInterest($paramsRequest);
			/*
			 * Array of EVERY interest  by categories : street country address etc..
			 */
			foreach ($userInterest as $interestByCat){
				if(!isset($interestByCat[0]['vide'])){
					$t->assign_block_vars('interestList',array('title'=>'Liste des '.$interestByCat[0]['titre'].' dans les centres d\'intérêt','CSSclass'=>'interestList'));
					/*
					 * Interest of each category
					 */
					foreach ($interestByCat as $interest){
						/*
						 * Process fields for delete link
						 */
						$table = $interest['table'];
						$fieldId = $interest['field'];
						$userId = $interest['idUtilisateur'];
						$interestId = $interest[$fieldId];
						
						
						$paramsDelete = array(
							$table,
							$fieldId,
							$userId,
							$interestId
						);
						
						$deleteUrl = $this->creerUrl('', 'deleteInterest', array('params' => $paramsDelete));
						switch ($interest['associateTable']){
							case 'personne':
								$t->assign_block_vars('interestList.interests',array(
								'name'=>$interest['nom']." ".$interest['prenom'],
								'deleteUrl' => $deleteUrl
								));
								break;
							default:
								$t->assign_block_vars('interestList.interests',array(
								'name'=>$interest['nom'],
								'deleteUrl' => $deleteUrl
								));
						}
					}
				}
				else{
					$t->assign_block_vars('interestList',array('vide'=>'Aucun résultat','title'=>'Liste des '.$interestByCat[0]['titre'].' dans les centres d\'intérêt','CSSclass'=>'interestList'));
				}
					
			}
	
			$t->assign_vars(array(
					'formAddInterest' => $formAddressAddInterest,
					'formActionUrl' => $formActionUrl,
					'nameForm'=>'saveInterest'
			));
	
			ob_start();
			$t->pparse('myinterests');
			$html .= ob_get_contents();
			ob_end_clean();
		return $html;
		}
		else{
			$this->messages->addError("Veuillez vous connecter pour personnaliser votre flux");
			$this->messages->display();
			$auth = new ArchiAuthentification();
			return $auth->afficheFormulaireAuthentification();
		}
	}
1124249
public function createCode()
    {
        $this->code = false;

        switch($this->captcha_type) {
            case self::SI_CAPTCHA_MATHEMATIC:
            {
                do {
                    $signs = array('+', '-', 'x');
                    $left  = mt_rand(1, 10);
                    $right = mt_rand(1, 5);
                    $sign  = $signs[mt_rand(0, 2)];

                    switch($sign) {
                        case 'x': $c = $left * $right; break;
                        case '-': $c = $left - $right; break;
                        default:  $c = $left + $right; break;
                    }
                } while ($c <= 0); // no negative #'s or 0

                $this->code         = "$c";
                $this->code_display = "$left $sign $right";
                break;
            }

            case self::SI_CAPTCHA_WORDS:
                $words = $this->readCodeFromFile(2);
                $this->code = implode(' ', $words);
                $this->code_display = $this->code;
                break;

            default:
            {
                if ($this->use_wordlist && is_readable($this->wordlist_file)) {
                    $this->code = $this->readCodeFromFile();
                }

                if ($this->code == false) {
                    $this->code = $this->generateCode($this->code_length);
                }

                $this->code_display = $this->code;
                $this->code         = ($this->case_sensitive) ? $this->code : strtolower($this->code);
            } // default
        }

        $this->saveData();
    }
550197
def main():
    from IPython import embed
    

    """ Python 3.5.3 (pypy3)
    libttl 2.387338638305664
    ttl 1.3430471420288086
    diff lt - ttl 1.0442914962768555
    librdfxml 24.70371127128601
    rdfxml 17.85916304588318
    diff lr - rl 6.844548225402832
    simple time 18.32300615310669
    """

    # well I guess that answers that question ...
    # librdf much faster for cpython, not for pypy3

    from time import time
    rdflib.plugin.register('librdfxml', rdflib.parser.Parser,
                        'librdflib', 'libRdfxmlParser')
    rdflib.plugin.register('libttl', rdflib.parser.Parser,
                        'librdflib', 'libTurtleParser')

    p1 = Path('~/git/NIF-Ontology/ttl/NIF-Molecule.ttl').expanduser()
    start = time()
    graph = rdflib.Graph().parse(p1.as_posix(), format='libttl')
    stop = time()
    lttime = stop - start
    print('libttl', lttime)
    #serialize(graph)

    start = time()
    graph = rdflib.Graph().parse(p1.as_posix(), format='turtle')
    stop = time()
    ttltime = stop - start
    print('ttl', ttltime)
    print('diff lt - ttl', lttime - ttltime)

    p2 = Path('~/git/NIF-Ontology/ttl/external/uberon.owl').expanduser()
    start = time()
    graph2 = rdflib.Graph().parse(p2.as_posix(), format='librdfxml')
    stop = time()
    lrtime = stop - start
    print('librdfxml', lrtime)
    if True:
        start = time()
        graph2 = rdflib.Graph().parse(p2.as_posix(), format='xml')
        stop = time()
        rltime = stop - start
        print('rdfxml', rltime)
        print('diff lr - rl', lrtime - rltime)

    if True:
        file_uri = p2.as_uri()
        parser = RDF.Parser(name='rdfxml')
        stream = parser.parse_as_stream(file_uri)
        start = time()
        # t = list(stream)
        t = tuple(statement_to_tuple(statement) for statement in stream)
        stop = time()
        stime = stop - start
        print('simple time', stime)

    embed()