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