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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15e98de4b9d7f60343d42d751e544e0f32732821 | README.md | README.md | melonJS boilerplate
-------------------------------------------------------------------------------
features :
- video autoscaling
- mobile optimized HTML/CSS
- swiping disabled on iOS devices
- debug Panel (if #debug)
-------------------------------------------------------------------------------
Copyright (C) 2011 - 2013, Olivier Biot, Jason Oster
melonJS is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php) | 1. Compile coffee to js runtime
`coffee -o js/ -cw src/`
| Add info how to compile coffee script | Add info how to compile coffee script
| Markdown | mit | goozzik/btk | markdown | ## Code Before:
melonJS boilerplate
-------------------------------------------------------------------------------
features :
- video autoscaling
- mobile optimized HTML/CSS
- swiping disabled on iOS devices
- debug Panel (if #debug)
-------------------------------------------------------------------------------
Copyright (C) 2011 - 2013, Olivier Biot, Jason Oster
melonJS is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php)
## Instruction:
Add info how to compile coffee script
## Code After:
1. Compile coffee to js runtime
`coffee -o js/ -cw src/`
| + 1. Compile coffee to js runtime
+ `coffee -o js/ -cw src/`
- melonJS boilerplate
- -------------------------------------------------------------------------------
-
- features :
- - video autoscaling
- - mobile optimized HTML/CSS
- - swiping disabled on iOS devices
- - debug Panel (if #debug)
-
- -------------------------------------------------------------------------------
- Copyright (C) 2011 - 2013, Olivier Biot, Jason Oster
- melonJS is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php) | 14 | 1.166667 | 2 | 12 |
9371463ad9c16dd6801b8a8578d6d786d1d36f38 | src/BloomBrowserUI/branding/PNG-RISE/branding.json | src/BloomBrowserUI/branding/PNG-RISE/branding.json | {
"presets": [
{
"//note": "Normally we would set this to outside-back-cover-branding-top-html, but when this branding was introduced, we didn't have that option; we could only insert text into the edit box (data-book=outsideBackCover). If we were to change to the new system, all old books, which already had that inserted, would end up with two copies of this text.",
"data-book": "outsideBackCover",
"lang": "en",
"content": "<p></p><p>If you have feedback (spelling corrections, sentence order, or other changes)</p><p>that should be made to this book, please contact SIL PNG.<p></p></p><p>Email: mytalkingbooks@gmail.com</p><p>Or stop by an SIL office</p><p></p><p></p><p><b> Go to <u>www.mytalkingbooks.org</u> for more books. </b></p>",
"condition": "always"
},
{
"data-book": "title-page-branding-bottom-html",
"lang": "*",
"content": "<img class='branding' src='title-page.png'/>",
"condition": "always"
},
{
"data-book": "outside-back-cover-branding-bottom-html",
"lang": "*",
// only one of these will be visible
"content": "<img class='portraitOnly branding' src='backPortrait.svg'/><img class='landscapeOnly branding' src='backLandscape.svg'/>",
"condition": "always"
}
]
}
| {
"presets": [
{
"data-book": "title-page-branding-bottom-html",
"lang": "*",
"content": "<img class='branding' src='title-page.png'/>",
"condition": "always"
},
{
"data-book": "outside-back-cover-branding-bottom-html",
"lang": "*",
// only one of these will be visible
"content": "<img class='portraitOnly branding' src='backPortrait.svg'/><img class='landscapeOnly branding' src='backLandscape.svg'/>",
"condition": "always"
}
]
}
| Remove PNG-RISE contact information boilerplate as requested (BL-9546) | Remove PNG-RISE contact information boilerplate as requested (BL-9546)
This does nothing to remove it from existing books, but at least it will
stop introducing it automatically.
| JSON | mit | StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork | json | ## Code Before:
{
"presets": [
{
"//note": "Normally we would set this to outside-back-cover-branding-top-html, but when this branding was introduced, we didn't have that option; we could only insert text into the edit box (data-book=outsideBackCover). If we were to change to the new system, all old books, which already had that inserted, would end up with two copies of this text.",
"data-book": "outsideBackCover",
"lang": "en",
"content": "<p></p><p>If you have feedback (spelling corrections, sentence order, or other changes)</p><p>that should be made to this book, please contact SIL PNG.<p></p></p><p>Email: mytalkingbooks@gmail.com</p><p>Or stop by an SIL office</p><p></p><p></p><p><b> Go to <u>www.mytalkingbooks.org</u> for more books. </b></p>",
"condition": "always"
},
{
"data-book": "title-page-branding-bottom-html",
"lang": "*",
"content": "<img class='branding' src='title-page.png'/>",
"condition": "always"
},
{
"data-book": "outside-back-cover-branding-bottom-html",
"lang": "*",
// only one of these will be visible
"content": "<img class='portraitOnly branding' src='backPortrait.svg'/><img class='landscapeOnly branding' src='backLandscape.svg'/>",
"condition": "always"
}
]
}
## Instruction:
Remove PNG-RISE contact information boilerplate as requested (BL-9546)
This does nothing to remove it from existing books, but at least it will
stop introducing it automatically.
## Code After:
{
"presets": [
{
"data-book": "title-page-branding-bottom-html",
"lang": "*",
"content": "<img class='branding' src='title-page.png'/>",
"condition": "always"
},
{
"data-book": "outside-back-cover-branding-bottom-html",
"lang": "*",
// only one of these will be visible
"content": "<img class='portraitOnly branding' src='backPortrait.svg'/><img class='landscapeOnly branding' src='backLandscape.svg'/>",
"condition": "always"
}
]
}
| {
"presets": [
- {
- "//note": "Normally we would set this to outside-back-cover-branding-top-html, but when this branding was introduced, we didn't have that option; we could only insert text into the edit box (data-book=outsideBackCover). If we were to change to the new system, all old books, which already had that inserted, would end up with two copies of this text.",
- "data-book": "outsideBackCover",
- "lang": "en",
- "content": "<p></p><p>If you have feedback (spelling corrections, sentence order, or other changes)</p><p>that should be made to this book, please contact SIL PNG.<p></p></p><p>Email: mytalkingbooks@gmail.com</p><p>Or stop by an SIL office</p><p></p><p></p><p><b> Go to <u>www.mytalkingbooks.org</u> for more books. </b></p>",
- "condition": "always"
- },
{
"data-book": "title-page-branding-bottom-html",
"lang": "*",
"content": "<img class='branding' src='title-page.png'/>",
"condition": "always"
},
{
"data-book": "outside-back-cover-branding-bottom-html",
"lang": "*",
// only one of these will be visible
"content": "<img class='portraitOnly branding' src='backPortrait.svg'/><img class='landscapeOnly branding' src='backLandscape.svg'/>",
"condition": "always"
}
]
} | 7 | 0.291667 | 0 | 7 |
e981cc2a51cf6bf099b4115610500aecb1ace270 | sources/wmo.int/2015-country-matcher/meta.txt | sources/wmo.int/2015-country-matcher/meta.txt | URL: https://www.wmo.int/cpdb/tools/countrymatcher
Title: Country2PUB5 matcher
Description:
Please input country names into the textfield
and press match to start matching process
| URL: https://www.wmo.int/cpdb/tools/countrymatcher
Title: Country2PUB5 matcher
Checked: 2015-01-28
Description:
Please input country names into the textfield
and press match to start matching process
| Check data.csv vs source in HTML format | Check data.csv vs source in HTML format
I compared the data with the table row by row, and found no differences.
| Text | cc0-1.0 | eric-brechemier/ipcc-countries,eric-brechemier/ipcc-countries | text | ## Code Before:
URL: https://www.wmo.int/cpdb/tools/countrymatcher
Title: Country2PUB5 matcher
Description:
Please input country names into the textfield
and press match to start matching process
## Instruction:
Check data.csv vs source in HTML format
I compared the data with the table row by row, and found no differences.
## Code After:
URL: https://www.wmo.int/cpdb/tools/countrymatcher
Title: Country2PUB5 matcher
Checked: 2015-01-28
Description:
Please input country names into the textfield
and press match to start matching process
| URL: https://www.wmo.int/cpdb/tools/countrymatcher
Title: Country2PUB5 matcher
+ Checked: 2015-01-28
Description:
Please input country names into the textfield
and press match to start matching process | 1 | 0.166667 | 1 | 0 |
33cf5f7dedbde1ac7d2bd46f64e0fe429676bf6b | README.md | README.md |
Basic implementation of EventEmitter in Dart.
## Limitations
* `EventEmitter::emit` does not allow (yet!) to pass dynamic number of arguments to handler
## To be done
* Create `EventInterface` to be able to hold data needed to handle event by event listener (removes need to pass dynamic number of arguments to `emit`)
* Create `EventHandlerInterface` to be able to hold handlers in separate classes
* If `EventInterface` is implemented, allow to add listeners not only by string but also by event type
* asynchronous event handling with Futures
* add dart-docs for `EventEmitter` and related
* publish package
* bump up version to 0.1 when points above will be implemented
| [](https://travis-ci.org/eps90/event-emitter.dart)
[](https://coveralls.io/r/eps90/event-emitter.dart?branch=master)
Basic implementation of EventEmitter in Dart.
## Limitations
* `EventEmitter::emit` does not allow (yet!) to pass dynamic number of arguments to handler
## To be done
* Create `EventInterface` to be able to hold data needed to handle event by event listener (removes need to pass dynamic number of arguments to `emit`)
* Create `EventHandlerInterface` to be able to hold handlers in separate classes
* If `EventInterface` is implemented, allow to add listeners not only by string but also by event type
* asynchronous event handling with Futures
* add dart-docs for `EventEmitter` and related
* publish package
* bump up version to 0.1 when points above will be implemented
| Add Travis CI and Coveralls badges | Add Travis CI and Coveralls badges
| Markdown | mit | eps90/event-emitter.dart,eps90/event-emitter.dart | markdown | ## Code Before:
Basic implementation of EventEmitter in Dart.
## Limitations
* `EventEmitter::emit` does not allow (yet!) to pass dynamic number of arguments to handler
## To be done
* Create `EventInterface` to be able to hold data needed to handle event by event listener (removes need to pass dynamic number of arguments to `emit`)
* Create `EventHandlerInterface` to be able to hold handlers in separate classes
* If `EventInterface` is implemented, allow to add listeners not only by string but also by event type
* asynchronous event handling with Futures
* add dart-docs for `EventEmitter` and related
* publish package
* bump up version to 0.1 when points above will be implemented
## Instruction:
Add Travis CI and Coveralls badges
## Code After:
[](https://travis-ci.org/eps90/event-emitter.dart)
[](https://coveralls.io/r/eps90/event-emitter.dart?branch=master)
Basic implementation of EventEmitter in Dart.
## Limitations
* `EventEmitter::emit` does not allow (yet!) to pass dynamic number of arguments to handler
## To be done
* Create `EventInterface` to be able to hold data needed to handle event by event listener (removes need to pass dynamic number of arguments to `emit`)
* Create `EventHandlerInterface` to be able to hold handlers in separate classes
* If `EventInterface` is implemented, allow to add listeners not only by string but also by event type
* asynchronous event handling with Futures
* add dart-docs for `EventEmitter` and related
* publish package
* bump up version to 0.1 when points above will be implemented
| + [](https://travis-ci.org/eps90/event-emitter.dart)
+ [](https://coveralls.io/r/eps90/event-emitter.dart?branch=master)
Basic implementation of EventEmitter in Dart.
## Limitations
* `EventEmitter::emit` does not allow (yet!) to pass dynamic number of arguments to handler
## To be done
* Create `EventInterface` to be able to hold data needed to handle event by event listener (removes need to pass dynamic number of arguments to `emit`)
* Create `EventHandlerInterface` to be able to hold handlers in separate classes
* If `EventInterface` is implemented, allow to add listeners not only by string but also by event type
* asynchronous event handling with Futures
* add dart-docs for `EventEmitter` and related
* publish package
* bump up version to 0.1 when points above will be implemented | 2 | 0.142857 | 2 | 0 |
f1ddcc890bc3df048a913a75460bcb277381c924 | source/css/main.css | source/css/main.css | /* custom properties */
/* custom selectors */
/* usage */
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000000;
color: rgba(0, 0, 0, 0.9);
}
pre,
.highlight {
background: #212121;
}
pre,
.highlight {
background: #2e2e2e;
color: #ddd;
line-height: 0.8em
}
pre .constant, .highlight .constant {
color: #66d9ef;
}
| /* custom properties */
/* custom selectors */
/* usage */
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000000;
color: rgba(0, 0, 0, 0.9);
}
pre,
.highlight {
background: #212121;
}
pre,
.highlight {
color: #f5f5f5
}
pre .string, .highlight .string {
color: #ffeb3b;
}
pre .comment, .highlight .comment {
color: #727272;
}
pre .keyword, .highlight .keyword {
color: #FF4081;
}
pre .built_in, .highlight .built_in {
color: #00BCD4;
}
| Add first version of syntax highlighting | Add first version of syntax highlighting
Built from c5a0c4724cb14420ddce23b12c29264db0659847.
| CSS | mit | ahaasler/hexo-theme-colos,ahaasler/hexo-theme-colos | css | ## Code Before:
/* custom properties */
/* custom selectors */
/* usage */
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000000;
color: rgba(0, 0, 0, 0.9);
}
pre,
.highlight {
background: #212121;
}
pre,
.highlight {
background: #2e2e2e;
color: #ddd;
line-height: 0.8em
}
pre .constant, .highlight .constant {
color: #66d9ef;
}
## Instruction:
Add first version of syntax highlighting
Built from c5a0c4724cb14420ddce23b12c29264db0659847.
## Code After:
/* custom properties */
/* custom selectors */
/* usage */
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000000;
color: rgba(0, 0, 0, 0.9);
}
pre,
.highlight {
background: #212121;
}
pre,
.highlight {
color: #f5f5f5
}
pre .string, .highlight .string {
color: #ffeb3b;
}
pre .comment, .highlight .comment {
color: #727272;
}
pre .keyword, .highlight .keyword {
color: #FF4081;
}
pre .built_in, .highlight .built_in {
color: #00BCD4;
}
| /* custom properties */
/* custom selectors */
/* usage */
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000000;
color: rgba(0, 0, 0, 0.9);
}
pre,
.highlight {
background: #212121;
}
pre,
.highlight {
+ color: #f5f5f5
- background: #2e2e2e;
- color: #ddd;
- line-height: 0.8em
}
- pre .constant, .highlight .constant {
? --- ^ ^ --- ^ ^
+ pre .string, .highlight .string {
? ^^ ^ ^^ ^
- color: #66d9ef;
+ color: #ffeb3b;
}
+ pre .comment, .highlight .comment {
+ color: #727272;
+ }
+ pre .keyword, .highlight .keyword {
+ color: #FF4081;
+ }
+ pre .built_in, .highlight .built_in {
+ color: #00BCD4;
+ } | 17 | 0.607143 | 12 | 5 |
077ec2b416d3a69bf82c52f5d18e361f014122f6 | tests/Functional/BatchActionsTest.php | tests/Functional/BatchActionsTest.php | <?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
final class BatchActionsTest extends BaseFunctionalTestCase
{
/**
* @dataProvider provideBatchActionsCases
*/
public function testBatchActions(string $url, string $action): void
{
$this->client->request(Request::METHOD_GET, $url);
$this->client->submitForm('OK', [
'all_elements' => true,
'action' => $action,
]);
$this->client->submitForm('Yes, execute');
self::assertResponseIsSuccessful();
}
/**
* @return iterable<array<string>>
*
* @phpstan-return iterable<array{0: string}>
*/
public static function provideBatchActionsCases(): iterable
{
yield 'Normal delete' => ['/admin/tests/app/book/list', 'delete'];
yield 'Joined delete' => ['/admin/tests/app/author/list', 'delete'];
}
}
| <?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
final class BatchActionsTest extends BaseFunctionalTestCase
{
/**
* @dataProvider provideBatchActionsCases
*/
public function testBatchActions(string $url, string $action): void
{
$this->client->request(Request::METHOD_GET, $url);
$this->client->submitForm('OK', [
'all_elements' => true,
'action' => $action,
]);
$this->client->submitForm('Yes, execute');
self::assertResponseIsSuccessful();
}
/**
* @return iterable<array<string>>
*
* @phpstan-return iterable<array{0: string}>
*/
public static function provideBatchActionsCases(): iterable
{
yield 'Normal delete' => ['/admin/tests/app/book/list', 'delete'];
yield 'Joined delete' => ['/admin/tests/app/author/list', 'delete'];
yield 'More than 20 items delete' => ['/admin/tests/app/sub/list', 'delete'];
}
}
| Add another case to delete | Add another case to delete
| PHP | mit | sonata-project/SonataDoctrineORMAdminBundle | php | ## Code Before:
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
final class BatchActionsTest extends BaseFunctionalTestCase
{
/**
* @dataProvider provideBatchActionsCases
*/
public function testBatchActions(string $url, string $action): void
{
$this->client->request(Request::METHOD_GET, $url);
$this->client->submitForm('OK', [
'all_elements' => true,
'action' => $action,
]);
$this->client->submitForm('Yes, execute');
self::assertResponseIsSuccessful();
}
/**
* @return iterable<array<string>>
*
* @phpstan-return iterable<array{0: string}>
*/
public static function provideBatchActionsCases(): iterable
{
yield 'Normal delete' => ['/admin/tests/app/book/list', 'delete'];
yield 'Joined delete' => ['/admin/tests/app/author/list', 'delete'];
}
}
## Instruction:
Add another case to delete
## Code After:
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
final class BatchActionsTest extends BaseFunctionalTestCase
{
/**
* @dataProvider provideBatchActionsCases
*/
public function testBatchActions(string $url, string $action): void
{
$this->client->request(Request::METHOD_GET, $url);
$this->client->submitForm('OK', [
'all_elements' => true,
'action' => $action,
]);
$this->client->submitForm('Yes, execute');
self::assertResponseIsSuccessful();
}
/**
* @return iterable<array<string>>
*
* @phpstan-return iterable<array{0: string}>
*/
public static function provideBatchActionsCases(): iterable
{
yield 'Normal delete' => ['/admin/tests/app/book/list', 'delete'];
yield 'Joined delete' => ['/admin/tests/app/author/list', 'delete'];
yield 'More than 20 items delete' => ['/admin/tests/app/sub/list', 'delete'];
}
}
| <?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\DoctrineORMAdminBundle\Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
final class BatchActionsTest extends BaseFunctionalTestCase
{
/**
* @dataProvider provideBatchActionsCases
*/
public function testBatchActions(string $url, string $action): void
{
$this->client->request(Request::METHOD_GET, $url);
$this->client->submitForm('OK', [
'all_elements' => true,
'action' => $action,
]);
$this->client->submitForm('Yes, execute');
self::assertResponseIsSuccessful();
}
/**
* @return iterable<array<string>>
*
* @phpstan-return iterable<array{0: string}>
*/
public static function provideBatchActionsCases(): iterable
{
yield 'Normal delete' => ['/admin/tests/app/book/list', 'delete'];
yield 'Joined delete' => ['/admin/tests/app/author/list', 'delete'];
+ yield 'More than 20 items delete' => ['/admin/tests/app/sub/list', 'delete'];
}
} | 1 | 0.022222 | 1 | 0 |
2acdd992ac239e9fd6be320452f80f38928765fd | web_external/js/models/WmsSourceModel.js | web_external/js/models/WmsSourceModel.js | minerva.models.WmsSourceModel = minerva.models.SourceModel.extend({
createSource: function (name, baseURL, projection) {
var params = {
name: name,
baseURL: baseURL,
projection: projection
};
girder.restRequest({
path: '/minerva_source/wms_source',
type: 'POST',
data: params,
error: null // ignore default error behavior (validation may fail)
}).done(_.bind(function (resp) {
this.set(resp);
this.trigger('m:saved');
}, this)).error(_.bind(function (err) {
this.trigger('m:error', err);
}, this));
return this;
}
});
| minerva.models.WmsSourceModel = minerva.models.SourceModel.extend({
createSource: function (name, baseURL) {
var params = {
name: name,
baseURL: baseURL
};
girder.restRequest({
path: '/minerva_source/wms_source',
type: 'POST',
data: params,
error: null // ignore default error behavior (validation may fail)
}).done(_.bind(function (resp) {
this.set(resp);
this.trigger('m:saved');
}, this)).error(_.bind(function (err) {
this.trigger('m:error', err);
}, this));
return this;
}
});
| Remove projection from client WMSSource Model | Remove projection from client WMSSource Model
| JavaScript | apache-2.0 | Kitware/minerva,Kitware/minerva,Kitware/minerva | javascript | ## Code Before:
minerva.models.WmsSourceModel = minerva.models.SourceModel.extend({
createSource: function (name, baseURL, projection) {
var params = {
name: name,
baseURL: baseURL,
projection: projection
};
girder.restRequest({
path: '/minerva_source/wms_source',
type: 'POST',
data: params,
error: null // ignore default error behavior (validation may fail)
}).done(_.bind(function (resp) {
this.set(resp);
this.trigger('m:saved');
}, this)).error(_.bind(function (err) {
this.trigger('m:error', err);
}, this));
return this;
}
});
## Instruction:
Remove projection from client WMSSource Model
## Code After:
minerva.models.WmsSourceModel = minerva.models.SourceModel.extend({
createSource: function (name, baseURL) {
var params = {
name: name,
baseURL: baseURL
};
girder.restRequest({
path: '/minerva_source/wms_source',
type: 'POST',
data: params,
error: null // ignore default error behavior (validation may fail)
}).done(_.bind(function (resp) {
this.set(resp);
this.trigger('m:saved');
}, this)).error(_.bind(function (err) {
this.trigger('m:error', err);
}, this));
return this;
}
});
| minerva.models.WmsSourceModel = minerva.models.SourceModel.extend({
- createSource: function (name, baseURL, projection) {
? ------------
+ createSource: function (name, baseURL) {
var params = {
name: name,
- baseURL: baseURL,
? -
+ baseURL: baseURL
- projection: projection
};
girder.restRequest({
path: '/minerva_source/wms_source',
type: 'POST',
data: params,
error: null // ignore default error behavior (validation may fail)
}).done(_.bind(function (resp) {
this.set(resp);
this.trigger('m:saved');
}, this)).error(_.bind(function (err) {
this.trigger('m:error', err);
}, this));
return this;
}
}); | 5 | 0.217391 | 2 | 3 |
b7b41a160294edd987f73be7817c8b08aa8ed70e | herders/templatetags/utils.py | herders/templatetags/utils.py | from django import template
register = template.Library()
@register.filter
def get_range(value):
return range(value)
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
def multiply(value, arg):
return value * arg
@register.filter
def remove_extension(string):
return string.replace('.png', '').replace("'", "").replace('(', '_').replace(')', '_')
| from django import template
register = template.Library()
@register.filter
def get_range(value):
if value:
return range(value)
else:
return 0
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
def multiply(value, arg):
return value * arg
@register.filter
def remove_extension(string):
return string.replace('.png', '').replace("'", "").replace('(', '_').replace(')', '_')
| Return 0 with the get_range filter if value is invalid instead of raise exception | Return 0 with the get_range filter if value is invalid instead of raise exception
| Python | apache-2.0 | porksmash/swarfarm,PeteAndersen/swarfarm,PeteAndersen/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm,porksmash/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm | python | ## Code Before:
from django import template
register = template.Library()
@register.filter
def get_range(value):
return range(value)
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
def multiply(value, arg):
return value * arg
@register.filter
def remove_extension(string):
return string.replace('.png', '').replace("'", "").replace('(', '_').replace(')', '_')
## Instruction:
Return 0 with the get_range filter if value is invalid instead of raise exception
## Code After:
from django import template
register = template.Library()
@register.filter
def get_range(value):
if value:
return range(value)
else:
return 0
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
def multiply(value, arg):
return value * arg
@register.filter
def remove_extension(string):
return string.replace('.png', '').replace("'", "").replace('(', '_').replace(')', '_')
| from django import template
register = template.Library()
@register.filter
def get_range(value):
+ if value:
- return range(value)
+ return range(value)
? ++++
+ else:
+ return 0
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
def multiply(value, arg):
return value * arg
@register.filter
def remove_extension(string):
return string.replace('.png', '').replace("'", "").replace('(', '_').replace(')', '_') | 5 | 0.178571 | 4 | 1 |
b4946f54a646003b907eb98469f96656bf212d36 | README.md | README.md | Code and notes for FENS 2015 Winter School on decision-making
=============================================================
This repository contains all the MATLAB code used to generate the figures for my tutorial on normative solutions to the speed/accuracy trade-off, held at the FENS-Hertie 2015 Winter School on the neuroscience on decision-making.
The derivations that result in these figures are provided in the [tutorial notes](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_notes.pdf). Further information is provided on the [tutorial slides](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_slides.pdf)
| Code and notes for FENS 2015 Winter School on decision-making
=============================================================
This repository contains all the MATLAB code used to generate the figures for my tutorial on normative solutions to the speed/accuracy trade-off, held at the FENS-Hertie 2015 Winter School on the neuroscience on decision-making.
The derivations that result in these figures are provided in the [tutorial notes](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_notes.pdf). Further information is provided on the [tutorial slides](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_slides.pdf)
| Update URLs for tutorial notes and slides | Update URLs for tutorial notes and slides
| Markdown | bsd-3-clause | jdrugo/FENS2015 | markdown | ## Code Before:
Code and notes for FENS 2015 Winter School on decision-making
=============================================================
This repository contains all the MATLAB code used to generate the figures for my tutorial on normative solutions to the speed/accuracy trade-off, held at the FENS-Hertie 2015 Winter School on the neuroscience on decision-making.
The derivations that result in these figures are provided in the [tutorial notes](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_notes.pdf). Further information is provided on the [tutorial slides](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_slides.pdf)
## Instruction:
Update URLs for tutorial notes and slides
## Code After:
Code and notes for FENS 2015 Winter School on decision-making
=============================================================
This repository contains all the MATLAB code used to generate the figures for my tutorial on normative solutions to the speed/accuracy trade-off, held at the FENS-Hertie 2015 Winter School on the neuroscience on decision-making.
The derivations that result in these figures are provided in the [tutorial notes](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_notes.pdf). Further information is provided on the [tutorial slides](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_slides.pdf)
| Code and notes for FENS 2015 Winter School on decision-making
=============================================================
This repository contains all the MATLAB code used to generate the figures for my tutorial on normative solutions to the speed/accuracy trade-off, held at the FENS-Hertie 2015 Winter School on the neuroscience on decision-making.
- The derivations that result in these figures are provided in the [tutorial notes](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_notes.pdf). Further information is provided on the [tutorial slides](https://sites.google.com/site/jdrugo/pub/pdf/fens2015_slides.pdf)
+ The derivations that result in these figures are provided in the [tutorial notes](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_notes.pdf). Further information is provided on the [tutorial slides](http://drugowitschlab.hms.harvard.edu/files/drugowitschlab/files/fens2015_slides.pdf) | 2 | 0.333333 | 1 | 1 |
644dd60a79e6ef1f2d1f838d177669fa133d17ac | environment/stage3/terpri.lisp | environment/stage3/terpri.lisp | ;;;;; tré – Copyright (c) 2013 Sven Michael Klose <pixel@copei.de>
(defvar *terpri* (format nil "~%"))
| ;;;;; tré – Copyright (c) 2013–2014 Sven Michael Klose <pixel@copei.de>
(defvar *terpri* (string (code-char 10)))
| Use CODE-CHAR instead of FORMAT. | Use CODE-CHAR instead of FORMAT.
| Common Lisp | mit | SvenMichaelKlose/tre,SvenMichaelKlose/tre,SvenMichaelKlose/tre | common-lisp | ## Code Before:
;;;;; tré – Copyright (c) 2013 Sven Michael Klose <pixel@copei.de>
(defvar *terpri* (format nil "~%"))
## Instruction:
Use CODE-CHAR instead of FORMAT.
## Code After:
;;;;; tré – Copyright (c) 2013–2014 Sven Michael Klose <pixel@copei.de>
(defvar *terpri* (string (code-char 10)))
| - ;;;;; tré – Copyright (c) 2013 Sven Michael Klose <pixel@copei.de>
+ ;;;;; tré – Copyright (c) 2013–2014 Sven Michael Klose <pixel@copei.de>
? +++++
- (defvar *terpri* (format nil "~%"))
+ (defvar *terpri* (string (code-char 10))) | 4 | 1.333333 | 2 | 2 |
a77002def2498b984b982e1cb4e4a879957a4426 | package.json | package.json | {
"name": "kuber.pl",
"version": "0.1.0",
"description": "Basic calendar of the current year with custom labels",
"engines": {
"node": "6.10.2"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "mocha tests/**.spec.js"
},
"dependencies": {
"bluebird": "3.5.0",
"contentful": "4.4.3",
"ejs": "2.5.6",
"express": "4.15.2",
"moment": "2.18.1",
"redis": "2.7.1",
"standard": "10.0.2"
},
"devDependencies": {
"chai": "4.0.2",
"dotenv": "4.0.0",
"mocha": "3.4.2"
},
"repository": {
"type": "git",
"url": "https://github.com/neu5/kuber.pl"
},
"keywords": [
"node",
"heroku",
"express",
"contentful",
"kuber",
"kuberpl"
],
"license": "MIT"
}
| {
"name": "kuber.pl",
"version": "0.1.0",
"description": "Basic calendar of the current year with custom labels",
"engines": {
"node": "6.10.2"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "standard && mocha tests/**.spec.js"
},
"dependencies": {
"bluebird": "3.5.0",
"contentful": "4.4.3",
"ejs": "2.5.6",
"express": "4.15.2",
"moment": "2.18.1",
"redis": "2.7.1"
},
"devDependencies": {
"chai": "4.0.2",
"dotenv": "4.0.0",
"mocha": "3.4.2",
"standard": "10.0.2"
},
"repository": {
"type": "git",
"url": "https://github.com/neu5/kuber.pl"
},
"keywords": [
"node",
"heroku",
"express",
"contentful",
"kuber",
"kuberpl"
],
"license": "MIT"
}
| Move standardjs to devDeps and make it run before tests | Move standardjs to devDeps and make it run before tests
| JSON | mit | neu5/kuber.pl,neu5/kuber.pl | json | ## Code Before:
{
"name": "kuber.pl",
"version": "0.1.0",
"description": "Basic calendar of the current year with custom labels",
"engines": {
"node": "6.10.2"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "mocha tests/**.spec.js"
},
"dependencies": {
"bluebird": "3.5.0",
"contentful": "4.4.3",
"ejs": "2.5.6",
"express": "4.15.2",
"moment": "2.18.1",
"redis": "2.7.1",
"standard": "10.0.2"
},
"devDependencies": {
"chai": "4.0.2",
"dotenv": "4.0.0",
"mocha": "3.4.2"
},
"repository": {
"type": "git",
"url": "https://github.com/neu5/kuber.pl"
},
"keywords": [
"node",
"heroku",
"express",
"contentful",
"kuber",
"kuberpl"
],
"license": "MIT"
}
## Instruction:
Move standardjs to devDeps and make it run before tests
## Code After:
{
"name": "kuber.pl",
"version": "0.1.0",
"description": "Basic calendar of the current year with custom labels",
"engines": {
"node": "6.10.2"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "standard && mocha tests/**.spec.js"
},
"dependencies": {
"bluebird": "3.5.0",
"contentful": "4.4.3",
"ejs": "2.5.6",
"express": "4.15.2",
"moment": "2.18.1",
"redis": "2.7.1"
},
"devDependencies": {
"chai": "4.0.2",
"dotenv": "4.0.0",
"mocha": "3.4.2",
"standard": "10.0.2"
},
"repository": {
"type": "git",
"url": "https://github.com/neu5/kuber.pl"
},
"keywords": [
"node",
"heroku",
"express",
"contentful",
"kuber",
"kuberpl"
],
"license": "MIT"
}
| {
"name": "kuber.pl",
"version": "0.1.0",
"description": "Basic calendar of the current year with custom labels",
"engines": {
"node": "6.10.2"
},
"main": "index.js",
"scripts": {
"start": "node index.js",
- "test": "mocha tests/**.spec.js"
+ "test": "standard && mocha tests/**.spec.js"
? ++++++++++++
},
"dependencies": {
"bluebird": "3.5.0",
"contentful": "4.4.3",
"ejs": "2.5.6",
"express": "4.15.2",
"moment": "2.18.1",
- "redis": "2.7.1",
? -
+ "redis": "2.7.1"
- "standard": "10.0.2"
},
"devDependencies": {
"chai": "4.0.2",
"dotenv": "4.0.0",
- "mocha": "3.4.2"
+ "mocha": "3.4.2",
? +
+ "standard": "10.0.2"
},
"repository": {
"type": "git",
"url": "https://github.com/neu5/kuber.pl"
},
"keywords": [
"node",
"heroku",
"express",
"contentful",
"kuber",
"kuberpl"
],
"license": "MIT"
} | 8 | 0.2 | 4 | 4 |
eb6632450fb65650a9f1125123f8d083729fe4c6 | etc/kayobe/overcloud.yml | etc/kayobe/overcloud.yml | ---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:
overcloud_group_hosts_map:
controllers:
- sv-b16-u23
ignore:
- sv-b16-u21
- sv-b16-u22
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
| ---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:
overcloud_group_hosts_map:
controllers:
- sv-b16-u23
ignore:
- sv-b16-u21
- sv-b16-u22
# To prevent some network issues you can choose to disable cloud-init
#disable_cloud_init:
disable_cloud_init: True
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
| Disable cloud-init on control plane hosts | Disable cloud-init on control plane hosts
When glean is used as the cloud initial configuration service, having cloud-init
enabled can cause issues. If cloud-init cannot detect network configuration, it
will apply a fallback configuration, enabling DHCP on one interface. This can
break existing network configuration, so we disable cloud-init to avoid this.
| YAML | apache-2.0 | SKA-ScienceDataProcessor/alaska-kayobe-config | yaml | ## Code Before:
---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:
overcloud_group_hosts_map:
controllers:
- sv-b16-u23
ignore:
- sv-b16-u21
- sv-b16-u22
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
## Instruction:
Disable cloud-init on control plane hosts
When glean is used as the cloud initial configuration service, having cloud-init
enabled can cause issues. If cloud-init cannot detect network configuration, it
will apply a fallback configuration, enabling DHCP on one interface. This can
break existing network configuration, so we disable cloud-init to avoid this.
## Code After:
---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:
overcloud_group_hosts_map:
controllers:
- sv-b16-u23
ignore:
- sv-b16-u21
- sv-b16-u22
# To prevent some network issues you can choose to disable cloud-init
#disable_cloud_init:
disable_cloud_init: True
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
| ---
###############################################################################
# Overcloud configuration.
# Default Ansible group for overcloud hosts.
#overcloud_group_default:
# List of names of Ansible groups for overcloud hosts.
#overcloud_groups:
# Dict mapping overcloud Ansible group names to lists of hosts in the group.
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
#overcloud_group_hosts_map:
overcloud_group_hosts_map:
controllers:
- sv-b16-u23
ignore:
- sv-b16-u21
- sv-b16-u22
+ # To prevent some network issues you can choose to disable cloud-init
+ #disable_cloud_init:
+ disable_cloud_init: True
+
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes | 4 | 0.166667 | 4 | 0 |
be4ccfdd04ef552fa99274f8f4caf6e13cbc7810 | docs/index.md | docs/index.md |
User creates a meta-schema and converts it to Xonomy schema as follows:
```js
var xschema = XonomyBuilder.convertSchema(schema);
```
... then he can create Xonomy editor as usual:
```js
var xmarkup = "<root version='0.1'/>";
var xonomy = document.getElementById("xonomy");
Xonomy.render(xmarkup, xonomy, xschema);
```
### Basic Hierarchy
Meta-schema representing a basic XML hierarchy can look as follows:
```js
schema.elements = {
'root': {
attributes: [
{name: 'version', mandatory: true}
],
children: ['group']
},
'group': {
attributes: ['b', 'c'],
children: [
{ name: 'first', max: 1 },
{ name: 'second', max: 1 },
]
},
'first': { order: true },
'second': { order: true },
};
```
... and leads to following editor configuration:
<iframe src="https://rawgit.com/filodej/xonomy-builder/master/examples/basic/index.html"
width="640" height="480" style="display:block; margin: 0 auto;"> </iframe>
|
User creates a meta-schema and converts it to Xonomy schema as follows:
```js
var xschema = XonomyBuilder.convertSchema(schema);
```
... then he can create Xonomy editor as usual:
```js
var xmarkup = "<root version='0.1'/>";
var xonomy = document.getElementById("xonomy");
Xonomy.render(xmarkup, xonomy, xschema);
```
### Basic Hierarchy
Meta-schema representing a basic XML hierarchy can look as follows:
```js
schema.elements = {
'root': {
attributes: [
{name: 'version', mandatory: true}
],
children: ['group']
},
'group': {
attributes: ['b', 'c'],
children: [
{ name: 'first', max: 1 },
{ name: 'second', max: 1 },
]
},
'first': { order: true },
'second': { order: true },
};
```
... and leads to following editor configuration:
<iframe src="https://rawgit.com/filodej/xonomy-builder/master/examples/basic/index.html"
width="100%" height="100px" style="background-color:#f6f8fa;"> </iframe>
| Update iframe style and dimensions | Update iframe style and dimensions
| Markdown | mit | filodej/xonomy-builder | markdown | ## Code Before:
User creates a meta-schema and converts it to Xonomy schema as follows:
```js
var xschema = XonomyBuilder.convertSchema(schema);
```
... then he can create Xonomy editor as usual:
```js
var xmarkup = "<root version='0.1'/>";
var xonomy = document.getElementById("xonomy");
Xonomy.render(xmarkup, xonomy, xschema);
```
### Basic Hierarchy
Meta-schema representing a basic XML hierarchy can look as follows:
```js
schema.elements = {
'root': {
attributes: [
{name: 'version', mandatory: true}
],
children: ['group']
},
'group': {
attributes: ['b', 'c'],
children: [
{ name: 'first', max: 1 },
{ name: 'second', max: 1 },
]
},
'first': { order: true },
'second': { order: true },
};
```
... and leads to following editor configuration:
<iframe src="https://rawgit.com/filodej/xonomy-builder/master/examples/basic/index.html"
width="640" height="480" style="display:block; margin: 0 auto;"> </iframe>
## Instruction:
Update iframe style and dimensions
## Code After:
User creates a meta-schema and converts it to Xonomy schema as follows:
```js
var xschema = XonomyBuilder.convertSchema(schema);
```
... then he can create Xonomy editor as usual:
```js
var xmarkup = "<root version='0.1'/>";
var xonomy = document.getElementById("xonomy");
Xonomy.render(xmarkup, xonomy, xschema);
```
### Basic Hierarchy
Meta-schema representing a basic XML hierarchy can look as follows:
```js
schema.elements = {
'root': {
attributes: [
{name: 'version', mandatory: true}
],
children: ['group']
},
'group': {
attributes: ['b', 'c'],
children: [
{ name: 'first', max: 1 },
{ name: 'second', max: 1 },
]
},
'first': { order: true },
'second': { order: true },
};
```
... and leads to following editor configuration:
<iframe src="https://rawgit.com/filodej/xonomy-builder/master/examples/basic/index.html"
width="100%" height="100px" style="background-color:#f6f8fa;"> </iframe>
|
User creates a meta-schema and converts it to Xonomy schema as follows:
```js
var xschema = XonomyBuilder.convertSchema(schema);
```
... then he can create Xonomy editor as usual:
```js
var xmarkup = "<root version='0.1'/>";
var xonomy = document.getElementById("xonomy");
Xonomy.render(xmarkup, xonomy, xschema);
```
### Basic Hierarchy
Meta-schema representing a basic XML hierarchy can look as follows:
```js
schema.elements = {
'root': {
attributes: [
{name: 'version', mandatory: true}
],
children: ['group']
},
'group': {
attributes: ['b', 'c'],
children: [
{ name: 'first', max: 1 },
{ name: 'second', max: 1 },
]
},
'first': { order: true },
'second': { order: true },
};
```
... and leads to following editor configuration:
<iframe src="https://rawgit.com/filodej/xonomy-builder/master/examples/basic/index.html"
+ width="100%" height="100px" style="background-color:#f6f8fa;"> </iframe>
- width="640" height="480" style="display:block; margin: 0 auto;"> </iframe>
- | 3 | 0.068182 | 1 | 2 |
48ddb27c81134e93aaef436580776454871ebc6c | javascripts/govuk/analytics/external-link-tracker.js | javascripts/govuk/analytics/external-link-tracker.js | (function() {
"use strict";
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.externalLinkTracker = function () {
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname(),
externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])';
$('body').on('click', externalLinkSelector, trackClickEvent);
function trackClickEvent(evt) {
var $target = $(evt.target),
options = {transport: 'beacon'},
href,
linkText;
if (!$target.is('a')) {
$target = $target.parents('a');
}
href = $target.attr('href');
linkText = $.trim($target.text());
if (linkText) {
options.label = linkText;
}
GOVUK.analytics.trackEvent('External Link Clicked', href, options);
}
}
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function() {
return window.location.hostname;
}
}());
| (function() {
"use strict";
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.externalLinkTracker = function () {
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname(),
externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])';
$('body').on('click', externalLinkSelector, trackClickEvent);
function trackClickEvent(evt) {
var $link = getLinkFromEvent(evt),
options = {transport: 'beacon'},
href = $link.attr('href'),
linkText = $.trim($link.text());
if (linkText) {
options.label = linkText;
}
GOVUK.analytics.trackEvent('External Link Clicked', href, options);
}
}
function getLinkFromEvent(evt) {
var $target = $(evt.target);
if (!$target.is('a')) {
$target = $target.parents('a');
}
return $target;
}
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function() {
return window.location.hostname;
}
}());
| Move externalLink DOM traversal to function | Move externalLink DOM traversal to function
Simplify external link tracker by moving DOM traversal into a named
function.
| JavaScript | mit | alphagov/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit | javascript | ## Code Before:
(function() {
"use strict";
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.externalLinkTracker = function () {
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname(),
externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])';
$('body').on('click', externalLinkSelector, trackClickEvent);
function trackClickEvent(evt) {
var $target = $(evt.target),
options = {transport: 'beacon'},
href,
linkText;
if (!$target.is('a')) {
$target = $target.parents('a');
}
href = $target.attr('href');
linkText = $.trim($target.text());
if (linkText) {
options.label = linkText;
}
GOVUK.analytics.trackEvent('External Link Clicked', href, options);
}
}
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function() {
return window.location.hostname;
}
}());
## Instruction:
Move externalLink DOM traversal to function
Simplify external link tracker by moving DOM traversal into a named
function.
## Code After:
(function() {
"use strict";
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.externalLinkTracker = function () {
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname(),
externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])';
$('body').on('click', externalLinkSelector, trackClickEvent);
function trackClickEvent(evt) {
var $link = getLinkFromEvent(evt),
options = {transport: 'beacon'},
href = $link.attr('href'),
linkText = $.trim($link.text());
if (linkText) {
options.label = linkText;
}
GOVUK.analytics.trackEvent('External Link Clicked', href, options);
}
}
function getLinkFromEvent(evt) {
var $target = $(evt.target);
if (!$target.is('a')) {
$target = $target.parents('a');
}
return $target;
}
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function() {
return window.location.hostname;
}
}());
| (function() {
"use strict";
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {};
GOVUK.analyticsPlugins.externalLinkTracker = function () {
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname(),
externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])';
$('body').on('click', externalLinkSelector, trackClickEvent);
function trackClickEvent(evt) {
- var $target = $(evt.target),
+ var $link = getLinkFromEvent(evt),
options = {transport: 'beacon'},
- href,
- linkText;
-
- if (!$target.is('a')) {
- $target = $target.parents('a');
- }
-
- href = $target.attr('href');
? ^^^^^^ ^
+ href = $link.attr('href'),
? ++++ ^^^^ ^
- linkText = $.trim($target.text());
? ^^^^^^
+ linkText = $.trim($link.text());
? ++++ ^^^^
if (linkText) {
options.label = linkText;
}
GOVUK.analytics.trackEvent('External Link Clicked', href, options);
}
}
+ function getLinkFromEvent(evt) {
+ var $target = $(evt.target);
+
+ if (!$target.is('a')) {
+ $target = $target.parents('a');
+ }
+
+ return $target;
+ }
+
GOVUK.analyticsPlugins.externalLinkTracker.getHostname = function() {
return window.location.hostname;
}
}()); | 23 | 0.657143 | 13 | 10 |
518c799363e3e856489ea710ea257e29ab891b1a | spec/models/organisation_spec.rb | spec/models/organisation_spec.rb | require "spec_helper"
describe Organisation do
let!(:hmrc) { create :organisation }
describe "#all" do
it "should have only hmrc loaded" do
Organisation.all.should eq([hmrc])
end
end
describe "#load_organisations, #initialize" do
it "should correctly create hmrc" do
hmrc.title.should eq("HM Revenue & Customs")
hmrc.format.should eq("Non-ministerial department")
hmrc.slug.should eq("hm-revenue-customs")
hmrc.abbreviation.should eq("HMRC")
end
end
describe "#find HMRC" do
it "should find hmrc by slug" do
Organisation.find_by_slug("hm-revenue-customs").should eq(hmrc)
end
end
end
| require "spec_helper"
describe Organisation do
subject(:organisation) { create :organisation, abbreviation: abbreviation, title: title }
let(:title) { "HM Revenue & Customs" }
let(:abbreviation) { "HMRC" }
describe "#title_with_abbreviation" do
context "when abbreviation is present" do
it "should append abbreviation to the title" do
organisation.title_with_abbreviation.should eq("HM Revenue & Customs [HMRC]")
end
end
context "when abbreviation is blank" do
let(:abbreviation) { nil }
it "should not append abbreviation to title" do
organisation.title_with_abbreviation.should eq("HM Revenue & Customs")
end
end
end
describe "#abbreviation_or_title" do
context "when abbreviation is present" do
it "should show abbreviation" do
organisation.abbreviation_or_title.should eq(abbreviation)
end
end
context "when abbreviation is blank" do
let(:abbreviation) { nil }
it "should show title" do
organisation.abbreviation_or_title.should eq(title)
end
end
end
describe "#path" do
it "should return correct path" do
organisation.path.should eq("/government/organisations/hm-revenue-customs")
end
end
end
| Refactor Organisation spec to test methods | Refactor Organisation spec to test methods
As per:
https://github.com/alphagov/hmrc-contacts/pull/113#commitcomment-5908997
I've refactored this test to test the actual methods in Organisation.rb
| Ruby | mit | alphagov/contacts-admin,alphagov/contacts-admin,alphagov/contacts-admin | ruby | ## Code Before:
require "spec_helper"
describe Organisation do
let!(:hmrc) { create :organisation }
describe "#all" do
it "should have only hmrc loaded" do
Organisation.all.should eq([hmrc])
end
end
describe "#load_organisations, #initialize" do
it "should correctly create hmrc" do
hmrc.title.should eq("HM Revenue & Customs")
hmrc.format.should eq("Non-ministerial department")
hmrc.slug.should eq("hm-revenue-customs")
hmrc.abbreviation.should eq("HMRC")
end
end
describe "#find HMRC" do
it "should find hmrc by slug" do
Organisation.find_by_slug("hm-revenue-customs").should eq(hmrc)
end
end
end
## Instruction:
Refactor Organisation spec to test methods
As per:
https://github.com/alphagov/hmrc-contacts/pull/113#commitcomment-5908997
I've refactored this test to test the actual methods in Organisation.rb
## Code After:
require "spec_helper"
describe Organisation do
subject(:organisation) { create :organisation, abbreviation: abbreviation, title: title }
let(:title) { "HM Revenue & Customs" }
let(:abbreviation) { "HMRC" }
describe "#title_with_abbreviation" do
context "when abbreviation is present" do
it "should append abbreviation to the title" do
organisation.title_with_abbreviation.should eq("HM Revenue & Customs [HMRC]")
end
end
context "when abbreviation is blank" do
let(:abbreviation) { nil }
it "should not append abbreviation to title" do
organisation.title_with_abbreviation.should eq("HM Revenue & Customs")
end
end
end
describe "#abbreviation_or_title" do
context "when abbreviation is present" do
it "should show abbreviation" do
organisation.abbreviation_or_title.should eq(abbreviation)
end
end
context "when abbreviation is blank" do
let(:abbreviation) { nil }
it "should show title" do
organisation.abbreviation_or_title.should eq(title)
end
end
end
describe "#path" do
it "should return correct path" do
organisation.path.should eq("/government/organisations/hm-revenue-customs")
end
end
end
| require "spec_helper"
describe Organisation do
- let!(:hmrc) { create :organisation }
+ subject(:organisation) { create :organisation, abbreviation: abbreviation, title: title }
+ let(:title) { "HM Revenue & Customs" }
+ let(:abbreviation) { "HMRC" }
- describe "#all" do
- it "should have only hmrc loaded" do
- Organisation.all.should eq([hmrc])
+ describe "#title_with_abbreviation" do
+
+ context "when abbreviation is present" do
+
+ it "should append abbreviation to the title" do
+ organisation.title_with_abbreviation.should eq("HM Revenue & Customs [HMRC]")
+ end
+ end
+
+ context "when abbreviation is blank" do
+ let(:abbreviation) { nil }
+
+ it "should not append abbreviation to title" do
+ organisation.title_with_abbreviation.should eq("HM Revenue & Customs")
+ end
end
end
- describe "#load_organisations, #initialize" do
- it "should correctly create hmrc" do
- hmrc.title.should eq("HM Revenue & Customs")
- hmrc.format.should eq("Non-ministerial department")
- hmrc.slug.should eq("hm-revenue-customs")
- hmrc.abbreviation.should eq("HMRC")
+
+ describe "#abbreviation_or_title" do
+ context "when abbreviation is present" do
+
+ it "should show abbreviation" do
+ organisation.abbreviation_or_title.should eq(abbreviation)
+ end
+ end
+
+ context "when abbreviation is blank" do
+ let(:abbreviation) { nil }
+
+ it "should show title" do
+ organisation.abbreviation_or_title.should eq(title)
+ end
end
end
- describe "#find HMRC" do
- it "should find hmrc by slug" do
- Organisation.find_by_slug("hm-revenue-customs").should eq(hmrc)
+
+ describe "#path" do
+ it "should return correct path" do
+ organisation.path.should eq("/government/organisations/hm-revenue-customs")
end
end
-
+
end | 52 | 2.08 | 38 | 14 |
fab7e2e67a5591c298db7a0290cc5dc16999a8dc | app/assets/javascripts/lesson_planner/unit_templates_manager/unit_template_profile/unit_template_profile_assign_button.jsx | app/assets/javascripts/lesson_planner/unit_templates_manager/unit_template_profile/unit_template_profile_assign_button.jsx | EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to everyone, with no due dates</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Pick specific students and due dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to Everyone</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Assign to Specific Students and Set Due Dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | Change the copy on the assign all button. | Change the copy on the assign all button. | JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | jsx | ## Code Before:
EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to everyone, with no due dates</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Pick specific students and due dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
});
## Instruction:
Change the copy on the assign all button.
## Code After:
EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to Everyone</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Assign to Specific Students and Set Due Dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
- <button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to everyone, with no due dates</button>
? ^ -------------------
+ <button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to Everyone</button>
? ^
- <button className='button-green full-width' onClick={this.props.actions.customAssign}>Pick specific students and due dates</button>
? ^ ^^ ^ ^ ^ ^
+ <button className='button-green full-width' onClick={this.props.actions.customAssign}>Assign to Specific Students and Set Due Dates</button>
? ^^^ ^^ ^^^^ ^ ^^^^^ ^
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | 4 | 0.142857 | 2 | 2 |
bf95fc9954ff52a11787fda50e3b28ddf5d5d470 | tasks/selinux-context.yml | tasks/selinux-context.yml | ---
- name: RedHat | Ensure selinux context for MISP httpd directories
command: "chcon -R httpd_sys_rw_content_t {{ item }}"
# FIXME! sefcontext module not working
# sefcontext:
# target: "{{ item }}(/.*)?"
# setype: httpd_sys_rw_content_t
# state: present
with_items:
- /var/www/MISP/app/files
- /var/www/MISP/app/files/terms
- /var/www/MISP/app/files/scripts/tmp
- /var/www/MISP/app/Plugin/CakeResque/tmp
- /var/www/MISP/app/tmp
- /var/www/MISP/app/webroot/img/orgs
- /var/www/MISP/app/webroot/img/custom
- "{{ misp_rootdir }}/.gnupg"
| ---
- name: RedHat | Ensure selinux context for MISP httpd directories
sefcontext:
target: "{{ item }}(/.*)?"
setype: httpd_sys_rw_content_t
state: present
with_items:
- /var/www/MISP/app/files
- /var/www/MISP/app/files/terms
- /var/www/MISP/app/files/scripts/tmp
- /var/www/MISP/app/Plugin/CakeResque/tmp
- /var/www/MISP/app/tmp
- /var/www/MISP/app/webroot/img/orgs
- /var/www/MISP/app/webroot/img/custom
- "{{ misp_rootdir }}/.gnupg"
| Revert "manual command for chcon as sefcontext module does not seem to work" | Revert "manual command for chcon as sefcontext module does not seem to work"
This reverts commit abb40b5d9cb9da991bd04ea42c84b2d699e4d142.
| YAML | bsd-2-clause | juju4/ansible-MISP,juju4/ansible-MISP,juju4/ansible-MISP | yaml | ## Code Before:
---
- name: RedHat | Ensure selinux context for MISP httpd directories
command: "chcon -R httpd_sys_rw_content_t {{ item }}"
# FIXME! sefcontext module not working
# sefcontext:
# target: "{{ item }}(/.*)?"
# setype: httpd_sys_rw_content_t
# state: present
with_items:
- /var/www/MISP/app/files
- /var/www/MISP/app/files/terms
- /var/www/MISP/app/files/scripts/tmp
- /var/www/MISP/app/Plugin/CakeResque/tmp
- /var/www/MISP/app/tmp
- /var/www/MISP/app/webroot/img/orgs
- /var/www/MISP/app/webroot/img/custom
- "{{ misp_rootdir }}/.gnupg"
## Instruction:
Revert "manual command for chcon as sefcontext module does not seem to work"
This reverts commit abb40b5d9cb9da991bd04ea42c84b2d699e4d142.
## Code After:
---
- name: RedHat | Ensure selinux context for MISP httpd directories
sefcontext:
target: "{{ item }}(/.*)?"
setype: httpd_sys_rw_content_t
state: present
with_items:
- /var/www/MISP/app/files
- /var/www/MISP/app/files/terms
- /var/www/MISP/app/files/scripts/tmp
- /var/www/MISP/app/Plugin/CakeResque/tmp
- /var/www/MISP/app/tmp
- /var/www/MISP/app/webroot/img/orgs
- /var/www/MISP/app/webroot/img/custom
- "{{ misp_rootdir }}/.gnupg"
| ---
- name: RedHat | Ensure selinux context for MISP httpd directories
- command: "chcon -R httpd_sys_rw_content_t {{ item }}"
- # FIXME! sefcontext module not working
- # sefcontext:
? -
+ sefcontext:
- # target: "{{ item }}(/.*)?"
? -
+ target: "{{ item }}(/.*)?"
- # setype: httpd_sys_rw_content_t
? -
+ setype: httpd_sys_rw_content_t
- # state: present
? -
+ state: present
with_items:
- /var/www/MISP/app/files
- /var/www/MISP/app/files/terms
- /var/www/MISP/app/files/scripts/tmp
- /var/www/MISP/app/Plugin/CakeResque/tmp
- /var/www/MISP/app/tmp
- /var/www/MISP/app/webroot/img/orgs
- /var/www/MISP/app/webroot/img/custom
- "{{ misp_rootdir }}/.gnupg" | 10 | 0.555556 | 4 | 6 |
31dd4d98d6a7cee7fa2eac22c7849b580a9be262 | webapp/app/views/events/_investigate_section_element_header.html.haml | webapp/app/views/events/_investigate_section_element_header.html.haml | %br
- section_id = "section_investigate_#{h(section.id)}"
- hide_id = section_id + "_hide"
- show_id = section_id + "_show"
%fieldset{:class => 'form_section vert-break'}
%legend
= h(strip_tags(section.name))
- unless section.help_text.blank?
= render_help_text(section) + " "
%span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;\">"}
= "[" + t('hide') + "]"
%span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
= "[" + t('show') + "]"
%div{:id => section_id}
- unless section.description.blank?
%li
%i= section.description.gsub("\n", '<br/>')
%br
%br
| %br
- section_id = "section_investigate_#{h(section.id)}"
- hide_id = section_id + "_hide"
- show_id = section_id + "_show"
%fieldset{:class => 'form_section vert-break'}
%legend
= h(strip_tags(section.name))
- unless section.help_text.blank?
= render_help_text(section) + " "
/ Because of the way the investigator section elements are rendered
/ using form_builder_dsl.rb, it's not easy to show and hide sections
/%span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;"}
/ = "[" + t('hide') + "]"
/%span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
/ = "[" + t('show') + "]"
%div{:id => section_id}
- unless section.description.blank?
%li
%i= section.description.gsub("\n", '<br/>')
%br
%br
| Disable Hide/Show for investigator sections | Disable Hide/Show for investigator sections
| Haml | agpl-3.0 | JayBoyer/new-trisano,JayBoyer/new-trisano,JayBoyer/new-trisano,JayBoyer/new-trisano,JayBoyer/new-trisano,JayBoyer/new-trisano,JayBoyer/new-trisano | haml | ## Code Before:
%br
- section_id = "section_investigate_#{h(section.id)}"
- hide_id = section_id + "_hide"
- show_id = section_id + "_show"
%fieldset{:class => 'form_section vert-break'}
%legend
= h(strip_tags(section.name))
- unless section.help_text.blank?
= render_help_text(section) + " "
%span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;\">"}
= "[" + t('hide') + "]"
%span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
= "[" + t('show') + "]"
%div{:id => section_id}
- unless section.description.blank?
%li
%i= section.description.gsub("\n", '<br/>')
%br
%br
## Instruction:
Disable Hide/Show for investigator sections
## Code After:
%br
- section_id = "section_investigate_#{h(section.id)}"
- hide_id = section_id + "_hide"
- show_id = section_id + "_show"
%fieldset{:class => 'form_section vert-break'}
%legend
= h(strip_tags(section.name))
- unless section.help_text.blank?
= render_help_text(section) + " "
/ Because of the way the investigator section elements are rendered
/ using form_builder_dsl.rb, it's not easy to show and hide sections
/%span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;"}
/ = "[" + t('hide') + "]"
/%span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
/ = "[" + t('show') + "]"
%div{:id => section_id}
- unless section.description.blank?
%li
%i= section.description.gsub("\n", '<br/>')
%br
%br
| %br
- section_id = "section_investigate_#{h(section.id)}"
- hide_id = section_id + "_hide"
- show_id = section_id + "_show"
%fieldset{:class => 'form_section vert-break'}
%legend
= h(strip_tags(section.name))
- unless section.help_text.blank?
= render_help_text(section) + " "
- %span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;\">"}
- = "[" + t('hide') + "]"
+ / Because of the way the investigator section elements are rendered
+ / using form_builder_dsl.rb, it's not easy to show and hide sections
+
+ /%span{:id => hide_id, :onclick => "Element.hide('#{section_id}'); Element.hide('#{hide_id}'); Element.show('#{show_id}'); return false;"}
+ / = "[" + t('hide') + "]"
+
- %span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
+ /%span{:id => show_id, :onclick => "Element.show('#{section_id}'); Element.hide('#{show_id }'); Element.show('#{hide_id}'); return false;", :style => "display: none;"}
? +
- = "[" + t('show') + "]"
+ / = "[" + t('show') + "]"
? +
%div{:id => section_id}
- unless section.description.blank?
%li
%i= section.description.gsub("\n", '<br/>')
%br
%br | 12 | 0.545455 | 8 | 4 |
303043e0de14747db5a47dd758be2394f63b5f07 | Readme.md | Readme.md | The official clone of MiniProfiler for .NET.
We accept patches and pull requests here.
See the home page at: http://miniprofiler.com
Licensed under apache 2.0 license, see: http://www.apache.org/licenses/LICENSE-2.0
####Be sure to `git submodule init` and `git submodule update` after cloning to pull down the ui repo!####
|
* See the home page at: [miniprofiler.com](http://miniprofiler.com) for more info on how to set things up.
* We accept [pull requests](https://github.com/MiniProfiler/dotnet/pulls) here.
* Any issues can be reported in [GitHub Issues](https://github.com/MiniProfiler/dotnet/issues) or on the [Community Site](http://community.miniprofiler.com/).
* Questions on StackOverflow are welcome using the [Mvc-Mini-Profiler tag](http://stackoverflow.com/questions/tagged/mvc-mini-profiler).
####Be sure to `git submodule init` and `git submodule update` after cloning to pull down the ui repo!####
Nuget Packages Available:
* **[MiniProfiler](https://www.nuget.org/packages/MiniProfiler/)** - The core functionality
* [MiniProfiler.EF5](https://www.nuget.org/packages/MiniProfiler.EF5/) - Entity Framework 4 and 5 Integration
* [MiniProfiler.EF6](https://www.nuget.org/packages/MiniProfiler.EF6/) - Entity Framework 6+ Integration
* [MiniProfiler.MVC3](https://www.nuget.org/packages/MiniProfiler.MVC3/) - ASP.net MVC 3 Integration
* [MiniProfiler.MVC4](https://www.nuget.org/packages/MiniProfiler.Mvc4/) - ASP.net MVC 4 and 5 Integration
* [MiniProfiler.Raven](https://www.nuget.org/packages/MiniProfiler.Raven/) - [RavenDb](http://ravendb.net) Integration
Licensed under [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0)
| Add more info to ReadMe | Add more info to ReadMe
| Markdown | mit | MiniProfiler/dotnet,MiniProfiler/dotnet | markdown | ## Code Before:
The official clone of MiniProfiler for .NET.
We accept patches and pull requests here.
See the home page at: http://miniprofiler.com
Licensed under apache 2.0 license, see: http://www.apache.org/licenses/LICENSE-2.0
####Be sure to `git submodule init` and `git submodule update` after cloning to pull down the ui repo!####
## Instruction:
Add more info to ReadMe
## Code After:
* See the home page at: [miniprofiler.com](http://miniprofiler.com) for more info on how to set things up.
* We accept [pull requests](https://github.com/MiniProfiler/dotnet/pulls) here.
* Any issues can be reported in [GitHub Issues](https://github.com/MiniProfiler/dotnet/issues) or on the [Community Site](http://community.miniprofiler.com/).
* Questions on StackOverflow are welcome using the [Mvc-Mini-Profiler tag](http://stackoverflow.com/questions/tagged/mvc-mini-profiler).
####Be sure to `git submodule init` and `git submodule update` after cloning to pull down the ui repo!####
Nuget Packages Available:
* **[MiniProfiler](https://www.nuget.org/packages/MiniProfiler/)** - The core functionality
* [MiniProfiler.EF5](https://www.nuget.org/packages/MiniProfiler.EF5/) - Entity Framework 4 and 5 Integration
* [MiniProfiler.EF6](https://www.nuget.org/packages/MiniProfiler.EF6/) - Entity Framework 6+ Integration
* [MiniProfiler.MVC3](https://www.nuget.org/packages/MiniProfiler.MVC3/) - ASP.net MVC 3 Integration
* [MiniProfiler.MVC4](https://www.nuget.org/packages/MiniProfiler.Mvc4/) - ASP.net MVC 4 and 5 Integration
* [MiniProfiler.Raven](https://www.nuget.org/packages/MiniProfiler.Raven/) - [RavenDb](http://ravendb.net) Integration
Licensed under [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0)
| - The official clone of MiniProfiler for .NET.
+ * See the home page at: [miniprofiler.com](http://miniprofiler.com) for more info on how to set things up.
+ * We accept [pull requests](https://github.com/MiniProfiler/dotnet/pulls) here.
+ * Any issues can be reported in [GitHub Issues](https://github.com/MiniProfiler/dotnet/issues) or on the [Community Site](http://community.miniprofiler.com/).
+ * Questions on StackOverflow are welcome using the [Mvc-Mini-Profiler tag](http://stackoverflow.com/questions/tagged/mvc-mini-profiler).
- We accept patches and pull requests here.
-
- See the home page at: http://miniprofiler.com
-
- Licensed under apache 2.0 license, see: http://www.apache.org/licenses/LICENSE-2.0
####Be sure to `git submodule init` and `git submodule update` after cloning to pull down the ui repo!####
+ Nuget Packages Available:
+
+ * **[MiniProfiler](https://www.nuget.org/packages/MiniProfiler/)** - The core functionality
+ * [MiniProfiler.EF5](https://www.nuget.org/packages/MiniProfiler.EF5/) - Entity Framework 4 and 5 Integration
+ * [MiniProfiler.EF6](https://www.nuget.org/packages/MiniProfiler.EF6/) - Entity Framework 6+ Integration
+ * [MiniProfiler.MVC3](https://www.nuget.org/packages/MiniProfiler.MVC3/) - ASP.net MVC 3 Integration
+ * [MiniProfiler.MVC4](https://www.nuget.org/packages/MiniProfiler.Mvc4/) - ASP.net MVC 4 and 5 Integration
+ * [MiniProfiler.Raven](https://www.nuget.org/packages/MiniProfiler.Raven/) - [RavenDb](http://ravendb.net) Integration
+
+ Licensed under [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0) | 20 | 2 | 14 | 6 |
00b901184c73f5850add45b86c4e10c3e60fb40c | app/serializers/user_serializer.rb | app/serializers/user_serializer.rb | class UserSerializer
include TalkSerializer
include ModerationActions
all_attributes except: :email
end
| class UserSerializer
include TalkSerializer
include ModerationActions
attributes :id, :created_at, :updated_at, :display_name,
:zooniverse_id, :credited_name, :admin, :banned
end
| Whitelist instead of blacklist user attributes | Whitelist instead of blacklist user attributes | Ruby | apache-2.0 | zooniverse/Talk-Api,zooniverse/Talk-Api,zooniverse/Talk-Api | ruby | ## Code Before:
class UserSerializer
include TalkSerializer
include ModerationActions
all_attributes except: :email
end
## Instruction:
Whitelist instead of blacklist user attributes
## Code After:
class UserSerializer
include TalkSerializer
include ModerationActions
attributes :id, :created_at, :updated_at, :display_name,
:zooniverse_id, :credited_name, :admin, :banned
end
| class UserSerializer
include TalkSerializer
include ModerationActions
- all_attributes except: :email
+ attributes :id, :created_at, :updated_at, :display_name,
+ :zooniverse_id, :credited_name, :admin, :banned
end | 3 | 0.5 | 2 | 1 |
63a2622f531d99fa0056709f90c996290dcab047 | server/devServer.js | server/devServer.js | const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: {
colors: true,
},
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
| const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: 'errors-only',
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
| Hide extra webpack stats on development. | Hide extra webpack stats on development.
| JavaScript | mit | hannupekka/react-pack,hannupekka/react-pack | javascript | ## Code Before:
const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: {
colors: true,
},
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
## Instruction:
Hide extra webpack stats on development.
## Code After:
const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: 'errors-only',
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
| const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
+ stats: 'errors-only',
- stats: {
- colors: true,
- },
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
}); | 4 | 0.181818 | 1 | 3 |
1393b450b401cab4d0c36290b2db7b58f9a8d924 | src/Database/Schema/Migrations/Dependencies.hs | src/Database/Schema/Migrations/Dependencies.hs | module Database.Schema.Migrations.Dependencies
( Dependable(..)
)
where
class Eq a => Dependable a where
depsOf :: a -> [a]
-- |Given a list of a in the environment, does that list satisfy
-- the dependency requirements of an a? returns whether or not it
-- does.
satisfies :: [a] -> a -> Bool
satisfies env object = and $ map (`elem` env) $ depsOf object
-- |Given a list of a (the environment) and an a whose
-- dependencies must be satisfied, return a list of a which would
-- satisfy those dependencies, i.e., such that
--
-- satisfies (env ++ $ satisfyDeps env a) a = True.
satisfyDeps :: [a] -> a -> [a]
satisfyDeps env object = filter (not . (`elem` env)) $ depsOf object
| module Database.Schema.Migrations.Dependencies
( Dependable(..)
)
where
class Eq a => Dependable a where
-- |The objects on which a depends.
depsOf :: a -> [a]
-- |Return the complete dependency list for the specified object,
-- including its children and their dependencies recursively, and
-- including the object itself. Some notes:
--
-- a == last $ fullDeps a
-- [] == satisfyDeps (fullDeps a) a
-- True == satisfies (fullDeps a) a
fullDeps :: a -> [a]
fullDeps object = (concat $ map fullDeps $ depsOf object) ++ [object]
-- |Given a list of a in the environment, does that list satisfy
-- the dependency requirements of an a? returns whether or not it
-- does.
satisfies :: [a] -> a -> Bool
satisfies env object = and $ map (`elem` env) $ fullDeps object
-- |Given a list of a (the environment) and an a whose
-- dependencies must be satisfied, return a list of a which would
-- satisfy those dependencies, i.e., such that
--
-- satisfies (env ++ $ satisfyDeps env a) a = True.
satisfyDeps :: [a] -> a -> [a]
satisfyDeps env object = filter (not . (`elem` env)) $ fullDeps object
| Update the Dependable instance for Migration | Update the Dependable instance for Migration
Ignore-this: 22d51ec73975926c7623477a80e75cf1
darcs-hash:20090416045602-e018d-1a882873a552132a3154008a18a8158ad9f9170b.gz
| Haskell | bsd-3-clause | nick0x01/dbmigrations,nathankot/dbmigrations,anton-dessiatov/dbmigrations,creswick/dbmigrations,jakubfijalkowski/dbmigrations | haskell | ## Code Before:
module Database.Schema.Migrations.Dependencies
( Dependable(..)
)
where
class Eq a => Dependable a where
depsOf :: a -> [a]
-- |Given a list of a in the environment, does that list satisfy
-- the dependency requirements of an a? returns whether or not it
-- does.
satisfies :: [a] -> a -> Bool
satisfies env object = and $ map (`elem` env) $ depsOf object
-- |Given a list of a (the environment) and an a whose
-- dependencies must be satisfied, return a list of a which would
-- satisfy those dependencies, i.e., such that
--
-- satisfies (env ++ $ satisfyDeps env a) a = True.
satisfyDeps :: [a] -> a -> [a]
satisfyDeps env object = filter (not . (`elem` env)) $ depsOf object
## Instruction:
Update the Dependable instance for Migration
Ignore-this: 22d51ec73975926c7623477a80e75cf1
darcs-hash:20090416045602-e018d-1a882873a552132a3154008a18a8158ad9f9170b.gz
## Code After:
module Database.Schema.Migrations.Dependencies
( Dependable(..)
)
where
class Eq a => Dependable a where
-- |The objects on which a depends.
depsOf :: a -> [a]
-- |Return the complete dependency list for the specified object,
-- including its children and their dependencies recursively, and
-- including the object itself. Some notes:
--
-- a == last $ fullDeps a
-- [] == satisfyDeps (fullDeps a) a
-- True == satisfies (fullDeps a) a
fullDeps :: a -> [a]
fullDeps object = (concat $ map fullDeps $ depsOf object) ++ [object]
-- |Given a list of a in the environment, does that list satisfy
-- the dependency requirements of an a? returns whether or not it
-- does.
satisfies :: [a] -> a -> Bool
satisfies env object = and $ map (`elem` env) $ fullDeps object
-- |Given a list of a (the environment) and an a whose
-- dependencies must be satisfied, return a list of a which would
-- satisfy those dependencies, i.e., such that
--
-- satisfies (env ++ $ satisfyDeps env a) a = True.
satisfyDeps :: [a] -> a -> [a]
satisfyDeps env object = filter (not . (`elem` env)) $ fullDeps object
| module Database.Schema.Migrations.Dependencies
( Dependable(..)
)
where
class Eq a => Dependable a where
+ -- |The objects on which a depends.
depsOf :: a -> [a]
+
+ -- |Return the complete dependency list for the specified object,
+ -- including its children and their dependencies recursively, and
+ -- including the object itself. Some notes:
+ --
+ -- a == last $ fullDeps a
+ -- [] == satisfyDeps (fullDeps a) a
+ -- True == satisfies (fullDeps a) a
+ fullDeps :: a -> [a]
+ fullDeps object = (concat $ map fullDeps $ depsOf object) ++ [object]
-- |Given a list of a in the environment, does that list satisfy
-- the dependency requirements of an a? returns whether or not it
-- does.
satisfies :: [a] -> a -> Bool
- satisfies env object = and $ map (`elem` env) $ depsOf object
? ^ --
+ satisfies env object = and $ map (`elem` env) $ fullDeps object
? ^^^^^
-- |Given a list of a (the environment) and an a whose
-- dependencies must be satisfied, return a list of a which would
-- satisfy those dependencies, i.e., such that
--
-- satisfies (env ++ $ satisfyDeps env a) a = True.
satisfyDeps :: [a] -> a -> [a]
- satisfyDeps env object = filter (not . (`elem` env)) $ depsOf object
? ^ --
+ satisfyDeps env object = filter (not . (`elem` env)) $ fullDeps object
? ^^^^^
| 15 | 0.714286 | 13 | 2 |
b0c443e2cf3268449a33342e900f5b1016b297e5 | app/views/tickets/new.html.erb | app/views/tickets/new.html.erb | <div class="row">
<div class="medium-9 columns">
<%= render 'form' %>
</div>
</div>
| <div class="row">
<div class="medium-9 columns" style="background: #fff <%# for unauthenticated form %>">
<%= render 'form' %>
</div>
</div>
| Fix unauthenticated ticket form styling | Fix unauthenticated ticket form styling
| HTML+ERB | agpl-3.0 | mbchandar/brimir,hadifarnoud/brimir,ivaldi/brimir,mbchandar/brimir,hadifarnoud/brimir,fiedl/brimir,git-jls/brimir,viddypiddy/brimir,git-jls/brimir,ivaldi/brimir,git-jls/brimir,fiedl/brimir,viddypiddy/brimir,mbchandar/brimir,git-jls/brimir,ivaldi/brimir,viddypiddy/brimir,mbchandar/brimir,hadifarnoud/brimir,fiedl/brimir,ivaldi/brimir,fiedl/brimir,viddypiddy/brimir,hadifarnoud/brimir | html+erb | ## Code Before:
<div class="row">
<div class="medium-9 columns">
<%= render 'form' %>
</div>
</div>
## Instruction:
Fix unauthenticated ticket form styling
## Code After:
<div class="row">
<div class="medium-9 columns" style="background: #fff <%# for unauthenticated form %>">
<%= render 'form' %>
</div>
</div>
| <div class="row">
- <div class="medium-9 columns">
+ <div class="medium-9 columns" style="background: #fff <%# for unauthenticated form %>">
<%= render 'form' %>
</div>
</div> | 2 | 0.285714 | 1 | 1 |
f96cadba3514c1c53ad931cd9e40ee3654a0f89e | packages/bundler/scripts/createVersionJSON.sh | packages/bundler/scripts/createVersionJSON.sh | set -eo pipefail
function getVersion {
if [ -n "$1" ]; then
echo "$1";
return 0;
fi;
local version=$(cat package.json | awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }');
echo "$version";
}
function getCommit {
[ "$1" ] && echo "$1" || git rev-parse HEAD;
}
function toJSON {
local tpl='{ "version": "#version", "commit": "#commit" }';
local commit=$(getCommit "$1");
local version=$(getVersion "$2");
echo "$tpl" | sed "s/#commit/$commit/; s/#version/$version/;"
}
if [ -z "$3" ]; then
mkdir -p build/assets;
fi;
printf '%-20s' "[commit]";
printf '%-20s' "$1";
echo
printf '%-20s' "[tag]";
printf '%-20s' "$2";
echo
printf '%-20s' "[output]";
printf '%-20s' "${3-build/assets/version.json}";
echo
##
# Write JSON version inside assets
# -1: commit hash
# -2: version tag
# -3: path
#
toJSON "$1" "$2" > "${3-build/assets/version.json}";
| set -eo pipefail
function getVersion {
if [ -n "$1" ]; then
echo "$1";
return 0;
fi;
# Sadly MacOS doesn't have gawk but awk, which doesn't support this match :/
# awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }'
local version=$(cat package.json | awk '/"version": "(.+)"/{print $2}' | sed 's/"//g;s/,//g');
echo "$version";
}
function getCommit {
[ "$1" ] && echo "$1" || git rev-parse HEAD;
}
function toJSON {
local tpl='{ "version": "#version", "commit": "#commit" }';
local commit=$(getCommit "$1");
local version=$(getVersion "$2");
echo "$tpl" | sed "s/#commit/$commit/; s/#version/$version/;"
}
if [ -z "$3" ]; then
mkdir -p build/assets;
fi;
printf '%-20s' "[commit]";
printf '%-20s' "$1";
echo
printf '%-20s' "[tag]";
printf '%-20s' "$2";
echo
printf '%-20s' "[output]";
printf '%-20s' "${3-build/assets/version.json}";
echo
##
# Write JSON version inside assets
# -1: commit hash
# -2: version tag
# -3: path
#
toJSON "$1" "$2" > "${3-build/assets/version.json}";
| Fix extract version awk for MacOS - support awk | Fix extract version awk for MacOS - support awk
| Shell | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | shell | ## Code Before:
set -eo pipefail
function getVersion {
if [ -n "$1" ]; then
echo "$1";
return 0;
fi;
local version=$(cat package.json | awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }');
echo "$version";
}
function getCommit {
[ "$1" ] && echo "$1" || git rev-parse HEAD;
}
function toJSON {
local tpl='{ "version": "#version", "commit": "#commit" }';
local commit=$(getCommit "$1");
local version=$(getVersion "$2");
echo "$tpl" | sed "s/#commit/$commit/; s/#version/$version/;"
}
if [ -z "$3" ]; then
mkdir -p build/assets;
fi;
printf '%-20s' "[commit]";
printf '%-20s' "$1";
echo
printf '%-20s' "[tag]";
printf '%-20s' "$2";
echo
printf '%-20s' "[output]";
printf '%-20s' "${3-build/assets/version.json}";
echo
##
# Write JSON version inside assets
# -1: commit hash
# -2: version tag
# -3: path
#
toJSON "$1" "$2" > "${3-build/assets/version.json}";
## Instruction:
Fix extract version awk for MacOS - support awk
## Code After:
set -eo pipefail
function getVersion {
if [ -n "$1" ]; then
echo "$1";
return 0;
fi;
# Sadly MacOS doesn't have gawk but awk, which doesn't support this match :/
# awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }'
local version=$(cat package.json | awk '/"version": "(.+)"/{print $2}' | sed 's/"//g;s/,//g');
echo "$version";
}
function getCommit {
[ "$1" ] && echo "$1" || git rev-parse HEAD;
}
function toJSON {
local tpl='{ "version": "#version", "commit": "#commit" }';
local commit=$(getCommit "$1");
local version=$(getVersion "$2");
echo "$tpl" | sed "s/#commit/$commit/; s/#version/$version/;"
}
if [ -z "$3" ]; then
mkdir -p build/assets;
fi;
printf '%-20s' "[commit]";
printf '%-20s' "$1";
echo
printf '%-20s' "[tag]";
printf '%-20s' "$2";
echo
printf '%-20s' "[output]";
printf '%-20s' "${3-build/assets/version.json}";
echo
##
# Write JSON version inside assets
# -1: commit hash
# -2: version tag
# -3: path
#
toJSON "$1" "$2" > "${3-build/assets/version.json}";
| set -eo pipefail
function getVersion {
if [ -n "$1" ]; then
echo "$1";
return 0;
fi;
+ # Sadly MacOS doesn't have gawk but awk, which doesn't support this match :/
- local version=$(cat package.json | awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }');
? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --
+ # awk 'match($0, /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/, arr) { print arr[1]; }'
? ^
+ local version=$(cat package.json | awk '/"version": "(.+)"/{print $2}' | sed 's/"//g;s/,//g');
echo "$version";
}
function getCommit {
[ "$1" ] && echo "$1" || git rev-parse HEAD;
}
function toJSON {
local tpl='{ "version": "#version", "commit": "#commit" }';
local commit=$(getCommit "$1");
local version=$(getVersion "$2");
echo "$tpl" | sed "s/#commit/$commit/; s/#version/$version/;"
}
if [ -z "$3" ]; then
mkdir -p build/assets;
fi;
printf '%-20s' "[commit]";
printf '%-20s' "$1";
echo
printf '%-20s' "[tag]";
printf '%-20s' "$2";
echo
printf '%-20s' "[output]";
printf '%-20s' "${3-build/assets/version.json}";
echo
##
# Write JSON version inside assets
# -1: commit hash
# -2: version tag
# -3: path
#
toJSON "$1" "$2" > "${3-build/assets/version.json}"; | 4 | 0.088889 | 3 | 1 |
f4dfe1a35e4d4d3252c8b640ca0f8a961afb72eb | lib/node_modules/@stdlib/types/ndarray/base/assert/is-index-mode/lib/main.js | lib/node_modules/@stdlib/types/ndarray/base/assert/is-index-mode/lib/main.js | 'use strict';
// MODULES //
var indexOf = require( '@stdlib/utils/index-of' );
var modes = require( '@stdlib/types/ndarray/base/modes' );
// VARIABLES //
var MODES = modes();
// MAIN //
/**
* Tests whether an input value is a supported ndarray index mode.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode
*
* @example
* var bool = isIndexMode( 'wrap' );
* // returns true
*
* bool = isIndexMode( 'clamp' );
* // returns true
*
* bool = isIndexMode( 'throw' );
* // returns true
*
* bool = isIndexMode( 'foo' );
* // returns false
*/
function isIndexMode( v ) {
return ( indexOf( MODES, v ) !== -1 );
} // end FUNCTION isIndexMode()
// EXPORTS //
module.exports = isIndexMode;
| 'use strict';
// MODULES //
var modes = require( '@stdlib/types/ndarray/base/modes' );
// VARIABLES //
var MODES = modes();
var len = MODES.length;
// MAIN //
/**
* Tests whether an input value is a supported ndarray index mode.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode
*
* @example
* var bool = isIndexMode( 'wrap' );
* // returns true
*
* bool = isIndexMode( 'clamp' );
* // returns true
*
* bool = isIndexMode( 'throw' );
* // returns true
*
* bool = isIndexMode( 'foo' );
* // returns false
*/
function isIndexMode( v ) {
var i;
for ( i = 0; i < len; i++ ) {
if ( v === MODES[ i ] ) {
return true;
}
}
return false;
} // end FUNCTION isIndexMode()
// EXPORTS //
module.exports = isIndexMode;
| Refactor to inline value search | Refactor to inline value search
| JavaScript | apache-2.0 | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | javascript | ## Code Before:
'use strict';
// MODULES //
var indexOf = require( '@stdlib/utils/index-of' );
var modes = require( '@stdlib/types/ndarray/base/modes' );
// VARIABLES //
var MODES = modes();
// MAIN //
/**
* Tests whether an input value is a supported ndarray index mode.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode
*
* @example
* var bool = isIndexMode( 'wrap' );
* // returns true
*
* bool = isIndexMode( 'clamp' );
* // returns true
*
* bool = isIndexMode( 'throw' );
* // returns true
*
* bool = isIndexMode( 'foo' );
* // returns false
*/
function isIndexMode( v ) {
return ( indexOf( MODES, v ) !== -1 );
} // end FUNCTION isIndexMode()
// EXPORTS //
module.exports = isIndexMode;
## Instruction:
Refactor to inline value search
## Code After:
'use strict';
// MODULES //
var modes = require( '@stdlib/types/ndarray/base/modes' );
// VARIABLES //
var MODES = modes();
var len = MODES.length;
// MAIN //
/**
* Tests whether an input value is a supported ndarray index mode.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode
*
* @example
* var bool = isIndexMode( 'wrap' );
* // returns true
*
* bool = isIndexMode( 'clamp' );
* // returns true
*
* bool = isIndexMode( 'throw' );
* // returns true
*
* bool = isIndexMode( 'foo' );
* // returns false
*/
function isIndexMode( v ) {
var i;
for ( i = 0; i < len; i++ ) {
if ( v === MODES[ i ] ) {
return true;
}
}
return false;
} // end FUNCTION isIndexMode()
// EXPORTS //
module.exports = isIndexMode;
| 'use strict';
// MODULES //
- var indexOf = require( '@stdlib/utils/index-of' );
var modes = require( '@stdlib/types/ndarray/base/modes' );
// VARIABLES //
var MODES = modes();
+ var len = MODES.length;
// MAIN //
/**
* Tests whether an input value is a supported ndarray index mode.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode
*
* @example
* var bool = isIndexMode( 'wrap' );
* // returns true
*
* bool = isIndexMode( 'clamp' );
* // returns true
*
* bool = isIndexMode( 'throw' );
* // returns true
*
* bool = isIndexMode( 'foo' );
* // returns false
*/
function isIndexMode( v ) {
- return ( indexOf( MODES, v ) !== -1 );
+ var i;
+ for ( i = 0; i < len; i++ ) {
+ if ( v === MODES[ i ] ) {
+ return true;
+ }
+ }
+ return false;
} // end FUNCTION isIndexMode()
// EXPORTS //
module.exports = isIndexMode; | 10 | 0.238095 | 8 | 2 |
e3daf718595d251040398936fdacab2df01f3bba | README.md | README.md |
Smoke tests for [Pension Wise].
## Prerequisites
* [Bundler]
* [Git]
* [Ruby 2.2.0][Ruby]
## Installation
Clone the repository:
```sh
$ git clone https://github.com/guidance-guarantee-programme/smoke_tests.git
```
Setup the application:
```sh
$ ./bin/setup
```
## Usage
To start the application:
```sh
$ ./bin/foreman s
```
## Contributing
Please see the [contributing guidelines](/CONTRIBUTING.md).
[bundler]: http://bundler.io
[git]: http://git-scm.com
[pension wise]: https://www.pensionwise.gov.uk
[ruby]: http://www.ruby-lang.org/en
|
Smoke tests for [Pension Wise].
## Prerequisites
* [Bundler]
* [Git]
* [Ruby 2.2.0][Ruby]
* [Redis]
## Installation
Clone the repository:
```sh
$ git clone https://github.com/guidance-guarantee-programme/smoke_tests.git
```
Setup the application:
```sh
$ ./bin/setup
```
## Usage
To start the application:
```sh
$ ./bin/foreman s
```
## Contributing
Please see the [contributing guidelines](/CONTRIBUTING.md).
[bundler]: http://bundler.io
[git]: http://git-scm.com
[pension wise]: https://www.pensionwise.gov.uk
[ruby]: http://www.ruby-lang.org/en
[redis]: http://redis.io/
| Add Redis to list of requirements | Add Redis to list of requirements
| Markdown | mit | guidance-guarantee-programme/smoke_tests,guidance-guarantee-programme/smoke_tests | markdown | ## Code Before:
Smoke tests for [Pension Wise].
## Prerequisites
* [Bundler]
* [Git]
* [Ruby 2.2.0][Ruby]
## Installation
Clone the repository:
```sh
$ git clone https://github.com/guidance-guarantee-programme/smoke_tests.git
```
Setup the application:
```sh
$ ./bin/setup
```
## Usage
To start the application:
```sh
$ ./bin/foreman s
```
## Contributing
Please see the [contributing guidelines](/CONTRIBUTING.md).
[bundler]: http://bundler.io
[git]: http://git-scm.com
[pension wise]: https://www.pensionwise.gov.uk
[ruby]: http://www.ruby-lang.org/en
## Instruction:
Add Redis to list of requirements
## Code After:
Smoke tests for [Pension Wise].
## Prerequisites
* [Bundler]
* [Git]
* [Ruby 2.2.0][Ruby]
* [Redis]
## Installation
Clone the repository:
```sh
$ git clone https://github.com/guidance-guarantee-programme/smoke_tests.git
```
Setup the application:
```sh
$ ./bin/setup
```
## Usage
To start the application:
```sh
$ ./bin/foreman s
```
## Contributing
Please see the [contributing guidelines](/CONTRIBUTING.md).
[bundler]: http://bundler.io
[git]: http://git-scm.com
[pension wise]: https://www.pensionwise.gov.uk
[ruby]: http://www.ruby-lang.org/en
[redis]: http://redis.io/
|
Smoke tests for [Pension Wise].
## Prerequisites
* [Bundler]
* [Git]
* [Ruby 2.2.0][Ruby]
+ * [Redis]
## Installation
Clone the repository:
```sh
$ git clone https://github.com/guidance-guarantee-programme/smoke_tests.git
```
Setup the application:
```sh
$ ./bin/setup
```
## Usage
To start the application:
```sh
$ ./bin/foreman s
```
## Contributing
Please see the [contributing guidelines](/CONTRIBUTING.md).
[bundler]: http://bundler.io
[git]: http://git-scm.com
[pension wise]: https://www.pensionwise.gov.uk
[ruby]: http://www.ruby-lang.org/en
+ [redis]: http://redis.io/ | 2 | 0.04878 | 2 | 0 |
c82a2517a8bd2b25e4cbe5784379c46f3a1cab92 | src/ontrail/core.clj | src/ontrail/core.clj | (ns ontrail.core
(:use lamina.core
aleph.http
compojure.core)
(:gen-class)
(:require [compojure.route :as route]))
(require '[monger.collection :as mc])
(use 'ring.middleware.file)
(use '[clojure.data.json :only (read-json json-str)])
(use '[ontrail.summary])
(defn json-response [data & [status]]
{:status (or status 200)
:headers {"Content-Type" "application/json"}
:body (json-str data)})
(defroutes app-routes
"Routes requests to their handler function. Captures dynamic variables."
(GET "/summary/:user" [user] (json-response (get-overall-summary user)))
(route/resources "/")
(route/not-found "Page not found"))
(defn -main [& args]
"Main thread for the server which starts an async server with
all the routes we specified and is websocket ready."
(start-http-server (wrap-ring-handler app-routes)
{:host "localhost" :port 8080 :websocket true}))
| (ns ontrail.core
(:use lamina.core
aleph.http
compojure.core)
(:gen-class)
(:require [compojure.route :as route]))
(require '[monger.collection :as mc])
(use 'ring.middleware.file)
(use 'ring.middleware.cookies)
(use '[clojure.data.json :only (read-json json-str)])
(use '[ontrail.summary])
(defn json-response [data & [status authToken]]
{:status (or status 200)
:headers {"Content-Type" "application/json"}
:cookies (if authToken {"authToken" authToken} {})
:body (json-str data)})
(defroutes app-routes
"Routes requests to their handler function. Captures dynamic variables."
(GET "/summary/:user" [user] (json-response (get-overall-summary user)))
(route/resources "/")
(route/not-found "Page not found"))
(defn -main [& args]
"Main thread for the server which starts an async server with
all the routes we specified and is websocket ready."
(start-http-server (-> app-routes
wrap-cookies
wrap-ring-handler)
{:host "localhost" :port 8080 :websocket true}))
| Add cookies to the response when specified | Add cookies to the response when specified | Clojure | mit | jrosti/ontrail,jrosti/ontrail,jrosti/ontrail,jrosti/ontrail,jrosti/ontrail | clojure | ## Code Before:
(ns ontrail.core
(:use lamina.core
aleph.http
compojure.core)
(:gen-class)
(:require [compojure.route :as route]))
(require '[monger.collection :as mc])
(use 'ring.middleware.file)
(use '[clojure.data.json :only (read-json json-str)])
(use '[ontrail.summary])
(defn json-response [data & [status]]
{:status (or status 200)
:headers {"Content-Type" "application/json"}
:body (json-str data)})
(defroutes app-routes
"Routes requests to their handler function. Captures dynamic variables."
(GET "/summary/:user" [user] (json-response (get-overall-summary user)))
(route/resources "/")
(route/not-found "Page not found"))
(defn -main [& args]
"Main thread for the server which starts an async server with
all the routes we specified and is websocket ready."
(start-http-server (wrap-ring-handler app-routes)
{:host "localhost" :port 8080 :websocket true}))
## Instruction:
Add cookies to the response when specified
## Code After:
(ns ontrail.core
(:use lamina.core
aleph.http
compojure.core)
(:gen-class)
(:require [compojure.route :as route]))
(require '[monger.collection :as mc])
(use 'ring.middleware.file)
(use 'ring.middleware.cookies)
(use '[clojure.data.json :only (read-json json-str)])
(use '[ontrail.summary])
(defn json-response [data & [status authToken]]
{:status (or status 200)
:headers {"Content-Type" "application/json"}
:cookies (if authToken {"authToken" authToken} {})
:body (json-str data)})
(defroutes app-routes
"Routes requests to their handler function. Captures dynamic variables."
(GET "/summary/:user" [user] (json-response (get-overall-summary user)))
(route/resources "/")
(route/not-found "Page not found"))
(defn -main [& args]
"Main thread for the server which starts an async server with
all the routes we specified and is websocket ready."
(start-http-server (-> app-routes
wrap-cookies
wrap-ring-handler)
{:host "localhost" :port 8080 :websocket true}))
| (ns ontrail.core
(:use lamina.core
aleph.http
compojure.core)
(:gen-class)
(:require [compojure.route :as route]))
(require '[monger.collection :as mc])
(use 'ring.middleware.file)
-
+ (use 'ring.middleware.cookies)
(use '[clojure.data.json :only (read-json json-str)])
(use '[ontrail.summary])
- (defn json-response [data & [status]]
+ (defn json-response [data & [status authToken]]
? ++++++++++
{:status (or status 200)
:headers {"Content-Type" "application/json"}
+ :cookies (if authToken {"authToken" authToken} {})
:body (json-str data)})
(defroutes app-routes
"Routes requests to their handler function. Captures dynamic variables."
(GET "/summary/:user" [user] (json-response (get-overall-summary user)))
(route/resources "/")
(route/not-found "Page not found"))
(defn -main [& args]
"Main thread for the server which starts an async server with
all the routes we specified and is websocket ready."
- (start-http-server (wrap-ring-handler app-routes)
? ---- ^^^^^^^^^^^^ -
+ (start-http-server (-> app-routes
? ^
+ wrap-cookies
+ wrap-ring-handler)
{:host "localhost" :port 8080 :websocket true})) | 9 | 0.3 | 6 | 3 |
648d4d961d9e63b777240d4048252dab437fe78c | .github/workflows/uiTests.yml | .github/workflows/uiTests.yml | name: Run example UI Tests
on:
workflow_dispatch
jobs:
build-for-ui-test-mac-os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2.1.0
with:
distribution: zulu
java-version: 11
- name: Clean
run: gradle :ui-test-example:clean
- name: Run Idea
run: gradle :ui-test-example:runIdeForUiTests &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@1.5
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
- name: Tests
run: gradle :ui-test-example:test
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ui-test-fails-report-mac
path: |
ui-test-example/build/reports | name: Run example UI Tests
on:
workflow_dispatch
jobs:
build-for-ui-test-mac-os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2.1.0
with:
distribution: zulu
java-version: 11
- name: Clean
run: gradle clean
- name: Run Idea
run: gradle runIdeForUiTests &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@1.5
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
- name: Tests
run: gradle testUi
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ui-test-fails-report-mac
path: |
ui-test-example/build/reports | Use correct gradle tasks names | Use correct gradle tasks names
| YAML | mit | JetBrains/ideavim,JetBrains/ideavim | yaml | ## Code Before:
name: Run example UI Tests
on:
workflow_dispatch
jobs:
build-for-ui-test-mac-os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2.1.0
with:
distribution: zulu
java-version: 11
- name: Clean
run: gradle :ui-test-example:clean
- name: Run Idea
run: gradle :ui-test-example:runIdeForUiTests &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@1.5
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
- name: Tests
run: gradle :ui-test-example:test
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ui-test-fails-report-mac
path: |
ui-test-example/build/reports
## Instruction:
Use correct gradle tasks names
## Code After:
name: Run example UI Tests
on:
workflow_dispatch
jobs:
build-for-ui-test-mac-os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2.1.0
with:
distribution: zulu
java-version: 11
- name: Clean
run: gradle clean
- name: Run Idea
run: gradle runIdeForUiTests &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@1.5
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
- name: Tests
run: gradle testUi
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ui-test-fails-report-mac
path: |
ui-test-example/build/reports | name: Run example UI Tests
on:
workflow_dispatch
jobs:
build-for-ui-test-mac-os:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2.1.0
with:
distribution: zulu
java-version: 11
- name: Clean
- run: gradle :ui-test-example:clean
+ run: gradle clean
- name: Run Idea
- run: gradle :ui-test-example:runIdeForUiTests &
? -----------------
+ run: gradle runIdeForUiTests &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@1.5
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 30s
- name: Tests
- run: gradle :ui-test-example:test
+ run: gradle testUi
- name: Save fails report
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: ui-test-fails-report-mac
path: |
ui-test-example/build/reports | 6 | 0.1875 | 3 | 3 |
df6b77a46efa939a496012a186d3d94dec35d8c3 | iree/compiler/Translation/SPIRV/LinalgToSPIRV/CMakeLists.txt | iree/compiler/Translation/SPIRV/LinalgToSPIRV/CMakeLists.txt |
iree_cc_library(
NAME
LinalgToSPIRV
HDRS
SRCS
"LinalgToSPIRV.cpp"
DEPS
LLVMSupport
MLIRAffineOps
MLIRAffineToStandard
MLIRGPUtoSPIRVTransforms
MLIRGPU
MLIRIR
MLIRLinalg
MLIRLoopsToGPU
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRStandardToSPIRVTransforms
MLIRSupport
MLIRTransforms
)
|
iree_cc_library(
NAME
LinalgToSPIRV
HDRS
SRCS
"LinalgToSPIRV.cpp"
DEPS
LLVMSupport
MLIRAffineOps
MLIRAffineToStandard
MLIRGPUtoSPIRVTransforms
MLIRGPU
MLIRIR
MLIRLinalgOps
MLIRLinalgTransforms
MLIRLinalgUtils
MLIRLoopsToGPU
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRStandardToSPIRVTransforms
MLIRSupport
MLIRTransforms
)
| Update CMake MLIR Linalg dependencies | Update CMake MLIR Linalg dependencies
The LLVM version bump included an update that moved these.
PiperOrigin-RevId: 289954940
| Text | apache-2.0 | iree-org/iree,google/iree,google/iree,google/iree,google/iree,google/iree,iree-org/iree,iree-org/iree,iree-org/iree,iree-org/iree,google/iree,iree-org/iree,google/iree,iree-org/iree | text | ## Code Before:
iree_cc_library(
NAME
LinalgToSPIRV
HDRS
SRCS
"LinalgToSPIRV.cpp"
DEPS
LLVMSupport
MLIRAffineOps
MLIRAffineToStandard
MLIRGPUtoSPIRVTransforms
MLIRGPU
MLIRIR
MLIRLinalg
MLIRLoopsToGPU
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRStandardToSPIRVTransforms
MLIRSupport
MLIRTransforms
)
## Instruction:
Update CMake MLIR Linalg dependencies
The LLVM version bump included an update that moved these.
PiperOrigin-RevId: 289954940
## Code After:
iree_cc_library(
NAME
LinalgToSPIRV
HDRS
SRCS
"LinalgToSPIRV.cpp"
DEPS
LLVMSupport
MLIRAffineOps
MLIRAffineToStandard
MLIRGPUtoSPIRVTransforms
MLIRGPU
MLIRIR
MLIRLinalgOps
MLIRLinalgTransforms
MLIRLinalgUtils
MLIRLoopsToGPU
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRStandardToSPIRVTransforms
MLIRSupport
MLIRTransforms
)
|
iree_cc_library(
NAME
LinalgToSPIRV
HDRS
SRCS
"LinalgToSPIRV.cpp"
DEPS
LLVMSupport
MLIRAffineOps
MLIRAffineToStandard
MLIRGPUtoSPIRVTransforms
MLIRGPU
MLIRIR
- MLIRLinalg
+ MLIRLinalgOps
? +++
+ MLIRLinalgTransforms
+ MLIRLinalgUtils
MLIRLoopsToGPU
MLIRPass
MLIRSPIRV
MLIRStandardOps
MLIRStandardToSPIRVTransforms
MLIRSupport
MLIRTransforms
) | 4 | 0.173913 | 3 | 1 |
d6d356c9382b2bc2efe5e278fc831892f5312983 | examples/babel/destructuring-assignment/index.js | examples/babel/destructuring-assignment/index.js |
import assert from 'assert';
function getObj() {
return {
x: 2,
y: 3
};
}
let {
x,
y,
z = 6
} = getObj();
assert.strictEqual(x, 2);
assert.strictEqual(y, 3);
assert.strictEqual(z, 6);
|
import assert from 'assert';
//
// 分割代入内で代入ができる
//
function getObj() {
return {
x: 2,
y: 3
};
}
let {
x,
y,
z = 6
} = getObj();
assert.strictEqual(x, 2);
assert.strictEqual(y, 3);
assert.strictEqual(z, 6);
//
// 別変数名で展開できる
//
function stringifyObj({ x: xVar, y: yVar }) {
return xVar + yVar;
}
assert.strictEqual(stringifyObj({ x: 'foo', y: 'bar' }), 'foobar');
| Update a sample of ES6 | Update a sample of ES6
| JavaScript | mit | kjirou/nodejs-codes | javascript | ## Code Before:
import assert from 'assert';
function getObj() {
return {
x: 2,
y: 3
};
}
let {
x,
y,
z = 6
} = getObj();
assert.strictEqual(x, 2);
assert.strictEqual(y, 3);
assert.strictEqual(z, 6);
## Instruction:
Update a sample of ES6
## Code After:
import assert from 'assert';
//
// 分割代入内で代入ができる
//
function getObj() {
return {
x: 2,
y: 3
};
}
let {
x,
y,
z = 6
} = getObj();
assert.strictEqual(x, 2);
assert.strictEqual(y, 3);
assert.strictEqual(z, 6);
//
// 別変数名で展開できる
//
function stringifyObj({ x: xVar, y: yVar }) {
return xVar + yVar;
}
assert.strictEqual(stringifyObj({ x: 'foo', y: 'bar' }), 'foobar');
|
import assert from 'assert';
+ //
+ // 分割代入内で代入ができる
+ //
function getObj() {
return {
x: 2,
y: 3
};
}
let {
x,
y,
z = 6
} = getObj();
-
assert.strictEqual(x, 2);
assert.strictEqual(y, 3);
assert.strictEqual(z, 6);
+
+
+ //
+ // 別変数名で展開できる
+ //
+ function stringifyObj({ x: xVar, y: yVar }) {
+ return xVar + yVar;
+ }
+ assert.strictEqual(stringifyObj({ x: 'foo', y: 'bar' }), 'foobar'); | 13 | 0.619048 | 12 | 1 |
01618bbe7e5a5dbdc9fc472d29ee9b150a9b11d5 | config.yml | config.yml | ---
engines:
JSON:
pretty: 1
canonical: 1
serializer: JSON
| ---
engines:
JSON:
pretty: 1
canonical: 1
allow_blessed: 1
serializer: JSON
| Fix emitting boolean JSON values | Fix emitting boolean JSON values
| YAML | agpl-3.0 | gbv/cocoda-db,gbv/cocoda-db | yaml | ## Code Before:
---
engines:
JSON:
pretty: 1
canonical: 1
serializer: JSON
## Instruction:
Fix emitting boolean JSON values
## Code After:
---
engines:
JSON:
pretty: 1
canonical: 1
allow_blessed: 1
serializer: JSON
| ---
engines:
JSON:
pretty: 1
canonical: 1
+ allow_blessed: 1
serializer: JSON | 1 | 0.166667 | 1 | 0 |
85ef97d1bceab3d19c4ceaec2248f2de942ade91 | README.md | README.md | [](https://travis-ci.org/cbeust/testng)
[](https://www.versioneye.com/java/org.testng:testng)
[](https://www.versioneye.com/java/org.testng:testng/references)
[](https://maven-badges.herokuapp.com/maven-central/org.testng/testng)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
Documentation available at [TestNG's main web site](http://testng.org).
| [](https://travis-ci.org/cbeust/testng)
[](https://www.versioneye.com/user/projects/553a031c4e5d2e9408000059)
[](https://www.versioneye.com/java/org.testng:testng/references)
[](https://maven-badges.herokuapp.com/maven-central/org.testng/testng)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
Documentation available at [TestNG's main web site](http://testng.org).
| Use a daily updated url for dependency status | Use a daily updated url for dependency status
| Markdown | apache-2.0 | 6ft-invsbl-rbbt/testng,AJ-72/testng,akozlova/testng,gjuillot/testng,rschmitt/testng,VladRassokhin/testng,rschmitt/testng,VikingDen/testng,VikingDen/testng,msebire/testng,jerome-jacob/testng,smaudet/testng,emopers/testng,juherr/testng,krmahadevan/testng,juherr/testng,JeshRJ/myRepRJ,krmahadevan/testng,bmlct/testng,6ft-invsbl-rbbt/testng,VladRassokhin/testng,jerome-jacob/testng,cbeust/testng,bmlct/testng,jaypal/testng,JeshRJ/myRepRJ,AJ-72/testng,smaudet/testng,tobecrazy/testng,missedone/testng,cbeust/testng,scr/testng,aledsage/testng,gjuillot/testng,jerome-jacob/testng,VladRassokhin/testng,smaudet/testng,raindev/testng,akozlova/testng,smaudet/testng,s2oBCN/testng,scr/testng,aledsage/testng,smaudet/testng,jaypal/testng,JeshRJ/myRepRJ,aledsage/testng,6ft-invsbl-rbbt/testng,msebire/testng,missedone/testng,VladRassokhin/testng,raindev/testng,scr/testng,JeshRJ/myRepRJ,emopers/testng,rschmitt/testng,rschmitt/testng,meeroslaph/testng,tobecrazy/testng,jaypal/testng,akozlova/testng,msebire/testng,scr/testng,aledsage/testng,cbeust/testng,jaypal/testng,juherr/testng,VladRassokhin/testng,jaypal/testng,msebire/testng,AJ-72/testng,emopers/testng,cbeust/testng,aledsage/testng,6ft-invsbl-rbbt/testng,s2oBCN/testng,scr/testng,msebire/testng,s2oBCN/testng,s2oBCN/testng,meeroslaph/testng,VikingDen/testng,JeshRJ/myRepRJ,s2oBCN/testng,AJ-72/testng,juherr/testng,tobecrazy/testng,missedone/testng,gjuillot/testng,meeroslaph/testng,juherr/testng,AJ-72/testng,raindev/testng,raindev/testng,6ft-invsbl-rbbt/testng,tobecrazy/testng,rschmitt/testng,emopers/testng,VladRassokhin/testng,bmlct/testng,akozlova/testng,gjuillot/testng,raindev/testng,missedone/testng,akozlova/testng,meeroslaph/testng,aledsage/testng,raindev/testng,jerome-jacob/testng,cbeust/testng,bmlct/testng,gjuillot/testng,krmahadevan/testng,emopers/testng,missedone/testng,krmahadevan/testng,bmlct/testng,VikingDen/testng,krmahadevan/testng,VikingDen/testng,jerome-jacob/testng,meeroslaph/testng,tobecrazy/testng,AJ-72/testng | markdown | ## Code Before:
[](https://travis-ci.org/cbeust/testng)
[](https://www.versioneye.com/java/org.testng:testng)
[](https://www.versioneye.com/java/org.testng:testng/references)
[](https://maven-badges.herokuapp.com/maven-central/org.testng/testng)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
Documentation available at [TestNG's main web site](http://testng.org).
## Instruction:
Use a daily updated url for dependency status
## Code After:
[](https://travis-ci.org/cbeust/testng)
[](https://www.versioneye.com/user/projects/553a031c4e5d2e9408000059)
[](https://www.versioneye.com/java/org.testng:testng/references)
[](https://maven-badges.herokuapp.com/maven-central/org.testng/testng)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
Documentation available at [TestNG's main web site](http://testng.org).
| [](https://travis-ci.org/cbeust/testng)
- [](https://www.versioneye.com/java/org.testng:testng)
+ [](https://www.versioneye.com/user/projects/553a031c4e5d2e9408000059)
[](https://www.versioneye.com/java/org.testng:testng/references)
[](https://maven-badges.herokuapp.com/maven-central/org.testng/testng)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
Documentation available at [TestNG's main web site](http://testng.org). | 2 | 0.285714 | 1 | 1 |
e96a304a9e9f06b8411e645b5c06ab08cc9dc472 | src/react-autolink.jsx | src/react-autolink.jsx | import React from 'react';
import assign from 'object-assign';
function ReactAutolinkMixin() {
let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})[a-z0-9.,_\/~#&=;%+?-]*)/ig;
return {
autolink(text, options = {}, bufs = []) {
if (!text) return null;
return text.split(delimiter).map(word => {
let match = word.match(delimiter);
if (match) {
let url = match[0];
return React.createElement(
'a',
assign({href: url.startsWith('http') ? url : `http://${url}`}, options),
url
);
} else {
return word;
}
});
}
};
}
export default ReactAutolinkMixin();
| import React from 'react';
import assign from 'object-assign';
function ReactAutolinkMixin() {
let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig;
return {
autolink(text, options = {}, bufs = []) {
if (!text) return null;
return text.split(delimiter).map(word => {
let match = word.match(delimiter);
if (match) {
let url = match[0];
return React.createElement(
'a',
assign({href: url.startsWith('http') ? url : `http://${url}`}, options),
url
);
} else {
return word;
}
});
}
};
}
export default ReactAutolinkMixin();
| Support for matching with port | Support for matching with port
Port regex would be more valid way (0 to 65535), however, I choose more easy (lazy) way
| JSX | mit | banyan/react-autolink,banyan/react-autolink,banyan/react-autolink | jsx | ## Code Before:
import React from 'react';
import assign from 'object-assign';
function ReactAutolinkMixin() {
let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})[a-z0-9.,_\/~#&=;%+?-]*)/ig;
return {
autolink(text, options = {}, bufs = []) {
if (!text) return null;
return text.split(delimiter).map(word => {
let match = word.match(delimiter);
if (match) {
let url = match[0];
return React.createElement(
'a',
assign({href: url.startsWith('http') ? url : `http://${url}`}, options),
url
);
} else {
return word;
}
});
}
};
}
export default ReactAutolinkMixin();
## Instruction:
Support for matching with port
Port regex would be more valid way (0 to 65535), however, I choose more easy (lazy) way
## Code After:
import React from 'react';
import assign from 'object-assign';
function ReactAutolinkMixin() {
let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig;
return {
autolink(text, options = {}, bufs = []) {
if (!text) return null;
return text.split(delimiter).map(word => {
let match = word.match(delimiter);
if (match) {
let url = match[0];
return React.createElement(
'a',
assign({href: url.startsWith('http') ? url : `http://${url}`}, options),
url
);
} else {
return word;
}
});
}
};
}
export default ReactAutolinkMixin();
| import React from 'react';
import assign from 'object-assign';
function ReactAutolinkMixin() {
- let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})[a-z0-9.,_\/~#&=;%+?-]*)/ig;
+ let delimiter = /((?:https?:\/\/)?(?:(?:[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.)+[a-z\.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_\/~#&=;%+?-]*)/ig;
? +++++++++++++
return {
autolink(text, options = {}, bufs = []) {
if (!text) return null;
return text.split(delimiter).map(word => {
let match = word.match(delimiter);
if (match) {
let url = match[0];
return React.createElement(
'a',
assign({href: url.startsWith('http') ? url : `http://${url}`}, options),
url
);
} else {
return word;
}
});
}
};
}
export default ReactAutolinkMixin(); | 2 | 0.071429 | 1 | 1 |
4e04fdbf1d5b89ca1daa8fb929509343880344ad | README.md | README.md | Photon base alarm clock using the Adafruit 128x128 SSD1351 OLED display
## Roadmap
* Add snooze button for testing
* Add ability to configure timezone and save to flash
* Upgrade to a [2.8" TFT LCD with Cap Touch](http://www.adafruit.com/products/2090)
| Photon base alarm clock using the Adafruit 128x128 SSD1351 OLED display
## Roadmap
* Add snooze button for testing
* Add ability to configure timezone and save to flash
* Upgrade to a [2.6" Serial: UART/I2C/SPI IPS Super TFT 320x240 with Touchscreen+16MB Flash Module](http://digole.com/index.php?productID=1225)
| Set goal for smarter screen | Set goal for smarter screen | Markdown | mit | tjpeden/mane-avis,tjpeden/mane-avis,tpeden/mane-avis,tpeden/mane-avis | markdown | ## Code Before:
Photon base alarm clock using the Adafruit 128x128 SSD1351 OLED display
## Roadmap
* Add snooze button for testing
* Add ability to configure timezone and save to flash
* Upgrade to a [2.8" TFT LCD with Cap Touch](http://www.adafruit.com/products/2090)
## Instruction:
Set goal for smarter screen
## Code After:
Photon base alarm clock using the Adafruit 128x128 SSD1351 OLED display
## Roadmap
* Add snooze button for testing
* Add ability to configure timezone and save to flash
* Upgrade to a [2.6" Serial: UART/I2C/SPI IPS Super TFT 320x240 with Touchscreen+16MB Flash Module](http://digole.com/index.php?productID=1225)
| Photon base alarm clock using the Adafruit 128x128 SSD1351 OLED display
## Roadmap
* Add snooze button for testing
* Add ability to configure timezone and save to flash
- * Upgrade to a [2.8" TFT LCD with Cap Touch](http://www.adafruit.com/products/2090)
+ * Upgrade to a [2.6" Serial: UART/I2C/SPI IPS Super TFT 320x240 with Touchscreen+16MB Flash Module](http://digole.com/index.php?productID=1225) | 2 | 0.285714 | 1 | 1 |
f195de0db97d483584ca67127682301bbeaec514 | articles/libraries/lock/_includes/_lock-version-9.md | articles/libraries/lock/_includes/_lock-version-9.md | <div class="alert alert-warning">
This document covers an outdated version of Lock - version 9. We recommend using the latest version of the library. To do so select v10 at the dropdown. If you are already using v9 but interested in upgrading, take a look at the <a href="/libraries/lock/v10/migration-guide">Lock 9 to Lock 10 migration guide</a>.
</div>
| <div class="alert alert-warning version-alert">
This document covers an outdated version of Lock. We recommend you to <a href="/libraries/lock/v10/migration-guide">upgrade to v10</a>.
</div>
| Change copy of lock 9 version | Change copy of lock 9 version
| Markdown | mit | auth0/docs,jeffreylees/docs,yvonnewilson/docs,auth0/docs,jeffreylees/docs,yvonnewilson/docs,auth0/docs,jeffreylees/docs,yvonnewilson/docs | markdown | ## Code Before:
<div class="alert alert-warning">
This document covers an outdated version of Lock - version 9. We recommend using the latest version of the library. To do so select v10 at the dropdown. If you are already using v9 but interested in upgrading, take a look at the <a href="/libraries/lock/v10/migration-guide">Lock 9 to Lock 10 migration guide</a>.
</div>
## Instruction:
Change copy of lock 9 version
## Code After:
<div class="alert alert-warning version-alert">
This document covers an outdated version of Lock. We recommend you to <a href="/libraries/lock/v10/migration-guide">upgrade to v10</a>.
</div>
| - <div class="alert alert-warning">
+ <div class="alert alert-warning version-alert">
? ++++++++++++++
- This document covers an outdated version of Lock - version 9. We recommend using the latest version of the library. To do so select v10 at the dropdown. If you are already using v9 but interested in upgrading, take a look at the <a href="/libraries/lock/v10/migration-guide">Lock 9 to Lock 10 migration guide</a>.
+ This document covers an outdated version of Lock. We recommend you to <a href="/libraries/lock/v10/migration-guide">upgrade to v10</a>.
</div> | 4 | 1.333333 | 2 | 2 |
927e48f7b920b85fdff0aeb94e560acb252d0f3f | css/style.css | css/style.css | body {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
input {
font-size: 14px;
width: 300px;
}
.graphs {
margin: 20px;
border: 1px solid #ccc;
}
| body {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
input {
font-size: 14px;
width: 300px;
}
.graphs {
margin: 20px;
border: 1px solid #ccc;
}
/* Hide axis lines*/
svg .nv-axis .tick line{
/*display: none;*/
}
| Add option to hide axis lines | :pouch: Add option to hide axis lines
| CSS | mit | 9-volt/bug-life,9-volt/bug-life | css | ## Code Before:
body {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
input {
font-size: 14px;
width: 300px;
}
.graphs {
margin: 20px;
border: 1px solid #ccc;
}
## Instruction:
:pouch: Add option to hide axis lines
## Code After:
body {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
input {
font-size: 14px;
width: 300px;
}
.graphs {
margin: 20px;
border: 1px solid #ccc;
}
/* Hide axis lines*/
svg .nv-axis .tick line{
/*display: none;*/
}
| body {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
input {
font-size: 14px;
width: 300px;
}
.graphs {
margin: 20px;
border: 1px solid #ccc;
}
+
+ /* Hide axis lines*/
+ svg .nv-axis .tick line{
+ /*display: none;*/
+ } | 5 | 0.263158 | 5 | 0 |
d72050e7a602d4e7a3bab253c0c098e90246f9e7 | index.js | index.js | const http = require('http');
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const isProduction = process.env.NODE_ENV === 'production';
if (!isProduction) require('dotenv').config();
var app = express();
const PORT = process.env.PORT || 4000;
const server = http.createServer(app);
const io = require('socket.io')(server, {
origins: '*:*'
});
// Attach the io instance to the express app object
// to make it accessible from the routes
app.io = io;
io.on('connection', (socket) => {
console.log('New client connected');
});
app.use(bodyParser.urlencoded({
extended: true
}))
.use(bodyParser.json())
.use(cors({
origin: process.env.CLIENT_URL || '*',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept'
}))
.use(express.static('public'))
.use('/', require('./routes'));
// Must use http server as listener rather than express app
server.listen(PORT, () => console.log(`Listening on ${ PORT }`));
| const http = require('http');
const path = require('path');
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const isProduction = process.env.NODE_ENV === 'production';
if (!isProduction) require('dotenv').config();
var app = express();
const PORT = process.env.PORT || 4000;
const server = http.createServer(app);
const io = require('socket.io')(server, {
origins: '*:*'
});
// Attach the io instance to the express app object
// to make it accessible from the routes
app.io = io;
io.on('connection', (socket) => {
console.log('New client connected');
});
app.use(bodyParser.urlencoded({
extended: true
}))
.use(bodyParser.json())
.use(cors({
origin: process.env.CLIENT_URL || '*',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept'
}))
.use(express.static(path.resolve(__dirname, 'build')))
.use('/', require('./routes'));
// Render the client routes if any other URL is passed in
// Do this ony in production. The local client server is used otherwise
if (isProduction) {
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
});
}
// Must use http server as listener rather than express app
server.listen(PORT, () => console.log(`Listening on ${ PORT }`));
| Add client routes in production | Add client routes in production
| JavaScript | mit | kevgathuku/torrent-dbx,kevgathuku/torrent-dbx | javascript | ## Code Before:
const http = require('http');
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const isProduction = process.env.NODE_ENV === 'production';
if (!isProduction) require('dotenv').config();
var app = express();
const PORT = process.env.PORT || 4000;
const server = http.createServer(app);
const io = require('socket.io')(server, {
origins: '*:*'
});
// Attach the io instance to the express app object
// to make it accessible from the routes
app.io = io;
io.on('connection', (socket) => {
console.log('New client connected');
});
app.use(bodyParser.urlencoded({
extended: true
}))
.use(bodyParser.json())
.use(cors({
origin: process.env.CLIENT_URL || '*',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept'
}))
.use(express.static('public'))
.use('/', require('./routes'));
// Must use http server as listener rather than express app
server.listen(PORT, () => console.log(`Listening on ${ PORT }`));
## Instruction:
Add client routes in production
## Code After:
const http = require('http');
const path = require('path');
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const isProduction = process.env.NODE_ENV === 'production';
if (!isProduction) require('dotenv').config();
var app = express();
const PORT = process.env.PORT || 4000;
const server = http.createServer(app);
const io = require('socket.io')(server, {
origins: '*:*'
});
// Attach the io instance to the express app object
// to make it accessible from the routes
app.io = io;
io.on('connection', (socket) => {
console.log('New client connected');
});
app.use(bodyParser.urlencoded({
extended: true
}))
.use(bodyParser.json())
.use(cors({
origin: process.env.CLIENT_URL || '*',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept'
}))
.use(express.static(path.resolve(__dirname, 'build')))
.use('/', require('./routes'));
// Render the client routes if any other URL is passed in
// Do this ony in production. The local client server is used otherwise
if (isProduction) {
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
});
}
// Must use http server as listener rather than express app
server.listen(PORT, () => console.log(`Listening on ${ PORT }`));
| const http = require('http');
+ const path = require('path');
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const isProduction = process.env.NODE_ENV === 'production';
if (!isProduction) require('dotenv').config();
var app = express();
const PORT = process.env.PORT || 4000;
const server = http.createServer(app);
const io = require('socket.io')(server, {
origins: '*:*'
});
// Attach the io instance to the express app object
// to make it accessible from the routes
app.io = io;
io.on('connection', (socket) => {
console.log('New client connected');
});
app.use(bodyParser.urlencoded({
extended: true
}))
.use(bodyParser.json())
.use(cors({
origin: process.env.CLIENT_URL || '*',
allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept'
}))
- .use(express.static('public'))
+ .use(express.static(path.resolve(__dirname, 'build')))
.use('/', require('./routes'));
+ // Render the client routes if any other URL is passed in
+ // Do this ony in production. The local client server is used otherwise
+ if (isProduction) {
+ app.get('*', (req, res) => {
+ res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
+ });
+ }
// Must use http server as listener rather than express app
server.listen(PORT, () => console.log(`Listening on ${ PORT }`)); | 10 | 0.25641 | 9 | 1 |
c48405819748498273f800ff6d678b698ac59ae8 | server/index.js | server/index.js | var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000);
| var express = require('express'),
enbMiddleware = require('enb/lib/server/server-middleware');
var app = express();
app.use(enbMiddleware.createMiddleware({
cdir: process.cwd(),
noLog: false
}));
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000);
| Add enb server-middleware to express | Add enb server-middleware to express
| JavaScript | mit | tormozz48/bem-homefinance | javascript | ## Code Before:
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000);
## Instruction:
Add enb server-middleware to express
## Code After:
var express = require('express'),
enbMiddleware = require('enb/lib/server/server-middleware');
var app = express();
app.use(enbMiddleware.createMiddleware({
cdir: process.cwd(),
noLog: false
}));
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000);
| - var express = require('express');
? ^
+ var express = require('express'),
? ^
+ enbMiddleware = require('enb/lib/server/server-middleware');
+
+
var app = express();
+
+ app.use(enbMiddleware.createMiddleware({
+ cdir: process.cwd(),
+ noLog: false
+ }));
app.get('/', function(req, res){
res.send('Hello World');
});
app.listen(3000); | 10 | 1.25 | 9 | 1 |
3ff2042041f896829937d19cbd0aaab68f51cdd4 | ktor-client/ktor-client-core/src/io/ktor/client/request/utils.kt | ktor-client/ktor-client-core/src/io/ktor/client/request/utils.kt | package io.ktor.client.request
import io.ktor.http.*
/**
* Gets the associated URL's host.
*/
var HttpRequestBuilder.host: String
get() = url.host
set(value) {
url.host = value
}
/**
* Gets the associated URL's port.
*/
var HttpRequestBuilder.port: Int
get() = url.port
set(value) {
url.port = value
}
/**
* Sets a single header of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.header(key: String, value: Any?): Unit =
value?.let { headers.append(key, it.toString()) } ?: Unit
/**
* Sets a single parameter of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =
value?.let { url.parameters.append(key, it.toString()) } ?: Unit
/**
* Sets the `Accept` header with a specific [contentType].
*/
fun HttpRequestBuilder.accept(contentType: ContentType): Unit =
headers.append(HttpHeaders.Accept, contentType.toString())
| package io.ktor.client.request
import io.ktor.http.*
/**
* Gets the associated URL's host.
*/
var HttpRequestBuilder.host: String
get() = url.host
set(value) {
url.host = value
}
/**
* Gets the associated URL's port.
*/
var HttpRequestBuilder.port: Int
get() = url.port
set(value) {
url.port = value
}
/**
* Sets a single header of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.header(key: String, value: Any?): Unit =
value?.let { headers.append(key, it.toString()) } ?: Unit
/**
* Sets a single URL query parameter of [key] with a specific [value] if the value is not null. Can not be used to set
* form parameters in the body.
*/
fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =
value?.let { url.parameters.append(key, it.toString()) } ?: Unit
/**
* Sets the `Accept` header with a specific [contentType].
*/
fun HttpRequestBuilder.accept(contentType: ContentType): Unit =
headers.append(HttpHeaders.Accept, contentType.toString())
| Clarify usage of HttpRequestBuilder.parameter() function | Clarify usage of HttpRequestBuilder.parameter() function
| Kotlin | apache-2.0 | ktorio/ktor,ktorio/ktor,ktorio/ktor,ktorio/ktor | kotlin | ## Code Before:
package io.ktor.client.request
import io.ktor.http.*
/**
* Gets the associated URL's host.
*/
var HttpRequestBuilder.host: String
get() = url.host
set(value) {
url.host = value
}
/**
* Gets the associated URL's port.
*/
var HttpRequestBuilder.port: Int
get() = url.port
set(value) {
url.port = value
}
/**
* Sets a single header of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.header(key: String, value: Any?): Unit =
value?.let { headers.append(key, it.toString()) } ?: Unit
/**
* Sets a single parameter of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =
value?.let { url.parameters.append(key, it.toString()) } ?: Unit
/**
* Sets the `Accept` header with a specific [contentType].
*/
fun HttpRequestBuilder.accept(contentType: ContentType): Unit =
headers.append(HttpHeaders.Accept, contentType.toString())
## Instruction:
Clarify usage of HttpRequestBuilder.parameter() function
## Code After:
package io.ktor.client.request
import io.ktor.http.*
/**
* Gets the associated URL's host.
*/
var HttpRequestBuilder.host: String
get() = url.host
set(value) {
url.host = value
}
/**
* Gets the associated URL's port.
*/
var HttpRequestBuilder.port: Int
get() = url.port
set(value) {
url.port = value
}
/**
* Sets a single header of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.header(key: String, value: Any?): Unit =
value?.let { headers.append(key, it.toString()) } ?: Unit
/**
* Sets a single URL query parameter of [key] with a specific [value] if the value is not null. Can not be used to set
* form parameters in the body.
*/
fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =
value?.let { url.parameters.append(key, it.toString()) } ?: Unit
/**
* Sets the `Accept` header with a specific [contentType].
*/
fun HttpRequestBuilder.accept(contentType: ContentType): Unit =
headers.append(HttpHeaders.Accept, contentType.toString())
| package io.ktor.client.request
import io.ktor.http.*
/**
* Gets the associated URL's host.
*/
var HttpRequestBuilder.host: String
get() = url.host
set(value) {
url.host = value
}
/**
* Gets the associated URL's port.
*/
var HttpRequestBuilder.port: Int
get() = url.port
set(value) {
url.port = value
}
/**
* Sets a single header of [key] with a specific [value] if the value is not null.
*/
fun HttpRequestBuilder.header(key: String, value: Any?): Unit =
value?.let { headers.append(key, it.toString()) } ?: Unit
/**
- * Sets a single parameter of [key] with a specific [value] if the value is not null.
+ * Sets a single URL query parameter of [key] with a specific [value] if the value is not null. Can not be used to set
? ++++++++++ +++++++++++++++++++++++
+ * form parameters in the body.
*/
fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =
value?.let { url.parameters.append(key, it.toString()) } ?: Unit
/**
* Sets the `Accept` header with a specific [contentType].
*/
fun HttpRequestBuilder.accept(contentType: ContentType): Unit =
headers.append(HttpHeaders.Accept, contentType.toString()) | 3 | 0.076923 | 2 | 1 |
ff4d372cfb249c1fa0bd9a0d1303eccb4229dfef | src/oslib/osx/OSXOperatingSystem.java | src/oslib/osx/OSXOperatingSystem.java | package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
public OSXOperatingSystem() {
this(OSXVersion.getFromString());
}
public OSXOperatingSystem(OSXVersion version, Arch arch) {
super(OperatingSystem.OSX, arch);
this.version = version;
}
public OSXOperatingSystem(OSXVersion version) {
this(version, Arch.getArch());
}
public void setVersion(OSXVersion version) {
this.version = version;
}
public OSXVersion getVersion() {
return this.version;
}
@Override
public String getDisplayString() {
return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
}
@Override
public String getDetailedString() {
return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
}
}
| package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
public OSXOperatingSystem() {
this(OSXVersion.getFromString());
}
public OSXOperatingSystem(OSXVersion version, Arch arch) {
super(OperatingSystem.OSX, arch);
this.version = version;
}
public OSXOperatingSystem(OSXVersion version) {
this(version, Arch.getArch());
}
public void setVersion(OSXVersion version) {
this.version = version;
}
public OSXVersion getVersion() {
return this.version;
}
@Override
public String getDisplayString() {
String s = "Mac OS X";
if (version.getDisplay() != null) {
s += " " + version.getDisplay();
}
if (version.getVersion() != null) {
s += " " + version.getVersion();
}
return s;
}
@Override
public String getDetailedString() {
return this.getDisplayString();
}
}
| Check for nulls (fix nullpointer on newer OSX?) | Check for nulls (fix nullpointer on newer OSX?)
| Java | mit | redpois0n/oslib | java | ## Code Before:
package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
public OSXOperatingSystem() {
this(OSXVersion.getFromString());
}
public OSXOperatingSystem(OSXVersion version, Arch arch) {
super(OperatingSystem.OSX, arch);
this.version = version;
}
public OSXOperatingSystem(OSXVersion version) {
this(version, Arch.getArch());
}
public void setVersion(OSXVersion version) {
this.version = version;
}
public OSXVersion getVersion() {
return this.version;
}
@Override
public String getDisplayString() {
return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
}
@Override
public String getDetailedString() {
return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
}
}
## Instruction:
Check for nulls (fix nullpointer on newer OSX?)
## Code After:
package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
public OSXOperatingSystem() {
this(OSXVersion.getFromString());
}
public OSXOperatingSystem(OSXVersion version, Arch arch) {
super(OperatingSystem.OSX, arch);
this.version = version;
}
public OSXOperatingSystem(OSXVersion version) {
this(version, Arch.getArch());
}
public void setVersion(OSXVersion version) {
this.version = version;
}
public OSXVersion getVersion() {
return this.version;
}
@Override
public String getDisplayString() {
String s = "Mac OS X";
if (version.getDisplay() != null) {
s += " " + version.getDisplay();
}
if (version.getVersion() != null) {
s += " " + version.getVersion();
}
return s;
}
@Override
public String getDetailedString() {
return this.getDisplayString();
}
}
| package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
public OSXOperatingSystem() {
this(OSXVersion.getFromString());
}
public OSXOperatingSystem(OSXVersion version, Arch arch) {
super(OperatingSystem.OSX, arch);
this.version = version;
}
public OSXOperatingSystem(OSXVersion version) {
this(version, Arch.getArch());
}
public void setVersion(OSXVersion version) {
this.version = version;
}
public OSXVersion getVersion() {
return this.version;
}
@Override
public String getDisplayString() {
- return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
+ String s = "Mac OS X";
+
+ if (version.getDisplay() != null) {
+ s += " " + version.getDisplay();
+ }
+
+ if (version.getVersion() != null) {
+ s += " " + version.getVersion();
+ }
+
+ return s;
}
@Override
public String getDetailedString() {
- return "Mac OS X " + version.getDisplay() + " " + version.getVersion();
+ return this.getDisplayString();
}
} | 14 | 0.304348 | 12 | 2 |
cf45b9839c08a4b793805252362dd9659ccd83f8 | spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "rubygems"
require "sidekiq/testing"
require "active_support/core_ext/numeric/time"
require "timecop"
require "simplecov"
require "coveralls"
pid = Process.pid
SimpleCov.at_exit do
SimpleCov.result.format! if Process.pid == pid
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "sidekiq/merger"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.order = :random
Kernel.srand config.seed
config.before :suite do
Sidekiq::Testing.fake!
Sidekiq::Merger.logger = nil
Sidekiq.logger = nil
end
config.before :example do
Sidekiq::Merger::Redis.redis do |conn|
conn.flushall
end
end
config.after :example do
Timecop.return
end
end
| $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "rubygems"
require "sidekiq/testing"
require "active_support/core_ext/numeric/time"
require "timecop"
require "simplecov"
require "coveralls"
pid = Process.pid
SimpleCov.at_exit do
SimpleCov.result.format! if Process.pid == pid
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "sidekiq/merger"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.order = :random
Kernel.srand config.seed
config.before :suite do
Sidekiq::Testing.fake!
Sidekiq::Merger.logger = nil
Sidekiq.logger = nil
end
config.around :example do |example|
Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
begin
example.run
ensure
Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
end
end
config.after :example do
Timecop.return
end
end
| Clean up redis after examples | Clean up redis after examples
| Ruby | mit | dtaniwaki/sidekiq-merger,dtaniwaki/sidekiq-merger | ruby | ## Code Before:
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "rubygems"
require "sidekiq/testing"
require "active_support/core_ext/numeric/time"
require "timecop"
require "simplecov"
require "coveralls"
pid = Process.pid
SimpleCov.at_exit do
SimpleCov.result.format! if Process.pid == pid
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "sidekiq/merger"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.order = :random
Kernel.srand config.seed
config.before :suite do
Sidekiq::Testing.fake!
Sidekiq::Merger.logger = nil
Sidekiq.logger = nil
end
config.before :example do
Sidekiq::Merger::Redis.redis do |conn|
conn.flushall
end
end
config.after :example do
Timecop.return
end
end
## Instruction:
Clean up redis after examples
## Code After:
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "rubygems"
require "sidekiq/testing"
require "active_support/core_ext/numeric/time"
require "timecop"
require "simplecov"
require "coveralls"
pid = Process.pid
SimpleCov.at_exit do
SimpleCov.result.format! if Process.pid == pid
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "sidekiq/merger"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.order = :random
Kernel.srand config.seed
config.before :suite do
Sidekiq::Testing.fake!
Sidekiq::Merger.logger = nil
Sidekiq.logger = nil
end
config.around :example do |example|
Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
begin
example.run
ensure
Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
end
end
config.after :example do
Timecop.return
end
end
| $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "rubygems"
require "sidekiq/testing"
require "active_support/core_ext/numeric/time"
require "timecop"
require "simplecov"
require "coveralls"
pid = Process.pid
SimpleCov.at_exit do
SimpleCov.result.format! if Process.pid == pid
end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "sidekiq/merger"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.order = :random
Kernel.srand config.seed
config.before :suite do
Sidekiq::Testing.fake!
Sidekiq::Merger.logger = nil
Sidekiq.logger = nil
end
- config.before :example do
+ config.around :example do |example|
- Sidekiq::Merger::Redis.redis do |conn|
? ^^
+ Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
? ^ ++++++++++++++++
- conn.flushall
+ begin
+ example.run
+ ensure
+ Sidekiq::Merger::Redis.redis { |conn| conn.flushall }
end
end
config.after :example do
Timecop.return
end
end | 9 | 0.163636 | 6 | 3 |
76e048c4570b652c217af4e10c4d4a37d9c72a86 | README.md | README.md | case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash)
==============
> Parse and stringify strings delimited by a dash
Install
--------------
```
$ npm install --save case-dash
```
Usage
--------------
```js
var caseDash = require('case-dash')
// parse
caseDash.parse('this-is-an-example') // ['this', 'is', 'an', 'example']
// stringify
caseDash.stringify(['this', 'is', 'an', 'example']) // 'this-is-an-example'
// check
caseDash.is('this-is-an-example') // true
caseDash.is('this_is_an_example') // false
caseDash.is('thisIsAnExample') // false
caseDash.is('this') // false
```
| case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash) [](https://github.com/feross/standard
==============
> Parse and stringify strings delimited by a dash
Install
--------------
```
$ npm install --save case-dash
```
Usage
--------------
```js
var caseDash = require('case-dash')
// parse
caseDash.parse('this-is-an-example') // ['this', 'is', 'an', 'example']
// stringify
caseDash.stringify(['this', 'is', 'an', 'example']) // 'this-is-an-example'
// check
caseDash.is('this-is-an-example') // true
caseDash.is('this_is_an_example') // false
caseDash.is('thisIsAnExample') // false
caseDash.is('this') // false
```
| Add standard badge to readme | Add standard badge to readme
| Markdown | mit | ileri/case-dash | markdown | ## Code Before:
case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash)
==============
> Parse and stringify strings delimited by a dash
Install
--------------
```
$ npm install --save case-dash
```
Usage
--------------
```js
var caseDash = require('case-dash')
// parse
caseDash.parse('this-is-an-example') // ['this', 'is', 'an', 'example']
// stringify
caseDash.stringify(['this', 'is', 'an', 'example']) // 'this-is-an-example'
// check
caseDash.is('this-is-an-example') // true
caseDash.is('this_is_an_example') // false
caseDash.is('thisIsAnExample') // false
caseDash.is('this') // false
```
## Instruction:
Add standard badge to readme
## Code After:
case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash) [](https://github.com/feross/standard
==============
> Parse and stringify strings delimited by a dash
Install
--------------
```
$ npm install --save case-dash
```
Usage
--------------
```js
var caseDash = require('case-dash')
// parse
caseDash.parse('this-is-an-example') // ['this', 'is', 'an', 'example']
// stringify
caseDash.stringify(['this', 'is', 'an', 'example']) // 'this-is-an-example'
// check
caseDash.is('this-is-an-example') // true
caseDash.is('this_is_an_example') // false
caseDash.is('thisIsAnExample') // false
caseDash.is('this') // false
```
| - case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash)
+ case-dash [](https://codeclimate.com/github/ileri/case-dash) [](https://travis-ci.org/ileri/case-dash) [](https://github.com/feross/standard
? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
==============
> Parse and stringify strings delimited by a dash
Install
--------------
```
$ npm install --save case-dash
```
Usage
--------------
```js
var caseDash = require('case-dash')
// parse
caseDash.parse('this-is-an-example') // ['this', 'is', 'an', 'example']
// stringify
caseDash.stringify(['this', 'is', 'an', 'example']) // 'this-is-an-example'
// check
caseDash.is('this-is-an-example') // true
caseDash.is('this_is_an_example') // false
caseDash.is('thisIsAnExample') // false
caseDash.is('this') // false
``` | 2 | 0.074074 | 1 | 1 |
722dcda1dfa083453e7dfdae774ede843510b8d9 | Source/Model/Settings/MSettingsProtocol.swift | Source/Model/Settings/MSettingsProtocol.swift | import UIKit
protocol MSettingsProtocol
{
var reusableIdentifier:String { get }
var cellHeight:CGFloat { get }
}
| import UIKit
protocol MSettingsProtocol
{
var reusableIdentifier:String { get }
var cellHeight:CGFloat { get }
init(settings:DSettings)
}
| Add required init for protocol | Add required init for protocol
| Swift | mit | velvetroom/columbus | swift | ## Code Before:
import UIKit
protocol MSettingsProtocol
{
var reusableIdentifier:String { get }
var cellHeight:CGFloat { get }
}
## Instruction:
Add required init for protocol
## Code After:
import UIKit
protocol MSettingsProtocol
{
var reusableIdentifier:String { get }
var cellHeight:CGFloat { get }
init(settings:DSettings)
}
| import UIKit
protocol MSettingsProtocol
{
var reusableIdentifier:String { get }
var cellHeight:CGFloat { get }
+
+ init(settings:DSettings)
} | 2 | 0.285714 | 2 | 0 |
60a3b345853d8b25c97a6366c5b4617a83183792 | config.mk | config.mk | INCLUDE+= -I..
CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE=500
# Installation
DESTDIR?= /
PREFIX?= /usr/local/
MANDEST= $(DESTDIR)/usr/share/man/man1/
BINDEST= $(DESTDIR)/$(PREFIX)/bin/
LIBDEST= $(DESTDIR)/$(PREFIX)/lib/
INCDEST= $(DESTDIR)/$(PREFIX)/include/
| INCLUDE+= -I..
CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
# Installation
DESTDIR?= /
PREFIX?= /usr/local/
MANDEST= $(DESTDIR)/usr/share/man/man1/
BINDEST= $(DESTDIR)/$(PREFIX)/bin/
LIBDEST= $(DESTDIR)/$(PREFIX)/lib/
INCDEST= $(DESTDIR)/$(PREFIX)/include/
| Use _XOPEN_SOURCE_EXTENDED instead of _XOPEN_SOURCE=500, since 500 breaks compilation on actual BSD machines | Use _XOPEN_SOURCE_EXTENDED instead of _XOPEN_SOURCE=500, since 500 breaks compilation on actual BSD machines
git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@1112 96dfbd92-d197-e211-9ca9-00110a534b34
| Makefile | mit | RyuKojiro/v6502 | makefile | ## Code Before:
INCLUDE+= -I..
CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE=500
# Installation
DESTDIR?= /
PREFIX?= /usr/local/
MANDEST= $(DESTDIR)/usr/share/man/man1/
BINDEST= $(DESTDIR)/$(PREFIX)/bin/
LIBDEST= $(DESTDIR)/$(PREFIX)/lib/
INCDEST= $(DESTDIR)/$(PREFIX)/include/
## Instruction:
Use _XOPEN_SOURCE_EXTENDED instead of _XOPEN_SOURCE=500, since 500 breaks compilation on actual BSD machines
git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@1112 96dfbd92-d197-e211-9ca9-00110a534b34
## Code After:
INCLUDE+= -I..
CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
# Installation
DESTDIR?= /
PREFIX?= /usr/local/
MANDEST= $(DESTDIR)/usr/share/man/man1/
BINDEST= $(DESTDIR)/$(PREFIX)/bin/
LIBDEST= $(DESTDIR)/$(PREFIX)/lib/
INCDEST= $(DESTDIR)/$(PREFIX)/include/
| INCLUDE+= -I..
- CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE=500
? ^^^^
+ CFLAGS+= -Wall -Wno-unknown-pragmas -std=c99 -ggdb $(INCLUDE) -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
? ^^^^^^^^^^^^^^^^^^^^^^^^^
# Installation
DESTDIR?= /
PREFIX?= /usr/local/
MANDEST= $(DESTDIR)/usr/share/man/man1/
BINDEST= $(DESTDIR)/$(PREFIX)/bin/
LIBDEST= $(DESTDIR)/$(PREFIX)/lib/
INCDEST= $(DESTDIR)/$(PREFIX)/include/ | 2 | 0.181818 | 1 | 1 |
daeef5fea7e57a0546a2ff137bc0b738039b1259 | libraries/glassfish_helper.rb | libraries/glassfish_helper.rb |
class RealityForge #nodoc
module GlassFish #nodoc
class << self
# Return the current domain name
#
# The domain is typically set when configuration run starts
#
def get_current_domain(node)
domain_key = node.run_state['glassfish_domain']
raise 'No domain specified' unless domain_key
domain_key
end
# Set the current domain name
#
def set_current_domain(node, domain_key)
node.run_state['glassfish_domain'] = domain_key
end
end
end
end
|
class RealityForge #nodoc
module GlassFish #nodoc
class << self
# Return the current glassfish domain name
#
# The domain is typically set when configuration run starts
#
def get_current_domain(node)
domain_key = node.run_state['glassfish_domain']
raise 'No domain specified' unless domain_key
domain_key
end
# Set the current glassfish domain name
#
def set_current_domain(node, domain_key)
node.run_state['glassfish_domain'] = domain_key
end
end
end
end
| Improve the doc comments so that they are more specific | Improve the doc comments so that they are more specific
| Ruby | apache-2.0 | realityforge/chef-glassfish,realityforge/chef-glassfish,hopshadoop/chef-glassfish,realityforge/chef-glassfish,hopshadoop/chef-glassfish,hopshadoop/chef-glassfish | ruby | ## Code Before:
class RealityForge #nodoc
module GlassFish #nodoc
class << self
# Return the current domain name
#
# The domain is typically set when configuration run starts
#
def get_current_domain(node)
domain_key = node.run_state['glassfish_domain']
raise 'No domain specified' unless domain_key
domain_key
end
# Set the current domain name
#
def set_current_domain(node, domain_key)
node.run_state['glassfish_domain'] = domain_key
end
end
end
end
## Instruction:
Improve the doc comments so that they are more specific
## Code After:
class RealityForge #nodoc
module GlassFish #nodoc
class << self
# Return the current glassfish domain name
#
# The domain is typically set when configuration run starts
#
def get_current_domain(node)
domain_key = node.run_state['glassfish_domain']
raise 'No domain specified' unless domain_key
domain_key
end
# Set the current glassfish domain name
#
def set_current_domain(node, domain_key)
node.run_state['glassfish_domain'] = domain_key
end
end
end
end
|
class RealityForge #nodoc
module GlassFish #nodoc
class << self
- # Return the current domain name
+ # Return the current glassfish domain name
? ++++++++++
#
# The domain is typically set when configuration run starts
#
def get_current_domain(node)
domain_key = node.run_state['glassfish_domain']
raise 'No domain specified' unless domain_key
domain_key
end
- # Set the current domain name
+ # Set the current glassfish domain name
? ++++++++++
#
def set_current_domain(node, domain_key)
node.run_state['glassfish_domain'] = domain_key
end
end
end
end | 4 | 0.181818 | 2 | 2 |
e593787ce47ecfe5ee47a1b2aa324c74808e0af0 | lib/extension-helper.coffee | lib/extension-helper.coffee | extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py'
'rb': 'rb'
'ruby': 'rb'
'sh': 'sh'
'toml': 'toml'
'xml': 'xml'
module.exports =
extensionForFenceName: (fenceName) ->
extensionsByFenceName[fenceName]
| extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py'
'rb': 'rb'
'ruby': 'rb'
'sh': 'sh'
'toml': 'toml'
'xml': 'xml'
'yaml': 'yaml'
'yml': 'yaml'
module.exports =
extensionForFenceName: (fenceName) ->
extensionsByFenceName[fenceName]
| Support fenced yaml code blocks | Support fenced yaml code blocks
Refs atom/language-gfm#17
| CoffeeScript | mit | grimmer0125/markdown-preview-kramdown,makyo/markdown-preview,sctlee/markdown-preview,Galadirith/markdown-preview,rugk/markdown-preview,atom/markdown-preview,tkssharma/markdown-preview,ArnaudRinquin/markdown-preview | coffeescript | ## Code Before:
extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py'
'rb': 'rb'
'ruby': 'rb'
'sh': 'sh'
'toml': 'toml'
'xml': 'xml'
module.exports =
extensionForFenceName: (fenceName) ->
extensionsByFenceName[fenceName]
## Instruction:
Support fenced yaml code blocks
Refs atom/language-gfm#17
## Code After:
extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py'
'rb': 'rb'
'ruby': 'rb'
'sh': 'sh'
'toml': 'toml'
'xml': 'xml'
'yaml': 'yaml'
'yml': 'yaml'
module.exports =
extensionForFenceName: (fenceName) ->
extensionsByFenceName[fenceName]
| extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py'
'rb': 'rb'
'ruby': 'rb'
'sh': 'sh'
'toml': 'toml'
'xml': 'xml'
+ 'yaml': 'yaml'
+ 'yml': 'yaml'
module.exports =
extensionForFenceName: (fenceName) ->
extensionsByFenceName[fenceName] | 2 | 0.076923 | 2 | 0 |
986012e1b960989a6ec5728219467e3868970b72 | services/api/package.json | services/api/package.json | {
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "echo 'hi'",
"test": "jest",
"test:watch": "jest --watch",
"start": "node -r dotenv-extended/config src",
"dev": "NODE_ENV=development nodemon --watch src --exec 'node -r dotenv-extended/config' -- src"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"dotenv": "^4.0.0",
"dotenv-extended": "^2.0.1",
"express": "^4.16.1",
"express-graphql": "^0.6.11",
"graphql": "^0.11.7",
"graphql-tools": "^2.5.0",
"jsonwebtoken": "^8.0.1",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"nodemon": "^1.12.1",
"ramda": "^0.24.1",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"winston": "^2.4.0"
}
}
| {
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "echo 'hi'",
"test": "jest",
"test:watch": "jest --watch",
"start": "node -r dotenv-extended/config src",
"dev": "NODE_ENV=development nodemon --watch src --exec 'node -r dotenv-extended/config' -- src"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"dotenv": "^4.0.0",
"dotenv-extended": "^2.0.1",
"express": "^4.16.1",
"express-graphql": "^0.6.11",
"graphql": "^0.11.7",
"graphql-tools": "^2.5.0",
"jsonwebtoken": "^8.0.1",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"nodemon": "^1.12.1",
"ramda": "^0.24.1",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"winston": "^2.4.0"
},
"devDependencies": {
"jest": "^22.0.0",
"prettier": "^1.9.2"
},
"jest": {
"rootDir": ".",
"testEnvironment": "node"
}
}
| Add jest & prettier to api devDeps | Add jest & prettier to api devDeps
| JSON | apache-2.0 | amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon | json | ## Code Before:
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "echo 'hi'",
"test": "jest",
"test:watch": "jest --watch",
"start": "node -r dotenv-extended/config src",
"dev": "NODE_ENV=development nodemon --watch src --exec 'node -r dotenv-extended/config' -- src"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"dotenv": "^4.0.0",
"dotenv-extended": "^2.0.1",
"express": "^4.16.1",
"express-graphql": "^0.6.11",
"graphql": "^0.11.7",
"graphql-tools": "^2.5.0",
"jsonwebtoken": "^8.0.1",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"nodemon": "^1.12.1",
"ramda": "^0.24.1",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"winston": "^2.4.0"
}
}
## Instruction:
Add jest & prettier to api devDeps
## Code After:
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "echo 'hi'",
"test": "jest",
"test:watch": "jest --watch",
"start": "node -r dotenv-extended/config src",
"dev": "NODE_ENV=development nodemon --watch src --exec 'node -r dotenv-extended/config' -- src"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"dotenv": "^4.0.0",
"dotenv-extended": "^2.0.1",
"express": "^4.16.1",
"express-graphql": "^0.6.11",
"graphql": "^0.11.7",
"graphql-tools": "^2.5.0",
"jsonwebtoken": "^8.0.1",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"nodemon": "^1.12.1",
"ramda": "^0.24.1",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"winston": "^2.4.0"
},
"devDependencies": {
"jest": "^22.0.0",
"prettier": "^1.9.2"
},
"jest": {
"rootDir": ".",
"testEnvironment": "node"
}
}
| {
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "echo 'hi'",
"test": "jest",
"test:watch": "jest --watch",
"start": "node -r dotenv-extended/config src",
"dev": "NODE_ENV=development nodemon --watch src --exec 'node -r dotenv-extended/config' -- src"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"dotenv": "^4.0.0",
"dotenv-extended": "^2.0.1",
"express": "^4.16.1",
"express-graphql": "^0.6.11",
"graphql": "^0.11.7",
"graphql-tools": "^2.5.0",
"jsonwebtoken": "^8.0.1",
"mariasql": "^0.2.6",
"morgan": "^1.9.0",
"nodemon": "^1.12.1",
"ramda": "^0.24.1",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",
"winston": "^2.4.0"
+ },
+ "devDependencies": {
+ "jest": "^22.0.0",
+ "prettier": "^1.9.2"
+ },
+ "jest": {
+ "rootDir": ".",
+ "testEnvironment": "node"
}
} | 8 | 0.235294 | 8 | 0 |
020b27ec210d83aed0d2094d055221e5d2ac7af2 | .github/workflows/build.js.yml | .github/workflows/build.js.yml |
name: Check PR
on:
workflow_dispatch:
push:
branches:
- master
- release/*
- hotfix/*
pull_request:
branches-ignore:
- tag/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- run: ./node_modules/.bin/bower install
- run: grunt
|
name: Build without deploy
on:
workflow_dispatch:
push:
branches:
- master
- release/*
- hotfix/*
pull_request:
branches-ignore:
- tag/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- run: ./node_modules/.bin/bower install
- run: grunt
| Build without deploy on pushes to master and release branches | Build without deploy on pushes to master and release branches
| YAML | unknown | bedrin/jdbc-sniffer-ui,sniffy/sniffy-ui,sniffy/sniffy-ui,bedrin/jdbc-sniffer-ui | yaml | ## Code Before:
name: Check PR
on:
workflow_dispatch:
push:
branches:
- master
- release/*
- hotfix/*
pull_request:
branches-ignore:
- tag/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- run: ./node_modules/.bin/bower install
- run: grunt
## Instruction:
Build without deploy on pushes to master and release branches
## Code After:
name: Build without deploy
on:
workflow_dispatch:
push:
branches:
- master
- release/*
- hotfix/*
pull_request:
branches-ignore:
- tag/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- run: ./node_modules/.bin/bower install
- run: grunt
|
- name: Check PR
+ name: Build without deploy
on:
workflow_dispatch:
push:
branches:
- master
- release/*
- hotfix/*
pull_request:
branches-ignore:
- tag/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
- run: ./node_modules/.bin/bower install
- run: grunt | 2 | 0.076923 | 1 | 1 |
c9b72d350872bf0d23d3b7905c7f8169c7f91a8b | reverb/cc/conversions.h | reverb/cc/conversions.h | // Copyright 2019 DeepMind Technologies Limited.
//
// 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.
#ifndef REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_
#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"
namespace deepmind {
namespace reverb {
namespace pybind {
void ImportNumpy();
tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
PyObject **out_ndarray);
tensorflow::Status NdArrayToTensor(PyObject *ndarray,
tensorflow::Tensor *out_tensor);
tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
PyArray_Descr **out_descr);
} // namespace pybind
} // namespace reverb
} // namespace deepmind
#endif // REVERB_CC_CONVERSIONS_H_
| // Copyright 2019 DeepMind Technologies Limited.
//
// 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.
#ifndef REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_
#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"
namespace deepmind {
namespace reverb {
namespace pybind {
// One MUST initialize Numpy, e.g. within the Pybind11 module definition before
// calling C Numpy functions.
// See https://pythonextensionpatterns.readthedocs.io/en/latest/cpp_and_numpy.html
void ImportNumpy();
tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
PyObject **out_ndarray);
tensorflow::Status NdArrayToTensor(PyObject *ndarray,
tensorflow::Tensor *out_tensor);
tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
PyArray_Descr **out_descr);
} // namespace pybind
} // namespace reverb
} // namespace deepmind
#endif // REVERB_CC_CONVERSIONS_H_
| Document why `ImportNumpy ` exists and when it should be used. | Document why `ImportNumpy ` exists and when it should be used.
PiperOrigin-RevId: 474532725
Change-Id: I305a57456bcac3186389a733e16d962fcee99dee
| C | apache-2.0 | deepmind/reverb,deepmind/reverb,deepmind/reverb,deepmind/reverb | c | ## Code Before:
// Copyright 2019 DeepMind Technologies Limited.
//
// 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.
#ifndef REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_
#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"
namespace deepmind {
namespace reverb {
namespace pybind {
void ImportNumpy();
tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
PyObject **out_ndarray);
tensorflow::Status NdArrayToTensor(PyObject *ndarray,
tensorflow::Tensor *out_tensor);
tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
PyArray_Descr **out_descr);
} // namespace pybind
} // namespace reverb
} // namespace deepmind
#endif // REVERB_CC_CONVERSIONS_H_
## Instruction:
Document why `ImportNumpy ` exists and when it should be used.
PiperOrigin-RevId: 474532725
Change-Id: I305a57456bcac3186389a733e16d962fcee99dee
## Code After:
// Copyright 2019 DeepMind Technologies Limited.
//
// 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.
#ifndef REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_
#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"
namespace deepmind {
namespace reverb {
namespace pybind {
// One MUST initialize Numpy, e.g. within the Pybind11 module definition before
// calling C Numpy functions.
// See https://pythonextensionpatterns.readthedocs.io/en/latest/cpp_and_numpy.html
void ImportNumpy();
tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
PyObject **out_ndarray);
tensorflow::Status NdArrayToTensor(PyObject *ndarray,
tensorflow::Tensor *out_tensor);
tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
PyArray_Descr **out_descr);
} // namespace pybind
} // namespace reverb
} // namespace deepmind
#endif // REVERB_CC_CONVERSIONS_H_
| // Copyright 2019 DeepMind Technologies Limited.
//
// 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.
#ifndef REVERB_CC_CONVERSIONS_H_
#define REVERB_CC_CONVERSIONS_H_
#include "numpy/arrayobject.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/tensor.h"
namespace deepmind {
namespace reverb {
namespace pybind {
+ // One MUST initialize Numpy, e.g. within the Pybind11 module definition before
+ // calling C Numpy functions.
+ // See https://pythonextensionpatterns.readthedocs.io/en/latest/cpp_and_numpy.html
void ImportNumpy();
tensorflow::Status TensorToNdArray(const tensorflow::Tensor &tensor,
PyObject **out_ndarray);
tensorflow::Status NdArrayToTensor(PyObject *ndarray,
tensorflow::Tensor *out_tensor);
tensorflow::Status GetPyDescrFromDataType(tensorflow::DataType dtype,
PyArray_Descr **out_descr);
} // namespace pybind
} // namespace reverb
} // namespace deepmind
#endif // REVERB_CC_CONVERSIONS_H_ | 3 | 0.073171 | 3 | 0 |
1a534acf6038b35c8bba125c277d349ec967d5bd | lc0246_strobogrammatic_number.py | lc0246_strobogrammatic_number.py |
class Solution(object):
def isStrobogrammatic(self, num):
"""
:type num: str
:rtype: bool
"""
pass
def main():
# Output: true
num = "69"
print Solution().isStrobogrammatic(num)
# Output: true
num = "88"
print Solution().isStrobogrammatic(num)
# Output: false
num = "962"
print Solution().isStrobogrammatic(num)
if __name__ == '__main__':
main()
|
class SolutionMapDictIter(object):
def isStrobogrammatic(self, num):
"""
:type num: str
:rtype: bool
Time complexity: O(n).
Space complexity: O(n).
"""
# Reverse num.
rev_num = num[::-1]
# Convert to mapped number or empty string.
map_d = {
'0': '0',
'1': '1',
'6': '9',
'8': '8',
'9': '6'
}
mapped_num_ls = []
for n in rev_num:
if n in map_d:
mapped_num_ls.append(map_d[n])
else:
mapped_num_ls.append(' ')
mapped_num = ''.join(mapped_num_ls)
# Check if strobogrammatic.
return mapped_num == num
def main():
# Output: true
num = "69"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: true
num = "88"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: false
num = "962"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: false
num = "2"
print SolutionMapDictIter().isStrobogrammatic(num)
if __name__ == '__main__':
main()
| Complete map dict sol w/ time/space complexity | Complete map dict sol w/ time/space complexity
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | python | ## Code Before:
class Solution(object):
def isStrobogrammatic(self, num):
"""
:type num: str
:rtype: bool
"""
pass
def main():
# Output: true
num = "69"
print Solution().isStrobogrammatic(num)
# Output: true
num = "88"
print Solution().isStrobogrammatic(num)
# Output: false
num = "962"
print Solution().isStrobogrammatic(num)
if __name__ == '__main__':
main()
## Instruction:
Complete map dict sol w/ time/space complexity
## Code After:
class SolutionMapDictIter(object):
def isStrobogrammatic(self, num):
"""
:type num: str
:rtype: bool
Time complexity: O(n).
Space complexity: O(n).
"""
# Reverse num.
rev_num = num[::-1]
# Convert to mapped number or empty string.
map_d = {
'0': '0',
'1': '1',
'6': '9',
'8': '8',
'9': '6'
}
mapped_num_ls = []
for n in rev_num:
if n in map_d:
mapped_num_ls.append(map_d[n])
else:
mapped_num_ls.append(' ')
mapped_num = ''.join(mapped_num_ls)
# Check if strobogrammatic.
return mapped_num == num
def main():
# Output: true
num = "69"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: true
num = "88"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: false
num = "962"
print SolutionMapDictIter().isStrobogrammatic(num)
# Output: false
num = "2"
print SolutionMapDictIter().isStrobogrammatic(num)
if __name__ == '__main__':
main()
|
- class Solution(object):
+ class SolutionMapDictIter(object):
? +++++++++++
def isStrobogrammatic(self, num):
"""
:type num: str
:rtype: bool
+
+ Time complexity: O(n).
+ Space complexity: O(n).
"""
+ # Reverse num.
+ rev_num = num[::-1]
+
+ # Convert to mapped number or empty string.
+ map_d = {
+ '0': '0',
+ '1': '1',
+ '6': '9',
+ '8': '8',
+ '9': '6'
- pass
? ^^^^
+ }
? ^
+
+ mapped_num_ls = []
+ for n in rev_num:
+ if n in map_d:
+ mapped_num_ls.append(map_d[n])
+ else:
+ mapped_num_ls.append(' ')
+ mapped_num = ''.join(mapped_num_ls)
+
+ # Check if strobogrammatic.
+ return mapped_num == num
def main():
# Output: true
num = "69"
- print Solution().isStrobogrammatic(num)
+ print SolutionMapDictIter().isStrobogrammatic(num)
? +++++++++++
# Output: true
num = "88"
- print Solution().isStrobogrammatic(num)
+ print SolutionMapDictIter().isStrobogrammatic(num)
? +++++++++++
# Output: false
num = "962"
- print Solution().isStrobogrammatic(num)
+ print SolutionMapDictIter().isStrobogrammatic(num)
? +++++++++++
+
+ # Output: false
+ num = "2"
+ print SolutionMapDictIter().isStrobogrammatic(num)
if __name__ == '__main__':
main() | 38 | 1.407407 | 33 | 5 |
c898ba8fbd2caa4750fc4d50042338f7ad29c85f | example/peek42.dev.html | example/peek42.dev.html | <!DOCTYPE html>
<html lang="en" style="font-family: Avenir, sans-serif;">
<head>
<meta charset="utf-8" />
<title>Peek42</title>
<link rel="stylesheet" href="../monofur.css" />
<link rel="stylesheet" href="../peek42.css" />
<script src="https://unpkg.com/apivis@latest/dist/apivis.umd.js"></script>
<script src="../dist/peek42.umd.js"></script>
<script src="../peek42.js"></script>
<script> 'use strict';
const {p, pp} = peek42.use(apivis);
document.addEventListener('DOMContentLoaded', () => {
p.api(peek42);
});
</script>
</head>
<body>
<h1 id="about">Peek42</h1>
<p>Click Peek42 title to scroll the log to the bottom (the beginning). Click it again to scroll to the top (the end). When in the middle of the log, click the title to scroll to the top.
</p>
</body>
</html>
| <!DOCTYPE html>
<html lang="en" style="font-family: Avenir, sans-serif;">
<head>
<meta charset="utf-8" />
<title>Peek42</title>
<link rel="stylesheet" href="../monofur.css" />
<link rel="stylesheet" href="../peek42.css" />
<script src="https://unpkg.com/apivis@latest/dist/apivis.umd.js"></script>
<script src="../dist/peek42.umd.js"></script>
<script> 'use strict';
const {p, pp} = peek42.use(apivis);
document.addEventListener('DOMContentLoaded', () => {
p.api(peek42);
});
</script>
</head>
<body>
<h1 id="about">Peek42</h1>
<p>Click Peek42 title to scroll the log to the bottom (the beginning). Click it again to scroll to the top (the end). When in the middle of the log, click the title to scroll to the top.
</p>
</body>
</html>
| Remove reference to the old library in example | Remove reference to the old library in example | HTML | mit | rpeev/konsole,rpeev/konsole | html | ## Code Before:
<!DOCTYPE html>
<html lang="en" style="font-family: Avenir, sans-serif;">
<head>
<meta charset="utf-8" />
<title>Peek42</title>
<link rel="stylesheet" href="../monofur.css" />
<link rel="stylesheet" href="../peek42.css" />
<script src="https://unpkg.com/apivis@latest/dist/apivis.umd.js"></script>
<script src="../dist/peek42.umd.js"></script>
<script src="../peek42.js"></script>
<script> 'use strict';
const {p, pp} = peek42.use(apivis);
document.addEventListener('DOMContentLoaded', () => {
p.api(peek42);
});
</script>
</head>
<body>
<h1 id="about">Peek42</h1>
<p>Click Peek42 title to scroll the log to the bottom (the beginning). Click it again to scroll to the top (the end). When in the middle of the log, click the title to scroll to the top.
</p>
</body>
</html>
## Instruction:
Remove reference to the old library in example
## Code After:
<!DOCTYPE html>
<html lang="en" style="font-family: Avenir, sans-serif;">
<head>
<meta charset="utf-8" />
<title>Peek42</title>
<link rel="stylesheet" href="../monofur.css" />
<link rel="stylesheet" href="../peek42.css" />
<script src="https://unpkg.com/apivis@latest/dist/apivis.umd.js"></script>
<script src="../dist/peek42.umd.js"></script>
<script> 'use strict';
const {p, pp} = peek42.use(apivis);
document.addEventListener('DOMContentLoaded', () => {
p.api(peek42);
});
</script>
</head>
<body>
<h1 id="about">Peek42</h1>
<p>Click Peek42 title to scroll the log to the bottom (the beginning). Click it again to scroll to the top (the end). When in the middle of the log, click the title to scroll to the top.
</p>
</body>
</html>
| <!DOCTYPE html>
<html lang="en" style="font-family: Avenir, sans-serif;">
<head>
<meta charset="utf-8" />
<title>Peek42</title>
<link rel="stylesheet" href="../monofur.css" />
<link rel="stylesheet" href="../peek42.css" />
<script src="https://unpkg.com/apivis@latest/dist/apivis.umd.js"></script>
<script src="../dist/peek42.umd.js"></script>
- <script src="../peek42.js"></script>
<script> 'use strict';
const {p, pp} = peek42.use(apivis);
document.addEventListener('DOMContentLoaded', () => {
p.api(peek42);
});
</script>
</head>
<body>
<h1 id="about">Peek42</h1>
<p>Click Peek42 title to scroll the log to the bottom (the beginning). Click it again to scroll to the top (the end). When in the middle of the log, click the title to scroll to the top.
</p>
</body>
</html> | 1 | 0.032258 | 0 | 1 |
21c41f3a74ecc4126cbb3d58afec21293cc1ad6c | test/elixir/elixir/partial_application_test.exs | test/elixir/elixir/partial_application_test.exs | defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_atom_call_and_one_item do
fun = :minus.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_one_item do
fun = minus(_, _)
fun = fun.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_all_items do
fun = minus(_, _)
fun = fun.(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
defp minus(x, y) do
x - y
end
end | defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_atom_call_and_one_item do
fun = :minus.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_one_item do
fun = minus(_, _)
fun = fun.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_all_items do
fun = minus(_, _)
fun = fun.(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_internal_macro do
fun = if(_, do: 1, else: 2)
1 = fun.(20)
2 = fun.(nil)
end
defp minus(x, y) do
x - y
end
end | Add test for partially applying an internal macro. | Add test for partially applying an internal macro.
| Elixir | apache-2.0 | beedub/elixir,beedub/elixir,lexmag/elixir,joshprice/elixir,antipax/elixir,lexmag/elixir,gfvcastro/elixir,ggcampinho/elixir,elixir-lang/elixir,gfvcastro/elixir,kimshrier/elixir,kimshrier/elixir,kelvinst/elixir,pedrosnk/elixir,kelvinst/elixir,pedrosnk/elixir,ggcampinho/elixir,michalmuskala/elixir,antipax/elixir | elixir | ## Code Before:
defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_atom_call_and_one_item do
fun = :minus.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_one_item do
fun = minus(_, _)
fun = fun.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_all_items do
fun = minus(_, _)
fun = fun.(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
defp minus(x, y) do
x - y
end
end
## Instruction:
Add test for partially applying an internal macro.
## Code After:
defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_atom_call_and_one_item do
fun = :minus.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_one_item do
fun = minus(_, _)
fun = fun.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_all_items do
fun = minus(_, _)
fun = fun.(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_internal_macro do
fun = if(_, do: 1, else: 2)
1 = fun.(20)
2 = fun.(nil)
end
defp minus(x, y) do
x - y
end
end | defmodule Elixir::PartialApplicationTest do
use ExUnit::Case
def test_partial_with_simple_call_and_one_item do
fun = minus(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_simple_call_and_all_items do
fun = minus(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
def test_partial_with_atom_call_and_one_item do
fun = :minus.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_one_item do
fun = minus(_, _)
fun = fun.(10, _)
5 = fun.(5)
7 = fun.(3)
end
def test_partial_with_funcall_and_all_items do
fun = minus(_, _)
fun = fun.(_, _)
5 = fun.(10, 5)
7 = fun.(13, 6)
end
+ def test_partial_with_internal_macro do
+ fun = if(_, do: 1, else: 2)
+ 1 = fun.(20)
+ 2 = fun.(nil)
+ end
+
defp minus(x, y) do
x - y
end
end | 6 | 0.153846 | 6 | 0 |
27c26a0e037c3f6cb8d334b245367d4b37eda2f4 | xquery/proiel2treedown.xquery | xquery/proiel2treedown.xquery | declare function local:unwrap($t, $stok)
{
let $children := $stok[@head-id = $t/@id]
let $seq := ($children | $t)/.
return
if ($children)
then
<wg relation="{$t/@relation}">
{
for $s in $seq
return
if ($s is $t)
then $t
else local:unwrap($s, $stok)
}
</wg>
else $t
};
for $s in //sentence
let $stok := $s//token
let $t := $stok[not(@head-id)][1] (: hack ... get rid of subscript :)
return
<sentence>
{
local:unwrap($t, $stok)
}
</sentence> | declare function local:token($t)
{
<w>{ string($t/@form) }</w>,
$t/@presentation-after[. != ' '] ! <pc>{string(.)}</pc>
};
declare function local:unwrap($t, $stok)
{
let $children := $stok[@head-id = $t/@id]
let $seq := ($children | $t)/.
return
if ($children)
then
<wg relation="{$t/@relation}">
{
for $s in $seq
return
if ($s is $t)
then local:token($t)
else local:unwrap($s, $stok)
}
</wg>
else local:token($t)
};
for $s in //sentence
return
<sentence>
{
let $stok := $s//token
for $t in $stok[not(@head-id)]
return local:unwrap($t, $stok)
}
</sentence> | Simplify output to make it more readable. Early exploratory stages, known to be quite buggy. | Simplify output to make it more readable. Early exploratory stages, known to be quite buggy.
| XQuery | apache-2.0 | biblicalhumanities/treedown | xquery | ## Code Before:
declare function local:unwrap($t, $stok)
{
let $children := $stok[@head-id = $t/@id]
let $seq := ($children | $t)/.
return
if ($children)
then
<wg relation="{$t/@relation}">
{
for $s in $seq
return
if ($s is $t)
then $t
else local:unwrap($s, $stok)
}
</wg>
else $t
};
for $s in //sentence
let $stok := $s//token
let $t := $stok[not(@head-id)][1] (: hack ... get rid of subscript :)
return
<sentence>
{
local:unwrap($t, $stok)
}
</sentence>
## Instruction:
Simplify output to make it more readable. Early exploratory stages, known to be quite buggy.
## Code After:
declare function local:token($t)
{
<w>{ string($t/@form) }</w>,
$t/@presentation-after[. != ' '] ! <pc>{string(.)}</pc>
};
declare function local:unwrap($t, $stok)
{
let $children := $stok[@head-id = $t/@id]
let $seq := ($children | $t)/.
return
if ($children)
then
<wg relation="{$t/@relation}">
{
for $s in $seq
return
if ($s is $t)
then local:token($t)
else local:unwrap($s, $stok)
}
</wg>
else local:token($t)
};
for $s in //sentence
return
<sentence>
{
let $stok := $s//token
for $t in $stok[not(@head-id)]
return local:unwrap($t, $stok)
}
</sentence> | + declare function local:token($t)
+ {
+ <w>{ string($t/@form) }</w>,
+ $t/@presentation-after[. != ' '] ! <pc>{string(.)}</pc>
+ };
+
declare function local:unwrap($t, $stok)
{
let $children := $stok[@head-id = $t/@id]
let $seq := ($children | $t)/.
return
if ($children)
then
<wg relation="{$t/@relation}">
{
for $s in $seq
return
if ($s is $t)
- then $t
+ then local:token($t)
else local:unwrap($s, $stok)
}
</wg>
- else $t
+ else local:token($t)
};
for $s in //sentence
- let $stok := $s//token
- let $t := $stok[not(@head-id)][1] (: hack ... get rid of subscript :)
return
<sentence>
- {
+ {
+ let $stok := $s//token
+ for $t in $stok[not(@head-id)]
- local:unwrap($t, $stok)
+ return local:unwrap($t, $stok)
? +++++++
}
</sentence> | 18 | 0.642857 | 12 | 6 |
2f04ede56096bc0fb3d76383901e857daf2a8cd1 | README.md | README.md |
[](https://travis-ci.com/atom/github)
[](https://ci.appveyor.com/project/Atom/github/branch/master)
The Atom GitHub package provides Git and GitHub integration for Atom.



## Installation
This package is bundled with Atom starting in version 1.18, and does not need to be installed separately.
## License
The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks.
GitHub® and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub [logo guidelines](https://github.com/logos).
|
[](https://travis-ci.com/atom/github)
[](https://ci.appveyor.com/project/Atom/github/branch/master)
The Atom GitHub package provides Git and GitHub integration for Atom. Check out [github.atom.io](https://github.atom.io) for more information.



## Installation
This package is bundled with Atom starting in version 1.18, and does not need to be installed separately.
## License
The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks.
GitHub® and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub [logo guidelines](https://github.com/logos).
| Add new github.atom.io microsite to readme ✨ | Add new github.atom.io microsite to readme ✨ | Markdown | mit | atom/github,atom/github,atom/github | markdown | ## Code Before:
[](https://travis-ci.com/atom/github)
[](https://ci.appveyor.com/project/Atom/github/branch/master)
The Atom GitHub package provides Git and GitHub integration for Atom.



## Installation
This package is bundled with Atom starting in version 1.18, and does not need to be installed separately.
## License
The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks.
GitHub® and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub [logo guidelines](https://github.com/logos).
## Instruction:
Add new github.atom.io microsite to readme ✨
## Code After:
[](https://travis-ci.com/atom/github)
[](https://ci.appveyor.com/project/Atom/github/branch/master)
The Atom GitHub package provides Git and GitHub integration for Atom. Check out [github.atom.io](https://github.atom.io) for more information.



## Installation
This package is bundled with Atom starting in version 1.18, and does not need to be installed separately.
## License
The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks.
GitHub® and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub [logo guidelines](https://github.com/logos).
|
[](https://travis-ci.com/atom/github)
[](https://ci.appveyor.com/project/Atom/github/branch/master)
- The Atom GitHub package provides Git and GitHub integration for Atom.
+ The Atom GitHub package provides Git and GitHub integration for Atom. Check out [github.atom.io](https://github.atom.io) for more information.



## Installation
This package is bundled with Atom starting in version 1.18, and does not need to be installed separately.
## License
The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks.
GitHub® and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub [logo guidelines](https://github.com/logos). | 2 | 0.095238 | 1 | 1 |
6177b0cdc08221ab1e4400dfb94e65463b63b9fa | resources/js/components/user-collections/store.js | resources/js/components/user-collections/store.js | const defaultState = {
items: [],
}
const store = {
state: JSON.parse(localStorage.getItem('userCollections')) || defaultState,
getItems() {
return this.state.items
},
addItem(itemId) {
this.state.items.push({id: itemId})
this._saveState()
},
removeItem(itemId) {
this.state.items = this.state.items.filter(({id}) => id !== itemId)
this._saveState()
},
hasItem(itemId) {
return this.state.items.findIndex(({id}) => id === itemId) > -1
},
toggleItem(itemId) {
this.hasItem(itemId) ? this.removeItem(itemId) : this.addItem(itemId)
},
clearAllItems() {
this.state.items = []
this._saveState()
},
_saveState() {
localStorage.setItem('userCollections', JSON.stringify(this.state))
},
}
module.exports = store
| const defaultState = {
items: [],
}
const store = {
state: JSON.parse(localStorage.getItem('userCollections')) || defaultState,
getItems() {
return this.state.items
},
addItem(itemId) {
this.state.items.push({id: itemId})
this._saveState()
this._track('addItem', itemId)
},
removeItem(itemId) {
this.state.items = this.state.items.filter(({id}) => id !== itemId)
this._saveState()
this._track('removeItem', itemId)
},
hasItem(itemId) {
return this.state.items.findIndex(({id}) => id === itemId) > -1
},
toggleItem(itemId) {
this.hasItem(itemId) ? this.removeItem(itemId) : this.addItem(itemId)
},
clearAllItems() {
this.state.items = []
this._saveState()
this._track('clearAllItems', null)
},
_saveState() {
localStorage.setItem('userCollections', JSON.stringify(this.state))
},
// GTM Tracking
_track(actionName, itemId) {
if (!window.dataLayer) return
window.dataLayer.push({
'event': 'UserCollectionEvent',
'eventCategory': 'UserCollection',
'eventAction': actionName,
'eventLabel': itemId,
'userCollection': this.state.items
})
}
}
module.exports = store
| Add basic GTM tracking for user collections | Add basic GTM tracking for user collections
| JavaScript | mit | SlovakNationalGallery/web-umenia-2,SlovakNationalGallery/web-umenia-2,SlovakNationalGallery/web-umenia-2,SlovakNationalGallery/web-umenia-2 | javascript | ## Code Before:
const defaultState = {
items: [],
}
const store = {
state: JSON.parse(localStorage.getItem('userCollections')) || defaultState,
getItems() {
return this.state.items
},
addItem(itemId) {
this.state.items.push({id: itemId})
this._saveState()
},
removeItem(itemId) {
this.state.items = this.state.items.filter(({id}) => id !== itemId)
this._saveState()
},
hasItem(itemId) {
return this.state.items.findIndex(({id}) => id === itemId) > -1
},
toggleItem(itemId) {
this.hasItem(itemId) ? this.removeItem(itemId) : this.addItem(itemId)
},
clearAllItems() {
this.state.items = []
this._saveState()
},
_saveState() {
localStorage.setItem('userCollections', JSON.stringify(this.state))
},
}
module.exports = store
## Instruction:
Add basic GTM tracking for user collections
## Code After:
const defaultState = {
items: [],
}
const store = {
state: JSON.parse(localStorage.getItem('userCollections')) || defaultState,
getItems() {
return this.state.items
},
addItem(itemId) {
this.state.items.push({id: itemId})
this._saveState()
this._track('addItem', itemId)
},
removeItem(itemId) {
this.state.items = this.state.items.filter(({id}) => id !== itemId)
this._saveState()
this._track('removeItem', itemId)
},
hasItem(itemId) {
return this.state.items.findIndex(({id}) => id === itemId) > -1
},
toggleItem(itemId) {
this.hasItem(itemId) ? this.removeItem(itemId) : this.addItem(itemId)
},
clearAllItems() {
this.state.items = []
this._saveState()
this._track('clearAllItems', null)
},
_saveState() {
localStorage.setItem('userCollections', JSON.stringify(this.state))
},
// GTM Tracking
_track(actionName, itemId) {
if (!window.dataLayer) return
window.dataLayer.push({
'event': 'UserCollectionEvent',
'eventCategory': 'UserCollection',
'eventAction': actionName,
'eventLabel': itemId,
'userCollection': this.state.items
})
}
}
module.exports = store
| const defaultState = {
items: [],
}
const store = {
state: JSON.parse(localStorage.getItem('userCollections')) || defaultState,
getItems() {
return this.state.items
},
addItem(itemId) {
this.state.items.push({id: itemId})
this._saveState()
+ this._track('addItem', itemId)
},
removeItem(itemId) {
this.state.items = this.state.items.filter(({id}) => id !== itemId)
this._saveState()
+ this._track('removeItem', itemId)
},
hasItem(itemId) {
return this.state.items.findIndex(({id}) => id === itemId) > -1
},
toggleItem(itemId) {
this.hasItem(itemId) ? this.removeItem(itemId) : this.addItem(itemId)
},
clearAllItems() {
this.state.items = []
this._saveState()
+ this._track('clearAllItems', null)
},
_saveState() {
localStorage.setItem('userCollections', JSON.stringify(this.state))
},
+
+ // GTM Tracking
+ _track(actionName, itemId) {
+ if (!window.dataLayer) return
+
+ window.dataLayer.push({
+ 'event': 'UserCollectionEvent',
+ 'eventCategory': 'UserCollection',
+ 'eventAction': actionName,
+ 'eventLabel': itemId,
+ 'userCollection': this.state.items
+ })
+ }
}
module.exports = store | 16 | 0.4 | 16 | 0 |
a148211d2ef765bfd6e67f0e658cc905a01a72eb | package.json | package.json | {
"private": true,
"name": "horizon",
"description": "Home of the Horizon theme for VS Code",
"author": "Jonathan Olaleye",
"license": "MIT",
"devDependencies": {
"node-sass": "^4.9.3",
"parcel-bundler": "^1.9.7"
}
}
| {
"private": true,
"name": "horizon",
"description": "Home of the Horizon theme for VS Code",
"author": "Jonathan Olaleye",
"license": "MIT",
"scripts": {
"start": "parcel index.html --out-dir build --no-autoinstall",
"build": "parcel build index.html --out-dir build"
},
"devDependencies": {
"node-sass": "^4.9.3",
"parcel-bundler": "^1.9.7"
}
}
| Add parcel serve and build scripts | Add parcel serve and build scripts
| JSON | mit | jolaleye/horizon-theme-vscode | json | ## Code Before:
{
"private": true,
"name": "horizon",
"description": "Home of the Horizon theme for VS Code",
"author": "Jonathan Olaleye",
"license": "MIT",
"devDependencies": {
"node-sass": "^4.9.3",
"parcel-bundler": "^1.9.7"
}
}
## Instruction:
Add parcel serve and build scripts
## Code After:
{
"private": true,
"name": "horizon",
"description": "Home of the Horizon theme for VS Code",
"author": "Jonathan Olaleye",
"license": "MIT",
"scripts": {
"start": "parcel index.html --out-dir build --no-autoinstall",
"build": "parcel build index.html --out-dir build"
},
"devDependencies": {
"node-sass": "^4.9.3",
"parcel-bundler": "^1.9.7"
}
}
| {
"private": true,
"name": "horizon",
"description": "Home of the Horizon theme for VS Code",
"author": "Jonathan Olaleye",
"license": "MIT",
+ "scripts": {
+ "start": "parcel index.html --out-dir build --no-autoinstall",
+ "build": "parcel build index.html --out-dir build"
+ },
"devDependencies": {
"node-sass": "^4.9.3",
"parcel-bundler": "^1.9.7"
}
} | 4 | 0.363636 | 4 | 0 |
28b19413776f0c9b9e5a94df50b195106afd7f5d | README.rst | README.rst | ----------
ironic_lib
----------
Overview
--------
A common library to be used by various projects in the Ironic ecosystem.
Running Tests
-------------
To run tests in virtualenvs (preferred)::
sudo pip install tox
tox
To run tests in the current environment::
sudo pip install -r requirements.txt
nosetests
| ----------
ironic_lib
----------
Overview
--------
A common library to be used **exclusively** by projects under the `Ironic
governance <http://governance.openstack.org/reference/projects/ironic.html>`_.
Running Tests
-------------
To run tests in virtualenvs (preferred)::
sudo pip install tox
tox
To run tests in the current environment::
sudo pip install -r requirements.txt
nosetests
| Clarify which projects are meant to use the ironic-lib | Clarify which projects are meant to use the ironic-lib
This patch is updating the README file to clarify that only projects
under the Ironic governance should be consuming this library.
Change-Id: Ie1430c955e44311bbe5d60503ee146ce1601612e
| reStructuredText | apache-2.0 | openstack/ironic-lib,NaohiroTamura/ironic-lib | restructuredtext | ## Code Before:
----------
ironic_lib
----------
Overview
--------
A common library to be used by various projects in the Ironic ecosystem.
Running Tests
-------------
To run tests in virtualenvs (preferred)::
sudo pip install tox
tox
To run tests in the current environment::
sudo pip install -r requirements.txt
nosetests
## Instruction:
Clarify which projects are meant to use the ironic-lib
This patch is updating the README file to clarify that only projects
under the Ironic governance should be consuming this library.
Change-Id: Ie1430c955e44311bbe5d60503ee146ce1601612e
## Code After:
----------
ironic_lib
----------
Overview
--------
A common library to be used **exclusively** by projects under the `Ironic
governance <http://governance.openstack.org/reference/projects/ironic.html>`_.
Running Tests
-------------
To run tests in virtualenvs (preferred)::
sudo pip install tox
tox
To run tests in the current environment::
sudo pip install -r requirements.txt
nosetests
| ----------
ironic_lib
----------
Overview
--------
- A common library to be used by various projects in the Ironic ecosystem.
+ A common library to be used **exclusively** by projects under the `Ironic
+ governance <http://governance.openstack.org/reference/projects/ironic.html>`_.
Running Tests
-------------
To run tests in virtualenvs (preferred)::
sudo pip install tox
tox
To run tests in the current environment::
sudo pip install -r requirements.txt
nosetests
| 3 | 0.136364 | 2 | 1 |
9bf6405ce9f19f319a152e8cd9032707e8b1beae | README.rst | README.rst | nonogram-solver
===============
Simple script that solves nonograms. It has no great interface, just pass in the nonogram in two lists of lists into
`Puzzle()` and either call `solve()` or `solve_step()` to solve the nonogram entirely or on a step-by-step basis
respectively.
This script was made to solve a nonogram featured in the Break-In introduction newsletter of the University of Twente
Kick-In 2014 introduction week (edition 2, Thursday 21 August 2014). Feel free to adjust, add nice interfaces, add a
brute-force solver, or whatever you want to do with it. Pull requests are welcome. | nonogram-solver
===============
Simple script that solves nonograms. It has no great interface, just pass in the nonogram in two lists of lists into
`Puzzle()` and either call `solve()` or `solve_step()` to solve the nonogram entirely or on a step-by-step basis
respectively.
This script was made to solve a nonogram featured in the Break-In introduction newsletter of the University of Twente
Kick-In 2014 introduction week ([edition 2 of Thursday 21 August 2014](http://www.scribd.com/doc/237386528/Break-In-2014-Editie-2)). Feel free to adjust, add nice interfaces, add a
brute-force solver, or whatever you want to do with it. Pull requests are welcome.
| Add link to online Break-In | Add link to online Break-In | reStructuredText | mit | ralphje/nonogram-solver | restructuredtext | ## Code Before:
nonogram-solver
===============
Simple script that solves nonograms. It has no great interface, just pass in the nonogram in two lists of lists into
`Puzzle()` and either call `solve()` or `solve_step()` to solve the nonogram entirely or on a step-by-step basis
respectively.
This script was made to solve a nonogram featured in the Break-In introduction newsletter of the University of Twente
Kick-In 2014 introduction week (edition 2, Thursday 21 August 2014). Feel free to adjust, add nice interfaces, add a
brute-force solver, or whatever you want to do with it. Pull requests are welcome.
## Instruction:
Add link to online Break-In
## Code After:
nonogram-solver
===============
Simple script that solves nonograms. It has no great interface, just pass in the nonogram in two lists of lists into
`Puzzle()` and either call `solve()` or `solve_step()` to solve the nonogram entirely or on a step-by-step basis
respectively.
This script was made to solve a nonogram featured in the Break-In introduction newsletter of the University of Twente
Kick-In 2014 introduction week ([edition 2 of Thursday 21 August 2014](http://www.scribd.com/doc/237386528/Break-In-2014-Editie-2)). Feel free to adjust, add nice interfaces, add a
brute-force solver, or whatever you want to do with it. Pull requests are welcome.
| nonogram-solver
===============
Simple script that solves nonograms. It has no great interface, just pass in the nonogram in two lists of lists into
`Puzzle()` and either call `solve()` or `solve_step()` to solve the nonogram entirely or on a step-by-step basis
respectively.
This script was made to solve a nonogram featured in the Break-In introduction newsletter of the University of Twente
- Kick-In 2014 introduction week (edition 2, Thursday 21 August 2014). Feel free to adjust, add nice interfaces, add a
? ^
+ Kick-In 2014 introduction week ([edition 2 of Thursday 21 August 2014](http://www.scribd.com/doc/237386528/Break-In-2014-Editie-2)). Feel free to adjust, add nice interfaces, add a
? + ^^^ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
brute-force solver, or whatever you want to do with it. Pull requests are welcome. | 2 | 0.2 | 1 | 1 |
e7aca443a1a0597bdb7c69406e1dbefb99df1624 | src/main/java/ee/tuleva/onboarding/config/DigiDocConfiguration.java | src/main/java/ee/tuleva/onboarding/config/DigiDocConfiguration.java | package ee.tuleva.onboarding.config;
import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class DigiDocConfiguration {
@Bean
@Profile("production")
public org.digidoc4j.Configuration digiDocConfigProd() {
return new org.digidoc4j.Configuration(PROD);
}
@Bean
@ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
public org.digidoc4j.Configuration digiDocConfigDev() {
// use PROD for testing signing
return new org.digidoc4j.Configuration(TEST);
}
}
| package ee.tuleva.onboarding.config;
import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class DigiDocConfiguration {
@Bean
@Profile({"production", "staging"})
public org.digidoc4j.Configuration digiDocConfigProd() {
return new org.digidoc4j.Configuration(PROD);
}
@Bean
@ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
public org.digidoc4j.Configuration digiDocConfigDev() {
// use PROD for testing signing
return new org.digidoc4j.Configuration(TEST);
}
}
| Add staging profile to digidoc | Add staging profile to digidoc
| Java | mit | TulevaEE/onboarding-service,TulevaEE/onboarding-service,TulevaEE/onboarding-service,TulevaEE/onboarding-service | java | ## Code Before:
package ee.tuleva.onboarding.config;
import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class DigiDocConfiguration {
@Bean
@Profile("production")
public org.digidoc4j.Configuration digiDocConfigProd() {
return new org.digidoc4j.Configuration(PROD);
}
@Bean
@ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
public org.digidoc4j.Configuration digiDocConfigDev() {
// use PROD for testing signing
return new org.digidoc4j.Configuration(TEST);
}
}
## Instruction:
Add staging profile to digidoc
## Code After:
package ee.tuleva.onboarding.config;
import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class DigiDocConfiguration {
@Bean
@Profile({"production", "staging"})
public org.digidoc4j.Configuration digiDocConfigProd() {
return new org.digidoc4j.Configuration(PROD);
}
@Bean
@ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
public org.digidoc4j.Configuration digiDocConfigDev() {
// use PROD for testing signing
return new org.digidoc4j.Configuration(TEST);
}
}
| package ee.tuleva.onboarding.config;
import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
public class DigiDocConfiguration {
@Bean
- @Profile("production")
+ @Profile({"production", "staging"})
? + ++++++++++++
public org.digidoc4j.Configuration digiDocConfigProd() {
return new org.digidoc4j.Configuration(PROD);
}
@Bean
@ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
public org.digidoc4j.Configuration digiDocConfigDev() {
// use PROD for testing signing
return new org.digidoc4j.Configuration(TEST);
}
} | 2 | 0.076923 | 1 | 1 |
9143f8d7bf047ddaa85891357b835a9895ce3e7e | lib/gem_ext.rb | lib/gem_ext.rb | require 'lib/gem_ext/doorkeeper/application.rb'
require 'lib/gem_ext/doorkeeper/server'
| require_relative './gem_ext/doorkeeper/application.rb'
require_relative './gem_ext/doorkeeper/server'
| Fix mri load path issue | Fix mri load path issue
| Ruby | apache-2.0 | camallen/Panoptes,marten/Panoptes,srallen/Panoptes,rogerhutchings/Panoptes,astopy/Panoptes,zooniverse/Panoptes,parrish/Panoptes,astopy/Panoptes,edpaget/Panoptes,edpaget/Panoptes,parrish/Panoptes,parrish/Panoptes,rogerhutchings/Panoptes,astopy/Panoptes,srallen/Panoptes,parrish/Panoptes,edpaget/Panoptes,rogerhutchings/Panoptes,camallen/Panoptes,camallen/Panoptes,zooniverse/Panoptes,rogerhutchings/Panoptes,marten/Panoptes,edpaget/Panoptes,zooniverse/Panoptes,camallen/Panoptes,astopy/Panoptes,srallen/Panoptes,marten/Panoptes,zooniverse/Panoptes,srallen/Panoptes,marten/Panoptes | ruby | ## Code Before:
require 'lib/gem_ext/doorkeeper/application.rb'
require 'lib/gem_ext/doorkeeper/server'
## Instruction:
Fix mri load path issue
## Code After:
require_relative './gem_ext/doorkeeper/application.rb'
require_relative './gem_ext/doorkeeper/server'
| - require 'lib/gem_ext/doorkeeper/application.rb'
? ^^^
+ require_relative './gem_ext/doorkeeper/application.rb'
? +++++++++ ^
- require 'lib/gem_ext/doorkeeper/server'
? ^^^
+ require_relative './gem_ext/doorkeeper/server'
? +++++++++ ^
| 4 | 2 | 2 | 2 |
6be2ddc7ca1cbe681a894bf4ddb1820a718d6347 | tools/makegraph.sh | tools/makegraph.sh |
dot -v -Tpng $1.gv > $1.png && eog $1.png
|
dot -v -Gdpi=300 -Tpng $1.gv > $1.png && eog $1.png
| Modify image resolution in graph generation script. | Modify image resolution in graph generation script.
| Shell | mit | samuelz/tiny-grep,grawies/tiny-grep | shell | ## Code Before:
dot -v -Tpng $1.gv > $1.png && eog $1.png
## Instruction:
Modify image resolution in graph generation script.
## Code After:
dot -v -Gdpi=300 -Tpng $1.gv > $1.png && eog $1.png
|
- dot -v -Tpng $1.gv > $1.png && eog $1.png
+ dot -v -Gdpi=300 -Tpng $1.gv > $1.png && eog $1.png
? ++++++++++
| 2 | 1 | 1 | 1 |
b425e473e309f889a0a98a66d488c6af64a4c956 | .travis.yml | .travis.yml | language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
script: phpunit
| language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
env:
matrix:
- DEPENDENCIES=latest
- DEPENDENCIES=oldest
install:
- >
echo;
if [ "$DEPENDENCIES" = "latest" ]; then
echo "Installing the latest dependencies";
composer update --with-dependencies --prefer-stable --prefer-dist
else
echo "Installing the lowest dependencies";
composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
fi;
composer show;
script: phpunit
| Test with both latest and oldest dependencies | [TASK] Test with both latest and oldest dependencies
This ensures that our dependency versions given in the composer.json always
provide a working set of packages.
| YAML | mit | mjaschen/collmex | yaml | ## Code Before:
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
script: phpunit
## Instruction:
[TASK] Test with both latest and oldest dependencies
This ensures that our dependency versions given in the composer.json always
provide a working set of packages.
## Code After:
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
env:
matrix:
- DEPENDENCIES=latest
- DEPENDENCIES=oldest
install:
- >
echo;
if [ "$DEPENDENCIES" = "latest" ]; then
echo "Installing the latest dependencies";
composer update --with-dependencies --prefer-stable --prefer-dist
else
echo "Installing the lowest dependencies";
composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
fi;
composer show;
script: phpunit
| language: php
php:
- - 5.5
? --
+ - 5.5
- - 5.6
? --
+ - 5.6
- - 7.0
? --
+ - 7.0
- - 7.1
? --
+ - 7.1
- before_script:
- - curl -s http://getcomposer.org/installer | php
- - php composer.phar install --dev
+ env:
+ matrix:
+ - DEPENDENCIES=latest
+ - DEPENDENCIES=oldest
+
+ install:
+ - >
+ echo;
+ if [ "$DEPENDENCIES" = "latest" ]; then
+ echo "Installing the latest dependencies";
+ composer update --with-dependencies --prefer-stable --prefer-dist
+ else
+ echo "Installing the lowest dependencies";
+ composer update --with-dependencies --prefer-stable --prefer-dist --prefer-lowest
+ fi;
+ composer show;
script: phpunit | 27 | 2.076923 | 20 | 7 |
d13b3b16f10c996e1f912825032b4efb9533c491 | examples/hydra/guild.yml | examples/hydra/guild.yml | basic-tutorial-1:
description: Pass flag values as Hydra command args
main: my_app_1 +db.driver=${driver} +db.user=${user} +db.password=${password}
flags-dest: none
flags:
driver: mysql
user: omry
password: secret
basic-tutorial-2:
description: Use a single config file with Hydra
main: my_app_2
flags-dest: config:config.yaml
flags-import: all
requires:
- config: config.yaml
target-path: .guild/sourcecode
replace-existing: yes
basic-tutorial-3:
description: Use complex Hydra config with argparse interface
main: my_app_3
flags-dest: args
flags-import: all
flags:
db:
description: DB configuration to use
choices: [mysql, postgresql]
db-config:
description: >
DB config settings for the specified db type
Specify settings using Hydra syntax, each setting separated by
a space.
Refer to the named config under 'conf' for supported config.
| basic-tutorial-1:
description: Pass flag values as Hydra command args
main: my_app_1 +db.driver=${driver} +db.user=${user} +db.password=${password}
flags-dest: none
flags:
driver: mysql
user: omry
password: secret
basic-tutorial-2:
description: Use a single config file with Hydra
main: my_app_2
flags-dest: config:config.yaml
flags-import: all
requires:
# This is required to write the config file in the source code
# path so that Hydra can find it. By default Guild writes to the
# root directory. We include replace-existing to ensure that the
# modified config replaces the source code version.
- config: config.yaml
target-path: .guild/sourcecode
replace-existing: yes
basic-tutorial-3:
description: Use complex Hydra config with argparse interface
main: my_app_3
flags-dest: args
flags-import: all
flags:
db:
description: DB configuration to use
choices: [mysql, postgresql]
db-config:
description: >
DB config settings for the specified db type
Specify settings using Hydra syntax, each setting separated by
a space.
Refer to the named config under 'conf' for supported config.
| Comment on obscure resource def for example | Comment on obscure resource def for example
| YAML | apache-2.0 | guildai/guild,guildai/guild,guildai/guild,guildai/guild | yaml | ## Code Before:
basic-tutorial-1:
description: Pass flag values as Hydra command args
main: my_app_1 +db.driver=${driver} +db.user=${user} +db.password=${password}
flags-dest: none
flags:
driver: mysql
user: omry
password: secret
basic-tutorial-2:
description: Use a single config file with Hydra
main: my_app_2
flags-dest: config:config.yaml
flags-import: all
requires:
- config: config.yaml
target-path: .guild/sourcecode
replace-existing: yes
basic-tutorial-3:
description: Use complex Hydra config with argparse interface
main: my_app_3
flags-dest: args
flags-import: all
flags:
db:
description: DB configuration to use
choices: [mysql, postgresql]
db-config:
description: >
DB config settings for the specified db type
Specify settings using Hydra syntax, each setting separated by
a space.
Refer to the named config under 'conf' for supported config.
## Instruction:
Comment on obscure resource def for example
## Code After:
basic-tutorial-1:
description: Pass flag values as Hydra command args
main: my_app_1 +db.driver=${driver} +db.user=${user} +db.password=${password}
flags-dest: none
flags:
driver: mysql
user: omry
password: secret
basic-tutorial-2:
description: Use a single config file with Hydra
main: my_app_2
flags-dest: config:config.yaml
flags-import: all
requires:
# This is required to write the config file in the source code
# path so that Hydra can find it. By default Guild writes to the
# root directory. We include replace-existing to ensure that the
# modified config replaces the source code version.
- config: config.yaml
target-path: .guild/sourcecode
replace-existing: yes
basic-tutorial-3:
description: Use complex Hydra config with argparse interface
main: my_app_3
flags-dest: args
flags-import: all
flags:
db:
description: DB configuration to use
choices: [mysql, postgresql]
db-config:
description: >
DB config settings for the specified db type
Specify settings using Hydra syntax, each setting separated by
a space.
Refer to the named config under 'conf' for supported config.
| basic-tutorial-1:
description: Pass flag values as Hydra command args
main: my_app_1 +db.driver=${driver} +db.user=${user} +db.password=${password}
flags-dest: none
flags:
driver: mysql
user: omry
password: secret
basic-tutorial-2:
description: Use a single config file with Hydra
main: my_app_2
flags-dest: config:config.yaml
flags-import: all
requires:
+ # This is required to write the config file in the source code
+ # path so that Hydra can find it. By default Guild writes to the
+ # root directory. We include replace-existing to ensure that the
+ # modified config replaces the source code version.
- config: config.yaml
target-path: .guild/sourcecode
replace-existing: yes
basic-tutorial-3:
description: Use complex Hydra config with argparse interface
main: my_app_3
flags-dest: args
flags-import: all
flags:
db:
description: DB configuration to use
choices: [mysql, postgresql]
db-config:
description: >
DB config settings for the specified db type
Specify settings using Hydra syntax, each setting separated by
a space.
Refer to the named config under 'conf' for supported config. | 4 | 0.111111 | 4 | 0 |
6c9d0a01a6a4fdda59bef42b75dd39d6d3212a33 | docs/readthedocs-pip-requirements.txt | docs/readthedocs-pip-requirements.txt | numpydoc==0.4
numpy
ipython
matplotlib
scipy
sphinx>=1.4
ipykernel
nbsphinx
numba
pyganja
| ipython
matplotlib
sphinx>=1.4
ipykernel
nbsphinx
pyganja
| Remove dependencies implied by setup.py | Remove dependencies implied by setup.py
| Text | bsd-3-clause | arsenovic/clifford,arsenovic/clifford | text | ## Code Before:
numpydoc==0.4
numpy
ipython
matplotlib
scipy
sphinx>=1.4
ipykernel
nbsphinx
numba
pyganja
## Instruction:
Remove dependencies implied by setup.py
## Code After:
ipython
matplotlib
sphinx>=1.4
ipykernel
nbsphinx
pyganja
| - numpydoc==0.4
- numpy
ipython
matplotlib
- scipy
sphinx>=1.4
ipykernel
nbsphinx
- numba
pyganja | 4 | 0.4 | 0 | 4 |
93a0d9618dcab4c1915105ad42c5cfed77afa798 | lib/sandbox_formulary.rb | lib/sandbox_formulary.rb | class Formulary
class << self
alias_method :original_factory, :factory
end
def self.factory(ref)
path = nil
repo = Repository.all.detect { |repo| path = repo.find_formula ref }
original_factory(path.nil? ? ref : File.join(repo.path, path))
end
end
| class Formulary
class << self
alias_method :original_factory, :factory
end
def self.factory(ref)
path = nil
repo = Repository.all.detect do |repo|
repo.extend RepositoryImport
path = repo.find_formula ref
end
original_factory(path.nil? ? ref : File.join(repo.path, path))
end
end
| Fix sandboxed Formulary to use RepositoryImport | Fix sandboxed Formulary to use RepositoryImport
| Ruby | bsd-3-clause | koraktor/braumeister.org,koraktor/braumeister.org,koraktor/braumeister.org,DJHartley/braumeister.org,AICIDNN/braumeister.org,AICIDNN/braumeister.org,DJHartley/braumeister.org,AICIDNN/braumeister.org,DJHartley/braumeister.org,koraktor/braumeister.org | ruby | ## Code Before:
class Formulary
class << self
alias_method :original_factory, :factory
end
def self.factory(ref)
path = nil
repo = Repository.all.detect { |repo| path = repo.find_formula ref }
original_factory(path.nil? ? ref : File.join(repo.path, path))
end
end
## Instruction:
Fix sandboxed Formulary to use RepositoryImport
## Code After:
class Formulary
class << self
alias_method :original_factory, :factory
end
def self.factory(ref)
path = nil
repo = Repository.all.detect do |repo|
repo.extend RepositoryImport
path = repo.find_formula ref
end
original_factory(path.nil? ? ref : File.join(repo.path, path))
end
end
| class Formulary
class << self
alias_method :original_factory, :factory
end
def self.factory(ref)
path = nil
- repo = Repository.all.detect { |repo| path = repo.find_formula ref }
+ repo = Repository.all.detect do |repo|
+ repo.extend RepositoryImport
+ path = repo.find_formula ref
+ end
original_factory(path.nil? ? ref : File.join(repo.path, path))
end
end | 5 | 0.384615 | 4 | 1 |
d771ee933fee0e550824d949521ece73e8e441f5 | src/js/map.js | src/js/map.js | import THREE from 'three';
const maps = {
minimal( scene ) {
const geometry = new THREE.IcosahedronGeometry( 1, 2 );
const material = new THREE.MeshPhongMaterial({
shading: THREE.FlatShading
});
const mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, 0, -8 );
scene.add( mesh );
const light = new THREE.PointLight();
light.position.set( 8, 8, 8 );
scene.add( light );
scene.add( new THREE.HemisphereLight( '#f43', '#33a', 0.5 ) );
}
};
export default function createMap( scene, name ) {
maps[ name ]( scene );
}
| import THREE from 'three';
function createAsteroidMesh( x, y, z, radius ) {
const geometry = new THREE.IcosahedronGeometry( radius, 2 );
const material = new THREE.MeshPhongMaterial({
shading: THREE.FlatShading
});
const mesh = new THREE.Mesh( geometry, material );
mesh.position.set( x, y, z );
return mesh;
}
function createAsteroidMeshes( asteroids ) {
return asteroids.map( asteroid => createAsteroidMesh( ...asteroid ) );
}
const maps = {
minimal( scene ) {
const meshes = createAsteroidMeshes([
[ 0, 0, -8, 1 ],
[ 4, -2, -4, 2 ]
]);
scene.add( ...meshes );
const light = new THREE.PointLight();
light.position.set( 8, 8, 8 );
scene.add( light );
scene.add( new THREE.HemisphereLight( '#f43', '#33a', 0.5 ) );
}
};
export default function createMap( scene, name ) {
maps[ name ]( scene );
}
| Generalize test scene geometry generation. | Generalize test scene geometry generation.
| JavaScript | mit | razh/flying-machines,razh/flying-machines | javascript | ## Code Before:
import THREE from 'three';
const maps = {
minimal( scene ) {
const geometry = new THREE.IcosahedronGeometry( 1, 2 );
const material = new THREE.MeshPhongMaterial({
shading: THREE.FlatShading
});
const mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, 0, -8 );
scene.add( mesh );
const light = new THREE.PointLight();
light.position.set( 8, 8, 8 );
scene.add( light );
scene.add( new THREE.HemisphereLight( '#f43', '#33a', 0.5 ) );
}
};
export default function createMap( scene, name ) {
maps[ name ]( scene );
}
## Instruction:
Generalize test scene geometry generation.
## Code After:
import THREE from 'three';
function createAsteroidMesh( x, y, z, radius ) {
const geometry = new THREE.IcosahedronGeometry( radius, 2 );
const material = new THREE.MeshPhongMaterial({
shading: THREE.FlatShading
});
const mesh = new THREE.Mesh( geometry, material );
mesh.position.set( x, y, z );
return mesh;
}
function createAsteroidMeshes( asteroids ) {
return asteroids.map( asteroid => createAsteroidMesh( ...asteroid ) );
}
const maps = {
minimal( scene ) {
const meshes = createAsteroidMeshes([
[ 0, 0, -8, 1 ],
[ 4, -2, -4, 2 ]
]);
scene.add( ...meshes );
const light = new THREE.PointLight();
light.position.set( 8, 8, 8 );
scene.add( light );
scene.add( new THREE.HemisphereLight( '#f43', '#33a', 0.5 ) );
}
};
export default function createMap( scene, name ) {
maps[ name ]( scene );
}
| import THREE from 'three';
+
+ function createAsteroidMesh( x, y, z, radius ) {
+ const geometry = new THREE.IcosahedronGeometry( radius, 2 );
+ const material = new THREE.MeshPhongMaterial({
+ shading: THREE.FlatShading
+ });
+
+ const mesh = new THREE.Mesh( geometry, material );
+ mesh.position.set( x, y, z );
+ return mesh;
+ }
+
+ function createAsteroidMeshes( asteroids ) {
+ return asteroids.map( asteroid => createAsteroidMesh( ...asteroid ) );
+ }
const maps = {
minimal( scene ) {
- const geometry = new THREE.IcosahedronGeometry( 1, 2 );
- const material = new THREE.MeshPhongMaterial({
- shading: THREE.FlatShading
+ const meshes = createAsteroidMeshes([
+ [ 0, 0, -8, 1 ],
+ [ 4, -2, -4, 2 ]
- });
? ^
+ ]);
? ^
- const mesh = new THREE.Mesh( geometry, material );
- mesh.position.set( 0, 0, -8 );
- scene.add( mesh );
+ scene.add( ...meshes );
? +++ ++
const light = new THREE.PointLight();
light.position.set( 8, 8, 8 );
scene.add( light );
scene.add( new THREE.HemisphereLight( '#f43', '#33a', 0.5 ) );
}
};
export default function createMap( scene, name ) {
maps[ name ]( scene );
} | 27 | 1.125 | 20 | 7 |
e7e7950a3f80e12436da91ffddca347a6cc1b5b0 | modules/fonts/install-hack.sh | modules/fonts/install-hack.sh |
HACK_RELEASES='https://github.com/chrissimpkins/Hack/releases/download/'
HACK_VERSION='v2.018/Hack-v2_018-ttf.zip'
HACK_URL=${HACK_RELEASES}${HACK_VERSION}
TEMP=`mktemp`
curl -L -o "${TEMP}" "${HACK_URL}"
if [ -d ~/Library/Fonts ]; then
unzip -o "${TEMP}" -d ~/Library/Fonts/
fi
if [ -d ~/.local/share/fonts ]; then
unzip -o "${TEMP}" -d ~/.local/share/fonts/
fi
rm "${TEMP}"
|
HACK_RELEASES='https://github.com/chrissimpkins/Hack/releases/download/'
HACK_VERSION='v2.018/Hack-v2_018-ttf.zip'
HACK_URL=${HACK_RELEASES}${HACK_VERSION}
TEMP=`mktemp`
curl -L -o "${TEMP}" "${HACK_URL}"
# OSX
if [ -d ~/Library/Fonts ]; then
unzip -o "${TEMP}" -d ~/Library/Fonts/
else
# Linux
if [ -d /usr/share/fonts ]; then
mkdir -p ~/.fonts/typetype/hack
unzip -o "${TEMP}" -d ~/.fonts/typetype/hack
fi
fi
rm "${TEMP}"
| Install on Linux when ~/.local/share/fonts does not exist | [fonts] Install on Linux when ~/.local/share/fonts does not exist
Fixes #44
| Shell | mit | Tyriar/dotfiles,Tyriar/dotfiles,Tyriar/dotfiles,Tyriar/tyr-tools,Tyriar/tyr-tools | shell | ## Code Before:
HACK_RELEASES='https://github.com/chrissimpkins/Hack/releases/download/'
HACK_VERSION='v2.018/Hack-v2_018-ttf.zip'
HACK_URL=${HACK_RELEASES}${HACK_VERSION}
TEMP=`mktemp`
curl -L -o "${TEMP}" "${HACK_URL}"
if [ -d ~/Library/Fonts ]; then
unzip -o "${TEMP}" -d ~/Library/Fonts/
fi
if [ -d ~/.local/share/fonts ]; then
unzip -o "${TEMP}" -d ~/.local/share/fonts/
fi
rm "${TEMP}"
## Instruction:
[fonts] Install on Linux when ~/.local/share/fonts does not exist
Fixes #44
## Code After:
HACK_RELEASES='https://github.com/chrissimpkins/Hack/releases/download/'
HACK_VERSION='v2.018/Hack-v2_018-ttf.zip'
HACK_URL=${HACK_RELEASES}${HACK_VERSION}
TEMP=`mktemp`
curl -L -o "${TEMP}" "${HACK_URL}"
# OSX
if [ -d ~/Library/Fonts ]; then
unzip -o "${TEMP}" -d ~/Library/Fonts/
else
# Linux
if [ -d /usr/share/fonts ]; then
mkdir -p ~/.fonts/typetype/hack
unzip -o "${TEMP}" -d ~/.fonts/typetype/hack
fi
fi
rm "${TEMP}"
|
HACK_RELEASES='https://github.com/chrissimpkins/Hack/releases/download/'
HACK_VERSION='v2.018/Hack-v2_018-ttf.zip'
HACK_URL=${HACK_RELEASES}${HACK_VERSION}
TEMP=`mktemp`
curl -L -o "${TEMP}" "${HACK_URL}"
+ # OSX
if [ -d ~/Library/Fonts ]; then
unzip -o "${TEMP}" -d ~/Library/Fonts/
- fi
+ else
+ # Linux
- if [ -d ~/.local/share/fonts ]; then
? - ^^^^^^
+ if [ -d /usr/share/fonts ]; then
? ++ ^^^
- unzip -o "${TEMP}" -d ~/.local/share/fonts/
+ mkdir -p ~/.fonts/typetype/hack
+ unzip -o "${TEMP}" -d ~/.fonts/typetype/hack
+ fi
fi
rm "${TEMP}" | 10 | 0.769231 | 7 | 3 |
8a6d7f17004bb95dacaab4608eb1d1e0d1f8538a | app/Traits/UsernameMentions.php | app/Traits/UsernameMentions.php | <?php
namespace App\Traits;
use App\Notifications\UsernameMentioned;
use App\User;
use Auth;
trait UsernameMentions
{
/**
* Handles all the mentions in the comment. (sends notifications to mentioned usernames).
*
* @param \App\Comment $comment
* @param \App\Submission $submission
* @param \App\User $notifiableUser
*
* @return void
*/
protected function handleMentions($comment, $submission, $notifiableUser = null)
{
if (!preg_match_all('/@([A-Za-z0-9\._]+)/', $comment->body, $mentionedUsernames)) {
return;
}
foreach ($mentionedUsernames[1] as $key => $username) {
// set a limit so they can't just mention the whole website!
if ($key === 5) {
return;
}
if ($user = User::whereUsername($username)->first()) {
if ($notifiableUser->id === $user->id) {
continue;
}
$user->notify(new UsernameMentioned(Auth::user(), $submission));
}
}
}
}
| <?php
namespace App\Traits;
use App\Notifications\UsernameMentioned;
use App\User;
use Auth;
trait UsernameMentions
{
/**
* Handles all the mentions in the comment. (sends notifications to mentioned usernames).
*
* @param \App\Comment $comment
* @param \App\Submission $submission
* @param \App\User $notifiableUser
*
* @return void
*/
protected function handleMentions($comment, $submission, $notifiableUser = null)
{
if (!preg_match_all('/@([A-Za-z0-9\._]+)/', $comment->body, $mentionedUsernames)) {
return;
}
foreach ($mentionedUsernames[1] as $key => $username) {
// set a limit so they can't just mention the whole website!
if ($key === 5) {
return;
}
if ($user = User::whereUsername($username)->first()) {
if (optional($notifiableUser)->id === $user->id) {
continue;
}
$user->notify(new UsernameMentioned(Auth::user(), $submission));
}
}
}
}
| Fix "Trying to get property of non-object" when mentioning at your own submission | Fix "Trying to get property of non-object" when mentioning at your own submission
| PHP | apache-2.0 | voten-co/voten,voten-co/voten,voten-co/voten | php | ## Code Before:
<?php
namespace App\Traits;
use App\Notifications\UsernameMentioned;
use App\User;
use Auth;
trait UsernameMentions
{
/**
* Handles all the mentions in the comment. (sends notifications to mentioned usernames).
*
* @param \App\Comment $comment
* @param \App\Submission $submission
* @param \App\User $notifiableUser
*
* @return void
*/
protected function handleMentions($comment, $submission, $notifiableUser = null)
{
if (!preg_match_all('/@([A-Za-z0-9\._]+)/', $comment->body, $mentionedUsernames)) {
return;
}
foreach ($mentionedUsernames[1] as $key => $username) {
// set a limit so they can't just mention the whole website!
if ($key === 5) {
return;
}
if ($user = User::whereUsername($username)->first()) {
if ($notifiableUser->id === $user->id) {
continue;
}
$user->notify(new UsernameMentioned(Auth::user(), $submission));
}
}
}
}
## Instruction:
Fix "Trying to get property of non-object" when mentioning at your own submission
## Code After:
<?php
namespace App\Traits;
use App\Notifications\UsernameMentioned;
use App\User;
use Auth;
trait UsernameMentions
{
/**
* Handles all the mentions in the comment. (sends notifications to mentioned usernames).
*
* @param \App\Comment $comment
* @param \App\Submission $submission
* @param \App\User $notifiableUser
*
* @return void
*/
protected function handleMentions($comment, $submission, $notifiableUser = null)
{
if (!preg_match_all('/@([A-Za-z0-9\._]+)/', $comment->body, $mentionedUsernames)) {
return;
}
foreach ($mentionedUsernames[1] as $key => $username) {
// set a limit so they can't just mention the whole website!
if ($key === 5) {
return;
}
if ($user = User::whereUsername($username)->first()) {
if (optional($notifiableUser)->id === $user->id) {
continue;
}
$user->notify(new UsernameMentioned(Auth::user(), $submission));
}
}
}
}
| <?php
namespace App\Traits;
use App\Notifications\UsernameMentioned;
use App\User;
use Auth;
trait UsernameMentions
{
/**
* Handles all the mentions in the comment. (sends notifications to mentioned usernames).
*
* @param \App\Comment $comment
* @param \App\Submission $submission
* @param \App\User $notifiableUser
*
* @return void
*/
protected function handleMentions($comment, $submission, $notifiableUser = null)
{
if (!preg_match_all('/@([A-Za-z0-9\._]+)/', $comment->body, $mentionedUsernames)) {
return;
}
foreach ($mentionedUsernames[1] as $key => $username) {
// set a limit so they can't just mention the whole website!
if ($key === 5) {
return;
}
if ($user = User::whereUsername($username)->first()) {
- if ($notifiableUser->id === $user->id) {
+ if (optional($notifiableUser)->id === $user->id) {
? +++++++++ +
continue;
}
$user->notify(new UsernameMentioned(Auth::user(), $submission));
}
}
}
} | 2 | 0.04878 | 1 | 1 |
6684ffd77a7f61074d5ef709eb091a971dcf984e | lib/cowboy/fft.rb | lib/cowboy/fft.rb | module Cowboy
def Cowboy::fft(arr, w=Hamming, n=29)
if !w.nil?
window = w.new(n)
input = window.convolve(arr)
fft_1d(input)
else
fft_1d(arr)
end
end
end
| module Cowboy
class Frequencies
attr_reader :dc, :unshifted, :freq
def initialize(unshifted_array)
@unshifted = unshifted_array
@dc = unshifted_array[0].real
n = unshifted_array.size
@freq = []
for i in (n/2...n)
@freq << unshifted_array[i].abs
end
for i in (0...n/2)
@freq << unshifted_array[i].abs
end
end
def buckets(sample_rate=nil)
sample_rate ||= @freq.size
nyquist = sample_rate/2
a = []
n = @freq.size
for i in (0..n)
a << -nyquist + (2 * nyquist/n) * i
end
return a
end
end
def Cowboy::fft(arr, w=Hamming, n=29)
if !w.nil?
window = w.new(n)
input = window.convolve(arr)
fft_1d(input)
else
fft_1d(arr)
end
end
end
| Add frequencies class to do shift and include frequency buckets. | Add frequencies class to do shift and include frequency buckets.
| Ruby | mit | ciniglio/cowboy,ciniglio/cowboy | ruby | ## Code Before:
module Cowboy
def Cowboy::fft(arr, w=Hamming, n=29)
if !w.nil?
window = w.new(n)
input = window.convolve(arr)
fft_1d(input)
else
fft_1d(arr)
end
end
end
## Instruction:
Add frequencies class to do shift and include frequency buckets.
## Code After:
module Cowboy
class Frequencies
attr_reader :dc, :unshifted, :freq
def initialize(unshifted_array)
@unshifted = unshifted_array
@dc = unshifted_array[0].real
n = unshifted_array.size
@freq = []
for i in (n/2...n)
@freq << unshifted_array[i].abs
end
for i in (0...n/2)
@freq << unshifted_array[i].abs
end
end
def buckets(sample_rate=nil)
sample_rate ||= @freq.size
nyquist = sample_rate/2
a = []
n = @freq.size
for i in (0..n)
a << -nyquist + (2 * nyquist/n) * i
end
return a
end
end
def Cowboy::fft(arr, w=Hamming, n=29)
if !w.nil?
window = w.new(n)
input = window.convolve(arr)
fft_1d(input)
else
fft_1d(arr)
end
end
end
| module Cowboy
+ class Frequencies
+ attr_reader :dc, :unshifted, :freq
+
+ def initialize(unshifted_array)
+ @unshifted = unshifted_array
+ @dc = unshifted_array[0].real
+ n = unshifted_array.size
+ @freq = []
+ for i in (n/2...n)
+ @freq << unshifted_array[i].abs
+ end
+ for i in (0...n/2)
+ @freq << unshifted_array[i].abs
+ end
+ end
+
+ def buckets(sample_rate=nil)
+ sample_rate ||= @freq.size
+ nyquist = sample_rate/2
+ a = []
+ n = @freq.size
+ for i in (0..n)
+ a << -nyquist + (2 * nyquist/n) * i
+ end
+ return a
+ end
+ end
+
def Cowboy::fft(arr, w=Hamming, n=29)
if !w.nil?
window = w.new(n)
input = window.convolve(arr)
fft_1d(input)
else
fft_1d(arr)
end
end
end | 28 | 2.545455 | 28 | 0 |
60833abd3b466c36a8a355a68dfe67d196076ced | mistral/family.cmake | mistral/family.cmake | set(MISTRAL_ROOT "" CACHE STRING "Mistral install path")
set(MISTRAL_DONT_INSTALL ON)
add_subdirectory(${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral)
find_package(LibLZMA REQUIRED)
foreach(family_target ${family_targets})
target_include_directories(${family_target} PRIVATE ${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(${family_target} PRIVATE mistral ${LIBLZMA_LIBRARIES})
# Currently required to avoid issues with mistral (LTO means the warnings can end up in nextpnr)
target_link_options(${family_target} PRIVATE -Wno-maybe-uninitialized -Wno-uninitialized -Wno-unknown-warning-option)
endforeach()
| set(MISTRAL_ROOT "" CACHE STRING "Mistral install path")
set(MISTRAL_DONT_INSTALL ON)
add_subdirectory(${MISTRAL_ROOT}/routes-to-bin ${CMAKE_CURRENT_BINARY_DIR}/routes-to-bin)
add_subdirectory(${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral)
find_package(LibLZMA REQUIRED)
foreach(family_target ${family_targets})
target_include_directories(${family_target} PRIVATE ${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(${family_target} PRIVATE mistral ${LIBLZMA_LIBRARIES})
# Currently required to avoid issues with mistral (LTO means the warnings can end up in nextpnr)
target_link_options(${family_target} PRIVATE -Wno-maybe-uninitialized -Wno-uninitialized -Wno-unknown-warning-option)
endforeach()
| Support the new routes-to-bin intermediate tool generation | mistral: Support the new routes-to-bin intermediate tool generation
| CMake | isc | YosysHQ/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr | cmake | ## Code Before:
set(MISTRAL_ROOT "" CACHE STRING "Mistral install path")
set(MISTRAL_DONT_INSTALL ON)
add_subdirectory(${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral)
find_package(LibLZMA REQUIRED)
foreach(family_target ${family_targets})
target_include_directories(${family_target} PRIVATE ${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(${family_target} PRIVATE mistral ${LIBLZMA_LIBRARIES})
# Currently required to avoid issues with mistral (LTO means the warnings can end up in nextpnr)
target_link_options(${family_target} PRIVATE -Wno-maybe-uninitialized -Wno-uninitialized -Wno-unknown-warning-option)
endforeach()
## Instruction:
mistral: Support the new routes-to-bin intermediate tool generation
## Code After:
set(MISTRAL_ROOT "" CACHE STRING "Mistral install path")
set(MISTRAL_DONT_INSTALL ON)
add_subdirectory(${MISTRAL_ROOT}/routes-to-bin ${CMAKE_CURRENT_BINARY_DIR}/routes-to-bin)
add_subdirectory(${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral)
find_package(LibLZMA REQUIRED)
foreach(family_target ${family_targets})
target_include_directories(${family_target} PRIVATE ${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(${family_target} PRIVATE mistral ${LIBLZMA_LIBRARIES})
# Currently required to avoid issues with mistral (LTO means the warnings can end up in nextpnr)
target_link_options(${family_target} PRIVATE -Wno-maybe-uninitialized -Wno-uninitialized -Wno-unknown-warning-option)
endforeach()
| set(MISTRAL_ROOT "" CACHE STRING "Mistral install path")
set(MISTRAL_DONT_INSTALL ON)
+ add_subdirectory(${MISTRAL_ROOT}/routes-to-bin ${CMAKE_CURRENT_BINARY_DIR}/routes-to-bin)
add_subdirectory(${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral)
find_package(LibLZMA REQUIRED)
foreach(family_target ${family_targets})
target_include_directories(${family_target} PRIVATE ${MISTRAL_ROOT}/libmistral ${CMAKE_CURRENT_BINARY_DIR}/libmistral ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(${family_target} PRIVATE mistral ${LIBLZMA_LIBRARIES})
# Currently required to avoid issues with mistral (LTO means the warnings can end up in nextpnr)
target_link_options(${family_target} PRIVATE -Wno-maybe-uninitialized -Wno-uninitialized -Wno-unknown-warning-option)
endforeach() | 1 | 0.076923 | 1 | 0 |
f0fb4e2c9edbbe8abd31b1b71de00c9fe1a8042d | lib/money-rails/money.rb | lib/money-rails/money.rb | require "active_support/core_ext/module/aliasing.rb"
require "active_support/core_ext/hash/reverse_merge.rb"
class Money
def format_with_settings(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
defaults = {
no_cents_if_whole: MoneyRails::Configuration.no_cents_if_whole,
symbol: MoneyRails::Configuration.symbol,
sign_before_symbol: MoneyRails::Configuration.sign_before_symbol
}.reject { |_k, v| v.nil? }
rules.reverse_merge!(defaults)
unless MoneyRails::Configuration.default_format.nil?
rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
format_without_settings(rules)
end
alias_method_chain :format, :settings
end
| require "active_support/core_ext/module/aliasing.rb"
require "active_support/core_ext/hash/reverse_merge.rb"
class Money
alias_method :orig_format, :format
def format(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
defaults = {
no_cents_if_whole: MoneyRails::Configuration.no_cents_if_whole,
symbol: MoneyRails::Configuration.symbol,
sign_before_symbol: MoneyRails::Configuration.sign_before_symbol
}.reject { |_k, v| v.nil? }
rules.reverse_merge!(defaults)
unless MoneyRails::Configuration.default_format.nil?
rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
orig_format(rules)
end
end
| Use alias_method instead of alias_method_chain | Use alias_method instead of alias_method_chain
| Ruby | mit | antstorm/money-rails,Nghi93/money-rails,RubyMoney/money-rails,Nghi93/money-rails,BookBub/money-rails,BookBub/money-rails,antstorm/money-rails,RubyMoney/money-rails,Nghi93/money-rails,BookBub/money-rails,antstorm/money-rails,RubyMoney/money-rails | ruby | ## Code Before:
require "active_support/core_ext/module/aliasing.rb"
require "active_support/core_ext/hash/reverse_merge.rb"
class Money
def format_with_settings(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
defaults = {
no_cents_if_whole: MoneyRails::Configuration.no_cents_if_whole,
symbol: MoneyRails::Configuration.symbol,
sign_before_symbol: MoneyRails::Configuration.sign_before_symbol
}.reject { |_k, v| v.nil? }
rules.reverse_merge!(defaults)
unless MoneyRails::Configuration.default_format.nil?
rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
format_without_settings(rules)
end
alias_method_chain :format, :settings
end
## Instruction:
Use alias_method instead of alias_method_chain
## Code After:
require "active_support/core_ext/module/aliasing.rb"
require "active_support/core_ext/hash/reverse_merge.rb"
class Money
alias_method :orig_format, :format
def format(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
defaults = {
no_cents_if_whole: MoneyRails::Configuration.no_cents_if_whole,
symbol: MoneyRails::Configuration.symbol,
sign_before_symbol: MoneyRails::Configuration.sign_before_symbol
}.reject { |_k, v| v.nil? }
rules.reverse_merge!(defaults)
unless MoneyRails::Configuration.default_format.nil?
rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
orig_format(rules)
end
end
| require "active_support/core_ext/module/aliasing.rb"
require "active_support/core_ext/hash/reverse_merge.rb"
class Money
+ alias_method :orig_format, :format
- def format_with_settings(*rules)
+ def format(*rules)
rules = normalize_formatting_rules(rules)
# Apply global defaults for money only for non-nil values
defaults = {
no_cents_if_whole: MoneyRails::Configuration.no_cents_if_whole,
symbol: MoneyRails::Configuration.symbol,
sign_before_symbol: MoneyRails::Configuration.sign_before_symbol
}.reject { |_k, v| v.nil? }
rules.reverse_merge!(defaults)
unless MoneyRails::Configuration.default_format.nil?
rules.reverse_merge!(MoneyRails::Configuration.default_format)
end
- format_without_settings(rules)
+ orig_format(rules)
end
- alias_method_chain :format, :settings
-
end | 7 | 0.259259 | 3 | 4 |
9eef192123837a5258ecac1018bec41a908b9890 | src/client/utils/colors.js | src/client/utils/colors.js | /**
* Convert a color hex to an rgb value
*
* Note that this currently only works with 6 digit hexes.
*/
export const hexToRgb = (colorHex) => {
const colorValue = parseInt(colorHex.replace('#', ''), 16)
return [
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255,
].join()
}
/**
* Convert a color hex and alpha to an rgba value
*
* Note that this currently only works with 6 digit hexes.
*/
export const rgba = (colorHex, alpha) => `rgba(${hexToRgb(colorHex)},${alpha})`
// The following colours are not included in either:
// - https://github.com/penx/govuk-colours or
// - https://github.com/govuk-react/govuk-react (which references govuk-colours)
// Instead, the colours have been taken from:
// - https://github.com/alphagov/govuk-frontend (referenced by GOV.UK Design System)
export const DARK_GREY = '#505a5f'
export const MID_GREY = '#b1b4b6'
export const FOCUS_COLOUR = '#ffdd00'
| /**
* Convert a color hex to an rgb value
*
* Note that this currently only works with 6 digit hexes.
*/
export const hexToRgb = (colorHex) => {
const colorValue = parseInt(colorHex.replace('#', ''), 16)
return [
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255,
].join()
}
/**
* Convert a color hex and alpha to an rgba value
*
* Note that this currently only works with 6 digit hexes.
*/
export const rgba = (colorHex, alpha) => `rgba(${hexToRgb(colorHex)},${alpha})`
// The following colours are not included in either:
// - https://github.com/penx/govuk-colours or
// - https://github.com/govuk-react/govuk-react (which references govuk-colours)
// Instead, the colours below have been taken from:
// - https://github.com/alphagov/govuk-frontend (referenced by GOV.UK Design System)
// Taken from the legacy palette, we're unable to choose a colour
// from the modern palette as it's either too light or too dark
// for the Data Hub header nav element which sits in between a
// darker and lighter shade of grey forming a natural gradient.
export const LIGHT_GREY = '#dee0e2'
// We require this specific blue for the navigation hover/selection.
// This blue has to match the colour of both 'Find Exporters' and 'Market Access'.
export const DARK_BLUE = '#005ea5'
export const DARK_GREY = '#505a5f'
export const MID_GREY = '#b1b4b6'
export const FOCUS_COLOUR = '#ffdd00'
| Add Data Hub header colours | Add Data Hub header colours
| JavaScript | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | javascript | ## Code Before:
/**
* Convert a color hex to an rgb value
*
* Note that this currently only works with 6 digit hexes.
*/
export const hexToRgb = (colorHex) => {
const colorValue = parseInt(colorHex.replace('#', ''), 16)
return [
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255,
].join()
}
/**
* Convert a color hex and alpha to an rgba value
*
* Note that this currently only works with 6 digit hexes.
*/
export const rgba = (colorHex, alpha) => `rgba(${hexToRgb(colorHex)},${alpha})`
// The following colours are not included in either:
// - https://github.com/penx/govuk-colours or
// - https://github.com/govuk-react/govuk-react (which references govuk-colours)
// Instead, the colours have been taken from:
// - https://github.com/alphagov/govuk-frontend (referenced by GOV.UK Design System)
export const DARK_GREY = '#505a5f'
export const MID_GREY = '#b1b4b6'
export const FOCUS_COLOUR = '#ffdd00'
## Instruction:
Add Data Hub header colours
## Code After:
/**
* Convert a color hex to an rgb value
*
* Note that this currently only works with 6 digit hexes.
*/
export const hexToRgb = (colorHex) => {
const colorValue = parseInt(colorHex.replace('#', ''), 16)
return [
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255,
].join()
}
/**
* Convert a color hex and alpha to an rgba value
*
* Note that this currently only works with 6 digit hexes.
*/
export const rgba = (colorHex, alpha) => `rgba(${hexToRgb(colorHex)},${alpha})`
// The following colours are not included in either:
// - https://github.com/penx/govuk-colours or
// - https://github.com/govuk-react/govuk-react (which references govuk-colours)
// Instead, the colours below have been taken from:
// - https://github.com/alphagov/govuk-frontend (referenced by GOV.UK Design System)
// Taken from the legacy palette, we're unable to choose a colour
// from the modern palette as it's either too light or too dark
// for the Data Hub header nav element which sits in between a
// darker and lighter shade of grey forming a natural gradient.
export const LIGHT_GREY = '#dee0e2'
// We require this specific blue for the navigation hover/selection.
// This blue has to match the colour of both 'Find Exporters' and 'Market Access'.
export const DARK_BLUE = '#005ea5'
export const DARK_GREY = '#505a5f'
export const MID_GREY = '#b1b4b6'
export const FOCUS_COLOUR = '#ffdd00'
| /**
* Convert a color hex to an rgb value
*
* Note that this currently only works with 6 digit hexes.
*/
export const hexToRgb = (colorHex) => {
const colorValue = parseInt(colorHex.replace('#', ''), 16)
return [
(colorValue >> 16) & 255,
(colorValue >> 8) & 255,
colorValue & 255,
].join()
}
/**
* Convert a color hex and alpha to an rgba value
*
* Note that this currently only works with 6 digit hexes.
*/
export const rgba = (colorHex, alpha) => `rgba(${hexToRgb(colorHex)},${alpha})`
// The following colours are not included in either:
// - https://github.com/penx/govuk-colours or
// - https://github.com/govuk-react/govuk-react (which references govuk-colours)
- // Instead, the colours have been taken from:
+ // Instead, the colours below have been taken from:
? ++++++
// - https://github.com/alphagov/govuk-frontend (referenced by GOV.UK Design System)
+
+ // Taken from the legacy palette, we're unable to choose a colour
+ // from the modern palette as it's either too light or too dark
+ // for the Data Hub header nav element which sits in between a
+ // darker and lighter shade of grey forming a natural gradient.
+ export const LIGHT_GREY = '#dee0e2'
+
+ // We require this specific blue for the navigation hover/selection.
+ // This blue has to match the colour of both 'Find Exporters' and 'Market Access'.
+ export const DARK_BLUE = '#005ea5'
+
export const DARK_GREY = '#505a5f'
export const MID_GREY = '#b1b4b6'
export const FOCUS_COLOUR = '#ffdd00' | 13 | 0.448276 | 12 | 1 |
7409ef1e9e8a0d84e11617a31a9883f519859900 | copy_pod_try.sh | copy_pod_try.sh | POD_NAME="$1"
DESTINATION_DIR="$2"
POD_TRY_OPTION="$3"
echo "Invoking 'pod try $POD_NAME'"
POD_TRY_DIR="$(pod _1.6.1_ try --verbose $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
echo "Copying contents of '$POD_TRY_DIR' into '$DESTINATION_DIR'"
cp -R $POD_TRY_DIR/* $DESTINATION_DIR/.
| POD_NAME="$1"
DESTINATION_DIR="$2"
POD_TRY_OPTION="$3"
echo "Invoking 'pod try $POD_NAME'"
POD_TRY_DIR="$(pod _1.6.1_ try $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
echo "Copying contents of '$POD_TRY_DIR' into '$DESTINATION_DIR'"
cp -R $POD_TRY_DIR/* $DESTINATION_DIR/.
| Revert "build: Add --verbose flag to pod try script." | Revert "build: Add --verbose flag to pod try script."
This reverts commit 88bde02022f5a45c489fd2edbaab9d69f6dcf62e.
| Shell | apache-2.0 | googlemaps/maps-sdk-for-ios-samples,googlemaps/maps-sdk-for-ios-samples,googlemaps/maps-sdk-for-ios-samples,googlemaps/maps-sdk-for-ios-samples | shell | ## Code Before:
POD_NAME="$1"
DESTINATION_DIR="$2"
POD_TRY_OPTION="$3"
echo "Invoking 'pod try $POD_NAME'"
POD_TRY_DIR="$(pod _1.6.1_ try --verbose $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
echo "Copying contents of '$POD_TRY_DIR' into '$DESTINATION_DIR'"
cp -R $POD_TRY_DIR/* $DESTINATION_DIR/.
## Instruction:
Revert "build: Add --verbose flag to pod try script."
This reverts commit 88bde02022f5a45c489fd2edbaab9d69f6dcf62e.
## Code After:
POD_NAME="$1"
DESTINATION_DIR="$2"
POD_TRY_OPTION="$3"
echo "Invoking 'pod try $POD_NAME'"
POD_TRY_DIR="$(pod _1.6.1_ try $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
echo "Copying contents of '$POD_TRY_DIR' into '$DESTINATION_DIR'"
cp -R $POD_TRY_DIR/* $DESTINATION_DIR/.
| POD_NAME="$1"
DESTINATION_DIR="$2"
POD_TRY_OPTION="$3"
echo "Invoking 'pod try $POD_NAME'"
- POD_TRY_DIR="$(pod _1.6.1_ try --verbose $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
? ----------
+ POD_TRY_DIR="$(pod _1.6.1_ try $POD_NAME <<< $POD_TRY_OPTION | tail -1 | awk '{print $2}' | echo "/$(cut -d\/ -f2-11)")"
echo "Copying contents of '$POD_TRY_DIR' into '$DESTINATION_DIR'"
cp -R $POD_TRY_DIR/* $DESTINATION_DIR/.
| 2 | 0.2 | 1 | 1 |
a0cc350cf1fc7fa7faf3656e05834fd0d1a3cb82 | app/controllers/questions_controller.rb | app/controllers/questions_controller.rb | class QuestionsController < ApplicationController
def index
@questions = Question.last(10)
end
def new
@question = Question.new
end
def create
params[:question][:user_id] = current_user.id
@question = Question.create(question_params)
redirect_to questions_path
end
def show
@question = Question.find_by(id: params[:id])
end
def edit
end
def update
end
def destroy
end
private
def question_params
params.require(:question).permit(:title, :description, :view_count, :user_id)
end
end
| class QuestionsController < ApplicationController
def index
@questions = Question.last(10)
end
def new
@question = Question.new
end
def create
params[:question][:user_id] = current_user.id
@question = Question.create(question_params)
redirect_to questions_path
end
def show
@question = Question.find_by(id: params[:id])
@sum = QuestionVote.joins(:vote).where('question_id =?', @question.id).sum('votes.vote_value')
end
def edit
end
def update
end
def destroy
end
private
def question_params
params.require(:question).permit(:title, :description, :view_count, :user_id)
end
end
| Add query to sum votes to question controller | Add query to sum votes to question controller
| Ruby | mit | melissawimberly/MustacheYouAQuestion,melissawimberly/MustacheYouAQuestion,melissawimberly/MustacheYouAQuestion | ruby | ## Code Before:
class QuestionsController < ApplicationController
def index
@questions = Question.last(10)
end
def new
@question = Question.new
end
def create
params[:question][:user_id] = current_user.id
@question = Question.create(question_params)
redirect_to questions_path
end
def show
@question = Question.find_by(id: params[:id])
end
def edit
end
def update
end
def destroy
end
private
def question_params
params.require(:question).permit(:title, :description, :view_count, :user_id)
end
end
## Instruction:
Add query to sum votes to question controller
## Code After:
class QuestionsController < ApplicationController
def index
@questions = Question.last(10)
end
def new
@question = Question.new
end
def create
params[:question][:user_id] = current_user.id
@question = Question.create(question_params)
redirect_to questions_path
end
def show
@question = Question.find_by(id: params[:id])
@sum = QuestionVote.joins(:vote).where('question_id =?', @question.id).sum('votes.vote_value')
end
def edit
end
def update
end
def destroy
end
private
def question_params
params.require(:question).permit(:title, :description, :view_count, :user_id)
end
end
| class QuestionsController < ApplicationController
def index
@questions = Question.last(10)
end
def new
@question = Question.new
end
def create
params[:question][:user_id] = current_user.id
@question = Question.create(question_params)
redirect_to questions_path
end
def show
@question = Question.find_by(id: params[:id])
+ @sum = QuestionVote.joins(:vote).where('question_id =?', @question.id).sum('votes.vote_value')
+
end
def edit
end
def update
end
def destroy
end
private
def question_params
params.require(:question).permit(:title, :description, :view_count, :user_id)
end
end
| 2 | 0.05 | 2 | 0 |
ce8a459a9cdfc31934cdb8dcf8a478192a8d51b7 | installers/ansible/roles/pgo-operator/files/pgo-configs/container-resources.json | installers/ansible/roles/pgo-operator/files/pgo-configs/container-resources.json | {{ if or .RequestsMemory .RequestsCPU }}
"resources": {
{{ if .RequestsCPU }}
"limits": {
"cpu": "{{.RequestsCPU}}"
},
"requests": {
{{ if .RequestsCPU }}
"cpu": "{{.RequestsCPU}}"{{ if .RequestsMemory }},{{ end }}
{{ end }}
{{ if .RequestsMemory }}
"memory": "{{.RequestsMemory}}"
{{ end }}
}
},
{{ end }}
| {{ if or .RequestsMemory .RequestsCPU }}
"resources": {
{{ if .RequestsCPU }}
"limits": {
"cpu": "{{.RequestsCPU}}"
},
{{ end }}
"requests": {
{{ if .RequestsCPU }}
"cpu": "{{.RequestsCPU}}"{{ if .RequestsMemory }},{{ end }}
{{ end }}
{{ if .RequestsMemory }}
"memory": "{{.RequestsMemory}}"
{{ end }}
}
},
{{ end }}
| Fix syntax error in installer file | Fix syntax error in installer file
This is the result of yet another misalignment between the two sets
of install configuration files for our templates, this one yet again
introduced by yours truly.
| JSON | apache-2.0 | CrunchyData/postgres-operator,CrunchyData/postgres-operator | json | ## Code Before:
{{ if or .RequestsMemory .RequestsCPU }}
"resources": {
{{ if .RequestsCPU }}
"limits": {
"cpu": "{{.RequestsCPU}}"
},
"requests": {
{{ if .RequestsCPU }}
"cpu": "{{.RequestsCPU}}"{{ if .RequestsMemory }},{{ end }}
{{ end }}
{{ if .RequestsMemory }}
"memory": "{{.RequestsMemory}}"
{{ end }}
}
},
{{ end }}
## Instruction:
Fix syntax error in installer file
This is the result of yet another misalignment between the two sets
of install configuration files for our templates, this one yet again
introduced by yours truly.
## Code After:
{{ if or .RequestsMemory .RequestsCPU }}
"resources": {
{{ if .RequestsCPU }}
"limits": {
"cpu": "{{.RequestsCPU}}"
},
{{ end }}
"requests": {
{{ if .RequestsCPU }}
"cpu": "{{.RequestsCPU}}"{{ if .RequestsMemory }},{{ end }}
{{ end }}
{{ if .RequestsMemory }}
"memory": "{{.RequestsMemory}}"
{{ end }}
}
},
{{ end }}
| {{ if or .RequestsMemory .RequestsCPU }}
"resources": {
{{ if .RequestsCPU }}
"limits": {
"cpu": "{{.RequestsCPU}}"
},
+ {{ end }}
"requests": {
{{ if .RequestsCPU }}
"cpu": "{{.RequestsCPU}}"{{ if .RequestsMemory }},{{ end }}
{{ end }}
{{ if .RequestsMemory }}
"memory": "{{.RequestsMemory}}"
{{ end }}
}
},
{{ end }} | 1 | 0.0625 | 1 | 0 |
008fdf0ddd913440161b73299eba7581dd2c2c9b | .github/workflows/history.sh | .github/workflows/history.sh | set -Eeuo pipefail
# "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs
docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
| tac \
| sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \
| awk '
# ignore the first ADD of the base image (base image changes unnecessarily break our diffs)
NR == 1 && $1 == "ADD" && $4 == "/" { next }
# TODO consider instead just removing the checksum in $3
# ignore obviously "centos" LABEL instructions (include a timestamp, so base image changes unnecessarily break our diffs)
$1 == "LABEL" && / org.opencontainers.image.vendor=CentOS | org.label-schema.vendor=CentOS / { next }
# just ignore the default CentOS CMD value (not relevant to our needs)
$0 == "CMD [\"/bin/bash\"]" { next }
# in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash"
/localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") }
# sane and sanitized, print it!
{ print }
'
| set -Eeuo pipefail
# "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs
docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
| tac \
| sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \
| gawk '
# munge the checksum of the first ADD of the base image (base image changes unnecessarily break our diffs)
NR == 1 && $1 == "ADD" && $4 == "/" { $2 = "-" }
# remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350)
$1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") }
# in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash"
/localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") }
# sane and sanitized, print it!
{ print }
'
| Remove unnecessary CentOS references and add Kibana's timestamp-ignoring code | Remove unnecessary CentOS references and add Kibana's timestamp-ignoring code
| Shell | apache-2.0 | docker-library/logstash,infosiftr/logstash | shell | ## Code Before:
set -Eeuo pipefail
# "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs
docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
| tac \
| sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \
| awk '
# ignore the first ADD of the base image (base image changes unnecessarily break our diffs)
NR == 1 && $1 == "ADD" && $4 == "/" { next }
# TODO consider instead just removing the checksum in $3
# ignore obviously "centos" LABEL instructions (include a timestamp, so base image changes unnecessarily break our diffs)
$1 == "LABEL" && / org.opencontainers.image.vendor=CentOS | org.label-schema.vendor=CentOS / { next }
# just ignore the default CentOS CMD value (not relevant to our needs)
$0 == "CMD [\"/bin/bash\"]" { next }
# in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash"
/localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") }
# sane and sanitized, print it!
{ print }
'
## Instruction:
Remove unnecessary CentOS references and add Kibana's timestamp-ignoring code
## Code After:
set -Eeuo pipefail
# "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs
docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
| tac \
| sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \
| gawk '
# munge the checksum of the first ADD of the base image (base image changes unnecessarily break our diffs)
NR == 1 && $1 == "ADD" && $4 == "/" { $2 = "-" }
# remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350)
$1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") }
# in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash"
/localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") }
# sane and sanitized, print it!
{ print }
'
| set -Eeuo pipefail
# "docker history", but ignoring/munging known problematic bits for the purposes of creating image diffs
docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
| tac \
| sed -r 's!^/bin/sh[[:space:]]+-c[[:space:]]+(#[(]nop[)][[:space:]]+)?!!' \
- | awk '
+ | gawk '
? +
- # ignore the first ADD of the base image (base image changes unnecessarily break our diffs)
? ^ ^ ^^
+ # munge the checksum of the first ADD of the base image (base image changes unnecessarily break our diffs)
? ^^^ ^^^^^^^^^^^^^^^ ^
- NR == 1 && $1 == "ADD" && $4 == "/" { next }
? ^^^^
+ NR == 1 && $1 == "ADD" && $4 == "/" { $2 = "-" }
? ^^^^^^^^
- # TODO consider instead just removing the checksum in $3
+ # remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350)
+ $1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") }
- # ignore obviously "centos" LABEL instructions (include a timestamp, so base image changes unnecessarily break our diffs)
- $1 == "LABEL" && / org.opencontainers.image.vendor=CentOS | org.label-schema.vendor=CentOS / { next }
-
- # just ignore the default CentOS CMD value (not relevant to our needs)
- $0 == "CMD [\"/bin/bash\"]" { next }
# in logstash, Elastic builds pull artifacts from "http://localhost:8000" instead of "https://artifacts.elastic.co/downloads/logstash"
/localhost:8000\/logstash/ { gsub(/http:\/\/localhost:8000\/logstash/, "https://artifacts.elastic.co/downloads/logstash/logstash") }
# sane and sanitized, print it!
{ print }
' | 14 | 0.583333 | 5 | 9 |
eb7538be926c037f189673c0d807c1409f795738 | resources/views/admin/index.blade.php | resources/views/admin/index.blade.php | @extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}</h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
<th>Updated At</th>
</tr>
<tbody>
@if(isset($items))
@foreach($items as $item)
<tr>
@foreach($fields as $f)
<td>{{ $item->$f }}</td>
@endforeach
<td>{{ $item->created_at }}</td>
<td>{{ $item->updated_at }}</td>
</tr>
@endforeach
@endif
</tbody>
</table>
@stop
| @extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}</h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
<th>Updated At</th>
<th>Actions</th>
</tr>
<tbody>
@if(isset($items))
@foreach($items as $item)
<tr>
@foreach($fields as $f)
<td>{{ $item->$f }}</td>
@endforeach
<td>{{ $item->created_at }}</td>
<td>{{ $item->updated_at }}</td>
<td><button class="btn btn-info">Edit</button> <button class="btn btn-danger">Delete</button></td>
</tr>
@endforeach
@endif
</tbody>
</table>
@stop
| Add placeholder buttons for actions (edit, delete) | Add placeholder buttons for actions (edit, delete)
| PHP | mit | taskforcedev/crud-api,taskforcedev/crud-api | php | ## Code Before:
@extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}</h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
<th>Updated At</th>
</tr>
<tbody>
@if(isset($items))
@foreach($items as $item)
<tr>
@foreach($fields as $f)
<td>{{ $item->$f }}</td>
@endforeach
<td>{{ $item->created_at }}</td>
<td>{{ $item->updated_at }}</td>
</tr>
@endforeach
@endif
</tbody>
</table>
@stop
## Instruction:
Add placeholder buttons for actions (edit, delete)
## Code After:
@extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}</h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
<th>Updated At</th>
<th>Actions</th>
</tr>
<tbody>
@if(isset($items))
@foreach($items as $item)
<tr>
@foreach($fields as $f)
<td>{{ $item->$f }}</td>
@endforeach
<td>{{ $item->created_at }}</td>
<td>{{ $item->updated_at }}</td>
<td><button class="btn btn-info">Edit</button> <button class="btn btn-danger">Delete</button></td>
</tr>
@endforeach
@endif
</tbody>
</table>
@stop
| @extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}</h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
<th>Updated At</th>
+ <th>Actions</th>
</tr>
<tbody>
@if(isset($items))
@foreach($items as $item)
<tr>
@foreach($fields as $f)
<td>{{ $item->$f }}</td>
@endforeach
<td>{{ $item->created_at }}</td>
<td>{{ $item->updated_at }}</td>
+ <td><button class="btn btn-info">Edit</button> <button class="btn btn-danger">Delete</button></td>
</tr>
@endforeach
@endif
</tbody>
</table>
@stop | 2 | 0.071429 | 2 | 0 |
25281351fb084a89ec4bc0b43b61d670fdc36658 | visual-archetype/src/main/resources/archetype-resources/client/src/main/java/Main.java | visual-archetype/src/main/resources/archetype-resources/client/src/main/java/Main.java | package ${package};
import net.java.html.boot.BrowserBuilder;
public final class Main {
private Main() {
}
public static void main(String... args) throws Exception {
BrowserBuilder.newBrowser().
loadPage("pages/index.html").
loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
System.exit(0);
}
/**
* Called when the page is ready.
*/
public static void onPageLoad() throws Exception {
DataModel.onPageLoad();
}
}
| package ${package};
import net.java.html.boot.BrowserBuilder;
public final class Main {
private Main() {
}
public static void main(String... args) throws Exception {
System.setProperty("prism.order", "sw");
BrowserBuilder.newBrowser().
loadPage("pages/index.html").
loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
System.exit(0);
}
/**
* Called when the page is ready.
*/
public static void onPageLoad() throws Exception {
DataModel.onPageLoad();
}
}
| Enforce software renderng pipeline to avoid flickering | Enforce software renderng pipeline to avoid flickering | Java | mit | dukescript/maven-archetypes,dukescript/maven-archetypes,dukescript/maven-archetypes | java | ## Code Before:
package ${package};
import net.java.html.boot.BrowserBuilder;
public final class Main {
private Main() {
}
public static void main(String... args) throws Exception {
BrowserBuilder.newBrowser().
loadPage("pages/index.html").
loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
System.exit(0);
}
/**
* Called when the page is ready.
*/
public static void onPageLoad() throws Exception {
DataModel.onPageLoad();
}
}
## Instruction:
Enforce software renderng pipeline to avoid flickering
## Code After:
package ${package};
import net.java.html.boot.BrowserBuilder;
public final class Main {
private Main() {
}
public static void main(String... args) throws Exception {
System.setProperty("prism.order", "sw");
BrowserBuilder.newBrowser().
loadPage("pages/index.html").
loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
System.exit(0);
}
/**
* Called when the page is ready.
*/
public static void onPageLoad() throws Exception {
DataModel.onPageLoad();
}
}
| package ${package};
import net.java.html.boot.BrowserBuilder;
public final class Main {
private Main() {
}
public static void main(String... args) throws Exception {
+ System.setProperty("prism.order", "sw");
BrowserBuilder.newBrowser().
loadPage("pages/index.html").
loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();
System.exit(0);
}
/**
* Called when the page is ready.
*/
public static void onPageLoad() throws Exception {
DataModel.onPageLoad();
}
} | 1 | 0.04 | 1 | 0 |
886146ac77d77e9695b895be88cfdee9b5e5eb24 | Cargo.toml | Cargo.toml | [package]
name = "fftw"
version = "0.1.0"
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "safe wrapper of FFTW3"
repository = "https://github.com/termoshtt/rust-fftw3"
keywords = ["fftw"]
license = "GPL-3.0"
[features]
default = ["source"]
system = ["fftw-sys/system"]
source = ["fftw-sys/source"]
[dependencies]
num-traits = { git = "http://github.com/rust-num/num" }
num-complex= { git = "http://github.com/rust-num/num" }
lazy_static = "0.2.2"
[dependencies.fftw-sys]
path = "fftw-sys"
# version = "0.2.0"
default-features = false
[dev-dependencies]
float-cmp = "0.2.3"
| [package]
name = "fftw"
version = "0.1.0"
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "safe wrapper of FFTW3"
repository = "https://github.com/termoshtt/rust-fftw3"
keywords = ["fftw"]
license = "GPL-3.0"
[features]
default = ["source"]
system = ["fftw-sys/system"]
source = ["fftw-sys/source"]
[dependencies]
num-traits = "0.1"
num-complex= { git = "http://github.com/rust-num/num" }
lazy_static = "0.2.2"
[dependencies.fftw-sys]
path = "fftw-sys"
# version = "0.2.0"
default-features = false
[dev-dependencies]
float-cmp = "0.2.3"
| Use num-traits v0.1 (do not use git) | Use num-traits v0.1 (do not use git)
| TOML | mit | termoshtt/rust-fftw3 | toml | ## Code Before:
[package]
name = "fftw"
version = "0.1.0"
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "safe wrapper of FFTW3"
repository = "https://github.com/termoshtt/rust-fftw3"
keywords = ["fftw"]
license = "GPL-3.0"
[features]
default = ["source"]
system = ["fftw-sys/system"]
source = ["fftw-sys/source"]
[dependencies]
num-traits = { git = "http://github.com/rust-num/num" }
num-complex= { git = "http://github.com/rust-num/num" }
lazy_static = "0.2.2"
[dependencies.fftw-sys]
path = "fftw-sys"
# version = "0.2.0"
default-features = false
[dev-dependencies]
float-cmp = "0.2.3"
## Instruction:
Use num-traits v0.1 (do not use git)
## Code After:
[package]
name = "fftw"
version = "0.1.0"
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "safe wrapper of FFTW3"
repository = "https://github.com/termoshtt/rust-fftw3"
keywords = ["fftw"]
license = "GPL-3.0"
[features]
default = ["source"]
system = ["fftw-sys/system"]
source = ["fftw-sys/source"]
[dependencies]
num-traits = "0.1"
num-complex= { git = "http://github.com/rust-num/num" }
lazy_static = "0.2.2"
[dependencies.fftw-sys]
path = "fftw-sys"
# version = "0.2.0"
default-features = false
[dev-dependencies]
float-cmp = "0.2.3"
| [package]
name = "fftw"
version = "0.1.0"
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "safe wrapper of FFTW3"
repository = "https://github.com/termoshtt/rust-fftw3"
keywords = ["fftw"]
license = "GPL-3.0"
[features]
default = ["source"]
system = ["fftw-sys/system"]
source = ["fftw-sys/source"]
[dependencies]
- num-traits = { git = "http://github.com/rust-num/num" }
+ num-traits = "0.1"
num-complex= { git = "http://github.com/rust-num/num" }
lazy_static = "0.2.2"
[dependencies.fftw-sys]
path = "fftw-sys"
# version = "0.2.0"
default-features = false
[dev-dependencies]
float-cmp = "0.2.3" | 2 | 0.074074 | 1 | 1 |
a9da3f3a71a7cc42f2e4cfa4c1f0fe0274f544b2 | _config.yml | _config.yml | title: Blog by Hilzu
email: hilzu@iki.fi
description: >
Random thoughts mostly about technology and especially about web stack.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "https://blog.hilzu.moe" # the base hostname & protocol for your site
twitter_username: ze_hilda
github_username: hilzu
permalink: pretty
# Build settings
markdown: kramdown
exclude: [vendor]
timezone: Europe/Helsinki
encoding: utf-8
| title: Blog by Hilzu
email: hilzu@iki.fi
description: >
Random thoughts mostly about technology and especially about web stack.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "https://blog.hilzu.moe" # the base hostname & protocol for your site
twitter_username: ze_hilda
github_username: hilzu
permalink: pretty
# Build settings
markdown: kramdown
exclude: [vendor]
timezone: Europe/Helsinki
encoding: utf-8
gems:
- jekyll-sitemap
| Add sitemap gem for sitemap generation | Add sitemap gem for sitemap generation
| YAML | mit | Hilzu/blog.hilzu.moe,Hilzu/blog.hilzu.moe | yaml | ## Code Before:
title: Blog by Hilzu
email: hilzu@iki.fi
description: >
Random thoughts mostly about technology and especially about web stack.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "https://blog.hilzu.moe" # the base hostname & protocol for your site
twitter_username: ze_hilda
github_username: hilzu
permalink: pretty
# Build settings
markdown: kramdown
exclude: [vendor]
timezone: Europe/Helsinki
encoding: utf-8
## Instruction:
Add sitemap gem for sitemap generation
## Code After:
title: Blog by Hilzu
email: hilzu@iki.fi
description: >
Random thoughts mostly about technology and especially about web stack.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "https://blog.hilzu.moe" # the base hostname & protocol for your site
twitter_username: ze_hilda
github_username: hilzu
permalink: pretty
# Build settings
markdown: kramdown
exclude: [vendor]
timezone: Europe/Helsinki
encoding: utf-8
gems:
- jekyll-sitemap
| title: Blog by Hilzu
email: hilzu@iki.fi
description: >
Random thoughts mostly about technology and especially about web stack.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "https://blog.hilzu.moe" # the base hostname & protocol for your site
twitter_username: ze_hilda
github_username: hilzu
permalink: pretty
# Build settings
markdown: kramdown
exclude: [vendor]
timezone: Europe/Helsinki
encoding: utf-8
+
+ gems:
+ - jekyll-sitemap | 3 | 0.1875 | 3 | 0 |
926ad4491849c574cdec03fc996dcd07f61a9000 | doc/INSTALL-ubuntu.md | doc/INSTALL-ubuntu.md | Feedbin Installation on Ubuntu 12.04
------------------------------------
### Ubuntu 12.04 Dependencies
apt-get install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
apt-get -y update
apt-get -y upgrade
apt-get install -y build-essential curl libreadline-dev libcurl4-gnutls-dev libpq-dev libxml2-dev libxslt1-dev libcurl4-gnutls-dev zlib1g-dev libssl-dev postgresql-client-9.2
TODO: Getting the Ruby environment setup on Ubuntu and running Feedbin
| Feedbin Installation on Ubuntu 12.04
------------------------------------
### Ubuntu 12.04 Dependencies
apt-get install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
add-apt-repository ppa:brightbox/ruby-ng-experimental
apt-get update
apt-get install -y ruby2.0 ruby2.0-dev build-essential curl libreadline-dev libcurl4-gnutls-dev \
libpq-dev libxml2-dev libxslt1-dev zlib1g-dev libssl-dev \
postgresql-client-9.2 postgresql-contrib-9.2 git-core
# For all-on-one-host installation
apt-get install -y postgresql-9.2 redis-server
sudo su - postgres
echo "CREATE USER feedbin WITH PASSWORD 'feedbin'; \
ALTER ROLE feedbin WITH SUPERUSER;" | psql
exit
# Setting up feedbin time!
git clone https://github.com/feedbin/feedbin.git
cd feedbin
echo "export GEM_HOME='$HOME/.gems'" >> ~/.bashrc
echo 'export PATH=$HOME/.gems/bin:${PATH}' >> ~/.bashrc
echo "export SECRET_KEY_BASE=$(rake secret)" >> ~/.bashrc
echo "export DATABASE_URL=postgres://feedbin:feedbin@localhost/feedbin_development" >> ~/.bashrc
echo "export POSTGRES_USERNAME=feedbin" >> ~/.bashrc
source ~/.bashrc
gem install bundler redis
bundle
vim config/database.yml # Edit this file to insert the 'feedbin' postgres password
rake db:setup
# Preferebly run these two in two separate terminals (or a screen!)
bundle exec foreman start &
rackup
| Add more detailed instructions for development installation on Ubuntu 12.04. | Add more detailed instructions for development installation on Ubuntu 12.04. | Markdown | mit | brendanlong/feedbin,saitodisse/feedbin,feedbin/feedbin,brendanlong/feedbin,nota-ja/feedbin,feedbin/feedbin,nota-ja/feedbin,fearenales/feedbin,feedbin/feedbin,brendanlong/feedbin,nota-ja/feedbin,azukiapp/feedbin,feedbin/feedbin,fearenales/feedbin,azukiapp/feedbin,saitodisse/feedbin,saitodisse/feedbin,fearenales/feedbin,azukiapp/feedbin | markdown | ## Code Before:
Feedbin Installation on Ubuntu 12.04
------------------------------------
### Ubuntu 12.04 Dependencies
apt-get install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
apt-get -y update
apt-get -y upgrade
apt-get install -y build-essential curl libreadline-dev libcurl4-gnutls-dev libpq-dev libxml2-dev libxslt1-dev libcurl4-gnutls-dev zlib1g-dev libssl-dev postgresql-client-9.2
TODO: Getting the Ruby environment setup on Ubuntu and running Feedbin
## Instruction:
Add more detailed instructions for development installation on Ubuntu 12.04.
## Code After:
Feedbin Installation on Ubuntu 12.04
------------------------------------
### Ubuntu 12.04 Dependencies
apt-get install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
add-apt-repository ppa:brightbox/ruby-ng-experimental
apt-get update
apt-get install -y ruby2.0 ruby2.0-dev build-essential curl libreadline-dev libcurl4-gnutls-dev \
libpq-dev libxml2-dev libxslt1-dev zlib1g-dev libssl-dev \
postgresql-client-9.2 postgresql-contrib-9.2 git-core
# For all-on-one-host installation
apt-get install -y postgresql-9.2 redis-server
sudo su - postgres
echo "CREATE USER feedbin WITH PASSWORD 'feedbin'; \
ALTER ROLE feedbin WITH SUPERUSER;" | psql
exit
# Setting up feedbin time!
git clone https://github.com/feedbin/feedbin.git
cd feedbin
echo "export GEM_HOME='$HOME/.gems'" >> ~/.bashrc
echo 'export PATH=$HOME/.gems/bin:${PATH}' >> ~/.bashrc
echo "export SECRET_KEY_BASE=$(rake secret)" >> ~/.bashrc
echo "export DATABASE_URL=postgres://feedbin:feedbin@localhost/feedbin_development" >> ~/.bashrc
echo "export POSTGRES_USERNAME=feedbin" >> ~/.bashrc
source ~/.bashrc
gem install bundler redis
bundle
vim config/database.yml # Edit this file to insert the 'feedbin' postgres password
rake db:setup
# Preferebly run these two in two separate terminals (or a screen!)
bundle exec foreman start &
rackup
| Feedbin Installation on Ubuntu 12.04
------------------------------------
### Ubuntu 12.04 Dependencies
apt-get install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
+ add-apt-repository ppa:brightbox/ruby-ng-experimental
- apt-get -y update
? ---
+ apt-get update
- apt-get -y upgrade
- apt-get install -y build-essential curl libreadline-dev libcurl4-gnutls-dev libpq-dev libxml2-dev libxslt1-dev libcurl4-gnutls-dev zlib1g-dev libssl-dev postgresql-client-9.2
-
- TODO: Getting the Ruby environment setup on Ubuntu and running Feedbin
+ apt-get install -y ruby2.0 ruby2.0-dev build-essential curl libreadline-dev libcurl4-gnutls-dev \
+ libpq-dev libxml2-dev libxslt1-dev zlib1g-dev libssl-dev \
+ postgresql-client-9.2 postgresql-contrib-9.2 git-core
+
+ # For all-on-one-host installation
+ apt-get install -y postgresql-9.2 redis-server
+ sudo su - postgres
+ echo "CREATE USER feedbin WITH PASSWORD 'feedbin'; \
+ ALTER ROLE feedbin WITH SUPERUSER;" | psql
+ exit
+
+ # Setting up feedbin time!
+ git clone https://github.com/feedbin/feedbin.git
+ cd feedbin
+ echo "export GEM_HOME='$HOME/.gems'" >> ~/.bashrc
+ echo 'export PATH=$HOME/.gems/bin:${PATH}' >> ~/.bashrc
+ echo "export SECRET_KEY_BASE=$(rake secret)" >> ~/.bashrc
+ echo "export DATABASE_URL=postgres://feedbin:feedbin@localhost/feedbin_development" >> ~/.bashrc
+ echo "export POSTGRES_USERNAME=feedbin" >> ~/.bashrc
+ source ~/.bashrc
+
+ gem install bundler redis
+ bundle
+
+ vim config/database.yml # Edit this file to insert the 'feedbin' postgres password
+
+ rake db:setup
+
+ # Preferebly run these two in two separate terminals (or a screen!)
+ bundle exec foreman start &
+ rackup | 38 | 3.166667 | 33 | 5 |
9d0f1ea3d75a913433a045c9edd1e9d55f08e3b5 | ModuleConfig.cfc | ModuleConfig.cfc | component {
this.title = "SendGrid Web API v3";
this.author = "Matthew J. Clemente";
this.webURL = "https://github.com/mjclemente/sendgrid.cfc";
this.description = "A wrapper for the SendGrid Web API v3";
function configure(){
settings = {
apiKey = '', // Required
baseUrl = 'https://api.sendgrid.com/v3', // Default value in init
forceTestMode = false, // Default value in init
httpTimeout = 60, // Default value in init
includeRaw = true // Default value in init
};
}
function onLoad(){
binder.map( "sendgrid@sendgridcfc" )
.to( "#moduleMapping#.sendgrid" )
.asSingleton()
.initWith(
apiKey = settings.apiKey,
baseUrl = settings.baseUrl,
forceTestMode = settings.forceTestMode,
httpTimeout = settings.httpTimeout,
includeRaw = settings.includeRaw
);
binder.mapDirectory(
packagePath = "#moduleMapping#/helpers",
namespace = "@sendgridcfc"
);
}
} | component {
this.title = "SendGrid Web API v3";
this.author = "Matthew J. Clemente";
this.webURL = "https://github.com/mjclemente/sendgrid.cfc";
this.description = "A wrapper for the SendGrid Web API v3";
function configure(){
settings = {
apiKey = '', // Required
baseUrl = 'https://api.sendgrid.com/v3', // Default value in init
forceTestMode = false, // Default value in init
httpTimeout = 60, // Default value in init
includeRaw = true // Default value in init
};
}
function onLoad(){
binder.map( "sendgrid@sendgridcfc" )
.to( "#moduleMapping#.sendgrid" )
.asSingleton()
.initWith(
apiKey = settings.apiKey,
baseUrl = settings.baseUrl,
forceTestMode = settings.forceTestMode,
httpTimeout = settings.httpTimeout,
includeRaw = settings.includeRaw
);
binder.mapDirectory(
packagePath = "#REreplace( moduleMapping, '^/', '' )#/helpers",
namespace = "@sendgridcfc"
);
}
} | Remove leading slash for modulemapping | Remove leading slash for modulemapping
| ColdFusion CFC | mit | mjclemente/sendgrid.cfc | coldfusion-cfc | ## Code Before:
component {
this.title = "SendGrid Web API v3";
this.author = "Matthew J. Clemente";
this.webURL = "https://github.com/mjclemente/sendgrid.cfc";
this.description = "A wrapper for the SendGrid Web API v3";
function configure(){
settings = {
apiKey = '', // Required
baseUrl = 'https://api.sendgrid.com/v3', // Default value in init
forceTestMode = false, // Default value in init
httpTimeout = 60, // Default value in init
includeRaw = true // Default value in init
};
}
function onLoad(){
binder.map( "sendgrid@sendgridcfc" )
.to( "#moduleMapping#.sendgrid" )
.asSingleton()
.initWith(
apiKey = settings.apiKey,
baseUrl = settings.baseUrl,
forceTestMode = settings.forceTestMode,
httpTimeout = settings.httpTimeout,
includeRaw = settings.includeRaw
);
binder.mapDirectory(
packagePath = "#moduleMapping#/helpers",
namespace = "@sendgridcfc"
);
}
}
## Instruction:
Remove leading slash for modulemapping
## Code After:
component {
this.title = "SendGrid Web API v3";
this.author = "Matthew J. Clemente";
this.webURL = "https://github.com/mjclemente/sendgrid.cfc";
this.description = "A wrapper for the SendGrid Web API v3";
function configure(){
settings = {
apiKey = '', // Required
baseUrl = 'https://api.sendgrid.com/v3', // Default value in init
forceTestMode = false, // Default value in init
httpTimeout = 60, // Default value in init
includeRaw = true // Default value in init
};
}
function onLoad(){
binder.map( "sendgrid@sendgridcfc" )
.to( "#moduleMapping#.sendgrid" )
.asSingleton()
.initWith(
apiKey = settings.apiKey,
baseUrl = settings.baseUrl,
forceTestMode = settings.forceTestMode,
httpTimeout = settings.httpTimeout,
includeRaw = settings.includeRaw
);
binder.mapDirectory(
packagePath = "#REreplace( moduleMapping, '^/', '' )#/helpers",
namespace = "@sendgridcfc"
);
}
} | component {
this.title = "SendGrid Web API v3";
this.author = "Matthew J. Clemente";
this.webURL = "https://github.com/mjclemente/sendgrid.cfc";
this.description = "A wrapper for the SendGrid Web API v3";
function configure(){
settings = {
apiKey = '', // Required
baseUrl = 'https://api.sendgrid.com/v3', // Default value in init
forceTestMode = false, // Default value in init
httpTimeout = 60, // Default value in init
includeRaw = true // Default value in init
};
}
function onLoad(){
binder.map( "sendgrid@sendgridcfc" )
.to( "#moduleMapping#.sendgrid" )
.asSingleton()
.initWith(
apiKey = settings.apiKey,
baseUrl = settings.baseUrl,
forceTestMode = settings.forceTestMode,
httpTimeout = settings.httpTimeout,
includeRaw = settings.includeRaw
);
binder.mapDirectory(
- packagePath = "#moduleMapping#/helpers",
+ packagePath = "#REreplace( moduleMapping, '^/', '' )#/helpers",
? +++++++++++ ++++++++++++
namespace = "@sendgridcfc"
);
}
} | 2 | 0.057143 | 1 | 1 |
31c0a1c9a5090727a20d4942f9c1fb3189b190d1 | lib/pkgcloud/amazon/storage/client/index.js | lib/pkgcloud/amazon/storage/client/index.js | /*
* client.js: Storage client for AWS S3
*
* (C) 2011 Nodejitsu Inc.
*
*/
var utile = require('utile'),
urlJoin = require('url-join'),
xml2js = require('xml2js'),
auth = require('../../../common/auth'),
amazon = require('../../client');
var Client = exports.Client = function (options) {
this.serversUrl = 's3.amazonaws.com';
amazon.Client.call(this, options);
utile.mixin(this, require('./containers'));
utile.mixin(this, require('./files'));
this.before.push(auth.amazon.headersSignature);
};
utile.inherits(Client, amazon.Client);
Client.prototype._xmlRequest = function query(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return this._request(options, function (err, body, res) {
if (err) {
return callback(err);
}
var parser = new xml2js.Parser();
parser.parseString(body || '', function (err, data) {
return err
? callback(err)
: callback(null, data, res);
});
});
};
Client.prototype._getUrl = function (options) {
options = options || {};
if (typeof options === 'string') {
return urlJoin('https://' + this.serversUrl, options);
}
return urlJoin('https://' +
(options.container ? options.container + '.' : '') +
this.serversUrl, options.path);
};
| /*
* client.js: Storage client for AWS S3
*
* (C) 2011 Nodejitsu Inc.
*
*/
var utile = require('utile'),
urlJoin = require('url-join'),
xml2js = require('xml2js'),
auth = require('../../../common/auth'),
amazon = require('../../client');
var Client = exports.Client = function (options) {
this.serversUrl = 's3.amazonaws.com';
amazon.Client.call(this, options);
utile.mixin(this, require('./containers'));
utile.mixin(this, require('./files'));
this.before.push(auth.amazon.headersSignature);
};
utile.inherits(Client, amazon.Client);
Client.prototype._xmlRequest = function query(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return this._request(options, function (err, body, res) {
if (err) {
return callback(err);
}
var parser = new xml2js.Parser();
parser.parseString(body || '', function (err, data) {
return err
? callback(err)
: callback(null, data, res);
});
});
};
Client.prototype._getUrl = function (options) {
options = options || {};
if (typeof options === 'string') {
return urlJoin(this.protocol + this.serversUrl, options);
}
return urlJoin(this.protocol +
(options.container ? options.container + '.' : '') +
this.serversUrl, options.path);
};
| Allow AWS client against non-https servers | Allow AWS client against non-https servers
I want to test my application against a "fake" local S3. It is not running HTTPS. This change allows me to specify a non-HTTPS connection by passing { protocol: 'http://' } to the client creation as an option. | JavaScript | mit | bunglestink/pkgcloud,songanbui/pkgcloud,mcanthony/pkgcloud,Phanatic/pkgcloud,dionjwa/pkgcloud,apla/pkgcloud,DonSchenck/pkgcloud,hacor/pkgcloud,pkgcloud/pkgcloud,Hopebaytech/pkgcloud,andrewsomething/pkgcloud,temka1234/pkgcloud,mdsummers/pkgcloud,Phanatic/pkgcloud | javascript | ## Code Before:
/*
* client.js: Storage client for AWS S3
*
* (C) 2011 Nodejitsu Inc.
*
*/
var utile = require('utile'),
urlJoin = require('url-join'),
xml2js = require('xml2js'),
auth = require('../../../common/auth'),
amazon = require('../../client');
var Client = exports.Client = function (options) {
this.serversUrl = 's3.amazonaws.com';
amazon.Client.call(this, options);
utile.mixin(this, require('./containers'));
utile.mixin(this, require('./files'));
this.before.push(auth.amazon.headersSignature);
};
utile.inherits(Client, amazon.Client);
Client.prototype._xmlRequest = function query(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return this._request(options, function (err, body, res) {
if (err) {
return callback(err);
}
var parser = new xml2js.Parser();
parser.parseString(body || '', function (err, data) {
return err
? callback(err)
: callback(null, data, res);
});
});
};
Client.prototype._getUrl = function (options) {
options = options || {};
if (typeof options === 'string') {
return urlJoin('https://' + this.serversUrl, options);
}
return urlJoin('https://' +
(options.container ? options.container + '.' : '') +
this.serversUrl, options.path);
};
## Instruction:
Allow AWS client against non-https servers
I want to test my application against a "fake" local S3. It is not running HTTPS. This change allows me to specify a non-HTTPS connection by passing { protocol: 'http://' } to the client creation as an option.
## Code After:
/*
* client.js: Storage client for AWS S3
*
* (C) 2011 Nodejitsu Inc.
*
*/
var utile = require('utile'),
urlJoin = require('url-join'),
xml2js = require('xml2js'),
auth = require('../../../common/auth'),
amazon = require('../../client');
var Client = exports.Client = function (options) {
this.serversUrl = 's3.amazonaws.com';
amazon.Client.call(this, options);
utile.mixin(this, require('./containers'));
utile.mixin(this, require('./files'));
this.before.push(auth.amazon.headersSignature);
};
utile.inherits(Client, amazon.Client);
Client.prototype._xmlRequest = function query(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return this._request(options, function (err, body, res) {
if (err) {
return callback(err);
}
var parser = new xml2js.Parser();
parser.parseString(body || '', function (err, data) {
return err
? callback(err)
: callback(null, data, res);
});
});
};
Client.prototype._getUrl = function (options) {
options = options || {};
if (typeof options === 'string') {
return urlJoin(this.protocol + this.serversUrl, options);
}
return urlJoin(this.protocol +
(options.container ? options.container + '.' : '') +
this.serversUrl, options.path);
};
| /*
* client.js: Storage client for AWS S3
*
* (C) 2011 Nodejitsu Inc.
*
*/
var utile = require('utile'),
urlJoin = require('url-join'),
xml2js = require('xml2js'),
auth = require('../../../common/auth'),
amazon = require('../../client');
var Client = exports.Client = function (options) {
this.serversUrl = 's3.amazonaws.com';
amazon.Client.call(this, options);
utile.mixin(this, require('./containers'));
utile.mixin(this, require('./files'));
this.before.push(auth.amazon.headersSignature);
};
utile.inherits(Client, amazon.Client);
Client.prototype._xmlRequest = function query(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
return this._request(options, function (err, body, res) {
if (err) {
return callback(err);
}
var parser = new xml2js.Parser();
parser.parseString(body || '', function (err, data) {
return err
? callback(err)
: callback(null, data, res);
});
});
};
Client.prototype._getUrl = function (options) {
options = options || {};
if (typeof options === 'string') {
- return urlJoin('https://' + this.serversUrl, options);
? ^ ^^^^^^^
+ return urlJoin(this.protocol + this.serversUrl, options);
? ^ ++++++ ^^^^
}
- return urlJoin('https://' +
+ return urlJoin(this.protocol +
(options.container ? options.container + '.' : '') +
this.serversUrl, options.path);
}; | 4 | 0.067797 | 2 | 2 |
cad48e91776ded810b23c336380797c88dd456c0 | services/netflix.py | services/netflix.py | import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize_url = 'https://api-user.netflix.com/oauth/login'
access_token_url = 'http://api.netflix.com/oauth/access_token'
api_domains = ['api-public.netflix.com', 'api.netflix.com']
available_permissions = [
(None, 'read and manage your queue'),
]
https = False
signature_type = SIGNATURE_TYPE_QUERY
def get_authorize_params(self, redirect_uri):
params = super(Netflix, self).get_authorize_params(redirect_uri)
params['oauth_consumer_key'] = self.client_id
return params
def get_user_id(self, key):
r = self.api(key, self.api_domains[0], u'/users/current',
params={'output': 'json'})
redirect = r.json[u'resource'][u'link'][u'href']
parts = urlparse.urlparse(redirect)
r = self.api(key, parts.netloc, parts.path,
params={'output': 'json'})
return r.json[u'user'][u'user_id']
| import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize_url = 'https://api-user.netflix.com/oauth/login'
access_token_url = 'http://api.netflix.com/oauth/access_token'
api_domains = ['api-public.netflix.com', 'api.netflix.com']
available_permissions = [
(None, 'read and manage your queue'),
]
https = False
signature_type = SIGNATURE_TYPE_QUERY
def get_authorize_params(self, *args, **kwargs):
params = super(Netflix, self).get_authorize_params(*args, **kwargs)
params['oauth_consumer_key'] = self.client_id
return params
def get_user_id(self, key):
r = self.api(key, self.api_domains[0], u'/users/current',
params={'output': 'json'})
redirect = r.json[u'resource'][u'link'][u'href']
parts = urlparse.urlparse(redirect)
r = self.api(key, parts.netloc, parts.path,
params={'output': 'json'})
return r.json[u'user'][u'user_id']
| Fix Netflix in light of the new scope selection system | Fix Netflix in light of the new scope selection system
| Python | bsd-3-clause | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | python | ## Code Before:
import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize_url = 'https://api-user.netflix.com/oauth/login'
access_token_url = 'http://api.netflix.com/oauth/access_token'
api_domains = ['api-public.netflix.com', 'api.netflix.com']
available_permissions = [
(None, 'read and manage your queue'),
]
https = False
signature_type = SIGNATURE_TYPE_QUERY
def get_authorize_params(self, redirect_uri):
params = super(Netflix, self).get_authorize_params(redirect_uri)
params['oauth_consumer_key'] = self.client_id
return params
def get_user_id(self, key):
r = self.api(key, self.api_domains[0], u'/users/current',
params={'output': 'json'})
redirect = r.json[u'resource'][u'link'][u'href']
parts = urlparse.urlparse(redirect)
r = self.api(key, parts.netloc, parts.path,
params={'output': 'json'})
return r.json[u'user'][u'user_id']
## Instruction:
Fix Netflix in light of the new scope selection system
## Code After:
import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize_url = 'https://api-user.netflix.com/oauth/login'
access_token_url = 'http://api.netflix.com/oauth/access_token'
api_domains = ['api-public.netflix.com', 'api.netflix.com']
available_permissions = [
(None, 'read and manage your queue'),
]
https = False
signature_type = SIGNATURE_TYPE_QUERY
def get_authorize_params(self, *args, **kwargs):
params = super(Netflix, self).get_authorize_params(*args, **kwargs)
params['oauth_consumer_key'] = self.client_id
return params
def get_user_id(self, key):
r = self.api(key, self.api_domains[0], u'/users/current',
params={'output': 'json'})
redirect = r.json[u'resource'][u'link'][u'href']
parts = urlparse.urlparse(redirect)
r = self.api(key, parts.netloc, parts.path,
params={'output': 'json'})
return r.json[u'user'][u'user_id']
| import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Netflix(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'https://www.netflix.com/'
docs_url = 'http://developer.netflix.com/docs'
# URLs to interact with the API
request_token_url = 'http://api.netflix.com/oauth/request_token'
authorize_url = 'https://api-user.netflix.com/oauth/login'
access_token_url = 'http://api.netflix.com/oauth/access_token'
api_domains = ['api-public.netflix.com', 'api.netflix.com']
available_permissions = [
(None, 'read and manage your queue'),
]
https = False
signature_type = SIGNATURE_TYPE_QUERY
- def get_authorize_params(self, redirect_uri):
? ^^^ ^^^^^^^
+ def get_authorize_params(self, *args, **kwargs):
? ++ ^^^^^^^^^ ^^
- params = super(Netflix, self).get_authorize_params(redirect_uri)
? ^^^ ^^^^^^^
+ params = super(Netflix, self).get_authorize_params(*args, **kwargs)
? ++ ^^^^^^^^^ ^^
params['oauth_consumer_key'] = self.client_id
return params
def get_user_id(self, key):
r = self.api(key, self.api_domains[0], u'/users/current',
params={'output': 'json'})
redirect = r.json[u'resource'][u'link'][u'href']
parts = urlparse.urlparse(redirect)
r = self.api(key, parts.netloc, parts.path,
params={'output': 'json'})
return r.json[u'user'][u'user_id'] | 4 | 0.108108 | 2 | 2 |
ced84f283761f38156960f2d8e001ba6f3cd2b08 | src/hook/index.js | src/hook/index.js | import { Base } from 'yeoman-generator';
import generatorArguments from './arguments';
import generatorOptions from './options';
import generatorSteps from './steps';
export default class HookGenerator extends Base {
constructor(...args) {
super(...args);
Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key]));
Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key]));
}
get configuring() {
return generatorSteps.configuring;
}
get conflicts() {
return generatorSteps.conflicts;
}
get default() {
return generatorSteps.default;
}
get end() {
return generatorSteps.end;
}
get initializing() {
return generatorSteps.initializing
}
get install() {
return generatorSteps.install;
}
get prompting() {
return generatorSteps.prompting
}
get writing() {
return generatorSteps.writing;
}
}
| import { Base } from 'yeoman-generator';
import generatorArguments from './arguments';
import generatorOptions from './options';
import generatorSteps from './steps';
export default class HookGenerator extends Base {
constructor(...args) {
super(...args);
Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key]));
Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key]));
this.description = 'Scaffold a custom hook in api/hooks';
}
get configuring() {
return generatorSteps.configuring;
}
get conflicts() {
return generatorSteps.conflicts;
}
get default() {
return generatorSteps.default;
}
get end() {
return generatorSteps.end;
}
get initializing() {
return generatorSteps.initializing
}
get install() {
return generatorSteps.install;
}
get prompting() {
return generatorSteps.prompting
}
get writing() {
return generatorSteps.writing;
}
}
| Add description to hook generator | Add description to hook generator
| JavaScript | mit | tnunes/generator-trails,IncoCode/generator-sails-rest-api,ghaiklor/generator-sails-rest-api,jaumard/generator-trails,konstantinzolotarev/generator-trails,italoag/generator-sails-rest-api,italoag/generator-sails-rest-api,ghaiklor/generator-sails-rest-api | javascript | ## Code Before:
import { Base } from 'yeoman-generator';
import generatorArguments from './arguments';
import generatorOptions from './options';
import generatorSteps from './steps';
export default class HookGenerator extends Base {
constructor(...args) {
super(...args);
Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key]));
Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key]));
}
get configuring() {
return generatorSteps.configuring;
}
get conflicts() {
return generatorSteps.conflicts;
}
get default() {
return generatorSteps.default;
}
get end() {
return generatorSteps.end;
}
get initializing() {
return generatorSteps.initializing
}
get install() {
return generatorSteps.install;
}
get prompting() {
return generatorSteps.prompting
}
get writing() {
return generatorSteps.writing;
}
}
## Instruction:
Add description to hook generator
## Code After:
import { Base } from 'yeoman-generator';
import generatorArguments from './arguments';
import generatorOptions from './options';
import generatorSteps from './steps';
export default class HookGenerator extends Base {
constructor(...args) {
super(...args);
Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key]));
Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key]));
this.description = 'Scaffold a custom hook in api/hooks';
}
get configuring() {
return generatorSteps.configuring;
}
get conflicts() {
return generatorSteps.conflicts;
}
get default() {
return generatorSteps.default;
}
get end() {
return generatorSteps.end;
}
get initializing() {
return generatorSteps.initializing
}
get install() {
return generatorSteps.install;
}
get prompting() {
return generatorSteps.prompting
}
get writing() {
return generatorSteps.writing;
}
}
| import { Base } from 'yeoman-generator';
import generatorArguments from './arguments';
import generatorOptions from './options';
import generatorSteps from './steps';
export default class HookGenerator extends Base {
constructor(...args) {
super(...args);
Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key]));
Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key]));
+
+ this.description = 'Scaffold a custom hook in api/hooks';
}
get configuring() {
return generatorSteps.configuring;
}
get conflicts() {
return generatorSteps.conflicts;
}
get default() {
return generatorSteps.default;
}
get end() {
return generatorSteps.end;
}
get initializing() {
return generatorSteps.initializing
}
get install() {
return generatorSteps.install;
}
get prompting() {
return generatorSteps.prompting
}
get writing() {
return generatorSteps.writing;
}
} | 2 | 0.044444 | 2 | 0 |
790a54a59c0544748f00d04eae84183837e85b54 | kura/distrib/src/main/resources/fedora25-nn/README.md | kura/distrib/src/main/resources/fedora25-nn/README.md | Manual steps to install Kura 3.0 on Fedora 25 / Raspberry Pi
==
See [../fedora25/README.md](../fedora25/README.md).
| Manual steps to install Kura 3.0 on Fedora 25 / Raspberry Pi
==
See [../fedora25/README.md](../fedora25/README.md).
## Firewall
As this version of Kura does not manage the firewall of the target device it may
be necessary to do this yourself. By default this is done by `firewall-cmd`.
For example opening port 8080, for the Kura Web UI, can be done by:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
| Add a note about the Fedora firewall | Add a note about the Fedora firewall
Signed-off-by: Jens Reimann <d1bf62d29e711fdf0a5795916341a7b53d204e2a@redhat.com> | Markdown | epl-1.0 | amitjoy/kura,cdealti/kura,nicolatimeus/kura,cdealti/kura,gavinying/kura,ymai/kura,gavinying/kura,MMaiero/kura,amitjoy/kura,ymai/kura,MMaiero/kura,MMaiero/kura,amitjoy/kura,gavinying/kura,darionct/kura,markoer/kura,cdealti/kura,ctron/kura,ctron/kura,MMaiero/kura,nicolatimeus/kura,markoer/kura,darionct/kura,markoer/kura,ymai/kura,MMaiero/kura,darionct/kura,ymai/kura,nicolatimeus/kura,amitjoy/kura,gavinying/kura,gavinying/kura,darionct/kura,nicolatimeus/kura,cdealti/kura,MMaiero/kura,amitjoy/kura,ctron/kura,nicolatimeus/kura,gavinying/kura,markoer/kura,ymai/kura,ymai/kura,cdealti/kura,darionct/kura,cdealti/kura,nicolatimeus/kura,ctron/kura,markoer/kura,darionct/kura,amitjoy/kura,markoer/kura,ctron/kura,ctron/kura | markdown | ## Code Before:
Manual steps to install Kura 3.0 on Fedora 25 / Raspberry Pi
==
See [../fedora25/README.md](../fedora25/README.md).
## Instruction:
Add a note about the Fedora firewall
Signed-off-by: Jens Reimann <d1bf62d29e711fdf0a5795916341a7b53d204e2a@redhat.com>
## Code After:
Manual steps to install Kura 3.0 on Fedora 25 / Raspberry Pi
==
See [../fedora25/README.md](../fedora25/README.md).
## Firewall
As this version of Kura does not manage the firewall of the target device it may
be necessary to do this yourself. By default this is done by `firewall-cmd`.
For example opening port 8080, for the Kura Web UI, can be done by:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
| Manual steps to install Kura 3.0 on Fedora 25 / Raspberry Pi
==
See [../fedora25/README.md](../fedora25/README.md).
+
+ ## Firewall
+
+ As this version of Kura does not manage the firewall of the target device it may
+ be necessary to do this yourself. By default this is done by `firewall-cmd`.
+
+ For example opening port 8080, for the Kura Web UI, can be done by:
+
+ sudo firewall-cmd --permanent --add-port=8080/tcp
+ sudo firewall-cmd --reload | 10 | 2.5 | 10 | 0 |
0fd8c61d93711e23a31f07c613f042caa0c0b6ee | scripts/install.sh | scripts/install.sh |
set -ev
pip install tox
# App Engine tests require the App Engine SDK.
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
fi
# Travis ships with an old version of PyPy, so install at least version 2.6.
if [[ "${TOX_ENV}" == "pypy" ]]; then
git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
${HOME}/.pyenv/bin/pyenv install pypy-2.6.0
fi
|
set -ev
pip install tox
# App Engine tests require the App Engine SDK.
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
fi
# Travis ships with an old version of PyPy, so install at least version 2.6.
if [[ "${TOX_ENV}" == "pypy" ]]; then
if [ ! -d "${HOME}/.pyenv" ]; then
git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
fi
${HOME}/.pyenv/bin/pyenv install --skip-existing pypy-2.6.0
fi
| Fix pypy environment in Travis | Fix pypy environment in Travis
| Shell | apache-2.0 | jonparrott/oauth2client,googleapis/oauth2client,googleapis/oauth2client,google/oauth2client,clancychilds/oauth2client,google/oauth2client,clancychilds/oauth2client,jonparrott/oauth2client | shell | ## Code Before:
set -ev
pip install tox
# App Engine tests require the App Engine SDK.
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
fi
# Travis ships with an old version of PyPy, so install at least version 2.6.
if [[ "${TOX_ENV}" == "pypy" ]]; then
git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
${HOME}/.pyenv/bin/pyenv install pypy-2.6.0
fi
## Instruction:
Fix pypy environment in Travis
## Code After:
set -ev
pip install tox
# App Engine tests require the App Engine SDK.
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
fi
# Travis ships with an old version of PyPy, so install at least version 2.6.
if [[ "${TOX_ENV}" == "pypy" ]]; then
if [ ! -d "${HOME}/.pyenv" ]; then
git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
fi
${HOME}/.pyenv/bin/pyenv install --skip-existing pypy-2.6.0
fi
|
set -ev
pip install tox
# App Engine tests require the App Engine SDK.
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
fi
# Travis ships with an old version of PyPy, so install at least version 2.6.
if [[ "${TOX_ENV}" == "pypy" ]]; then
+ if [ ! -d "${HOME}/.pyenv" ]; then
- git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
+ git clone https://github.com/yyuu/pyenv.git ${HOME}/.pyenv
? ++++
+ fi
- ${HOME}/.pyenv/bin/pyenv install pypy-2.6.0
+ ${HOME}/.pyenv/bin/pyenv install --skip-existing pypy-2.6.0
? ++++++++++++++++
fi | 6 | 0.4 | 4 | 2 |
7a1782c3cd86a739a19b5382235cfadd6bba7da2 | data/hostname/worker02.softwareheritage.org.yaml | data/hostname/worker02.softwareheritage.org.yaml | networks:
private:
interface: ens19
address: 192.168.100.22
netmask: 255.255.255.0
gateway: 192.168.100.1
default:
interface: ens18
address: 128.93.193.22
netmask: 255.255.255.0
gateway: 128.93.193.254
| networks:
private:
interface: ens19
address: 192.168.100.22
netmask: 255.255.255.0
gateway: 192.168.100.1
default:
interface: ens18
address: 128.93.193.22
netmask: 255.255.255.0
gateway: 128.93.193.254
swh::deploy::worker::instances:
- swh_lister_debian
- swh_lister_github
- swh_loader_debian
- swh_loader_git
- swh_loader_git_disk
- swh_loader_svn
- swh_loader_deposit
| Deploy deposit loader on worker02 as tryout | data/worker02: Deploy deposit loader on worker02 as tryout
Related T821
| YAML | apache-2.0 | SoftwareHeritage/puppet-swh-site,SoftwareHeritage/puppet-swh-site,SoftwareHeritage/puppet-swh-site,SoftwareHeritage/puppet-swh-site,SoftwareHeritage/puppet-swh-site | yaml | ## Code Before:
networks:
private:
interface: ens19
address: 192.168.100.22
netmask: 255.255.255.0
gateway: 192.168.100.1
default:
interface: ens18
address: 128.93.193.22
netmask: 255.255.255.0
gateway: 128.93.193.254
## Instruction:
data/worker02: Deploy deposit loader on worker02 as tryout
Related T821
## Code After:
networks:
private:
interface: ens19
address: 192.168.100.22
netmask: 255.255.255.0
gateway: 192.168.100.1
default:
interface: ens18
address: 128.93.193.22
netmask: 255.255.255.0
gateway: 128.93.193.254
swh::deploy::worker::instances:
- swh_lister_debian
- swh_lister_github
- swh_loader_debian
- swh_loader_git
- swh_loader_git_disk
- swh_loader_svn
- swh_loader_deposit
| networks:
private:
interface: ens19
address: 192.168.100.22
netmask: 255.255.255.0
gateway: 192.168.100.1
default:
interface: ens18
address: 128.93.193.22
netmask: 255.255.255.0
gateway: 128.93.193.254
+
+ swh::deploy::worker::instances:
+ - swh_lister_debian
+ - swh_lister_github
+ - swh_loader_debian
+ - swh_loader_git
+ - swh_loader_git_disk
+ - swh_loader_svn
+ - swh_loader_deposit | 9 | 0.818182 | 9 | 0 |
0ee42ac3b80893557691d722eda207733289c97c | micropsi_core/world/minecraft/spockplugin.py | micropsi_core/world/minecraft/spockplugin.py | import logging
from spock.mcp import mcdata, mcpacket
from spock.mcmap import smpmap
from micropsi_core.world.minecraft.psidispatcher import PsiDispatcher
from spock.utils import pl_announce
@pl_announce('Micropsi')
class MicropsiPlugin(object):
def __init__(self, ploader, settings):
self.worldadapter = settings['worldadapter']
self.worldadapter.spockplugin = self
self.net = ploader.requires('Net')
self.event = ploader.requires('Event')
self.world = ploader.requires('World')
self.clientinfo = ploader.requires('ClientInfo')
#MicroPsi Datatargets
self.psi_dispatcher = PsiDispatcher(self)
self.move_x = 0
self.move_z = 0
self.move_x_ = 0
self.move_z_ = 0
def move(self, position=None):
if not (self.net.connected and self.net.proto_state == mcdata.PLAY_STATE):
return
if position is None:
position = self.client_info.position
self.net.push(mcpacket.Packet(
ident='PLAY>Player Position and Look',
data=position
)) | import logging
from spock.mcp import mcdata, mcpacket
from spock.mcmap import smpmap
from micropsi_core.world.minecraft.psidispatcher import PsiDispatcher
from spock.utils import pl_announce
@pl_announce('Micropsi')
class MicropsiPlugin(object):
def __init__(self, ploader, settings):
self.worldadapter = settings['worldadapter']
self.worldadapter.spockplugin = self
self.net = ploader.requires('Net')
self.event = ploader.requires('Event')
self.world = ploader.requires('World')
self.clientinfo = ploader.requires('ClientInfo')
#MicroPsi Datatargets
self.psi_dispatcher = PsiDispatcher(self)
self.move_x = 0
self.move_z = 0
self.move_x_ = 0
self.move_z_ = 0
def move(self, position=None):
if not (self.net.connected and self.net.proto_state == mcdata.PLAY_STATE):
return
self.clientinfo.position = position
| Move now sets the client position and allows the movement plugin do its thing | Move now sets the client position and allows the
movement plugin do its thing | Python | mit | ianupright/micropsi2,ianupright/micropsi2,printedheart/micropsi2,ianupright/micropsi2,printedheart/micropsi2,printedheart/micropsi2 | python | ## Code Before:
import logging
from spock.mcp import mcdata, mcpacket
from spock.mcmap import smpmap
from micropsi_core.world.minecraft.psidispatcher import PsiDispatcher
from spock.utils import pl_announce
@pl_announce('Micropsi')
class MicropsiPlugin(object):
def __init__(self, ploader, settings):
self.worldadapter = settings['worldadapter']
self.worldadapter.spockplugin = self
self.net = ploader.requires('Net')
self.event = ploader.requires('Event')
self.world = ploader.requires('World')
self.clientinfo = ploader.requires('ClientInfo')
#MicroPsi Datatargets
self.psi_dispatcher = PsiDispatcher(self)
self.move_x = 0
self.move_z = 0
self.move_x_ = 0
self.move_z_ = 0
def move(self, position=None):
if not (self.net.connected and self.net.proto_state == mcdata.PLAY_STATE):
return
if position is None:
position = self.client_info.position
self.net.push(mcpacket.Packet(
ident='PLAY>Player Position and Look',
data=position
))
## Instruction:
Move now sets the client position and allows the
movement plugin do its thing
## Code After:
import logging
from spock.mcp import mcdata, mcpacket
from spock.mcmap import smpmap
from micropsi_core.world.minecraft.psidispatcher import PsiDispatcher
from spock.utils import pl_announce
@pl_announce('Micropsi')
class MicropsiPlugin(object):
def __init__(self, ploader, settings):
self.worldadapter = settings['worldadapter']
self.worldadapter.spockplugin = self
self.net = ploader.requires('Net')
self.event = ploader.requires('Event')
self.world = ploader.requires('World')
self.clientinfo = ploader.requires('ClientInfo')
#MicroPsi Datatargets
self.psi_dispatcher = PsiDispatcher(self)
self.move_x = 0
self.move_z = 0
self.move_x_ = 0
self.move_z_ = 0
def move(self, position=None):
if not (self.net.connected and self.net.proto_state == mcdata.PLAY_STATE):
return
self.clientinfo.position = position
| import logging
from spock.mcp import mcdata, mcpacket
from spock.mcmap import smpmap
from micropsi_core.world.minecraft.psidispatcher import PsiDispatcher
from spock.utils import pl_announce
@pl_announce('Micropsi')
class MicropsiPlugin(object):
def __init__(self, ploader, settings):
self.worldadapter = settings['worldadapter']
self.worldadapter.spockplugin = self
self.net = ploader.requires('Net')
self.event = ploader.requires('Event')
self.world = ploader.requires('World')
self.clientinfo = ploader.requires('ClientInfo')
#MicroPsi Datatargets
self.psi_dispatcher = PsiDispatcher(self)
self.move_x = 0
self.move_z = 0
self.move_x_ = 0
self.move_z_ = 0
def move(self, position=None):
if not (self.net.connected and self.net.proto_state == mcdata.PLAY_STATE):
return
+ self.clientinfo.position = position
- if position is None:
- position = self.client_info.position
- self.net.push(mcpacket.Packet(
- ident='PLAY>Player Position and Look',
- data=position
- )) | 7 | 0.2 | 1 | 6 |
30d03fc17151ae738be4c6d4d7ef91bd25434087 | metadata/com.orpheusdroid.screenrecorder.txt | metadata/com.orpheusdroid.screenrecorder.txt | Categories:System
License:AGPLv3
Web Site:
Source Code:https://github.com/vijai1996/screenrecorder
Issue Tracker:https://github.com/vijai1996/screenrecorder/issues
Summary:lightweight and functional screen recorder
Description:
ScreenCam doesn't need any root access to record your screen and works on all
phones with Android Lollipop 5.0 and above. You can also record audio along with
the screen recording and get it beautifully combined with the recorded video.
Choose from different resolutions, frames per second and bitrate for the best
choice of quality and size of the video or make use of the app shortcut in
android 7.1 nougat or in any custom launcher supporting app shortcuts.
.
Repo Type:git
Repo:https://github.com/vijai1996/screenrecorder
Build:1.1,4
commit=a078649ef3c3a6b53d16b6987a70d99818094a4a
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
| Categories:System
License:AGPLv3
Web Site:
Source Code:https://github.com/vijai1996/screenrecorder
Issue Tracker:https://github.com/vijai1996/screenrecorder/issues
Auto Name:ScreenCam
Summary:lightweight and functional screen recorder
Description:
ScreenCam doesn't need any root access to record your screen and works on all
phones with Android Lollipop 5.0 and above. You can also record audio along with
the screen recording and get it beautifully combined with the recorded video.
Choose from different resolutions, frames per second and bitrate for the best
choice of quality and size of the video or make use of the app shortcut in
android 7.1 nougat or in any custom launcher supporting app shortcuts.
.
Repo Type:git
Repo:https://github.com/vijai1996/screenrecorder
Build:1.1,4
commit=a078649ef3c3a6b53d16b6987a70d99818094a4a
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1
Current Version Code:4
| Update CV of ScreenCam to 1.1 (4) | Update CV of ScreenCam to 1.1 (4)
| Text | agpl-3.0 | f-droid/fdroid-data,f-droid/fdroiddata,f-droid/fdroiddata | text | ## Code Before:
Categories:System
License:AGPLv3
Web Site:
Source Code:https://github.com/vijai1996/screenrecorder
Issue Tracker:https://github.com/vijai1996/screenrecorder/issues
Summary:lightweight and functional screen recorder
Description:
ScreenCam doesn't need any root access to record your screen and works on all
phones with Android Lollipop 5.0 and above. You can also record audio along with
the screen recording and get it beautifully combined with the recorded video.
Choose from different resolutions, frames per second and bitrate for the best
choice of quality and size of the video or make use of the app shortcut in
android 7.1 nougat or in any custom launcher supporting app shortcuts.
.
Repo Type:git
Repo:https://github.com/vijai1996/screenrecorder
Build:1.1,4
commit=a078649ef3c3a6b53d16b6987a70d99818094a4a
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
## Instruction:
Update CV of ScreenCam to 1.1 (4)
## Code After:
Categories:System
License:AGPLv3
Web Site:
Source Code:https://github.com/vijai1996/screenrecorder
Issue Tracker:https://github.com/vijai1996/screenrecorder/issues
Auto Name:ScreenCam
Summary:lightweight and functional screen recorder
Description:
ScreenCam doesn't need any root access to record your screen and works on all
phones with Android Lollipop 5.0 and above. You can also record audio along with
the screen recording and get it beautifully combined with the recorded video.
Choose from different resolutions, frames per second and bitrate for the best
choice of quality and size of the video or make use of the app shortcut in
android 7.1 nougat or in any custom launcher supporting app shortcuts.
.
Repo Type:git
Repo:https://github.com/vijai1996/screenrecorder
Build:1.1,4
commit=a078649ef3c3a6b53d16b6987a70d99818094a4a
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1
Current Version Code:4
| Categories:System
License:AGPLv3
Web Site:
Source Code:https://github.com/vijai1996/screenrecorder
Issue Tracker:https://github.com/vijai1996/screenrecorder/issues
+ Auto Name:ScreenCam
Summary:lightweight and functional screen recorder
Description:
ScreenCam doesn't need any root access to record your screen and works on all
phones with Android Lollipop 5.0 and above. You can also record audio along with
the screen recording and get it beautifully combined with the recorded video.
Choose from different resolutions, frames per second and bitrate for the best
choice of quality and size of the video or make use of the app shortcut in
android 7.1 nougat or in any custom launcher supporting app shortcuts.
.
Repo Type:git
Repo:https://github.com/vijai1996/screenrecorder
Build:1.1,4
commit=a078649ef3c3a6b53d16b6987a70d99818094a4a
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
+ Current Version:1.1
+ Current Version Code:4 | 3 | 0.111111 | 3 | 0 |
d15a72f586db5e086beeb7ebcb84e34bf34b54a5 | data/transition-sites/ukvi.yml | data/transition-sites/ukvi.yml | ---
site: ukvi
whitehall_slug: uk-visas-and-immigration
host: www.ukba.homeoffice.gov.uk
tna_timestamp: 20140110181512
homepage: https://www.gov.uk/government/organisations/uk-visas-and-immigration
aliases:
- bia.homeoffice.gov.uk
- biapreview.homeoffice.gov.uk
- ind.homeoffice.gov.uk
- origin.ukba.homeoffice.gov.uk # Currently used for us to serve proxied content. Will move eventually.
- ukba.homeoffice.gov.uk
- www.bia.homeoffice.gov.uk
- www.biapreview.homeoffice.gov.uk
- www.ind.homeoffice.gov.uk
# area: used for different news index pages
# item: used for different contact pages
# version: used for different outcomes of an asylum application
# view: used to distinguish between a cover page (HTML) and the PDF itself
options: --query-string area:item:version:view
css: home-office
| ---
site: ukvi
whitehall_slug: uk-visas-and-immigration
host: www.ukba.homeoffice.gov.uk
tna_timestamp: 20140110181512
homepage: https://www.gov.uk/government/organisations/uk-visas-and-immigration
aliases:
- bia.homeoffice.gov.uk
- biapreview.homeoffice.gov.uk
- contact-ukba.homeoffice.gov.uk
- ind.homeoffice.gov.uk
- origin.ukba.homeoffice.gov.uk # Currently used for us to serve proxied content. Will move eventually.
- report-ukba.homeoffice.gov.uk
- ukba.homeoffice.gov.uk
- www.bia.homeoffice.gov.uk
- www.biapreview.homeoffice.gov.uk
- www.ind.homeoffice.gov.uk
# area: used for different news index pages
# item: used for different contact pages
# version: used for different outcomes of an asylum application
# view: used to distinguish between a cover page (HTML) and the PDF itself
options: --query-string area:item:version:view
css: home-office
| Revert "Remove two redundant aliases for UKVI" | Revert "Remove two redundant aliases for UKVI"
After this configuration change was merged and deployed, the Host
entries coresponding to the contact-ukba.homeoffice.gov.uk were
deleted.
This broke the Transition_load_all_data job, as there were host_paths
that referenced the deleted host.
This database change has now been reversed, and the deleted records
restored (details here [1]).
It seems sensible to make the coresponding change in the
configuration, with the expectation that this won't change the
database, as coresponding host entries already exist for these
aliases.
1: https://github.com/alphagov/govuk-org-notes/blob/master/Debugging%20the%20Transition_load_all_data%20Jenkins%20job%20failures.org
This reverts commit 9ce925400e42c6003bad2140847184c83764826f.
| YAML | mit | alphagov/transition-config,alphagov/transition-config | yaml | ## Code Before:
---
site: ukvi
whitehall_slug: uk-visas-and-immigration
host: www.ukba.homeoffice.gov.uk
tna_timestamp: 20140110181512
homepage: https://www.gov.uk/government/organisations/uk-visas-and-immigration
aliases:
- bia.homeoffice.gov.uk
- biapreview.homeoffice.gov.uk
- ind.homeoffice.gov.uk
- origin.ukba.homeoffice.gov.uk # Currently used for us to serve proxied content. Will move eventually.
- ukba.homeoffice.gov.uk
- www.bia.homeoffice.gov.uk
- www.biapreview.homeoffice.gov.uk
- www.ind.homeoffice.gov.uk
# area: used for different news index pages
# item: used for different contact pages
# version: used for different outcomes of an asylum application
# view: used to distinguish between a cover page (HTML) and the PDF itself
options: --query-string area:item:version:view
css: home-office
## Instruction:
Revert "Remove two redundant aliases for UKVI"
After this configuration change was merged and deployed, the Host
entries coresponding to the contact-ukba.homeoffice.gov.uk were
deleted.
This broke the Transition_load_all_data job, as there were host_paths
that referenced the deleted host.
This database change has now been reversed, and the deleted records
restored (details here [1]).
It seems sensible to make the coresponding change in the
configuration, with the expectation that this won't change the
database, as coresponding host entries already exist for these
aliases.
1: https://github.com/alphagov/govuk-org-notes/blob/master/Debugging%20the%20Transition_load_all_data%20Jenkins%20job%20failures.org
This reverts commit 9ce925400e42c6003bad2140847184c83764826f.
## Code After:
---
site: ukvi
whitehall_slug: uk-visas-and-immigration
host: www.ukba.homeoffice.gov.uk
tna_timestamp: 20140110181512
homepage: https://www.gov.uk/government/organisations/uk-visas-and-immigration
aliases:
- bia.homeoffice.gov.uk
- biapreview.homeoffice.gov.uk
- contact-ukba.homeoffice.gov.uk
- ind.homeoffice.gov.uk
- origin.ukba.homeoffice.gov.uk # Currently used for us to serve proxied content. Will move eventually.
- report-ukba.homeoffice.gov.uk
- ukba.homeoffice.gov.uk
- www.bia.homeoffice.gov.uk
- www.biapreview.homeoffice.gov.uk
- www.ind.homeoffice.gov.uk
# area: used for different news index pages
# item: used for different contact pages
# version: used for different outcomes of an asylum application
# view: used to distinguish between a cover page (HTML) and the PDF itself
options: --query-string area:item:version:view
css: home-office
| ---
site: ukvi
whitehall_slug: uk-visas-and-immigration
host: www.ukba.homeoffice.gov.uk
tna_timestamp: 20140110181512
homepage: https://www.gov.uk/government/organisations/uk-visas-and-immigration
aliases:
- bia.homeoffice.gov.uk
- biapreview.homeoffice.gov.uk
+ - contact-ukba.homeoffice.gov.uk
- ind.homeoffice.gov.uk
- origin.ukba.homeoffice.gov.uk # Currently used for us to serve proxied content. Will move eventually.
+ - report-ukba.homeoffice.gov.uk
- ukba.homeoffice.gov.uk
- www.bia.homeoffice.gov.uk
- www.biapreview.homeoffice.gov.uk
- www.ind.homeoffice.gov.uk
# area: used for different news index pages
# item: used for different contact pages
# version: used for different outcomes of an asylum application
# view: used to distinguish between a cover page (HTML) and the PDF itself
options: --query-string area:item:version:view
css: home-office | 2 | 0.095238 | 2 | 0 |
a8abf47a88d9737a99c59a0da25524d832a65d61 | install.sh | install.sh |
NOTIFIER_URL=https://raw.githubusercontent.com/grantovich/homebrew-notifier/master/notifier.sh
brew install terminal-notifier
mkdir -p ~/.bin
curl -fsS $NOTIFIER_URL > ~/.bin/brew-update-notifier.sh
if crontab -l | grep -q 'brew-update-notifier'; then
echo 'Crontab entry already exists, skipping...'
else
echo "0 11 * * * PATH=/usr/local/bin:\$PATH $(echo ~)/.bin/brew-update-notifier.sh" | crontab -
fi
echo
echo "Notifier installed. You'll be notified of brew updates at 11am every day."
echo "Checking for updates right now..."
~/.bin/brew-update-notifier.sh
|
NOTIFIER_URL=https://raw.githubusercontent.com/grantovich/homebrew-notifier/master/notifier.sh
brew install terminal-notifier
mkdir -p ~/.bin
curl -fsS $NOTIFIER_URL > ~/.bin/brew-update-notifier.sh
chmod +x ~/.bin/brew-update-notifier.sh
if crontab -l | grep -q 'brew-update-notifier'; then
echo 'Crontab entry already exists, skipping...'
else
echo "0 11 * * * PATH=/usr/local/bin:\$PATH $(echo ~)/.bin/brew-update-notifier.sh" | crontab -
fi
echo
echo "Notifier installed. You'll be notified of brew updates at 11am every day."
echo "Checking for updates right now..."
~/.bin/brew-update-notifier.sh
| Fix notifier script not being made executable | Fix notifier script not being made executable
| Shell | mit | ntpeters/homebrew-notifier | shell | ## Code Before:
NOTIFIER_URL=https://raw.githubusercontent.com/grantovich/homebrew-notifier/master/notifier.sh
brew install terminal-notifier
mkdir -p ~/.bin
curl -fsS $NOTIFIER_URL > ~/.bin/brew-update-notifier.sh
if crontab -l | grep -q 'brew-update-notifier'; then
echo 'Crontab entry already exists, skipping...'
else
echo "0 11 * * * PATH=/usr/local/bin:\$PATH $(echo ~)/.bin/brew-update-notifier.sh" | crontab -
fi
echo
echo "Notifier installed. You'll be notified of brew updates at 11am every day."
echo "Checking for updates right now..."
~/.bin/brew-update-notifier.sh
## Instruction:
Fix notifier script not being made executable
## Code After:
NOTIFIER_URL=https://raw.githubusercontent.com/grantovich/homebrew-notifier/master/notifier.sh
brew install terminal-notifier
mkdir -p ~/.bin
curl -fsS $NOTIFIER_URL > ~/.bin/brew-update-notifier.sh
chmod +x ~/.bin/brew-update-notifier.sh
if crontab -l | grep -q 'brew-update-notifier'; then
echo 'Crontab entry already exists, skipping...'
else
echo "0 11 * * * PATH=/usr/local/bin:\$PATH $(echo ~)/.bin/brew-update-notifier.sh" | crontab -
fi
echo
echo "Notifier installed. You'll be notified of brew updates at 11am every day."
echo "Checking for updates right now..."
~/.bin/brew-update-notifier.sh
|
NOTIFIER_URL=https://raw.githubusercontent.com/grantovich/homebrew-notifier/master/notifier.sh
brew install terminal-notifier
mkdir -p ~/.bin
curl -fsS $NOTIFIER_URL > ~/.bin/brew-update-notifier.sh
+ chmod +x ~/.bin/brew-update-notifier.sh
if crontab -l | grep -q 'brew-update-notifier'; then
echo 'Crontab entry already exists, skipping...'
else
echo "0 11 * * * PATH=/usr/local/bin:\$PATH $(echo ~)/.bin/brew-update-notifier.sh" | crontab -
fi
echo
echo "Notifier installed. You'll be notified of brew updates at 11am every day."
echo "Checking for updates right now..."
~/.bin/brew-update-notifier.sh | 1 | 0.058824 | 1 | 0 |
5605b61c0815756a756b8dc0ac12b45f6506fc5b | debexpo/templates/plugins/controlfields/html.mako | debexpo/templates/plugins/controlfields/html.mako | <div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
<div class="qa-content">
<dl>
%for field, contents in sorted(o.rich_data.items()):
<dt>${field}</dt>
<dd><a href="${contents}">${contents}</a></dd>
%endfor
</dl>
</div>
%endif
| <div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
<div class="qa-content">
<dl>
%for field, contents in sorted(o.rich_data.items()):
<dt>${field}</dt>
<dd><a href="${contents}" rel="nofollow">${contents}</a></dd>
%endfor
</dl>
</div>
%endif
| Make us unattractive for link spam | Make us unattractive for link spam
| Mako | mit | swvist/Debexpo,swvist/Debexpo,jonnylamb/debexpo,swvist/Debexpo,jonnylamb/debexpo,jadonk/debexpo,jonnylamb/debexpo,jadonk/debexpo,jadonk/debexpo | mako | ## Code Before:
<div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
<div class="qa-content">
<dl>
%for field, contents in sorted(o.rich_data.items()):
<dt>${field}</dt>
<dd><a href="${contents}">${contents}</a></dd>
%endfor
</dl>
</div>
%endif
## Instruction:
Make us unattractive for link spam
## Code After:
<div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
<div class="qa-content">
<dl>
%for field, contents in sorted(o.rich_data.items()):
<dt>${field}</dt>
<dd><a href="${contents}" rel="nofollow">${contents}</a></dd>
%endfor
</dl>
</div>
%endif
| <div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
<div class="qa-content">
<dl>
%for field, contents in sorted(o.rich_data.items()):
<dt>${field}</dt>
- <dd><a href="${contents}">${contents}</a></dd>
+ <dd><a href="${contents}" rel="nofollow">${contents}</a></dd>
? +++++++++++++++
%endfor
</dl>
</div>
%endif | 2 | 0.153846 | 1 | 1 |
b791f8c35ca4489608d6895761873020c4a31c1e | word-count/src/lib.rs | word-count/src/lib.rs | use std::collections::HashMap;
pub fn word_count(phrase: &str) -> HashMap<String, u32> {
let phrase = phrase.to_lowercase();
let words = phrase.split(|c: char| !c.is_alphanumeric())
.filter(|s| !s.is_empty())
.map(|w| w.to_string())
.collect::<Vec<_>>();
let mut word_counts = HashMap::new();
for word in &words {
if word_counts.contains_key(word) {
continue;
}
let count = words.iter().filter(|&w| { w == word }).count() as u32;
word_counts.insert(word.clone(), count);
}
word_counts
}
| use std::collections::HashMap;
pub fn word_count(phrase: &str) -> HashMap<String, u32> {
phrase.to_lowercase()
.split(|c: char| !c.is_alphanumeric())
.filter(|s| !s.is_empty())
.map(|w| w.to_string())
.fold(HashMap::new(), |mut acc, w| {
*acc.entry(w).or_insert(0) += 1;
acc
})
}
| Improve solution for Word Count | Improve solution for Word Count
| Rust | mit | attilahorvath/exercism-rust | rust | ## Code Before:
use std::collections::HashMap;
pub fn word_count(phrase: &str) -> HashMap<String, u32> {
let phrase = phrase.to_lowercase();
let words = phrase.split(|c: char| !c.is_alphanumeric())
.filter(|s| !s.is_empty())
.map(|w| w.to_string())
.collect::<Vec<_>>();
let mut word_counts = HashMap::new();
for word in &words {
if word_counts.contains_key(word) {
continue;
}
let count = words.iter().filter(|&w| { w == word }).count() as u32;
word_counts.insert(word.clone(), count);
}
word_counts
}
## Instruction:
Improve solution for Word Count
## Code After:
use std::collections::HashMap;
pub fn word_count(phrase: &str) -> HashMap<String, u32> {
phrase.to_lowercase()
.split(|c: char| !c.is_alphanumeric())
.filter(|s| !s.is_empty())
.map(|w| w.to_string())
.fold(HashMap::new(), |mut acc, w| {
*acc.entry(w).or_insert(0) += 1;
acc
})
}
| use std::collections::HashMap;
pub fn word_count(phrase: &str) -> HashMap<String, u32> {
- let phrase = phrase.to_lowercase();
? ------------- -
+ phrase.to_lowercase()
- let words = phrase.split(|c: char| !c.is_alphanumeric())
? --- ----- - ^^^^^^
+ .split(|c: char| !c.is_alphanumeric())
? ^
.filter(|s| !s.is_empty())
.map(|w| w.to_string())
+ .fold(HashMap::new(), |mut acc, w| {
+ *acc.entry(w).or_insert(0) += 1;
+ acc
- .collect::<Vec<_>>();
-
- let mut word_counts = HashMap::new();
-
- for word in &words {
- if word_counts.contains_key(word) {
- continue;
- }
+ })
? +
-
- let count = words.iter().filter(|&w| { w == word }).count() as u32;
-
- word_counts.insert(word.clone(), count);
- }
-
- word_counts
} | 23 | 1 | 6 | 17 |
841872cdfdab993e70ac9e35ea26b87086575901 | src/ParameterResolver/TypeHintResolver.php | src/ParameterResolver/TypeHintResolver.php | <?php declare(strict_types=1);
namespace Invoker\ParameterResolver;
use ReflectionFunctionAbstract;
use ReflectionNamedType;
/**
* Inject entries using type-hints.
*
* Tries to match type-hints with the parameters provided.
*/
class TypeHintResolver implements ParameterResolver
{
public function getParameters(
ReflectionFunctionAbstract $reflection,
array $providedParameters,
array $resolvedParameters
): array {
$parameters = $reflection->getParameters();
// Skip parameters already resolved
if (! empty($resolvedParameters)) {
$parameters = array_diff_key($parameters, $resolvedParameters);
}
foreach ($parameters as $index => $parameter) {
$parameterType = $parameter->getType();
if (! $parameterType) {
// No type
continue;
}
if ($parameterType->isBuiltin()) {
// Primitive types are not supported
continue;
}
if (! $parameterType instanceof ReflectionNamedType) {
// Union types are not supported
continue;
}
$parameterClass = $parameterType->getName();
if ($parameterClass === 'self') {
$parameterClass = $parameter->getDeclaringClass()->getName();
}
if (array_key_exists($parameterClass, $providedParameters)) {
$resolvedParameters[$index] = $providedParameters[$parameterClass];
}
}
return $resolvedParameters;
}
}
| <?php declare(strict_types=1);
namespace Invoker\ParameterResolver;
use ReflectionFunctionAbstract;
use ReflectionNamedType;
/**
* Inject entries using type-hints.
*
* Tries to match type-hints with the parameters provided.
*/
class TypeHintResolver implements ParameterResolver
{
public function getParameters(
ReflectionFunctionAbstract $reflection,
array $providedParameters,
array $resolvedParameters
): array {
$parameters = $reflection->getParameters();
// Skip parameters already resolved
if (! empty($resolvedParameters)) {
$parameters = array_diff_key($parameters, $resolvedParameters);
}
foreach ($parameters as $index => $parameter) {
$parameterType = $parameter->getType();
if (! $parameterType) {
// No type
continue;
}
if (! $parameterType instanceof ReflectionNamedType) {
// Union types are not supported
continue;
}
if ($parameterType->isBuiltin()) {
// Primitive types are not supported
continue;
}
$parameterClass = $parameterType->getName();
if ($parameterClass === 'self') {
$parameterClass = $parameter->getDeclaringClass()->getName();
}
if (array_key_exists($parameterClass, $providedParameters)) {
$resolvedParameters[$index] = $providedParameters[$parameterClass];
}
}
return $resolvedParameters;
}
}
| Switch condition order to support PHP 8 | Switch condition order to support PHP 8 | PHP | mit | PHP-DI/Invoker | php | ## Code Before:
<?php declare(strict_types=1);
namespace Invoker\ParameterResolver;
use ReflectionFunctionAbstract;
use ReflectionNamedType;
/**
* Inject entries using type-hints.
*
* Tries to match type-hints with the parameters provided.
*/
class TypeHintResolver implements ParameterResolver
{
public function getParameters(
ReflectionFunctionAbstract $reflection,
array $providedParameters,
array $resolvedParameters
): array {
$parameters = $reflection->getParameters();
// Skip parameters already resolved
if (! empty($resolvedParameters)) {
$parameters = array_diff_key($parameters, $resolvedParameters);
}
foreach ($parameters as $index => $parameter) {
$parameterType = $parameter->getType();
if (! $parameterType) {
// No type
continue;
}
if ($parameterType->isBuiltin()) {
// Primitive types are not supported
continue;
}
if (! $parameterType instanceof ReflectionNamedType) {
// Union types are not supported
continue;
}
$parameterClass = $parameterType->getName();
if ($parameterClass === 'self') {
$parameterClass = $parameter->getDeclaringClass()->getName();
}
if (array_key_exists($parameterClass, $providedParameters)) {
$resolvedParameters[$index] = $providedParameters[$parameterClass];
}
}
return $resolvedParameters;
}
}
## Instruction:
Switch condition order to support PHP 8
## Code After:
<?php declare(strict_types=1);
namespace Invoker\ParameterResolver;
use ReflectionFunctionAbstract;
use ReflectionNamedType;
/**
* Inject entries using type-hints.
*
* Tries to match type-hints with the parameters provided.
*/
class TypeHintResolver implements ParameterResolver
{
public function getParameters(
ReflectionFunctionAbstract $reflection,
array $providedParameters,
array $resolvedParameters
): array {
$parameters = $reflection->getParameters();
// Skip parameters already resolved
if (! empty($resolvedParameters)) {
$parameters = array_diff_key($parameters, $resolvedParameters);
}
foreach ($parameters as $index => $parameter) {
$parameterType = $parameter->getType();
if (! $parameterType) {
// No type
continue;
}
if (! $parameterType instanceof ReflectionNamedType) {
// Union types are not supported
continue;
}
if ($parameterType->isBuiltin()) {
// Primitive types are not supported
continue;
}
$parameterClass = $parameterType->getName();
if ($parameterClass === 'self') {
$parameterClass = $parameter->getDeclaringClass()->getName();
}
if (array_key_exists($parameterClass, $providedParameters)) {
$resolvedParameters[$index] = $providedParameters[$parameterClass];
}
}
return $resolvedParameters;
}
}
| <?php declare(strict_types=1);
namespace Invoker\ParameterResolver;
use ReflectionFunctionAbstract;
use ReflectionNamedType;
/**
* Inject entries using type-hints.
*
* Tries to match type-hints with the parameters provided.
*/
class TypeHintResolver implements ParameterResolver
{
public function getParameters(
ReflectionFunctionAbstract $reflection,
array $providedParameters,
array $resolvedParameters
): array {
$parameters = $reflection->getParameters();
// Skip parameters already resolved
if (! empty($resolvedParameters)) {
$parameters = array_diff_key($parameters, $resolvedParameters);
}
foreach ($parameters as $index => $parameter) {
$parameterType = $parameter->getType();
if (! $parameterType) {
// No type
continue;
}
+ if (! $parameterType instanceof ReflectionNamedType) {
+ // Union types are not supported
+ continue;
+ }
if ($parameterType->isBuiltin()) {
// Primitive types are not supported
- continue;
- }
- if (! $parameterType instanceof ReflectionNamedType) {
- // Union types are not supported
continue;
}
$parameterClass = $parameterType->getName();
if ($parameterClass === 'self') {
$parameterClass = $parameter->getDeclaringClass()->getName();
}
if (array_key_exists($parameterClass, $providedParameters)) {
$resolvedParameters[$index] = $providedParameters[$parameterClass];
}
}
return $resolvedParameters;
}
} | 8 | 0.148148 | 4 | 4 |
a8f44e52c36e7dee41d2e6a913e83e1d9bb9c1cc | sbr/folder_free.c | sbr/folder_free.c |
/*
* folder_free.c -- free a folder/message structure
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
void
folder_free (struct msgs *mp)
{
size_t i;
bvector_t *v;
if (!mp)
return;
if (mp->foldpath)
free (mp->foldpath);
/* free the sequence names */
for (i = 0; i < svector_size (mp->msgattrs); i++)
free (svector_at (mp->msgattrs, i));
svector_free (mp->msgattrs);
for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
bvector_free (*v);
}
free (mp->msgstats);
/* Close/free the sequence file if it is open */
if (mp->seqhandle)
lkfclosedata (mp->seqhandle, mp->seqname);
if (mp->seqname)
free (mp->seqname);
bvector_free (mp->attrstats);
free (mp); /* free main folder structure */
}
|
/*
* folder_free.c -- free a folder/message structure
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
#include <h/utils.h>
void
folder_free (struct msgs *mp)
{
size_t i;
bvector_t *v;
if (!mp)
return;
mh_xfree(mp->foldpath);
/* free the sequence names */
for (i = 0; i < svector_size (mp->msgattrs); i++)
free (svector_at (mp->msgattrs, i));
svector_free (mp->msgattrs);
for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
bvector_free (*v);
}
free (mp->msgstats);
/* Close/free the sequence file if it is open */
if (mp->seqhandle)
lkfclosedata (mp->seqhandle, mp->seqname);
mh_xfree(mp->seqname);
bvector_free (mp->attrstats);
free (mp); /* free main folder structure */
}
| Replace `if (p) free(p)' with `mh_xfree(p)'. | Replace `if (p) free(p)' with `mh_xfree(p)'.
| C | bsd-3-clause | mcr/nmh,mcr/nmh | c | ## Code Before:
/*
* folder_free.c -- free a folder/message structure
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
void
folder_free (struct msgs *mp)
{
size_t i;
bvector_t *v;
if (!mp)
return;
if (mp->foldpath)
free (mp->foldpath);
/* free the sequence names */
for (i = 0; i < svector_size (mp->msgattrs); i++)
free (svector_at (mp->msgattrs, i));
svector_free (mp->msgattrs);
for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
bvector_free (*v);
}
free (mp->msgstats);
/* Close/free the sequence file if it is open */
if (mp->seqhandle)
lkfclosedata (mp->seqhandle, mp->seqname);
if (mp->seqname)
free (mp->seqname);
bvector_free (mp->attrstats);
free (mp); /* free main folder structure */
}
## Instruction:
Replace `if (p) free(p)' with `mh_xfree(p)'.
## Code After:
/*
* folder_free.c -- free a folder/message structure
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
#include <h/utils.h>
void
folder_free (struct msgs *mp)
{
size_t i;
bvector_t *v;
if (!mp)
return;
mh_xfree(mp->foldpath);
/* free the sequence names */
for (i = 0; i < svector_size (mp->msgattrs); i++)
free (svector_at (mp->msgattrs, i));
svector_free (mp->msgattrs);
for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
bvector_free (*v);
}
free (mp->msgstats);
/* Close/free the sequence file if it is open */
if (mp->seqhandle)
lkfclosedata (mp->seqhandle, mp->seqname);
mh_xfree(mp->seqname);
bvector_free (mp->attrstats);
free (mp); /* free main folder structure */
}
|
/*
* folder_free.c -- free a folder/message structure
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
+ #include <h/utils.h>
void
folder_free (struct msgs *mp)
{
size_t i;
bvector_t *v;
if (!mp)
return;
- if (mp->foldpath)
? ^ ^
+ mh_xfree(mp->foldpath);
? ^^^^ ^^^ +
- free (mp->foldpath);
/* free the sequence names */
for (i = 0; i < svector_size (mp->msgattrs); i++)
free (svector_at (mp->msgattrs, i));
svector_free (mp->msgattrs);
for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
bvector_free (*v);
}
free (mp->msgstats);
/* Close/free the sequence file if it is open */
if (mp->seqhandle)
lkfclosedata (mp->seqhandle, mp->seqname);
- if (mp->seqname)
- free (mp->seqname);
? ^ -
+ mh_xfree(mp->seqname);
? ^^^^
bvector_free (mp->attrstats);
free (mp); /* free main folder structure */
} | 7 | 0.155556 | 3 | 4 |
b5c4116003fb1e0b7b36ecf649a59e721fdc320d | examples/driver/my_driver.sv | examples/driver/my_driver.sv | class my_driver extends uvm_driver #(my_item);
virtual my_interface vif;
`uvm_component_utils(my_driver)
function new(string name="my_driver", uvm_component parent=null);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
assert (uvm_config_db#(virtual my_interface)::get(this, "", "ifc", vif) && vif != null)
else `uvm_fatal("DRIVER_VIF_NOT_FOUND", "Did not find virtual my_interface 'vif' in the uvm_config_db")
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork drive_thread(); join_none
endtask
virtual task drive_thread();
forever begin
#1;
seq_item_port.get(req); // seq_item_port and req are inherited from uvm_driver
vif.foo = req.foo;
end
endtask
endclass
| class my_driver extends uvm_driver #(my_item);
virtual my_interface vif;
`uvm_component_utils(my_driver)
function new(string name="my_driver", uvm_component parent=null);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
assert (uvm_config_db#(virtual my_interface)::get(this, "", "ifc", vif) && vif != null)
else `uvm_fatal("DRIVER_VIF_NOT_FOUND", "Did not find virtual my_interface 'vif' in the uvm_config_db")
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork drive_thread(); join_none
endtask
virtual task drive_thread();
forever begin
#1;
seq_item_port.get_next_item(req); // seq_item_port and req are inherited from uvm_driver
vif.foo = req.foo;
seq_item_port.item_done();
end
endtask
endclass
| Use proper get_next_item()/item_done() calls in driver example. | Use proper get_next_item()/item_done() calls in driver example.
| SystemVerilog | apache-2.0 | cquickstad/uvm_unit,cquickstad/uvm_unit,cquickstad/uvm_unit | systemverilog | ## Code Before:
class my_driver extends uvm_driver #(my_item);
virtual my_interface vif;
`uvm_component_utils(my_driver)
function new(string name="my_driver", uvm_component parent=null);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
assert (uvm_config_db#(virtual my_interface)::get(this, "", "ifc", vif) && vif != null)
else `uvm_fatal("DRIVER_VIF_NOT_FOUND", "Did not find virtual my_interface 'vif' in the uvm_config_db")
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork drive_thread(); join_none
endtask
virtual task drive_thread();
forever begin
#1;
seq_item_port.get(req); // seq_item_port and req are inherited from uvm_driver
vif.foo = req.foo;
end
endtask
endclass
## Instruction:
Use proper get_next_item()/item_done() calls in driver example.
## Code After:
class my_driver extends uvm_driver #(my_item);
virtual my_interface vif;
`uvm_component_utils(my_driver)
function new(string name="my_driver", uvm_component parent=null);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
assert (uvm_config_db#(virtual my_interface)::get(this, "", "ifc", vif) && vif != null)
else `uvm_fatal("DRIVER_VIF_NOT_FOUND", "Did not find virtual my_interface 'vif' in the uvm_config_db")
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork drive_thread(); join_none
endtask
virtual task drive_thread();
forever begin
#1;
seq_item_port.get_next_item(req); // seq_item_port and req are inherited from uvm_driver
vif.foo = req.foo;
seq_item_port.item_done();
end
endtask
endclass
| class my_driver extends uvm_driver #(my_item);
virtual my_interface vif;
`uvm_component_utils(my_driver)
function new(string name="my_driver", uvm_component parent=null);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
assert (uvm_config_db#(virtual my_interface)::get(this, "", "ifc", vif) && vif != null)
else `uvm_fatal("DRIVER_VIF_NOT_FOUND", "Did not find virtual my_interface 'vif' in the uvm_config_db")
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork drive_thread(); join_none
endtask
virtual task drive_thread();
forever begin
#1;
- seq_item_port.get(req); // seq_item_port and req are inherited from uvm_driver
+ seq_item_port.get_next_item(req); // seq_item_port and req are inherited from uvm_driver
? ++++++++++
vif.foo = req.foo;
+ seq_item_port.item_done();
end
endtask
endclass | 3 | 0.111111 | 2 | 1 |
b862848c53a2e702dae64f32820c0c37a9eccf82 | quantum/conf/dhcp_agent.ini | quantum/conf/dhcp_agent.ini | {% set quantum = pillar['openstack']['quantum'] -%}
[DEFAULT]
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
enable_metadata_network = True
dnsmasq_config_file = /etc/quantum/dnsmasq.conf
dhcp_domain={{ quantum['network']['domain'] }}
| {% set quantum = pillar['openstack']['quantum'] -%}
{% set nova = openstack['nova'] -%}
[DEFAULT]
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
enable_metadata_network = True
dnsmasq_config_file = /etc/quantum/dnsmasq.conf
dhcp_domain={{ quantum['network']['domain'] }}
metadata_ip={{nova['metadata']['server']}} | Add metadata port to dhcp config | Add metadata port to dhcp config
| INI | bsd-2-clause | jahkeup/salt-openstack,jahkeup/salt-openstack | ini | ## Code Before:
{% set quantum = pillar['openstack']['quantum'] -%}
[DEFAULT]
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
enable_metadata_network = True
dnsmasq_config_file = /etc/quantum/dnsmasq.conf
dhcp_domain={{ quantum['network']['domain'] }}
## Instruction:
Add metadata port to dhcp config
## Code After:
{% set quantum = pillar['openstack']['quantum'] -%}
{% set nova = openstack['nova'] -%}
[DEFAULT]
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
enable_metadata_network = True
dnsmasq_config_file = /etc/quantum/dnsmasq.conf
dhcp_domain={{ quantum['network']['domain'] }}
metadata_ip={{nova['metadata']['server']}} | {% set quantum = pillar['openstack']['quantum'] -%}
+ {% set nova = openstack['nova'] -%}
+
[DEFAULT]
interface_driver = quantum.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
enable_metadata_network = True
dnsmasq_config_file = /etc/quantum/dnsmasq.conf
dhcp_domain={{ quantum['network']['domain'] }}
+ metadata_ip={{nova['metadata']['server']}} | 3 | 0.375 | 3 | 0 |
aa4f352b187bfeecb3f72791f70a0cb95f6e5254 | .travis.yml | .travis.yml | language: python
python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- pypy
- pypy3
addons:
apt:
packages:
- xcb-proto
- ghc
- cabal-install
- happy
- alex
- x11-apps
- xvfb
install:
- cabal update
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- pip install -r requirements.txt
script: "make -j3 check"
sudo: required
dist: trusty
| language: python
python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
addons:
apt:
packages:
- xcb-proto
- ghc
- cabal-install
- happy
- alex
- x11-apps
- xvfb
install:
- cabal update
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- pip install -r requirements.txt
script: "make -j3 check"
# pypy and pypy3 are currently not available in sudo-less Trusty builds, when
# available, we can switch to those
sudo: required
dist: trusty
| Add 3.6 Python, move to sudo-less trusty | Travis: Add 3.6 Python, move to sudo-less trusty
| YAML | apache-2.0 | tych0/xcffib | yaml | ## Code Before:
language: python
python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- pypy
- pypy3
addons:
apt:
packages:
- xcb-proto
- ghc
- cabal-install
- happy
- alex
- x11-apps
- xvfb
install:
- cabal update
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- pip install -r requirements.txt
script: "make -j3 check"
sudo: required
dist: trusty
## Instruction:
Travis: Add 3.6 Python, move to sudo-less trusty
## Code After:
language: python
python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
addons:
apt:
packages:
- xcb-proto
- ghc
- cabal-install
- happy
- alex
- x11-apps
- xvfb
install:
- cabal update
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- pip install -r requirements.txt
script: "make -j3 check"
# pypy and pypy3 are currently not available in sudo-less Trusty builds, when
# available, we can switch to those
sudo: required
dist: trusty
| language: python
python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
+ - 3.6
- pypy
- pypy3
addons:
apt:
packages:
- xcb-proto
- ghc
- cabal-install
- happy
- alex
- x11-apps
- xvfb
install:
- cabal update
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- pip install -r requirements.txt
script: "make -j3 check"
+ # pypy and pypy3 are currently not available in sudo-less Trusty builds, when
+ # available, we can switch to those
sudo: required
dist: trusty | 3 | 0.09375 | 3 | 0 |
b855475599eef41c36fa9f2ced516aee32c4ade8 | application/traits/currentMember.php | application/traits/currentMember.php | <?php
trait Trait_currentMember
{
protected $_current_member = null;
protected function _checkCurrentMember()
{
if(isset($_SESSION['connected_user_id']))
{
$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
$this->_current_member->prop('last_login', date('Y-m-d H:i:s'));
Model_Users::update($this->_current_member);
if($this->_current_member->prop('is_banned'))
$this->_current_member = new Model_Users();
}
else
$this->_current_member = new Model_Users();
Library_i18n::defineLocale($this->_current_member);
\Eliya\Tpl::set(['current_member' => $this->_current_member]);
if(!isset($_SESSION['token_logout']))
$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
}
protected function _redirectToCurrentMemberProfile()
{
$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
exit;
}
} | <?php
trait Trait_currentMember
{
protected $_current_member = null;
protected function _checkCurrentMember()
{
if(isset($_SESSION['connected_user_id']))
{
$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
$this->_current_member->prop('last_login', date('Y-m-d H:i:s'));
$this->_current_member->load('user_group');
$this->_current_member->load('locale_website');
$this->_current_member->load('locales_comics');
$this->_current_member->load('follows');
Model_Users::update($this->_current_member);
if($this->_current_member->prop('is_banned'))
$this->_current_member = new Model_Users();
}
else
$this->_current_member = new Model_Users();
Library_i18n::defineLocale($this->_current_member);
\Eliya\Tpl::set(['current_member' => $this->_current_member]);
if(!isset($_SESSION['token_logout']))
$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
}
protected function _redirectToCurrentMemberProfile()
{
$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
exit;
}
} | Fix bug when following an user | Fix bug when following an user
| PHP | mit | alexandre-desequeira/ShyComics,adrien-gueret/ShyComics,Tatane58/ShyComics,Tatane58/ShyComics,adrien-gueret/ShyComics,alexandre-desequeira/ShyComics | php | ## Code Before:
<?php
trait Trait_currentMember
{
protected $_current_member = null;
protected function _checkCurrentMember()
{
if(isset($_SESSION['connected_user_id']))
{
$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
$this->_current_member->prop('last_login', date('Y-m-d H:i:s'));
Model_Users::update($this->_current_member);
if($this->_current_member->prop('is_banned'))
$this->_current_member = new Model_Users();
}
else
$this->_current_member = new Model_Users();
Library_i18n::defineLocale($this->_current_member);
\Eliya\Tpl::set(['current_member' => $this->_current_member]);
if(!isset($_SESSION['token_logout']))
$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
}
protected function _redirectToCurrentMemberProfile()
{
$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
exit;
}
}
## Instruction:
Fix bug when following an user
## Code After:
<?php
trait Trait_currentMember
{
protected $_current_member = null;
protected function _checkCurrentMember()
{
if(isset($_SESSION['connected_user_id']))
{
$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
$this->_current_member->prop('last_login', date('Y-m-d H:i:s'));
$this->_current_member->load('user_group');
$this->_current_member->load('locale_website');
$this->_current_member->load('locales_comics');
$this->_current_member->load('follows');
Model_Users::update($this->_current_member);
if($this->_current_member->prop('is_banned'))
$this->_current_member = new Model_Users();
}
else
$this->_current_member = new Model_Users();
Library_i18n::defineLocale($this->_current_member);
\Eliya\Tpl::set(['current_member' => $this->_current_member]);
if(!isset($_SESSION['token_logout']))
$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
}
protected function _redirectToCurrentMemberProfile()
{
$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
exit;
}
} | <?php
trait Trait_currentMember
{
protected $_current_member = null;
protected function _checkCurrentMember()
{
if(isset($_SESSION['connected_user_id']))
{
$this->_current_member = Model_Users::getById($_SESSION['connected_user_id']);
$this->_current_member->prop('last_login', date('Y-m-d H:i:s'));
+
+ $this->_current_member->load('user_group');
+ $this->_current_member->load('locale_website');
+ $this->_current_member->load('locales_comics');
+ $this->_current_member->load('follows');
+
Model_Users::update($this->_current_member);
if($this->_current_member->prop('is_banned'))
$this->_current_member = new Model_Users();
}
else
$this->_current_member = new Model_Users();
Library_i18n::defineLocale($this->_current_member);
\Eliya\Tpl::set(['current_member' => $this->_current_member]);
if(!isset($_SESSION['token_logout']))
$_SESSION['token_logout'] = uniqid(rand(), true); //Protection contre les failles CSRF
}
protected function _redirectToCurrentMemberProfile()
{
$this->response->redirect($this->request->getBaseUrl().'profile/'.$this->_current_member->getId());
exit;
}
} | 6 | 0.176471 | 6 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.