mirror of
https://github.com/fenetikm/falcon.git
synced 2024-07-14 18:10:31 +03:00
Add in corpus items.
This commit is contained in:
parent
0104b6a628
commit
38e667adea
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
corpus/
|
35
corpus/bash.sh
Normal file
35
corpus/bash.sh
Normal file
@ -0,0 +1,35 @@
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
#
|
||||
# aliases
|
||||
alias grpe=grep
|
||||
alias grep='grep --color --line-number'
|
||||
alias vim="vim -p"
|
||||
alias rebash="source ~/.bashrc"
|
||||
|
||||
alias install='sudo apt-get -y install'
|
||||
alias search='apt-cache search'
|
||||
alias purge='sudo apt-get purge'
|
||||
|
||||
export EDITOR=vim
|
||||
|
||||
# set up the prompt to the hostname
|
||||
shopt -s checkwinsize
|
||||
PS1="\e[1;35m[\w] --- \@ \d \n$>\[\e[0m\]"
|
||||
PS2="\e[1;35m->\[\e[0m\]"
|
||||
|
||||
#--------------------------------------------------
|
||||
# grabs some definitions from google
|
||||
#--------------------------------------------------
|
||||
define () {
|
||||
lynx -dump "http://www.google.com/search?hl=en&q=define%3A+${1}" | grep -m 25 -w "*" | sed 's/;/ -/g' | cut -d- -f5 > /tmp/templookup.txt
|
||||
if [[ -s /tmp/templookup.txt ]] ;then
|
||||
until ! read response
|
||||
do
|
||||
echo "${response}"
|
||||
done < /tmp/templookup.txt
|
||||
else
|
||||
echo "Sorry $USER, I can't find the term \"${1} \""
|
||||
fi
|
34
corpus/cpp.cpp
Normal file
34
corpus/cpp.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "algostuff.hpp"
|
||||
using namespace std;
|
||||
|
||||
bool bothEvenOrOdd (int elem1, int elem2)
|
||||
{
|
||||
return elem1 % 2 == elem2 % 2;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> coll1;
|
||||
list<int> coll2;
|
||||
|
||||
float m = 40.0f;
|
||||
|
||||
INSERT_ELEMENTS(coll1,1,7);
|
||||
INSERT_ELEMENTS(coll2,3,9);
|
||||
|
||||
PRINT_ELEMENTS(coll1,"coll1: \n");
|
||||
PRINT_ELEMENTS(coll2,"coll2: \n");
|
||||
|
||||
// check whether both collections are equal
|
||||
if (equal (coll1.begin(), coll1.end(), // first range
|
||||
coll2.begin())) { // second range
|
||||
cout << "coll1 == coll2" << endl;
|
||||
} /* TODO Shouldn't there be an 'else' case? */
|
||||
|
||||
// check for corresponding even and odd elements
|
||||
if (equal (coll1.begin(), coll1.end(), // first range
|
||||
coll2.begin(), // second range
|
||||
bothEvenOrOdd)) { // comparison criterion
|
||||
cout << "even and odd elements correspond" << endl;
|
||||
}
|
||||
}
|
58
corpus/css.css
Normal file
58
corpus/css.css
Normal file
@ -0,0 +1,58 @@
|
||||
/* A comment. */
|
||||
@font-face {
|
||||
font-family: 'Fira Code';
|
||||
src: url('eot/FiraCode-Bold.eot');
|
||||
src: url('eot/FiraCode-Bold.eot') format('embedded-opentype'),
|
||||
url('woff2/FiraCode-Bold.woff2') format('woff2'),
|
||||
url('woff/FiraCode-Bold.woff') format('woff'),
|
||||
url('ttf/FiraCode-Bold.ttf') format('truetype');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 320px) {
|
||||
html {
|
||||
font-size: calc(11px + 9 * ((100vw - 320px) / 680));
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1000px) {
|
||||
html {
|
||||
font-size: 21px;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Fira Code", monospace;
|
||||
background: #000002;
|
||||
color: #d4d4d9;
|
||||
font-feature-settings: "calt" 1; /* Enable ligatures for IE 10+, Edge */
|
||||
text-rendering: optimizeLegibility; /* Force ligatures for Webkit, Blink, Gecko */
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
display: block;
|
||||
z-index: -1;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
font-family: "Fira Code", monospace;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.blah #thing:nth-child(1) {
|
||||
display: inline;
|
||||
}
|
35
corpus/html.html
Normal file
35
corpus/html.html
Normal file
@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Name Submission</title>
|
||||
<meta name="author" content="Raoul Duke">
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="name.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1> Submit your Name here! </h1>
|
||||
<h3> We'll get more information on the following pages..</h3>
|
||||
<form name="input" action="html_form_action.php" method="get">
|
||||
First name > <input type="text" name="FirstName" value="Average" /><br />
|
||||
Last name: > <input type="text" name="LastName" value="Redditor" /><br />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
<p class="standard" >Click "Submit" to continue..</p>
|
||||
|
||||
<h4>A nested List:</h4>
|
||||
<a href="www.google.com">Google</a>
|
||||
<ul>
|
||||
<li>Coffee & Tea</li>
|
||||
<li>Tea
|
||||
<ul>
|
||||
<li>Black tea</li>
|
||||
<li>Green tea
|
||||
<ul>
|
||||
<li>China</li>
|
||||
<li>Africa</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Milk</li>
|
||||
</ul>
|
45
corpus/js.js
Normal file
45
corpus/js.js
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Watch changes to *.es6.js files and compile them to ES5 during development.
|
||||
*
|
||||
* @internal This file is part of the core javascript build process and is only
|
||||
* meant to be used in that context.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const chokidar = require('chokidar');
|
||||
|
||||
const changeOrAdded = require('./changeOrAdded');
|
||||
const log = require('./log');
|
||||
|
||||
// Match only on .es6.js files.
|
||||
const fileMatch = './**/*.es6.js';
|
||||
// Ignore everything in node_modules
|
||||
const watcher = chokidar.watch(fileMatch, {
|
||||
ignoreInitial: true,
|
||||
ignored: './node_modules/**'
|
||||
});
|
||||
|
||||
const unlinkHandler = (err) => {
|
||||
if (err) {
|
||||
log(err);
|
||||
}
|
||||
};
|
||||
|
||||
console.log('Check.');
|
||||
|
||||
// Watch for filesystem changes.
|
||||
watcher
|
||||
.on('add', changeOrAdded)
|
||||
.on('change', changeOrAdded)
|
||||
.on('unlink', (filePath) => {
|
||||
const fileName = filePath.slice(0, -7);
|
||||
fs.stat(`${fileName}.js`, () => {
|
||||
fs.unlink(`${fileName}.js`, unlinkHandler);
|
||||
});
|
||||
})
|
||||
.on('ready', () => log(`Watching '${fileMatch}' for changes.`));
|
48
corpus/php.php
Normal file
48
corpus/php.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\ua_ccsp_module\Service;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* CCSP service for users.
|
||||
*/
|
||||
class CcspUserService implements CcspUserServiceInterface {
|
||||
use StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* Entity type manager.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
|
||||
*/
|
||||
protected $entityTypeManager;
|
||||
|
||||
/**
|
||||
* Field ids.
|
||||
*/
|
||||
const FIELD_FACULTY_REF = 'field_st_faculty_ref';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createReturnReviewer($reviewer_id, $reviewer_name = '', $email = '') {
|
||||
$reviewer = $this->loadUserByName($reviewer_id);
|
||||
if (!empty($reviewer)) {
|
||||
return reset($reviewer);
|
||||
}
|
||||
|
||||
$user_storage = $this->entityTypeManager->getStorage('user');
|
||||
$reviewer = $user_storage->create();
|
||||
$reviewer->setUsername($reviewer_id)
|
||||
->enforceIsNew()
|
||||
->activate()
|
||||
->set('roles', ['reviewer'])
|
||||
->set(CcspUserService::FIELD_FULL_NAME, $reviewer_name)
|
||||
->setEmail($email)
|
||||
->save();
|
||||
|
||||
// @TODO fix this up, plaz.
|
||||
return $reviewer;
|
||||
}
|
||||
|
||||
}
|
34
corpus/php_old.php
Normal file
34
corpus/php_old.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function main() {
|
||||
global $_REQUEST;
|
||||
try {
|
||||
ini_set('memory_limit', '64M');
|
||||
ini_set('display_errors', 'on');
|
||||
if (isset($_REQUEST['dev'])) {
|
||||
require_once 'config_dev.php';
|
||||
}
|
||||
else {
|
||||
require_once 'config.php';
|
||||
}
|
||||
define('TESTING', FALSE);
|
||||
|
||||
if (empty($_REQUEST['api_key'])) {
|
||||
error('Invalid API key specified');
|
||||
}
|
||||
|
||||
// Check API credentials.
|
||||
$sql = <<<EOSQL
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE
|
||||
api_key = :api_key AND
|
||||
active = 1
|
||||
EOSQL;
|
||||
|
||||
$q = $_pdo->prepare($sql);
|
||||
}
|
||||
}
|
32
corpus/python.py
Normal file
32
corpus/python.py
Normal file
@ -0,0 +1,32 @@
|
||||
def dump_args(func):
|
||||
"This decorator dumps out the arguments passed to a function before calling it"
|
||||
argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
|
||||
fname = func.func_name
|
||||
def echo_func(*args,**kwargs):
|
||||
print fname, ":", ', '.join(
|
||||
'%s=%r' % entry
|
||||
for entry in zip(argnames,args) + kwargs.items())
|
||||
return func(*args, **kwargs)
|
||||
return echo_func
|
||||
|
||||
@dump_args
|
||||
def f1(a,b,c):
|
||||
print a + b + c
|
||||
|
||||
f1(1, 2, 3)
|
||||
|
||||
def precondition(precondition, use_conditions=DEFAULT_ON):
|
||||
return conditions(precondition, None, use_conditions)
|
||||
|
||||
def postcondition(postcondition, use_conditions=DEFAULT_ON):
|
||||
return conditions(None, postcondition, use_conditions)
|
||||
|
||||
class conditions(object):
|
||||
__slots__ = ('__precondition', '__postcondition')
|
||||
|
||||
def __init__(self, pre, post, use_conditions=DEFAULT_ON):
|
||||
if not use_conditions:
|
||||
pre, post = None, None
|
||||
|
||||
self.__precondition = pre
|
||||
self.__postcondition = post
|
Loading…
Reference in New Issue
Block a user