commit stringlengths 40 40 | old_file stringlengths 4 184 | new_file stringlengths 4 184 | old_contents stringlengths 1 3.6k | new_contents stringlengths 5 3.38k | subject stringlengths 15 778 | message stringlengths 16 6.74k | lang stringclasses 201 values | license stringclasses 13 values | repos stringlengths 6 116k | config stringclasses 201 values | content stringlengths 137 7.24k | diff stringlengths 26 5.55k | diff_length int64 1 123 | relative_diff_length float64 0.01 89 | n_lines_added int64 0 108 | n_lines_deleted int64 0 106 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d30c3805d604282331b14c6778ed3232d5531025 | .travis.yml | .travis.yml | language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
notifications:
irc:
use_notice: true
skip_join: true
channels: ["irc.freenode.org#imbo"]
branches:
only:
- develop
- master
services:
- memcached
before_install:
- pecl install --force memcached
- pecl install apcu
before_script:
- phpenv config-add .travis-php.ini
- composer self-update
- composer -n --no-ansi install --prefer-source
script:
- ./vendor/bin/phpunit --verbose
| language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
notifications:
irc:
use_notice: true
skip_join: true
channels: ["irc.freenode.org#imbo"]
branches:
only:
- develop
- master
services:
- memcached
before_install:
- printf "\n" | pecl install --force memcached
- printf "\n" | pecl install apcu
before_script:
- phpenv config-add .travis-php.ini
- composer self-update
- composer -n --no-ansi install --prefer-source
script:
- ./vendor/bin/phpunit --verbose
| Make sure the build script does not wait for input | Make sure the build script does not wait for input
| YAML | mit | imbo/imbo-metadata-cache | yaml | ## Code Before:
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
notifications:
irc:
use_notice: true
skip_join: true
channels: ["irc.freenode.org#imbo"]
branches:
only:
- develop
- master
services:
- memcached
before_install:
- pecl install --force memcached
- pecl install apcu
before_script:
- phpenv config-add .travis-php.ini
- composer self-update
- composer -n --no-ansi install --prefer-source
script:
- ./vendor/bin/phpunit --verbose
## Instruction:
Make sure the build script does not wait for input
## Code After:
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
notifications:
irc:
use_notice: true
skip_join: true
channels: ["irc.freenode.org#imbo"]
branches:
only:
- develop
- master
services:
- memcached
before_install:
- printf "\n" | pecl install --force memcached
- printf "\n" | pecl install apcu
before_script:
- phpenv config-add .travis-php.ini
- composer self-update
- composer -n --no-ansi install --prefer-source
script:
- ./vendor/bin/phpunit --verbose
| language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
notifications:
irc:
use_notice: true
skip_join: true
channels: ["irc.freenode.org#imbo"]
branches:
only:
- develop
- master
services:
- memcached
before_install:
- - pecl install --force memcached
+ - printf "\n" | pecl install --force memcached
? ++++++++++++++
- - pecl install apcu
+ - printf "\n" | pecl install apcu
? ++++++++++++++
before_script:
- phpenv config-add .travis-php.ini
- composer self-update
- composer -n --no-ansi install --prefer-source
script:
- ./vendor/bin/phpunit --verbose | 4 | 0.153846 | 2 | 2 |
f6ee5550329d53cdd26cbc8c34f57b24a936c51f | src/Controllers/Admin/Controller.php | src/Controllers/Admin/Controller.php | <?php
namespace jorenvanhocht\Blogify\Controllers\Admin;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController {
use DispatchesCommands, ValidatesRequests;
}
| <?php
namespace jorenvanhocht\Blogify\Controllers\Admin;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
class Controller extends BaseController
{
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
}
| Update base controller to laravel 5.2 | Update base controller to laravel 5.2
| PHP | unknown | jorenvh/Blogify,blogify/blogify,blogify/blogify,jorenvh/Blogify,jorenvh/Blogify | php | ## Code Before:
<?php
namespace jorenvanhocht\Blogify\Controllers\Admin;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController {
use DispatchesCommands, ValidatesRequests;
}
## Instruction:
Update base controller to laravel 5.2
## Code After:
<?php
namespace jorenvanhocht\Blogify\Controllers\Admin;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
class Controller extends BaseController
{
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
}
| <?php
namespace jorenvanhocht\Blogify\Controllers\Admin;
- use Illuminate\Foundation\Bus\DispatchesCommands;
? ^ ^^^^^
+ use Illuminate\Foundation\Bus\DispatchesJobs;
? ^ ^
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
+ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+ use Illuminate\Foundation\Auth\Access\AuthorizesResources;
- abstract class Controller extends BaseController {
? --------- --
+ class Controller extends BaseController
+ {
+ use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
-
- use DispatchesCommands, ValidatesRequests;
-
} | 11 | 0.846154 | 6 | 5 |
29695f711542d58eb69bb3e5f2d35e1fda30aeb1 | README.md | README.md |
Python API able to get chains from web-app database and automatically
writes/secure them on the bitcoin blockchain via 21 micropayment services.
|
Python API able to get chains from web-app database and automatically
writes/secure them on the bitcoin blockchain via 21 micropayment services.
## API Endpoints
Web browser <--> Front-end <--> **api.py <--> connector.py**
### api.py
RESTful service for vote saving. This module only receives and transmits
information to the connector.py script and to the front-end instances.
Resource | HTTP Method | URL and arguments | Returns
----|-----|----- |-----|
Vote saving | POST | <host:port>/send-vote?proposal=yes/no | JSON object with confirmation, vote and the wallet's address that stores our votes
Vote status | GET | <host:port>/vote-count | Total number of votes on each option for the proposal
### connector.py
21.co server for operations over micropayments (One satoshi per operation). This
connector provides information for the api.py module and manages the operations
for Blockchain events
Resource | HTTP Method | URL and arguments | Returns
----|-----|-----|-----|
Vote accounting to the Blockchain | POST | <host:port>/write-vote?proposal=yes/no | Wallet address
Votes on each proposal | GET | <host:port>/count | Total votes for the proposal
| Add API endpoint docs and endpoints | Add API endpoint docs and endpoints | Markdown | mit | DemocracyEarth/21API | markdown | ## Code Before:
Python API able to get chains from web-app database and automatically
writes/secure them on the bitcoin blockchain via 21 micropayment services.
## Instruction:
Add API endpoint docs and endpoints
## Code After:
Python API able to get chains from web-app database and automatically
writes/secure them on the bitcoin blockchain via 21 micropayment services.
## API Endpoints
Web browser <--> Front-end <--> **api.py <--> connector.py**
### api.py
RESTful service for vote saving. This module only receives and transmits
information to the connector.py script and to the front-end instances.
Resource | HTTP Method | URL and arguments | Returns
----|-----|----- |-----|
Vote saving | POST | <host:port>/send-vote?proposal=yes/no | JSON object with confirmation, vote and the wallet's address that stores our votes
Vote status | GET | <host:port>/vote-count | Total number of votes on each option for the proposal
### connector.py
21.co server for operations over micropayments (One satoshi per operation). This
connector provides information for the api.py module and manages the operations
for Blockchain events
Resource | HTTP Method | URL and arguments | Returns
----|-----|-----|-----|
Vote accounting to the Blockchain | POST | <host:port>/write-vote?proposal=yes/no | Wallet address
Votes on each proposal | GET | <host:port>/count | Total votes for the proposal
|
Python API able to get chains from web-app database and automatically
writes/secure them on the bitcoin blockchain via 21 micropayment services.
+
+ ## API Endpoints
+
+
+ Web browser <--> Front-end <--> **api.py <--> connector.py**
+
+ ### api.py
+ RESTful service for vote saving. This module only receives and transmits
+ information to the connector.py script and to the front-end instances.
+
+ Resource | HTTP Method | URL and arguments | Returns
+ ----|-----|----- |-----|
+ Vote saving | POST | <host:port>/send-vote?proposal=yes/no | JSON object with confirmation, vote and the wallet's address that stores our votes
+ Vote status | GET | <host:port>/vote-count | Total number of votes on each option for the proposal
+
+
+
+ ### connector.py
+ 21.co server for operations over micropayments (One satoshi per operation). This
+ connector provides information for the api.py module and manages the operations
+ for Blockchain events
+
+ Resource | HTTP Method | URL and arguments | Returns
+ ----|-----|-----|-----|
+ Vote accounting to the Blockchain | POST | <host:port>/write-vote?proposal=yes/no | Wallet address
+ Votes on each proposal | GET | <host:port>/count | Total votes for the proposal | 26 | 8.666667 | 26 | 0 |
f2dadc95706d99b713ea7501797b5367a2ab36c5 | package.json | package.json | {
"name": "tokenize-markdown",
"version": "0.1.0",
"description": "A utility for reading markdown files and parsing them into (optionally filtered) lists of tokens",
"main": "tokenize-markdown.js",
"scripts": {
"pretest": "grunt lint",
"test": "grunt test"
},
"author": "K.Adam White (http://www.kadamwhite.com/)",
"license": "MIT",
"dependencies": {
"lodash.isregexp": "^3.0.0",
"lodash.reduce": "^3.0.0",
"marked": "^0.3.3"
},
"devDependencies": {
"chai": "^1.10.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0",
"grunt-jscs": "^1.5.0",
"grunt-simple-mocha": "^0.4.0",
"jscs-stylish": "^0.3.1",
"jshint-stylish": "^1.0.1",
"load-grunt-tasks": "^3.1.0",
"lodash.merge": "^3.0.2",
"proxyquire": "^1.4.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.6.0"
}
}
| {
"name": "tokenize-markdown",
"version": "0.1.0",
"description": "A utility for reading markdown files and parsing them into (optionally filtered) lists of tokens",
"main": "tokenize-markdown.js",
"scripts": {
"prepublish": "npm test",
"pretest": "grunt lint",
"test": "grunt test"
},
"author": "K.Adam White (http://www.kadamwhite.com/)",
"license": "MIT",
"dependencies": {
"lodash.isregexp": "^3.0.0",
"lodash.reduce": "^3.0.0",
"marked": "^0.3.3"
},
"devDependencies": {
"chai": "^1.10.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0",
"grunt-jscs": "^1.5.0",
"grunt-simple-mocha": "^0.4.0",
"jscs-stylish": "^0.3.1",
"jshint-stylish": "^1.0.1",
"load-grunt-tasks": "^3.1.0",
"lodash.merge": "^3.0.2",
"proxyquire": "^1.4.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.6.0"
}
}
| Add a prepublish script to run grunt before publishing to NPM | Add a prepublish script to run grunt before publishing to NPM
| JSON | mit | kadamwhite/tokenize-markdown | json | ## Code Before:
{
"name": "tokenize-markdown",
"version": "0.1.0",
"description": "A utility for reading markdown files and parsing them into (optionally filtered) lists of tokens",
"main": "tokenize-markdown.js",
"scripts": {
"pretest": "grunt lint",
"test": "grunt test"
},
"author": "K.Adam White (http://www.kadamwhite.com/)",
"license": "MIT",
"dependencies": {
"lodash.isregexp": "^3.0.0",
"lodash.reduce": "^3.0.0",
"marked": "^0.3.3"
},
"devDependencies": {
"chai": "^1.10.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0",
"grunt-jscs": "^1.5.0",
"grunt-simple-mocha": "^0.4.0",
"jscs-stylish": "^0.3.1",
"jshint-stylish": "^1.0.1",
"load-grunt-tasks": "^3.1.0",
"lodash.merge": "^3.0.2",
"proxyquire": "^1.4.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.6.0"
}
}
## Instruction:
Add a prepublish script to run grunt before publishing to NPM
## Code After:
{
"name": "tokenize-markdown",
"version": "0.1.0",
"description": "A utility for reading markdown files and parsing them into (optionally filtered) lists of tokens",
"main": "tokenize-markdown.js",
"scripts": {
"prepublish": "npm test",
"pretest": "grunt lint",
"test": "grunt test"
},
"author": "K.Adam White (http://www.kadamwhite.com/)",
"license": "MIT",
"dependencies": {
"lodash.isregexp": "^3.0.0",
"lodash.reduce": "^3.0.0",
"marked": "^0.3.3"
},
"devDependencies": {
"chai": "^1.10.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0",
"grunt-jscs": "^1.5.0",
"grunt-simple-mocha": "^0.4.0",
"jscs-stylish": "^0.3.1",
"jshint-stylish": "^1.0.1",
"load-grunt-tasks": "^3.1.0",
"lodash.merge": "^3.0.2",
"proxyquire": "^1.4.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.6.0"
}
}
| {
"name": "tokenize-markdown",
"version": "0.1.0",
"description": "A utility for reading markdown files and parsing them into (optionally filtered) lists of tokens",
"main": "tokenize-markdown.js",
"scripts": {
+ "prepublish": "npm test",
"pretest": "grunt lint",
"test": "grunt test"
},
"author": "K.Adam White (http://www.kadamwhite.com/)",
"license": "MIT",
"dependencies": {
"lodash.isregexp": "^3.0.0",
"lodash.reduce": "^3.0.0",
"marked": "^0.3.3"
},
"devDependencies": {
"chai": "^1.10.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.0",
"grunt-jscs": "^1.5.0",
"grunt-simple-mocha": "^0.4.0",
"jscs-stylish": "^0.3.1",
"jshint-stylish": "^1.0.1",
"load-grunt-tasks": "^3.1.0",
"lodash.merge": "^3.0.2",
"proxyquire": "^1.4.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.6.0"
}
} | 1 | 0.03125 | 1 | 0 |
7d59fe2cbc0c77a779fa3a6063da281889e9adcc | README.md | README.md |
This framework was originally part of [angular/protractor](https://github.com/angular/protractor) and
is now a separate module to decouple [cucumber.js](https://github.com/cucumber/cucumber-js).
##Install
`npm install --save-dev protractor-cucumber-framework`
##Implementation
To implement this framework, utilize the `protractor` custom framework config option:
```js
var cucumberFrameworkPath = require('protractor-cucumber-framework').resolve();
exports.config = {
// set to "custom" instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: cucumberFrameworkPath
};
```
| Protractor Cucumber Framework
=============================
This framework was originally part of [angular/protractor](https://github.com/angular/protractor) and
is now a separate module to decouple [cucumber.js](https://github.com/cucumber/cucumber-js).
Install
-------
`npm install --save-dev protractor-cucumber-framework`
Implementation
--------------
To implement this framework, utilize the `protractor` custom framework config option:
```js
var cucumberFrameworkPath = require('protractor-cucumber-framework').resolve();
exports.config = {
// set to "custom" instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: cucumberFrameworkPath
};
```
| Support standard markdown for npm readme | Support standard markdown for npm readme
| Markdown | mit | protractor-cucumber-framework/protractor-cucumber-framework,mattfritz/protractor-cucumber-framework,protractor-cucumber-framework/protractor-cucumber-framework,mattfritz/protractor-cucumber-framework | markdown | ## Code Before:
This framework was originally part of [angular/protractor](https://github.com/angular/protractor) and
is now a separate module to decouple [cucumber.js](https://github.com/cucumber/cucumber-js).
##Install
`npm install --save-dev protractor-cucumber-framework`
##Implementation
To implement this framework, utilize the `protractor` custom framework config option:
```js
var cucumberFrameworkPath = require('protractor-cucumber-framework').resolve();
exports.config = {
// set to "custom" instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: cucumberFrameworkPath
};
```
## Instruction:
Support standard markdown for npm readme
## Code After:
Protractor Cucumber Framework
=============================
This framework was originally part of [angular/protractor](https://github.com/angular/protractor) and
is now a separate module to decouple [cucumber.js](https://github.com/cucumber/cucumber-js).
Install
-------
`npm install --save-dev protractor-cucumber-framework`
Implementation
--------------
To implement this framework, utilize the `protractor` custom framework config option:
```js
var cucumberFrameworkPath = require('protractor-cucumber-framework').resolve();
exports.config = {
// set to "custom" instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: cucumberFrameworkPath
};
```
| + Protractor Cucumber Framework
+ =============================
This framework was originally part of [angular/protractor](https://github.com/angular/protractor) and
is now a separate module to decouple [cucumber.js](https://github.com/cucumber/cucumber-js).
- ##Install
? --
+ Install
+ -------
+
`npm install --save-dev protractor-cucumber-framework`
- ##Implementation
? --
+ Implementation
+ --------------
+
To implement this framework, utilize the `protractor` custom framework config option:
```js
var cucumberFrameworkPath = require('protractor-cucumber-framework').resolve();
exports.config = {
// set to "custom" instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: cucumberFrameworkPath
};
``` | 10 | 0.47619 | 8 | 2 |
be0eede6f56426c76704a266c2319489b7cd08bc | README.md | README.md | Dabbling with promises. It’ll be [legendary](https://soundcloud.com/buck65/legendary).
| <a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" alt="Promises/A+ logo" align="right"></a>
# Legendary
Legendary is a [Promises/A+](http://promises-aplus.github.com/promises-spec) compatible promise implementation. It combines promise subclassing with sugar inspired by [when.js](https://github.com/cujojs/when), [Q](https://github.com/kriskowal/q) and [async](https://github.com/caolan/async).
## Theme song
[Legendary](https://soundcloud.com/buck65/legendary) by [Buck 65](http://buck65.com).
| Update Readme, give credit for the sugar | Update Readme, give credit for the sugar
| Markdown | isc | novemberborn/legendary | markdown | ## Code Before:
Dabbling with promises. It’ll be [legendary](https://soundcloud.com/buck65/legendary).
## Instruction:
Update Readme, give credit for the sugar
## Code After:
<a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" alt="Promises/A+ logo" align="right"></a>
# Legendary
Legendary is a [Promises/A+](http://promises-aplus.github.com/promises-spec) compatible promise implementation. It combines promise subclassing with sugar inspired by [when.js](https://github.com/cujojs/when), [Q](https://github.com/kriskowal/q) and [async](https://github.com/caolan/async).
## Theme song
[Legendary](https://soundcloud.com/buck65/legendary) by [Buck 65](http://buck65.com).
| - Dabbling with promises. It’ll be [legendary](https://soundcloud.com/buck65/legendary).
+ <a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" alt="Promises/A+ logo" align="right"></a>
+
+ # Legendary
+
+ Legendary is a [Promises/A+](http://promises-aplus.github.com/promises-spec) compatible promise implementation. It combines promise subclassing with sugar inspired by [when.js](https://github.com/cujojs/when), [Q](https://github.com/kriskowal/q) and [async](https://github.com/caolan/async).
+
+ ## Theme song
+
+ [Legendary](https://soundcloud.com/buck65/legendary) by [Buck 65](http://buck65.com). | 10 | 10 | 9 | 1 |
4af5b06f8ef41b3b1854bd4358c3bca03871308e | routes/api.js | routes/api.js | var express = require('express');
var router = express.Router();
var funfacts = [
'Ants stretch when they wake up in the morning.',
'The state of Florida is bigger than England.',
'Some bamboo plants can grow almost a meter in just one day.',
'Olympic gold medals are actually made mostly of silver.',
'On average, it takes 66 days to form a new habit.',
'You are born with 300 bones; by the time you are an adult you will have 206.',
'Ostriches can run faster than horses.',
'Mammoths still walked the earth when the Great Pyramid was being built.',
'It takes about 8 minutes for light from the Sun to reach Earth.',
'Some penguins can leap 2-3 meters out of the water.'
];
// 1.0.X Routes
router.get('/v1.0/fact/random', function(req, res, next) {
var factIndex = Math.floor(Math.random() * funfacts.length);
var factText = funfacts[factIndex];
var fact = {
text: factText
};
res.json(fact);
});
module.exports = router;
| var express = require('express');
var router = express.Router();
var funfacts = [
'Ants stretch when they wake up in the morning.',
'The state of Florida is bigger than England.',
'Some bamboo plants can grow almost a meter in just one day.',
'Olympic gold medals are actually made mostly of silver.',
'On average, it takes 66 days to form a new habit.',
'You are born with 300 bones; by the time you are an adult you will have 206.',
'Ostriches can run faster than horses.',
'Mammoths still walked the earth when the Great Pyramid was being built.',
'It takes about 8 minutes for light from the Sun to reach Earth.',
'Some penguins can leap 2-3 meters out of the water.'
];
// 1.0.X Routes
router.get('/v1.0/fact/random', function(req, res, next) {
var factIndex = Math.floor(Math.random() * funfacts.length);
var fact = {
text: funfacts[factIndex]
};
res.json(fact);
});
module.exports = router;
| Clean JSON object creation code | Clean JSON object creation code
| JavaScript | isc | NathanHeffley/FunFactsWebsite | javascript | ## Code Before:
var express = require('express');
var router = express.Router();
var funfacts = [
'Ants stretch when they wake up in the morning.',
'The state of Florida is bigger than England.',
'Some bamboo plants can grow almost a meter in just one day.',
'Olympic gold medals are actually made mostly of silver.',
'On average, it takes 66 days to form a new habit.',
'You are born with 300 bones; by the time you are an adult you will have 206.',
'Ostriches can run faster than horses.',
'Mammoths still walked the earth when the Great Pyramid was being built.',
'It takes about 8 minutes for light from the Sun to reach Earth.',
'Some penguins can leap 2-3 meters out of the water.'
];
// 1.0.X Routes
router.get('/v1.0/fact/random', function(req, res, next) {
var factIndex = Math.floor(Math.random() * funfacts.length);
var factText = funfacts[factIndex];
var fact = {
text: factText
};
res.json(fact);
});
module.exports = router;
## Instruction:
Clean JSON object creation code
## Code After:
var express = require('express');
var router = express.Router();
var funfacts = [
'Ants stretch when they wake up in the morning.',
'The state of Florida is bigger than England.',
'Some bamboo plants can grow almost a meter in just one day.',
'Olympic gold medals are actually made mostly of silver.',
'On average, it takes 66 days to form a new habit.',
'You are born with 300 bones; by the time you are an adult you will have 206.',
'Ostriches can run faster than horses.',
'Mammoths still walked the earth when the Great Pyramid was being built.',
'It takes about 8 minutes for light from the Sun to reach Earth.',
'Some penguins can leap 2-3 meters out of the water.'
];
// 1.0.X Routes
router.get('/v1.0/fact/random', function(req, res, next) {
var factIndex = Math.floor(Math.random() * funfacts.length);
var fact = {
text: funfacts[factIndex]
};
res.json(fact);
});
module.exports = router;
| var express = require('express');
var router = express.Router();
var funfacts = [
'Ants stretch when they wake up in the morning.',
'The state of Florida is bigger than England.',
'Some bamboo plants can grow almost a meter in just one day.',
'Olympic gold medals are actually made mostly of silver.',
'On average, it takes 66 days to form a new habit.',
'You are born with 300 bones; by the time you are an adult you will have 206.',
'Ostriches can run faster than horses.',
'Mammoths still walked the earth when the Great Pyramid was being built.',
'It takes about 8 minutes for light from the Sun to reach Earth.',
'Some penguins can leap 2-3 meters out of the water.'
];
// 1.0.X Routes
router.get('/v1.0/fact/random', function(req, res, next) {
var factIndex = Math.floor(Math.random() * funfacts.length);
- var factText = funfacts[factIndex];
var fact = {
- text: factText
+ text: funfacts[factIndex]
};
res.json(fact);
});
module.exports = router; | 3 | 0.111111 | 1 | 2 |
9085fc1062f5d6791655e8812e2de4596126b4b9 | app/assets/javascripts/application.coffee | app/assets/javascripts/application.coffee |
onReady = ->
$('#gems-search').keyup ->
if $("#query").val().length
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview()
onReady()
|
onReady = ->
$('#gems-search').keyup ->
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview()
onReady()
| Revert "Don't send search query when query field is empty" | Revert "Don't send search query when query field is empty"
This reverts commit 6173b9b468889a31d84460eb95eac5ec9ec767bc.
Necessary because else when someone erases his search query in the input
field, the index page does not show again all the gems.
| CoffeeScript | mit | rubyperu/ready4rails,rubyperu/ready4rails,rubyperu/ready4rails | coffeescript | ## Code Before:
onReady = ->
$('#gems-search').keyup ->
if $("#query").val().length
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview()
onReady()
## Instruction:
Revert "Don't send search query when query field is empty"
This reverts commit 6173b9b468889a31d84460eb95eac5ec9ec767bc.
Necessary because else when someone erases his search query in the input
field, the index page does not show again all the gems.
## Code After:
onReady = ->
$('#gems-search').keyup ->
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview()
onReady()
|
onReady = ->
$('#gems-search').keyup ->
- if $("#query").val().length
- $.get $(this).attr('action'), $(this).serialize(), null, 'script'
? --
+ $.get $(this).attr('action'), $(this).serialize(), null, 'script'
- false
? --
+ false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview()
onReady() | 5 | 0.3125 | 2 | 3 |
799da6dbe80b4808e66d81c0004d279abcbf55ea | Library/Homebrew/requirements/ruby_requirement.rb | Library/Homebrew/requirements/ruby_requirement.rb | class RubyRequirement < Requirement
fatal true
default_formula "ruby"
def initialize(tags)
@version = tags.shift if /(\d\.)+\d/ =~ tags.first
raise "RubyRequirement requires a version!" unless @version
super
end
satisfy build_env: false do
which_all("ruby").detect do |ruby|
version = /\d\.\d/.match Utils.popen_read(ruby, "--version")
next unless version
Version.create(version.to_s) >= Version.create(@version)
end
end
def message
s = "Ruby #{@version} is required to install this formula."
s += super
s
end
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
end
| class RubyRequirement < Requirement
fatal true
default_formula "ruby"
def initialize(tags)
@version = tags.shift if /(\d\.)+\d/ =~ tags.first
raise "RubyRequirement requires a version!" unless @version
super
end
satisfy build_env: false do
found_ruby = rubies.detect { |ruby| suitable?(ruby) }
return unless found_ruby
ENV.prepend_path "PATH", found_ruby.dirname
found_ruby
end
def message
s = "Ruby >= #{@version} is required to install this formula."
s += super
s
end
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
private
def rubies
rubies = which_all("ruby")
if ruby_formula.installed?
rubies.unshift Pathname.new(ruby_formula.bin/"ruby")
end
rubies.uniq
end
def suitable?(ruby)
version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
end
def min_version
@min_version ||= Version.create(@version)
end
def ruby_formula
@ruby_formula ||= Formula["ruby"]
rescue FormulaUnavailableError
nil
end
end
| Prepend selected ruby to PATH in RubyRequirement | Prepend selected ruby to PATH in RubyRequirement
| Ruby | bsd-2-clause | gregory-nisbet/brew,rwhogg/brew,amar-laksh/brew_sudo,gregory-nisbet/brew,ilovezfs/brew,EricFromCanada/brew,aw1621107/brew,amar-laksh/brew_sudo,Homebrew/brew,zmwangx/brew,EricFromCanada/brew,konqui/brew,sjackman/homebrew,pseudocody/brew,rwhogg/brew,sjackman/homebrew,vitorgalvao/brew,EricFromCanada/brew,Homebrew/brew,gregory-nisbet/brew,Linuxbrew/brew,mgrimes/brew,nandub/brew,claui/brew,tonyg/homebrew,MikeMcQuaid/brew,MikeMcQuaid/brew,Homebrew/brew,reitermarkus/brew,sjackman/homebrew,nandub/brew,DomT4/brew,DomT4/brew,muellermartin/dist,bfontaine/brew,mgrimes/brew,zmwangx/brew,aw1621107/brew,pseudocody/brew,mgrimes/brew,jmsundar/brew,pseudocody/brew,MikeMcQuaid/brew,mahori/brew,vitorgalvao/brew,aw1621107/brew,claui/brew,bfontaine/brew,Linuxbrew/brew,tonyg/homebrew,EricFromCanada/brew,tonyg/homebrew,DomT4/brew,maxim-belkin/brew,jmsundar/brew,Linuxbrew/brew,mahori/brew,reitermarkus/brew,konqui/brew,MikeMcQuaid/brew,claui/brew,reelsense/brew,zmwangx/brew,vitorgalvao/brew,nandub/brew,maxim-belkin/brew,DomT4/brew,hanxue/linuxbrew,reitermarkus/brew,Homebrew/brew,Linuxbrew/brew,konqui/brew,palxex/brew,JCount/brew,JCount/brew,palxex/brew,bfontaine/brew,rwhogg/brew,alyssais/brew,mahori/brew,ilovezfs/brew,claui/brew,nandub/brew,sjackman/homebrew,jmsundar/brew,reelsense/brew,reelsense/brew,JCount/brew,alyssais/brew,amar-laksh/brew_sudo,konqui/brew,alyssais/brew,ilovezfs/brew,mahori/brew,muellermartin/dist,muellermartin/dist,maxim-belkin/brew,palxex/brew,reitermarkus/brew,JCount/brew,hanxue/linuxbrew,hanxue/linuxbrew,vitorgalvao/brew | ruby | ## Code Before:
class RubyRequirement < Requirement
fatal true
default_formula "ruby"
def initialize(tags)
@version = tags.shift if /(\d\.)+\d/ =~ tags.first
raise "RubyRequirement requires a version!" unless @version
super
end
satisfy build_env: false do
which_all("ruby").detect do |ruby|
version = /\d\.\d/.match Utils.popen_read(ruby, "--version")
next unless version
Version.create(version.to_s) >= Version.create(@version)
end
end
def message
s = "Ruby #{@version} is required to install this formula."
s += super
s
end
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
end
## Instruction:
Prepend selected ruby to PATH in RubyRequirement
## Code After:
class RubyRequirement < Requirement
fatal true
default_formula "ruby"
def initialize(tags)
@version = tags.shift if /(\d\.)+\d/ =~ tags.first
raise "RubyRequirement requires a version!" unless @version
super
end
satisfy build_env: false do
found_ruby = rubies.detect { |ruby| suitable?(ruby) }
return unless found_ruby
ENV.prepend_path "PATH", found_ruby.dirname
found_ruby
end
def message
s = "Ruby >= #{@version} is required to install this formula."
s += super
s
end
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
private
def rubies
rubies = which_all("ruby")
if ruby_formula.installed?
rubies.unshift Pathname.new(ruby_formula.bin/"ruby")
end
rubies.uniq
end
def suitable?(ruby)
version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
end
def min_version
@min_version ||= Version.create(@version)
end
def ruby_formula
@ruby_formula ||= Formula["ruby"]
rescue FormulaUnavailableError
nil
end
end
| class RubyRequirement < Requirement
fatal true
default_formula "ruby"
def initialize(tags)
@version = tags.shift if /(\d\.)+\d/ =~ tags.first
raise "RubyRequirement requires a version!" unless @version
super
end
satisfy build_env: false do
+ found_ruby = rubies.detect { |ruby| suitable?(ruby) }
+ return unless found_ruby
+ ENV.prepend_path "PATH", found_ruby.dirname
+ found_ruby
- which_all("ruby").detect do |ruby|
- version = /\d\.\d/.match Utils.popen_read(ruby, "--version")
- next unless version
- Version.create(version.to_s) >= Version.create(@version)
- end
end
def message
- s = "Ruby #{@version} is required to install this formula."
+ s = "Ruby >= #{@version} is required to install this formula."
? +++
s += super
s
end
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
+
+ private
+
+ def rubies
+ rubies = which_all("ruby")
+ if ruby_formula.installed?
+ rubies.unshift Pathname.new(ruby_formula.bin/"ruby")
+ end
+ rubies.uniq
+ end
+
+ def suitable?(ruby)
+ version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
+ version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
+ end
+
+ def min_version
+ @min_version ||= Version.create(@version)
+ end
+
+ def ruby_formula
+ @ruby_formula ||= Formula["ruby"]
+ rescue FormulaUnavailableError
+ nil
+ end
+
end | 37 | 1.027778 | 31 | 6 |
753c624149577dd7d9ec4e50565fb61782cea1b2 | puppet/modules/jenkins/templates/jenkins.service.erb | puppet/modules/jenkins/templates/jenkins.service.erb | [Unit]
Description=Jenkins Daemon
After=syslog.target
[Service]
Type=simple
Environment="JENKINS_HOME=/var/lib/jenkins"
ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
User=jenkins
[Install]
WantedBy=multi-user.target
| [Unit]
Description=Jenkins Daemon
After=syslog.target
[Service]
Type=simple
Environment="JENKINS_HOME=/var/lib/jenkins"
ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -Dhudson.model.ParametersAction.keepUndefinedParameters=true -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
User=jenkins
[Install]
WantedBy=multi-user.target
| Fix dynamic job' parameters removed by Jenkins | Fix dynamic job' parameters removed by Jenkins
Since the upgrade to Jenkins 1.651 and the SF 2.2.1 release
the artifacts export (with zuul_swift_upload) was broken because
relying on dynamics parameters. This patch adds the option
hudson.model.ParametersAction.keepUndefinedParameters to Jenkins
at startup.
Co-Authored-By: tdecacqu@redhat.com
Change-Id: Ic12b9379f8d9fbdf144ba6aa31c150a14fd675b4
| HTML+ERB | apache-2.0 | enovance/software-factory,enovance/software-factory,enovance/software-factory,enovance/software-factory,enovance/software-factory | html+erb | ## Code Before:
[Unit]
Description=Jenkins Daemon
After=syslog.target
[Service]
Type=simple
Environment="JENKINS_HOME=/var/lib/jenkins"
ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
User=jenkins
[Install]
WantedBy=multi-user.target
## Instruction:
Fix dynamic job' parameters removed by Jenkins
Since the upgrade to Jenkins 1.651 and the SF 2.2.1 release
the artifacts export (with zuul_swift_upload) was broken because
relying on dynamics parameters. This patch adds the option
hudson.model.ParametersAction.keepUndefinedParameters to Jenkins
at startup.
Co-Authored-By: tdecacqu@redhat.com
Change-Id: Ic12b9379f8d9fbdf144ba6aa31c150a14fd675b4
## Code After:
[Unit]
Description=Jenkins Daemon
After=syslog.target
[Service]
Type=simple
Environment="JENKINS_HOME=/var/lib/jenkins"
ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -Dhudson.model.ParametersAction.keepUndefinedParameters=true -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
User=jenkins
[Install]
WantedBy=multi-user.target
| [Unit]
Description=Jenkins Daemon
After=syslog.target
[Service]
Type=simple
Environment="JENKINS_HOME=/var/lib/jenkins"
- ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
+ ExecStart=/usr/bin/java -Xmx<%= @settings['jenkins_heap_limit'] %> -Dhudson.model.ParametersAction.keepUndefinedParameters=true -jar /usr/lib/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1 --prefix=/jenkins --httpListenAddress=127.0.0.1
? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
User=jenkins
[Install]
WantedBy=multi-user.target | 2 | 0.166667 | 1 | 1 |
37042f6dcd6c7420c327487fd5cf308532b92b6a | coffee/core/util.coffee | coffee/core/util.coffee | window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()
resize = =>
canvas.style.height = "#{$container.height()}px"
canvas.setAttribute('width', $canvas.width())
canvas.setAttribute('height', $canvas.height())
callback()
$container.resize(resize)
$(window).bind('orientationchange resize', resize)
resize()
combineCanvases: (a, b) ->
c = $('<canvas>').get(0)
c.width = Math.max(a.width, b.width)
c.height = Math.max(a.height, b.height)
ctx = c.getContext('2d')
ctx.drawImage(a, 0, 0)
ctx.drawImage(b, 0, 0)
c
| window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()
resize = =>
canvas.style.width = "#{$container.width()}px"
canvas.style.height = "#{$container.height()}px"
canvas.setAttribute('width', $canvas.width())
canvas.setAttribute('height', $canvas.height())
callback()
$container.resize(resize)
$(window).bind('orientationchange resize', resize)
resize()
combineCanvases: (a, b) ->
c = $('<canvas>').get(0)
c.width = Math.max(a.width, b.width)
c.height = Math.max(a.height, b.height)
ctx = c.getContext('2d')
ctx.drawImage(a, 0, 0)
ctx.drawImage(b, 0, 0)
c
| Fix sizeToContainer - actually set width | Fix sizeToContainer - actually set width
| CoffeeScript | bsd-2-clause | ivanisidrowu/literallycanvas,irskep/lc-demo,shawinder/literallycanvas,bartuspan/literallycanvas,shawinder/literallycanvas,aiwenlg007/literallycanvas,literallycanvas/literallycanvas,aiwenlg007/literallycanvas,178620086/literallycanvas,bartuspan/literallycanvas,irskep/lc-demo,irskep/literallycanvas,178620086/literallycanvas,ivanisidrowu/literallycanvas | coffeescript | ## Code Before:
window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()
resize = =>
canvas.style.height = "#{$container.height()}px"
canvas.setAttribute('width', $canvas.width())
canvas.setAttribute('height', $canvas.height())
callback()
$container.resize(resize)
$(window).bind('orientationchange resize', resize)
resize()
combineCanvases: (a, b) ->
c = $('<canvas>').get(0)
c.width = Math.max(a.width, b.width)
c.height = Math.max(a.height, b.height)
ctx = c.getContext('2d')
ctx.drawImage(a, 0, 0)
ctx.drawImage(b, 0, 0)
c
## Instruction:
Fix sizeToContainer - actually set width
## Code After:
window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()
resize = =>
canvas.style.width = "#{$container.width()}px"
canvas.style.height = "#{$container.height()}px"
canvas.setAttribute('width', $canvas.width())
canvas.setAttribute('height', $canvas.height())
callback()
$container.resize(resize)
$(window).bind('orientationchange resize', resize)
resize()
combineCanvases: (a, b) ->
c = $('<canvas>').get(0)
c.width = Math.max(a.width, b.width)
c.height = Math.max(a.height, b.height)
ctx = c.getContext('2d')
ctx.drawImage(a, 0, 0)
ctx.drawImage(b, 0, 0)
c
| window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()
resize = =>
+ canvas.style.width = "#{$container.width()}px"
canvas.style.height = "#{$container.height()}px"
canvas.setAttribute('width', $canvas.width())
canvas.setAttribute('height', $canvas.height())
callback()
$container.resize(resize)
$(window).bind('orientationchange resize', resize)
resize()
combineCanvases: (a, b) ->
c = $('<canvas>').get(0)
c.width = Math.max(a.width, b.width)
c.height = Math.max(a.height, b.height)
ctx = c.getContext('2d')
ctx.drawImage(a, 0, 0)
ctx.drawImage(b, 0, 0)
c | 1 | 0.030303 | 1 | 0 |
f0a34bc5814cb2b85bce3c73641e8e25d1cd3127 | readme.md | readme.md | > Simple production-ready boilerplate for [React](http://facebook.github.io/react/) and [Webpack](http://webpack.github.io/) (SASS and React hot reloading)
## Install
Clone repository and run:
```sh
$ npm install
```
Alternatively, you can deploy your own copy with one click using this button:
[](https://heroku.com/deploy?template=https://github.com/srn/react-webpack-boilerplate)
## iojs
If you'd rather want to use `iojs` you need to install a newer version of `jest` than what is currently
available on npm. Jest uses a newer version of `jsdom` where support for node `<= 0.12` has been dropped in order to move
the project further. As of [#374](https://github.com/facebook/jest/pull/374), Jest should work on latest io.js.
It's currently in a separate branch, [facebook/jest/tree/0.5.x](https://github.com/facebook/jest/tree/0.5.x), and can also be installed via npm `facebook/jest#0.5.x`.
## Development
```sh
$ npm start
```
Go to [http://localhost:3001](http://localhost:3001) and see the magic happen.
## Production
If you want to run the project in production, set the `NODE_ENV` environment variable to `production`.
```sh
$ NODE_ENV=production npm start
```
Also build the production bundle:
```sh
$ npm run dist
```
## Tests
```sh
$ npm test
```
Only run specific tests
```sh
$ npm test -- NotFoundComponent
```
Coverage
```sh
$ npm test -- --coverage
```
## License
MIT © [Søren Brokær](http://srn.io)
[travis]: https://travis-ci.org/srn/react-webpack-boilerplate
[travis-badge]: http://img.shields.io/travis/srn/react-webpack-boilerplate.svg?style=flat-square
[coveralls]: https://coveralls.io/r/srn/react-webpack-boilerplate
[coveralls-badge]: http://img.shields.io/coveralls/srn/react-webpack-boilerplate.svg?style=flat-square
| Learning React. There will be many mistakes. | Update README to be more accurate | Update README to be more accurate
| Markdown | mit | flubstep/foxgami.com,flubstep/foxgami.com | markdown | ## Code Before:
> Simple production-ready boilerplate for [React](http://facebook.github.io/react/) and [Webpack](http://webpack.github.io/) (SASS and React hot reloading)
## Install
Clone repository and run:
```sh
$ npm install
```
Alternatively, you can deploy your own copy with one click using this button:
[](https://heroku.com/deploy?template=https://github.com/srn/react-webpack-boilerplate)
## iojs
If you'd rather want to use `iojs` you need to install a newer version of `jest` than what is currently
available on npm. Jest uses a newer version of `jsdom` where support for node `<= 0.12` has been dropped in order to move
the project further. As of [#374](https://github.com/facebook/jest/pull/374), Jest should work on latest io.js.
It's currently in a separate branch, [facebook/jest/tree/0.5.x](https://github.com/facebook/jest/tree/0.5.x), and can also be installed via npm `facebook/jest#0.5.x`.
## Development
```sh
$ npm start
```
Go to [http://localhost:3001](http://localhost:3001) and see the magic happen.
## Production
If you want to run the project in production, set the `NODE_ENV` environment variable to `production`.
```sh
$ NODE_ENV=production npm start
```
Also build the production bundle:
```sh
$ npm run dist
```
## Tests
```sh
$ npm test
```
Only run specific tests
```sh
$ npm test -- NotFoundComponent
```
Coverage
```sh
$ npm test -- --coverage
```
## License
MIT © [Søren Brokær](http://srn.io)
[travis]: https://travis-ci.org/srn/react-webpack-boilerplate
[travis-badge]: http://img.shields.io/travis/srn/react-webpack-boilerplate.svg?style=flat-square
[coveralls]: https://coveralls.io/r/srn/react-webpack-boilerplate
[coveralls-badge]: http://img.shields.io/coveralls/srn/react-webpack-boilerplate.svg?style=flat-square
## Instruction:
Update README to be more accurate
## Code After:
Learning React. There will be many mistakes. | + Learning React. There will be many mistakes.
- > Simple production-ready boilerplate for [React](http://facebook.github.io/react/) and [Webpack](http://webpack.github.io/) (SASS and React hot reloading)
-
- ## Install
-
- Clone repository and run:
-
- ```sh
- $ npm install
- ```
-
- Alternatively, you can deploy your own copy with one click using this button:
-
- [](https://heroku.com/deploy?template=https://github.com/srn/react-webpack-boilerplate)
-
- ## iojs
-
- If you'd rather want to use `iojs` you need to install a newer version of `jest` than what is currently
- available on npm. Jest uses a newer version of `jsdom` where support for node `<= 0.12` has been dropped in order to move
- the project further. As of [#374](https://github.com/facebook/jest/pull/374), Jest should work on latest io.js.
- It's currently in a separate branch, [facebook/jest/tree/0.5.x](https://github.com/facebook/jest/tree/0.5.x), and can also be installed via npm `facebook/jest#0.5.x`.
-
- ## Development
-
- ```sh
- $ npm start
- ```
-
- Go to [http://localhost:3001](http://localhost:3001) and see the magic happen.
-
- ## Production
-
- If you want to run the project in production, set the `NODE_ENV` environment variable to `production`.
-
- ```sh
- $ NODE_ENV=production npm start
- ```
-
- Also build the production bundle:
-
- ```sh
- $ npm run dist
- ```
-
- ## Tests
-
- ```sh
- $ npm test
- ```
-
- Only run specific tests
-
- ```sh
- $ npm test -- NotFoundComponent
- ```
-
- Coverage
-
- ```sh
- $ npm test -- --coverage
- ```
-
- ## License
-
- MIT © [Søren Brokær](http://srn.io)
-
- [travis]: https://travis-ci.org/srn/react-webpack-boilerplate
- [travis-badge]: http://img.shields.io/travis/srn/react-webpack-boilerplate.svg?style=flat-square
- [coveralls]: https://coveralls.io/r/srn/react-webpack-boilerplate
- [coveralls-badge]: http://img.shields.io/coveralls/srn/react-webpack-boilerplate.svg?style=flat-square | 70 | 1.014493 | 1 | 69 |
b036d65878a1bab09233a6a6585bd7d5b9a008c7 | RELEASE.md | RELEASE.md | How to do a new release
=======================
Steps to create a new release:
1. check that the version bump was done in spec_cleaner/__init__.py
2. run `make` to verify the generated data are up-to-date
3. tag the new release: `git tag -s spec-cleaner-X.Y.Z`
4. upload to pypi: `python setup.py sdist upload`
5. post release version bump in spec_cleaner/__init__.py
| How to do a new release
=======================
Steps to create a new release:
1. check that the version bump was done in spec_cleaner/__init__.py
2. run `make` to verify the generated data are up-to-date
3. tag the new release: `git tag -s spec-cleaner-X.Y.Z`
4. verify travis did upload new version to to pypi
5. post release version bump in spec_cleaner/__init__.py
| Document in release guide that we just check pypi now | Document in release guide that we just check pypi now
| Markdown | bsd-3-clause | plusky/spec-cleaner,plusky/spec-cleaner,plusky/spec-cleaner,plusky/spec-cleaner,plusky/spec-cleaner | markdown | ## Code Before:
How to do a new release
=======================
Steps to create a new release:
1. check that the version bump was done in spec_cleaner/__init__.py
2. run `make` to verify the generated data are up-to-date
3. tag the new release: `git tag -s spec-cleaner-X.Y.Z`
4. upload to pypi: `python setup.py sdist upload`
5. post release version bump in spec_cleaner/__init__.py
## Instruction:
Document in release guide that we just check pypi now
## Code After:
How to do a new release
=======================
Steps to create a new release:
1. check that the version bump was done in spec_cleaner/__init__.py
2. run `make` to verify the generated data are up-to-date
3. tag the new release: `git tag -s spec-cleaner-X.Y.Z`
4. verify travis did upload new version to to pypi
5. post release version bump in spec_cleaner/__init__.py
| How to do a new release
=======================
Steps to create a new release:
1. check that the version bump was done in spec_cleaner/__init__.py
2. run `make` to verify the generated data are up-to-date
3. tag the new release: `git tag -s spec-cleaner-X.Y.Z`
- 4. upload to pypi: `python setup.py sdist upload`
+ 4. verify travis did upload new version to to pypi
5. post release version bump in spec_cleaner/__init__.py | 2 | 0.222222 | 1 | 1 |
e5ffafb53bdce4fdfca12680175adb6858dacd75 | index.js | index.js | var Xray = require('x-ray'),
fs = require('fs')
var x = Xray()
var baseURLPrefix = "http://www.thaischool.in.th/sitemap.php?school_area=&province_id=",
baseURLSuffix = "&schooltype_id=&txtsearch=",
provinces = require('./provinces.json')
function appendObject(obj){
var resultFile = fs.readFileSync('./result/result.json')
var result = JSON.parse(resultFile)
result.push(obj)
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/result.json', resultJSON)
}
provinces.map(function(province){
x(baseURLPrefix + province['id'] + baseURLSuffix, 'form', ['td > a'])
.paginate('a[title="Next"]@href')(function(err, arr) {
appendObject({
province: province['name'],
schools: arr
})
})
}) | var Xray = require('x-ray'),
fs = require('fs')
var x = Xray()
var baseURLPrefix = "http://www.thaischool.in.th/sitemap.php?school_area=&province_id=",
baseURLSuffix = "&schooltype_id=&txtsearch=",
provinces = require('./provinces.json')
function appendObject(obj){
var resultFile = fs.readFileSync('./result/result.json')
var result = JSON.parse(resultFile)
result.push(obj)
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/result.json', resultJSON)
}
function appendArray(arr){
var resultFile = fs.readFileSync('./result/schools.json')
var result = JSON.parse(resultFile)
Array.prototype.push.apply(result, obj);
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/schools.json', resultJSON)
}
provinces.map(function(province){
x(baseURLPrefix + province['id'] + baseURLSuffix, 'form', ['td > a'])
.paginate('a[title="Next"]@href')(function(err, arr) {
appendObject({
province: province['name'],
schools: arr
})
appendArray(arr)
})
}) | Save result as array of school name only | Save result as array of school name only
| JavaScript | isc | lukyth/thailand-school-collector | javascript | ## Code Before:
var Xray = require('x-ray'),
fs = require('fs')
var x = Xray()
var baseURLPrefix = "http://www.thaischool.in.th/sitemap.php?school_area=&province_id=",
baseURLSuffix = "&schooltype_id=&txtsearch=",
provinces = require('./provinces.json')
function appendObject(obj){
var resultFile = fs.readFileSync('./result/result.json')
var result = JSON.parse(resultFile)
result.push(obj)
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/result.json', resultJSON)
}
provinces.map(function(province){
x(baseURLPrefix + province['id'] + baseURLSuffix, 'form', ['td > a'])
.paginate('a[title="Next"]@href')(function(err, arr) {
appendObject({
province: province['name'],
schools: arr
})
})
})
## Instruction:
Save result as array of school name only
## Code After:
var Xray = require('x-ray'),
fs = require('fs')
var x = Xray()
var baseURLPrefix = "http://www.thaischool.in.th/sitemap.php?school_area=&province_id=",
baseURLSuffix = "&schooltype_id=&txtsearch=",
provinces = require('./provinces.json')
function appendObject(obj){
var resultFile = fs.readFileSync('./result/result.json')
var result = JSON.parse(resultFile)
result.push(obj)
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/result.json', resultJSON)
}
function appendArray(arr){
var resultFile = fs.readFileSync('./result/schools.json')
var result = JSON.parse(resultFile)
Array.prototype.push.apply(result, obj);
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/schools.json', resultJSON)
}
provinces.map(function(province){
x(baseURLPrefix + province['id'] + baseURLSuffix, 'form', ['td > a'])
.paginate('a[title="Next"]@href')(function(err, arr) {
appendObject({
province: province['name'],
schools: arr
})
appendArray(arr)
})
}) | var Xray = require('x-ray'),
fs = require('fs')
var x = Xray()
var baseURLPrefix = "http://www.thaischool.in.th/sitemap.php?school_area=&province_id=",
baseURLSuffix = "&schooltype_id=&txtsearch=",
provinces = require('./provinces.json')
function appendObject(obj){
var resultFile = fs.readFileSync('./result/result.json')
var result = JSON.parse(resultFile)
result.push(obj)
var resultJSON = JSON.stringify(result)
fs.writeFileSync('./result/result.json', resultJSON)
}
+ function appendArray(arr){
+ var resultFile = fs.readFileSync('./result/schools.json')
+ var result = JSON.parse(resultFile)
+ Array.prototype.push.apply(result, obj);
+ var resultJSON = JSON.stringify(result)
+ fs.writeFileSync('./result/schools.json', resultJSON)
+ }
+
provinces.map(function(province){
x(baseURLPrefix + province['id'] + baseURLSuffix, 'form', ['td > a'])
.paginate('a[title="Next"]@href')(function(err, arr) {
appendObject({
province: province['name'],
schools: arr
})
+ appendArray(arr)
})
}) | 9 | 0.346154 | 9 | 0 |
e3a95d00444fb981d7aaf6d3beffca8796a8891f | mycroft/frontends/tts/mimic_tts.py | mycroft/frontends/tts/mimic_tts.py | from subprocess import call
from mycroft.frontends.tts.tts_plugin import TtsPlugin
class MimicTts(TtsPlugin):
def read(self, text):
call(['mimic', '-t', text, '-voice', self.config['voice']])
| from subprocess import call
from os.path import isdir
from mycroft.frontends.tts.tts_plugin import TtsPlugin
from mycroft.util.git_repo import GitRepo
class MimicTts(TtsPlugin):
def __init__(self, rt):
super().__init__(rt)
if not isdir(self.rt.paths.mimic_exe):
self.download_mimic()
def download_mimic(self):
repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
repo.try_pull()
repo.run_inside('./dependencies.sh --prefix="/usr/local"')
repo.run_inside('./autogen.sh')
repo.run_inside('./configure.sh --prefix="/usr/local"')
repo.run_inside('make -j2')
def read(self, text):
call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])
| Add download and compile step to mimic | Add download and compile step to mimic
| Python | apache-2.0 | MatthewScholefield/mycroft-simple,MatthewScholefield/mycroft-simple | python | ## Code Before:
from subprocess import call
from mycroft.frontends.tts.tts_plugin import TtsPlugin
class MimicTts(TtsPlugin):
def read(self, text):
call(['mimic', '-t', text, '-voice', self.config['voice']])
## Instruction:
Add download and compile step to mimic
## Code After:
from subprocess import call
from os.path import isdir
from mycroft.frontends.tts.tts_plugin import TtsPlugin
from mycroft.util.git_repo import GitRepo
class MimicTts(TtsPlugin):
def __init__(self, rt):
super().__init__(rt)
if not isdir(self.rt.paths.mimic_exe):
self.download_mimic()
def download_mimic(self):
repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
repo.try_pull()
repo.run_inside('./dependencies.sh --prefix="/usr/local"')
repo.run_inside('./autogen.sh')
repo.run_inside('./configure.sh --prefix="/usr/local"')
repo.run_inside('make -j2')
def read(self, text):
call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])
| from subprocess import call
+ from os.path import isdir
+
from mycroft.frontends.tts.tts_plugin import TtsPlugin
+ from mycroft.util.git_repo import GitRepo
class MimicTts(TtsPlugin):
+ def __init__(self, rt):
+ super().__init__(rt)
+
+ if not isdir(self.rt.paths.mimic_exe):
+ self.download_mimic()
+
+ def download_mimic(self):
+ repo = GitRepo(self.rt.paths.mimic, self.config['url'], 'master')
+ repo.try_pull()
+ repo.run_inside('./dependencies.sh --prefix="/usr/local"')
+ repo.run_inside('./autogen.sh')
+ repo.run_inside('./configure.sh --prefix="/usr/local"')
+ repo.run_inside('make -j2')
+
def read(self, text):
- call(['mimic', '-t', text, '-voice', self.config['voice']])
? ^ ^
+ call([self.rt.paths.mimic_exe, '-t', text, '-voice', self.config['voice']])
? ^^^^^^^^^^^^^^ ^^^^
| 19 | 2.375 | 18 | 1 |
c5fa12d8cd7bf2266e21221d99a0d870e4edfd74 | src/React.Sample.Mvc4/types/index.d.ts | src/React.Sample.Mvc4/types/index.d.ts | import {
Component as _Component,
useState as _useState,
Dispatch,
SetStateAction,
} from 'react';
// Globally available modules must be declared here
// Copy type definitions from @types/react/index.d.ts, because namespaces can't be re-exported
declare global {
namespace React {
function useState<S>(
initialState: S | (() => S),
): [S, Dispatch<SetStateAction<S>>];
function useState<S = undefined>(): [
S | undefined,
Dispatch<SetStateAction<S | undefined>>
];
interface Component<P = {}, S = {}, SS = any>
extends ComponentLifecycle<P, S, SS> {}
}
const Reactstrap: any;
const PropTypes: any;
}
export const test = 1;
| import _React from 'react';
import _Reactstrap from 'reactstrap';
import _PropTypes from 'prop-types';
declare global {
const React: typeof _React;
const Reactstrap: typeof _Reactstrap;
const PropTypes: typeof _PropTypes;
}
| Improve type resolution for UMD libraries | Improve type resolution for UMD libraries
😎 found a way to make it "just work" with existing types
| TypeScript | mit | reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET,reactjs/React.NET | typescript | ## Code Before:
import {
Component as _Component,
useState as _useState,
Dispatch,
SetStateAction,
} from 'react';
// Globally available modules must be declared here
// Copy type definitions from @types/react/index.d.ts, because namespaces can't be re-exported
declare global {
namespace React {
function useState<S>(
initialState: S | (() => S),
): [S, Dispatch<SetStateAction<S>>];
function useState<S = undefined>(): [
S | undefined,
Dispatch<SetStateAction<S | undefined>>
];
interface Component<P = {}, S = {}, SS = any>
extends ComponentLifecycle<P, S, SS> {}
}
const Reactstrap: any;
const PropTypes: any;
}
export const test = 1;
## Instruction:
Improve type resolution for UMD libraries
😎 found a way to make it "just work" with existing types
## Code After:
import _React from 'react';
import _Reactstrap from 'reactstrap';
import _PropTypes from 'prop-types';
declare global {
const React: typeof _React;
const Reactstrap: typeof _Reactstrap;
const PropTypes: typeof _PropTypes;
}
| + import _React from 'react';
+ import _Reactstrap from 'reactstrap';
+ import _PropTypes from 'prop-types';
- import {
- Component as _Component,
- useState as _useState,
- Dispatch,
- SetStateAction,
- } from 'react';
-
- // Globally available modules must be declared here
- // Copy type definitions from @types/react/index.d.ts, because namespaces can't be re-exported
declare global {
+ const React: typeof _React;
+ const Reactstrap: typeof _Reactstrap;
+ const PropTypes: typeof _PropTypes;
- namespace React {
- function useState<S>(
- initialState: S | (() => S),
- ): [S, Dispatch<SetStateAction<S>>];
- function useState<S = undefined>(): [
- S | undefined,
- Dispatch<SetStateAction<S | undefined>>
- ];
- interface Component<P = {}, S = {}, SS = any>
- extends ComponentLifecycle<P, S, SS> {}
- }
- const Reactstrap: any;
- const PropTypes: any;
}
-
- export const test = 1; | 30 | 1.111111 | 6 | 24 |
cba46dca4712fae8fd5354cd14e90f632d36f9be | test/CodeGen/X86/vec_align_i256.ll | test/CodeGen/X86/vec_align_i256.ll | ; RUN: llc < %s -mcpu=corei7-avx | FileCheck %s
; Make sure that we are not generating a movaps because the vector is aligned to 1.
;CHECK: @foo
;CHECK: xor
;CHECK-NEXT: vmovups
;CHECK-NEXT: ret
define void @foo() {
store <16 x i16> zeroinitializer, <16 x i16>* undef, align 1
ret void
}
| ; RUN: llc < %s -mcpu=corei7-avx | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-apple-darwin8"
; Make sure that we are not generating a movaps because the vector is aligned to 1.
;CHECK: @foo
;CHECK: xor
;CHECK-NEXT: vmovups
;CHECK-NEXT: ret
define void @foo() {
store <16 x i16> zeroinitializer, <16 x i16>* undef, align 1
ret void
}
| Add a triple to the test. | Add a triple to the test.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@177131 91177308-0d34-0410-b5e6-96231b3b80d8
| LLVM | bsd-2-clause | chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,dslab-epfl/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,apple/swift-llvm,llvm-mirror/llvm,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,chubbymaggie/asap,dslab-epfl/asap | llvm | ## Code Before:
; RUN: llc < %s -mcpu=corei7-avx | FileCheck %s
; Make sure that we are not generating a movaps because the vector is aligned to 1.
;CHECK: @foo
;CHECK: xor
;CHECK-NEXT: vmovups
;CHECK-NEXT: ret
define void @foo() {
store <16 x i16> zeroinitializer, <16 x i16>* undef, align 1
ret void
}
## Instruction:
Add a triple to the test.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@177131 91177308-0d34-0410-b5e6-96231b3b80d8
## Code After:
; RUN: llc < %s -mcpu=corei7-avx | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-apple-darwin8"
; Make sure that we are not generating a movaps because the vector is aligned to 1.
;CHECK: @foo
;CHECK: xor
;CHECK-NEXT: vmovups
;CHECK-NEXT: ret
define void @foo() {
store <16 x i16> zeroinitializer, <16 x i16>* undef, align 1
ret void
}
| ; RUN: llc < %s -mcpu=corei7-avx | FileCheck %s
+
+ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+ target triple = "i686-apple-darwin8"
; Make sure that we are not generating a movaps because the vector is aligned to 1.
;CHECK: @foo
;CHECK: xor
;CHECK-NEXT: vmovups
;CHECK-NEXT: ret
define void @foo() {
store <16 x i16> zeroinitializer, <16 x i16>* undef, align 1
ret void
} | 3 | 0.272727 | 3 | 0 |
a1a6d77f11b50a848a4c9872519bf73933f24cc5 | doc/source/webapi/v1.rst | doc/source/webapi/v1.rst | ============
V1 Web API
============
.. autotype:: solum.api.controllers.common_types.Link
:members:
Platform
========
.. autotype:: solum.api.controllers.v1.Platform
:members:
Assemblies
==========
.. rest-controller:: solum.api.controllers.v1:AssembliesController
:webprefix: /v1/assemblies
.. autotype:: solum.api.controllers.v1.Assembly
:members:
| ============
V1 Web API
============
.. autotype:: solum.api.controllers.common_types.Link
:members:
Platform
========
.. autotype:: solum.api.controllers.v1.root.Platform
:members:
Assemblies
==========
.. rest-controller:: solum.api.controllers.v1.assembly:AssembliesController
:webprefix: /v1/assemblies
.. autotype:: solum.api.controllers.v1.assembly.Assembly
:members:
| Fix the path to the controllers | Docs: Fix the path to the controllers
This was restructured, but the docs were not updated.
Change-Id: Ie0d04de234d1616f574805c43d5a4c6525e547fc
Closes-bug: #1255315
| reStructuredText | apache-2.0 | gilbertpilz/solum,stackforge/solum,gilbertpilz/solum,julienvey/solum,devdattakulkarni/test-solum,gilbertpilz/solum,devdattakulkarni/test-solum,mohitsethi/solum,ed-/solum,julienvey/solum,openstack/solum,ed-/solum,ed-/solum,gilbertpilz/solum,stackforge/solum,mohitsethi/solum,ed-/solum,openstack/solum | restructuredtext | ## Code Before:
============
V1 Web API
============
.. autotype:: solum.api.controllers.common_types.Link
:members:
Platform
========
.. autotype:: solum.api.controllers.v1.Platform
:members:
Assemblies
==========
.. rest-controller:: solum.api.controllers.v1:AssembliesController
:webprefix: /v1/assemblies
.. autotype:: solum.api.controllers.v1.Assembly
:members:
## Instruction:
Docs: Fix the path to the controllers
This was restructured, but the docs were not updated.
Change-Id: Ie0d04de234d1616f574805c43d5a4c6525e547fc
Closes-bug: #1255315
## Code After:
============
V1 Web API
============
.. autotype:: solum.api.controllers.common_types.Link
:members:
Platform
========
.. autotype:: solum.api.controllers.v1.root.Platform
:members:
Assemblies
==========
.. rest-controller:: solum.api.controllers.v1.assembly:AssembliesController
:webprefix: /v1/assemblies
.. autotype:: solum.api.controllers.v1.assembly.Assembly
:members:
| ============
V1 Web API
============
.. autotype:: solum.api.controllers.common_types.Link
:members:
Platform
========
- .. autotype:: solum.api.controllers.v1.Platform
+ .. autotype:: solum.api.controllers.v1.root.Platform
? +++++
:members:
Assemblies
==========
- .. rest-controller:: solum.api.controllers.v1:AssembliesController
+ .. rest-controller:: solum.api.controllers.v1.assembly:AssembliesController
? +++++++++
:webprefix: /v1/assemblies
- .. autotype:: solum.api.controllers.v1.Assembly
+ .. autotype:: solum.api.controllers.v1.assembly.Assembly
? +++++++++
:members: | 6 | 0.272727 | 3 | 3 |
08867b33ee3cb1fe48f93bb22f19b018bff6ee6b | tests/unit/src/unit/issues/Issue3516.hx | tests/unit/src/unit/issues/Issue3516.hx | package unit.issues;
class Issue3516 extends Test
{
public function test()
{
var b = new B();
var c = b.uniqueFieldName(C);
t(Std.is(c, C));
t(c != null);
}
}
private class A<T> {
public function new() {}
public function uniqueFieldName(c:Class<T>):T {
return Type.createInstance(c, []);
}
}
private class B extends A<C> {}
private class C {}
class TestMain {
static function main() {
}
}
| package unit.issues;
class Issue3516 extends Test
{
public function test()
{
var b = new B();
var c = b.uniqueFieldName(C);
t(Std.is(c, C));
t(c != null);
}
}
private class A<T> {
public function new() {}
public function uniqueFieldName(c:Class<T>):T {
return Type.createInstance(c, []);
}
}
private class B extends A<C> {}
private class C { @:keep public function new() {} }
class TestMain {
static function main() {
}
}
| Fix createEmptyInstance on class without a constructor | [neko] Fix createEmptyInstance on class without a constructor
| Haxe | mit | pleclech/hacking-haxe,pleclech/hacking-haxe,pleclech/hacking-haxe,pleclech/hacking-haxe,pleclech/hacking-haxe,pleclech/hacking-haxe | haxe | ## Code Before:
package unit.issues;
class Issue3516 extends Test
{
public function test()
{
var b = new B();
var c = b.uniqueFieldName(C);
t(Std.is(c, C));
t(c != null);
}
}
private class A<T> {
public function new() {}
public function uniqueFieldName(c:Class<T>):T {
return Type.createInstance(c, []);
}
}
private class B extends A<C> {}
private class C {}
class TestMain {
static function main() {
}
}
## Instruction:
[neko] Fix createEmptyInstance on class without a constructor
## Code After:
package unit.issues;
class Issue3516 extends Test
{
public function test()
{
var b = new B();
var c = b.uniqueFieldName(C);
t(Std.is(c, C));
t(c != null);
}
}
private class A<T> {
public function new() {}
public function uniqueFieldName(c:Class<T>):T {
return Type.createInstance(c, []);
}
}
private class B extends A<C> {}
private class C { @:keep public function new() {} }
class TestMain {
static function main() {
}
}
| package unit.issues;
class Issue3516 extends Test
{
public function test()
{
var b = new B();
var c = b.uniqueFieldName(C);
t(Std.is(c, C));
t(c != null);
}
}
private class A<T> {
public function new() {}
public function uniqueFieldName(c:Class<T>):T {
return Type.createInstance(c, []);
}
}
private class B extends A<C> {}
- private class C {}
+ private class C { @:keep public function new() {} }
class TestMain {
static function main() {
}
} | 2 | 0.071429 | 1 | 1 |
7401e34c524c006b8fdfa9f39c48b8543f2b31d5 | app/controllers/api/customers_controller.rb | app/controllers/api/customers_controller.rb | module Api
class CustomersController < Api::BaseController
skip_authorization_check only: :index
def index
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
if @customer.update(params[:customer])
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
end
end
| module Api
class CustomersController < Api::BaseController
skip_authorization_check only: :index
def index
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
if @customer.update(customer_params)
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
def customer_params
params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges)
end
end
end
| Fix credit cards strong params | Fix credit cards strong params
| Ruby | agpl-3.0 | Matt-Yorkley/openfoodnetwork,openfoodfoundation/openfoodnetwork,lin-d-hop/openfoodnetwork,lin-d-hop/openfoodnetwork,mkllnk/openfoodnetwork,openfoodfoundation/openfoodnetwork,Matt-Yorkley/openfoodnetwork,openfoodfoundation/openfoodnetwork,lin-d-hop/openfoodnetwork,lin-d-hop/openfoodnetwork,Matt-Yorkley/openfoodnetwork,mkllnk/openfoodnetwork,openfoodfoundation/openfoodnetwork,mkllnk/openfoodnetwork,Matt-Yorkley/openfoodnetwork,mkllnk/openfoodnetwork | ruby | ## Code Before:
module Api
class CustomersController < Api::BaseController
skip_authorization_check only: :index
def index
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
if @customer.update(params[:customer])
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
end
end
## Instruction:
Fix credit cards strong params
## Code After:
module Api
class CustomersController < Api::BaseController
skip_authorization_check only: :index
def index
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
if @customer.update(customer_params)
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
def customer_params
params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges)
end
end
end
| module Api
class CustomersController < Api::BaseController
skip_authorization_check only: :index
def index
@customers = current_api_user.customers
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
- if @customer.update(params[:customer])
? -------- ^
+ if @customer.update(customer_params)
? ^^^^^^^
render json: @customer, serializer: CustomerSerializer, status: :ok
else
invalid_resource!(@customer)
end
end
+
+ def customer_params
+ params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges)
+ end
end
end | 6 | 0.285714 | 5 | 1 |
7d813e455e164e8577481aa858d71f70c45189e7 | sota.tex | sota.tex | % State of the Art Chapter
\section{Linux Kernel}
Blah.
\subsection{Linux Kernel Modules}
Blah.
\section{Software Composition Analysis}
SCA be here.
\subsection{Static Binary Analysis}
SBA be here.
| % State of the Art Chapter
\section{Software Composition Analysis}
Software composition analysis has steadily raised its profile over the years \cite{sauce}. While it
still hasn't quite reached a mainstream status yet, it has been made available for the masses by
actors such as Docker with the introduction of Docker Security Scan in Docker Hub and Docker Cloud
hosting services \cite{dockerscan}.
Here be some academics.
There are multiple commercial SCA solutions available from providers such as Black Duck
\cite{sauce}, Veracode \cite{sauce}, WhiteHat security \cite{sauce}, Whitesource \cite{sauce} and
Synopsys \cite{sauce}. The main purpose of these products is to report license information and
known vulnerabilities of the identified third party libraries from the system under test. There
are multiple different ways to identify the third party components. One common way is to statically
analyse build files from the source code repository and deduce what third party libraries are
included when the project is compiled. Another way is to try to figure out what third party
library the analyzed code belongs to.
\subsection{Static Binary Analysis}
Static binary analysis is conducted by analyzing the compiled binary without actually executing it.
\section{Linux Kernel}
Blah.
\subsection{Linux Kernel Modules}
Blah.
| Add some text to SCA chapter | Add some text to SCA chapter
| TeX | mit | okuuva/cse-dtyo | tex | ## Code Before:
% State of the Art Chapter
\section{Linux Kernel}
Blah.
\subsection{Linux Kernel Modules}
Blah.
\section{Software Composition Analysis}
SCA be here.
\subsection{Static Binary Analysis}
SBA be here.
## Instruction:
Add some text to SCA chapter
## Code After:
% State of the Art Chapter
\section{Software Composition Analysis}
Software composition analysis has steadily raised its profile over the years \cite{sauce}. While it
still hasn't quite reached a mainstream status yet, it has been made available for the masses by
actors such as Docker with the introduction of Docker Security Scan in Docker Hub and Docker Cloud
hosting services \cite{dockerscan}.
Here be some academics.
There are multiple commercial SCA solutions available from providers such as Black Duck
\cite{sauce}, Veracode \cite{sauce}, WhiteHat security \cite{sauce}, Whitesource \cite{sauce} and
Synopsys \cite{sauce}. The main purpose of these products is to report license information and
known vulnerabilities of the identified third party libraries from the system under test. There
are multiple different ways to identify the third party components. One common way is to statically
analyse build files from the source code repository and deduce what third party libraries are
included when the project is compiled. Another way is to try to figure out what third party
library the analyzed code belongs to.
\subsection{Static Binary Analysis}
Static binary analysis is conducted by analyzing the compiled binary without actually executing it.
\section{Linux Kernel}
Blah.
\subsection{Linux Kernel Modules}
Blah.
| % State of the Art Chapter
+
+ \section{Software Composition Analysis}
+
+ Software composition analysis has steadily raised its profile over the years \cite{sauce}. While it
+ still hasn't quite reached a mainstream status yet, it has been made available for the masses by
+ actors such as Docker with the introduction of Docker Security Scan in Docker Hub and Docker Cloud
+ hosting services \cite{dockerscan}.
+
+ Here be some academics.
+
+ There are multiple commercial SCA solutions available from providers such as Black Duck
+ \cite{sauce}, Veracode \cite{sauce}, WhiteHat security \cite{sauce}, Whitesource \cite{sauce} and
+ Synopsys \cite{sauce}. The main purpose of these products is to report license information and
+ known vulnerabilities of the identified third party libraries from the system under test. There
+ are multiple different ways to identify the third party components. One common way is to statically
+ analyse build files from the source code repository and deduce what third party libraries are
+ included when the project is compiled. Another way is to try to figure out what third party
+ library the analyzed code belongs to.
+
+ \subsection{Static Binary Analysis}
+
+ Static binary analysis is conducted by analyzing the compiled binary without actually executing it.
\section{Linux Kernel}
Blah.
\subsection{Linux Kernel Modules}
Blah.
- \section{Software Composition Analysis}
-
- SCA be here.
-
- \subsection{Static Binary Analysis}
-
- SBA be here. | 29 | 1.705882 | 22 | 7 |
cec08d708f40d35ca8896990fb316d3f5d57ee96 | src/filings-cli.coffee | src/filings-cli.coffee | fs = require 'fs'
optimist = require 'optimist'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
console.error "Unrecognized command: #{command}"
else
options.showHelp()
| fs = require 'fs'
path = require 'path'
optimist = require 'optimist'
{FormFour} = require './filings'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
[command, commandArgs...] = options.argv._
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
switch command
when 'profit'
reportPath = path.resolve(process.cwd(), commandArgs.shift())
FormFour.open reportPath, (error, formFour) ->
if error?
console.error(error)
else
console.log(formFour.getProfit())
else
console.error "Unrecognized command: #{command}"
else
options.showHelp()
| Add form 4 profit command | Add form 4 profit command
| CoffeeScript | mit | parrondo/filings,kevinsawicki/filings,krisalexander/filings | coffeescript | ## Code Before:
fs = require 'fs'
optimist = require 'optimist'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
console.error "Unrecognized command: #{command}"
else
options.showHelp()
## Instruction:
Add form 4 profit command
## Code After:
fs = require 'fs'
path = require 'path'
optimist = require 'optimist'
{FormFour} = require './filings'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
[command, commandArgs...] = options.argv._
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
switch command
when 'profit'
reportPath = path.resolve(process.cwd(), commandArgs.shift())
FormFour.open reportPath, (error, formFour) ->
if error?
console.error(error)
else
console.log(formFour.getProfit())
else
console.error "Unrecognized command: #{command}"
else
options.showHelp()
| fs = require 'fs'
+ path = require 'path'
optimist = require 'optimist'
+ {FormFour} = require './filings'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports =
run: (args=process.argv[2..]) ->
options = parseOptions(args)
+ [command, commandArgs...] = options.argv._
if options.argv.v
console.log JSON.parse(fs.readFileSync('package.json')).version
else if options.argv.h
options.showHelp()
else if command = options.argv._.shift()
+ switch command
+ when 'profit'
+ reportPath = path.resolve(process.cwd(), commandArgs.shift())
+ FormFour.open reportPath, (error, formFour) ->
+ if error?
+ console.error(error)
+ else
+ console.log(formFour.getProfit())
+ else
- console.error "Unrecognized command: #{command}"
+ console.error "Unrecognized command: #{command}"
? ++++
else
options.showHelp() | 14 | 0.666667 | 13 | 1 |
18aa55888b45eb683c216b887e04e062fa6a85f6 | scripts/webpack/ManageElectronProcessPlugin.js | scripts/webpack/ManageElectronProcessPlugin.js | const { exec } = require('child_process');
class ManageElectronProcessPlugin {
apply(compiler) {
if (compiler.options.watch) {
let electron = null;
compiler.hooks.done.tap(
'RestartElectronPlugin',
() => {
if (electron === null) {
electron = exec("yarn electron .");
electron.once('close', () => {
electron = null;
});
} else {
electron.kill();
electron = exec("yarn electron .");
}
}
);
}
}
}
module.exports = ManageElectronProcessPlugin;
| const { exec } = require('child_process');
class ManageElectronProcessPlugin {
apply(compiler) {
if (compiler.options.watch) {
let electronMainProcess = null;
let isMainProcessBeingRestarted = false;
compiler.hooks.done.tap(
'RestartElectronPlugin',
() => {
if (electronMainProcess === null) {
electronMainProcess = exec("yarn electron .");
electronMainProcess.once('close', () => {
electronMainProcess = null;
if (isMainProcessBeingRestarted) {
electronMainProcess = exec("yarn electron .");
isMainProcessBeingRestarted = false;
}
});
} else if (!isMainProcessBeingRestarted) {
isMainProcessBeingRestarted = true;
electronMainProcess.kill();
}
}
);
}
}
}
module.exports = ManageElectronProcessPlugin;
| Improve electron process webpack plugin | [DDW-596] Improve electron process webpack plugin
| JavaScript | apache-2.0 | input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus | javascript | ## Code Before:
const { exec } = require('child_process');
class ManageElectronProcessPlugin {
apply(compiler) {
if (compiler.options.watch) {
let electron = null;
compiler.hooks.done.tap(
'RestartElectronPlugin',
() => {
if (electron === null) {
electron = exec("yarn electron .");
electron.once('close', () => {
electron = null;
});
} else {
electron.kill();
electron = exec("yarn electron .");
}
}
);
}
}
}
module.exports = ManageElectronProcessPlugin;
## Instruction:
[DDW-596] Improve electron process webpack plugin
## Code After:
const { exec } = require('child_process');
class ManageElectronProcessPlugin {
apply(compiler) {
if (compiler.options.watch) {
let electronMainProcess = null;
let isMainProcessBeingRestarted = false;
compiler.hooks.done.tap(
'RestartElectronPlugin',
() => {
if (electronMainProcess === null) {
electronMainProcess = exec("yarn electron .");
electronMainProcess.once('close', () => {
electronMainProcess = null;
if (isMainProcessBeingRestarted) {
electronMainProcess = exec("yarn electron .");
isMainProcessBeingRestarted = false;
}
});
} else if (!isMainProcessBeingRestarted) {
isMainProcessBeingRestarted = true;
electronMainProcess.kill();
}
}
);
}
}
}
module.exports = ManageElectronProcessPlugin;
| const { exec } = require('child_process');
class ManageElectronProcessPlugin {
apply(compiler) {
if (compiler.options.watch) {
- let electron = null;
+ let electronMainProcess = null;
? +++++++++++
+ let isMainProcessBeingRestarted = false;
compiler.hooks.done.tap(
'RestartElectronPlugin',
() => {
- if (electron === null) {
+ if (electronMainProcess === null) {
? +++++++++++
- electron = exec("yarn electron .");
+ electronMainProcess = exec("yarn electron .");
? +++++++++++
- electron.once('close', () => {
+ electronMainProcess.once('close', () => {
? +++++++++++
- electron = null;
+ electronMainProcess = null;
? +++++++++++
+ if (isMainProcessBeingRestarted) {
+ electronMainProcess = exec("yarn electron .");
+ isMainProcessBeingRestarted = false;
+ }
});
- } else {
+ } else if (!isMainProcessBeingRestarted) {
+ isMainProcessBeingRestarted = true;
- electron.kill();
+ electronMainProcess.kill();
? +++++++++++
- electron = exec("yarn electron .");
}
}
);
}
}
}
module.exports = ManageElectronProcessPlugin; | 21 | 0.807692 | 13 | 8 |
f996755665c9e55af5139a473b859aa0eb507515 | back2back/wsgi.py | back2back/wsgi.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "back2back.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling, MediaCling
application = Cling(MediaCling(get_wsgi_application()))
| import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "back2back.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())
| Remove MediaCling as there isn't any. | Remove MediaCling as there isn't any.
| Python | bsd-2-clause | mjtamlyn/back2back,mjtamlyn/back2back,mjtamlyn/back2back,mjtamlyn/back2back | python | ## Code Before:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "back2back.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling, MediaCling
application = Cling(MediaCling(get_wsgi_application()))
## Instruction:
Remove MediaCling as there isn't any.
## Code After:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "back2back.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())
| import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "back2back.settings")
from django.core.wsgi import get_wsgi_application
- from dj_static import Cling, MediaCling
? ------------
+ from dj_static import Cling
- application = Cling(MediaCling(get_wsgi_application()))
? ----------- -
+ application = Cling(get_wsgi_application()) | 4 | 0.571429 | 2 | 2 |
e7c6cbb75f5f4766eef3463ba8ccf487600fd6bf | pages/app/controllers/constructor_pages/templates_controller.rb | pages/app/controllers/constructor_pages/templates_controller.rb |
module ConstructorPages
class TemplatesController < ApplicationController
include TreeviewHelper
movable :template
before_filter {@roots = Template.roots}
def index
@templates = Template.all
@templates_cache = Digest::MD5.hexdigest(@templates.map{|t| [t.name, t.lft]}.join)
end
def new
@template = Template.new
end
def edit
@template = Template.find(params[:id])
end
def create
@template = Template.new template_params
if @template.save
redirect_to templates_url, notice: t(:template_success_added, name: @template.name)
else
render :new
end
end
def update
@template = Template.find params[:id]
if @template.update template_params
redirect_to templates_url, notice: t(:template_success_updated, name: @template.name)
else
render :edit
end
end
def destroy
@template = Template.find(params[:id])
if @template.pages.count == 0
name = @template.name
@template.destroy
redirect_to templates_url, notice: t(:template_success_removed, name: name)
else
redirect_to :back, alert: t(:template_error_delete_pages)
end
end
private
def template_params
params.require(:template).permit(
:name,
:code_name,
:parent_id,
:child_id
)
end
end
end
|
module ConstructorPages
class TemplatesController < ApplicationController
include TreeviewHelper
movable :template
before_filter -> {@roots = Template.roots}, only: [:new, :edit]
def index
@templates = Template.all
@templates_cache = Digest::MD5.hexdigest(@templates.map{|t| [t.name, t.lft]}.join)
end
def new
@template = Template.new
end
def edit
@template = Template.find(params[:id])
end
def create
@template = Template.new template_params
if @template.save
redirect_to templates_url, notice: t(:template_success_added, name: @template.name)
else
render :new
end
end
def update
@template = Template.find params[:id]
if @template.update template_params
redirect_to templates_url, notice: t(:template_success_updated, name: @template.name)
else
render :edit
end
end
def destroy
@template = Template.find(params[:id])
if @template.pages.count == 0
name = @template.name
@template.destroy
redirect_to templates_url, notice: t(:template_success_removed, name: name)
else
redirect_to :back, alert: t(:template_error_delete_pages)
end
end
private
def template_params
params.require(:template).permit(
:name,
:code_name,
:parent_id,
:child_id
)
end
end
end
| Change template before_filter for only new and edit | Change template before_filter for only new and edit
| Ruby | mit | szyablitsky/constructor,szyablitsky/constructor,szyablitsky/constructor,ivanzotov/constructor,ivanzotov/constructor,ivanzotov/constructor | ruby | ## Code Before:
module ConstructorPages
class TemplatesController < ApplicationController
include TreeviewHelper
movable :template
before_filter {@roots = Template.roots}
def index
@templates = Template.all
@templates_cache = Digest::MD5.hexdigest(@templates.map{|t| [t.name, t.lft]}.join)
end
def new
@template = Template.new
end
def edit
@template = Template.find(params[:id])
end
def create
@template = Template.new template_params
if @template.save
redirect_to templates_url, notice: t(:template_success_added, name: @template.name)
else
render :new
end
end
def update
@template = Template.find params[:id]
if @template.update template_params
redirect_to templates_url, notice: t(:template_success_updated, name: @template.name)
else
render :edit
end
end
def destroy
@template = Template.find(params[:id])
if @template.pages.count == 0
name = @template.name
@template.destroy
redirect_to templates_url, notice: t(:template_success_removed, name: name)
else
redirect_to :back, alert: t(:template_error_delete_pages)
end
end
private
def template_params
params.require(:template).permit(
:name,
:code_name,
:parent_id,
:child_id
)
end
end
end
## Instruction:
Change template before_filter for only new and edit
## Code After:
module ConstructorPages
class TemplatesController < ApplicationController
include TreeviewHelper
movable :template
before_filter -> {@roots = Template.roots}, only: [:new, :edit]
def index
@templates = Template.all
@templates_cache = Digest::MD5.hexdigest(@templates.map{|t| [t.name, t.lft]}.join)
end
def new
@template = Template.new
end
def edit
@template = Template.find(params[:id])
end
def create
@template = Template.new template_params
if @template.save
redirect_to templates_url, notice: t(:template_success_added, name: @template.name)
else
render :new
end
end
def update
@template = Template.find params[:id]
if @template.update template_params
redirect_to templates_url, notice: t(:template_success_updated, name: @template.name)
else
render :edit
end
end
def destroy
@template = Template.find(params[:id])
if @template.pages.count == 0
name = @template.name
@template.destroy
redirect_to templates_url, notice: t(:template_success_removed, name: name)
else
redirect_to :back, alert: t(:template_error_delete_pages)
end
end
private
def template_params
params.require(:template).permit(
:name,
:code_name,
:parent_id,
:child_id
)
end
end
end
|
module ConstructorPages
class TemplatesController < ApplicationController
include TreeviewHelper
movable :template
- before_filter {@roots = Template.roots}
+ before_filter -> {@roots = Template.roots}, only: [:new, :edit]
? +++ +++++++++++++++++++++
def index
@templates = Template.all
@templates_cache = Digest::MD5.hexdigest(@templates.map{|t| [t.name, t.lft]}.join)
end
def new
@template = Template.new
end
def edit
@template = Template.find(params[:id])
end
def create
@template = Template.new template_params
if @template.save
redirect_to templates_url, notice: t(:template_success_added, name: @template.name)
else
render :new
end
end
def update
@template = Template.find params[:id]
if @template.update template_params
redirect_to templates_url, notice: t(:template_success_updated, name: @template.name)
else
render :edit
end
end
def destroy
@template = Template.find(params[:id])
if @template.pages.count == 0
name = @template.name
@template.destroy
redirect_to templates_url, notice: t(:template_success_removed, name: name)
else
redirect_to :back, alert: t(:template_error_delete_pages)
end
end
private
def template_params
params.require(:template).permit(
:name,
:code_name,
:parent_id,
:child_id
)
end
end
end | 2 | 0.030303 | 1 | 1 |
ca6c17e1ea21d3e95dd8338f70a0c79669c66721 | osx/defaults.sh | osx/defaults.sh | defaults write -g ApplePressAndHoldEnabled -bool false
# you could use Karabiner as well
defaults write -g InitialKeyRepeat -float 10.0 # 166ms
defaults write -g KeyRepeat -float 1.2 # 20ms
| defaults write -g ApplePressAndHoldEnabled -bool false
# you could use Karabiner as well
defaults write -g InitialKeyRepeat -float 10.0 # 166ms
defaults write -g KeyRepeat -float 1.2 # 20ms
# Use all Fn keys as standard function keys
defaults write -g com.apple.keyboard.fnState -bool true
| Use all Fn keys as standard function keys on Mac OS | Use all Fn keys as standard function keys on Mac OS
| Shell | mit | ganczarek/dotfiles,ganczarek/dotfiles,ganczarek/dotfiles | shell | ## Code Before:
defaults write -g ApplePressAndHoldEnabled -bool false
# you could use Karabiner as well
defaults write -g InitialKeyRepeat -float 10.0 # 166ms
defaults write -g KeyRepeat -float 1.2 # 20ms
## Instruction:
Use all Fn keys as standard function keys on Mac OS
## Code After:
defaults write -g ApplePressAndHoldEnabled -bool false
# you could use Karabiner as well
defaults write -g InitialKeyRepeat -float 10.0 # 166ms
defaults write -g KeyRepeat -float 1.2 # 20ms
# Use all Fn keys as standard function keys
defaults write -g com.apple.keyboard.fnState -bool true
| defaults write -g ApplePressAndHoldEnabled -bool false
# you could use Karabiner as well
defaults write -g InitialKeyRepeat -float 10.0 # 166ms
defaults write -g KeyRepeat -float 1.2 # 20ms
+ # Use all Fn keys as standard function keys
+ defaults write -g com.apple.keyboard.fnState -bool true | 2 | 0.4 | 2 | 0 |
34de7a17477578b66e559368d82be97cf2c3dd01 | .travis.yml | .travis.yml | language: python
before_install: >
travis_retry sudo apt-get install python python-setuptools
python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev
install:
- travis_retry python setup.py dev # installs tox
- travis_retry pip install coveralls
script: travis_retry tox
after_success: coveralls
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=lint
- TOXENV=cover
notifications:
email: false
irc: "chat.freenode.net#letsencrypt"
| language: python
before_install: >
travis_retry sudo apt-get install python python-setuptools
python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev
install:
- travis_retry python setup.py dev # installs tox
- travis_retry pip install coveralls
script: travis_retry tox
after_success: '[ "$TOXENV" == "cover" ] && coveralls'
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=lint
- TOXENV=cover
notifications:
email: false
irc: "chat.freenode.net#letsencrypt"
| Make coveralls dependent on the TOXENV variable being "cover" | Make coveralls dependent on the TOXENV variable being "cover"
| YAML | apache-2.0 | mrb/letsencrypt,sjerdo/letsencrypt,lbeltrame/letsencrypt,DavidGarciaCat/letsencrypt,jmaurice/letsencrypt,fmarier/letsencrypt,BKreisel/letsencrypt,luorenjin/letsencrypt,vcavallo/letsencrypt,kuba/letsencrypt,goofwear/letsencrypt,mrb/letsencrypt,BillKeenan/lets-encrypt-preview,g1franc/lets-encrypt-preview,skynet/letsencrypt,ghyde/letsencrypt,rugk/letsencrypt,BKreisel/letsencrypt,Bachmann1234/letsencrypt,letsencrypt/letsencrypt,rlustin/letsencrypt,skynet/letsencrypt,Sveder/letsencrypt,riseofthetigers/letsencrypt,rugk/letsencrypt,piru/letsencrypt,jtl999/certbot,bsmr-misc-forks/letsencrypt,stewnorriss/letsencrypt,modulexcite/letsencrypt,solidgoldbomb/letsencrypt,ahojjati/letsencrypt,jmaurice/letsencrypt,fmarier/letsencrypt,tyagi-prashant/letsencrypt,PeterMosmans/letsencrypt,brentdax/letsencrypt,twstrike/le_for_patching,twstrike/le_for_patching,VladimirTyrin/letsencrypt,lbeltrame/letsencrypt,hsduk/lets-encrypt-preview,kuba/letsencrypt,martindale/letsencrypt,beermix/letsencrypt,wteiken/letsencrypt,brentdax/letsencrypt,digideskio/lets-encrypt-preview,sjerdo/letsencrypt,deserted/letsencrypt,lmcro/letsencrypt,xgin/letsencrypt,tdfischer/lets-encrypt-preview,dietsche/letsencrypt,riseofthetigers/letsencrypt,armersong/letsencrypt,hlieberman/letsencrypt,bestwpw/letsencrypt,diracdeltas/lets-encrypt-preview,bsmr-misc-forks/letsencrypt,modulexcite/letsencrypt,Jonadabe/letsencrypt,dietsche/letsencrypt,rutsky/letsencrypt,Hasimir/letsencrypt,hsduk/lets-encrypt-preview,Jonadabe/letsencrypt,g1franc/lets-encrypt-preview,stweil/letsencrypt,ruo91/letsencrypt,sapics/letsencrypt,stewnorriss/letsencrypt,beermix/letsencrypt,bestwpw/letsencrypt,rlustin/letsencrypt,BillKeenan/lets-encrypt-preview,ruo91/letsencrypt,jsha/letsencrypt,Bachmann1234/letsencrypt,jmhodges/letsencrypt,deserted/letsencrypt,Sveder/letsencrypt,jtl999/certbot,vcavallo/letsencrypt,digideskio/lets-encrypt-preview,mitnk/letsencrypt,ahojjati/letsencrypt,letsencrypt/letsencrypt,Jadaw1n/letsencrypt,piru/letsencrypt,tyagi-prashant/letsencrypt,wteiken/letsencrypt,rutsky/letsencrypt,jmhodges/letsencrypt,jsha/letsencrypt,kevinlondon/letsencrypt,tdfischer/lets-encrypt-preview,martindale/letsencrypt,DavidGarciaCat/letsencrypt,solidgoldbomb/letsencrypt,stweil/letsencrypt,TheBoegl/letsencrypt,goofwear/letsencrypt,mitnk/letsencrypt,ghyde/letsencrypt,PeterMosmans/letsencrypt,diracdeltas/lets-encrypt-preview,kevinlondon/letsencrypt,thanatos/lets-encrypt-preview,VladimirTyrin/letsencrypt,Hasimir/letsencrypt,sapics/letsencrypt,lmcro/letsencrypt,Jadaw1n/letsencrypt,luorenjin/letsencrypt,armersong/letsencrypt,hlieberman/letsencrypt,thanatos/lets-encrypt-preview,xgin/letsencrypt,TheBoegl/letsencrypt | yaml | ## Code Before:
language: python
before_install: >
travis_retry sudo apt-get install python python-setuptools
python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev
install:
- travis_retry python setup.py dev # installs tox
- travis_retry pip install coveralls
script: travis_retry tox
after_success: coveralls
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=lint
- TOXENV=cover
notifications:
email: false
irc: "chat.freenode.net#letsencrypt"
## Instruction:
Make coveralls dependent on the TOXENV variable being "cover"
## Code After:
language: python
before_install: >
travis_retry sudo apt-get install python python-setuptools
python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev
install:
- travis_retry python setup.py dev # installs tox
- travis_retry pip install coveralls
script: travis_retry tox
after_success: '[ "$TOXENV" == "cover" ] && coveralls'
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=lint
- TOXENV=cover
notifications:
email: false
irc: "chat.freenode.net#letsencrypt"
| language: python
before_install: >
travis_retry sudo apt-get install python python-setuptools
python-virtualenv python-dev gcc swig dialog libaugeas0 libssl-dev
install:
- travis_retry python setup.py dev # installs tox
- travis_retry pip install coveralls
script: travis_retry tox
- after_success: coveralls
+ after_success: '[ "$TOXENV" == "cover" ] && coveralls'
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=lint
- TOXENV=cover
notifications:
email: false
irc: "chat.freenode.net#letsencrypt" | 2 | 0.086957 | 1 | 1 |
d12e99cc2e5e7d4240bb37ffcc658253fb166596 | app/Http/Controllers/Admin/TournamentPoolController.php | app/Http/Controllers/Admin/TournamentPoolController.php | <?php
namespace App\Http\Controllers\Admin;
use App\Pool;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TournamentPoolController extends Controller
{
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*
* @author Doran Kayoumi
*/
public function update(Request $request, $id) {
echo "coucou";
}
}
| <?php
namespace App\Http\Controllers\Admin;
use App\Pool;
use App\Contender;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TournamentPoolController extends Controller
{
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $tournament_id
* @param int $pool_id
* @return \Illuminate\Http\Response
*
* @author Doran Kayoumi
*/
public function update(Request $request, $tournament_id, $pool_id) {
// get pool, set it to finished and save changes
$pool = Pool::find($pool_id);
$pool->isFinished = 1;
$pool->save();
// find contender for the next pool with the current rank and current pool and set it with the team id
$contender = Contender::where('pool_from_id', $pool_id)->where('rank_in_pool', $request->rank_in_pool)->firstOrFail();
$contender->team_id = $request->team_id;
$contender->save();
}
}
| Set pool to finished and set contenders for next pools with team ids | Set pool to finished and set contenders for next pools with team ids
| PHP | mit | CPNV-ES/Joutes,CPNV-ES/Joutes,CPNV-ES/Joutes,CPNV-ES/Joutes | php | ## Code Before:
<?php
namespace App\Http\Controllers\Admin;
use App\Pool;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TournamentPoolController extends Controller
{
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*
* @author Doran Kayoumi
*/
public function update(Request $request, $id) {
echo "coucou";
}
}
## Instruction:
Set pool to finished and set contenders for next pools with team ids
## Code After:
<?php
namespace App\Http\Controllers\Admin;
use App\Pool;
use App\Contender;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TournamentPoolController extends Controller
{
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $tournament_id
* @param int $pool_id
* @return \Illuminate\Http\Response
*
* @author Doran Kayoumi
*/
public function update(Request $request, $tournament_id, $pool_id) {
// get pool, set it to finished and save changes
$pool = Pool::find($pool_id);
$pool->isFinished = 1;
$pool->save();
// find contender for the next pool with the current rank and current pool and set it with the team id
$contender = Contender::where('pool_from_id', $pool_id)->where('rank_in_pool', $request->rank_in_pool)->firstOrFail();
$contender->team_id = $request->team_id;
$contender->save();
}
}
| <?php
namespace App\Http\Controllers\Admin;
use App\Pool;
+ use App\Contender;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TournamentPoolController extends Controller
{
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
+ * @param int $tournament_id
- * @param int $id
+ * @param int $pool_id
? +++++
* @return \Illuminate\Http\Response
*
* @author Doran Kayoumi
*/
- public function update(Request $request, $id) {
+ public function update(Request $request, $tournament_id, $pool_id) {
? +++++++++++++++++++++
- echo "coucou";
+ // get pool, set it to finished and save changes
+ $pool = Pool::find($pool_id);
+ $pool->isFinished = 1;
+ $pool->save();
+
+ // find contender for the next pool with the current rank and current pool and set it with the team id
+ $contender = Contender::where('pool_from_id', $pool_id)->where('rank_in_pool', $request->rank_in_pool)->firstOrFail();
+ $contender->team_id = $request->team_id;
+ $contender->save();
}
} | 16 | 0.695652 | 13 | 3 |
0783fa45f2dd785513c54441cdb84f58d0b23b13 | ui/shared/web-view.js | ui/shared/web-view.js | /*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/**
* React doesn't support non-HTML attributes unless the element is a custom
* element which must have a hyphen in the tag name. This means React can't
* render most of the attributes of a <webview> so we use this <web-view> as a
* wrapper.
*/
(function() {
class WebView extends HTMLElement {
createdCallback() {
const shadow = this.createShadowRoot();
this.webview = document.createElement('webview');
for (let i = 0; i < this.attributes.length; i++) {
const attr = this.attributes[i];
this.webview.setAttribute(attr.name, attr.value);
}
shadow.appendChild(this.webview);
}
attributeChangedCallback(name, oldValue, newValue) {
if (newValue) {
this.webview.setAttribute(name, newValue);
} else {
this.webview.removeAttribute(name);
}
}
}
document.registerElement('web-view', WebView);
}());
| /*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/**
* React doesn't support non-HTML attributes unless the element is a custom
* element which must have a hyphen in the tag name. This means React can't
* render most of the attributes of a <webview> so we use this <web-view> as a
* wrapper.
*/
class WebView extends HTMLElement {
createdCallback() {
this.webview = document.createElement('webview');
for (const { name, value } of Array.from(this.attributes)) {
this.webview.setAttribute(name, value);
}
const shadow = this.createShadowRoot();
shadow.appendChild(this.webview);
}
attributeChangedCallback(name, oldValue, newValue) {
if (newValue) {
this.webview.setAttribute(name, newValue);
} else {
this.webview.removeAttribute(name);
}
}
}
document.registerElement('web-view', WebView);
| Remove useless wrapper function and cleanup WebView a bit | Remove useless wrapper function and cleanup WebView a bit
Signed-off-by: Victor Porof <7d8eebacd0931807085fa6b9af29638ed74e0886@mozilla.com>
| JavaScript | apache-2.0 | bgrins/tofino,jsantell/tofino,victorporof/tofino,mozilla/tofino,mozilla/tofino,victorporof/tofino,mozilla/tofino,jsantell/tofino,jsantell/tofino,bgrins/tofino,jsantell/tofino,bgrins/tofino,mozilla/tofino,bgrins/tofino | javascript | ## Code Before:
/*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/**
* React doesn't support non-HTML attributes unless the element is a custom
* element which must have a hyphen in the tag name. This means React can't
* render most of the attributes of a <webview> so we use this <web-view> as a
* wrapper.
*/
(function() {
class WebView extends HTMLElement {
createdCallback() {
const shadow = this.createShadowRoot();
this.webview = document.createElement('webview');
for (let i = 0; i < this.attributes.length; i++) {
const attr = this.attributes[i];
this.webview.setAttribute(attr.name, attr.value);
}
shadow.appendChild(this.webview);
}
attributeChangedCallback(name, oldValue, newValue) {
if (newValue) {
this.webview.setAttribute(name, newValue);
} else {
this.webview.removeAttribute(name);
}
}
}
document.registerElement('web-view', WebView);
}());
## Instruction:
Remove useless wrapper function and cleanup WebView a bit
Signed-off-by: Victor Porof <7d8eebacd0931807085fa6b9af29638ed74e0886@mozilla.com>
## Code After:
/*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/**
* React doesn't support non-HTML attributes unless the element is a custom
* element which must have a hyphen in the tag name. This means React can't
* render most of the attributes of a <webview> so we use this <web-view> as a
* wrapper.
*/
class WebView extends HTMLElement {
createdCallback() {
this.webview = document.createElement('webview');
for (const { name, value } of Array.from(this.attributes)) {
this.webview.setAttribute(name, value);
}
const shadow = this.createShadowRoot();
shadow.appendChild(this.webview);
}
attributeChangedCallback(name, oldValue, newValue) {
if (newValue) {
this.webview.setAttribute(name, newValue);
} else {
this.webview.removeAttribute(name);
}
}
}
document.registerElement('web-view', WebView);
| /*
Copyright 2016 Mozilla
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
/**
* React doesn't support non-HTML attributes unless the element is a custom
* element which must have a hyphen in the tag name. This means React can't
* render most of the attributes of a <webview> so we use this <web-view> as a
* wrapper.
*/
- (function() {
- class WebView extends HTMLElement {
? --
+ class WebView extends HTMLElement {
- createdCallback() {
? --
+ createdCallback() {
- const shadow = this.createShadowRoot();
+ this.webview = document.createElement('webview');
+ for (const { name, value } of Array.from(this.attributes)) {
- this.webview = document.createElement('webview');
- for (let i = 0; i < this.attributes.length; i++) {
- const attr = this.attributes[i];
- this.webview.setAttribute(attr.name, attr.value);
? -- ----- -----
+ this.webview.setAttribute(name, value);
- }
-
- shadow.appendChild(this.webview);
}
+ const shadow = this.createShadowRoot();
+ shadow.appendChild(this.webview);
+ }
+
- attributeChangedCallback(name, oldValue, newValue) {
? --
+ attributeChangedCallback(name, oldValue, newValue) {
- if (newValue) {
? --
+ if (newValue) {
- this.webview.setAttribute(name, newValue);
? --
+ this.webview.setAttribute(name, newValue);
- } else {
? --
+ } else {
- this.webview.removeAttribute(name);
? --
+ this.webview.removeAttribute(name);
- }
}
}
+ }
- document.registerElement('web-view', WebView);
? --
+ document.registerElement('web-view', WebView);
- }()); | 35 | 0.813953 | 16 | 19 |
1fe432605860d08dc77f8f8cae76ea0a3110117f | src/preparecomponents.bat | src/preparecomponents.bat | mkdir ..\..\..\workingdir
mkdir ..\..\..\workingdir\components
xcopy ..\..\..\das-collectionearnings-opa-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-collectionearnings-datalock ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerpayments-calculator ..\..\..\workingdir\components /E | mkdir ..\..\..\workingdir
mkdir ..\..\..\workingdir\components
xcopy ..\..\..\das-collectionearnings-opa-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-collectionearnings-datalock ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerpayments-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-payment-reference-commitments ..\..\..\workingdir\components /E
xcopy ..\..\..\das-payment-reference-accounts ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerevents-components ..\..\..\workingdir\components /E | Add missing components to prepare script | Add missing components to prepare script
| Batchfile | mit | SkillsFundingAgency/das-paymentsacceptancetesting | batchfile | ## Code Before:
mkdir ..\..\..\workingdir
mkdir ..\..\..\workingdir\components
xcopy ..\..\..\das-collectionearnings-opa-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-collectionearnings-datalock ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerpayments-calculator ..\..\..\workingdir\components /E
## Instruction:
Add missing components to prepare script
## Code After:
mkdir ..\..\..\workingdir
mkdir ..\..\..\workingdir\components
xcopy ..\..\..\das-collectionearnings-opa-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-collectionearnings-datalock ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerpayments-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-payment-reference-commitments ..\..\..\workingdir\components /E
xcopy ..\..\..\das-payment-reference-accounts ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerevents-components ..\..\..\workingdir\components /E | mkdir ..\..\..\workingdir
mkdir ..\..\..\workingdir\components
xcopy ..\..\..\das-collectionearnings-opa-calculator ..\..\..\workingdir\components /E
xcopy ..\..\..\das-collectionearnings-datalock ..\..\..\workingdir\components /E
xcopy ..\..\..\das-providerpayments-calculator ..\..\..\workingdir\components /E
+
+ xcopy ..\..\..\das-payment-reference-commitments ..\..\..\workingdir\components /E
+ xcopy ..\..\..\das-payment-reference-accounts ..\..\..\workingdir\components /E
+ xcopy ..\..\..\das-providerevents-components ..\..\..\workingdir\components /E | 4 | 0.666667 | 4 | 0 |
73ce0d33ceca69c96928305cd40a25cfae8131c9 | util/gitinstall.sh | util/gitinstall.sh |
repo=~/bw-git/
cd $repo
install() {
git clone git@github.com:Bedework/$1.git
cd $1/
mvn -q clean package
mvn -q install
cd ..
}
#install "bw-ws"
#install "bw-util"
#install "bw-access"
#install "bw-synch"
#install "bw-timezone-server"
#install "bw-webdav"
install "bw-caldav"
#install "bw-carddav"
#install "bw-self-registration"
#install "bw-calendar-engine"
#install "bw-calendar-client" |
repo=~/bw-git/
cd $repo
install() {
git clone git@github.com:Bedework/$1.git
cd $1/
mvn -q clean package
mvn -q install
cd ..
}
#install "bw-ws"
#install "bw-util"
#install "bw-access"
#install "bw-synch"
#install "bw-timezone-server"
#install "bw-webdav"
#install "bw-caldav"
#install "bw-carddav"
#install "bw-self-registration"
#install "bw-calendar-engine"
#install "bw-calendar-client"
install "bw-event-registration"
| Fix eventreg for hibernate interface issue. | Fix eventreg for hibernate interface issue.
Also eventreg fixes for new bw-util.
Add bw-util iml files
| Shell | apache-2.0 | Bedework/bw-classic,Bedework/bw-classic,Bedework/bw-classic,Bedework/bw-classic | shell | ## Code Before:
repo=~/bw-git/
cd $repo
install() {
git clone git@github.com:Bedework/$1.git
cd $1/
mvn -q clean package
mvn -q install
cd ..
}
#install "bw-ws"
#install "bw-util"
#install "bw-access"
#install "bw-synch"
#install "bw-timezone-server"
#install "bw-webdav"
install "bw-caldav"
#install "bw-carddav"
#install "bw-self-registration"
#install "bw-calendar-engine"
#install "bw-calendar-client"
## Instruction:
Fix eventreg for hibernate interface issue.
Also eventreg fixes for new bw-util.
Add bw-util iml files
## Code After:
repo=~/bw-git/
cd $repo
install() {
git clone git@github.com:Bedework/$1.git
cd $1/
mvn -q clean package
mvn -q install
cd ..
}
#install "bw-ws"
#install "bw-util"
#install "bw-access"
#install "bw-synch"
#install "bw-timezone-server"
#install "bw-webdav"
#install "bw-caldav"
#install "bw-carddav"
#install "bw-self-registration"
#install "bw-calendar-engine"
#install "bw-calendar-client"
install "bw-event-registration"
|
repo=~/bw-git/
cd $repo
install() {
git clone git@github.com:Bedework/$1.git
cd $1/
- mvn -q clean package
? -
+ mvn -q clean package
mvn -q install
cd ..
}
#install "bw-ws"
#install "bw-util"
#install "bw-access"
#install "bw-synch"
#install "bw-timezone-server"
#install "bw-webdav"
- install "bw-caldav"
+ #install "bw-caldav"
? +
#install "bw-carddav"
#install "bw-self-registration"
#install "bw-calendar-engine"
#install "bw-calendar-client"
+ install "bw-event-registration" | 5 | 0.208333 | 3 | 2 |
e46d766aaf90b5eaf79cf40f2e57604a9ade12e9 | test/nogui.go | test/nogui.go | package test
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
"github.com/howeyc/gopass"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-events.WaitForPlaylists()
playlist := playlists["Ramones"]
playlist.Wait()
track := playlist.Track(3).Track()
track.Wait()
events.ToPlay <- track
println(track.Name())
<-events.WaitForStatus()
<-events.NextPlay
}
func credentials() (*string, *[]byte) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.Trim(username, " \n\r")
fmt.Print("Password: ")
pass := gopass.GetPasswd()
return &username, &pass
}
| package test
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
ui "github.com/fabiofalci/sconsify/ui"
"github.com/howeyc/gopass"
sp "github.com/op/go-libspotify/spotify"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-events.WaitForPlaylists()
allTracks := getAllTracks(playlists).Contents()
for {
index := rand.Intn(len(allTracks))
track := allTracks[index]
events.ToPlay <- track
println(<-events.WaitForStatus())
<-events.NextPlay
}
}
func getAllTracks(playlists map[string]*sp.Playlist) *ui.Queue {
queue := ui.InitQueue()
for _, playlist := range playlists {
playlist.Wait()
for i := 0; i < playlist.Tracks(); i++ {
track := playlist.Track(i).Track()
track.Wait()
queue.Add(track)
}
}
return queue
}
func credentials() (*string, *[]byte) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.Trim(username, " \n\r")
fmt.Print("Password: ")
pass := gopass.GetPasswd()
return &username, &pass
}
| Make no gui test random all tracks | Make no gui test random all tracks
| Go | apache-2.0 | fabiofalci/sconsify | go | ## Code Before:
package test
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
"github.com/howeyc/gopass"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-events.WaitForPlaylists()
playlist := playlists["Ramones"]
playlist.Wait()
track := playlist.Track(3).Track()
track.Wait()
events.ToPlay <- track
println(track.Name())
<-events.WaitForStatus()
<-events.NextPlay
}
func credentials() (*string, *[]byte) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.Trim(username, " \n\r")
fmt.Print("Password: ")
pass := gopass.GetPasswd()
return &username, &pass
}
## Instruction:
Make no gui test random all tracks
## Code After:
package test
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
ui "github.com/fabiofalci/sconsify/ui"
"github.com/howeyc/gopass"
sp "github.com/op/go-libspotify/spotify"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-events.WaitForPlaylists()
allTracks := getAllTracks(playlists).Contents()
for {
index := rand.Intn(len(allTracks))
track := allTracks[index]
events.ToPlay <- track
println(<-events.WaitForStatus())
<-events.NextPlay
}
}
func getAllTracks(playlists map[string]*sp.Playlist) *ui.Queue {
queue := ui.InitQueue()
for _, playlist := range playlists {
playlist.Wait()
for i := 0; i < playlist.Tracks(); i++ {
track := playlist.Track(i).Track()
track.Wait()
queue.Add(track)
}
}
return queue
}
func credentials() (*string, *[]byte) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.Trim(username, " \n\r")
fmt.Print("Password: ")
pass := gopass.GetPasswd()
return &username, &pass
}
| package test
import (
"bufio"
"fmt"
+ "math/rand"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
+ ui "github.com/fabiofalci/sconsify/ui"
"github.com/howeyc/gopass"
+ sp "github.com/op/go-libspotify/spotify"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-events.WaitForPlaylists()
+ allTracks := getAllTracks(playlists).Contents()
- playlist := playlists["Ramones"]
- playlist.Wait()
- track := playlist.Track(3).Track()
- track.Wait()
- events.ToPlay <- track
+ for {
+ index := rand.Intn(len(allTracks))
+ track := allTracks[index]
- println(track.Name())
+ events.ToPlay <- track
+
- <-events.WaitForStatus()
+ println(<-events.WaitForStatus())
? +++++++++ +
- <-events.NextPlay
+ <-events.NextPlay
? +
+ }
+ }
+
+ func getAllTracks(playlists map[string]*sp.Playlist) *ui.Queue {
+ queue := ui.InitQueue()
+
+ for _, playlist := range playlists {
+ playlist.Wait()
+ for i := 0; i < playlist.Tracks(); i++ {
+ track := playlist.Track(i).Track()
+ track.Wait()
+ queue.Add(track)
+ }
+ }
+
+ return queue
}
func credentials() (*string, *[]byte) {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.Trim(username, " \n\r")
fmt.Print("Password: ")
pass := gopass.GetPasswd()
return &username, &pass
} | 35 | 0.853659 | 27 | 8 |
bfbba4eaa2862f921df28c2f56ba245b3532de76 | src/sweets.pm | src/sweets.pm |
use strict;
use v5.18;
use warnings;
no warnings 'experimental';
use utf8;
binmode STDOUT, ':utf8';
package sweets;
use LWP;
use Encode qw/decode/;
my $ua = LWP::UserAgent->new();
my $BASH = "http://bash.im/random";
sub fetch_bash_joke {
my $response = $ua->get($BASH);
return undef unless ($response->is_success && $response->content_type eq 'text/html');
my $bash = decode("Windows-1251", $response->content);
my $quote = $1 if $bash =~ m/<div class="quote">.*?<div class="text">(.*?)<\/div>/s;
$quote =~ s/<br.*?>/\n/g;
$quote =~ s/</</g;
$quote =~ s/>/>/g;
return $quote;
}
1;
|
use strict;
use v5.18;
use warnings;
no warnings 'experimental';
use utf8;
binmode STDOUT, ':utf8';
package sweets;
use LWP;
use Encode qw/decode/;
use HTML::Entities;
my $ua = LWP::UserAgent->new();
my $BASH = "http://bash.im/random";
sub fetch_bash_joke {
my $response = $ua->get($BASH);
return undef unless ($response->is_success && $response->content_type eq 'text/html');
my $bash = decode("Windows-1251", $response->content);
my $quote = $1 if $bash =~ m/<div class="quote">.*?<div class="text">(.*?)<\/div>/s;
$quote =~ s/<br.*?>/\n/g;
return decode_entities($quote);
}
1;
| Fix html entities - characters codes | Fix html entities - characters codes
| Perl | bsd-2-clause | tune-it/jplbot,tune-it/jplbot,tune-it/jplbot | perl | ## Code Before:
use strict;
use v5.18;
use warnings;
no warnings 'experimental';
use utf8;
binmode STDOUT, ':utf8';
package sweets;
use LWP;
use Encode qw/decode/;
my $ua = LWP::UserAgent->new();
my $BASH = "http://bash.im/random";
sub fetch_bash_joke {
my $response = $ua->get($BASH);
return undef unless ($response->is_success && $response->content_type eq 'text/html');
my $bash = decode("Windows-1251", $response->content);
my $quote = $1 if $bash =~ m/<div class="quote">.*?<div class="text">(.*?)<\/div>/s;
$quote =~ s/<br.*?>/\n/g;
$quote =~ s/</</g;
$quote =~ s/>/>/g;
return $quote;
}
1;
## Instruction:
Fix html entities - characters codes
## Code After:
use strict;
use v5.18;
use warnings;
no warnings 'experimental';
use utf8;
binmode STDOUT, ':utf8';
package sweets;
use LWP;
use Encode qw/decode/;
use HTML::Entities;
my $ua = LWP::UserAgent->new();
my $BASH = "http://bash.im/random";
sub fetch_bash_joke {
my $response = $ua->get($BASH);
return undef unless ($response->is_success && $response->content_type eq 'text/html');
my $bash = decode("Windows-1251", $response->content);
my $quote = $1 if $bash =~ m/<div class="quote">.*?<div class="text">(.*?)<\/div>/s;
$quote =~ s/<br.*?>/\n/g;
return decode_entities($quote);
}
1;
|
use strict;
use v5.18;
use warnings;
no warnings 'experimental';
use utf8;
binmode STDOUT, ':utf8';
package sweets;
use LWP;
use Encode qw/decode/;
+ use HTML::Entities;
my $ua = LWP::UserAgent->new();
my $BASH = "http://bash.im/random";
sub fetch_bash_joke {
my $response = $ua->get($BASH);
return undef unless ($response->is_success && $response->content_type eq 'text/html');
my $bash = decode("Windows-1251", $response->content);
my $quote = $1 if $bash =~ m/<div class="quote">.*?<div class="text">(.*?)<\/div>/s;
$quote =~ s/<br.*?>/\n/g;
- $quote =~ s/</</g;
- $quote =~ s/>/>/g;
- return $quote;
+ return decode_entities($quote);
}
1; | 5 | 0.151515 | 2 | 3 |
43766fbfa3f64a53801905879aaf05035d2dded8 | cosmos-api/app/views/admin.scala.html | cosmos-api/app/views/admin.scala.html | @(underMaintenance: Boolean, tabs: Seq[views.NavTab])(implicit request: RequestHeader)
<!--
Telefónica Digital - Product Development and Innovation
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
All rights reserved.
-->
@main("Cosmos administration") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/profile.css")">
} {
@navigation("admin", tabs)
<h1 class="page-title">Cosmos administration</h1>
<h2>Maintenance mode</h2>
<p>Maintenance status: <strong>@underMaintenance</strong></p>
}
| @(underMaintenance: Boolean, tabs: Seq[views.NavTab])(implicit request: RequestHeader)
<!--
Telefónica Digital - Product Development and Innovation
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
All rights reserved.
-->
@main("Cosmos administration") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/profile.css")">
} {
@navigation("admin", tabs)
<h1 class="page-title">Cosmos administration</h1>
<h2>Maintenance mode</h2>
<p>Maintenance mode:
@if(underMaintenance) {
<strong>ON</strong>
<input id="leave-maintenance" type="submit" value="Leave maintenance mode"/>
} else {
<strong>OFF</strong>
<input id="enter-maintenance" type="submit" value="Enter maintenance mode"/>
}
</p>
}
| Add maintenance mode status at the admin page | Add maintenance mode status at the admin page
| HTML | apache-2.0 | telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform | html | ## Code Before:
@(underMaintenance: Boolean, tabs: Seq[views.NavTab])(implicit request: RequestHeader)
<!--
Telefónica Digital - Product Development and Innovation
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
All rights reserved.
-->
@main("Cosmos administration") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/profile.css")">
} {
@navigation("admin", tabs)
<h1 class="page-title">Cosmos administration</h1>
<h2>Maintenance mode</h2>
<p>Maintenance status: <strong>@underMaintenance</strong></p>
}
## Instruction:
Add maintenance mode status at the admin page
## Code After:
@(underMaintenance: Boolean, tabs: Seq[views.NavTab])(implicit request: RequestHeader)
<!--
Telefónica Digital - Product Development and Innovation
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
All rights reserved.
-->
@main("Cosmos administration") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/profile.css")">
} {
@navigation("admin", tabs)
<h1 class="page-title">Cosmos administration</h1>
<h2>Maintenance mode</h2>
<p>Maintenance mode:
@if(underMaintenance) {
<strong>ON</strong>
<input id="leave-maintenance" type="submit" value="Leave maintenance mode"/>
} else {
<strong>OFF</strong>
<input id="enter-maintenance" type="submit" value="Enter maintenance mode"/>
}
</p>
}
| @(underMaintenance: Boolean, tabs: Seq[views.NavTab])(implicit request: RequestHeader)
<!--
Telefónica Digital - Product Development and Innovation
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
All rights reserved.
-->
@main("Cosmos administration") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/profile.css")">
} {
@navigation("admin", tabs)
<h1 class="page-title">Cosmos administration</h1>
<h2>Maintenance mode</h2>
- <p>Maintenance status: <strong>@underMaintenance</strong></p>
+ <p>Maintenance mode:
+ @if(underMaintenance) {
+ <strong>ON</strong>
+ <input id="leave-maintenance" type="submit" value="Leave maintenance mode"/>
+ } else {
+ <strong>OFF</strong>
+ <input id="enter-maintenance" type="submit" value="Enter maintenance mode"/>
+ }
+ </p>
} | 10 | 0.454545 | 9 | 1 |
30748a2d085c60a75c1ffc2049978a395cc77a65 | spec/database_mysql.yml | spec/database_mysql.yml | production:
adapter: mysql2
database: redmine
host: localhost
username: root
encoding: utf8
development:
adapter: mysql2
database: redmine
host: localhost
username: root
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: redmine_test
host: localhost
username: root
encoding: utf8
| production:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
development:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
test:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
| Use env var to get database settings | Use env var to get database settings
| YAML | mit | jbox-web/redmine_jenkins,jbox-web/redmine_jenkins,jbox-web/redmine_jenkins | yaml | ## Code Before:
production:
adapter: mysql2
database: redmine
host: localhost
username: root
encoding: utf8
development:
adapter: mysql2
database: redmine
host: localhost
username: root
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: redmine_test
host: localhost
username: root
encoding: utf8
## Instruction:
Use env var to get database settings
## Code After:
production:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
development:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
test:
adapter: mysql2
database: <%= ENV['MYSQL_DATABASE'] %>
host: <%= ENV['MYSQL_HOST'] %>
port: <%= ENV['MYSQL_PORT'] %>
username: <%= ENV['MYSQL_USER'] %>
password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
| production:
adapter: mysql2
- database: redmine
- host: localhost
- username: root
+ database: <%= ENV['MYSQL_DATABASE'] %>
+ host: <%= ENV['MYSQL_HOST'] %>
+ port: <%= ENV['MYSQL_PORT'] %>
+ username: <%= ENV['MYSQL_USER'] %>
+ password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
development:
adapter: mysql2
- database: redmine
- host: localhost
- username: root
+ database: <%= ENV['MYSQL_DATABASE'] %>
+ host: <%= ENV['MYSQL_HOST'] %>
+ port: <%= ENV['MYSQL_PORT'] %>
+ username: <%= ENV['MYSQL_USER'] %>
+ password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8
- # Warning: The database defined as "test" will be erased and
- # re-generated from your development database when you run "rake".
- # Do not set this db to the same as development or production.
test:
adapter: mysql2
- database: redmine_test
- host: localhost
- username: root
+ database: <%= ENV['MYSQL_DATABASE'] %>
+ host: <%= ENV['MYSQL_HOST'] %>
+ port: <%= ENV['MYSQL_PORT'] %>
+ username: <%= ENV['MYSQL_USER'] %>
+ password: <%= ENV['MYSQL_PASSWORD'] %>
encoding: utf8 | 27 | 1.173913 | 15 | 12 |
87a4c494c18039a296775dab8acf910f83fb59b8 | djangoappengine/utils.py | djangoappengine/utils.py | from google.appengine.api import apiproxy_stub_map
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')
| from google.appengine.api import apiproxy_stub_map
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
try:
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
except ValueError:
# https://bitbucket.org/wkornewald/django-nonrel/issue/13/managepy-test-broken-with-gae-sdk-16
appconfig, unused, from_cache = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')
| Make prosthetic-runner work with GAE SDK 1.6 | Make prosthetic-runner work with GAE SDK 1.6
| Python | mit | philterphactory/prosthetic-runner,philterphactory/prosthetic-runner,philterphactory/prosthetic-runner | python | ## Code Before:
from google.appengine.api import apiproxy_stub_map
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')
## Instruction:
Make prosthetic-runner work with GAE SDK 1.6
## Code After:
from google.appengine.api import apiproxy_stub_map
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
try:
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
except ValueError:
# https://bitbucket.org/wkornewald/django-nonrel/issue/13/managepy-test-broken-with-gae-sdk-16
appconfig, unused, from_cache = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')
| from google.appengine.api import apiproxy_stub_map
import os
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from .boot import PROJECT_DIR
+ try:
- appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
+ appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
? ++++
+ except ValueError:
+ # https://bitbucket.org/wkornewald/django-nonrel/issue/13/managepy-test-broken-with-gae-sdk-16
+ appconfig, unused, from_cache = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError, e:
raise Exception('Could not get appid. Is your app.yaml file missing? '
'Error was: %s' % e)
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel') | 6 | 0.315789 | 5 | 1 |
27b504fc60f76b4fce52b2ffdf61a3974ae9600c | src/Services/Terminal/TerminalParser.js | src/Services/Terminal/TerminalParser.js | import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
const errorHandler = (rsp) => {
throw new TerminalRuntimeError(rsp);
};
const createSession = (rsp) => {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new TerminalParsingError.TerminalSessionTokenMissing();
}
return rsp[`common_${this.uapi_version}:HostToken`]._;
};
const terminalRequest = (rsp) => {
if (
!rsp['terminal:TerminalCommandResponse'] ||
!rsp['terminal:TerminalCommandResponse']['terminal:Text']
) {
throw new TerminalParsingError.TerminalResponseMissing();
}
return rsp['terminal:TerminalCommandResponse']['terminal:Text'];
};
const closeSession = (rsp) => {
if (
!rsp[`common_${this.uapi_version}:ResponseMessage`] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._ ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._.match(/Terminal End Session Successful/i)
) {
throw new TerminalRuntimeError.TerminalCloseSessionFailed();
}
return true;
};
module.exports = {
TERMINAL_ERROR: errorHandler,
CREATE_SESSION: createSession,
TERMINAL_REQUEST: terminalRequest,
CLOSE_SESSION: closeSession,
};
| import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
function errorHandler(rsp) {
throw new TerminalRuntimeError(rsp);
}
function createSession(rsp) {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new TerminalParsingError.TerminalSessionTokenMissing();
}
return rsp[`common_${this.uapi_version}:HostToken`]._;
}
function terminalRequest(rsp) {
if (
!rsp['terminal:TerminalCommandResponse'] ||
!rsp['terminal:TerminalCommandResponse']['terminal:Text']
) {
throw new TerminalParsingError.TerminalResponseMissing();
}
return rsp['terminal:TerminalCommandResponse']['terminal:Text'];
}
function closeSession(rsp) {
if (
!rsp[`common_${this.uapi_version}:ResponseMessage`] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._ ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._.match(/Terminal End Session Successful/i)
) {
throw new TerminalRuntimeError.TerminalCloseSessionFailed();
}
return true;
}
module.exports = {
TERMINAL_ERROR: errorHandler,
CREATE_SESSION: createSession,
TERMINAL_REQUEST: terminalRequest,
CLOSE_SESSION: closeSession,
};
| Fix of the terminal parser functions passed without context | Fix of the terminal parser functions passed without context
| JavaScript | mit | Travelport-Ukraine/uapi-json | javascript | ## Code Before:
import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
const errorHandler = (rsp) => {
throw new TerminalRuntimeError(rsp);
};
const createSession = (rsp) => {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new TerminalParsingError.TerminalSessionTokenMissing();
}
return rsp[`common_${this.uapi_version}:HostToken`]._;
};
const terminalRequest = (rsp) => {
if (
!rsp['terminal:TerminalCommandResponse'] ||
!rsp['terminal:TerminalCommandResponse']['terminal:Text']
) {
throw new TerminalParsingError.TerminalResponseMissing();
}
return rsp['terminal:TerminalCommandResponse']['terminal:Text'];
};
const closeSession = (rsp) => {
if (
!rsp[`common_${this.uapi_version}:ResponseMessage`] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._ ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._.match(/Terminal End Session Successful/i)
) {
throw new TerminalRuntimeError.TerminalCloseSessionFailed();
}
return true;
};
module.exports = {
TERMINAL_ERROR: errorHandler,
CREATE_SESSION: createSession,
TERMINAL_REQUEST: terminalRequest,
CLOSE_SESSION: closeSession,
};
## Instruction:
Fix of the terminal parser functions passed without context
## Code After:
import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
function errorHandler(rsp) {
throw new TerminalRuntimeError(rsp);
}
function createSession(rsp) {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new TerminalParsingError.TerminalSessionTokenMissing();
}
return rsp[`common_${this.uapi_version}:HostToken`]._;
}
function terminalRequest(rsp) {
if (
!rsp['terminal:TerminalCommandResponse'] ||
!rsp['terminal:TerminalCommandResponse']['terminal:Text']
) {
throw new TerminalParsingError.TerminalResponseMissing();
}
return rsp['terminal:TerminalCommandResponse']['terminal:Text'];
}
function closeSession(rsp) {
if (
!rsp[`common_${this.uapi_version}:ResponseMessage`] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._ ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._.match(/Terminal End Session Successful/i)
) {
throw new TerminalRuntimeError.TerminalCloseSessionFailed();
}
return true;
}
module.exports = {
TERMINAL_ERROR: errorHandler,
CREATE_SESSION: createSession,
TERMINAL_REQUEST: terminalRequest,
CLOSE_SESSION: closeSession,
};
| import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
- const errorHandler = (rsp) => {
? -- --- ---
+ function errorHandler(rsp) {
? +++ ++
throw new TerminalRuntimeError(rsp);
- };
+ }
- const createSession = (rsp) => {
? -- --- ---
+ function createSession(rsp) {
? +++ ++
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new TerminalParsingError.TerminalSessionTokenMissing();
}
return rsp[`common_${this.uapi_version}:HostToken`]._;
- };
+ }
- const terminalRequest = (rsp) => {
? -- --- ---
+ function terminalRequest(rsp) {
? +++ ++
if (
!rsp['terminal:TerminalCommandResponse'] ||
!rsp['terminal:TerminalCommandResponse']['terminal:Text']
) {
throw new TerminalParsingError.TerminalResponseMissing();
}
return rsp['terminal:TerminalCommandResponse']['terminal:Text'];
- };
+ }
- const closeSession = (rsp) => {
? -- --- ---
+ function closeSession(rsp) {
? +++ ++
if (
!rsp[`common_${this.uapi_version}:ResponseMessage`] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0] ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._ ||
!rsp[`common_${this.uapi_version}:ResponseMessage`][0]._.match(/Terminal End Session Successful/i)
) {
throw new TerminalRuntimeError.TerminalCloseSessionFailed();
}
return true;
- };
+ }
module.exports = {
TERMINAL_ERROR: errorHandler,
CREATE_SESSION: createSession,
TERMINAL_REQUEST: terminalRequest,
CLOSE_SESSION: closeSession,
}; | 16 | 0.340426 | 8 | 8 |
e454d5f92e4a546bffb76f4f71c6f05fd6ad5b7e | app/views/search-menu.html | app/views/search-menu.html | <div ng-controller="SearchMenuCtrl">
<!-- Menu -->
<nav class="navbar navbar-inverse" role="navigation" ng-keypress="{esc: 'onEsk($event)'}">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" ng-click="goBack()">
<i class="fa fa-arrow-left"></i>
<span class="hidden-xs">
{{'BACK' | translate }}
</span>
</a>
<form class="navbar-form navbar-left" ng-submit="search()">
<!-- Add form control horisontal size <div class="col-xs-4"> -->
<input id="searchField" type="text" class="search-input" ng-keypress="onEsk($event)" placeholder="{{'SEARCH' | translate }}" ng-change="search()" ng-model="searchTerm">
<button type="button" class="btn btn-warning" value="{{'SEARCH' | translate }}" ng-click="search()">
<span class="visible-xs"><span class="glyphicon glyphicon-search"></span></span>
<span class="hidden-xs">{{'SEARCH' | translate }}</span>
</button>
</form>
</div>
</div>
</nav>
</div>
| <div ng-controller="SearchMenuCtrl">
<!-- Menu -->
<nav class="navbar navbar-inverse" role="navigation" ng-keypress="{esc: 'onEsk($event)'}">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#" ng-click="goBack()">
<i class="fa fa-arrow-left"></i>
<span class="hidden-xs">
{{'BACK' | translate }}
</span>
</a>
<form class="navbar-form navbar-left" ng-submit="search()">
<!-- Add form control horisontal size <div class="col-xs-4"> -->
<input id="searchField" type="text" class="search-input" ng-keypress="onEsk($event)" placeholder="{{'SEARCH' | translate }}" ng-change="search()" ng-model="searchTerm">
<button type="button" class="btn btn-warning" value="{{'SEARCH' | translate }}" ng-click="search()">
<span class="visible-xs"><span class="glyphicon glyphicon-search"></span></span>
<span class="hidden-xs">{{'SEARCH' | translate }}</span>
</button>
</form>
</div>
</div>
</nav>
</div>
| Remove the menu button of the mobile search toolbar | Remove the menu button of the mobile search toolbar
| HTML | mit | mkruneva/emibg,mkruneva/emibg,luchesar/emibg,luchesar/emibg | html | ## Code Before:
<div ng-controller="SearchMenuCtrl">
<!-- Menu -->
<nav class="navbar navbar-inverse" role="navigation" ng-keypress="{esc: 'onEsk($event)'}">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" ng-click="goBack()">
<i class="fa fa-arrow-left"></i>
<span class="hidden-xs">
{{'BACK' | translate }}
</span>
</a>
<form class="navbar-form navbar-left" ng-submit="search()">
<!-- Add form control horisontal size <div class="col-xs-4"> -->
<input id="searchField" type="text" class="search-input" ng-keypress="onEsk($event)" placeholder="{{'SEARCH' | translate }}" ng-change="search()" ng-model="searchTerm">
<button type="button" class="btn btn-warning" value="{{'SEARCH' | translate }}" ng-click="search()">
<span class="visible-xs"><span class="glyphicon glyphicon-search"></span></span>
<span class="hidden-xs">{{'SEARCH' | translate }}</span>
</button>
</form>
</div>
</div>
</nav>
</div>
## Instruction:
Remove the menu button of the mobile search toolbar
## Code After:
<div ng-controller="SearchMenuCtrl">
<!-- Menu -->
<nav class="navbar navbar-inverse" role="navigation" ng-keypress="{esc: 'onEsk($event)'}">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#" ng-click="goBack()">
<i class="fa fa-arrow-left"></i>
<span class="hidden-xs">
{{'BACK' | translate }}
</span>
</a>
<form class="navbar-form navbar-left" ng-submit="search()">
<!-- Add form control horisontal size <div class="col-xs-4"> -->
<input id="searchField" type="text" class="search-input" ng-keypress="onEsk($event)" placeholder="{{'SEARCH' | translate }}" ng-change="search()" ng-model="searchTerm">
<button type="button" class="btn btn-warning" value="{{'SEARCH' | translate }}" ng-click="search()">
<span class="visible-xs"><span class="glyphicon glyphicon-search"></span></span>
<span class="hidden-xs">{{'SEARCH' | translate }}</span>
</button>
</form>
</div>
</div>
</nav>
</div>
| <div ng-controller="SearchMenuCtrl">
<!-- Menu -->
<nav class="navbar navbar-inverse" role="navigation" ng-keypress="{esc: 'onEsk($event)'}">
<div class="container-fluid">
<div class="navbar-header">
- <button type="button" class="navbar-toggle">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
<a class="navbar-brand" href="#" ng-click="goBack()">
<i class="fa fa-arrow-left"></i>
<span class="hidden-xs">
{{'BACK' | translate }}
</span>
</a>
<form class="navbar-form navbar-left" ng-submit="search()">
<!-- Add form control horisontal size <div class="col-xs-4"> -->
<input id="searchField" type="text" class="search-input" ng-keypress="onEsk($event)" placeholder="{{'SEARCH' | translate }}" ng-change="search()" ng-model="searchTerm">
<button type="button" class="btn btn-warning" value="{{'SEARCH' | translate }}" ng-click="search()">
<span class="visible-xs"><span class="glyphicon glyphicon-search"></span></span>
<span class="hidden-xs">{{'SEARCH' | translate }}</span>
</button>
</form>
</div>
</div>
</nav>
</div> | 6 | 0.2 | 0 | 6 |
2feb53f71a24bee105e9d6571ad76b6d17e494df | composer.json | composer.json | {
"require": {
"corneltek/pux": "~1.5",
"swiftmailer/swiftmailer": "^5.4",
"twig/twig": "^1.18"
},
"require-dev": {
"fzaninotto/faker": "^1.5",
"codeception/codeception": "^2.0",
"phpunit/phpunit": "^4.6"
},
"autoload": {
"psr-4": {
"Gazzete\\": "app/"
}
},
"scripts": {
"post-install-cmd": [
"bower install"
],
"post-update-cmd": [
"bower install"
]
}
}
| {
"require": {
"corneltek/pux": "~1.5",
"swiftmailer/swiftmailer": "^5.4",
"twig/twig": "^1.18",
"fzaninotto/faker": "^1.5"
},
"require-dev": {
"codeception/codeception": "^2.0",
"phpunit/phpunit": "^4.6"
},
"autoload": {
"psr-4": {
"Gazzete\\": "app/"
}
},
"scripts": {
"post-install-cmd": [
"bower install"
],
"post-update-cmd": [
"bower install"
]
}
}
| Use Faker library for production server.: | Use Faker library for production server.:
| JSON | mit | Hub-IT/abandoned-gazzete,Hub-IT/abandoned-gazzete | json | ## Code Before:
{
"require": {
"corneltek/pux": "~1.5",
"swiftmailer/swiftmailer": "^5.4",
"twig/twig": "^1.18"
},
"require-dev": {
"fzaninotto/faker": "^1.5",
"codeception/codeception": "^2.0",
"phpunit/phpunit": "^4.6"
},
"autoload": {
"psr-4": {
"Gazzete\\": "app/"
}
},
"scripts": {
"post-install-cmd": [
"bower install"
],
"post-update-cmd": [
"bower install"
]
}
}
## Instruction:
Use Faker library for production server.:
## Code After:
{
"require": {
"corneltek/pux": "~1.5",
"swiftmailer/swiftmailer": "^5.4",
"twig/twig": "^1.18",
"fzaninotto/faker": "^1.5"
},
"require-dev": {
"codeception/codeception": "^2.0",
"phpunit/phpunit": "^4.6"
},
"autoload": {
"psr-4": {
"Gazzete\\": "app/"
}
},
"scripts": {
"post-install-cmd": [
"bower install"
],
"post-update-cmd": [
"bower install"
]
}
}
| {
- "require": {
? ^
+ "require": {
? ^^
- "corneltek/pux": "~1.5",
? ^^
+ "corneltek/pux": "~1.5",
? ^^^^
- "swiftmailer/swiftmailer": "^5.4",
? ^^
+ "swiftmailer/swiftmailer": "^5.4",
? ^^^^
- "twig/twig": "^1.18"
? ^^
+ "twig/twig": "^1.18",
? ^^^^ +
- },
+ "fzaninotto/faker": "^1.5"
+ },
- "require-dev": {
? ^
+ "require-dev": {
? ^^
- "fzaninotto/faker": "^1.5",
- "codeception/codeception": "^2.0",
? ^^
+ "codeception/codeception": "^2.0",
? ^^^^
- "phpunit/phpunit": "^4.6"
? ^^
+ "phpunit/phpunit": "^4.6"
? ^^^^
- },
+ },
- "autoload": {
? ^
+ "autoload": {
? ^^
- "psr-4": {
? ^^
+ "psr-4": {
? ^^^^
- "Gazzete\\": "app/"
? ^^^
+ "Gazzete\\": "app/"
? ^^^^^^
- }
- },
+ }
+ },
- "scripts": {
? ^
+ "scripts": {
? ^^
- "post-install-cmd": [
? ^^
+ "post-install-cmd": [
? ^^^^
- "bower install"
? ^^^
+ "bower install"
? ^^^^^^
- ],
+ ],
- "post-update-cmd": [
? ^^
+ "post-update-cmd": [
? ^^^^
- "bower install"
? ^^^
+ "bower install"
? ^^^^^^
+ ]
- ]
- }
-
+ }
? +
} | 47 | 1.807692 | 23 | 24 |
f8fdafe98be9675624dd28e7747824691df99979 | my_server.yml | my_server.yml | ---
- hosts: box-ng
remote_user: root
vars:
apt_mirror: http://ftp.de.debian.org/debian/
apt_extra_dists:
- { dist: unstable, prio: 150 }
- { dist: experimental, prio: 145 }
docker_dev: /dev/vda
roles:
- apt_config
- common
- docker_host
- postgres_container
- davical
- nginx
| ---
- hosts: box-ng
remote_user: root
vars:
apt_mirror: http://ftp.de.debian.org/debian/
apt_extra_dists:
- { dist: unstable, prio: 150 }
- { dist: experimental, prio: 145 }
docker_dev: /dev/vda
davical_backup_file: backup/caldav_dump.sql
roles:
- apt_config
- common
- docker_host
- postgres_container
- davical
- nginx
| Put potential backup file in playbook | Put potential backup file in playbook
Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
| YAML | bsd-3-clause | janLo/ansible-playground,janLo/ansible-playground,janLo/ansible-playground | yaml | ## Code Before:
---
- hosts: box-ng
remote_user: root
vars:
apt_mirror: http://ftp.de.debian.org/debian/
apt_extra_dists:
- { dist: unstable, prio: 150 }
- { dist: experimental, prio: 145 }
docker_dev: /dev/vda
roles:
- apt_config
- common
- docker_host
- postgres_container
- davical
- nginx
## Instruction:
Put potential backup file in playbook
Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
## Code After:
---
- hosts: box-ng
remote_user: root
vars:
apt_mirror: http://ftp.de.debian.org/debian/
apt_extra_dists:
- { dist: unstable, prio: 150 }
- { dist: experimental, prio: 145 }
docker_dev: /dev/vda
davical_backup_file: backup/caldav_dump.sql
roles:
- apt_config
- common
- docker_host
- postgres_container
- davical
- nginx
| ---
- hosts: box-ng
remote_user: root
vars:
apt_mirror: http://ftp.de.debian.org/debian/
apt_extra_dists:
- { dist: unstable, prio: 150 }
- { dist: experimental, prio: 145 }
docker_dev: /dev/vda
+ davical_backup_file: backup/caldav_dump.sql
roles:
- apt_config
- common
- docker_host
- postgres_container
- davical
- nginx | 1 | 0.0625 | 1 | 0 |
f5f29f26312c189eab0acbeb4800dbcdcf684dcb | gradle.properties | gradle.properties | theForgeVersion=1.11.2-13.20.0.2311
theMappingsVersion=snapshot_20170516
malisisCoreMinVersion=1.11.2-5.0.0
malisisCoreVersion=1.11.2-5.1.0
licenseYear=2015
projectName=Cubic Chunks Mod
description=CubicChunks
versionSuffix=
versionMinorFreeze=
| theForgeVersion=1.11.2-13.20.1.2393
theMappingsVersion=snapshot_20170516
malisisCoreMinVersion=1.11.2-5.0.0
malisisCoreVersion=1.11.2-5.2.3-SNAPSHOT
licenseYear=2015
projectName=Cubic Chunks Mod
description=CubicChunks
versionSuffix=
versionMinorFreeze=
| Update to latest Forge and MalisisCore versions | Update to latest Forge and MalisisCore versions
| INI | mit | OpenCubicChunks/CubicChunks,OpenCubicChunks/CubicChunks,Barteks2x/CubicChunks,Barteks2x/CubicChunks | ini | ## Code Before:
theForgeVersion=1.11.2-13.20.0.2311
theMappingsVersion=snapshot_20170516
malisisCoreMinVersion=1.11.2-5.0.0
malisisCoreVersion=1.11.2-5.1.0
licenseYear=2015
projectName=Cubic Chunks Mod
description=CubicChunks
versionSuffix=
versionMinorFreeze=
## Instruction:
Update to latest Forge and MalisisCore versions
## Code After:
theForgeVersion=1.11.2-13.20.1.2393
theMappingsVersion=snapshot_20170516
malisisCoreMinVersion=1.11.2-5.0.0
malisisCoreVersion=1.11.2-5.2.3-SNAPSHOT
licenseYear=2015
projectName=Cubic Chunks Mod
description=CubicChunks
versionSuffix=
versionMinorFreeze=
| - theForgeVersion=1.11.2-13.20.0.2311
? ^ ^^
+ theForgeVersion=1.11.2-13.20.1.2393
? ^ ^^
theMappingsVersion=snapshot_20170516
malisisCoreMinVersion=1.11.2-5.0.0
- malisisCoreVersion=1.11.2-5.1.0
? ^ ^
+ malisisCoreVersion=1.11.2-5.2.3-SNAPSHOT
? ^ ^^^^^^^^^^
licenseYear=2015
projectName=Cubic Chunks Mod
description=CubicChunks
versionSuffix=
versionMinorFreeze= | 4 | 0.444444 | 2 | 2 |
d9468479799e4104f56ac2a2842d938e9e16e330 | app/views/admin/editions/confirm_unpublish.html.erb | app/views/admin/editions/confirm_unpublish.html.erb |
<%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
<%= fields_for Unpublishing.new do |unpublish| %>
<%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
<%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
<%= unpublish.text_area :explanation, label_text: 'Further explanation' %>
<%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
<%= submit_tag 'Unpublish', class: "btn btn-danger" %>
<% end %>
<% end %>
| <% page_title "Unpublish: #{@edition.title}" %>
<div class="span8">
<section>
<h1>Unpublish <%= @edition.type.titleize %></h1>
<%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
<%= fields_for :unpublishing do |unpublish| %>
<%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
<%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
<%= unpublish.text_area :explanation, label_text: 'Further explanation', rows: 5 %>
<%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
<%= submit_tag 'Unpublish', class: "btn btn-danger" %>
<span class="or_cancel"> or <%= link_to 'cancel', [:admin, @edition] %></span>
<% end %>
<% end %>
</section>
</div>
| Add cancel link to unpublish form | Add cancel link to unpublish form
| HTML+ERB | mit | alphagov/whitehall,YOTOV-LIMITED/whitehall,askl56/whitehall,askl56/whitehall,hotvulcan/whitehall,YOTOV-LIMITED/whitehall,alphagov/whitehall,alphagov/whitehall,ggoral/whitehall,ggoral/whitehall,ggoral/whitehall,robinwhittleton/whitehall,ggoral/whitehall,hotvulcan/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,alphagov/whitehall,robinwhittleton/whitehall,robinwhittleton/whitehall,askl56/whitehall,robinwhittleton/whitehall,hotvulcan/whitehall,hotvulcan/whitehall,YOTOV-LIMITED/whitehall | html+erb | ## Code Before:
<%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
<%= fields_for Unpublishing.new do |unpublish| %>
<%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
<%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
<%= unpublish.text_area :explanation, label_text: 'Further explanation' %>
<%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
<%= submit_tag 'Unpublish', class: "btn btn-danger" %>
<% end %>
<% end %>
## Instruction:
Add cancel link to unpublish form
## Code After:
<% page_title "Unpublish: #{@edition.title}" %>
<div class="span8">
<section>
<h1>Unpublish <%= @edition.type.titleize %></h1>
<%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
<%= fields_for :unpublishing do |unpublish| %>
<%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
<%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
<%= unpublish.text_area :explanation, label_text: 'Further explanation', rows: 5 %>
<%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
<%= submit_tag 'Unpublish', class: "btn btn-danger" %>
<span class="or_cancel"> or <%= link_to 'cancel', [:admin, @edition] %></span>
<% end %>
<% end %>
</section>
</div>
| + <% page_title "Unpublish: #{@edition.title}" %>
+ <div class="span8">
+ <section>
+ <h1>Unpublish <%= @edition.type.titleize %></h1>
+
- <%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
+ <%= form_tag unpublish_admin_edition_path(@edition, lock_version: @edition.lock_version) do %>
? ++++++
- <%= fields_for Unpublishing.new do |unpublish| %>
? ^ ----
+ <%= fields_for :unpublishing do |unpublish| %>
? ++++++ ^^
- <%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
+ <%= unpublish.label :unpublishing_reason_id, "Reason for unpublishing" %>
? ++++++
- <%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
+ <%= unpublish.select :unpublishing_reason_id, options_from_collection_for_select(UnpublishingReason.all, :id, :name) %>
? ++++++
- <%= unpublish.text_area :explanation, label_text: 'Further explanation' %>
+ <%= unpublish.text_area :explanation, label_text: 'Further explanation', rows: 5 %>
? ++++++ +++++++++
- <%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
+ <%= unpublish.text_field :alternative_url, label_text: 'Alternative URL' %>
? ++++++
- <%= submit_tag 'Unpublish', class: "btn btn-danger" %>
+ <%= submit_tag 'Unpublish', class: "btn btn-danger" %>
? ++++++
+ <span class="or_cancel"> or <%= link_to 'cancel', [:admin, @edition] %></span>
+ <% end %>
- <% end %>
+ <% end %>
? ++++
- <% end %>
+ </section>
+ </div> | 26 | 2.6 | 17 | 9 |
3f9fcdac11ae1ece5a172f6bc32f401f292ce102 | tests/jasmine/server/integration/pages-publication-spec.js | tests/jasmine/server/integration/pages-publication-spec.js | describe("Pages publication", function() {
beforeEach(function (done) {
Meteor.call('fixtures/reset', done);
});
it('should return regular data but not premiumContent when a user is not logged in', function() {
//Setup
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for',
order: 1,
path: '/content'
});
//Execute
var cursor = Meteor.server.publish_handlers.pages();
//Verify
data = cursor.fetch()[0];
expect(data.premiumContent).toBeUndefined;
expect(data.content).toBe('My preview content');
expect(data.title).toBe('My Title with Spaces and Cases');
expect(data.order).toBe(1);
expect(data.path).toBe("/content");
});
it('should return premiumContent when a user is logged in', function() {
//Setup
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for'
});
//Execute
var cursor = Meteor.server.publish_handlers.pages.apply({userId: '123'});
//Verify
expect(cursor.fetch()[0].premiumContent).toBe('My premium content that you need to login for');
});
});
| describe("Pages publication", function() {
beforeEach(function (done) {
Meteor.call('fixtures/reset', function() {
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for',
order: 1,
path: '/content'
}, done);
});
});
it('should return regular data but not premiumContent when a user is not logged in', function() {
//Setup
var page = Letterpress.Collections.Pages.findOne('myId');
//Execute
var cursor = Meteor.server.publish_handlers.pages();
//Verify
data = cursor.fetch()[0];
expect(data.premiumContent).toBeUndefined;
expect(data.content).toBe(page.content);
expect(data.title).toBe(page.title);
expect(data.order).toBe(page.order);
expect(data.path).toBe(page.path);
});
it('should return premiumContent when a user is logged in', function() {
//Setup
var page = Letterpress.Collections.Pages.findOne('myId');
//Execute
var cursor = Meteor.server.publish_handlers.pages.apply({userId: '123'});
//Verify
expect(cursor.fetch()[0].premiumContent).toBe(page.premiumContent);
});
});
| Clean up the tests a bit to read easier. Also DRY. | Clean up the tests a bit to read easier. Also DRY.
| JavaScript | mit | chrisdamba/Letterpress,nhantamdo/Letterpress,dandv/Letterpress,cp612sh/Letterpress,dandv/Letterpress,xolvio/Letterpress,FleetingClouds/Letterpress,FleetingClouds/Letterpress,liangsun/Letterpress,shrop/Letterpress,chrisdamba/Letterpress,shrop/Letterpress,xolvio/Letterpress,liangsun/Letterpress,shrop/Letterpress,cp612sh/Letterpress,nhantamdo/Letterpress,nhantamdo/Letterpress,FleetingClouds/Letterpress,xolvio/Letterpress,cp612sh/Letterpress,dandv/Letterpress,chrisdamba/Letterpress,liangsun/Letterpress | javascript | ## Code Before:
describe("Pages publication", function() {
beforeEach(function (done) {
Meteor.call('fixtures/reset', done);
});
it('should return regular data but not premiumContent when a user is not logged in', function() {
//Setup
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for',
order: 1,
path: '/content'
});
//Execute
var cursor = Meteor.server.publish_handlers.pages();
//Verify
data = cursor.fetch()[0];
expect(data.premiumContent).toBeUndefined;
expect(data.content).toBe('My preview content');
expect(data.title).toBe('My Title with Spaces and Cases');
expect(data.order).toBe(1);
expect(data.path).toBe("/content");
});
it('should return premiumContent when a user is logged in', function() {
//Setup
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for'
});
//Execute
var cursor = Meteor.server.publish_handlers.pages.apply({userId: '123'});
//Verify
expect(cursor.fetch()[0].premiumContent).toBe('My premium content that you need to login for');
});
});
## Instruction:
Clean up the tests a bit to read easier. Also DRY.
## Code After:
describe("Pages publication", function() {
beforeEach(function (done) {
Meteor.call('fixtures/reset', function() {
Letterpress.Collections.Pages.insert({
_id: 'myId',
title: 'My Title with Spaces and Cases',
content: 'My preview content',
premiumContent: 'My premium content that you need to login for',
order: 1,
path: '/content'
}, done);
});
});
it('should return regular data but not premiumContent when a user is not logged in', function() {
//Setup
var page = Letterpress.Collections.Pages.findOne('myId');
//Execute
var cursor = Meteor.server.publish_handlers.pages();
//Verify
data = cursor.fetch()[0];
expect(data.premiumContent).toBeUndefined;
expect(data.content).toBe(page.content);
expect(data.title).toBe(page.title);
expect(data.order).toBe(page.order);
expect(data.path).toBe(page.path);
});
it('should return premiumContent when a user is logged in', function() {
//Setup
var page = Letterpress.Collections.Pages.findOne('myId');
//Execute
var cursor = Meteor.server.publish_handlers.pages.apply({userId: '123'});
//Verify
expect(cursor.fetch()[0].premiumContent).toBe(page.premiumContent);
});
});
| describe("Pages publication", function() {
beforeEach(function (done) {
- Meteor.call('fixtures/reset', done);
? ^ ^ ^
+ Meteor.call('fixtures/reset', function() {
? ^^^^^^ ^ ^^
+ Letterpress.Collections.Pages.insert({
+ _id: 'myId',
+ title: 'My Title with Spaces and Cases',
+ content: 'My preview content',
+ premiumContent: 'My premium content that you need to login for',
+ order: 1,
+ path: '/content'
+ }, done);
+ });
});
it('should return regular data but not premiumContent when a user is not logged in', function() {
//Setup
+ var page = Letterpress.Collections.Pages.findOne('myId');
- Letterpress.Collections.Pages.insert({
- _id: 'myId',
- title: 'My Title with Spaces and Cases',
- content: 'My preview content',
- premiumContent: 'My premium content that you need to login for',
- order: 1,
- path: '/content'
- });
//Execute
var cursor = Meteor.server.publish_handlers.pages();
//Verify
data = cursor.fetch()[0];
expect(data.premiumContent).toBeUndefined;
- expect(data.content).toBe('My preview content');
? ---- ^ ^^^^^ -
+ expect(data.content).toBe(page.content);
? ^^ ^
- expect(data.title).toBe('My Title with Spaces and Cases');
+ expect(data.title).toBe(page.title);
- expect(data.order).toBe(1);
? ^
+ expect(data.order).toBe(page.order);
? ^^^^^^^^^^
- expect(data.path).toBe("/content");
? ^^^^^ ^^^^
+ expect(data.path).toBe(page.path);
? ^^^^^^^ ^
});
it('should return premiumContent when a user is logged in', function() {
//Setup
+ var page = Letterpress.Collections.Pages.findOne('myId');
- Letterpress.Collections.Pages.insert({
- _id: 'myId',
- title: 'My Title with Spaces and Cases',
- content: 'My preview content',
- premiumContent: 'My premium content that you need to login for'
- });
//Execute
var cursor = Meteor.server.publish_handlers.pages.apply({userId: '123'});
//Verify
- expect(cursor.fetch()[0].premiumContent).toBe('My premium content that you need to login for');
? ^^^^ ^^ ----------------------------
+ expect(cursor.fetch()[0].premiumContent).toBe(page.premiumContent);
? ^^^^^ ^
});
}); | 37 | 0.925 | 17 | 20 |
73e634676dac90508b4d4e2f0717358c639553aa | src/port1.0/resources/group/Makefile | src/port1.0/resources/group/Makefile | INSTALLDIR= ${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
RSRCS= perl5-1.0.tcl zope-1.0.tcl
include ../../../../Mk/dports.autoconf.mk
all:
clean:
distclean:
install:
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
$(SILENT)set -x; for file in ${RSRCS}; do \
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
done
| INSTALLDIR= ${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
RSRCS= perl5-1.0.tcl python-1.0.tcl zope-1.0.tcl
include ../../../../Mk/dports.autoconf.mk
all:
clean:
distclean:
install:
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
$(SILENT)set -x; for file in ${RSRCS}; do \
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
done
| Add python to the makefile. | Add python to the makefile.
git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@6443 d073be05-634f-4543-b044-5fe20cf6d1d6
| unknown | bsd-3-clause | macports/macports-base,macports/macports-base,neverpanic/macports-base,danchr/macports-base,neverpanic/macports-base,danchr/macports-base | unknown | ## Code Before:
INSTALLDIR= ${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
RSRCS= perl5-1.0.tcl zope-1.0.tcl
include ../../../../Mk/dports.autoconf.mk
all:
clean:
distclean:
install:
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
$(SILENT)set -x; for file in ${RSRCS}; do \
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
done
## Instruction:
Add python to the makefile.
git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@6443 d073be05-634f-4543-b044-5fe20cf6d1d6
## Code After:
INSTALLDIR= ${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
RSRCS= perl5-1.0.tcl python-1.0.tcl zope-1.0.tcl
include ../../../../Mk/dports.autoconf.mk
all:
clean:
distclean:
install:
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
$(SILENT)set -x; for file in ${RSRCS}; do \
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
done
| INSTALLDIR= ${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
- RSRCS= perl5-1.0.tcl zope-1.0.tcl
+ RSRCS= perl5-1.0.tcl python-1.0.tcl zope-1.0.tcl
? +++++++++++++++
include ../../../../Mk/dports.autoconf.mk
all:
clean:
distclean:
install:
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
$(SILENT)set -x; for file in ${RSRCS}; do \
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
done | 2 | 0.117647 | 1 | 1 |
3d34f417654ea649a6df9b866dd361305e947daa | src/layouts/partials/_head/scripts.html | src/layouts/partials/_head/scripts.html | {{$scripts := readDir ( $.Param "dev.js_path" | default "/static/dist/js")}}
{{with $scripts}}
{{range .}}
<script src='{{.Name | add "/dist/js/" | relURL }}' defer></script>
{{end}}
{{end}}
<script type="text/javascript">
var MTIProjectId='0279604d-1ddd-4c0d-b491-eff8ca0e76df';
(function() {
var mtiTracking = document.createElement('script');
mtiTracking.type='text/javascript';
mtiTracking.async='true';
mtiTracking.src='/mtiFontTrackingCode.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
})();
</script>
| {{$scripts := readDir ( $.Param "dev.js_path" | default "/static/dist/js")}}
{{with $scripts}}
{{range .}}
<script src='{{.Name | add "/dist/js/" | relURL }}' defer></script>
{{end}}
{{end}}
{{/* CSS for Algolia */}}
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch-theme-algolia.min.css">
{{/*
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch-theme-algolia.min.css">
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch-preact.min.js"></script>
{{ if eq .Type "search-results" }}{{end}}
*/}}
<script type="text/javascript">
var MTIProjectId='0279604d-1ddd-4c0d-b491-eff8ca0e76df';
(function() {
var mtiTracking = document.createElement('script');
mtiTracking.type='text/javascript';
mtiTracking.async='true';
mtiTracking.src='/mtiFontTrackingCode.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
})();
</script>
| Use Algolia styling for now | Use Algolia styling for now
Ref #32
| HTML | mit | thenewdynamic-org/thenewdynamic.org,budparr/thenewdynamic,budparr/thenewdynamic,thenewdynamic-org/thenewdynamic.org,budparr/thenewdynamic | html | ## Code Before:
{{$scripts := readDir ( $.Param "dev.js_path" | default "/static/dist/js")}}
{{with $scripts}}
{{range .}}
<script src='{{.Name | add "/dist/js/" | relURL }}' defer></script>
{{end}}
{{end}}
<script type="text/javascript">
var MTIProjectId='0279604d-1ddd-4c0d-b491-eff8ca0e76df';
(function() {
var mtiTracking = document.createElement('script');
mtiTracking.type='text/javascript';
mtiTracking.async='true';
mtiTracking.src='/mtiFontTrackingCode.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
})();
</script>
## Instruction:
Use Algolia styling for now
Ref #32
## Code After:
{{$scripts := readDir ( $.Param "dev.js_path" | default "/static/dist/js")}}
{{with $scripts}}
{{range .}}
<script src='{{.Name | add "/dist/js/" | relURL }}' defer></script>
{{end}}
{{end}}
{{/* CSS for Algolia */}}
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch-theme-algolia.min.css">
{{/*
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch-theme-algolia.min.css">
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch-preact.min.js"></script>
{{ if eq .Type "search-results" }}{{end}}
*/}}
<script type="text/javascript">
var MTIProjectId='0279604d-1ddd-4c0d-b491-eff8ca0e76df';
(function() {
var mtiTracking = document.createElement('script');
mtiTracking.type='text/javascript';
mtiTracking.async='true';
mtiTracking.src='/mtiFontTrackingCode.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
})();
</script>
| {{$scripts := readDir ( $.Param "dev.js_path" | default "/static/dist/js")}}
{{with $scripts}}
{{range .}}
<script src='{{.Name | add "/dist/js/" | relURL }}' defer></script>
{{end}}
{{end}}
+
+ {{/* CSS for Algolia */}}
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch.min.css">
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.5.1/dist/instantsearch-theme-algolia.min.css">
+
+
+ {{/*
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch.min.css">
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch-theme-algolia.min.css">
+ <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@1/dist/instantsearch-preact.min.js"></script>
+ {{ if eq .Type "search-results" }}{{end}}
+ */}}
<script type="text/javascript">
var MTIProjectId='0279604d-1ddd-4c0d-b491-eff8ca0e76df';
(function() {
var mtiTracking = document.createElement('script');
mtiTracking.type='text/javascript';
mtiTracking.async='true';
mtiTracking.src='/mtiFontTrackingCode.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
})();
</script> | 12 | 0.631579 | 12 | 0 |
8311f4aac19ae4a19a76a3c401cd0fca8dc2bf3a | .travis.yml | .travis.yml | dist: trusty
sudo: false
language: node_js
node_js:
- 4
- 5
- 6
- 7
- 8
env:
- NODE_ENV=test WEBPACK_VERSION=1.x
- NODE_ENV=test WEBPACK_VERSION=2.x
- NODE_ENV=test WEBPACK_VERSION=3.x
before_install:
- npm install -g npm
install:
- npm install
script:
- scripts/test.sh
matrix:
allow_failures:
- node_js: 8 | dist: trusty
sudo: false
language: node_js
node_js:
- 4
- 5
- 6
- 7
- 8
env:
- NODE_ENV=test WEBPACK_VERSION=1.x
- NODE_ENV=test WEBPACK_VERSION=2.x
- NODE_ENV=test WEBPACK_VERSION=3.x
- NODE_ENV=test WEBPACK_VERSION=4.x
before_install:
- npm install -g npm
install:
- npm install
script:
- scripts/test.sh
matrix:
allow_failures:
- node_js: 8 | Add webpack 4 in Travis tests | Add webpack 4 in Travis tests
| YAML | mit | kavu/webp-loader,kavu/webp-loader | yaml | ## Code Before:
dist: trusty
sudo: false
language: node_js
node_js:
- 4
- 5
- 6
- 7
- 8
env:
- NODE_ENV=test WEBPACK_VERSION=1.x
- NODE_ENV=test WEBPACK_VERSION=2.x
- NODE_ENV=test WEBPACK_VERSION=3.x
before_install:
- npm install -g npm
install:
- npm install
script:
- scripts/test.sh
matrix:
allow_failures:
- node_js: 8
## Instruction:
Add webpack 4 in Travis tests
## Code After:
dist: trusty
sudo: false
language: node_js
node_js:
- 4
- 5
- 6
- 7
- 8
env:
- NODE_ENV=test WEBPACK_VERSION=1.x
- NODE_ENV=test WEBPACK_VERSION=2.x
- NODE_ENV=test WEBPACK_VERSION=3.x
- NODE_ENV=test WEBPACK_VERSION=4.x
before_install:
- npm install -g npm
install:
- npm install
script:
- scripts/test.sh
matrix:
allow_failures:
- node_js: 8 | dist: trusty
sudo: false
language: node_js
node_js:
- 4
- 5
- 6
- 7
- 8
env:
- NODE_ENV=test WEBPACK_VERSION=1.x
- NODE_ENV=test WEBPACK_VERSION=2.x
- NODE_ENV=test WEBPACK_VERSION=3.x
+ - NODE_ENV=test WEBPACK_VERSION=4.x
before_install:
- npm install -g npm
install:
- npm install
script:
- scripts/test.sh
matrix:
allow_failures:
- node_js: 8 | 1 | 0.037037 | 1 | 0 |
35e383007f5866c81a4f39a3550eb06dcad44e6e | src/ui/Slider.css | src/ui/Slider.css | .widget-slider .rc-slider-handle,
.widget-slider .rc-slider-dot-active {
border-color: #e9e9e9;
border: 2px solid #e9e9e9;
}
.widget-slider.has-error .rc-slider-track,
.widget-slider.has-error .rc-slider-rail {
background-color: #a94442;
}
.rc-slider.rc-slider-with-marks {
padding-bottom: 25px;
}
.rc-slider.rc-slider-disabled {
background-color: transparent;
}
.widget-slider-default .rc-slider-track {
background-color: #DDDDDD;
}
.widget-slider-inverse .rc-slider-track {
background-color: #3D3F41;
}
.widget-slider-primary .rc-slider-track{
background-color: #59C2E6;
}
.widget-slider-info .rc-slider-track {
background-color: #8AD4ED;
}
.widget-slider-success .rc-slider-track {
background-color: #8CC152;
}
.widget-slider-warning .rc-slider-track {
background-color: #f4a911;
}
.widget-slider-danger .rc-slider-track {
background-color: #D9534F;
}
| .widget-slider .rc-slider-handle,
.widget-slider .rc-slider-dot-active {
border-color: #e9e9e9;
border: 2px solid #e9e9e9;
}
.widget-slider.has-error .rc-slider-track,
.widget-slider.has-error .rc-slider-rail {
background-color: #a94442;
}
.rc-slider-mark-text {
width: auto !important;
margin-left: -4px !important;
}
.rc-slider.rc-slider-with-marks {
padding-bottom: 25px;
}
.rc-slider.rc-slider-disabled {
background-color: transparent;
}
.widget-slider-default .rc-slider-track {
background-color: #DDDDDD;
}
.widget-slider-inverse .rc-slider-track {
background-color: #3D3F41;
}
.widget-slider-primary .rc-slider-track{
background-color: #59C2E6;
}
.widget-slider-info .rc-slider-track {
background-color: #8AD4ED;
}
.widget-slider-success .rc-slider-track {
background-color: #8CC152;
}
.widget-slider-warning .rc-slider-track {
background-color: #f4a911;
}
.widget-slider-danger .rc-slider-track {
background-color: #D9534F;
}
| Fix the horizontal scrollbar on mobile | Fix the horizontal scrollbar on mobile
| CSS | apache-2.0 | mendixlabs/slider,mendixlabs/slider | css | ## Code Before:
.widget-slider .rc-slider-handle,
.widget-slider .rc-slider-dot-active {
border-color: #e9e9e9;
border: 2px solid #e9e9e9;
}
.widget-slider.has-error .rc-slider-track,
.widget-slider.has-error .rc-slider-rail {
background-color: #a94442;
}
.rc-slider.rc-slider-with-marks {
padding-bottom: 25px;
}
.rc-slider.rc-slider-disabled {
background-color: transparent;
}
.widget-slider-default .rc-slider-track {
background-color: #DDDDDD;
}
.widget-slider-inverse .rc-slider-track {
background-color: #3D3F41;
}
.widget-slider-primary .rc-slider-track{
background-color: #59C2E6;
}
.widget-slider-info .rc-slider-track {
background-color: #8AD4ED;
}
.widget-slider-success .rc-slider-track {
background-color: #8CC152;
}
.widget-slider-warning .rc-slider-track {
background-color: #f4a911;
}
.widget-slider-danger .rc-slider-track {
background-color: #D9534F;
}
## Instruction:
Fix the horizontal scrollbar on mobile
## Code After:
.widget-slider .rc-slider-handle,
.widget-slider .rc-slider-dot-active {
border-color: #e9e9e9;
border: 2px solid #e9e9e9;
}
.widget-slider.has-error .rc-slider-track,
.widget-slider.has-error .rc-slider-rail {
background-color: #a94442;
}
.rc-slider-mark-text {
width: auto !important;
margin-left: -4px !important;
}
.rc-slider.rc-slider-with-marks {
padding-bottom: 25px;
}
.rc-slider.rc-slider-disabled {
background-color: transparent;
}
.widget-slider-default .rc-slider-track {
background-color: #DDDDDD;
}
.widget-slider-inverse .rc-slider-track {
background-color: #3D3F41;
}
.widget-slider-primary .rc-slider-track{
background-color: #59C2E6;
}
.widget-slider-info .rc-slider-track {
background-color: #8AD4ED;
}
.widget-slider-success .rc-slider-track {
background-color: #8CC152;
}
.widget-slider-warning .rc-slider-track {
background-color: #f4a911;
}
.widget-slider-danger .rc-slider-track {
background-color: #D9534F;
}
| .widget-slider .rc-slider-handle,
.widget-slider .rc-slider-dot-active {
border-color: #e9e9e9;
border: 2px solid #e9e9e9;
}
.widget-slider.has-error .rc-slider-track,
.widget-slider.has-error .rc-slider-rail {
background-color: #a94442;
+ }
+
+ .rc-slider-mark-text {
+ width: auto !important;
+ margin-left: -4px !important;
}
.rc-slider.rc-slider-with-marks {
padding-bottom: 25px;
}
.rc-slider.rc-slider-disabled {
background-color: transparent;
}
.widget-slider-default .rc-slider-track {
background-color: #DDDDDD;
}
.widget-slider-inverse .rc-slider-track {
background-color: #3D3F41;
}
.widget-slider-primary .rc-slider-track{
background-color: #59C2E6;
}
.widget-slider-info .rc-slider-track {
background-color: #8AD4ED;
}
.widget-slider-success .rc-slider-track {
background-color: #8CC152;
}
.widget-slider-warning .rc-slider-track {
background-color: #f4a911;
}
.widget-slider-danger .rc-slider-track {
background-color: #D9534F;
} | 5 | 0.106383 | 5 | 0 |
465219d295bba381023d6762a6bf3bb20ba6026d | README.md | README.md |
FBI is an open source CIA (un)installer for the 3DS.
Banner credit: [OctopusRift](http://gbatemp.net/members/octopusrift.356526/), [Apache Thunder](https://gbatemp.net/members/apache-thunder.105648/)
Download: https://github.com/Steveice10/FBI/releases
Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) to build.
|
FBI is an open source CIA (un)installer for the 3DS.
Banner credit: [OctopusRift](http://gbatemp.net/members/octopusrift.356526/), [Apache Thunder](https://gbatemp.net/members/apache-thunder.105648/)
Download: https://github.com/Steveice10/FBI/releases
Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) and [citro3d](https://github.com/fincs/citro3d) to build.
| Add citro3d to list of requirements. | Add citro3d to list of requirements.
| Markdown | mit | Steveice10/FBI,Steveice10/FBI,Steveice10/FBI | markdown | ## Code Before:
FBI is an open source CIA (un)installer for the 3DS.
Banner credit: [OctopusRift](http://gbatemp.net/members/octopusrift.356526/), [Apache Thunder](https://gbatemp.net/members/apache-thunder.105648/)
Download: https://github.com/Steveice10/FBI/releases
Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) to build.
## Instruction:
Add citro3d to list of requirements.
## Code After:
FBI is an open source CIA (un)installer for the 3DS.
Banner credit: [OctopusRift](http://gbatemp.net/members/octopusrift.356526/), [Apache Thunder](https://gbatemp.net/members/apache-thunder.105648/)
Download: https://github.com/Steveice10/FBI/releases
Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) and [citro3d](https://github.com/fincs/citro3d) to build.
|
FBI is an open source CIA (un)installer for the 3DS.
Banner credit: [OctopusRift](http://gbatemp.net/members/octopusrift.356526/), [Apache Thunder](https://gbatemp.net/members/apache-thunder.105648/)
Download: https://github.com/Steveice10/FBI/releases
- Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) to build.
+ Requires [devkitARM](http://sourceforge.net/projects/devkitpro/files/devkitARM/) and [citro3d](https://github.com/fincs/citro3d) to build.
? ++++++++++++++++++++++++++++++++++++++++++++++++
| 2 | 0.25 | 1 | 1 |
2b9e3c11038231a0b961c71b29aa178d8d617490 | src/mac/make-installer.sh | src/mac/make-installer.sh |
set -e
tmpdir=$(mktemp -d -t elm)
installerdir=$(pwd)
contentsdir=$tmpdir
scriptsdir=$contentsdir/Scripts
bindir=$contentsdir
mkdir -p $bindir
mkdir -p $scriptsdir
cp $installerdir/postinstall $scriptsdir
cp $installerdir/wrapper/elm $bindir
# This is not nice! You should download Elm and build everything from scratch
for bin in elm-compiler elm-get elm-server elm-repl elm-doc
do
whichbin=$(which $bin) || echo ""
if [ "$whichbin" = "" ]; then
echo "File does not exist: $bin"
exit 1
fi
if [ ! -f $whichbin ]; then
echo "File does not exist: $bin"
exit 1
fi
cp $(which $bin) $bindir
done
pkgbuild --identifier org.elm-lang.share.pkg --install-location /usr/local/share/elm --root ../share share.pkg
pkgbuild --identifier org.elm-lang.bin.pkg --install-location /usr/local/bin --scripts $scriptsdir --filter 'Scripts.*' --root $tmpdir bin.pkg
productbuild --distribution Distribution.xml --package-path . --resources Resources ElmInstaller.pkg
# rm -rf $tmpdir
|
set -e
tmpdir=$(mktemp -d -t elm)
installerdir=$(pwd)
contentsdir=$tmpdir
scriptsdir=$contentsdir/Scripts
bindir=$contentsdir
mkdir -p $bindir
mkdir -p $scriptsdir
cp $installerdir/postinstall $scriptsdir
cp $installerdir/wrapper/elm $bindir
# This is not nice! You should download Elm and build everything from scratch
for bin in elm-compiler elm-get elm-server elm-repl elm-doc
do
whichbin=$(which $bin) || echo ""
if [ "$whichbin" = "" ]; then
echo "File does not exist: $bin"
exit 1
fi
if [ ! -f $whichbin ]; then
echo "File does not exist: $bin"
exit 1
fi
cp $(which $bin) $bindir
done
pkgbuild --identifier org.elm-lang.share.pkg --install-location /usr/local/share/elm --root ../share share.pkg
pkgbuild --identifier org.elm-lang.bin.pkg --install-location /usr/local/bin --scripts $scriptsdir --filter 'Scripts.*' --root $tmpdir bin.pkg
productbuild --distribution Distribution.xml --package-path . --resources Resources ElmInstaller.pkg
# Clean-up
rm bin.pkg
rm share.pkg
# rm -rf $tmpdir
| Add clean-up of .pkg files that will not be distributed | Add clean-up of .pkg files that will not be distributed
| Shell | bsd-3-clause | rtorr/elm-platform,jvoigtlaender/elm-platform,jonathanperret/elm-platform,cored/elm-platform,mseri/elm-platform,wskplho/elm-platform,jvoigtlaender/elm-platform | shell | ## Code Before:
set -e
tmpdir=$(mktemp -d -t elm)
installerdir=$(pwd)
contentsdir=$tmpdir
scriptsdir=$contentsdir/Scripts
bindir=$contentsdir
mkdir -p $bindir
mkdir -p $scriptsdir
cp $installerdir/postinstall $scriptsdir
cp $installerdir/wrapper/elm $bindir
# This is not nice! You should download Elm and build everything from scratch
for bin in elm-compiler elm-get elm-server elm-repl elm-doc
do
whichbin=$(which $bin) || echo ""
if [ "$whichbin" = "" ]; then
echo "File does not exist: $bin"
exit 1
fi
if [ ! -f $whichbin ]; then
echo "File does not exist: $bin"
exit 1
fi
cp $(which $bin) $bindir
done
pkgbuild --identifier org.elm-lang.share.pkg --install-location /usr/local/share/elm --root ../share share.pkg
pkgbuild --identifier org.elm-lang.bin.pkg --install-location /usr/local/bin --scripts $scriptsdir --filter 'Scripts.*' --root $tmpdir bin.pkg
productbuild --distribution Distribution.xml --package-path . --resources Resources ElmInstaller.pkg
# rm -rf $tmpdir
## Instruction:
Add clean-up of .pkg files that will not be distributed
## Code After:
set -e
tmpdir=$(mktemp -d -t elm)
installerdir=$(pwd)
contentsdir=$tmpdir
scriptsdir=$contentsdir/Scripts
bindir=$contentsdir
mkdir -p $bindir
mkdir -p $scriptsdir
cp $installerdir/postinstall $scriptsdir
cp $installerdir/wrapper/elm $bindir
# This is not nice! You should download Elm and build everything from scratch
for bin in elm-compiler elm-get elm-server elm-repl elm-doc
do
whichbin=$(which $bin) || echo ""
if [ "$whichbin" = "" ]; then
echo "File does not exist: $bin"
exit 1
fi
if [ ! -f $whichbin ]; then
echo "File does not exist: $bin"
exit 1
fi
cp $(which $bin) $bindir
done
pkgbuild --identifier org.elm-lang.share.pkg --install-location /usr/local/share/elm --root ../share share.pkg
pkgbuild --identifier org.elm-lang.bin.pkg --install-location /usr/local/bin --scripts $scriptsdir --filter 'Scripts.*' --root $tmpdir bin.pkg
productbuild --distribution Distribution.xml --package-path . --resources Resources ElmInstaller.pkg
# Clean-up
rm bin.pkg
rm share.pkg
# rm -rf $tmpdir
|
set -e
tmpdir=$(mktemp -d -t elm)
installerdir=$(pwd)
contentsdir=$tmpdir
scriptsdir=$contentsdir/Scripts
bindir=$contentsdir
mkdir -p $bindir
mkdir -p $scriptsdir
cp $installerdir/postinstall $scriptsdir
-
cp $installerdir/wrapper/elm $bindir
# This is not nice! You should download Elm and build everything from scratch
for bin in elm-compiler elm-get elm-server elm-repl elm-doc
do
whichbin=$(which $bin) || echo ""
if [ "$whichbin" = "" ]; then
echo "File does not exist: $bin"
exit 1
fi
if [ ! -f $whichbin ]; then
echo "File does not exist: $bin"
exit 1
fi
cp $(which $bin) $bindir
done
pkgbuild --identifier org.elm-lang.share.pkg --install-location /usr/local/share/elm --root ../share share.pkg
pkgbuild --identifier org.elm-lang.bin.pkg --install-location /usr/local/bin --scripts $scriptsdir --filter 'Scripts.*' --root $tmpdir bin.pkg
productbuild --distribution Distribution.xml --package-path . --resources Resources ElmInstaller.pkg
+ # Clean-up
+ rm bin.pkg
+ rm share.pkg
# rm -rf $tmpdir
| 4 | 0.095238 | 3 | 1 |
049ec8a07aeb2344b7617ab5eb039c61f52fec45 | Pig-Latin/pig_latin.py | Pig-Latin/pig_latin.py | class Pig_latin(object):
vowels = ["a", "e" , "i", "o", "u", "A", "E", "I", "O", "U"]
def __init__(self, sentence):
self.sentence = sentence
print self.convert_sentence()
def convert_sentence(self):
new_sentence = self.sentence.split(" ")
converted_sentence = []
for word in new_sentence:
if word[0] in self.vowels:
converted_sentence.append(word)
else:
converted_sentence.append(''.join(self.word_converter(word)))
return (' ').join(converted_sentence)
def word_converter(self,word):
solution = list(word)
for letter in list(word):
if letter not in self.vowels:
solution.remove(letter)
solution.append(letter)
else:
break
solution.append("ay")
return solution
Pig_latin("Hello eric ryan there")
| class Pig_latin(object):
vowels = ["a", "e" , "i", "o", "u", "A", "E", "I", "O", "U"]
def __init__(self):
self.sentence = raw_input("Enter a sentence to be converted into pig latin: ")
print self.convert_sentence()
while True:
play_again = raw_input("Do you want to play again? Type yes or no ").lower()
if play_again == "yes":
Pig_latin()
break
elif play_again == "no":
print "thanks for playing!"
break
else:
print "Please type yes or no!"
def convert_sentence(self):
new_sentence = self.sentence.split(" ")
converted_sentence = []
for word in new_sentence:
if word[0] in self.vowels:
converted_sentence.append(word)
else:
converted_sentence.append(''.join(self.word_converter(word)))
return (' ').join(converted_sentence)
def word_converter(self,word):
solution = list(word)
for letter in list(word):
if letter not in self.vowels:
solution.remove(letter)
solution.append(letter)
else:
break
solution.append("ay")
return solution
Pig_latin()
| Add user functionality to Pig Latin class | Add user functionality to Pig Latin class
| Python | mit | Bigless27/Python-Projects | python | ## Code Before:
class Pig_latin(object):
vowels = ["a", "e" , "i", "o", "u", "A", "E", "I", "O", "U"]
def __init__(self, sentence):
self.sentence = sentence
print self.convert_sentence()
def convert_sentence(self):
new_sentence = self.sentence.split(" ")
converted_sentence = []
for word in new_sentence:
if word[0] in self.vowels:
converted_sentence.append(word)
else:
converted_sentence.append(''.join(self.word_converter(word)))
return (' ').join(converted_sentence)
def word_converter(self,word):
solution = list(word)
for letter in list(word):
if letter not in self.vowels:
solution.remove(letter)
solution.append(letter)
else:
break
solution.append("ay")
return solution
Pig_latin("Hello eric ryan there")
## Instruction:
Add user functionality to Pig Latin class
## Code After:
class Pig_latin(object):
vowels = ["a", "e" , "i", "o", "u", "A", "E", "I", "O", "U"]
def __init__(self):
self.sentence = raw_input("Enter a sentence to be converted into pig latin: ")
print self.convert_sentence()
while True:
play_again = raw_input("Do you want to play again? Type yes or no ").lower()
if play_again == "yes":
Pig_latin()
break
elif play_again == "no":
print "thanks for playing!"
break
else:
print "Please type yes or no!"
def convert_sentence(self):
new_sentence = self.sentence.split(" ")
converted_sentence = []
for word in new_sentence:
if word[0] in self.vowels:
converted_sentence.append(word)
else:
converted_sentence.append(''.join(self.word_converter(word)))
return (' ').join(converted_sentence)
def word_converter(self,word):
solution = list(word)
for letter in list(word):
if letter not in self.vowels:
solution.remove(letter)
solution.append(letter)
else:
break
solution.append("ay")
return solution
Pig_latin()
| class Pig_latin(object):
vowels = ["a", "e" , "i", "o", "u", "A", "E", "I", "O", "U"]
- def __init__(self, sentence):
? ----------
+ def __init__(self):
- self.sentence = sentence
+ self.sentence = raw_input("Enter a sentence to be converted into pig latin: ")
print self.convert_sentence()
+
+ while True:
+ play_again = raw_input("Do you want to play again? Type yes or no ").lower()
+ if play_again == "yes":
+ Pig_latin()
+ break
+ elif play_again == "no":
+ print "thanks for playing!"
+ break
+ else:
+ print "Please type yes or no!"
+
def convert_sentence(self):
new_sentence = self.sentence.split(" ")
converted_sentence = []
for word in new_sentence:
if word[0] in self.vowels:
converted_sentence.append(word)
else:
converted_sentence.append(''.join(self.word_converter(word)))
return (' ').join(converted_sentence)
-
def word_converter(self,word):
solution = list(word)
for letter in list(word):
if letter not in self.vowels:
solution.remove(letter)
solution.append(letter)
else:
break
solution.append("ay")
return solution
- Pig_latin("Hello eric ryan there")
+ Pig_latin()
| 19 | 0.612903 | 15 | 4 |
7c80d299d05d95ab92515493422f1646c53d2989 | README.md | README.md | Source code for the BMI Live clinic at the 2018 CSDMS Annual Meeting
|
Code for the **BMI Live** clinic
held at the
[2018 CSDMS Annual Meeting](https://csdms.colorado.edu/wiki/Form:Annualmeeting2018),
May 22-24, in Boulder, Colorado.
## The Goal
Given a model, wrap it in a BMI in realtime.
We also hope show some best practices in Python development.
## The Plan
1. Start with a model
1. View the list of BMI methods and their signatures
at http://bmi-python.readthedocs.io
1. Together, implement the BMI methods for our model!
1. Test the results in a Jupyter Notebook (and make a plot,
maybe using widgets!)
## The Requirements
* Laptop
* Text editor
* Python distribution (we recommend the
[Anaconda](https://www.continuum.io/downloads) Python 2.7
distribution)
* Optionally, a [GitHub](https://github.com) account, and `git` or
GitHub Desktop
| Add goal, plan, and requirements | Add goal, plan, and requirements
| Markdown | mit | csdms/bmi-live,csdms/bmi-live | markdown | ## Code Before:
Source code for the BMI Live clinic at the 2018 CSDMS Annual Meeting
## Instruction:
Add goal, plan, and requirements
## Code After:
Code for the **BMI Live** clinic
held at the
[2018 CSDMS Annual Meeting](https://csdms.colorado.edu/wiki/Form:Annualmeeting2018),
May 22-24, in Boulder, Colorado.
## The Goal
Given a model, wrap it in a BMI in realtime.
We also hope show some best practices in Python development.
## The Plan
1. Start with a model
1. View the list of BMI methods and their signatures
at http://bmi-python.readthedocs.io
1. Together, implement the BMI methods for our model!
1. Test the results in a Jupyter Notebook (and make a plot,
maybe using widgets!)
## The Requirements
* Laptop
* Text editor
* Python distribution (we recommend the
[Anaconda](https://www.continuum.io/downloads) Python 2.7
distribution)
* Optionally, a [GitHub](https://github.com) account, and `git` or
GitHub Desktop
| - Source code for the BMI Live clinic at the 2018 CSDMS Annual Meeting
+
+ Code for the **BMI Live** clinic
+ held at the
+ [2018 CSDMS Annual Meeting](https://csdms.colorado.edu/wiki/Form:Annualmeeting2018),
+ May 22-24, in Boulder, Colorado.
+
+ ## The Goal
+
+ Given a model, wrap it in a BMI in realtime.
+ We also hope show some best practices in Python development.
+
+ ## The Plan
+
+ 1. Start with a model
+ 1. View the list of BMI methods and their signatures
+ at http://bmi-python.readthedocs.io
+ 1. Together, implement the BMI methods for our model!
+ 1. Test the results in a Jupyter Notebook (and make a plot,
+ maybe using widgets!)
+
+ ## The Requirements
+
+ * Laptop
+ * Text editor
+ * Python distribution (we recommend the
+ [Anaconda](https://www.continuum.io/downloads) Python 2.7
+ distribution)
+ * Optionally, a [GitHub](https://github.com) account, and `git` or
+ GitHub Desktop | 30 | 30 | 29 | 1 |
1eabf025ecdf2f7e3d0fd640211d213f7f69a6b2 | tox.ini | tox.ini | [tox]
envlist = django14,django15,django16,django17
[base]
deps =
nose
pep8
mock==1.0.1
tissue
[testenv]
commands = nosetests --with-tissue --tissue-package=template_shortcuts
[testenv:django14]
deps =
django<1.5
{[base]deps}
[testenv:django15]
deps =
django<1.6
{[base]deps}
[testenv:django16]
deps =
django<1.7
{[base]deps} | [tox]
envlist = django17,django18,django19
[base]
deps =
pytest-django
[testenv]
commands = py.test
changedir = test_project
[testenv:django17]
deps =
Django>=1.7,<1.8
{[base]deps}
[testenv:django18]
deps =
Django>=1.8,<1.9
{[base]deps}
[testenv:django19]
deps =
Django>=1.9,<1.10
{[base]deps} | Switch to latest supported django versions | Switch to latest supported django versions
| INI | bsd-3-clause | comandrei/django-template-shortcuts | ini | ## Code Before:
[tox]
envlist = django14,django15,django16,django17
[base]
deps =
nose
pep8
mock==1.0.1
tissue
[testenv]
commands = nosetests --with-tissue --tissue-package=template_shortcuts
[testenv:django14]
deps =
django<1.5
{[base]deps}
[testenv:django15]
deps =
django<1.6
{[base]deps}
[testenv:django16]
deps =
django<1.7
{[base]deps}
## Instruction:
Switch to latest supported django versions
## Code After:
[tox]
envlist = django17,django18,django19
[base]
deps =
pytest-django
[testenv]
commands = py.test
changedir = test_project
[testenv:django17]
deps =
Django>=1.7,<1.8
{[base]deps}
[testenv:django18]
deps =
Django>=1.8,<1.9
{[base]deps}
[testenv:django19]
deps =
Django>=1.9,<1.10
{[base]deps} | [tox]
- envlist = django14,django15,django16,django17
? ^ ^ ^^^^^^^^^^
+ envlist = django17,django18,django19
? ^ ^ ^
[base]
deps =
+ pytest-django
- nose
- pep8
- mock==1.0.1
- tissue
[testenv]
- commands = nosetests --with-tissue --tissue-package=template_shortcuts
+ commands = py.test
+ changedir = test_project
- [testenv:django14]
? ^
+ [testenv:django17]
? ^
deps =
- django<1.5
+ Django>=1.7,<1.8
{[base]deps}
- [testenv:django15]
? ^
+ [testenv:django18]
? ^
deps =
- django<1.6
+ Django>=1.8,<1.9
{[base]deps}
- [testenv:django16]
? ^
+ [testenv:django19]
? ^
deps =
- django<1.7
+ Django>=1.9,<1.10
{[base]deps} | 22 | 0.814815 | 10 | 12 |
16c78d7d0cc0a54b6b5691af03d96e1f66aeb8f1 | _sass/_header.scss | _sass/_header.scss | .jumbotron {
background: url('/assets/img/jumbotron.png') no-repeat left top;
background-size: 100%;
color: $white;
height: 656px;
padding-top: 200px;
position: relative;
text-align: center;
h1 {
font-size: 54px;
font-weight: 700;
}
.lead {
font-size: 24px;
height: 1.8em;
}
.arrow-down {
bottom: 50px;
color: $white;
left: 50%;
position: absolute;
transform: translateX(-50%);
transition: bottom .3s;
.fa {
text-shadow: 2px 0 4px 0 fade-out($black, .5);
}
&:hover {
bottom: 55px;
transition: bottom .3s;
}
}
}
.navbar {
font-family: $font-family-sans-serif;
}
| .jumbotron {
background: url('/assets/img/jumbotron.jpg') no-repeat left top;
background-size: cover;
color: $white;
height: 450px;
padding-top: 120px;
position: relative;
text-align: center;
@include media-breakpoint-up(sm) {
h1 {
font-size: 54px;
font-weight: 700;
}
.lead {
font-size: 24px;
height: 1.8em;
}
}
&.short {
height: 250px;
}
h1 {
font-weight: 700;
}
.arrow-down {
bottom: 50px;
color: $white;
left: 50%;
position: absolute;
transform: translateX(-50%);
transition: bottom .3s;
.fa {
text-shadow: 2px 0 4px 0 fade-out($black, .5);
}
&:hover {
bottom: 55px;
transition: bottom .3s;
}
}
}
.navbar {
font-family: $font-family-sans-serif;
position: absolute !important;
}
| Change jumbotron img url and size | Change jumbotron img url and size
| SCSS | mit | manueljtejada/manueljtejada.github.io,manueljtejada/manueljtejada.github.io | scss | ## Code Before:
.jumbotron {
background: url('/assets/img/jumbotron.png') no-repeat left top;
background-size: 100%;
color: $white;
height: 656px;
padding-top: 200px;
position: relative;
text-align: center;
h1 {
font-size: 54px;
font-weight: 700;
}
.lead {
font-size: 24px;
height: 1.8em;
}
.arrow-down {
bottom: 50px;
color: $white;
left: 50%;
position: absolute;
transform: translateX(-50%);
transition: bottom .3s;
.fa {
text-shadow: 2px 0 4px 0 fade-out($black, .5);
}
&:hover {
bottom: 55px;
transition: bottom .3s;
}
}
}
.navbar {
font-family: $font-family-sans-serif;
}
## Instruction:
Change jumbotron img url and size
## Code After:
.jumbotron {
background: url('/assets/img/jumbotron.jpg') no-repeat left top;
background-size: cover;
color: $white;
height: 450px;
padding-top: 120px;
position: relative;
text-align: center;
@include media-breakpoint-up(sm) {
h1 {
font-size: 54px;
font-weight: 700;
}
.lead {
font-size: 24px;
height: 1.8em;
}
}
&.short {
height: 250px;
}
h1 {
font-weight: 700;
}
.arrow-down {
bottom: 50px;
color: $white;
left: 50%;
position: absolute;
transform: translateX(-50%);
transition: bottom .3s;
.fa {
text-shadow: 2px 0 4px 0 fade-out($black, .5);
}
&:hover {
bottom: 55px;
transition: bottom .3s;
}
}
}
.navbar {
font-family: $font-family-sans-serif;
position: absolute !important;
}
| .jumbotron {
- background: url('/assets/img/jumbotron.png') no-repeat left top;
? -
+ background: url('/assets/img/jumbotron.jpg') no-repeat left top;
? +
- background-size: 100%;
? ^^^^
+ background-size: cover;
? ^^^^^
color: $white;
- height: 656px;
? ^ ^
+ height: 450px;
? ^ ^
- padding-top: 200px;
? -
+ padding-top: 120px;
? +
position: relative;
text-align: center;
+ @include media-breakpoint-up(sm) {
- h1 {
+ h1 {
? ++
- font-size: 54px;
+ font-size: 54px;
? ++
- font-weight: 700;
+ font-weight: 700;
? ++
+ }
+
+ .lead {
+ font-size: 24px;
+ height: 1.8em;
+ }
}
- .lead {
- font-size: 24px;
- height: 1.8em;
+ &.short {
+ height: 250px;
+ }
+
+ h1 {
+ font-weight: 700;
}
.arrow-down {
bottom: 50px;
color: $white;
left: 50%;
position: absolute;
transform: translateX(-50%);
transition: bottom .3s;
.fa {
text-shadow: 2px 0 4px 0 fade-out($black, .5);
}
&:hover {
bottom: 55px;
transition: bottom .3s;
}
}
}
.navbar {
font-family: $font-family-sans-serif;
+ position: absolute !important;
} | 31 | 0.756098 | 21 | 10 |
0ebfc24d14e90dfe9d98ffbff39c3ed2f534721b | gen-tsd.json | gen-tsd.json | {
"exclude": [
"dist/**",
"externs/**",
"gulpfile.js",
"test/**",
"util/**"
],
"removeReferences": [
"../shadycss/apply-shim.d.ts",
"../shadycss/custom-style-interface.d.ts"
],
"addReferences": {
"lib/utils/boot.d.ts": [
"extra-types.d.ts"
]
},
"renameTypes": {
"Polymer_PropertyEffects": "Polymer.PropertyEffects.Interface"
}
}
| {
"exclude": [
"dist/**",
"externs/**",
"gulpfile.js",
"test/**",
"util/**"
],
"removeReferences": [
"../shadycss/apply-shim.d.ts",
"../shadycss/custom-style-interface.d.ts"
],
"addReferences": {
"lib/utils/boot.d.ts": [
"extra-types.d.ts"
]
},
"renameTypes": {
"Polymer_PropertyEffects": "Polymer.PropertyEffects"
}
}
| Update PropertyEffects interface name in remap config. | Update PropertyEffects interface name in remap config.
| JSON | bsd-3-clause | Polymer/polymer,Polymer/polymer,Polymer/polymer | json | ## Code Before:
{
"exclude": [
"dist/**",
"externs/**",
"gulpfile.js",
"test/**",
"util/**"
],
"removeReferences": [
"../shadycss/apply-shim.d.ts",
"../shadycss/custom-style-interface.d.ts"
],
"addReferences": {
"lib/utils/boot.d.ts": [
"extra-types.d.ts"
]
},
"renameTypes": {
"Polymer_PropertyEffects": "Polymer.PropertyEffects.Interface"
}
}
## Instruction:
Update PropertyEffects interface name in remap config.
## Code After:
{
"exclude": [
"dist/**",
"externs/**",
"gulpfile.js",
"test/**",
"util/**"
],
"removeReferences": [
"../shadycss/apply-shim.d.ts",
"../shadycss/custom-style-interface.d.ts"
],
"addReferences": {
"lib/utils/boot.d.ts": [
"extra-types.d.ts"
]
},
"renameTypes": {
"Polymer_PropertyEffects": "Polymer.PropertyEffects"
}
}
| {
"exclude": [
"dist/**",
"externs/**",
"gulpfile.js",
"test/**",
"util/**"
],
"removeReferences": [
"../shadycss/apply-shim.d.ts",
"../shadycss/custom-style-interface.d.ts"
],
"addReferences": {
"lib/utils/boot.d.ts": [
"extra-types.d.ts"
]
},
"renameTypes": {
- "Polymer_PropertyEffects": "Polymer.PropertyEffects.Interface"
? ----------
+ "Polymer_PropertyEffects": "Polymer.PropertyEffects"
}
} | 2 | 0.095238 | 1 | 1 |
f00627f365fd81aeb2c652706adde536915ff064 | modules/member/models/LetAuthItemChild.php | modules/member/models/LetAuthItemChild.php | <?php
/**
* @link http://www.letyii.com/
* @copyright Copyright (c) 2014 Let.,ltd
* @license https://github.com/letyii/cms/blob/master/LICENSE
* @author Ngua Go <nguago@let.vn>, CongTS <congts.vn@gmail.com>
*/
namespace app\modules\member\models;
use Yii;
class LetAuthItemChild extends base\LetAuthItemChildBase
{
public static function getAncestors($items = [], $result = []) {
// Get parent list of $item
$list = self::find()->select('parent')->where(['child' => $items])->asArray()->all();
$list = \yii\helpers\ArrayHelper::map($list, 'parent', 'parent');
$result += $list;
if (!empty($list)) {
return self::getAncestors($list, $result);
} else {
return $result;
}
}
}
| <?php
/**
* @link http://www.letyii.com/
* @copyright Copyright (c) 2014 Let.,ltd
* @license https://github.com/letyii/cms/blob/master/LICENSE
* @author Ngua Go <nguago@let.vn>, CongTS <congts.vn@gmail.com>
*/
namespace app\modules\member\models;
use yii\helpers\ArrayHelper;
use Yii;
class LetAuthItemChild extends base\LetAuthItemChildBase
{
public static function getAncestors($items = [], $result = []) {
// Get parent list of $item
$list = self::find()->select('parent')->where(['child' => $items])->asArray()->all();
$list = ArrayHelper::map($list, 'parent', 'parent');
$list = array_values($list);
$result = array_merge($result, $list);
if (!empty($list)) {
return self::getAncestors($list, $result);
} else {
return $result;
}
}
}
| Fix merge array Ancestors (RBAC) | Fix merge array Ancestors (RBAC)
| PHP | mit | letyii/cms,letyii/cms,letyii/cms | php | ## Code Before:
<?php
/**
* @link http://www.letyii.com/
* @copyright Copyright (c) 2014 Let.,ltd
* @license https://github.com/letyii/cms/blob/master/LICENSE
* @author Ngua Go <nguago@let.vn>, CongTS <congts.vn@gmail.com>
*/
namespace app\modules\member\models;
use Yii;
class LetAuthItemChild extends base\LetAuthItemChildBase
{
public static function getAncestors($items = [], $result = []) {
// Get parent list of $item
$list = self::find()->select('parent')->where(['child' => $items])->asArray()->all();
$list = \yii\helpers\ArrayHelper::map($list, 'parent', 'parent');
$result += $list;
if (!empty($list)) {
return self::getAncestors($list, $result);
} else {
return $result;
}
}
}
## Instruction:
Fix merge array Ancestors (RBAC)
## Code After:
<?php
/**
* @link http://www.letyii.com/
* @copyright Copyright (c) 2014 Let.,ltd
* @license https://github.com/letyii/cms/blob/master/LICENSE
* @author Ngua Go <nguago@let.vn>, CongTS <congts.vn@gmail.com>
*/
namespace app\modules\member\models;
use yii\helpers\ArrayHelper;
use Yii;
class LetAuthItemChild extends base\LetAuthItemChildBase
{
public static function getAncestors($items = [], $result = []) {
// Get parent list of $item
$list = self::find()->select('parent')->where(['child' => $items])->asArray()->all();
$list = ArrayHelper::map($list, 'parent', 'parent');
$list = array_values($list);
$result = array_merge($result, $list);
if (!empty($list)) {
return self::getAncestors($list, $result);
} else {
return $result;
}
}
}
| <?php
/**
* @link http://www.letyii.com/
* @copyright Copyright (c) 2014 Let.,ltd
* @license https://github.com/letyii/cms/blob/master/LICENSE
* @author Ngua Go <nguago@let.vn>, CongTS <congts.vn@gmail.com>
*/
namespace app\modules\member\models;
+ use yii\helpers\ArrayHelper;
+
use Yii;
class LetAuthItemChild extends base\LetAuthItemChildBase
{
public static function getAncestors($items = [], $result = []) {
// Get parent list of $item
$list = self::find()->select('parent')->where(['child' => $items])->asArray()->all();
- $list = \yii\helpers\ArrayHelper::map($list, 'parent', 'parent');
? -------------
+ $list = ArrayHelper::map($list, 'parent', 'parent');
- $result += $list;
+ $list = array_values($list);
+ $result = array_merge($result, $list);
if (!empty($list)) {
return self::getAncestors($list, $result);
} else {
return $result;
}
}
} | 7 | 0.269231 | 5 | 2 |
a0f07caff4e9647d9aeef9dbd85eab4e2ece8523 | angular/src/app/file/file-list.component.ts | angular/src/app/file/file-list.component.ts | import { Component, OnInit } from '@angular/core';
import { IFile } from './file';
import { ITag } from '../tag/tag';
import { FileService } from './file.service';
import { TagService } from '../tag/tag.service';
@Component({
template: `
<div class="row">
<div class="col-sm-3" *ngFor="let file of files">
<file [file]="file"></file>
</div>
</div>`,
})
export class FileListComponent implements OnInit {
files: IFile[] = [];
constructor(private fileService: FileService, private tagService: TagService) {}
ngOnInit() {
this.tagService.getTags(true).subscribe((tags: ITag[]) => {});
this.fileService.getFiles().then((files: IFile[]) => {
this.files= files;
});
}
}
| import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Observable } from 'rxjs/Rx';
import { IFile } from './file';
import { ITag } from '../tag/tag';
import { FileService } from './file.service';
import { TagService } from '../tag/tag.service';
@Component({
template: `
<div class="row">
<div class="col-sm-offset-2 col-sm-12">
<br>
<br>
<input class="form-control" placeholder="search..." #search>
<br>
</div>
<div class="col-sm-3" *ngFor="let file of files">
<file [file]="file"></file>
</div>
</div>`,
})
export class FileListComponent implements AfterViewInit, OnInit {
files: IFile[] = [];
allFiles: IFile[] = [];
private inputValue: Observable<string>;
@ViewChild('search') input: ElementRef;
constructor(private fileService: FileService, public tagService: TagService) {}
ngAfterViewInit() {
this.inputValue = fromEvent(this.input.nativeElement, 'input', ($event) => $event.target.value);
this.inputValue.debounceTime(200).subscribe((value: string) => {
const re = new RegExp(value, 'gi');
this.files = this.allFiles.filter((file: IFile) => {
return this.fileMatch(re, file);
});
});
};
fileMatch(re: RegExp, file: IFile) {
if (re.test(file.path)) {
return true;
}
const tags: ITag[] = file.tags.filter((tag: ITag) => {
return re.test(tag.name);
})
if(tags.length) {
return true;
}
}
ngOnInit() {
this.tagService.getTags(true).subscribe((tags: ITag[]) => {});
this.fileService.getFiles().then((files: IFile[]) => {
this.allFiles = files;
this.files = files;
});
}
}
| Add search on filename and tags | Add search on filename and tags
| TypeScript | mit | waxe/waxe-image,waxe/waxe-image,waxe/waxe-image,waxe/waxe-image,waxe/waxe-image | typescript | ## Code Before:
import { Component, OnInit } from '@angular/core';
import { IFile } from './file';
import { ITag } from '../tag/tag';
import { FileService } from './file.service';
import { TagService } from '../tag/tag.service';
@Component({
template: `
<div class="row">
<div class="col-sm-3" *ngFor="let file of files">
<file [file]="file"></file>
</div>
</div>`,
})
export class FileListComponent implements OnInit {
files: IFile[] = [];
constructor(private fileService: FileService, private tagService: TagService) {}
ngOnInit() {
this.tagService.getTags(true).subscribe((tags: ITag[]) => {});
this.fileService.getFiles().then((files: IFile[]) => {
this.files= files;
});
}
}
## Instruction:
Add search on filename and tags
## Code After:
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { Observable } from 'rxjs/Rx';
import { IFile } from './file';
import { ITag } from '../tag/tag';
import { FileService } from './file.service';
import { TagService } from '../tag/tag.service';
@Component({
template: `
<div class="row">
<div class="col-sm-offset-2 col-sm-12">
<br>
<br>
<input class="form-control" placeholder="search..." #search>
<br>
</div>
<div class="col-sm-3" *ngFor="let file of files">
<file [file]="file"></file>
</div>
</div>`,
})
export class FileListComponent implements AfterViewInit, OnInit {
files: IFile[] = [];
allFiles: IFile[] = [];
private inputValue: Observable<string>;
@ViewChild('search') input: ElementRef;
constructor(private fileService: FileService, public tagService: TagService) {}
ngAfterViewInit() {
this.inputValue = fromEvent(this.input.nativeElement, 'input', ($event) => $event.target.value);
this.inputValue.debounceTime(200).subscribe((value: string) => {
const re = new RegExp(value, 'gi');
this.files = this.allFiles.filter((file: IFile) => {
return this.fileMatch(re, file);
});
});
};
fileMatch(re: RegExp, file: IFile) {
if (re.test(file.path)) {
return true;
}
const tags: ITag[] = file.tags.filter((tag: ITag) => {
return re.test(tag.name);
})
if(tags.length) {
return true;
}
}
ngOnInit() {
this.tagService.getTags(true).subscribe((tags: ITag[]) => {});
this.fileService.getFiles().then((files: IFile[]) => {
this.allFiles = files;
this.files = files;
});
}
}
| - import { Component, OnInit } from '@angular/core';
+ import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
+
+ import { fromEvent } from 'rxjs/observable/fromEvent';
+ import { Observable } from 'rxjs/Rx';
import { IFile } from './file';
import { ITag } from '../tag/tag';
import { FileService } from './file.service';
import { TagService } from '../tag/tag.service';
@Component({
template: `
<div class="row">
+ <div class="col-sm-offset-2 col-sm-12">
+ <br>
+ <br>
+ <input class="form-control" placeholder="search..." #search>
+ <br>
+ </div>
<div class="col-sm-3" *ngFor="let file of files">
<file [file]="file"></file>
</div>
</div>`,
})
- export class FileListComponent implements OnInit {
+ export class FileListComponent implements AfterViewInit, OnInit {
? +++++++++++++++
files: IFile[] = [];
+ allFiles: IFile[] = [];
+ private inputValue: Observable<string>;
+
+ @ViewChild('search') input: ElementRef;
+
- constructor(private fileService: FileService, private tagService: TagService) {}
? ^ ^^^^
+ constructor(private fileService: FileService, public tagService: TagService) {}
? ^^^ ^
+
+
+ ngAfterViewInit() {
+ this.inputValue = fromEvent(this.input.nativeElement, 'input', ($event) => $event.target.value);
+
+
+ this.inputValue.debounceTime(200).subscribe((value: string) => {
+ const re = new RegExp(value, 'gi');
+ this.files = this.allFiles.filter((file: IFile) => {
+ return this.fileMatch(re, file);
+ });
+ });
+ };
+
+ fileMatch(re: RegExp, file: IFile) {
+ if (re.test(file.path)) {
+ return true;
+ }
+
+ const tags: ITag[] = file.tags.filter((tag: ITag) => {
+ return re.test(tag.name);
+ })
+
+ if(tags.length) {
+ return true;
+ }
+ }
ngOnInit() {
this.tagService.getTags(true).subscribe((tags: ITag[]) => {});
this.fileService.getFiles().then((files: IFile[]) => {
+ this.allFiles = files;
- this.files= files;
+ this.files = files;
? +
});
}
-
} | 51 | 1.7 | 46 | 5 |
2a6399a74110b6a9e0d48349c68775986c13a579 | pyservice/context.py | pyservice/context.py | import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init__(self):
super().__init__(self, Container.DEFAULT_FACTORY)
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
class Context(object):
def __init__(self, service, operation):
self.service = service
self.operation = operation
def execute(self):
self.service.continue_execution(self)
| import ujson
import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init__(self):
super().__init__(self, Container.DEFAULT_FACTORY)
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
class Context(object):
def __init__(self, service, operation, processor):
self.service = service
self.operation = operation
self.processor = processor
def process_request(self):
self.processor.continue_execution()
class Processor(object):
def __init__(self, service, operation, request_body):
self.service = service
self.operation = operation
self.context = Context(service, operation, self)
self.request = Container()
self.request_body = request_body
self.response = Container()
self.response_body = None
self.plugins = service.get_plugins(operation)
self.index = -1
self.state = "request" # request -> operation -> function
def execute(self):
self.context.process_request()
def continue_execution(self):
self.index += 1
plugins = self.plugins[self.state]
n = len(plugins)
if self.index > n:
# Terminal point so that service.invoke
# can safely call context.process_request()
return
elif self.index == n:
if self.state == "request":
self.index = -1
self.state = "operation"
self._deserialize_request()
self.continue_execution()
self._serialize_response()
elif self.state == "operation":
self.service.invoke(self.operation, self.request,
self.response, self.context)
# index < n
else:
if self.state == "request":
plugins[self.index](self.context)
elif self.state == "operation":
plugins[self.index](self.request, self.response, self.context)
def _deserialize_request(self):
self.request.update(ujson.loads(self.request_body))
def _serialize_response(self):
self.response_body = ujson.dumps(self.response)
| Create class for request process recursion | Create class for request process recursion
| Python | mit | numberoverzero/pyservice | python | ## Code Before:
import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init__(self):
super().__init__(self, Container.DEFAULT_FACTORY)
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
class Context(object):
def __init__(self, service, operation):
self.service = service
self.operation = operation
def execute(self):
self.service.continue_execution(self)
## Instruction:
Create class for request process recursion
## Code After:
import ujson
import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init__(self):
super().__init__(self, Container.DEFAULT_FACTORY)
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
class Context(object):
def __init__(self, service, operation, processor):
self.service = service
self.operation = operation
self.processor = processor
def process_request(self):
self.processor.continue_execution()
class Processor(object):
def __init__(self, service, operation, request_body):
self.service = service
self.operation = operation
self.context = Context(service, operation, self)
self.request = Container()
self.request_body = request_body
self.response = Container()
self.response_body = None
self.plugins = service.get_plugins(operation)
self.index = -1
self.state = "request" # request -> operation -> function
def execute(self):
self.context.process_request()
def continue_execution(self):
self.index += 1
plugins = self.plugins[self.state]
n = len(plugins)
if self.index > n:
# Terminal point so that service.invoke
# can safely call context.process_request()
return
elif self.index == n:
if self.state == "request":
self.index = -1
self.state = "operation"
self._deserialize_request()
self.continue_execution()
self._serialize_response()
elif self.state == "operation":
self.service.invoke(self.operation, self.request,
self.response, self.context)
# index < n
else:
if self.state == "request":
plugins[self.index](self.context)
elif self.state == "operation":
plugins[self.index](self.request, self.response, self.context)
def _deserialize_request(self):
self.request.update(ujson.loads(self.request_body))
def _serialize_response(self):
self.response_body = ujson.dumps(self.response)
| + import ujson
import collections
class Container(collections.defaultdict):
DEFAULT_FACTORY = lambda: None
def __init__(self):
super().__init__(self, Container.DEFAULT_FACTORY)
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
class Context(object):
- def __init__(self, service, operation):
+ def __init__(self, service, operation, processor):
? +++++++++++
+ self.service = service
+ self.operation = operation
+ self.processor = processor
+
+ def process_request(self):
+ self.processor.continue_execution()
+
+
+ class Processor(object):
+ def __init__(self, service, operation, request_body):
self.service = service
self.operation = operation
+ self.context = Context(service, operation, self)
+ self.request = Container()
+ self.request_body = request_body
+ self.response = Container()
+ self.response_body = None
+
+ self.plugins = service.get_plugins(operation)
+
+ self.index = -1
+ self.state = "request" # request -> operation -> function
+
def execute(self):
+ self.context.process_request()
+
+ def continue_execution(self):
+ self.index += 1
+ plugins = self.plugins[self.state]
+ n = len(plugins)
+
+ if self.index > n:
+ # Terminal point so that service.invoke
+ # can safely call context.process_request()
+ return
+ elif self.index == n:
+ if self.state == "request":
+ self.index = -1
+ self.state = "operation"
+
+ self._deserialize_request()
- self.service.continue_execution(self)
? -------- ----
+ self.continue_execution()
? ++++++++
+ self._serialize_response()
+ elif self.state == "operation":
+ self.service.invoke(self.operation, self.request,
+ self.response, self.context)
+ # index < n
+ else:
+ if self.state == "request":
+ plugins[self.index](self.context)
+ elif self.state == "operation":
+ plugins[self.index](self.request, self.response, self.context)
+
+ def _deserialize_request(self):
+ self.request.update(ujson.loads(self.request_body))
+
+ def _serialize_response(self):
+ self.response_body = ujson.dumps(self.response) | 59 | 2.565217 | 57 | 2 |
20a33ecaea503241b258070dcb94a2d7f1a9971a | scripts/sweep_benchmarks_echo.sh | scripts/sweep_benchmarks_echo.sh |
if [ "$1" == "" ]; then
echo "Executable required for first argument"
exit 1
fi
myexec=$(realpath $1)
WORK_DIR=sweep_run
mkdir -p $WORK_DIR
for benchmark in $(ls -hSr /project/work/timing_analysis/tatum_echo/*.echo)
do
benchmark_name=$(basename $benchmark | sed 's/.echo//')
run_dir=${WORK_DIR}/${benchmark_name}
#No echo moving
echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
#With echo moving
#echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && mv timing_graph.echo ${benchmark_name}.echo && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
done
exit 0
|
if [ "$1" == "" ]; then
echo "Executable required for first argument"
exit 1
fi
myexec=$(realpath $1)
WORK_DIR=sweep_run
mkdir -p $WORK_DIR
for benchmark in $(ls -hSr /project/work/timing_analysis/tatum_echo/*.echo)
do
benchmark_name=$(basename $benchmark | sed 's/.echo//')
run_dir=${WORK_DIR}/${benchmark_name}
#No echo moving
#echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
#With echo moving
echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && if [ -f timing_graph.echo ]; then mv timing_graph.echo ${benchmark_name}.echo; fi && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
done
exit 0
| Update sweep script to handle optional echo files | Update sweep script to handle optional echo files
| Shell | mit | verilog-to-routing/tatum,kmurray/tatum,verilog-to-routing/tatum,verilog-to-routing/tatum,kmurray/tatum,kmurray/tatum | shell | ## Code Before:
if [ "$1" == "" ]; then
echo "Executable required for first argument"
exit 1
fi
myexec=$(realpath $1)
WORK_DIR=sweep_run
mkdir -p $WORK_DIR
for benchmark in $(ls -hSr /project/work/timing_analysis/tatum_echo/*.echo)
do
benchmark_name=$(basename $benchmark | sed 's/.echo//')
run_dir=${WORK_DIR}/${benchmark_name}
#No echo moving
echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
#With echo moving
#echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && mv timing_graph.echo ${benchmark_name}.echo && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
done
exit 0
## Instruction:
Update sweep script to handle optional echo files
## Code After:
if [ "$1" == "" ]; then
echo "Executable required for first argument"
exit 1
fi
myexec=$(realpath $1)
WORK_DIR=sweep_run
mkdir -p $WORK_DIR
for benchmark in $(ls -hSr /project/work/timing_analysis/tatum_echo/*.echo)
do
benchmark_name=$(basename $benchmark | sed 's/.echo//')
run_dir=${WORK_DIR}/${benchmark_name}
#No echo moving
#echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
#With echo moving
echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && if [ -f timing_graph.echo ]; then mv timing_graph.echo ${benchmark_name}.echo; fi && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
done
exit 0
|
if [ "$1" == "" ]; then
echo "Executable required for first argument"
exit 1
fi
myexec=$(realpath $1)
WORK_DIR=sweep_run
mkdir -p $WORK_DIR
for benchmark in $(ls -hSr /project/work/timing_analysis/tatum_echo/*.echo)
do
benchmark_name=$(basename $benchmark | sed 's/.echo//')
run_dir=${WORK_DIR}/${benchmark_name}
#No echo moving
- echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
+ #echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
? +
#With echo moving
- #echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && mv timing_graph.echo ${benchmark_name}.echo && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
? -
+ echo "mkdir -p $run_dir && cd $run_dir && $myexec $benchmark >& ${benchmark_name}.log && if [ -f timing_graph.echo ]; then mv timing_graph.echo ${benchmark_name}.echo; fi && echo 'PASSED $benchmark_name' || echo 'FAILED $benchmark_name'"
? ++++++++++++++++++++++++++++++++++ ++++
done
exit 0 | 4 | 0.16 | 2 | 2 |
850e8a665c3f2a154f3f0cb7c3c419603b686ff9 | RELEASE_CHECKLIST.md | RELEASE_CHECKLIST.md |
* Always use a clean checkout, otherwise setup.py may pick up files not
tracked by git that you don't actually want to distribute.
* Make sure CHANGELOG is updated with major changes since the last
release (look through the commit history)
* Update version in inmembrane/__init__.py.
* git commit -a
* Create a new tag for the release:
git tag inmembrane-0.xx
git push --tags
git push
* Run:
* python setup.py sdist
* sudo pip uninstall inmembrane
sudo pip install dist/inmembrane-<version>.tar.gz
* Test the installed version: inmembrane_scan --test
* python setup.py register
* Push a new version to PyPi:
* python setup.py sdist upload
* Switch to the the gh-pages branch:
git checkout gh-pages
* Update the pypi download link in index.html.wrap.
Regenerate HTML docs with:
python wrap.py *html.wrap
* Commit and push the changes.
git commit -a; git push
|
* Always use a clean checkout, otherwise setup.py may pick up files not
tracked by git that you don't actually want to distribute.
* Make sure CHANGELOG is updated with major changes since the last
release (look through the commit history)
* Update version in inmembrane/__init__.py.
* git commit -a
* Create a new tag for the release:
git tag inmembrane-0.xx
git push --tags
git push
* Run:
* virtualenv /tmp/inmembrane_venv
* source /tmp/inmembrane_venv/bin/activate
* python setup.py sdist
* pip uninstall inmembrane
pip install dist/inmembrane-<version>.tar.gz
* Test the installed version:
inmembrane_scan --test
As per https://packaging.python.org/tutorials/distributing-packages/#upload-your-distributions
* Create a `~/.pypirc` file like:
```
[pypi]
username=<my_username>
password=<my_password>
~
```
* chmod 600 ~/.pypirc
* Push a new version to PyPi:
* pip install twine
* twine upload dist/*
* Switch to the the gh-pages branch:
git checkout gh-pages
* Update the pypi download link in index.html.wrap.
Regenerate HTML docs with:
python wrap.py *html.wrap
* Commit and push the changes.
git commit -a; git push
| Update release checklist to reflect changes to pypi. | Update release checklist to reflect changes to pypi.
| Markdown | bsd-2-clause | boscoh/inmembrane | markdown | ## Code Before:
* Always use a clean checkout, otherwise setup.py may pick up files not
tracked by git that you don't actually want to distribute.
* Make sure CHANGELOG is updated with major changes since the last
release (look through the commit history)
* Update version in inmembrane/__init__.py.
* git commit -a
* Create a new tag for the release:
git tag inmembrane-0.xx
git push --tags
git push
* Run:
* python setup.py sdist
* sudo pip uninstall inmembrane
sudo pip install dist/inmembrane-<version>.tar.gz
* Test the installed version: inmembrane_scan --test
* python setup.py register
* Push a new version to PyPi:
* python setup.py sdist upload
* Switch to the the gh-pages branch:
git checkout gh-pages
* Update the pypi download link in index.html.wrap.
Regenerate HTML docs with:
python wrap.py *html.wrap
* Commit and push the changes.
git commit -a; git push
## Instruction:
Update release checklist to reflect changes to pypi.
## Code After:
* Always use a clean checkout, otherwise setup.py may pick up files not
tracked by git that you don't actually want to distribute.
* Make sure CHANGELOG is updated with major changes since the last
release (look through the commit history)
* Update version in inmembrane/__init__.py.
* git commit -a
* Create a new tag for the release:
git tag inmembrane-0.xx
git push --tags
git push
* Run:
* virtualenv /tmp/inmembrane_venv
* source /tmp/inmembrane_venv/bin/activate
* python setup.py sdist
* pip uninstall inmembrane
pip install dist/inmembrane-<version>.tar.gz
* Test the installed version:
inmembrane_scan --test
As per https://packaging.python.org/tutorials/distributing-packages/#upload-your-distributions
* Create a `~/.pypirc` file like:
```
[pypi]
username=<my_username>
password=<my_password>
~
```
* chmod 600 ~/.pypirc
* Push a new version to PyPi:
* pip install twine
* twine upload dist/*
* Switch to the the gh-pages branch:
git checkout gh-pages
* Update the pypi download link in index.html.wrap.
Regenerate HTML docs with:
python wrap.py *html.wrap
* Commit and push the changes.
git commit -a; git push
|
* Always use a clean checkout, otherwise setup.py may pick up files not
tracked by git that you don't actually want to distribute.
* Make sure CHANGELOG is updated with major changes since the last
release (look through the commit history)
* Update version in inmembrane/__init__.py.
* git commit -a
* Create a new tag for the release:
git tag inmembrane-0.xx
git push --tags
git push
* Run:
+ * virtualenv /tmp/inmembrane_venv
+ * source /tmp/inmembrane_venv/bin/activate
* python setup.py sdist
- * sudo pip uninstall inmembrane
? -----
+ * pip uninstall inmembrane
- sudo pip install dist/inmembrane-<version>.tar.gz
? -----
+ pip install dist/inmembrane-<version>.tar.gz
- * Test the installed version: inmembrane_scan --test
- * python setup.py register
+ * Test the installed version:
+ inmembrane_scan --test
+
+ As per https://packaging.python.org/tutorials/distributing-packages/#upload-your-distributions
+
+ * Create a `~/.pypirc` file like:
+
+ ```
+ [pypi]
+ username=<my_username>
+ password=<my_password>
+ ~
+ ```
+
+ * chmod 600 ~/.pypirc
* Push a new version to PyPi:
- * python setup.py sdist upload
+ * pip install twine
+ * twine upload dist/*
* Switch to the the gh-pages branch:
git checkout gh-pages
* Update the pypi download link in index.html.wrap.
Regenerate HTML docs with:
python wrap.py *html.wrap
* Commit and push the changes.
git commit -a; git push | 26 | 0.742857 | 21 | 5 |
a28122842e4c7c454813c81bbca1c3645dfc70e9 | jest.config.base.js | jest.config.base.js | const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"<rootDir>/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "<rootDir>/src/__tests__/tsconfig.json",
diagnostics: false
}
}
};
| const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"<rootDir>/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
// This regex should match the packages that we want compiled from source
// through `ts-jest`, as opposed to loaded from their output files in
// `dist`.
// We don't want to match `apollo-server-env` and
// `apollo-engine-reporting-protobuf`, because these don't depend on
// compilation but need to be initialized from as parto of `prepare`.
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "<rootDir>/src/__tests__/tsconfig.json",
diagnostics: false
}
}
};
| Add comments to `moduleNameMapper` option in Jest config | Add comments to `moduleNameMapper` option in Jest config
| JavaScript | mit | apollostack/apollo-server | javascript | ## Code Before:
const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"<rootDir>/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "<rootDir>/src/__tests__/tsconfig.json",
diagnostics: false
}
}
};
## Instruction:
Add comments to `moduleNameMapper` option in Jest config
## Code After:
const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"<rootDir>/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
// This regex should match the packages that we want compiled from source
// through `ts-jest`, as opposed to loaded from their output files in
// `dist`.
// We don't want to match `apollo-server-env` and
// `apollo-engine-reporting-protobuf`, because these don't depend on
// compilation but need to be initialized from as parto of `prepare`.
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "<rootDir>/src/__tests__/tsconfig.json",
diagnostics: false
}
}
};
| const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "node",
setupFiles: [
"<rootDir>/../apollo-server-env/dist/index.js"
],
preset: "ts-jest",
testMatch: null,
testRegex: "/__tests__/.*\\.test\\.(js|ts)$",
testPathIgnorePatterns: [
"/node_modules/",
"/dist/"
],
moduleFileExtensions: [...defaults.moduleFileExtensions, "ts", "tsx"],
moduleNameMapper: {
'^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
+ // This regex should match the packages that we want compiled from source
+ // through `ts-jest`, as opposed to loaded from their output files in
+ // `dist`.
+ // We don't want to match `apollo-server-env` and
+ // `apollo-engine-reporting-protobuf`, because these don't depend on
+ // compilation but need to be initialized from as parto of `prepare`.
'^(?!apollo-server-env|apollo-engine-reporting-protobuf)(apollo-(?:server|datasource|cache-control|tracing|engine)[^/]*|graphql-extensions)(?:/dist)?((?:/.*)|$)': '<rootDir>/../../packages/$1/src$2'
},
clearMocks: true,
globals: {
"ts-jest": {
tsConfig: "<rootDir>/src/__tests__/tsconfig.json",
diagnostics: false
}
}
}; | 6 | 0.222222 | 6 | 0 |
6b76af9296f99c7901770c194c801c55bc326e4c | .travis.yml | .travis.yml | language: python
env:
- TWISTED=Twisted==10.1
- TWISTED=Twisted==10.2
- TWISTED=Twisted==11.0
- TWISTED=Twisted==11.1
- TWISTED=Twisted==12.0
- TWISTED=Twisted==12.1
- TWISTED=Twisted==12.2
- TWISTED=Twisted==12.3
- TWISTED=svn+svn://svn.twistedmatrix.com/svn/Twisted/trunk
python:
- 2.6
- 2.7
- pypy
matrix:
allow_failures:
# pypy is a bit sporadic
- python: pypy
install:
- pip install $TWISTED pyOpenSSL coveralls --use-mirrors
- pip install -r requirements.txt --use-mirrors
script: coverage run $(which trial) txsocksx
after_success: "coveralls"
| language: python
env:
# earliest, latest, and the last release of every year
- TWISTED=Twisted==10.1
- TWISTED=Twisted==10.2
- TWISTED=Twisted==11.1
- TWISTED=Twisted==12.3
- TWISTED=Twisted==13.1
- TWISTED=svn+svn://svn.twistedmatrix.com/svn/Twisted/trunk
python:
- 2.6
- 2.7
- pypy
matrix:
allow_failures:
# pypy is a bit sporadic
- python: pypy
install:
- pip install $TWISTED pyOpenSSL coveralls --use-mirrors
- pip install -r requirements.txt --use-mirrors
script: coverage run $(which trial) txsocksx
after_success: "coveralls"
| Update the versions of twisted to test against. | Update the versions of twisted to test against.
| YAML | isc | nihilifer/txsocksx,habnabit/txsocksx,locusf/txsocksx | yaml | ## Code Before:
language: python
env:
- TWISTED=Twisted==10.1
- TWISTED=Twisted==10.2
- TWISTED=Twisted==11.0
- TWISTED=Twisted==11.1
- TWISTED=Twisted==12.0
- TWISTED=Twisted==12.1
- TWISTED=Twisted==12.2
- TWISTED=Twisted==12.3
- TWISTED=svn+svn://svn.twistedmatrix.com/svn/Twisted/trunk
python:
- 2.6
- 2.7
- pypy
matrix:
allow_failures:
# pypy is a bit sporadic
- python: pypy
install:
- pip install $TWISTED pyOpenSSL coveralls --use-mirrors
- pip install -r requirements.txt --use-mirrors
script: coverage run $(which trial) txsocksx
after_success: "coveralls"
## Instruction:
Update the versions of twisted to test against.
## Code After:
language: python
env:
# earliest, latest, and the last release of every year
- TWISTED=Twisted==10.1
- TWISTED=Twisted==10.2
- TWISTED=Twisted==11.1
- TWISTED=Twisted==12.3
- TWISTED=Twisted==13.1
- TWISTED=svn+svn://svn.twistedmatrix.com/svn/Twisted/trunk
python:
- 2.6
- 2.7
- pypy
matrix:
allow_failures:
# pypy is a bit sporadic
- python: pypy
install:
- pip install $TWISTED pyOpenSSL coveralls --use-mirrors
- pip install -r requirements.txt --use-mirrors
script: coverage run $(which trial) txsocksx
after_success: "coveralls"
| language: python
env:
+ # earliest, latest, and the last release of every year
- TWISTED=Twisted==10.1
- TWISTED=Twisted==10.2
- - TWISTED=Twisted==11.0
- TWISTED=Twisted==11.1
- - TWISTED=Twisted==12.0
- - TWISTED=Twisted==12.1
- - TWISTED=Twisted==12.2
- TWISTED=Twisted==12.3
+ - TWISTED=Twisted==13.1
- TWISTED=svn+svn://svn.twistedmatrix.com/svn/Twisted/trunk
python:
- 2.6
- 2.7
- pypy
matrix:
allow_failures:
# pypy is a bit sporadic
- python: pypy
install:
- pip install $TWISTED pyOpenSSL coveralls --use-mirrors
- pip install -r requirements.txt --use-mirrors
script: coverage run $(which trial) txsocksx
after_success: "coveralls" | 6 | 0.206897 | 2 | 4 |
3fbc0b25eee198ed5d60751a3802a49242b4bfdc | store/store/templates/store/common-pagination.html | store/store/templates/store/common-pagination.html | <div class="pagination">
<span class="step-links">
{% if list.has_previous %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.previous_page_number }}">< previous</a>
{% endif %}
<span class="current">
Page
<input type="number" id="page-number" value="{{ list.number }}"
max="{{ list.paginator.num_pages }}" min="1" step="1" size="3"
data-sort="{{ sort }}">
of {{ list.paginator.num_pages }}.
</span>
{% if list.has_next %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.next_page_number }}">next ></a>
{% endif %}
</span>
</div>
<script>
$(document).ready(function (){
$('#page-number').change(function (event) {
var $this = $(this);
var sort = $this.data('sort');
var filter = $this.data('filter');
var max = $this.attr('max');
var min = $this.attr('min');
if ($this.val() >= min && $this.val() <= max
&& $this.attr('value') != $this.val()) {
window.location = '?filter=' + filter + '&sort=' + sort + '&page=' + $this.val();
}
});
});
</script> | <div class="pagination">
<span class="step-links">
{% if list.has_previous %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.previous_page_number }}">< previous</a>
{% endif %}
<span class="current">
Page
<input type="number" id="page-number" value="{{ list.number }}"
max="{{ list.paginator.num_pages }}" min="1" step="1" size="3"
data-filter="{{ filter }}"
data-sort="{{ sort }}">
of {{ list.paginator.num_pages }}.
</span>
{% if list.has_next %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.next_page_number }}">next ></a>
{% endif %}
</span>
</div>
<script>
$(document).ready(function (){
$('#page-number').change(function (event) {
var $this = $(this);
var sort = $this.data('sort');
var filter = $this.data('filter');
var max = $this.attr('max');
var min = $this.attr('min');
if ($this.val() >= min && $this.val() <= max
&& $this.attr('value') != $this.val()) {
window.location = '?filter=' + filter + '&sort=' + sort + '&page=' + $this.val();
}
});
});
</script> | Fix page jumping lost args | Fix page jumping lost args
| HTML | mit | sorz/isi,sorz/isi,sorz/isi | html | ## Code Before:
<div class="pagination">
<span class="step-links">
{% if list.has_previous %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.previous_page_number }}">< previous</a>
{% endif %}
<span class="current">
Page
<input type="number" id="page-number" value="{{ list.number }}"
max="{{ list.paginator.num_pages }}" min="1" step="1" size="3"
data-sort="{{ sort }}">
of {{ list.paginator.num_pages }}.
</span>
{% if list.has_next %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.next_page_number }}">next ></a>
{% endif %}
</span>
</div>
<script>
$(document).ready(function (){
$('#page-number').change(function (event) {
var $this = $(this);
var sort = $this.data('sort');
var filter = $this.data('filter');
var max = $this.attr('max');
var min = $this.attr('min');
if ($this.val() >= min && $this.val() <= max
&& $this.attr('value') != $this.val()) {
window.location = '?filter=' + filter + '&sort=' + sort + '&page=' + $this.val();
}
});
});
</script>
## Instruction:
Fix page jumping lost args
## Code After:
<div class="pagination">
<span class="step-links">
{% if list.has_previous %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.previous_page_number }}">< previous</a>
{% endif %}
<span class="current">
Page
<input type="number" id="page-number" value="{{ list.number }}"
max="{{ list.paginator.num_pages }}" min="1" step="1" size="3"
data-filter="{{ filter }}"
data-sort="{{ sort }}">
of {{ list.paginator.num_pages }}.
</span>
{% if list.has_next %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.next_page_number }}">next ></a>
{% endif %}
</span>
</div>
<script>
$(document).ready(function (){
$('#page-number').change(function (event) {
var $this = $(this);
var sort = $this.data('sort');
var filter = $this.data('filter');
var max = $this.attr('max');
var min = $this.attr('min');
if ($this.val() >= min && $this.val() <= max
&& $this.attr('value') != $this.val()) {
window.location = '?filter=' + filter + '&sort=' + sort + '&page=' + $this.val();
}
});
});
</script> | <div class="pagination">
<span class="step-links">
{% if list.has_previous %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.previous_page_number }}">< previous</a>
{% endif %}
<span class="current">
Page
<input type="number" id="page-number" value="{{ list.number }}"
max="{{ list.paginator.num_pages }}" min="1" step="1" size="3"
+ data-filter="{{ filter }}"
data-sort="{{ sort }}">
of {{ list.paginator.num_pages }}.
</span>
{% if list.has_next %}
<a href="?filter={{ filter }}&sort={{ sort }}&page={{ list.next_page_number }}">next ></a>
{% endif %}
</span>
</div>
<script>
$(document).ready(function (){
$('#page-number').change(function (event) {
var $this = $(this);
var sort = $this.data('sort');
var filter = $this.data('filter');
var max = $this.attr('max');
var min = $this.attr('min');
if ($this.val() >= min && $this.val() <= max
&& $this.attr('value') != $this.val()) {
window.location = '?filter=' + filter + '&sort=' + sort + '&page=' + $this.val();
}
});
});
</script> | 1 | 0.027778 | 1 | 0 |
589decd2b3beeca6ebbe6994159adfe9b38abe24 | lib/paur.rb | lib/paur.rb | require 'optparse'
require 'paur/submission'
module Paur
class Main
class << self
attr_reader :category, :verbose
def run(argv)
@category = 'system'
@verbose = false
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
o.on('-c', '--category CATEGORY') { |c| @category = c }
o.on('-v', '--verbose' ) { @verbose = true }
end.parse!(argv)
execute('makepkg -g >> ./PKGBUILD')
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
taurball = Dir.glob('*.src.tar.gz').first
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
execute(s.submit_command)
rescue => ex
if verbose
raise ex # explode naturally
else
$stderr.puts("#{ex}")
exit 1
end
end
private
def execute(cmd)
puts cmd if verbose
unless system(cmd)
raise "#{$?}, command was #{cmd}"
end
end
end
end
end
| require 'optparse'
require 'fileutils'
require 'paur/submission'
module Paur
class Main
class << self
include FileUtils
attr_reader :category, :build_dir, :verbose
def run(argv)
@category = 'system'
@build_dir = '.paur_build'
@verbose = false
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
o.on('-c', '--category CATEGORY') { |c| @category = c }
o.on('-b', '--build-dir DIRECTORY') { |b| @build_dir = b }
o.on('-v', '--verbose') { @verbose = true }
end.parse!(argv)
execute("BUILD_DIR='#{build_dir}' makepkg -g >> ./PKGBUILD")
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
taurball = Dir.glob("*.src.tar.gz").first
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
puts(s.submit_command)
#execute(s.submit_command)
rm taurball, :verbose => verbose
rm_rf build_dir, :verbose => verbose
rescue => ex
if verbose
raise ex # explode naturally
else
$stderr.puts("#{ex}")
exit 1
end
end
private
def execute(cmd)
puts cmd if verbose
unless system(cmd)
raise "#{$?}, command was #{cmd}"
end
end
end
end
end
| Set a build_dir option, remove working files | Set a build_dir option, remove working files
| Ruby | mit | pbrisbin/paur,pbrisbin/paur | ruby | ## Code Before:
require 'optparse'
require 'paur/submission'
module Paur
class Main
class << self
attr_reader :category, :verbose
def run(argv)
@category = 'system'
@verbose = false
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
o.on('-c', '--category CATEGORY') { |c| @category = c }
o.on('-v', '--verbose' ) { @verbose = true }
end.parse!(argv)
execute('makepkg -g >> ./PKGBUILD')
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
taurball = Dir.glob('*.src.tar.gz').first
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
execute(s.submit_command)
rescue => ex
if verbose
raise ex # explode naturally
else
$stderr.puts("#{ex}")
exit 1
end
end
private
def execute(cmd)
puts cmd if verbose
unless system(cmd)
raise "#{$?}, command was #{cmd}"
end
end
end
end
end
## Instruction:
Set a build_dir option, remove working files
## Code After:
require 'optparse'
require 'fileutils'
require 'paur/submission'
module Paur
class Main
class << self
include FileUtils
attr_reader :category, :build_dir, :verbose
def run(argv)
@category = 'system'
@build_dir = '.paur_build'
@verbose = false
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
o.on('-c', '--category CATEGORY') { |c| @category = c }
o.on('-b', '--build-dir DIRECTORY') { |b| @build_dir = b }
o.on('-v', '--verbose') { @verbose = true }
end.parse!(argv)
execute("BUILD_DIR='#{build_dir}' makepkg -g >> ./PKGBUILD")
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
taurball = Dir.glob("*.src.tar.gz").first
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
puts(s.submit_command)
#execute(s.submit_command)
rm taurball, :verbose => verbose
rm_rf build_dir, :verbose => verbose
rescue => ex
if verbose
raise ex # explode naturally
else
$stderr.puts("#{ex}")
exit 1
end
end
private
def execute(cmd)
puts cmd if verbose
unless system(cmd)
raise "#{$?}, command was #{cmd}"
end
end
end
end
end
| require 'optparse'
+ require 'fileutils'
require 'paur/submission'
module Paur
class Main
class << self
+ include FileUtils
+
- attr_reader :category, :verbose
+ attr_reader :category, :build_dir, :verbose
? ++++++++++++
def run(argv)
- @category = 'system'
+ @category = 'system'
? +
+ @build_dir = '.paur_build'
- @verbose = false
+ @verbose = false
? +
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
- o.on('-c', '--category CATEGORY') { |c| @category = c }
? ---
+ o.on('-c', '--category CATEGORY') { |c| @category = c }
? ++ +
+ o.on('-b', '--build-dir DIRECTORY') { |b| @build_dir = b }
- o.on('-v', '--verbose' ) { @verbose = true }
? ---------- ----
+ o.on('-v', '--verbose') { @verbose = true }
end.parse!(argv)
- execute('makepkg -g >> ./PKGBUILD')
? ^
+ execute("BUILD_DIR='#{build_dir}' makepkg -g >> ./PKGBUILD")
? +++++++++++ ++++++++++++++ ^
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
- taurball = Dir.glob('*.src.tar.gz').first
? ^ ^
+ taurball = Dir.glob("*.src.tar.gz").first
? ^ ^
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
+ puts(s.submit_command)
- execute(s.submit_command)
+ #execute(s.submit_command)
? +
+
+ rm taurball, :verbose => verbose
+ rm_rf build_dir, :verbose => verbose
rescue => ex
if verbose
raise ex # explode naturally
else
$stderr.puts("#{ex}")
exit 1
end
end
private
def execute(cmd)
puts cmd if verbose
unless system(cmd)
raise "#{$?}, command was #{cmd}"
end
end
end
end
end | 25 | 0.510204 | 17 | 8 |
f999638b8a419c4adbf51032e5d582060c24cc93 | packages/fo/forkable-monad.yaml | packages/fo/forkable-monad.yaml | homepage: http://code.google.com/p/forkable-monad/
changelog-type: ''
hash: d1706d38608b83af759a555d0e3175ae2c42e1c8c6485c2f0eea6f5555143fbd
test-bench-deps: {}
maintainer: dave@natulte.net
synopsis: An implementation of forkIO for monad stacks.
changelog: ''
basic-deps:
base: ! '>3.0 && <4.4'
transformers: ! '>=0.2.2'
all-versions:
- '0.1'
- '0.1.1'
author: David Anderson
latest: '0.1.1'
description-type: haddock
description: ! 'This module defines a more generic version of Control.Concurrent''s
forkIO, which can directly run some complex monadic actions as well
as plain IO actions.'
license-name: BSD3
| homepage: https://github.com/https://www.github.com/System-Indystress/ForkableMonad#readme
changelog-type: ''
hash: fde420399943b29d68795c9cd9abc087915dfd92b109de3b32004e00bc24a2eb
test-bench-deps: {}
maintainer: matt.p.ahrens@gmail.com
synopsis: An implementation of forkIO for monad stacks.
changelog: ''
basic-deps:
base: ! '>=4.7 && <5'
transformers: ! '>=0.2.2'
all-versions:
- '0.1'
- '0.1.1'
- '0.2.0.0'
author: David Anderson
latest: '0.2.0.0'
description-type: haddock
description: < This module defines a more generic version of Control.Concurrent's
forkIO, which can directly run some complex monadic actions as well as plain IO
actions.
license-name: BSD3
| Update from Hackage at 2018-06-15T23:16:47Z | Update from Hackage at 2018-06-15T23:16:47Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: http://code.google.com/p/forkable-monad/
changelog-type: ''
hash: d1706d38608b83af759a555d0e3175ae2c42e1c8c6485c2f0eea6f5555143fbd
test-bench-deps: {}
maintainer: dave@natulte.net
synopsis: An implementation of forkIO for monad stacks.
changelog: ''
basic-deps:
base: ! '>3.0 && <4.4'
transformers: ! '>=0.2.2'
all-versions:
- '0.1'
- '0.1.1'
author: David Anderson
latest: '0.1.1'
description-type: haddock
description: ! 'This module defines a more generic version of Control.Concurrent''s
forkIO, which can directly run some complex monadic actions as well
as plain IO actions.'
license-name: BSD3
## Instruction:
Update from Hackage at 2018-06-15T23:16:47Z
## Code After:
homepage: https://github.com/https://www.github.com/System-Indystress/ForkableMonad#readme
changelog-type: ''
hash: fde420399943b29d68795c9cd9abc087915dfd92b109de3b32004e00bc24a2eb
test-bench-deps: {}
maintainer: matt.p.ahrens@gmail.com
synopsis: An implementation of forkIO for monad stacks.
changelog: ''
basic-deps:
base: ! '>=4.7 && <5'
transformers: ! '>=0.2.2'
all-versions:
- '0.1'
- '0.1.1'
- '0.2.0.0'
author: David Anderson
latest: '0.2.0.0'
description-type: haddock
description: < This module defines a more generic version of Control.Concurrent's
forkIO, which can directly run some complex monadic actions as well as plain IO
actions.
license-name: BSD3
| - homepage: http://code.google.com/p/forkable-monad/
+ homepage: https://github.com/https://www.github.com/System-Indystress/ForkableMonad#readme
changelog-type: ''
- hash: d1706d38608b83af759a555d0e3175ae2c42e1c8c6485c2f0eea6f5555143fbd
+ hash: fde420399943b29d68795c9cd9abc087915dfd92b109de3b32004e00bc24a2eb
test-bench-deps: {}
- maintainer: dave@natulte.net
+ maintainer: matt.p.ahrens@gmail.com
synopsis: An implementation of forkIO for monad stacks.
changelog: ''
basic-deps:
- base: ! '>3.0 && <4.4'
? ^ ^ ^^^
+ base: ! '>=4.7 && <5'
? ^^ ^ ^
transformers: ! '>=0.2.2'
all-versions:
- '0.1'
- '0.1.1'
+ - '0.2.0.0'
author: David Anderson
- latest: '0.1.1'
? ^ ^
+ latest: '0.2.0.0'
? ^ ^^^
description-type: haddock
- description: ! 'This module defines a more generic version of Control.Concurrent''s
? ^ - -
+ description: < This module defines a more generic version of Control.Concurrent's
? ^
-
- forkIO, which can directly run some complex monadic actions as well
+ forkIO, which can directly run some complex monadic actions as well as plain IO
? ++++++++++++
+ actions.
-
- as plain IO actions.'
license-name: BSD3 | 19 | 0.863636 | 9 | 10 |
feea673502d89090d1e13c570a8e28cdd8147a42 | test/scene/texture/checkerboard_test.cc | test/scene/texture/checkerboard_test.cc | /*
* Unit tests for the checkerboard.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "scene/texture/checkerboard.h"
#include "test/test_util.h"
namespace {
static IntersectionData DataWithCoords(Scalar ss, Scalar tt) {
Ray r(Point3(0, 0, 0), Vector3(0, 0, 1));
IntersectionData data(r);
data.texture_coordinate.s = ss;
data.texture_coordinate.t = tt;
return data;
}
TEST(Checkerboard, IsChanging) {
Color3 blue(0, 0, 1);
Color3 red(1, 0, 0);
Checkerboard cb(blue, red);
EXPECT_TRUE(TestUtil::ColorsEqual(blue, cb.Evaluate(DataWithCoords(0, 0))));
EXPECT_TRUE(TestUtil::ColorsEqual(red, cb.Evaluate(DataWithCoords(0, 0.1))));
}
}
| /*
* Unit tests for the checkerboard.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "scene/texture/checkerboard.h"
#include "test/test_util.h"
namespace {
static IntersectionData DataWithCoords(Scalar ss, Scalar tt) {
Ray r(Point3(0, 0, 0), Vector3(0, 0, 1));
IntersectionData data(r);
data.texture_coordinate.s = ss;
data.texture_coordinate.t = tt;
return data;
}
TEST(Checkerboard, IsChanging) {
Color3 blue(0, 0, 1);
Color3 red(1, 0, 0);
Checkerboard cb(blue, red, 5 /* length */);
EXPECT_TRUE(TestUtil::ColorsEqual(blue, cb.Evaluate(DataWithCoords(0, 0))));
EXPECT_TRUE(TestUtil::ColorsEqual(red, cb.Evaluate(DataWithCoords(0, 0.1))));
}
}
| Fix failing test due to missing checkerboard constructor param. | Fix failing test due to missing checkerboard constructor param.
| C++ | mit | dinowernli/raytracer,dinowernli/raytracer,dinowernli/raytracer,dinowernli/raytracer | c++ | ## Code Before:
/*
* Unit tests for the checkerboard.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "scene/texture/checkerboard.h"
#include "test/test_util.h"
namespace {
static IntersectionData DataWithCoords(Scalar ss, Scalar tt) {
Ray r(Point3(0, 0, 0), Vector3(0, 0, 1));
IntersectionData data(r);
data.texture_coordinate.s = ss;
data.texture_coordinate.t = tt;
return data;
}
TEST(Checkerboard, IsChanging) {
Color3 blue(0, 0, 1);
Color3 red(1, 0, 0);
Checkerboard cb(blue, red);
EXPECT_TRUE(TestUtil::ColorsEqual(blue, cb.Evaluate(DataWithCoords(0, 0))));
EXPECT_TRUE(TestUtil::ColorsEqual(red, cb.Evaluate(DataWithCoords(0, 0.1))));
}
}
## Instruction:
Fix failing test due to missing checkerboard constructor param.
## Code After:
/*
* Unit tests for the checkerboard.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "scene/texture/checkerboard.h"
#include "test/test_util.h"
namespace {
static IntersectionData DataWithCoords(Scalar ss, Scalar tt) {
Ray r(Point3(0, 0, 0), Vector3(0, 0, 1));
IntersectionData data(r);
data.texture_coordinate.s = ss;
data.texture_coordinate.t = tt;
return data;
}
TEST(Checkerboard, IsChanging) {
Color3 blue(0, 0, 1);
Color3 red(1, 0, 0);
Checkerboard cb(blue, red, 5 /* length */);
EXPECT_TRUE(TestUtil::ColorsEqual(blue, cb.Evaluate(DataWithCoords(0, 0))));
EXPECT_TRUE(TestUtil::ColorsEqual(red, cb.Evaluate(DataWithCoords(0, 0.1))));
}
}
| /*
* Unit tests for the checkerboard.
* Author: Dino Wernli
*/
#include <gtest/gtest.h>
#include "scene/texture/checkerboard.h"
#include "test/test_util.h"
namespace {
static IntersectionData DataWithCoords(Scalar ss, Scalar tt) {
Ray r(Point3(0, 0, 0), Vector3(0, 0, 1));
IntersectionData data(r);
data.texture_coordinate.s = ss;
data.texture_coordinate.t = tt;
return data;
}
TEST(Checkerboard, IsChanging) {
Color3 blue(0, 0, 1);
Color3 red(1, 0, 0);
- Checkerboard cb(blue, red);
+ Checkerboard cb(blue, red, 5 /* length */);
? ++++++++++++++++
EXPECT_TRUE(TestUtil::ColorsEqual(blue, cb.Evaluate(DataWithCoords(0, 0))));
EXPECT_TRUE(TestUtil::ColorsEqual(red, cb.Evaluate(DataWithCoords(0, 0.1))));
}
} | 2 | 0.066667 | 1 | 1 |
22ced8b34a8b90b0e5d7a3b72a78e1c6bd597221 | .github/workflows/test.yml | .github/workflows/test.yml | name: Test
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js (latest)
uses: actions/setup-node@v2
with:
node-version: 15
- name: Before Install
run: |
mkdir -p shogi/boards
touch shogi/boards/temp.sqlite3
- run: npm ci
- name: Typecheck files not covered by tests
run: npx tsc --noEmit
- name: Test
run: npm test
- name: Set up reviewdog
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"
- name: codecov
run: npx codecov
| name: Test
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js (latest)
uses: actions/setup-node@v2
with:
node-version: 15
- name: Before Install
run: |
mkdir -p shogi/boards
touch shogi/boards/temp.sqlite3
- run: npm ci
- name: Typecheck files not covered by tests
run: npx tsc --noEmit
- name: Test
uses: w9jds/firebase-action@master
with:
args: emulators:exec --only firestore \"npm test\"
- name: Set up reviewdog
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"
- name: codecov
run: npx codecov
| Install and use Firebase emulators on GitHub Actions | Install and use Firebase emulators on GitHub Actions
| YAML | mit | tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot | yaml | ## Code Before:
name: Test
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js (latest)
uses: actions/setup-node@v2
with:
node-version: 15
- name: Before Install
run: |
mkdir -p shogi/boards
touch shogi/boards/temp.sqlite3
- run: npm ci
- name: Typecheck files not covered by tests
run: npx tsc --noEmit
- name: Test
run: npm test
- name: Set up reviewdog
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"
- name: codecov
run: npx codecov
## Instruction:
Install and use Firebase emulators on GitHub Actions
## Code After:
name: Test
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js (latest)
uses: actions/setup-node@v2
with:
node-version: 15
- name: Before Install
run: |
mkdir -p shogi/boards
touch shogi/boards/temp.sqlite3
- run: npm ci
- name: Typecheck files not covered by tests
run: npx tsc --noEmit
- name: Test
uses: w9jds/firebase-action@master
with:
args: emulators:exec --only firestore \"npm test\"
- name: Set up reviewdog
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"
- name: codecov
run: npx codecov
| name: Test
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js (latest)
uses: actions/setup-node@v2
with:
node-version: 15
- name: Before Install
run: |
mkdir -p shogi/boards
touch shogi/boards/temp.sqlite3
- run: npm ci
- name: Typecheck files not covered by tests
run: npx tsc --noEmit
- name: Test
- run: npm test
+ uses: w9jds/firebase-action@master
+ with:
+ args: emulators:exec --only firestore \"npm test\"
- name: Set up reviewdog
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"
- name: codecov
run: npx codecov | 4 | 0.085106 | 3 | 1 |
80508be0bfcf35e5c0cdd84968be9ec474a66f10 | cmake/fuzzing.cmake | cmake/fuzzing.cmake |
function(add_fuzzer target_name)
# Fuzzing is (currently) only fully supported on clang. So we will
# only enable the fuzzing-flag on clang, but we will still compile it
# in any case, to protect the fuzz-tests from breaking. Since the
# executable's main-function is provided by libfuzzer we have to compile
# the code to a static library on other compilers instead.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(${target_name} ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
target_compile_options(${target_name} PUBLIC "-fsanitize=fuzzer")
set_property(
TARGET ${target_name}
APPEND
PROPERTY LINK_OPTIONS "-fsanitize=fuzzer")
else()
add_library(${target_name} STATIC ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
endif()
endfunction()
# Usage example:
# add_fuzzer(ClassNameMethodNameFuzzer ClassNameMethodNameFuzzer.cpp)
# target_link_libraries(ClassNameMethodNameFuzzer ${PROJECT_NAME})
|
function(add_fuzzer target_name)
# Fuzzing is (currently) only fully supported on clang. So we will
# only enable the fuzzing-flag on clang, but we will still compile it
# in any case, to protect the fuzz-tests from breaking. Since the
# executable's main-function is provided by libfuzzer we have to compile
# the code to a static library on other compilers instead.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(${target_name} ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
if (ENV{LIB_FUZZING_ENGINE})
message(STATUS "Adding linker flags according to LIB_FUZZING_ENGINE env variable: $ENV{LIB_FUZZING_ENGINE}")
set(FUZZING_OPTION $ENV{LIB_FUZZING_ENGINE})
else()
set(FUZZING_OPTION "-fsanitize=fuzzer")
endif()
target_compile_options(${target_name} PUBLIC ${FUZZING_OPTION})
set_property(
TARGET ${target_name}
APPEND
PROPERTY LINK_OPTIONS ${FUZZING_OPTION})
else()
add_library(${target_name} STATIC ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
endif()
endfunction()
# Usage example:
# add_fuzzer(ClassNameMethodNameFuzzer ClassNameMethodNameFuzzer.cpp)
# target_link_libraries(ClassNameMethodNameFuzzer ${PROJECT_NAME})
| Make CMake respect the LIB_FUZZING_ENGINE env var | Make CMake respect the LIB_FUZZING_ENGINE env var
When building a fuzzer is oss-fuzz LIB_FUZZING_ENGINE contains the
linker flags (-fsanitize=fuzzer in the libfuzzer case). For respecting
the oss-fuzz workflow we should read that variable instead of adding our
own linker flag.
| CMake | bsd-2-clause | google/orbit,google/orbit,google/orbit,google/orbit | cmake | ## Code Before:
function(add_fuzzer target_name)
# Fuzzing is (currently) only fully supported on clang. So we will
# only enable the fuzzing-flag on clang, but we will still compile it
# in any case, to protect the fuzz-tests from breaking. Since the
# executable's main-function is provided by libfuzzer we have to compile
# the code to a static library on other compilers instead.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(${target_name} ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
target_compile_options(${target_name} PUBLIC "-fsanitize=fuzzer")
set_property(
TARGET ${target_name}
APPEND
PROPERTY LINK_OPTIONS "-fsanitize=fuzzer")
else()
add_library(${target_name} STATIC ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
endif()
endfunction()
# Usage example:
# add_fuzzer(ClassNameMethodNameFuzzer ClassNameMethodNameFuzzer.cpp)
# target_link_libraries(ClassNameMethodNameFuzzer ${PROJECT_NAME})
## Instruction:
Make CMake respect the LIB_FUZZING_ENGINE env var
When building a fuzzer is oss-fuzz LIB_FUZZING_ENGINE contains the
linker flags (-fsanitize=fuzzer in the libfuzzer case). For respecting
the oss-fuzz workflow we should read that variable instead of adding our
own linker flag.
## Code After:
function(add_fuzzer target_name)
# Fuzzing is (currently) only fully supported on clang. So we will
# only enable the fuzzing-flag on clang, but we will still compile it
# in any case, to protect the fuzz-tests from breaking. Since the
# executable's main-function is provided by libfuzzer we have to compile
# the code to a static library on other compilers instead.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(${target_name} ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
if (ENV{LIB_FUZZING_ENGINE})
message(STATUS "Adding linker flags according to LIB_FUZZING_ENGINE env variable: $ENV{LIB_FUZZING_ENGINE}")
set(FUZZING_OPTION $ENV{LIB_FUZZING_ENGINE})
else()
set(FUZZING_OPTION "-fsanitize=fuzzer")
endif()
target_compile_options(${target_name} PUBLIC ${FUZZING_OPTION})
set_property(
TARGET ${target_name}
APPEND
PROPERTY LINK_OPTIONS ${FUZZING_OPTION})
else()
add_library(${target_name} STATIC ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
endif()
endfunction()
# Usage example:
# add_fuzzer(ClassNameMethodNameFuzzer ClassNameMethodNameFuzzer.cpp)
# target_link_libraries(ClassNameMethodNameFuzzer ${PROJECT_NAME})
|
function(add_fuzzer target_name)
# Fuzzing is (currently) only fully supported on clang. So we will
# only enable the fuzzing-flag on clang, but we will still compile it
# in any case, to protect the fuzz-tests from breaking. Since the
# executable's main-function is provided by libfuzzer we have to compile
# the code to a static library on other compilers instead.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(${target_name} ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
- target_compile_options(${target_name} PUBLIC "-fsanitize=fuzzer")
+ if (ENV{LIB_FUZZING_ENGINE})
+ message(STATUS "Adding linker flags according to LIB_FUZZING_ENGINE env variable: $ENV{LIB_FUZZING_ENGINE}")
+ set(FUZZING_OPTION $ENV{LIB_FUZZING_ENGINE})
+ else()
+ set(FUZZING_OPTION "-fsanitize=fuzzer")
+ endif()
+
+ target_compile_options(${target_name} PUBLIC ${FUZZING_OPTION})
set_property(
TARGET ${target_name}
APPEND
- PROPERTY LINK_OPTIONS "-fsanitize=fuzzer")
+ PROPERTY LINK_OPTIONS ${FUZZING_OPTION})
else()
add_library(${target_name} STATIC ${ARGN})
target_compile_options(${target_name} PRIVATE ${STRICT_COMPILE_FLAGS})
endif()
endfunction()
# Usage example:
# add_fuzzer(ClassNameMethodNameFuzzer ClassNameMethodNameFuzzer.cpp)
# target_link_libraries(ClassNameMethodNameFuzzer ${PROJECT_NAME}) | 11 | 0.44 | 9 | 2 |
eb6cc542836e3daf41330956f588204730db94e9 | cmd/README.md | cmd/README.md |
The example of use of Grafana HTTP API.
Saves all dashboards to JSON files in the current directory.
Requires API key with admin rights.
## backup-datasources
The example of use of Grafana HTTP API.
Saves all datasources to JSON files in the current directory.
Requires API key with admin rights.
|
The example of use of Grafana HTTP API.
Saves all dashboards to JSON files in the current directory.
Requires API key with admin rights.
## backup-datasources
The example of use of Grafana HTTP API.
Saves all datasources to JSON files in the current directory.
Requires API key with admin rights.
## import-dashboards
The example of use of Grafana HTTP API.
It imports all dashboards from JSON files in the current directory.
It will silently replace all existing dashboards with a same name.
Requires API key with admin rights.
## import-datasources
The example of use of Grafana HTTP API.
It imports all datasources from JSON files in the current directory.
It will silently replace all existing datasources with a same name.
Requires API key with admin rights.
| Add new examples to the doc | Add new examples to the doc
| Markdown | apache-2.0 | grafov/autograf,grafana-tools/sdk | markdown | ## Code Before:
The example of use of Grafana HTTP API.
Saves all dashboards to JSON files in the current directory.
Requires API key with admin rights.
## backup-datasources
The example of use of Grafana HTTP API.
Saves all datasources to JSON files in the current directory.
Requires API key with admin rights.
## Instruction:
Add new examples to the doc
## Code After:
The example of use of Grafana HTTP API.
Saves all dashboards to JSON files in the current directory.
Requires API key with admin rights.
## backup-datasources
The example of use of Grafana HTTP API.
Saves all datasources to JSON files in the current directory.
Requires API key with admin rights.
## import-dashboards
The example of use of Grafana HTTP API.
It imports all dashboards from JSON files in the current directory.
It will silently replace all existing dashboards with a same name.
Requires API key with admin rights.
## import-datasources
The example of use of Grafana HTTP API.
It imports all datasources from JSON files in the current directory.
It will silently replace all existing datasources with a same name.
Requires API key with admin rights.
|
The example of use of Grafana HTTP API.
Saves all dashboards to JSON files in the current directory.
Requires API key with admin rights.
## backup-datasources
The example of use of Grafana HTTP API.
Saves all datasources to JSON files in the current directory.
Requires API key with admin rights.
+ ## import-dashboards
+
+ The example of use of Grafana HTTP API.
+ It imports all dashboards from JSON files in the current directory.
+ It will silently replace all existing dashboards with a same name.
+ Requires API key with admin rights.
+
+ ## import-datasources
+
+ The example of use of Grafana HTTP API.
+ It imports all datasources from JSON files in the current directory.
+ It will silently replace all existing datasources with a same name.
+ Requires API key with admin rights.
+ | 14 | 1.272727 | 14 | 0 |
2f9eac2868c7a4e0577fd79858ae8b7e1878c6c6 | test/runIntTests.sh | test/runIntTests.sh | cd /home6/greg/GOMC/test
bash ./Setup_Examples.sh
python Run_Examples.py
# End of submit file
| cd /home6/greg/GOMC/test
bash ./Setup_Examples.sh
python Run_Examples.py > integrationTest.log
# End of submit file
| Add shell script to launch integration tests | Add shell script to launch integration tests
| Shell | mit | GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC | shell | ## Code Before:
cd /home6/greg/GOMC/test
bash ./Setup_Examples.sh
python Run_Examples.py
# End of submit file
## Instruction:
Add shell script to launch integration tests
## Code After:
cd /home6/greg/GOMC/test
bash ./Setup_Examples.sh
python Run_Examples.py > integrationTest.log
# End of submit file
| cd /home6/greg/GOMC/test
bash ./Setup_Examples.sh
- python Run_Examples.py
+ python Run_Examples.py > integrationTest.log
# End of submit file | 2 | 0.5 | 1 | 1 |
c8b0d04b279519471ba00708c0a34c47edbb889f | repos.yaml | repos.yaml | edx/loghandlersplus:
edx/ease:
edx/arch-prototype:
edx/djeventstream:
edx/xserver:
edx/discern:
edx/edxanalytics:
edx/insights:
edx/codejail:
edx/xqueue:
edx/js-test-tool:
edx/edx-e2e-tests:
edx/notifier:
edx/event-tracking:
edx/XBlock:
edx/edx-demo-course:
edx/cs_comments_service:
edx/diff-cover:
edx/edx-ora:
edx/edx-tim:
edx/edx-platform:
hidden-contributors:
- anant*
edx/configuration:
| edx/loghandlersplus:
edx/ease:
edx/arch-prototype:
edx/djeventstream:
edx/xserver:
edx/discern:
edx/edxanalytics:
edx/insights:
edx/codejail:
edx/xqueue:
edx/js-test-tool:
edx/edx-e2e-tests:
edx/notifier:
edx/event-tracking:
edx/XBlock:
edx/edx-demo-course:
edx/cs_comments_service:
edx/diff-cover:
edx/edx-ora:
edx/edx-tim:
edx/edx-platform:
hidden-contributors:
- aculich
- anant*
- kimtonyhyun
- rcchirwa
- terman
edx/configuration:
| Add some more hidden contributors | Add some more hidden contributors
| YAML | apache-2.0 | edx/repo-tools,edx/repo-tools | yaml | ## Code Before:
edx/loghandlersplus:
edx/ease:
edx/arch-prototype:
edx/djeventstream:
edx/xserver:
edx/discern:
edx/edxanalytics:
edx/insights:
edx/codejail:
edx/xqueue:
edx/js-test-tool:
edx/edx-e2e-tests:
edx/notifier:
edx/event-tracking:
edx/XBlock:
edx/edx-demo-course:
edx/cs_comments_service:
edx/diff-cover:
edx/edx-ora:
edx/edx-tim:
edx/edx-platform:
hidden-contributors:
- anant*
edx/configuration:
## Instruction:
Add some more hidden contributors
## Code After:
edx/loghandlersplus:
edx/ease:
edx/arch-prototype:
edx/djeventstream:
edx/xserver:
edx/discern:
edx/edxanalytics:
edx/insights:
edx/codejail:
edx/xqueue:
edx/js-test-tool:
edx/edx-e2e-tests:
edx/notifier:
edx/event-tracking:
edx/XBlock:
edx/edx-demo-course:
edx/cs_comments_service:
edx/diff-cover:
edx/edx-ora:
edx/edx-tim:
edx/edx-platform:
hidden-contributors:
- aculich
- anant*
- kimtonyhyun
- rcchirwa
- terman
edx/configuration:
| edx/loghandlersplus:
edx/ease:
edx/arch-prototype:
edx/djeventstream:
edx/xserver:
edx/discern:
edx/edxanalytics:
edx/insights:
edx/codejail:
edx/xqueue:
edx/js-test-tool:
edx/edx-e2e-tests:
edx/notifier:
edx/event-tracking:
edx/XBlock:
edx/edx-demo-course:
edx/cs_comments_service:
edx/diff-cover:
edx/edx-ora:
edx/edx-tim:
edx/edx-platform:
hidden-contributors:
+ - aculich
- anant*
+ - kimtonyhyun
+ - rcchirwa
+ - terman
edx/configuration: | 4 | 0.166667 | 4 | 0 |
2a7a7d7d24f237fdaf59a88935eed0e96c2f2439 | src/api/players/index.js | src/api/players/index.js | import isString from 'lodash/isString';
const ENDPOINT_PREFIX = 'players';
export default (http, options, parser) => {
async function getByName(playerName) {
console.log('Heads up! This endpoint currently does not work, it is here because it is listed in the API docs.');
if (!playerName) {
return new Error('Expected required playerName. Usage: .getByName(playerName)');
}
if (!isString(playerName)) {
return new Error('Expected a string for playerName');
}
const endpoint = `${ENDPOINT_PREFIX}`;
const defaults = { filter: { playerNames: '' } };
const query = { ...defaults, filter: { playerNames: playerName } };
const body = await http.execute('GET', `${ENDPOINT_PREFIX}`, query);
return parser('player', body);
}
async function getById(playerId) {
if (!playerId) {
return new Error('Expected required playerId. Usage: .single(playerId)');
}
if (!isString(playerId)) {
return new Error('Expected a string for playerId');
}
const endpoint = `${ENDPOINT_PREFIX}/${playerId}`;
const body = await http.execute('GET', endpoint);
return parser('player', body);
}
return { getByName, getById };
}
| import isString from 'lodash/isString';
const ENDPOINT_PREFIX = 'players';
export default (http, options, parser) => {
async function getByName(playerName) {
if (!playerName) {
return new Error('Expected required playerName. Usage: .getByName(playerName)');
}
if (!isString(playerName)) {
return new Error('Expected a string for playerName');
}
const endpoint = `${ENDPOINT_PREFIX}`;
const defaults = { filter: { playerName: '' } };
const query = { ...defaults, filter: { playerName: playerName } };
const body = await http.execute('GET', `${ENDPOINT_PREFIX}`, query);
return parser('player', body);
}
async function getById(playerId) {
if (!playerId) {
return new Error('Expected required playerId. Usage: .single(playerId)');
}
if (!isString(playerId)) {
return new Error('Expected a string for playerId');
}
const endpoint = `${ENDPOINT_PREFIX}/${playerId}`;
const body = await http.execute('GET', endpoint);
return parser('player', body);
}
return { getByName, getById };
}
| Fix for querying for player by username | Fix for querying for player by username
| JavaScript | mit | seripap/vainglory | javascript | ## Code Before:
import isString from 'lodash/isString';
const ENDPOINT_PREFIX = 'players';
export default (http, options, parser) => {
async function getByName(playerName) {
console.log('Heads up! This endpoint currently does not work, it is here because it is listed in the API docs.');
if (!playerName) {
return new Error('Expected required playerName. Usage: .getByName(playerName)');
}
if (!isString(playerName)) {
return new Error('Expected a string for playerName');
}
const endpoint = `${ENDPOINT_PREFIX}`;
const defaults = { filter: { playerNames: '' } };
const query = { ...defaults, filter: { playerNames: playerName } };
const body = await http.execute('GET', `${ENDPOINT_PREFIX}`, query);
return parser('player', body);
}
async function getById(playerId) {
if (!playerId) {
return new Error('Expected required playerId. Usage: .single(playerId)');
}
if (!isString(playerId)) {
return new Error('Expected a string for playerId');
}
const endpoint = `${ENDPOINT_PREFIX}/${playerId}`;
const body = await http.execute('GET', endpoint);
return parser('player', body);
}
return { getByName, getById };
}
## Instruction:
Fix for querying for player by username
## Code After:
import isString from 'lodash/isString';
const ENDPOINT_PREFIX = 'players';
export default (http, options, parser) => {
async function getByName(playerName) {
if (!playerName) {
return new Error('Expected required playerName. Usage: .getByName(playerName)');
}
if (!isString(playerName)) {
return new Error('Expected a string for playerName');
}
const endpoint = `${ENDPOINT_PREFIX}`;
const defaults = { filter: { playerName: '' } };
const query = { ...defaults, filter: { playerName: playerName } };
const body = await http.execute('GET', `${ENDPOINT_PREFIX}`, query);
return parser('player', body);
}
async function getById(playerId) {
if (!playerId) {
return new Error('Expected required playerId. Usage: .single(playerId)');
}
if (!isString(playerId)) {
return new Error('Expected a string for playerId');
}
const endpoint = `${ENDPOINT_PREFIX}/${playerId}`;
const body = await http.execute('GET', endpoint);
return parser('player', body);
}
return { getByName, getById };
}
| import isString from 'lodash/isString';
const ENDPOINT_PREFIX = 'players';
export default (http, options, parser) => {
async function getByName(playerName) {
- console.log('Heads up! This endpoint currently does not work, it is here because it is listed in the API docs.');
if (!playerName) {
return new Error('Expected required playerName. Usage: .getByName(playerName)');
}
if (!isString(playerName)) {
return new Error('Expected a string for playerName');
}
const endpoint = `${ENDPOINT_PREFIX}`;
- const defaults = { filter: { playerNames: '' } };
? -
+ const defaults = { filter: { playerName: '' } };
- const query = { ...defaults, filter: { playerNames: playerName } };
? -
+ const query = { ...defaults, filter: { playerName: playerName } };
const body = await http.execute('GET', `${ENDPOINT_PREFIX}`, query);
return parser('player', body);
}
async function getById(playerId) {
if (!playerId) {
return new Error('Expected required playerId. Usage: .single(playerId)');
}
if (!isString(playerId)) {
return new Error('Expected a string for playerId');
}
const endpoint = `${ENDPOINT_PREFIX}/${playerId}`;
const body = await http.execute('GET', endpoint);
return parser('player', body);
}
return { getByName, getById };
} | 5 | 0.125 | 2 | 3 |
8fa1cae882c0ff020c0b9c3c2fac9e4248d46ce4 | deploy/common/sqlite_wrapper.py | deploy/common/sqlite_wrapper.py | import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=OFF")
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, multi=False, many_rows=None):
try:
with self.conn as conn:
cursor = conn.cursor()
if many_rows:
cursor.executemany(sql, many_rows)
return
if multi:
cursor.executescript(sql)
if params is None and not multi:
cursor.execute(sql)
if params and not multi:
cursor.execute(sql, params)
if iterator:
return cursor
if fetch_one:
return cursor.fetchone()[0]
if not multi:
return cursor.fetchall()
except Exception as e:
raise Exception('Error in executing query ' + sql + ': ' + format(e))
def close(self):
self.conn.close()
| import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA page_size=4096")
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=NORMAL")
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, multi=False, many_rows=None):
try:
with self.conn as conn:
cursor = conn.cursor()
if many_rows:
cursor.executemany(sql, many_rows)
return
if multi:
cursor.executescript(sql)
if params is None and not multi:
cursor.execute(sql)
if params and not multi:
cursor.execute(sql, params)
if iterator:
return cursor
if fetch_one:
return cursor.fetchone()[0]
if not multi:
return cursor.fetchall()
except Exception as e:
raise Exception('Error in executing query ' + sql + ': ' + format(e))
def close(self):
self.conn.close()
| Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096. | Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096.
| Python | mit | mikispag/bitiodine | python | ## Code Before:
import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=OFF")
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, multi=False, many_rows=None):
try:
with self.conn as conn:
cursor = conn.cursor()
if many_rows:
cursor.executemany(sql, many_rows)
return
if multi:
cursor.executescript(sql)
if params is None and not multi:
cursor.execute(sql)
if params and not multi:
cursor.execute(sql, params)
if iterator:
return cursor
if fetch_one:
return cursor.fetchone()[0]
if not multi:
return cursor.fetchall()
except Exception as e:
raise Exception('Error in executing query ' + sql + ': ' + format(e))
def close(self):
self.conn.close()
## Instruction:
Use PRAGMA synchronous=NORMAL instead of OFF, and set page_size to 4096.
## Code After:
import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
self.cursor.execute("PRAGMA page_size=4096")
self.cursor.execute("PRAGMA cache_size=-16000")
self.cursor.execute("PRAGMA synchronous=NORMAL")
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, multi=False, many_rows=None):
try:
with self.conn as conn:
cursor = conn.cursor()
if many_rows:
cursor.executemany(sql, many_rows)
return
if multi:
cursor.executescript(sql)
if params is None and not multi:
cursor.execute(sql)
if params and not multi:
cursor.execute(sql, params)
if iterator:
return cursor
if fetch_one:
return cursor.fetchone()[0]
if not multi:
return cursor.fetchall()
except Exception as e:
raise Exception('Error in executing query ' + sql + ': ' + format(e))
def close(self):
self.conn.close()
| import sqlite3
class SQLiteWrapper:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
+ self.cursor.execute("PRAGMA page_size=4096")
self.cursor.execute("PRAGMA cache_size=-16000")
- self.cursor.execute("PRAGMA synchronous=OFF")
? ^^
+ self.cursor.execute("PRAGMA synchronous=NORMAL")
? + ^^^^
self.conn.commit()
def query(self, sql, params=None, iterator=False, fetch_one=False, multi=False, many_rows=None):
try:
with self.conn as conn:
cursor = conn.cursor()
if many_rows:
cursor.executemany(sql, many_rows)
return
if multi:
cursor.executescript(sql)
if params is None and not multi:
cursor.execute(sql)
if params and not multi:
cursor.execute(sql, params)
if iterator:
return cursor
if fetch_one:
return cursor.fetchone()[0]
if not multi:
return cursor.fetchall()
except Exception as e:
raise Exception('Error in executing query ' + sql + ': ' + format(e))
def close(self):
self.conn.close() | 3 | 0.088235 | 2 | 1 |
c6a9932600ca2b1ee549ac9ca6380605afed0244 | spec/spec_helper.rb | spec/spec_helper.rb | require 'active_record'
require 'polymorpheus'
require 'stringio'
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
ActiveRecord::Base.establish_connection({
adapter: 'mysql2',
username: 'travis',
database: 'polymorpheus_test'
})
Dir[File.dirname(__FILE__) + '/support/*.rb'].sort.each { |path| require path }
Polymorpheus::Adapter.load!
# This is normally done via a Railtie in non-testing situations.
ActiveRecord::SchemaDumper.class_eval { include Polymorpheus::SchemaDumper }
ActiveRecord::Migration.verbose = false
RSpec.configure do |config|
config.include ConnectionHelpers
config.include SchemaHelpers
config.include SqlTestHelpers
config.after do
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
end
end
| require 'active_record'
require 'polymorpheus'
require 'stringio'
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
ActiveRecord::Base.establish_connection({
adapter: 'mysql2',
username: 'travis',
database: 'polymorpheus_test'
})
Dir[File.dirname(__FILE__) + '/support/*.rb'].sort.each { |path| require path }
Polymorpheus::Adapter.load!
# This is normally done via a Railtie in non-testing situations.
ActiveRecord::SchemaDumper.class_eval { include Polymorpheus::SchemaDumper }
ActiveRecord::Migration.verbose = false
RSpec.configure do |config|
config.order = :random
Kernel.srand config.seed
config.include ConnectionHelpers
config.include SchemaHelpers
config.include SqlTestHelpers
config.after do
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
end
end
| Configure rspec to randomize order | Configure rspec to randomize order
| Ruby | mit | wegowise/polymorpheus | ruby | ## Code Before:
require 'active_record'
require 'polymorpheus'
require 'stringio'
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
ActiveRecord::Base.establish_connection({
adapter: 'mysql2',
username: 'travis',
database: 'polymorpheus_test'
})
Dir[File.dirname(__FILE__) + '/support/*.rb'].sort.each { |path| require path }
Polymorpheus::Adapter.load!
# This is normally done via a Railtie in non-testing situations.
ActiveRecord::SchemaDumper.class_eval { include Polymorpheus::SchemaDumper }
ActiveRecord::Migration.verbose = false
RSpec.configure do |config|
config.include ConnectionHelpers
config.include SchemaHelpers
config.include SqlTestHelpers
config.after do
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
end
end
## Instruction:
Configure rspec to randomize order
## Code After:
require 'active_record'
require 'polymorpheus'
require 'stringio'
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
ActiveRecord::Base.establish_connection({
adapter: 'mysql2',
username: 'travis',
database: 'polymorpheus_test'
})
Dir[File.dirname(__FILE__) + '/support/*.rb'].sort.each { |path| require path }
Polymorpheus::Adapter.load!
# This is normally done via a Railtie in non-testing situations.
ActiveRecord::SchemaDumper.class_eval { include Polymorpheus::SchemaDumper }
ActiveRecord::Migration.verbose = false
RSpec.configure do |config|
config.order = :random
Kernel.srand config.seed
config.include ConnectionHelpers
config.include SchemaHelpers
config.include SqlTestHelpers
config.after do
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
end
end
| require 'active_record'
require 'polymorpheus'
require 'stringio'
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
ActiveRecord::Base.establish_connection({
adapter: 'mysql2',
username: 'travis',
database: 'polymorpheus_test'
})
Dir[File.dirname(__FILE__) + '/support/*.rb'].sort.each { |path| require path }
Polymorpheus::Adapter.load!
# This is normally done via a Railtie in non-testing situations.
ActiveRecord::SchemaDumper.class_eval { include Polymorpheus::SchemaDumper }
ActiveRecord::Migration.verbose = false
RSpec.configure do |config|
+ config.order = :random
+ Kernel.srand config.seed
+
config.include ConnectionHelpers
config.include SchemaHelpers
config.include SqlTestHelpers
config.after do
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
end
end | 3 | 0.096774 | 3 | 0 |
4a48fedc267ef9c2705050edd6998739a974d5c1 | app/views/pages/about.html.erb | app/views/pages/about.html.erb | <% content_for :title do %>About<% end %>
<h3>About Foobar Kadigan</h3>
<p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
<p>His favorite quotation is:</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
| <% content_for :title do %>About<% end %>
<section>
<div class="container jumbotron">
<div class="row">
<div class="col-md-12">
<h2>About Foobar Kadigan</h2>
<p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
<p>His favorite quotation is:</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
</div>
</section> | Add style to about page | Add style to about page
| HTML+ERB | bsd-3-clause | oscarmcm/invite-me,oscarmcm/invite-me,oscarmcm/invite-me,oscarmcm/invite-me | html+erb | ## Code Before:
<% content_for :title do %>About<% end %>
<h3>About Foobar Kadigan</h3>
<p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
<p>His favorite quotation is:</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
## Instruction:
Add style to about page
## Code After:
<% content_for :title do %>About<% end %>
<section>
<div class="container jumbotron">
<div class="row">
<div class="col-md-12">
<h2>About Foobar Kadigan</h2>
<p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
<p>His favorite quotation is:</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
</div>
</section> | <% content_for :title do %>About<% end %>
+ <section>
+ <div class="container jumbotron">
+ <div class="row">
+ <div class="col-md-12">
- <h3>About Foobar Kadigan</h3>
? ^ ^
+ <h2>About Foobar Kadigan</h2>
? ++++ ^ ^
- <p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
+ <p>He was born in Waikikamukau, New Zealand. He left New Zealand for England, excelled at the University of Mopery, and served in the Royal Loamshire Regiment. While in service, he invented the kanuten valve used in the processing of unobtainium for industrial use. With a partner, Granda Fairbook, he founded Acme Manufacturing, later acquired by the Advent Corporation, to develop his discovery for use in the Turboencabulator. Mr. Kadigan is now retired and lives in Middlehampton with a favorite cat, where he raises Griadium frieda and collects metasyntactic variables.</p>
? ++++
- <p>His favorite quotation is:</p>
+ <p>His favorite quotation is:</p>
? ++++
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
? ++++
+ </div>
+ </div>
+ </div>
+ </section> | 16 | 3.2 | 12 | 4 |
59455fe23f7c35b4feb307ff7fb40bbb5b2aa206 | test/dummy/config/database.yml | test/dummy/config/database.yml | test:
:adapter: oracle_enhanced
:username: rails_audit_test
:password: rails_audit_test
:database: railyard
| oracle: &oracle
adapter: oracle_enhanced
username: rails_audit_test
password: rails_audit_test
database: railyard
test:
<<: *<%= ENV['DB'] || "oracle" %>
| Add structure for switching out DB backend in tests based on ENV. | Add structure for switching out DB backend in tests based on ENV.
Intended to resurrect test runs in Postgresql.
| YAML | mit | rst/smartguard,rst/smartguard | yaml | ## Code Before:
test:
:adapter: oracle_enhanced
:username: rails_audit_test
:password: rails_audit_test
:database: railyard
## Instruction:
Add structure for switching out DB backend in tests based on ENV.
Intended to resurrect test runs in Postgresql.
## Code After:
oracle: &oracle
adapter: oracle_enhanced
username: rails_audit_test
password: rails_audit_test
database: railyard
test:
<<: *<%= ENV['DB'] || "oracle" %>
| + oracle: &oracle
+ adapter: oracle_enhanced
+ username: rails_audit_test
+ password: rails_audit_test
+ database: railyard
+
test:
+ <<: *<%= ENV['DB'] || "oracle" %>
- :adapter: oracle_enhanced
- :username: rails_audit_test
- :password: rails_audit_test
- :database: railyard | 11 | 2.2 | 7 | 4 |
f073ba047cfbcbf57dd4b30452f8ba60701ed555 | gig/gig01-01/README.md | gig/gig01-01/README.md |
[](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/gcp-getting-started-lab-jp&cloudshell_working_dir=gig/gig01-01&cloudshell_tutorial=tutorial.md)
**This is not an officially supported Google product**.
see [tutorial.md](tutorial.md) for more details
|
[](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/gcp-getting-started-lab-jp&cloudshell_working_dir=gig/gig01-01&cloudshell_tutorial=tutorial.md)
**This is not an officially supported Google product**.
See [tutorial.md](tutorial.md) for more details.
Run following command to launch a tutorial.
```
teachme tutorial.md
```
| Add command to launch a tutorial | Add command to launch a tutorial
| Markdown | apache-2.0 | GoogleCloudPlatform/gcp-getting-started-lab-jp,GoogleCloudPlatform/gcp-getting-started-lab-jp,GoogleCloudPlatform/gcp-getting-started-lab-jp,GoogleCloudPlatform/gcp-getting-started-lab-jp | markdown | ## Code Before:
[](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/gcp-getting-started-lab-jp&cloudshell_working_dir=gig/gig01-01&cloudshell_tutorial=tutorial.md)
**This is not an officially supported Google product**.
see [tutorial.md](tutorial.md) for more details
## Instruction:
Add command to launch a tutorial
## Code After:
[](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/gcp-getting-started-lab-jp&cloudshell_working_dir=gig/gig01-01&cloudshell_tutorial=tutorial.md)
**This is not an officially supported Google product**.
See [tutorial.md](tutorial.md) for more details.
Run following command to launch a tutorial.
```
teachme tutorial.md
```
|
[](https://ssh.cloud.google.com/cloudshell/open?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/gcp-getting-started-lab-jp&cloudshell_working_dir=gig/gig01-01&cloudshell_tutorial=tutorial.md)
**This is not an officially supported Google product**.
- see [tutorial.md](tutorial.md) for more details
? ^
+ See [tutorial.md](tutorial.md) for more details.
? ^ +
+
+ Run following command to launch a tutorial.
+
+ ```
+ teachme tutorial.md
+ ``` | 8 | 1.333333 | 7 | 1 |
7c1a118488224d37ff152fef2edc3942aa4b5a24 | src/main/java/org/cryptomator/cryptolib/api/CryptoLibVersion.java | src/main/java/org/cryptomator/cryptolib/api/CryptoLibVersion.java | /*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CryptoLibVersion {
Version value() default Version.ONE;
public enum Version {
ONE
}
}
| /*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CryptoLibVersion {
Version value();
public enum Version {
ONE
}
}
| Enforce explicit declaration of required CryptorProvider version | Enforce explicit declaration of required CryptorProvider version [ci skip]
| Java | agpl-3.0 | cryptomator/cryptolib | java | ## Code Before:
/*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CryptoLibVersion {
Version value() default Version.ONE;
public enum Version {
ONE
}
}
## Instruction:
Enforce explicit declaration of required CryptorProvider version [ci skip]
## Code After:
/*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CryptoLibVersion {
Version value();
public enum Version {
ONE
}
}
| /*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface CryptoLibVersion {
- Version value() default Version.ONE;
+ Version value();
public enum Version {
ONE
}
} | 2 | 0.076923 | 1 | 1 |
f7d9d0a57f691a4d9104ab00c75e1cca8cb2142f | src/history.js | src/history.js | const timetrack = require('./timetrack');
const calculateDuration = require('./calculateDuration');
module.exports = (pluginContext) => {
return (project, env = {}) => {
return new Promise((resolve, reject) => {
timetrack.loadData();
resolve(timetrack.getHistory().map(entry => {
// get the duration of the entry
let duration = 'Running';
if ('stop' in entry) {
duration = calculateDuration(entry.start, entry.stop);
}
// get the project name
const project = entry.project || 'No project';
return {
icon: 'fa-clock-o',
title: `[${duration}] ${project}`,
subtitle: `Nice work bro!`
}
}));
});
}
}
| const timetrack = require('./timetrack');
const Sugar = require('sugar-date');
const calculateDuration = require('./calculateDuration');
module.exports = (pluginContext) => {
return (project, env = {}) => {
return new Promise((resolve, reject) => {
timetrack.loadData();
resolve(timetrack.getHistory().map(entry => {
try {
// get the duration of the entry
let duration = 'Running';
if ('stop' in entry) {
// sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later
duration = Sugar.Date.format(Sugar.Date.create(entry.stop - entry.start - 3600000), '%H:%M:%S');
}
// get the project name
const project = entry.project || 'No project';
// get the start date
const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%c')
return {
icon: 'fa-clock-o',
title: `[${duration}] ${project}`,
subtitle: `started on ${startDate}`
}
} catch (e) {
alert('fount: ' + e);
}
}));
});
}
}
| Use sugarjs for date parsing | Use sugarjs for date parsing
| JavaScript | mit | jnstr/zazu-timetracker | javascript | ## Code Before:
const timetrack = require('./timetrack');
const calculateDuration = require('./calculateDuration');
module.exports = (pluginContext) => {
return (project, env = {}) => {
return new Promise((resolve, reject) => {
timetrack.loadData();
resolve(timetrack.getHistory().map(entry => {
// get the duration of the entry
let duration = 'Running';
if ('stop' in entry) {
duration = calculateDuration(entry.start, entry.stop);
}
// get the project name
const project = entry.project || 'No project';
return {
icon: 'fa-clock-o',
title: `[${duration}] ${project}`,
subtitle: `Nice work bro!`
}
}));
});
}
}
## Instruction:
Use sugarjs for date parsing
## Code After:
const timetrack = require('./timetrack');
const Sugar = require('sugar-date');
const calculateDuration = require('./calculateDuration');
module.exports = (pluginContext) => {
return (project, env = {}) => {
return new Promise((resolve, reject) => {
timetrack.loadData();
resolve(timetrack.getHistory().map(entry => {
try {
// get the duration of the entry
let duration = 'Running';
if ('stop' in entry) {
// sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later
duration = Sugar.Date.format(Sugar.Date.create(entry.stop - entry.start - 3600000), '%H:%M:%S');
}
// get the project name
const project = entry.project || 'No project';
// get the start date
const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%c')
return {
icon: 'fa-clock-o',
title: `[${duration}] ${project}`,
subtitle: `started on ${startDate}`
}
} catch (e) {
alert('fount: ' + e);
}
}));
});
}
}
| const timetrack = require('./timetrack');
+ const Sugar = require('sugar-date');
const calculateDuration = require('./calculateDuration');
module.exports = (pluginContext) => {
return (project, env = {}) => {
return new Promise((resolve, reject) => {
timetrack.loadData();
resolve(timetrack.getHistory().map(entry => {
+ try {
// get the duration of the entry
let duration = 'Running';
if ('stop' in entry) {
- duration = calculateDuration(entry.start, entry.stop);
+ // sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later
+ duration = Sugar.Date.format(Sugar.Date.create(entry.stop - entry.start - 3600000), '%H:%M:%S');
}
// get the project name
const project = entry.project || 'No project';
+ // get the start date
+ const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%c')
+
return {
icon: 'fa-clock-o',
title: `[${duration}] ${project}`,
- subtitle: `Nice work bro!`
+ subtitle: `started on ${startDate}`
+ }
+ } catch (e) {
+ alert('fount: ' + e);
}
}));
});
}
} | 13 | 0.5 | 11 | 2 |
dd1e0fda50e6ccc61d2c754394061299acbe751d | haskell/robot-name/Robot.hs | haskell/robot-name/Robot.hs | module Robot
( mkRobot
, resetName
, robotName
) where
import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, readMVar, tryTakeMVar)
import System.Random (newStdGen, randomRs)
data Robot = Robot (MVar String)
mkRobot :: IO Robot
mkRobot = do
var <- newEmptyMVar
let robot = Robot var
resetName robot
return robot
resetName :: Robot -> IO ()
resetName (Robot var) = do
gen <- newStdGen
let letters = take 2 (randomRs ('A', 'Z') gen)
gen <- newStdGen
let numbers = take 3 (randomRs ('0', '9') gen)
tryTakeMVar var
putMVar var $ letters ++ numbers
robotName :: Robot -> IO String
robotName (Robot var) = readMVar var
| module Robot
( mkRobot
, resetName
, robotName
) where
import GHC.Conc (TVar, atomically, newTVar, readTVar, writeTVar)
import System.Random (randomRIO)
data Robot = Robot (TVar String)
mkRobot :: IO Robot
mkRobot = do
var <- atomically $ newTVar ""
let robot = Robot var
resetName robot
return robot
resetName :: Robot -> IO ()
resetName (Robot var) = do
a <- randomRIO ('A', 'Z')
b <- randomRIO ('A', 'Z')
c <- randomRIO ('0', '9')
d <- randomRIO ('0', '9')
e <- randomRIO ('0', '9')
atomically $ writeTVar var [a, b, c, d, e]
robotName :: Robot -> IO String
robotName (Robot var) = atomically $ readTVar var
| Use TVar instead of MVar | Use TVar instead of MVar
| Haskell | mit | tfausak/exercism-solutions,tfausak/exercism-solutions,tfausak/exercism-solutions | haskell | ## Code Before:
module Robot
( mkRobot
, resetName
, robotName
) where
import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, readMVar, tryTakeMVar)
import System.Random (newStdGen, randomRs)
data Robot = Robot (MVar String)
mkRobot :: IO Robot
mkRobot = do
var <- newEmptyMVar
let robot = Robot var
resetName robot
return robot
resetName :: Robot -> IO ()
resetName (Robot var) = do
gen <- newStdGen
let letters = take 2 (randomRs ('A', 'Z') gen)
gen <- newStdGen
let numbers = take 3 (randomRs ('0', '9') gen)
tryTakeMVar var
putMVar var $ letters ++ numbers
robotName :: Robot -> IO String
robotName (Robot var) = readMVar var
## Instruction:
Use TVar instead of MVar
## Code After:
module Robot
( mkRobot
, resetName
, robotName
) where
import GHC.Conc (TVar, atomically, newTVar, readTVar, writeTVar)
import System.Random (randomRIO)
data Robot = Robot (TVar String)
mkRobot :: IO Robot
mkRobot = do
var <- atomically $ newTVar ""
let robot = Robot var
resetName robot
return robot
resetName :: Robot -> IO ()
resetName (Robot var) = do
a <- randomRIO ('A', 'Z')
b <- randomRIO ('A', 'Z')
c <- randomRIO ('0', '9')
d <- randomRIO ('0', '9')
e <- randomRIO ('0', '9')
atomically $ writeTVar var [a, b, c, d, e]
robotName :: Robot -> IO String
robotName (Robot var) = atomically $ readTVar var
| module Robot
( mkRobot
, resetName
, robotName
) where
- import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, readMVar, tryTakeMVar)
+ import GHC.Conc (TVar, atomically, newTVar, readTVar, writeTVar)
- import System.Random (newStdGen, randomRs)
? ----------- ^
+ import System.Random (randomRIO)
? ^^
- data Robot = Robot (MVar String)
? ^
+ data Robot = Robot (TVar String)
? ^
mkRobot :: IO Robot
mkRobot = do
- var <- newEmptyMVar
+ var <- atomically $ newTVar ""
let robot = Robot var
resetName robot
return robot
resetName :: Robot -> IO ()
resetName (Robot var) = do
- gen <- newStdGen
- let letters = take 2 (randomRs ('A', 'Z') gen)
- gen <- newStdGen
- let numbers = take 3 (randomRs ('0', '9') gen)
- tryTakeMVar var
- putMVar var $ letters ++ numbers
+ a <- randomRIO ('A', 'Z')
+ b <- randomRIO ('A', 'Z')
+ c <- randomRIO ('0', '9')
+ d <- randomRIO ('0', '9')
+ e <- randomRIO ('0', '9')
+ atomically $ writeTVar var [a, b, c, d, e]
robotName :: Robot -> IO String
- robotName (Robot var) = readMVar var
? ^
+ robotName (Robot var) = atomically $ readTVar var
? +++++++++++++ ^
| 22 | 0.758621 | 11 | 11 |
4fb6cd2b73deb500d664c1a0d2d6c57b11626a7e | tests/pyutils/test_path.py | tests/pyutils/test_path.py | from graphql.pyutils import Path
def describe_path():
def add_path():
path = Path(None, 0, None)
assert path.prev is None
assert path.key == 0
prev, path = path, Path(path, 1, None)
assert path.prev is prev
assert path.key == 1
prev, path = path, Path(path, "two", None)
assert path.prev is prev
assert path.key == "two"
def add_key():
prev = Path(None, 0, None)
path = prev.add_key("one")
assert path.prev is prev
assert path.key == "one"
def as_list():
path = Path(None, 1, None)
assert path.as_list() == [1]
path = path.add_key("two")
assert path.as_list() == [1, "two"]
path = path.add_key(3)
assert path.as_list() == [1, "two", 3]
| from graphql.pyutils import Path
def describe_path():
def can_create_a_path():
first = Path(None, 1, "First")
assert first.prev is None
assert first.key == 1
assert first.typename == "First"
def can_add_a_new_key_to_an_existing_path():
first = Path(None, 1, "First")
second = first.add_key("two", "Second")
assert second.prev is first
assert second.key == "two"
assert second.typename == "Second"
def can_convert_a_path_to_a_list_of_its_keys():
root = Path(None, 0, "Root")
assert root.as_list() == [0]
first = root.add_key("one", "First")
assert first.as_list() == [0, "one"]
second = first.add_key(2, "Second")
assert second.as_list() == [0, "one", 2]
| Improve tests for Path methods | Improve tests for Path methods
Replicates graphql/graphql-js@f42cee922d13576b1452bb5bf6c7b155bf0e2ecd
| Python | mit | graphql-python/graphql-core | python | ## Code Before:
from graphql.pyutils import Path
def describe_path():
def add_path():
path = Path(None, 0, None)
assert path.prev is None
assert path.key == 0
prev, path = path, Path(path, 1, None)
assert path.prev is prev
assert path.key == 1
prev, path = path, Path(path, "two", None)
assert path.prev is prev
assert path.key == "two"
def add_key():
prev = Path(None, 0, None)
path = prev.add_key("one")
assert path.prev is prev
assert path.key == "one"
def as_list():
path = Path(None, 1, None)
assert path.as_list() == [1]
path = path.add_key("two")
assert path.as_list() == [1, "two"]
path = path.add_key(3)
assert path.as_list() == [1, "two", 3]
## Instruction:
Improve tests for Path methods
Replicates graphql/graphql-js@f42cee922d13576b1452bb5bf6c7b155bf0e2ecd
## Code After:
from graphql.pyutils import Path
def describe_path():
def can_create_a_path():
first = Path(None, 1, "First")
assert first.prev is None
assert first.key == 1
assert first.typename == "First"
def can_add_a_new_key_to_an_existing_path():
first = Path(None, 1, "First")
second = first.add_key("two", "Second")
assert second.prev is first
assert second.key == "two"
assert second.typename == "Second"
def can_convert_a_path_to_a_list_of_its_keys():
root = Path(None, 0, "Root")
assert root.as_list() == [0]
first = root.add_key("one", "First")
assert first.as_list() == [0, "one"]
second = first.add_key(2, "Second")
assert second.as_list() == [0, "one", 2]
| from graphql.pyutils import Path
def describe_path():
- def add_path():
- path = Path(None, 0, None)
+ def can_create_a_path():
+ first = Path(None, 1, "First")
- assert path.prev is None
? ^^ -
+ assert first.prev is None
? ^^^^
- assert path.key == 0
- prev, path = path, Path(path, 1, None)
- assert path.prev is prev
- assert path.key == 1
? ^^ -
+ assert first.key == 1
? ^^^^
+ assert first.typename == "First"
- prev, path = path, Path(path, "two", None)
- assert path.prev is prev
- assert path.key == "two"
- def add_key():
- prev = Path(None, 0, None)
- path = prev.add_key("one")
- assert path.prev is prev
+ def can_add_a_new_key_to_an_existing_path():
+ first = Path(None, 1, "First")
+ second = first.add_key("two", "Second")
+ assert second.prev is first
- assert path.key == "one"
? ^^^^ --
+ assert second.key == "two"
? ^^^^^^ ++
+ assert second.typename == "Second"
- def as_list():
+ def can_convert_a_path_to_a_list_of_its_keys():
- path = Path(None, 1, None)
? ^^ - ^ ^ ^^
+ root = Path(None, 0, "Root")
? ^^^ ^ ^^ ^^^
- assert path.as_list() == [1]
? ^^ - ^
+ assert root.as_list() == [0]
? ^^^ ^
- path = path.add_key("two")
+ first = root.add_key("one", "First")
- assert path.as_list() == [1, "two"]
? ^^ - ^ --
+ assert first.as_list() == [0, "one"]
? ^^^^ ^ ++
- path = path.add_key(3)
+ second = first.add_key(2, "Second")
- assert path.as_list() == [1, "two", 3]
? ^^^^ ^ -- ^
+ assert second.as_list() == [0, "one", 2]
? ^^^^^^ ^ ++ ^
| 40 | 1.428571 | 18 | 22 |
d540d8717b2844cf4863b93a504d2dfb65ce5f9a | App/Views/Interests.js | App/Views/Interests.js | import React, { Component } from 'react'
import {
Text,
View,
StyleSheet,
TouchableHighlight,
Image
} from 'react-native'
export default class Interests extends Component {
render () {
return (
<View style={styles.container}>
<Image
style={styles.logo}
source={{uri: 'http://www.fillmurray.com/150/150'}}
/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff'
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 60,
color: 'blue'
}
})
| import React, { Component } from 'react'
import {
Text,
View,
StyleSheet,
TouchableHighlight,
Image
} from 'react-native'
export default class Interests extends Component {
render () {
return (
<View style={styles.container}>
<Image
style={styles.image}
source={{ uri: 'http://www.fillmurray.com/150/150' }}
/>
<Text> Interests </Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff'
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 60,
color: 'blue'
},
image: {
width: 150,
height: 150
}
})
| Add initial image to interests | Add initial image to interests
| JavaScript | mit | FAC7/anna-freud-hub,FAC7/anna-freud-hub,FAC7/anna-freud-hub | javascript | ## Code Before:
import React, { Component } from 'react'
import {
Text,
View,
StyleSheet,
TouchableHighlight,
Image
} from 'react-native'
export default class Interests extends Component {
render () {
return (
<View style={styles.container}>
<Image
style={styles.logo}
source={{uri: 'http://www.fillmurray.com/150/150'}}
/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff'
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 60,
color: 'blue'
}
})
## Instruction:
Add initial image to interests
## Code After:
import React, { Component } from 'react'
import {
Text,
View,
StyleSheet,
TouchableHighlight,
Image
} from 'react-native'
export default class Interests extends Component {
render () {
return (
<View style={styles.container}>
<Image
style={styles.image}
source={{ uri: 'http://www.fillmurray.com/150/150' }}
/>
<Text> Interests </Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff'
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 60,
color: 'blue'
},
image: {
width: 150,
height: 150
}
})
| import React, { Component } from 'react'
import {
Text,
View,
StyleSheet,
TouchableHighlight,
Image
} from 'react-native'
export default class Interests extends Component {
render () {
return (
<View style={styles.container}>
<Image
- style={styles.logo}
? ^^ ^
+ style={styles.image}
? ^^^ ^
- source={{uri: 'http://www.fillmurray.com/150/150'}}
+ source={{ uri: 'http://www.fillmurray.com/150/150' }}
? + +
/>
+ <Text> Interests </Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff'
},
title: {
fontSize: 20,
textAlign: 'center',
margin: 60,
color: 'blue'
+ },
+ image: {
+ width: 150,
+ height: 150
}
}) | 9 | 0.264706 | 7 | 2 |
0acac7a26b14208ec4c3f392bc869ca2d1a6d875 | app/views/homepage/about.html.erb | app/views/homepage/about.html.erb | <div class="col-md-8">
<div class="row">
<p>I am the about page. This is content. Youre reading it. High five!</p>
<p>This is a demo service-oriented architecture app which uses a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
Puma, and Heroku. Two API endpoints are utilized to return gas price information to the user. Once a day,
the application checks when each state's regular unleaded gas price was last updated, and scrapes
<a href="http://fuelgaugereport.aaa.com/import/display.php?lt=state" target="_blank">the aaa.com website</a> for
updated information. This application's states are then updated, and you have the incredible pleasure of reading
each state's regular unleaded gasoline per gallon price right here in your very own web browser.
</p>
<p>
Site by <a href="http://techarchist.com/" target="_blank">Todd Morningstar</a> |
<a href="https://github.com/stratigos" target="_blank">https://github.com/stratigos</a>
</p>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm text-center">
<p>I am a sidebar element</p>
</div>
<div class="well well-sm text-center">
<p>I am another sidebar element</p>
</div>
</div>
| <div class="col-md-8">
<div class="row">
<p>I am the about page. This is content. Youre reading it. High five!</p>
<p>This is a demo of a service-oriented architecture app. It employs a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
Puma, and Heroku. Two API endpoints are utilized to return gas price information to the user. Once a day,
the application checks when each state's regular unleaded gas price was last updated, and scrapes
<a href="http://fuelgaugereport.aaa.com/import/display.php?lt=state" target="_blank">the aaa.com website</a> for
updated information. This application's states are then updated, and you have the incredible pleasure of reading
each state's regular unleaded gasoline per gallon price right here in your very own web browser.
</p>
<p>
Site by <a href="http://techarchist.com/" target="_blank">Todd Morningstar</a> |
<a href="https://github.com/stratigos" target="_blank">https://github.com/stratigos</a>
</p>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm text-center">
<p>I am a sidebar element</p>
</div>
<div class="well well-sm text-center">
<p>I am another sidebar element</p>
</div>
</div>
| Correct grammar / wording on About page; | Correct grammar / wording on About page;
| HTML+ERB | mit | stratigos/gasprices,stratigos/gasprices,stratigos/gasprices | html+erb | ## Code Before:
<div class="col-md-8">
<div class="row">
<p>I am the about page. This is content. Youre reading it. High five!</p>
<p>This is a demo service-oriented architecture app which uses a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
Puma, and Heroku. Two API endpoints are utilized to return gas price information to the user. Once a day,
the application checks when each state's regular unleaded gas price was last updated, and scrapes
<a href="http://fuelgaugereport.aaa.com/import/display.php?lt=state" target="_blank">the aaa.com website</a> for
updated information. This application's states are then updated, and you have the incredible pleasure of reading
each state's regular unleaded gasoline per gallon price right here in your very own web browser.
</p>
<p>
Site by <a href="http://techarchist.com/" target="_blank">Todd Morningstar</a> |
<a href="https://github.com/stratigos" target="_blank">https://github.com/stratigos</a>
</p>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm text-center">
<p>I am a sidebar element</p>
</div>
<div class="well well-sm text-center">
<p>I am another sidebar element</p>
</div>
</div>
## Instruction:
Correct grammar / wording on About page;
## Code After:
<div class="col-md-8">
<div class="row">
<p>I am the about page. This is content. Youre reading it. High five!</p>
<p>This is a demo of a service-oriented architecture app. It employs a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
Puma, and Heroku. Two API endpoints are utilized to return gas price information to the user. Once a day,
the application checks when each state's regular unleaded gas price was last updated, and scrapes
<a href="http://fuelgaugereport.aaa.com/import/display.php?lt=state" target="_blank">the aaa.com website</a> for
updated information. This application's states are then updated, and you have the incredible pleasure of reading
each state's regular unleaded gasoline per gallon price right here in your very own web browser.
</p>
<p>
Site by <a href="http://techarchist.com/" target="_blank">Todd Morningstar</a> |
<a href="https://github.com/stratigos" target="_blank">https://github.com/stratigos</a>
</p>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm text-center">
<p>I am a sidebar element</p>
</div>
<div class="well well-sm text-center">
<p>I am another sidebar element</p>
</div>
</div>
| <div class="col-md-8">
<div class="row">
<p>I am the about page. This is content. Youre reading it. High five!</p>
- <p>This is a demo service-oriented architecture app which uses a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
? ^^^^^ --
+ <p>This is a demo of a service-oriented architecture app. It employs a stack of Rails 4, jQuery, Bootstrap, PostgreSQL,
? +++++ + ^^ +++++
Puma, and Heroku. Two API endpoints are utilized to return gas price information to the user. Once a day,
the application checks when each state's regular unleaded gas price was last updated, and scrapes
<a href="http://fuelgaugereport.aaa.com/import/display.php?lt=state" target="_blank">the aaa.com website</a> for
updated information. This application's states are then updated, and you have the incredible pleasure of reading
each state's regular unleaded gasoline per gallon price right here in your very own web browser.
</p>
<p>
Site by <a href="http://techarchist.com/" target="_blank">Todd Morningstar</a> |
<a href="https://github.com/stratigos" target="_blank">https://github.com/stratigos</a>
</p>
</div>
</div>
<div class="col-md-4">
<div class="well well-sm text-center">
<p>I am a sidebar element</p>
</div>
<div class="well well-sm text-center">
<p>I am another sidebar element</p>
</div>
</div> | 2 | 0.083333 | 1 | 1 |
170b311ad7e326fd845fd2f2b813f381173a570c | src/cljs/cglossa/search_inputs.cljs | src/cljs/cglossa/search_inputs.cljs | (ns cglossa.search-inputs
(:require [clojure.string :as str]))
(defn cwb-search-inputs [{:keys [search-query]}]
(let [query (:query @search-query)
displayed-query (str/replace query #"\[\(?\w+=\"(.+?)\"(?:\s+%c)?\)?\]" "$1")
phonetic? (not= -1 (.indexOf query "phon="))]
[:div.row-fluid
[:form.form-inline.span12
[:div.span10
[:input.span12 {:type "text" :value displayed-query
:on-change #(swap! search-query assoc-in [:query] (aget % "target" "value"))}]
[:label {:style {:marginTop 5}}]
[:input {:name "phonetic" :type "checkbox"
:style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))
(def components {:cwb cwb-search-inputs
:cwb-speech (fn [] [:div "CWB-SPEECHE"])})
| (ns cglossa.search-inputs
(:require [clojure.string :as str]))
(defn- convert-to-cqp [value phonetic?]
(let [attr (if phonetic? "phon" "word")
chinese-chars-range "[\u4E00-\u9FFF\u3400-\u4DFF\uF900-\uFAFF]"
value (str/replace value (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
(->> (str/split value #"\s")
(map #(if (= % "")
""
(str "[" attr "=\"" % "\" %c]")))
(str/join " "))))
(defn- handle-text-changed [event search-query phonetic?]
(let [value (aget event "target" "value")
query (if (= value "")
""
(convert-to-cqp value phonetic?))]
(swap! search-query assoc-in [:query] query)))
(defn cwb-search-inputs [{:keys [search-query]}]
(let [query (:query @search-query)
displayed-query (str/replace query #"\[\(?\w+=\"(.+?)\"(?:\s+%c)?\)?\]" "$1")
phonetic? (not= -1 (.indexOf query "phon="))]
[:div.row-fluid
[:form.form-inline.span12
[:div.span10
[:input.span12 {:type "text" :value displayed-query
:on-change #(handle-text-changed % search-query phonetic?)}]
[:label {:style {:marginTop 5}}]
[:input {:name "phonetic" :type "checkbox"
:style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))
(def components {:cwb cwb-search-inputs
:cwb-speech (fn [] [:div "CWB-SPEECHE"])})
| Convert to CQP format on text change | Convert to CQP format on text change
| Clojure | mit | textlab/glossa,textlab/glossa,textlab/glossa,textlab/glossa,textlab/glossa | clojure | ## Code Before:
(ns cglossa.search-inputs
(:require [clojure.string :as str]))
(defn cwb-search-inputs [{:keys [search-query]}]
(let [query (:query @search-query)
displayed-query (str/replace query #"\[\(?\w+=\"(.+?)\"(?:\s+%c)?\)?\]" "$1")
phonetic? (not= -1 (.indexOf query "phon="))]
[:div.row-fluid
[:form.form-inline.span12
[:div.span10
[:input.span12 {:type "text" :value displayed-query
:on-change #(swap! search-query assoc-in [:query] (aget % "target" "value"))}]
[:label {:style {:marginTop 5}}]
[:input {:name "phonetic" :type "checkbox"
:style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))
(def components {:cwb cwb-search-inputs
:cwb-speech (fn [] [:div "CWB-SPEECHE"])})
## Instruction:
Convert to CQP format on text change
## Code After:
(ns cglossa.search-inputs
(:require [clojure.string :as str]))
(defn- convert-to-cqp [value phonetic?]
(let [attr (if phonetic? "phon" "word")
chinese-chars-range "[\u4E00-\u9FFF\u3400-\u4DFF\uF900-\uFAFF]"
value (str/replace value (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
(->> (str/split value #"\s")
(map #(if (= % "")
""
(str "[" attr "=\"" % "\" %c]")))
(str/join " "))))
(defn- handle-text-changed [event search-query phonetic?]
(let [value (aget event "target" "value")
query (if (= value "")
""
(convert-to-cqp value phonetic?))]
(swap! search-query assoc-in [:query] query)))
(defn cwb-search-inputs [{:keys [search-query]}]
(let [query (:query @search-query)
displayed-query (str/replace query #"\[\(?\w+=\"(.+?)\"(?:\s+%c)?\)?\]" "$1")
phonetic? (not= -1 (.indexOf query "phon="))]
[:div.row-fluid
[:form.form-inline.span12
[:div.span10
[:input.span12 {:type "text" :value displayed-query
:on-change #(handle-text-changed % search-query phonetic?)}]
[:label {:style {:marginTop 5}}]
[:input {:name "phonetic" :type "checkbox"
:style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))
(def components {:cwb cwb-search-inputs
:cwb-speech (fn [] [:div "CWB-SPEECHE"])})
| (ns cglossa.search-inputs
(:require [clojure.string :as str]))
+
+ (defn- convert-to-cqp [value phonetic?]
+ (let [attr (if phonetic? "phon" "word")
+ chinese-chars-range "[\u4E00-\u9FFF\u3400-\u4DFF\uF900-\uFAFF]"
+ value (str/replace value (re-pattern (str "(" chinese-chars-range ")")) " $1 ")]
+ (->> (str/split value #"\s")
+ (map #(if (= % "")
+ ""
+ (str "[" attr "=\"" % "\" %c]")))
+ (str/join " "))))
+
+ (defn- handle-text-changed [event search-query phonetic?]
+ (let [value (aget event "target" "value")
+ query (if (= value "")
+ ""
+ (convert-to-cqp value phonetic?))]
+ (swap! search-query assoc-in [:query] query)))
(defn cwb-search-inputs [{:keys [search-query]}]
(let [query (:query @search-query)
displayed-query (str/replace query #"\[\(?\w+=\"(.+?)\"(?:\s+%c)?\)?\]" "$1")
phonetic? (not= -1 (.indexOf query "phon="))]
[:div.row-fluid
[:form.form-inline.span12
[:div.span10
[:input.span12 {:type "text" :value displayed-query
- :on-change #(swap! search-query assoc-in [:query] (aget % "target" "value"))}]
+ :on-change #(handle-text-changed % search-query phonetic?)}]
[:label {:style {:marginTop 5}}]
[:input {:name "phonetic" :type "checkbox"
:style {:marginTop -3} :checked phonetic?} " Phonetic form"]]]]))
(def components {:cwb cwb-search-inputs
:cwb-speech (fn [] [:div "CWB-SPEECHE"])}) | 19 | 1.055556 | 18 | 1 |
dd5849029657de9e0c33433bb66e2cd3a1fd239c | zsh/path.zsh | zsh/path.zsh | path_prepend() {
if [ -d $1 ] && [[ ":$PATH:" != ":$1:" ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
}
# haskell
CABAL_BIN=$HOME/.cabal/bin
if [[ -d $CABAL_BIN && ":$PATH:" != ":$CABAL_BIN:" ]]; then
PATH=$CABAL_BIN:$PATH
fi
# MacTex BasicTex http://www.tug.org/mactex/morepackages.html
TEXLIVE_VERSION="2015basic"
TEXLIVE_PATH=$BREW_PREFIX/texlive/$TEXLIVE_VERSION/bin/x86_64-darwin
if [[ -d $TEXLIVE_PATH && ":$PATH:" != ":$TEXLIVE_PATH:" ]]; then
PATH=$TEXLIVE_PATH:$PATH
fi
# Go
# You may wish to add the GOROOT-based install location to your PATH:
# if [[ -d $BREW_PREFIX/opt/go/libexec/bin ]]; then
# PATH=$PATH:$BREW_PREFIX/opt/go/libexec/bin
# fi
export GOPATH=$HOME/.go
path_prepend $GOPATH/bin
# User path
path_prepend $HOME/.local/bin
export PATH
| path_prepend() {
if [ -d $1 ] && [[ ":$PATH:" != ":$1:" ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
}
# haskell
CABAL_BIN=$HOME/.cabal/bin
if [[ -d $CABAL_BIN && ":$PATH:" != ":$CABAL_BIN:" ]]; then
PATH=$CABAL_BIN:$PATH
fi
# MacTex BasicTex http://www.tug.org/mactex/morepackages.html
TEXLIVE_PATH=/Library/TeX/texbin
if [[ -d $TEXLIVE_PATH && ":$PATH:" != ":$TEXLIVE_PATH:" ]]; then
PATH=$TEXLIVE_PATH:$PATH
fi
# Go
# You may wish to add the GOROOT-based install location to your PATH:
# if [[ -d $BREW_PREFIX/opt/go/libexec/bin ]]; then
# PATH=$PATH:$BREW_PREFIX/opt/go/libexec/bin
# fi
export GOPATH=$HOME/.go
path_prepend $GOPATH/bin
# User path
path_prepend $HOME/.local/bin
export PATH
| Use TexLive symbolic link to current install bin | Use TexLive symbolic link to current install bin
| Shell | mit | dcloud/dotfiles,dcloud/dotfiles | shell | ## Code Before:
path_prepend() {
if [ -d $1 ] && [[ ":$PATH:" != ":$1:" ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
}
# haskell
CABAL_BIN=$HOME/.cabal/bin
if [[ -d $CABAL_BIN && ":$PATH:" != ":$CABAL_BIN:" ]]; then
PATH=$CABAL_BIN:$PATH
fi
# MacTex BasicTex http://www.tug.org/mactex/morepackages.html
TEXLIVE_VERSION="2015basic"
TEXLIVE_PATH=$BREW_PREFIX/texlive/$TEXLIVE_VERSION/bin/x86_64-darwin
if [[ -d $TEXLIVE_PATH && ":$PATH:" != ":$TEXLIVE_PATH:" ]]; then
PATH=$TEXLIVE_PATH:$PATH
fi
# Go
# You may wish to add the GOROOT-based install location to your PATH:
# if [[ -d $BREW_PREFIX/opt/go/libexec/bin ]]; then
# PATH=$PATH:$BREW_PREFIX/opt/go/libexec/bin
# fi
export GOPATH=$HOME/.go
path_prepend $GOPATH/bin
# User path
path_prepend $HOME/.local/bin
export PATH
## Instruction:
Use TexLive symbolic link to current install bin
## Code After:
path_prepend() {
if [ -d $1 ] && [[ ":$PATH:" != ":$1:" ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
}
# haskell
CABAL_BIN=$HOME/.cabal/bin
if [[ -d $CABAL_BIN && ":$PATH:" != ":$CABAL_BIN:" ]]; then
PATH=$CABAL_BIN:$PATH
fi
# MacTex BasicTex http://www.tug.org/mactex/morepackages.html
TEXLIVE_PATH=/Library/TeX/texbin
if [[ -d $TEXLIVE_PATH && ":$PATH:" != ":$TEXLIVE_PATH:" ]]; then
PATH=$TEXLIVE_PATH:$PATH
fi
# Go
# You may wish to add the GOROOT-based install location to your PATH:
# if [[ -d $BREW_PREFIX/opt/go/libexec/bin ]]; then
# PATH=$PATH:$BREW_PREFIX/opt/go/libexec/bin
# fi
export GOPATH=$HOME/.go
path_prepend $GOPATH/bin
# User path
path_prepend $HOME/.local/bin
export PATH
| path_prepend() {
if [ -d $1 ] && [[ ":$PATH:" != ":$1:" ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
}
# haskell
CABAL_BIN=$HOME/.cabal/bin
if [[ -d $CABAL_BIN && ":$PATH:" != ":$CABAL_BIN:" ]]; then
PATH=$CABAL_BIN:$PATH
fi
# MacTex BasicTex http://www.tug.org/mactex/morepackages.html
+ TEXLIVE_PATH=/Library/TeX/texbin
- TEXLIVE_VERSION="2015basic"
- TEXLIVE_PATH=$BREW_PREFIX/texlive/$TEXLIVE_VERSION/bin/x86_64-darwin
if [[ -d $TEXLIVE_PATH && ":$PATH:" != ":$TEXLIVE_PATH:" ]]; then
PATH=$TEXLIVE_PATH:$PATH
fi
# Go
# You may wish to add the GOROOT-based install location to your PATH:
# if [[ -d $BREW_PREFIX/opt/go/libexec/bin ]]; then
# PATH=$PATH:$BREW_PREFIX/opt/go/libexec/bin
# fi
export GOPATH=$HOME/.go
path_prepend $GOPATH/bin
# User path
path_prepend $HOME/.local/bin
export PATH | 3 | 0.096774 | 1 | 2 |
8d4c6a5fdf0522915c86c4f412ac733e368159e5 | poker-dice/hand_spec.rb | poker-dice/hand_spec.rb | require_relative 'hand'
require_relative 'loaded_die'
describe Hand do
it "has five dice, each of which has a known face value" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
specify "a Hand with five Queens is ranked as 'five of a kind'" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Five of a kind' )
end
specify "a bust is not five of a kind" do
dice = %w[ 9 T J Q A ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Bupkis' )
end
end
| require_relative 'hand'
require_relative 'loaded_die'
describe Hand do
def hand_with(face_values)
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
end
it "has five dice, each of which has a known face value" do
# dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
# hand = Hand.new( dice )
hand = hand_with(nil)
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
specify "a Hand with five Queens is ranked as 'five of a kind'" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Five of a kind' )
end
specify "a bust is not five of a kind" do
dice = %w[ 9 T J Q A ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Bupkis' )
end
end
| Create a helper method, use it once | Create a helper method, use it once
| Ruby | unlicense | geeksam/cohort-1-live-coding,geeksam/cohort-1-live-coding | ruby | ## Code Before:
require_relative 'hand'
require_relative 'loaded_die'
describe Hand do
it "has five dice, each of which has a known face value" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
specify "a Hand with five Queens is ranked as 'five of a kind'" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Five of a kind' )
end
specify "a bust is not five of a kind" do
dice = %w[ 9 T J Q A ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Bupkis' )
end
end
## Instruction:
Create a helper method, use it once
## Code After:
require_relative 'hand'
require_relative 'loaded_die'
describe Hand do
def hand_with(face_values)
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
end
it "has five dice, each of which has a known face value" do
# dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
# hand = Hand.new( dice )
hand = hand_with(nil)
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
specify "a Hand with five Queens is ranked as 'five of a kind'" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Five of a kind' )
end
specify "a bust is not five of a kind" do
dice = %w[ 9 T J Q A ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Bupkis' )
end
end
| require_relative 'hand'
require_relative 'loaded_die'
describe Hand do
- it "has five dice, each of which has a known face value" do
+ def hand_with(face_values)
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
+ end
+
+ it "has five dice, each of which has a known face value" do
+ # dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
+ # hand = Hand.new( dice )
+ hand = hand_with(nil)
expect( hand.face_values ).to eq( %w[ Q Q Q Q Q ] )
end
specify "a Hand with five Queens is ranked as 'five of a kind'" do
dice = %w[ Q Q Q Q Q ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Five of a kind' )
end
specify "a bust is not five of a kind" do
dice = %w[ 9 T J Q A ].map { |value| LoadedDie.new(value) }
hand = Hand.new( dice )
expect( hand.rank ).to eq( 'Bupkis' )
end
end
| 8 | 0.347826 | 7 | 1 |
24d2d9f064a81cbff0d6a5a43eb4ed79e4ea3001 | planning/src/main/java/fape/core/planning/search/strategies/flaws/HierarchicalFirstComp.java | planning/src/main/java/fape/core/planning/search/strategies/flaws/HierarchicalFirstComp.java | package fape.core.planning.search.strategies.flaws;
import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;
public class HierarchicalFirstComp implements FlawComparator {
public final State st;
public final Planner planner;
public HierarchicalFirstComp(State st, Planner planner) {
this.st = st;
this.planner = planner;
}
@Override
public String shortName() {
return "hf";
}
private int priority(Flaw flaw) {
if(flaw instanceof UnrefinedTask)
return 3;
else if(flaw instanceof UnmotivatedAction)
return 4;
else
return 5;
}
@Override
public int compare(Flaw o1, Flaw o2) {
return priority(o1) - priority(o2);
}
}
| package fape.core.planning.search.strategies.flaws;
import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.Threat;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;
public class HierarchicalFirstComp implements FlawComparator {
public final State st;
public final Planner planner;
public final boolean threatsFirst;
public HierarchicalFirstComp(State st, Planner planner) {
this.st = st;
this.planner = planner;
threatsFirst = st.pb.allActionsAreMotivated();
}
@Override
public String shortName() {
return "hf";
}
private double priority(Flaw flaw) {
if(threatsFirst && flaw instanceof Threat)
return 0.;
else if(flaw instanceof UnrefinedTask)
return 1. + ((double) st.getEarliestStartTime(((UnrefinedTask) flaw).task.start())) / ((double) st.getEarliestStartTime(st.pb.end())+1);
else if(flaw instanceof UnmotivatedAction)
return 4.;
else
return 5.;
}
@Override
public int compare(Flaw o1, Flaw o2) {
return (int) Math.signum(priority(o1) - priority(o2));
}
}
| Update default flaw selection strategy on hierarchical domains: threats first, then unrefined tasks. | [planning] Update default flaw selection strategy on hierarchical domains: threats first, then unrefined tasks.
| Java | bsd-2-clause | athy/fape,athy/fape,athy/fape,athy/fape | java | ## Code Before:
package fape.core.planning.search.strategies.flaws;
import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;
public class HierarchicalFirstComp implements FlawComparator {
public final State st;
public final Planner planner;
public HierarchicalFirstComp(State st, Planner planner) {
this.st = st;
this.planner = planner;
}
@Override
public String shortName() {
return "hf";
}
private int priority(Flaw flaw) {
if(flaw instanceof UnrefinedTask)
return 3;
else if(flaw instanceof UnmotivatedAction)
return 4;
else
return 5;
}
@Override
public int compare(Flaw o1, Flaw o2) {
return priority(o1) - priority(o2);
}
}
## Instruction:
[planning] Update default flaw selection strategy on hierarchical domains: threats first, then unrefined tasks.
## Code After:
package fape.core.planning.search.strategies.flaws;
import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.Threat;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;
public class HierarchicalFirstComp implements FlawComparator {
public final State st;
public final Planner planner;
public final boolean threatsFirst;
public HierarchicalFirstComp(State st, Planner planner) {
this.st = st;
this.planner = planner;
threatsFirst = st.pb.allActionsAreMotivated();
}
@Override
public String shortName() {
return "hf";
}
private double priority(Flaw flaw) {
if(threatsFirst && flaw instanceof Threat)
return 0.;
else if(flaw instanceof UnrefinedTask)
return 1. + ((double) st.getEarliestStartTime(((UnrefinedTask) flaw).task.start())) / ((double) st.getEarliestStartTime(st.pb.end())+1);
else if(flaw instanceof UnmotivatedAction)
return 4.;
else
return 5.;
}
@Override
public int compare(Flaw o1, Flaw o2) {
return (int) Math.signum(priority(o1) - priority(o2));
}
}
| package fape.core.planning.search.strategies.flaws;
import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
+ import fape.core.planning.search.flaws.flaws.Threat;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;
public class HierarchicalFirstComp implements FlawComparator {
public final State st;
public final Planner planner;
+ public final boolean threatsFirst;
public HierarchicalFirstComp(State st, Planner planner) {
this.st = st;
this.planner = planner;
+ threatsFirst = st.pb.allActionsAreMotivated();
}
@Override
public String shortName() {
return "hf";
}
- private int priority(Flaw flaw) {
? ^^^
+ private double priority(Flaw flaw) {
? ^^^^^^
+ if(threatsFirst && flaw instanceof Threat)
+ return 0.;
- if(flaw instanceof UnrefinedTask)
+ else if(flaw instanceof UnrefinedTask)
? +++++
- return 3;
+ return 1. + ((double) st.getEarliestStartTime(((UnrefinedTask) flaw).task.start())) / ((double) st.getEarliestStartTime(st.pb.end())+1);
else if(flaw instanceof UnmotivatedAction)
- return 4;
+ return 4.;
? +
else
- return 5;
+ return 5.;
? +
}
@Override
public int compare(Flaw o1, Flaw o2) {
- return priority(o1) - priority(o2);
+ return (int) Math.signum(priority(o1) - priority(o2));
? ++++++++++++++++++ +
}
} | 17 | 0.447368 | 11 | 6 |
d7bce814c10ce13cf4c228fd87dcbdee75f8d0a1 | integration-test/1211-fix-null-network.py | integration-test/1211-fix-null-network.py | from . import OsmFixtureTest
class FixNullNetwork(OsmFixtureTest):
def test_routes_with_no_network(self):
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# '4'
self.load_fixtures(['http://www.openstreetmap.org/relation/2307408'])
self.assert_has_feature(
11, 1038, 705, 'roads',
{'kind': 'major_road', 'shield_text': '4', 'network': type(None)})
| from . import OsmFixtureTest
class FixNullNetwork(OsmFixtureTest):
def test_routes_with_no_network(self):
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# '4'
self.load_fixtures(
['http://www.openstreetmap.org/relation/2307408'],
clip=self.tile_bbox(11, 1038, 705))
self.assert_has_feature(
11, 1038, 705, 'roads',
{'kind': 'major_road', 'shield_text': '4', 'network': type(None)})
| Add clip to reduce fixture size. | Add clip to reduce fixture size.
| Python | mit | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | python | ## Code Before:
from . import OsmFixtureTest
class FixNullNetwork(OsmFixtureTest):
def test_routes_with_no_network(self):
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# '4'
self.load_fixtures(['http://www.openstreetmap.org/relation/2307408'])
self.assert_has_feature(
11, 1038, 705, 'roads',
{'kind': 'major_road', 'shield_text': '4', 'network': type(None)})
## Instruction:
Add clip to reduce fixture size.
## Code After:
from . import OsmFixtureTest
class FixNullNetwork(OsmFixtureTest):
def test_routes_with_no_network(self):
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# '4'
self.load_fixtures(
['http://www.openstreetmap.org/relation/2307408'],
clip=self.tile_bbox(11, 1038, 705))
self.assert_has_feature(
11, 1038, 705, 'roads',
{'kind': 'major_road', 'shield_text': '4', 'network': type(None)})
| from . import OsmFixtureTest
class FixNullNetwork(OsmFixtureTest):
def test_routes_with_no_network(self):
# ref="N 4", route=road, but no network=*
# so we should get something that has no network, but a shield text of
# '4'
+ self.load_fixtures(
- self.load_fixtures(['http://www.openstreetmap.org/relation/2307408'])
? ^^^^^^^^^^^^^^^^^^^ ^
+ ['http://www.openstreetmap.org/relation/2307408'],
? ^^^^ ^
+ clip=self.tile_bbox(11, 1038, 705))
self.assert_has_feature(
11, 1038, 705, 'roads',
{'kind': 'major_road', 'shield_text': '4', 'network': type(None)}) | 4 | 0.307692 | 3 | 1 |
331fd7f5b5536a8250ba65ebad6d85ad25d56053 | src/karmanaut/crawler.clj | src/karmanaut/crawler.clj | (ns karmanaut.crawler
(:require [karmanaut.client :as client]
[karmanaut.db :as db]
[karmanaut.utils :as utils]
[monger.collection :as mc]))
(defn create-user-map [username]
; We're actually making two calls to the Reddit API
; here -- should find a way to save the data from one call
; and re-use it.
{:username username,
:link-karma (client/link-karma username),
:comment-karma (client/comment-karma username)})
(defn crawl-users [usernames]
(map create-user-map usernames))
(defn create-user-document [user-map]
{:_id (:username user-map)})
(defn create-sample-document [user-map]
(let [mn (utils/midnight (utils/utcnow))
secs (utils/seconds-since-midnight (utils/utcnow))
stats {(str "link_karma." secs) (:link-karma user-map),
(str "comment_karma." secs) (:comment-karma user-map)}]
{"$set" stats}))
(defn create-query-document [user-map]
{:user (:username user-map),
:timestamp (utils/midnight (utils/utcnow))})
(defn create-sample! [user-map]
(mc/upsert db/db "samples" (create-query-document user-map) (create-sample-document user-map) {:upsert true}))
(defn insert-samples! [user-maps]
(dorun (map create-sample! user-maps)))
| (ns karmanaut.crawler
(:require [karmanaut.client :as client]
[karmanaut.db :as db]
[karmanaut.utils :as utils]
[monger.collection :as mc]))
(defn create-user-map [username]
; We're actually making two calls to the Reddit API
; here -- should find a way to save the data from one call
; and re-use it.
{:username username,
:link-karma (client/link-karma username),
:comment-karma (client/comment-karma username)})
(defn crawl-users [usernames]
(map create-user-map usernames))
(defn create-user-document [user-map]
{:_id (:username user-map)})
(defn create-sample-document [user-map]
(let [mn (utils/midnight (utils/utcnow))
secs (utils/seconds-since-midnight (utils/utcnow))
stats {(str "link_karma." secs) (:link-karma user-map),
(str "comment_karma." secs) (:comment-karma user-map)}]
{"$set" stats}))
(defn create-query-document [user-map]
{:user (:username user-map),
:timestamp (utils/midnight (utils/utcnow))})
(defn create-sample! [user-map]
(mc/upsert db/db "samples" (create-query-document user-map) (create-sample-document user-map) {:upsert true}))
(defn insert-samples! [user-maps]
(doseq [u user-maps] (create-sample! u)))
| Use doseq instead of dorun | Use doseq instead of dorun
doseq is like for, but specifically for performing side effects.
| Clojure | bsd-3-clause | mdippery/karmanaut | clojure | ## Code Before:
(ns karmanaut.crawler
(:require [karmanaut.client :as client]
[karmanaut.db :as db]
[karmanaut.utils :as utils]
[monger.collection :as mc]))
(defn create-user-map [username]
; We're actually making two calls to the Reddit API
; here -- should find a way to save the data from one call
; and re-use it.
{:username username,
:link-karma (client/link-karma username),
:comment-karma (client/comment-karma username)})
(defn crawl-users [usernames]
(map create-user-map usernames))
(defn create-user-document [user-map]
{:_id (:username user-map)})
(defn create-sample-document [user-map]
(let [mn (utils/midnight (utils/utcnow))
secs (utils/seconds-since-midnight (utils/utcnow))
stats {(str "link_karma." secs) (:link-karma user-map),
(str "comment_karma." secs) (:comment-karma user-map)}]
{"$set" stats}))
(defn create-query-document [user-map]
{:user (:username user-map),
:timestamp (utils/midnight (utils/utcnow))})
(defn create-sample! [user-map]
(mc/upsert db/db "samples" (create-query-document user-map) (create-sample-document user-map) {:upsert true}))
(defn insert-samples! [user-maps]
(dorun (map create-sample! user-maps)))
## Instruction:
Use doseq instead of dorun
doseq is like for, but specifically for performing side effects.
## Code After:
(ns karmanaut.crawler
(:require [karmanaut.client :as client]
[karmanaut.db :as db]
[karmanaut.utils :as utils]
[monger.collection :as mc]))
(defn create-user-map [username]
; We're actually making two calls to the Reddit API
; here -- should find a way to save the data from one call
; and re-use it.
{:username username,
:link-karma (client/link-karma username),
:comment-karma (client/comment-karma username)})
(defn crawl-users [usernames]
(map create-user-map usernames))
(defn create-user-document [user-map]
{:_id (:username user-map)})
(defn create-sample-document [user-map]
(let [mn (utils/midnight (utils/utcnow))
secs (utils/seconds-since-midnight (utils/utcnow))
stats {(str "link_karma." secs) (:link-karma user-map),
(str "comment_karma." secs) (:comment-karma user-map)}]
{"$set" stats}))
(defn create-query-document [user-map]
{:user (:username user-map),
:timestamp (utils/midnight (utils/utcnow))})
(defn create-sample! [user-map]
(mc/upsert db/db "samples" (create-query-document user-map) (create-sample-document user-map) {:upsert true}))
(defn insert-samples! [user-maps]
(doseq [u user-maps] (create-sample! u)))
| (ns karmanaut.crawler
(:require [karmanaut.client :as client]
[karmanaut.db :as db]
[karmanaut.utils :as utils]
[monger.collection :as mc]))
(defn create-user-map [username]
; We're actually making two calls to the Reddit API
; here -- should find a way to save the data from one call
; and re-use it.
{:username username,
:link-karma (client/link-karma username),
:comment-karma (client/comment-karma username)})
(defn crawl-users [usernames]
(map create-user-map usernames))
(defn create-user-document [user-map]
{:_id (:username user-map)})
(defn create-sample-document [user-map]
(let [mn (utils/midnight (utils/utcnow))
secs (utils/seconds-since-midnight (utils/utcnow))
stats {(str "link_karma." secs) (:link-karma user-map),
(str "comment_karma." secs) (:comment-karma user-map)}]
{"$set" stats}))
(defn create-query-document [user-map]
{:user (:username user-map),
:timestamp (utils/midnight (utils/utcnow))})
(defn create-sample! [user-map]
(mc/upsert db/db "samples" (create-query-document user-map) (create-sample-document user-map) {:upsert true}))
(defn insert-samples! [user-maps]
- (dorun (map create-sample! user-maps)))
+ (doseq [u user-maps] (create-sample! u))) | 2 | 0.055556 | 1 | 1 |
e50adab11ac9b0858e111dcb855f166f58781308 | docker-compose.yml | docker-compose.yml | version: "3.3"
services:
django:
build: .
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8000:8000"
volumes:
- .:/djedi-cms
node:
build: ./djedi-react
image: djedi-react
tty: true
ports:
- "3000:3000"
volumes:
- ./djedi-react/:/code
- /code/node_modules
environment:
- SERVER_BASE_URL=http://django:8000/djedi/api
| version: "3.3"
services:
django:
build: .
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8000:8000"
volumes:
- .:/djedi-cms
node:
build: ./djedi-react
image: djedi-react
ports:
- "3000:3000"
volumes:
- ./djedi-react/:/code
- /code/node_modules
environment:
- SERVER_BASE_URL=http://django:8000/djedi/api
| Remove `tty: true` from the example node container | Remove `tty: true` from the example node container
The idea was to get fancier logs, but it didn't work very well in
practice. There were many scrambled characters and the cursor
disappeared.
| YAML | bsd-3-clause | 5monkeys/djedi-cms,5monkeys/djedi-cms,5monkeys/djedi-cms | yaml | ## Code Before:
version: "3.3"
services:
django:
build: .
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8000:8000"
volumes:
- .:/djedi-cms
node:
build: ./djedi-react
image: djedi-react
tty: true
ports:
- "3000:3000"
volumes:
- ./djedi-react/:/code
- /code/node_modules
environment:
- SERVER_BASE_URL=http://django:8000/djedi/api
## Instruction:
Remove `tty: true` from the example node container
The idea was to get fancier logs, but it didn't work very well in
practice. There were many scrambled characters and the cursor
disappeared.
## Code After:
version: "3.3"
services:
django:
build: .
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8000:8000"
volumes:
- .:/djedi-cms
node:
build: ./djedi-react
image: djedi-react
ports:
- "3000:3000"
volumes:
- ./djedi-react/:/code
- /code/node_modules
environment:
- SERVER_BASE_URL=http://django:8000/djedi/api
| version: "3.3"
services:
django:
build: .
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8000:8000"
volumes:
- .:/djedi-cms
node:
build: ./djedi-react
image: djedi-react
- tty: true
ports:
- "3000:3000"
volumes:
- ./djedi-react/:/code
- /code/node_modules
environment:
- SERVER_BASE_URL=http://django:8000/djedi/api | 1 | 0.041667 | 0 | 1 |
3d24c0bbc2b5473124d27ca54f7f73aa1e3dc1d2 | README.rst | README.rst | memcached client for asyncio
============================
asyncio (PEP 3156) library to work with memcached.
.. image:: https://travis-ci.org/aio-libs/aiomcache.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiomcache
Getting started
---------------
The API looks very similar to the other memcache clients:
.. code:: python
import asyncio
import aiomcache
loop = asyncio.get_event_loop()
@asyncio.coroutine
def hello_aiomcache():
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
yield from mc.set(b"some_key", b"Some value")
value = yield from mc.get(b"some_key")
print(value)
values = yield from mc.multi_get(b"some_key", b"other_key")
print(values)
yield from mc.delete(b"another_key")
loop.run_until_complete(hello_aiomcache())
Requirements
------------
- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio/ | memcached client for asyncio
============================
asyncio (PEP 3156) library to work with memcached.
.. image:: https://travis-ci.org/aio-libs/aiomcache.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiomcache
Getting started
---------------
The API looks very similar to the other memcache clients:
.. code:: python
import asyncio
import aiomcache
loop = asyncio.get_event_loop()
async def hello_aiomcache():
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
yield from mc.set(b"some_key", b"Some value")
value = await mc.get(b"some_key")
print(value)
values = await mc.multi_get(b"some_key", b"other_key")
print(values)
await mc.delete(b"another_key")
loop.run_until_complete(hello_aiomcache())
Requirements
------------
- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio/
| Use async/await syntax in readme | Use async/await syntax in readme
| reStructuredText | bsd-2-clause | aio-libs/aiomcache | restructuredtext | ## Code Before:
memcached client for asyncio
============================
asyncio (PEP 3156) library to work with memcached.
.. image:: https://travis-ci.org/aio-libs/aiomcache.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiomcache
Getting started
---------------
The API looks very similar to the other memcache clients:
.. code:: python
import asyncio
import aiomcache
loop = asyncio.get_event_loop()
@asyncio.coroutine
def hello_aiomcache():
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
yield from mc.set(b"some_key", b"Some value")
value = yield from mc.get(b"some_key")
print(value)
values = yield from mc.multi_get(b"some_key", b"other_key")
print(values)
yield from mc.delete(b"another_key")
loop.run_until_complete(hello_aiomcache())
Requirements
------------
- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio/
## Instruction:
Use async/await syntax in readme
## Code After:
memcached client for asyncio
============================
asyncio (PEP 3156) library to work with memcached.
.. image:: https://travis-ci.org/aio-libs/aiomcache.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiomcache
Getting started
---------------
The API looks very similar to the other memcache clients:
.. code:: python
import asyncio
import aiomcache
loop = asyncio.get_event_loop()
async def hello_aiomcache():
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
yield from mc.set(b"some_key", b"Some value")
value = await mc.get(b"some_key")
print(value)
values = await mc.multi_get(b"some_key", b"other_key")
print(values)
await mc.delete(b"another_key")
loop.run_until_complete(hello_aiomcache())
Requirements
------------
- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio/
| memcached client for asyncio
============================
asyncio (PEP 3156) library to work with memcached.
.. image:: https://travis-ci.org/aio-libs/aiomcache.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiomcache
Getting started
---------------
The API looks very similar to the other memcache clients:
.. code:: python
import asyncio
import aiomcache
loop = asyncio.get_event_loop()
- @asyncio.coroutine
- def hello_aiomcache():
+ async def hello_aiomcache():
? ++++++
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
yield from mc.set(b"some_key", b"Some value")
- value = yield from mc.get(b"some_key")
? ^ ^^^^^^^^
+ value = await mc.get(b"some_key")
? ^^^ ^
print(value)
- values = yield from mc.multi_get(b"some_key", b"other_key")
? ^ ^^^^^^^^
+ values = await mc.multi_get(b"some_key", b"other_key")
? ^^^ ^
print(values)
- yield from mc.delete(b"another_key")
? ^ ^^^^^^^^
+ await mc.delete(b"another_key")
? ^^^ ^
loop.run_until_complete(hello_aiomcache())
Requirements
------------
- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio/ | 9 | 0.230769 | 4 | 5 |
bb2257bec5ddb14bb74aff56690accaf15f2e4f9 | package.json | package.json | {
"name": "configurator-closure-loader",
"version": "0.1.21",
"description": "Webpack loader for google closure library dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack",
"loader",
"closure"
],
"repository": {
"type": "git",
"url": "git://github.com/configurator/closure-loader.git"
},
"author": "Steven Weingärtner",
"contributors": [
"Michael van Engelshoven <michael@van-engelshoven.de>",
"Matthias Harmuth <mcpain83@gmail.com>",
"Dor Kleiman <configurator@gmail.com>"
],
"license": "MIT",
"peerDependencies": {
"webpack": "^2.3.2"
},
"dependencies": {
"bluebird": "^3.4.1",
"chokidar": "^1.0.6",
"deep-extend": "^0.2.11",
"glob": "^7.0.5",
"graceful-fs": "^4.1.2",
"loader-utils": "^0.2.11",
"lodash": "^4.13.1",
"source-map": "^0.5.1"
}
}
| {
"name": "configurator-closure-loader",
"version": "0.1.22",
"description": "Webpack loader for google closure library dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack",
"loader",
"closure"
],
"repository": {
"type": "git",
"url": "git://github.com/configurator/closure-loader.git"
},
"author": "Steven Weingärtner",
"contributors": [
"Michael van Engelshoven <michael@van-engelshoven.de>",
"Matthias Harmuth <mcpain83@gmail.com>",
"Dor Kleiman <configurator@gmail.com>"
],
"license": "MIT",
"dependencies": {
"bluebird": "^3.4.1",
"chokidar": "^1.0.6",
"deep-extend": "^0.2.11",
"glob": "^7.0.5",
"graceful-fs": "^4.1.2",
"loader-utils": "^0.2.11",
"lodash": "^4.13.1",
"source-map": "^0.5.1"
},
"peerDependencies": {
"webpack": "^2.3.3 || ^3.0.0"
}
}
| Upgrade to webpack 3; v0.1.22 | Upgrade to webpack 3; v0.1.22
| JSON | mit | configurator/closure-loader | json | ## Code Before:
{
"name": "configurator-closure-loader",
"version": "0.1.21",
"description": "Webpack loader for google closure library dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack",
"loader",
"closure"
],
"repository": {
"type": "git",
"url": "git://github.com/configurator/closure-loader.git"
},
"author": "Steven Weingärtner",
"contributors": [
"Michael van Engelshoven <michael@van-engelshoven.de>",
"Matthias Harmuth <mcpain83@gmail.com>",
"Dor Kleiman <configurator@gmail.com>"
],
"license": "MIT",
"peerDependencies": {
"webpack": "^2.3.2"
},
"dependencies": {
"bluebird": "^3.4.1",
"chokidar": "^1.0.6",
"deep-extend": "^0.2.11",
"glob": "^7.0.5",
"graceful-fs": "^4.1.2",
"loader-utils": "^0.2.11",
"lodash": "^4.13.1",
"source-map": "^0.5.1"
}
}
## Instruction:
Upgrade to webpack 3; v0.1.22
## Code After:
{
"name": "configurator-closure-loader",
"version": "0.1.22",
"description": "Webpack loader for google closure library dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack",
"loader",
"closure"
],
"repository": {
"type": "git",
"url": "git://github.com/configurator/closure-loader.git"
},
"author": "Steven Weingärtner",
"contributors": [
"Michael van Engelshoven <michael@van-engelshoven.de>",
"Matthias Harmuth <mcpain83@gmail.com>",
"Dor Kleiman <configurator@gmail.com>"
],
"license": "MIT",
"dependencies": {
"bluebird": "^3.4.1",
"chokidar": "^1.0.6",
"deep-extend": "^0.2.11",
"glob": "^7.0.5",
"graceful-fs": "^4.1.2",
"loader-utils": "^0.2.11",
"lodash": "^4.13.1",
"source-map": "^0.5.1"
},
"peerDependencies": {
"webpack": "^2.3.3 || ^3.0.0"
}
}
| {
"name": "configurator-closure-loader",
- "version": "0.1.21",
? ^
+ "version": "0.1.22",
? ^
"description": "Webpack loader for google closure library dependencies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"webpack",
"loader",
"closure"
],
"repository": {
"type": "git",
"url": "git://github.com/configurator/closure-loader.git"
},
"author": "Steven Weingärtner",
"contributors": [
"Michael van Engelshoven <michael@van-engelshoven.de>",
"Matthias Harmuth <mcpain83@gmail.com>",
"Dor Kleiman <configurator@gmail.com>"
],
"license": "MIT",
- "peerDependencies": {
- "webpack": "^2.3.2"
- },
"dependencies": {
"bluebird": "^3.4.1",
"chokidar": "^1.0.6",
"deep-extend": "^0.2.11",
"glob": "^7.0.5",
"graceful-fs": "^4.1.2",
"loader-utils": "^0.2.11",
"lodash": "^4.13.1",
"source-map": "^0.5.1"
+ },
+ "peerDependencies": {
+ "webpack": "^2.3.3 || ^3.0.0"
}
} | 8 | 0.210526 | 4 | 4 |
c8a7ca842c1973ae189ac98ba5c6bc5e603dea2e | playbooks/mos9_prepare_env.yml | playbooks/mos9_prepare_env.yml | ---
- hosts: env_{{ env_id }}
any_errors_fatal: true
vars_files:
- "vars/common.yml"
tasks:
- name: Fix apt-preferences
command: sed -i -e 's|n=mos9.0-updates|n=mos9.0|' /etc/apt/preferences.d/mos-updates.pref
- name: Update MCollective
apt:
update_cache: yes
name: "{{ item }}"
state: latest
with_items:
- nailgun-agent
- nailgun-mcagents
- name: Restart MCollective
service:
name: mcollective
state: restarted
| ---
- hosts: env_{{ env_id }}
any_errors_fatal: true
vars_files:
- "vars/common.yml"
- "vars/mos_releases/{{ mos_release }}.yml"
tasks:
- name: Fix apt-preferences
command: sed -i -e 's|n=mos9.0-updates|n=mos9.0|' /etc/apt/preferences.d/mos-updates.pref
- name: Add MOS 9.2 repo
apt_repository:
filename="mos9.2"
repo="deb {{ fuel_url }}/snapshots/{{ snapshot_repo }} mos9.0-proposed main restricted"
state=present
update_cache=yes
- name: Add MOS 9.2 repo key
apt_key:
url={{ fuel_url }}/snapshots/{{ snapshot_repo }}/archive-mos9.0-proposed.key
- name: Update MCollective
apt:
update_cache: yes
name: "{{ item }}"
state: latest
with_items:
- nailgun-agent
- nailgun-mcagents
- name: Restart MCollective
service:
name: mcollective
state: restarted
| Add proposed repo for 9.2 | Add proposed repo for 9.2
| YAML | apache-2.0 | aepifanov/mos_mu,aepifanov/mos_mu | yaml | ## Code Before:
---
- hosts: env_{{ env_id }}
any_errors_fatal: true
vars_files:
- "vars/common.yml"
tasks:
- name: Fix apt-preferences
command: sed -i -e 's|n=mos9.0-updates|n=mos9.0|' /etc/apt/preferences.d/mos-updates.pref
- name: Update MCollective
apt:
update_cache: yes
name: "{{ item }}"
state: latest
with_items:
- nailgun-agent
- nailgun-mcagents
- name: Restart MCollective
service:
name: mcollective
state: restarted
## Instruction:
Add proposed repo for 9.2
## Code After:
---
- hosts: env_{{ env_id }}
any_errors_fatal: true
vars_files:
- "vars/common.yml"
- "vars/mos_releases/{{ mos_release }}.yml"
tasks:
- name: Fix apt-preferences
command: sed -i -e 's|n=mos9.0-updates|n=mos9.0|' /etc/apt/preferences.d/mos-updates.pref
- name: Add MOS 9.2 repo
apt_repository:
filename="mos9.2"
repo="deb {{ fuel_url }}/snapshots/{{ snapshot_repo }} mos9.0-proposed main restricted"
state=present
update_cache=yes
- name: Add MOS 9.2 repo key
apt_key:
url={{ fuel_url }}/snapshots/{{ snapshot_repo }}/archive-mos9.0-proposed.key
- name: Update MCollective
apt:
update_cache: yes
name: "{{ item }}"
state: latest
with_items:
- nailgun-agent
- nailgun-mcagents
- name: Restart MCollective
service:
name: mcollective
state: restarted
| ---
- hosts: env_{{ env_id }}
any_errors_fatal: true
vars_files:
- "vars/common.yml"
+ - "vars/mos_releases/{{ mos_release }}.yml"
tasks:
- name: Fix apt-preferences
command: sed -i -e 's|n=mos9.0-updates|n=mos9.0|' /etc/apt/preferences.d/mos-updates.pref
+
+ - name: Add MOS 9.2 repo
+ apt_repository:
+ filename="mos9.2"
+ repo="deb {{ fuel_url }}/snapshots/{{ snapshot_repo }} mos9.0-proposed main restricted"
+ state=present
+ update_cache=yes
+
+ - name: Add MOS 9.2 repo key
+ apt_key:
+ url={{ fuel_url }}/snapshots/{{ snapshot_repo }}/archive-mos9.0-proposed.key
- name: Update MCollective
apt:
update_cache: yes
name: "{{ item }}"
state: latest
with_items:
- nailgun-agent
- nailgun-mcagents
- name: Restart MCollective
service:
name: mcollective
state: restarted
| 12 | 0.48 | 12 | 0 |
f9fc1dafcbb7a6a456d0721137b34b6716498d86 | ci/requirements-py26.yml | ci/requirements-py26.yml | name: test_env
dependencies:
- python=2.6.9
- cython=0.22.1
- h5py=2.5.0
- pytest
- ordereddict
- numpy=1.9.2
- pandas=0.16.2
- matplotlib=1.4
- openssl
- toolz
# no seaborn
- scipy=0.16.0
- unittest2
- pip:
- coveralls
- pytest-cov
- cyordereddict
- dask
- h5netcdf
| name: test_env
dependencies:
- python=2.6.9
- cython=0.22.1
- h5py=2.5.0
- pytest
- ordereddict
- numpy=1.9.2
- pandas=0.16.2
- matplotlib=1.4
- openssl
# no seaborn
- scipy=0.16.0
- unittest2
- pip:
- coveralls
- pytest-cov
- cyordereddict
- dask
- h5netcdf
- toolz
| Fix failing CI tests on Python 2.6 | Fix failing CI tests on Python 2.6
It turns out we need the latest toolz from pip, not conda
(which is no longer building packages for Python 2.6).
| YAML | apache-2.0 | rabernat/xray,shoyer/xarray,markelg/xray,pydata/xarray,pydata/xarray,jhamman/xray,jhamman/xarray,markelg/xray,chunweiyuan/xarray,shoyer/xray,jcmgray/xarray,xray/xray,shoyer/xarray,markelg/xray,NicWayand/xray,jhamman/xarray,jhamman/xarray,pydata/xarray,rabernat/xray | yaml | ## Code Before:
name: test_env
dependencies:
- python=2.6.9
- cython=0.22.1
- h5py=2.5.0
- pytest
- ordereddict
- numpy=1.9.2
- pandas=0.16.2
- matplotlib=1.4
- openssl
- toolz
# no seaborn
- scipy=0.16.0
- unittest2
- pip:
- coveralls
- pytest-cov
- cyordereddict
- dask
- h5netcdf
## Instruction:
Fix failing CI tests on Python 2.6
It turns out we need the latest toolz from pip, not conda
(which is no longer building packages for Python 2.6).
## Code After:
name: test_env
dependencies:
- python=2.6.9
- cython=0.22.1
- h5py=2.5.0
- pytest
- ordereddict
- numpy=1.9.2
- pandas=0.16.2
- matplotlib=1.4
- openssl
# no seaborn
- scipy=0.16.0
- unittest2
- pip:
- coveralls
- pytest-cov
- cyordereddict
- dask
- h5netcdf
- toolz
| name: test_env
dependencies:
- python=2.6.9
- cython=0.22.1
- h5py=2.5.0
- pytest
- ordereddict
- numpy=1.9.2
- pandas=0.16.2
- matplotlib=1.4
- openssl
- - toolz
# no seaborn
- scipy=0.16.0
- unittest2
- pip:
- coveralls
- pytest-cov
- cyordereddict
- dask
- h5netcdf
+ - toolz | 2 | 0.095238 | 1 | 1 |
6b22c4fcfdd3561a88c82f25cd5adaf57692af9e | web/database.py.ex | web/database.py.ex |
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='root',
password='secret',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater WHERE callsign = %s"
repeater = None
cursor.execute(query, (callsign,))
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
cursor.close()
return repeater
def close(self):
self.cnx.close()
|
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='openqua',
password='xxxxxxxxxxxxxxx',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater WHERE callsign = %s"
repeater = None
cursor.execute(query, (callsign,))
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
cursor.close()
return repeater
def get_all_repeaters(self):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater"
cursor.execute(query)
repeaters = []
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
repeaters.append(repeater)
return repeaters
def close(self):
self.cnx.close()
| Add database class for web | Add database class for web
| Elixir | bsd-3-clause | openqua/openqua | elixir | ## Code Before:
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='root',
password='secret',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater WHERE callsign = %s"
repeater = None
cursor.execute(query, (callsign,))
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
cursor.close()
return repeater
def close(self):
self.cnx.close()
## Instruction:
Add database class for web
## Code After:
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(user='openqua',
password='xxxxxxxxxxxxxxx',
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater WHERE callsign = %s"
repeater = None
cursor.execute(query, (callsign,))
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
cursor.close()
return repeater
def get_all_repeaters(self):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater"
cursor.execute(query)
repeaters = []
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
repeaters.append(repeater)
return repeaters
def close(self):
self.cnx.close()
|
import mysql.connector
class Database:
def __init__(self):
- self.cnx = mysql.connector.connect(user='root',
? - ^^
+ self.cnx = mysql.connector.connect(user='openqua',
? ^^^^^^
- password='secret',
? ^^^^^^
+ password='xxxxxxxxxxxxxxx',
? ^^^^^^^^^^^^^^^
host='127.0.0.1', database='openqua')
def get_repeater(self, callsign):
cursor = self.cnx.cursor()
query = "SELECT * FROM repeater WHERE callsign = %s"
repeater = None
cursor.execute(query, (callsign,))
for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
repeater = { 'callsign': callsign,
'rx': rx,
'tx': tx,
'to': to,
'mo': mo,
'ml': ml,
'lo': lo,
'ke': ke,
'lat': lat,
'lon': lon }
cursor.close()
return repeater
+ def get_all_repeaters(self):
+ cursor = self.cnx.cursor()
+ query = "SELECT * FROM repeater"
+ cursor.execute(query)
+ repeaters = []
+ for (callsign, rx, tx, to, mo, ml, lo, ke, lat, lon) in cursor:
+ repeater = { 'callsign': callsign,
+ 'rx': rx,
+ 'tx': tx,
+ 'to': to,
+ 'mo': mo,
+ 'ml': ml,
+ 'lo': lo,
+ 'ke': ke,
+ 'lat': lat,
+ 'lon': lon }
+ repeaters.append(repeater)
+ return repeaters
+
+
def close(self):
self.cnx.close()
| 24 | 0.727273 | 22 | 2 |
7164d8cb003bc2adc83373978a9b21d4bc38bfc2 | components/main_layout/header/templates/user.jade | components/main_layout/header/templates/user.jade | .main-layout-header-user
if user
span.mlh-user-name.hover-pulldown( data-anchor='right', data-mode='hover' )
= user.get('name') ? user.get('name') : 'Account'
.hover-pulldown-menu
a.hpm-header( href='/following/artists' ) Follows & Favorites
a( href='/following/artists' ) Artists
a( href='/favorites' ) Works
a( href='/following/profiles' ) Galleries
hr
if user.isAdmin()
a( href= sd.ADMIN_URL ) Admin
if user.isAdmin() || user.get('has_partner_access')
a( href= sd.CMS_URL ) CMS
if user.isAdmin() || user.get('has_partner_access')
hr
a( href='/user/edit' ) Settings
a.mlh-logout Log out
else
a.mlh-top-nav-link.mlh-login( href='/log_in' ) Log in
a.mlh-top-nav-link.mlh-signup( href='/sign_up' ) Sign up
| .main-layout-header-user
if user
span.mlh-user-name.hover-pulldown( data-anchor='right', data-mode='hover' )
= user.get('name') ? user.get('name') : 'Account'
.hover-pulldown-menu
if user.isAdmin()
a( href= sd.ADMIN_URL ) Admin
if user.isAdmin() || user.get('has_partner_access')
a( href= sd.CMS_URL ) CMS
if user.isAdmin() || user.get('has_partner_access')
hr
a( href='/user/edit' ) Settings
a.mlh-logout Log out
else
a.mlh-top-nav-link.mlh-login( href='/log_in' ) Log in
a.mlh-top-nav-link.mlh-signup( href='/sign_up' ) Sign up
| Remove pull down links to follows/favorites | Remove pull down links to follows/favorites
| Jade | mit | xtina-starr/force,erikdstock/force,anandaroop/force,eessex/force,artsy/force-public,oxaudo/force,kanaabe/force,izakp/force,joeyAghion/force,mzikherman/force,mzikherman/force,anandaroop/force,joeyAghion/force,eessex/force,izakp/force,eessex/force,joeyAghion/force,damassi/force,oxaudo/force,kanaabe/force,xtina-starr/force,dblock/force,dblock/force,erikdstock/force,cavvia/force-1,anandaroop/force,artsy/force,yuki24/force,xtina-starr/force,xtina-starr/force,joeyAghion/force,mzikherman/force,damassi/force,kanaabe/force,artsy/force,oxaudo/force,erikdstock/force,cavvia/force-1,erikdstock/force,anandaroop/force,yuki24/force,kanaabe/force,yuki24/force,izakp/force,artsy/force,damassi/force,dblock/force,oxaudo/force,yuki24/force,cavvia/force-1,artsy/force,mzikherman/force,kanaabe/force,damassi/force,izakp/force,eessex/force,artsy/force-public,cavvia/force-1 | jade | ## Code Before:
.main-layout-header-user
if user
span.mlh-user-name.hover-pulldown( data-anchor='right', data-mode='hover' )
= user.get('name') ? user.get('name') : 'Account'
.hover-pulldown-menu
a.hpm-header( href='/following/artists' ) Follows & Favorites
a( href='/following/artists' ) Artists
a( href='/favorites' ) Works
a( href='/following/profiles' ) Galleries
hr
if user.isAdmin()
a( href= sd.ADMIN_URL ) Admin
if user.isAdmin() || user.get('has_partner_access')
a( href= sd.CMS_URL ) CMS
if user.isAdmin() || user.get('has_partner_access')
hr
a( href='/user/edit' ) Settings
a.mlh-logout Log out
else
a.mlh-top-nav-link.mlh-login( href='/log_in' ) Log in
a.mlh-top-nav-link.mlh-signup( href='/sign_up' ) Sign up
## Instruction:
Remove pull down links to follows/favorites
## Code After:
.main-layout-header-user
if user
span.mlh-user-name.hover-pulldown( data-anchor='right', data-mode='hover' )
= user.get('name') ? user.get('name') : 'Account'
.hover-pulldown-menu
if user.isAdmin()
a( href= sd.ADMIN_URL ) Admin
if user.isAdmin() || user.get('has_partner_access')
a( href= sd.CMS_URL ) CMS
if user.isAdmin() || user.get('has_partner_access')
hr
a( href='/user/edit' ) Settings
a.mlh-logout Log out
else
a.mlh-top-nav-link.mlh-login( href='/log_in' ) Log in
a.mlh-top-nav-link.mlh-signup( href='/sign_up' ) Sign up
| .main-layout-header-user
if user
span.mlh-user-name.hover-pulldown( data-anchor='right', data-mode='hover' )
= user.get('name') ? user.get('name') : 'Account'
.hover-pulldown-menu
- a.hpm-header( href='/following/artists' ) Follows & Favorites
- a( href='/following/artists' ) Artists
- a( href='/favorites' ) Works
- a( href='/following/profiles' ) Galleries
- hr
-
if user.isAdmin()
a( href= sd.ADMIN_URL ) Admin
if user.isAdmin() || user.get('has_partner_access')
a( href= sd.CMS_URL ) CMS
if user.isAdmin() || user.get('has_partner_access')
hr
a( href='/user/edit' ) Settings
a.mlh-logout Log out
else
a.mlh-top-nav-link.mlh-login( href='/log_in' ) Log in
a.mlh-top-nav-link.mlh-signup( href='/sign_up' ) Sign up | 6 | 0.24 | 0 | 6 |
2951452c2cb18a504fd3f1a2e5009ecdbece9599 | config/deploy.rb | config/deploy.rb | namespace :deploy do
task :cold do # Overriding the default deploy:cold
update
setup_db
start
end
task :setup_db, :roles => :app do
run "cd #{current_path}; /usr/bin/env bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
end
#Application
set :application, 'bookyt'
set :repository, 'git@github.com:huerlisi/bookyt.git'
# Staging
set :stages, %w(production)
set :default_stage, 'production'
require 'capistrano/ext/multistage'
# Deployment
set :server, :passenger
set :user, "deployer" # The server's user for deploys
# Configuration
set :scm, :git
set :branch, "master"
ssh_options[:forward_agent] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
set :copy_exclude, [".git", "spec"]
# Passenger
require 'cap_recipes/tasks/passenger'
# Bundle install
require "bundler/capistrano"
after "bundle:install", "deploy:migrate"
| namespace :deploy do
task :cold do # Overriding the default deploy:cold
update
setup_db
start
end
task :setup_db, :roles => :app do
run "cd #{current_path}; /usr/bin/env bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
end
#Application
set :application, 'bookyt'
set :repository, 'git@github.com:huerlisi/bookyt.git'
# Staging
set :stages, %w(production)
set :default_stage, 'production'
require 'capistrano/ext/multistage'
# Deployment
set :server, :passenger
set :user, "deployer" # The server's user for deploys
# Configuration
set :scm, :git
set :branch, "master"
ssh_options[:forward_agent] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
set :copy_exclude, [".git", "spec"]
# Passenger
require 'cap_recipes/tasks/passenger'
# Bundle install
require "bundler/capistrano"
after "bundle:install", "deploy:migrate"
# Asset Pipeline
after 'deploy:update_code' do
run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
end
| Add asset precompile cap recipe. | Add asset precompile cap recipe.
| Ruby | agpl-3.0 | gaapt/bookyt,xuewenfei/bookyt,huerlisi/bookyt,hauledev/bookyt,silvermind/bookyt,silvermind/bookyt,huerlisi/bookyt,xuewenfei/bookyt,wtag/bookyt,gaapt/bookyt,hauledev/bookyt,silvermind/bookyt,wtag/bookyt,xuewenfei/bookyt,gaapt/bookyt,wtag/bookyt,silvermind/bookyt,huerlisi/bookyt,gaapt/bookyt,hauledev/bookyt,hauledev/bookyt | ruby | ## Code Before:
namespace :deploy do
task :cold do # Overriding the default deploy:cold
update
setup_db
start
end
task :setup_db, :roles => :app do
run "cd #{current_path}; /usr/bin/env bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
end
#Application
set :application, 'bookyt'
set :repository, 'git@github.com:huerlisi/bookyt.git'
# Staging
set :stages, %w(production)
set :default_stage, 'production'
require 'capistrano/ext/multistage'
# Deployment
set :server, :passenger
set :user, "deployer" # The server's user for deploys
# Configuration
set :scm, :git
set :branch, "master"
ssh_options[:forward_agent] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
set :copy_exclude, [".git", "spec"]
# Passenger
require 'cap_recipes/tasks/passenger'
# Bundle install
require "bundler/capistrano"
after "bundle:install", "deploy:migrate"
## Instruction:
Add asset precompile cap recipe.
## Code After:
namespace :deploy do
task :cold do # Overriding the default deploy:cold
update
setup_db
start
end
task :setup_db, :roles => :app do
run "cd #{current_path}; /usr/bin/env bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
end
#Application
set :application, 'bookyt'
set :repository, 'git@github.com:huerlisi/bookyt.git'
# Staging
set :stages, %w(production)
set :default_stage, 'production'
require 'capistrano/ext/multistage'
# Deployment
set :server, :passenger
set :user, "deployer" # The server's user for deploys
# Configuration
set :scm, :git
set :branch, "master"
ssh_options[:forward_agent] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
set :copy_exclude, [".git", "spec"]
# Passenger
require 'cap_recipes/tasks/passenger'
# Bundle install
require "bundler/capistrano"
after "bundle:install", "deploy:migrate"
# Asset Pipeline
after 'deploy:update_code' do
run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
end
| namespace :deploy do
task :cold do # Overriding the default deploy:cold
update
setup_db
start
end
task :setup_db, :roles => :app do
run "cd #{current_path}; /usr/bin/env bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
end
#Application
set :application, 'bookyt'
set :repository, 'git@github.com:huerlisi/bookyt.git'
# Staging
set :stages, %w(production)
set :default_stage, 'production'
require 'capistrano/ext/multistage'
# Deployment
set :server, :passenger
set :user, "deployer" # The server's user for deploys
# Configuration
set :scm, :git
set :branch, "master"
ssh_options[:forward_agent] = true
set :use_sudo, false
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
set :copy_exclude, [".git", "spec"]
# Passenger
require 'cap_recipes/tasks/passenger'
# Bundle install
require "bundler/capistrano"
after "bundle:install", "deploy:migrate"
+
+ # Asset Pipeline
+ after 'deploy:update_code' do
+ run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
+ end | 5 | 0.125 | 5 | 0 |
c1d22d24e6c1d7aa1a70e07e39ee0196da86b26f | scripts/stock_price/white_noise.py | scripts/stock_price/white_noise.py |
'''
Create a white noise animation like a TV screen
'''
import numpy as np
from PIL import Image
width = 128
height = 96
n_frames = 10
frame_duration = 100
center_value = 64
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y in range(0, height):
for x in range(0, width):
value = int(np.random.normal() * center_value) + center_value
image[y, x] = value
return Image.fromarray(np.uint8(np.clip(image, 0, 255)))
images = list(map(lambda _: create_image(), range(0, n_frames)))
images[0].save('out/white_noise.gif',
save_all=True, append_images=images[1:], optimize=False,
duration=frame_duration, loop=0)
|
'''
Create a white noise animation like a TV screen
'''
import itertools
import random
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
width = 256
height = 192
max_value = 255 # brightness
value_center = 64 # mean
value_range = 16 # stddev
n_frames = 10
frame_duration = 100
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y in range(0, height):
for x in range(0, width):
image[y, x] = int(np.random.normal() * value_range + value_center)
pixels = np.uint8(np.clip(image, 0, max_value))
return Image.fromarray(pixels), pixels
images, pixels = map(list, zip(*map(lambda _: create_image(), range(0, n_frames))))
images[0].save('out/white_noise.gif',
save_all=True, append_images=images[1:], optimize=False,
duration=frame_duration, loop=0)
plt.hist(x=np.array(pixels).reshape(-1), bins=range(0, max_value + 1))
plt.xlabel('value (brightness)')
plt.ylabel('# of pixels')
xticks = list(itertools.takewhile(lambda x: x <= (max_value + 1), itertools.count(0, value_center)))
plt.xticks(xticks)
plt.yticks([])
plt.savefig('out/white_noise_hist.png', dpi=160)
| Fix distributions of the white noise sampler | Fix distributions of the white noise sampler
| Python | mit | zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend | python | ## Code Before:
'''
Create a white noise animation like a TV screen
'''
import numpy as np
from PIL import Image
width = 128
height = 96
n_frames = 10
frame_duration = 100
center_value = 64
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y in range(0, height):
for x in range(0, width):
value = int(np.random.normal() * center_value) + center_value
image[y, x] = value
return Image.fromarray(np.uint8(np.clip(image, 0, 255)))
images = list(map(lambda _: create_image(), range(0, n_frames)))
images[0].save('out/white_noise.gif',
save_all=True, append_images=images[1:], optimize=False,
duration=frame_duration, loop=0)
## Instruction:
Fix distributions of the white noise sampler
## Code After:
'''
Create a white noise animation like a TV screen
'''
import itertools
import random
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
width = 256
height = 192
max_value = 255 # brightness
value_center = 64 # mean
value_range = 16 # stddev
n_frames = 10
frame_duration = 100
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y in range(0, height):
for x in range(0, width):
image[y, x] = int(np.random.normal() * value_range + value_center)
pixels = np.uint8(np.clip(image, 0, max_value))
return Image.fromarray(pixels), pixels
images, pixels = map(list, zip(*map(lambda _: create_image(), range(0, n_frames))))
images[0].save('out/white_noise.gif',
save_all=True, append_images=images[1:], optimize=False,
duration=frame_duration, loop=0)
plt.hist(x=np.array(pixels).reshape(-1), bins=range(0, max_value + 1))
plt.xlabel('value (brightness)')
plt.ylabel('# of pixels')
xticks = list(itertools.takewhile(lambda x: x <= (max_value + 1), itertools.count(0, value_center)))
plt.xticks(xticks)
plt.yticks([])
plt.savefig('out/white_noise_hist.png', dpi=160)
|
'''
Create a white noise animation like a TV screen
'''
+ import itertools
+ import random
+ import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
- width = 128
? - ^
+ width = 256
? ^^
- height = 96
? ^
+ height = 192
? + ^
+ max_value = 255 # brightness
+ value_center = 64 # mean
+ value_range = 16 # stddev
n_frames = 10
frame_duration = 100
- center_value = 64
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y in range(0, height):
for x in range(0, width):
+ image[y, x] = int(np.random.normal() * value_range + value_center)
- value = int(np.random.normal() * center_value) + center_value
- image[y, x] = value
- return Image.fromarray(np.uint8(np.clip(image, 0, 255)))
+ pixels = np.uint8(np.clip(image, 0, max_value))
+ return Image.fromarray(pixels), pixels
+
- images = list(map(lambda _: create_image(), range(0, n_frames)))
+ images, pixels = map(list, zip(*map(lambda _: create_image(), range(0, n_frames))))
? ++++++++ ++++ +++++ + +
images[0].save('out/white_noise.gif',
save_all=True, append_images=images[1:], optimize=False,
duration=frame_duration, loop=0)
+
+ plt.hist(x=np.array(pixels).reshape(-1), bins=range(0, max_value + 1))
+ plt.xlabel('value (brightness)')
+ plt.ylabel('# of pixels')
+ xticks = list(itertools.takewhile(lambda x: x <= (max_value + 1), itertools.count(0, value_center)))
+ plt.xticks(xticks)
+ plt.yticks([])
+ plt.savefig('out/white_noise_hist.png', dpi=160) | 28 | 1.076923 | 21 | 7 |
8ff38149ce921f17cfbb182dc69eaf8d2e5efb67 | README.md | README.md | [GraphViz]: http://www.graphviz.org/
A .NET wrapper for [GraphViz][].
# Example
```csharp
Graph graph = Graph.Undirected
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"));
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Open("graph.png"))
{
await renderer.RunAsync(graph, file, RendererLayouts.Dot, RendererFormats.Png, CancellationToken.None);
}
```

| [GraphViz]: http://www.graphviz.org/
A .NET wrapper for [GraphViz][].
# Example
```csharp
Graph graph = Graph.Undirected
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"));
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Open("graph.png"))
{
await renderer.RunAsync(
graph, file,
RendererLayouts.Dot,
RendererFormats.Png,
CancellationToken.None);
}
```

| Format code sample in readme. | Format code sample in readme.
| Markdown | mit | timothy-shields/graphviz | markdown | ## Code Before:
[GraphViz]: http://www.graphviz.org/
A .NET wrapper for [GraphViz][].
# Example
```csharp
Graph graph = Graph.Undirected
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"));
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Open("graph.png"))
{
await renderer.RunAsync(graph, file, RendererLayouts.Dot, RendererFormats.Png, CancellationToken.None);
}
```

## Instruction:
Format code sample in readme.
## Code After:
[GraphViz]: http://www.graphviz.org/
A .NET wrapper for [GraphViz][].
# Example
```csharp
Graph graph = Graph.Undirected
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"));
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Open("graph.png"))
{
await renderer.RunAsync(
graph, file,
RendererLayouts.Dot,
RendererFormats.Png,
CancellationToken.None);
}
```

| [GraphViz]: http://www.graphviz.org/
A .NET wrapper for [GraphViz][].
# Example
```csharp
Graph graph = Graph.Undirected
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"));
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Open("graph.png"))
{
- await renderer.RunAsync(graph, file, RendererLayouts.Dot, RendererFormats.Png, CancellationToken.None);
+ await renderer.RunAsync(
+ graph, file,
+ RendererLayouts.Dot,
+ RendererFormats.Png,
+ CancellationToken.None);
}
```
 | 6 | 0.333333 | 5 | 1 |
fdba4a5a14f5096e15c825e2de9736badcac7ea0 | Web/Server/lib/resist/map/Entity.js | Web/Server/lib/resist/map/Entity.js | module.exports = Entity = function(entity) {
var name = entity.name,
coordinate = entity.coordinate,
width = entity.width,
height = entity.height,
type = entity.type,
properties = {
WALKABLE: false,
DAMAGEABLE: true,
};
switch(entity.type) {
case 'STRUCTURE':
properties.DAMAGEABLE = false;
break;
default:
break;
}
this.getCoordinate = function() {
return coordinate || new Array();
}
this.isWalkable = function() {
return properties.WALKABLE;
}
this.isDamageable = function() {
return properties.DAMAGEABLE;
}
} | module.exports = Entity = function(entity) {
var name = entity.name,
coordinate = entity.coordinate,
width = entity.width,
height = entity.height,
type = entity.type,
properties = {
WALKABLE: false,
DAMAGEABLE: true,
};
switch(entity.type) {
case 'STRUCTURE':
properties.DAMAGEABLE = false;
break;
default:
break;
}
this.getCoordinate = function() {
return coordinate || new Array();
}
this.getWidth = function() {
return width;
}
this.getHeight = function() {
return height;
}
this.isWalkable = function() {
return properties.WALKABLE;
}
this.isDamageable = function() {
return properties.DAMAGEABLE;
}
} | Add entity getWidth and getHeight. | Add entity getWidth and getHeight.
| JavaScript | mit | ftheriault/resist-game,ftheriault/resist-game | javascript | ## Code Before:
module.exports = Entity = function(entity) {
var name = entity.name,
coordinate = entity.coordinate,
width = entity.width,
height = entity.height,
type = entity.type,
properties = {
WALKABLE: false,
DAMAGEABLE: true,
};
switch(entity.type) {
case 'STRUCTURE':
properties.DAMAGEABLE = false;
break;
default:
break;
}
this.getCoordinate = function() {
return coordinate || new Array();
}
this.isWalkable = function() {
return properties.WALKABLE;
}
this.isDamageable = function() {
return properties.DAMAGEABLE;
}
}
## Instruction:
Add entity getWidth and getHeight.
## Code After:
module.exports = Entity = function(entity) {
var name = entity.name,
coordinate = entity.coordinate,
width = entity.width,
height = entity.height,
type = entity.type,
properties = {
WALKABLE: false,
DAMAGEABLE: true,
};
switch(entity.type) {
case 'STRUCTURE':
properties.DAMAGEABLE = false;
break;
default:
break;
}
this.getCoordinate = function() {
return coordinate || new Array();
}
this.getWidth = function() {
return width;
}
this.getHeight = function() {
return height;
}
this.isWalkable = function() {
return properties.WALKABLE;
}
this.isDamageable = function() {
return properties.DAMAGEABLE;
}
} | module.exports = Entity = function(entity) {
var name = entity.name,
coordinate = entity.coordinate,
width = entity.width,
height = entity.height,
type = entity.type,
properties = {
WALKABLE: false,
DAMAGEABLE: true,
};
switch(entity.type) {
case 'STRUCTURE':
properties.DAMAGEABLE = false;
break;
default:
break;
}
this.getCoordinate = function() {
return coordinate || new Array();
}
+ this.getWidth = function() {
+ return width;
+ }
+
+ this.getHeight = function() {
+ return height;
+ }
+
this.isWalkable = function() {
return properties.WALKABLE;
}
this.isDamageable = function() {
return properties.DAMAGEABLE;
}
} | 8 | 0.25 | 8 | 0 |
618aa06fa17c1aed3cce18218c41b2c7e517c935 | src/pyfont.h | src/pyfont.h |
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
|
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
| Fix for newlines and other non-printable chars in renderer | Fix for newlines and other non-printable chars in renderer
| C | mit | bartoszbielawski/InfoClock,bartoszbielawski/InfoClock | c | ## Code Before:
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
## Instruction:
Fix for newlines and other non-printable chars in renderer
## Code After:
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
|
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
+ if ((ch < baseChar) || (ch > (chars + baseChar)))
+ ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
+ if ((ch < baseChar) || (ch > (chars + baseChar)))
+ ch = baseChar;
- uint16_t o = ((uint8_t)ch)-baseChar;
+ uint16_t o = ((uint8_t)ch)-baseChar;
? ++
- return data + offsets[o];
+ return data + offsets[o];
? ++
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H | 8 | 0.266667 | 6 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.