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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9415bc992e9e2061917f5534fac16c88036c1630 | src/Wallabag/CoreBundle/Resources/views/themes/share.html.twig | src/Wallabag/CoreBundle/Resources/views/themes/share.html.twig | <html>
<head>
<title>{{ entry.title | raw }}</title>
<style>
body {
margin: 10px;
font-family: 'Roboto',Verdana,Geneva,sans-serif;
font-size: 16px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a,
a:hover,
a:visited {
color: #000;
}
article {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<header>
<h1>{{ entry.title | raw }}</h1>
</header>
<article>
{{ entry.content | raw }}
</article>
</body>
</html>
| <html>
<head>
<title>{{ entry.title | raw }}</title>
<style>
body {
margin: 10px;
font-family: 'Roboto',Verdana,Geneva,sans-serif;
font-size: 16px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a,
a:hover,
a:visited {
color: #000;
}
article {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<header>
<h1>{{ entry.title | raw }}</h1>
<span>{{ 'entry.view.left_menu.view_original_article'|trans }}: <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">{{ entry.domainName|removeWww }}</a></span>
</header>
<article>
{{ entry.content | raw }}
</article>
</body>
</html>
| Add original link in public view of the article | Add original link in public view of the article
| Twig | mit | shtrom/wallabag,X-dark/wallabag,egilli/wallabag,wallabag/wallabag,X-dark/wallabag,wallabag/wallabag,shtrom/wallabag,shtrom/wallabag,egilli/wallabag,egilli/wallabag,pmichelazzo/wallabag,pmichelazzo/wallabag,pmichelazzo/wallabag,X-dark/wallabag,wallabag/wallabag,pmichelazzo/wallabag,pmichelazzo/wallabag,shtrom/wallabag,egilli/wallabag,X-dark/wallabag,egilli/wallabag,shtrom/wallabag,X-dark/wallabag | twig | ## Code Before:
<html>
<head>
<title>{{ entry.title | raw }}</title>
<style>
body {
margin: 10px;
font-family: 'Roboto',Verdana,Geneva,sans-serif;
font-size: 16px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a,
a:hover,
a:visited {
color: #000;
}
article {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<header>
<h1>{{ entry.title | raw }}</h1>
</header>
<article>
{{ entry.content | raw }}
</article>
</body>
</html>
## Instruction:
Add original link in public view of the article
## Code After:
<html>
<head>
<title>{{ entry.title | raw }}</title>
<style>
body {
margin: 10px;
font-family: 'Roboto',Verdana,Geneva,sans-serif;
font-size: 16px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a,
a:hover,
a:visited {
color: #000;
}
article {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<header>
<h1>{{ entry.title | raw }}</h1>
<span>{{ 'entry.view.left_menu.view_original_article'|trans }}: <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">{{ entry.domainName|removeWww }}</a></span>
</header>
<article>
{{ entry.content | raw }}
</article>
</body>
</html>
| <html>
<head>
<title>{{ entry.title | raw }}</title>
<style>
body {
margin: 10px;
font-family: 'Roboto',Verdana,Geneva,sans-serif;
font-size: 16px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a,
a:hover,
a:visited {
color: #000;
}
article {
margin: 0 auto;
width: 600px;
}
</style>
</head>
<body>
<header>
<h1>{{ entry.title | raw }}</h1>
+ <span>{{ 'entry.view.left_menu.view_original_article'|trans }}: <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">{{ entry.domainName|removeWww }}</a></span>
</header>
<article>
{{ entry.content | raw }}
</article>
</body>
</html> | 1 | 0.025641 | 1 | 0 |
99ffa27f0e7bd2eae63c84a0ded567eba4a2394b | README.rst | README.rst | .. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.org/project/skeleton
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
License
=======
License is indicated in the project metadata (typically one or more
of the Trove classifiers). For more details, see `this explanation
<https://github.com/jaraco/skeleton/issues/1>`_.
Docs
====
There's `no good mechanism for publishing documentation
<https://github.com/pypa/python-packaging-user-guide/pull/266>`_
easily. If there's a documentation link above, it's probably
stale because PyPI-based documentation is deprecated. This
project may have documentation published at ReadTheDocs, but
probably not. Good luck finding it.
| .. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.org/project/skeleton
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
License
=======
License is indicated in the project metadata (typically one or more
of the Trove classifiers). For more details, see `this explanation
<https://github.com/jaraco/skeleton/issues/1>`_.
| Remove rant about docs. If there's no link to the docs, then this is the docs. | Remove rant about docs. If there's no link to the docs, then this is the docs.
| reStructuredText | mit | jaraco/jaraco.text,jaraco/calendra,jaraco/zipp,jaraco/backports.functools_lru_cache,jaraco/jaraco.functools,jaraco/jaraco.path,yougov/librarypaste,yougov/pmxbot,cherrypy/magicbus,jaraco/jaraco.stream,pytest-dev/pytest-runner,jaraco/jaraco.collections,yougov/librarypaste,hugovk/inflect.py,yougov/pmxbot,yougov/mettle,cherrypy/cheroot,jaraco/keyring,pwdyson/inflect.py,jaraco/portend,python/importlib_metadata,jaraco/irc,jaraco/jaraco.itertools,jaraco/rwt,jaraco/tempora,jaraco/jaraco.classes,yougov/mettle,yougov/pmxbot,jaraco/jaraco.logging,jaraco/jaraco.context,yougov/mettle,yougov/mettle,jaraco/hgtools,jazzband/inflect | restructuredtext | ## Code Before:
.. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.org/project/skeleton
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
License
=======
License is indicated in the project metadata (typically one or more
of the Trove classifiers). For more details, see `this explanation
<https://github.com/jaraco/skeleton/issues/1>`_.
Docs
====
There's `no good mechanism for publishing documentation
<https://github.com/pypa/python-packaging-user-guide/pull/266>`_
easily. If there's a documentation link above, it's probably
stale because PyPI-based documentation is deprecated. This
project may have documentation published at ReadTheDocs, but
probably not. Good luck finding it.
## Instruction:
Remove rant about docs. If there's no link to the docs, then this is the docs.
## Code After:
.. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.org/project/skeleton
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
License
=======
License is indicated in the project metadata (typically one or more
of the Trove classifiers). For more details, see `this explanation
<https://github.com/jaraco/skeleton/issues/1>`_.
| .. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.org/project/skeleton
.. image:: https://img.shields.io/pypi/pyversions/skeleton.svg
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
License
=======
License is indicated in the project metadata (typically one or more
of the Trove classifiers). For more details, see `this explanation
<https://github.com/jaraco/skeleton/issues/1>`_.
-
- Docs
- ====
-
- There's `no good mechanism for publishing documentation
- <https://github.com/pypa/python-packaging-user-guide/pull/266>`_
- easily. If there's a documentation link above, it's probably
- stale because PyPI-based documentation is deprecated. This
- project may have documentation published at ReadTheDocs, but
- probably not. Good luck finding it. | 10 | 0.37037 | 0 | 10 |
410222f5120844ddc47e7591c2ac08698df1929a | src/modules/findBestIcon.js | src/modules/findBestIcon.js | function findBestIcon(iconPaths) {
return new Promise(function (resolve, reject) {
resolve(iconPaths[0]);
});
}
module.exports = findBestIcon;
| const fs = require('fs');
function getFileSize(filePath) {
return new Promise((resolve, reject) => {
fs.stat(filePath, function(error, fileInfo) {
if (error) {
reject(error);
return;
}
const fileSizeKB = fileInfo.size / 1000;
resolve({
sizeKB: fileSizeKB,
path: filePath
});
});
});
}
function getFileSizes(filePaths) {
const getFileSizePromises = filePaths.map(getFileSize);
return Promise.all(getFileSizePromises)
}
function sortFileBySizes(fileSizes) {
return fileSizes.sort(function(a, b){
if (a.sizeKB < b.sizeKB) {
return 1;
} else {
return -1;
}
});
}
function findBestIcon(iconPaths) {
return getFileSizes(iconPaths).then(fileSizes => {
// sort descending
const sortedFileSizes = sortFileBySizes(fileSizes);
return sortedFileSizes[0].path;
});
}
module.exports = findBestIcon;
| Return icon path with largest size | Return icon path with largest size
| JavaScript | mit | jiahaog/page-icon | javascript | ## Code Before:
function findBestIcon(iconPaths) {
return new Promise(function (resolve, reject) {
resolve(iconPaths[0]);
});
}
module.exports = findBestIcon;
## Instruction:
Return icon path with largest size
## Code After:
const fs = require('fs');
function getFileSize(filePath) {
return new Promise((resolve, reject) => {
fs.stat(filePath, function(error, fileInfo) {
if (error) {
reject(error);
return;
}
const fileSizeKB = fileInfo.size / 1000;
resolve({
sizeKB: fileSizeKB,
path: filePath
});
});
});
}
function getFileSizes(filePaths) {
const getFileSizePromises = filePaths.map(getFileSize);
return Promise.all(getFileSizePromises)
}
function sortFileBySizes(fileSizes) {
return fileSizes.sort(function(a, b){
if (a.sizeKB < b.sizeKB) {
return 1;
} else {
return -1;
}
});
}
function findBestIcon(iconPaths) {
return getFileSizes(iconPaths).then(fileSizes => {
// sort descending
const sortedFileSizes = sortFileBySizes(fileSizes);
return sortedFileSizes[0].path;
});
}
module.exports = findBestIcon;
| + const fs = require('fs');
+
+ function getFileSize(filePath) {
+ return new Promise((resolve, reject) => {
+ fs.stat(filePath, function(error, fileInfo) {
+ if (error) {
+ reject(error);
+ return;
+ }
+
+ const fileSizeKB = fileInfo.size / 1000;
+ resolve({
+ sizeKB: fileSizeKB,
+ path: filePath
+ });
+ });
+ });
+ }
+
+ function getFileSizes(filePaths) {
+ const getFileSizePromises = filePaths.map(getFileSize);
+ return Promise.all(getFileSizePromises)
+ }
+
+ function sortFileBySizes(fileSizes) {
+ return fileSizes.sort(function(a, b){
+ if (a.sizeKB < b.sizeKB) {
+ return 1;
+ } else {
+ return -1;
+ }
+ });
+ }
+
function findBestIcon(iconPaths) {
- return new Promise(function (resolve, reject) {
- resolve(iconPaths[0]);
+ return getFileSizes(iconPaths).then(fileSizes => {
+ // sort descending
+ const sortedFileSizes = sortFileBySizes(fileSizes);
+ return sortedFileSizes[0].path;
});
}
module.exports = findBestIcon; | 40 | 5.714286 | 38 | 2 |
551524b73107dcc6600420607546c77a306f1629 | spec/carrierwave-azure_spec.rb | spec/carrierwave-azure_spec.rb | require 'spec_helper'
describe CarrierWave::Uploader::Base do
it 'should define azure as a storage engine' do
described_class.storage_engines[:azure].should == 'CarrierWave::Storage::Azure'
end
it 'should define azure options' do
should respond_to(:azure_storage_account_name)
should respond_to(:azure_storage_access_key)
should respond_to(:azure_storage_blob_host)
should respond_to(:azure_container)
end
end
| require 'spec_helper'
describe CarrierWave::Uploader::Base do
it 'should define azure as a storage engine' do
expect(described_class.storage_engines[:azure]).to eq 'CarrierWave::Storage::Azure'
end
it 'should define azure options' do
is_expected.to respond_to(:azure_storage_account_name)
is_expected.to respond_to(:azure_storage_access_key)
is_expected.to respond_to(:azure_storage_blob_host)
is_expected.to respond_to(:azure_container)
end
end
| Fix should => expect on RSpec | Fix should => expect on RSpec
| Ruby | mit | chenzeyu/carrierwave-azure,unosk/carrierwave-azure,joshtate04/carrierwave-azure,tsara27/carrierwave-azure | ruby | ## Code Before:
require 'spec_helper'
describe CarrierWave::Uploader::Base do
it 'should define azure as a storage engine' do
described_class.storage_engines[:azure].should == 'CarrierWave::Storage::Azure'
end
it 'should define azure options' do
should respond_to(:azure_storage_account_name)
should respond_to(:azure_storage_access_key)
should respond_to(:azure_storage_blob_host)
should respond_to(:azure_container)
end
end
## Instruction:
Fix should => expect on RSpec
## Code After:
require 'spec_helper'
describe CarrierWave::Uploader::Base do
it 'should define azure as a storage engine' do
expect(described_class.storage_engines[:azure]).to eq 'CarrierWave::Storage::Azure'
end
it 'should define azure options' do
is_expected.to respond_to(:azure_storage_account_name)
is_expected.to respond_to(:azure_storage_access_key)
is_expected.to respond_to(:azure_storage_blob_host)
is_expected.to respond_to(:azure_container)
end
end
| require 'spec_helper'
describe CarrierWave::Uploader::Base do
it 'should define azure as a storage engine' do
- described_class.storage_engines[:azure].should == 'CarrierWave::Storage::Azure'
? ^^ --- ^^
+ expect(described_class.storage_engines[:azure]).to eq 'CarrierWave::Storage::Azure'
? +++++++ + ^ ^^
end
it 'should define azure options' do
- should respond_to(:azure_storage_account_name)
? ^ ---
+ is_expected.to respond_to(:azure_storage_account_name)
? + ^^^^^^^^^^^
- should respond_to(:azure_storage_access_key)
? ^ ---
+ is_expected.to respond_to(:azure_storage_access_key)
? + ^^^^^^^^^^^
- should respond_to(:azure_storage_blob_host)
? ^ ---
+ is_expected.to respond_to(:azure_storage_blob_host)
? + ^^^^^^^^^^^
- should respond_to(:azure_container)
? ^ ---
+ is_expected.to respond_to(:azure_container)
? + ^^^^^^^^^^^
end
end | 10 | 0.714286 | 5 | 5 |
bc21578fada916cb10c4d94106a44495a31244b0 | appveyor.yml | appveyor.yml | image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 8
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install
test_script:
- node --version
- yarn build
- yarn test
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn"
| image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 8
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install
test_script:
- node --version
- yarn lint
- yarn flow
- yarn build
- yarn test
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn"
| Add more tasks to AppVeyor | Add more tasks to AppVeyor | YAML | mit | aickin/react,acdlite/react,mosoft521/react,jdlehman/react,rickbeerendonk/react,TheBlasfem/react,kaushik94/react,krasimir/react,STRML/react,Simek/react,ericyang321/react,tomocchino/react,dilidili/react,roth1002/react,syranide/react,apaatsio/react,dilidili/react,chicoxyzzy/react,acdlite/react,acdlite/react,camsong/react,jdlehman/react,krasimir/react,aickin/react,STRML/react,terminatorheart/react,dilidili/react,TheBlasfem/react,billfeller/react,chenglou/react,roth1002/react,acdlite/react,tomocchino/react,jzmq/react,roth1002/react,dilidili/react,ericyang321/react,empyrical/react,anushreesubramani/react,facebook/react,ericyang321/react,flarnie/react,jzmq/react,flarnie/react,anushreesubramani/react,mjackson/react,STRML/react,mjackson/react,ericyang321/react,trueadm/react,mosoft521/react,camsong/react,VioletLife/react,kaushik94/react,krasimir/react,krasimir/react,facebook/react,STRML/react,krasimir/react,rricard/react,VioletLife/react,jzmq/react,tomocchino/react,camsong/react,tomocchino/react,rickbeerendonk/react,nhunzaker/react,apaatsio/react,yiminghe/react,anushreesubramani/react,yungsters/react,rricard/react,apaatsio/react,flarnie/react,anushreesubramani/react,mjackson/react,chenglou/react,mjackson/react,chicoxyzzy/react,syranide/react,jameszhan/react,kaushik94/react,TheBlasfem/react,billfeller/react,jdlehman/react,yungsters/react,anushreesubramani/react,roth1002/react,Simek/react,VioletLife/react,prometheansacrifice/react,nhunzaker/react,trueadm/react,aickin/react,yungsters/react,billfeller/react,acdlite/react,chicoxyzzy/react,terminatorheart/react,VioletLife/react,prometheansacrifice/react,anushreesubramani/react,prometheansacrifice/react,mjackson/react,Simek/react,jzmq/react,syranide/react,Simek/react,nhunzaker/react,rricard/react,roth1002/react,camsong/react,apaatsio/react,jzmq/react,roth1002/react,yungsters/react,mjackson/react,cpojer/react,yiminghe/react,camsong/react,jameszhan/react,billfeller/react,cpojer/react,empyrical/react,anushreesubramani/react,flarnie/react,dilidili/react,prometheansacrifice/react,apaatsio/react,cpojer/react,apaatsio/react,jameszhan/react,jdlehman/react,trueadm/react,rricard/react,syranide/react,chicoxyzzy/react,glenjamin/react,terminatorheart/react,rickbeerendonk/react,kaushik94/react,terminatorheart/react,mosoft521/react,facebook/react,tomocchino/react,yiminghe/react,VioletLife/react,yiminghe/react,ArunTesco/react,aickin/react,prometheansacrifice/react,ArunTesco/react,flarnie/react,dilidili/react,acdlite/react,terminatorheart/react,jameszhan/react,dilidili/react,Simek/react,rickbeerendonk/react,aickin/react,yungsters/react,tomocchino/react,chenglou/react,camsong/react,ericyang321/react,facebook/react,rricard/react,camsong/react,flarnie/react,jdlehman/react,mosoft521/react,chenglou/react,apaatsio/react,nhunzaker/react,cpojer/react,facebook/react,rickbeerendonk/react,nhunzaker/react,terminatorheart/react,STRML/react,glenjamin/react,prometheansacrifice/react,glenjamin/react,empyrical/react,trueadm/react,empyrical/react,trueadm/react,flarnie/react,Simek/react,jzmq/react,yiminghe/react,facebook/react,billfeller/react,trueadm/react,yiminghe/react,krasimir/react,ericyang321/react,STRML/react,cpojer/react,TheBlasfem/react,empyrical/react,acdlite/react,yungsters/react,aickin/react,tomocchino/react,TheBlasfem/react,empyrical/react,chicoxyzzy/react,jdlehman/react,chenglou/react,rricard/react,rickbeerendonk/react,chicoxyzzy/react,kaushik94/react,jameszhan/react,yungsters/react,krasimir/react,mosoft521/react,cpojer/react,billfeller/react,jameszhan/react,cpojer/react,yiminghe/react,kaushik94/react,VioletLife/react,nhunzaker/react,jameszhan/react,roth1002/react,jzmq/react,kaushik94/react,mosoft521/react,trueadm/react,facebook/react,prometheansacrifice/react,STRML/react,chenglou/react,chicoxyzzy/react,chenglou/react,glenjamin/react,mjackson/react,jdlehman/react,rickbeerendonk/react,mosoft521/react,VioletLife/react,TheBlasfem/react,billfeller/react,ericyang321/react,Simek/react,glenjamin/react,glenjamin/react,aickin/react,glenjamin/react,empyrical/react,nhunzaker/react,ArunTesco/react | yaml | ## Code Before:
image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 8
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install
test_script:
- node --version
- yarn build
- yarn test
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn"
## Instruction:
Add more tasks to AppVeyor
## Code After:
image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 8
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install
test_script:
- node --version
- yarn lint
- yarn flow
- yarn build
- yarn test
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn"
| image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
matrix:
- nodejs_version: 8
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install
test_script:
- node --version
+ - yarn lint
+ - yarn flow
- yarn build
- yarn test
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn" | 2 | 0.054054 | 2 | 0 |
aa4ff683978b0940d4234be15c314879002688ab | run.sh | run.sh |
LINTLINES=$($WERCKER_STEP_ROOT/golint ./... | tee lint_results.txt | wc -l | tr -d " ")
cat lint_results.txt
if [ "$LINTLINES" -ge 10 ]; then echo "Time to tidy up: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge 5 ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
if [ "$LINTLINES" -eq 0 ]; then echo "Perfect: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
|
LINTLINES=$($WERCKER_STEP_ROOT/golint ./... | tee lint_results.txt | wc -l | tr -d " ")
cat lint_results.txt
if [ "$LINTLINES" -ge 10 ]; then echo "Time to tidy up: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge 5 ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
| Remove notification when there are no issues | Remove notification when there are no issues
| Shell | mit | wercker/step-golint,ainoya/step-golint | shell | ## Code Before:
LINTLINES=$($WERCKER_STEP_ROOT/golint ./... | tee lint_results.txt | wc -l | tr -d " ")
cat lint_results.txt
if [ "$LINTLINES" -ge 10 ]; then echo "Time to tidy up: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge 5 ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
if [ "$LINTLINES" -eq 0 ]; then echo "Perfect: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
## Instruction:
Remove notification when there are no issues
## Code After:
LINTLINES=$($WERCKER_STEP_ROOT/golint ./... | tee lint_results.txt | wc -l | tr -d " ")
cat lint_results.txt
if [ "$LINTLINES" -ge 10 ]; then echo "Time to tidy up: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge 5 ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
|
LINTLINES=$($WERCKER_STEP_ROOT/golint ./... | tee lint_results.txt | wc -l | tr -d " ")
cat lint_results.txt
if [ "$LINTLINES" -ge 10 ]; then echo "Time to tidy up: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge 5 ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi
- if [ "$LINTLINES" -eq 0 ]; then echo "Perfect: $LINTLINES lint warnings." > $WERCKER_REPORT_MESSAGE_FILE; fi | 1 | 0.142857 | 0 | 1 |
115897c91ebbc985e6aeab68a0a3c4769c49d33d | bin/build.sh | bin/build.sh | set -eu
# Call yourself with -h if no arguments
[[ -z $@ ]] && ./$0 -h && exit 1
while [[ $# -ge 1 ]]; do
key="$1"
case $key in
-h|--help)
echo -e "
Usage:
-h|--help \t\t Bring up this menu
-n|--name \t\t Hostname
--os (centos|ubuntu) \t Type of OS
"
exit
;;
-n|--name)
HOSTNAME=$2
shift; shift;
;;
esac
done
# Going to assume that no one is going to be running
# anything directly out of this folder
source bin/common.sh
# Sanity check
if [[ -z ${HOSTNAME+x} ]]; then
graceful_exit "Hostname not defined"
fi
log "Building: ${HOSTNAME}"
# Shared Vars setup ... for customization
SHARED_VARS=''
# Packer will dump the final product here
output_directory="vm_out"
test -e ${output_directory}
SHARED_vars="${SHARED_VARS}
-var output_directory=${output_directory}
-var hostname=${HOSTNAME}"
packer validate ${SHARED_VARS} ubuntu.json
packer build -force ${SHARED_VARS} ubuntu.json
| set -eu
##Parse long and short OPTIONS
OPTIONS=$(getopt -o hn: -l name:,os:,help -- "$@")
if [ $? != 0 ]; then
echo "Failed to parse arguments."
exit 1
fi
# Call yourself with -h if no arguments
[[ -z $@ ]] && ./$0 -h && exit 1
eval set -- "$OPTIONS"
while true; do
case "$1" in
-h|--help)
echo -e "
Usage:
-h|--help \t\t Bring up this menu
-n|--name \t\t Hostname
--os (centos|ubuntu) \t Type of OS
"
exit
;;
-n|--name)
HOSTNAME=$2
shift; shift;
;;
--os)
echo "$1 Can't do this function yet"
exit 1
;;
--)
shift
break
;;
*)
echo "Invalid option"
;;
esac
done
# Going to assume that no one is going to be running
# anything directly out of this folder
source bin/common.sh
# Sanity check
if [[ -z ${HOSTNAME+x} ]]; then
graceful_exit "Hostname not defined"
fi
log "Building: ${HOSTNAME}"
# Shared Vars setup ... for customization
SHARED_VARS=''
# Packer will dump the final product here
output_directory="vm_out"
test -e ${output_directory}
SHARED_vars="${SHARED_VARS}
-var output_directory=${output_directory}
-var hostname=${HOSTNAME}"
packer validate ${SHARED_VARS} ubuntu.json
packer build -force ${SHARED_VARS} ubuntu.json
| Fix invalid arguments causing infinite loop | Fix invalid arguments causing infinite loop
Also getopt offers much more flexibility with combining and ordering
options
| Shell | apache-2.0 | capusta/packer,capusta/packer,capusta/packer | shell | ## Code Before:
set -eu
# Call yourself with -h if no arguments
[[ -z $@ ]] && ./$0 -h && exit 1
while [[ $# -ge 1 ]]; do
key="$1"
case $key in
-h|--help)
echo -e "
Usage:
-h|--help \t\t Bring up this menu
-n|--name \t\t Hostname
--os (centos|ubuntu) \t Type of OS
"
exit
;;
-n|--name)
HOSTNAME=$2
shift; shift;
;;
esac
done
# Going to assume that no one is going to be running
# anything directly out of this folder
source bin/common.sh
# Sanity check
if [[ -z ${HOSTNAME+x} ]]; then
graceful_exit "Hostname not defined"
fi
log "Building: ${HOSTNAME}"
# Shared Vars setup ... for customization
SHARED_VARS=''
# Packer will dump the final product here
output_directory="vm_out"
test -e ${output_directory}
SHARED_vars="${SHARED_VARS}
-var output_directory=${output_directory}
-var hostname=${HOSTNAME}"
packer validate ${SHARED_VARS} ubuntu.json
packer build -force ${SHARED_VARS} ubuntu.json
## Instruction:
Fix invalid arguments causing infinite loop
Also getopt offers much more flexibility with combining and ordering
options
## Code After:
set -eu
##Parse long and short OPTIONS
OPTIONS=$(getopt -o hn: -l name:,os:,help -- "$@")
if [ $? != 0 ]; then
echo "Failed to parse arguments."
exit 1
fi
# Call yourself with -h if no arguments
[[ -z $@ ]] && ./$0 -h && exit 1
eval set -- "$OPTIONS"
while true; do
case "$1" in
-h|--help)
echo -e "
Usage:
-h|--help \t\t Bring up this menu
-n|--name \t\t Hostname
--os (centos|ubuntu) \t Type of OS
"
exit
;;
-n|--name)
HOSTNAME=$2
shift; shift;
;;
--os)
echo "$1 Can't do this function yet"
exit 1
;;
--)
shift
break
;;
*)
echo "Invalid option"
;;
esac
done
# Going to assume that no one is going to be running
# anything directly out of this folder
source bin/common.sh
# Sanity check
if [[ -z ${HOSTNAME+x} ]]; then
graceful_exit "Hostname not defined"
fi
log "Building: ${HOSTNAME}"
# Shared Vars setup ... for customization
SHARED_VARS=''
# Packer will dump the final product here
output_directory="vm_out"
test -e ${output_directory}
SHARED_vars="${SHARED_VARS}
-var output_directory=${output_directory}
-var hostname=${HOSTNAME}"
packer validate ${SHARED_VARS} ubuntu.json
packer build -force ${SHARED_VARS} ubuntu.json
| set -eu
+
+
+ ##Parse long and short OPTIONS
+ OPTIONS=$(getopt -o hn: -l name:,os:,help -- "$@")
+
+ if [ $? != 0 ]; then
+ echo "Failed to parse arguments."
+ exit 1
+ fi
# Call yourself with -h if no arguments
[[ -z $@ ]] && ./$0 -h && exit 1
- while [[ $# -ge 1 ]]; do
- key="$1"
+ eval set -- "$OPTIONS"
+ while true; do
- case $key in
? ^^^
+ case "$1" in
? + ^^
-h|--help)
echo -e "
Usage:
-h|--help \t\t Bring up this menu
-n|--name \t\t Hostname
--os (centos|ubuntu) \t Type of OS
"
exit
;;
- -n|--name)
+ -n|--name)
? ++++
- HOSTNAME=$2
+ HOSTNAME=$2
? ++++
- shift; shift;
+ shift; shift;
? ++++
;;
+ --os)
+ echo "$1 Can't do this function yet"
+ exit 1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "Invalid option"
+ ;;
esac
done
# Going to assume that no one is going to be running
# anything directly out of this folder
source bin/common.sh
# Sanity check
if [[ -z ${HOSTNAME+x} ]]; then
graceful_exit "Hostname not defined"
fi
log "Building: ${HOSTNAME}"
# Shared Vars setup ... for customization
SHARED_VARS=''
# Packer will dump the final product here
output_directory="vm_out"
test -e ${output_directory}
SHARED_vars="${SHARED_VARS}
-var output_directory=${output_directory}
-var hostname=${HOSTNAME}"
packer validate ${SHARED_VARS} ubuntu.json
packer build -force ${SHARED_VARS} ubuntu.json
| 32 | 0.680851 | 26 | 6 |
5706011db24fd98d86932e86bd60c5142edc152c | server/server.js | server/server.js | var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.set('port', (process.env.PORT || 3000));
app.use(bodyParser.json());
app.use(express.static(__dirname +'/../client'));
app.set('views',__dirname + '/../client');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Should be refactored to go under /api
// Also, probably, to be rehandled in an external routehandler/ctrlrs
app.get('/locations', function(req, res) {
res.send('locations go here');
});
app.post('/locations', function(req, res) {
res.send('something something');
});
app.listen(app.get('port'));
console.log('Server is now listening at port ' + app.get('port')); | var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var mongoose = require('mongoose');
// To use on Heroku, set the environment variable:
// $ heroku set:config MONGOLAB_URL=mongodb://user:password@mongolabstuff
var db = (process.env.MONGOLAB_URL || 'mongodb://localhost/ambits');
mongoose.connect(db);
var Location = require('./locations/locationSchema');
app.use(bodyParser.json());
app.use(express.static(__dirname +'/../client'));
app.set('views',__dirname + '/../client');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Should be refactored to go under /api
// Also, probably, to be rehandled in an external routehandler/ctrlrs
app.get('/locations', function(req, res) {
res.send('locations go here');
});
app.post('/locations', function(req, res) {
res.send('something something');
});
// DB testing paths; remove when endpoints are built
app.get('/db_post', function(req, res, next) {
var elapsed = Math.floor(Math.random()*100000);
var newLocation = new Location({
name: 'Testy McUserson',
geodata: elapsed
});
newLocation.save().then(function(newLocation) {
console.log('POSTED: ', newLocation);
res.json(newLocation);
}).catch(function(err) {
next(err);
});
});
app.get('/db', function(req, res, next) {
Location.find().then(function(locations) {
res.json(locations);
})
.catch(function(err) {
next(err);
})
});
// To use on Heroku, must use port provided by process.env:
var port = (process.env.PORT || 3000);
app.listen(port);
console.log('Server is now listening at port ' + port); | Verify mongo works with new schema and on Heroku, add db post testing path | Verify mongo works with new schema and on Heroku, add db post testing path
| JavaScript | mit | OmnipotentOnions/Boop,blakeFleck/Boop,CellularAnathema/ambits,smarty-sprouts/ambits,Rob0h/Boop,blakeFleck/Boop,CellularAnathema/ambits,Rob0h/Boop,smarty-sprouts/ambits,OmnipotentOnions/Boop | javascript | ## Code Before:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.set('port', (process.env.PORT || 3000));
app.use(bodyParser.json());
app.use(express.static(__dirname +'/../client'));
app.set('views',__dirname + '/../client');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Should be refactored to go under /api
// Also, probably, to be rehandled in an external routehandler/ctrlrs
app.get('/locations', function(req, res) {
res.send('locations go here');
});
app.post('/locations', function(req, res) {
res.send('something something');
});
app.listen(app.get('port'));
console.log('Server is now listening at port ' + app.get('port'));
## Instruction:
Verify mongo works with new schema and on Heroku, add db post testing path
## Code After:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var mongoose = require('mongoose');
// To use on Heroku, set the environment variable:
// $ heroku set:config MONGOLAB_URL=mongodb://user:password@mongolabstuff
var db = (process.env.MONGOLAB_URL || 'mongodb://localhost/ambits');
mongoose.connect(db);
var Location = require('./locations/locationSchema');
app.use(bodyParser.json());
app.use(express.static(__dirname +'/../client'));
app.set('views',__dirname + '/../client');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Should be refactored to go under /api
// Also, probably, to be rehandled in an external routehandler/ctrlrs
app.get('/locations', function(req, res) {
res.send('locations go here');
});
app.post('/locations', function(req, res) {
res.send('something something');
});
// DB testing paths; remove when endpoints are built
app.get('/db_post', function(req, res, next) {
var elapsed = Math.floor(Math.random()*100000);
var newLocation = new Location({
name: 'Testy McUserson',
geodata: elapsed
});
newLocation.save().then(function(newLocation) {
console.log('POSTED: ', newLocation);
res.json(newLocation);
}).catch(function(err) {
next(err);
});
});
app.get('/db', function(req, res, next) {
Location.find().then(function(locations) {
res.json(locations);
})
.catch(function(err) {
next(err);
})
});
// To use on Heroku, must use port provided by process.env:
var port = (process.env.PORT || 3000);
app.listen(port);
console.log('Server is now listening at port ' + port); | var express = require('express');
var bodyParser = require('body-parser');
var app = express();
- app.set('port', (process.env.PORT || 3000));
+ var mongoose = require('mongoose');
+
+ // To use on Heroku, set the environment variable:
+ // $ heroku set:config MONGOLAB_URL=mongodb://user:password@mongolabstuff
+ var db = (process.env.MONGOLAB_URL || 'mongodb://localhost/ambits');
+
+ mongoose.connect(db);
+ var Location = require('./locations/locationSchema');
+
app.use(bodyParser.json());
app.use(express.static(__dirname +'/../client'));
app.set('views',__dirname + '/../client');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
// Should be refactored to go under /api
// Also, probably, to be rehandled in an external routehandler/ctrlrs
-
app.get('/locations', function(req, res) {
res.send('locations go here');
});
app.post('/locations', function(req, res) {
res.send('something something');
});
+ // DB testing paths; remove when endpoints are built
+ app.get('/db_post', function(req, res, next) {
+ var elapsed = Math.floor(Math.random()*100000);
+ var newLocation = new Location({
+ name: 'Testy McUserson',
+ geodata: elapsed
+ });
+ newLocation.save().then(function(newLocation) {
+ console.log('POSTED: ', newLocation);
+ res.json(newLocation);
+ }).catch(function(err) {
+ next(err);
+ });
+
+ });
+
+ app.get('/db', function(req, res, next) {
+ Location.find().then(function(locations) {
+ res.json(locations);
+ })
+ .catch(function(err) {
+ next(err);
+ })
+ });
+
+ // To use on Heroku, must use port provided by process.env:
+ var port = (process.env.PORT || 3000);
- app.listen(app.get('port'));
? --------- --
+ app.listen(port);
- console.log('Server is now listening at port ' + app.get('port'));
? --------- --
+ console.log('Server is now listening at port ' + port); | 42 | 1.615385 | 38 | 4 |
2542a0ac6c4a34ffca670724aed6d7e0720134c5 | app/helpers/sessions_helper.rb | app/helpers/sessions_helper.rb | module SessionsHelper
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def unread_message
@conversations = Conversation.involving(current_user)
@conversations.each do |convo|
return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
end
end
end
| module SessionsHelper
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def unread_message
@conversations = Conversation.involving(current_user)
@conversations.each do |convo|
if convo.messages.present?
return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
end
end
end
end
| Fix logic in message helper method to handle no messages | Fix logic in message helper method to handle no messages
| Ruby | mit | ctrutmann/bootbook,ctrutmann/bootbook,ctrutmann/bootbook | ruby | ## Code Before:
module SessionsHelper
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def unread_message
@conversations = Conversation.involving(current_user)
@conversations.each do |convo|
return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
end
end
end
## Instruction:
Fix logic in message helper method to handle no messages
## Code After:
module SessionsHelper
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def unread_message
@conversations = Conversation.involving(current_user)
@conversations.each do |convo|
if convo.messages.present?
return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
end
end
end
end
| module SessionsHelper
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def unread_message
@conversations = Conversation.involving(current_user)
@conversations.each do |convo|
+ if convo.messages.present?
- return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
+ return true if convo.messages.last.read == false && convo.messages.last.user_id != current_user.id
? ++
+ end
end
end
end | 4 | 0.333333 | 3 | 1 |
bc3aee78bb5be3afa639b8c572273b662aea1721 | glue/tests/test_settings_helpers.py | glue/tests/test_settings_helpers.py | from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
settings.add('LIST', [1,2,3], list)
with patch('glue.config.settings', settings):
with patch('glue.config.CFG_DIR', tmpdir.strpath):
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
save_settings()
assert os.path.exists(os.path.join(tmpdir.strpath, 'settings.cfg'))
settings.STRING = 'red'
settings.INT = 3
settings.FLOAT = 4.5
settings.LIST = ['DDD', 'EE', 'F']
load_settings(force=True)
assert settings.STRING == 'blue'
assert settings.INT == 4
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
| from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
settings.add('LIST', [1,2,3], list)
with patch('glue.config.settings', settings):
with patch('glue.config.CFG_DIR', tmpdir.strpath):
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
settings.reset_defaults()
assert settings.STRING == 'green'
assert settings.INT == 3
assert settings.FLOAT == 5.5
assert settings.LIST == [1, 2, 3]
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
save_settings()
assert os.path.exists(os.path.join(tmpdir.strpath, 'settings.cfg'))
settings.reset_defaults()
settings.STRING = 'red'
settings.INT = 5
# Loading settings will only change settings that have not been
# changed from the defaults...
load_settings()
assert settings.STRING == 'red'
assert settings.INT == 5
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
# ... unless the ``force=True`` option is passed
load_settings(force=True)
assert settings.STRING == 'blue'
assert settings.INT == 4
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
| Improve unit test for settings helpers | Improve unit test for settings helpers | Python | bsd-3-clause | saimn/glue,stscieisenhamer/glue,stscieisenhamer/glue,saimn/glue | python | ## Code Before:
from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
settings.add('LIST', [1,2,3], list)
with patch('glue.config.settings', settings):
with patch('glue.config.CFG_DIR', tmpdir.strpath):
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
save_settings()
assert os.path.exists(os.path.join(tmpdir.strpath, 'settings.cfg'))
settings.STRING = 'red'
settings.INT = 3
settings.FLOAT = 4.5
settings.LIST = ['DDD', 'EE', 'F']
load_settings(force=True)
assert settings.STRING == 'blue'
assert settings.INT == 4
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
## Instruction:
Improve unit test for settings helpers
## Code After:
from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
settings.add('LIST', [1,2,3], list)
with patch('glue.config.settings', settings):
with patch('glue.config.CFG_DIR', tmpdir.strpath):
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
settings.reset_defaults()
assert settings.STRING == 'green'
assert settings.INT == 3
assert settings.FLOAT == 5.5
assert settings.LIST == [1, 2, 3]
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
save_settings()
assert os.path.exists(os.path.join(tmpdir.strpath, 'settings.cfg'))
settings.reset_defaults()
settings.STRING = 'red'
settings.INT = 5
# Loading settings will only change settings that have not been
# changed from the defaults...
load_settings()
assert settings.STRING == 'red'
assert settings.INT == 5
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
# ... unless the ``force=True`` option is passed
load_settings(force=True)
assert settings.STRING == 'blue'
assert settings.INT == 4
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC']
| from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
+
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
settings.add('LIST', [1,2,3], list)
with patch('glue.config.settings', settings):
with patch('glue.config.CFG_DIR', tmpdir.strpath):
settings.STRING = 'blue'
settings.INT = 4
settings.FLOAT = 3.5
settings.LIST = ['A', 'BB', 'CCC']
+ settings.reset_defaults()
+
+ assert settings.STRING == 'green'
+ assert settings.INT == 3
+ assert settings.FLOAT == 5.5
+ assert settings.LIST == [1, 2, 3]
+
+ settings.STRING = 'blue'
+ settings.INT = 4
+ settings.FLOAT = 3.5
+ settings.LIST = ['A', 'BB', 'CCC']
+
save_settings()
assert os.path.exists(os.path.join(tmpdir.strpath, 'settings.cfg'))
+ settings.reset_defaults()
+
settings.STRING = 'red'
- settings.INT = 3
? ^
+ settings.INT = 5
? ^
- settings.FLOAT = 4.5
- settings.LIST = ['DDD', 'EE', 'F']
+ # Loading settings will only change settings that have not been
+ # changed from the defaults...
+ load_settings()
+
+ assert settings.STRING == 'red'
+ assert settings.INT == 5
+ assert settings.FLOAT == 3.5
+ assert settings.LIST == ['A', 'BB', 'CCC']
+
+ # ... unless the ``force=True`` option is passed
load_settings(force=True)
assert settings.STRING == 'blue'
assert settings.INT == 4
assert settings.FLOAT == 3.5
assert settings.LIST == ['A', 'BB', 'CCC'] | 29 | 0.74359 | 26 | 3 |
763a71fe91248a77a30497b30b4ac970ab2cf309 | test/test_helper.rb | test/test_helper.rb | ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
require 'test/unit'
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
| require 'rubygems'
require 'active_support'
require 'test/unit'
require File.join(File.dirname(__FILE__), '..', 'lib', 'lucy')
| Remove unnecessary loading of Rails env | Remove unnecessary loading of Rails env
| Ruby | mit | toretore/lucy,oelmekki/lucy | ruby | ## Code Before:
ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
require 'test/unit'
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
## Instruction:
Remove unnecessary loading of Rails env
## Code After:
require 'rubygems'
require 'active_support'
require 'test/unit'
require File.join(File.dirname(__FILE__), '..', 'lib', 'lucy')
| + require 'rubygems'
+ require 'active_support'
- ENV['RAILS_ENV'] = 'test'
- ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
-
require 'test/unit'
- require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'lucy') | 7 | 1.4 | 3 | 4 |
9b1ec605a690cc083ce43a21eb8e9210f890d882 | src/cecs566_tth/Driver.java | src/cecs566_tth/Driver.java | package cecs566_tth;
public class Driver
{
public static void main(String [] args)
{
// System.out.println(Utils.translateTotalToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices("I leave twenty million dollars to my friendly cousin Bill."))));
// Integer [] targetNumbers = { 6,25,17,22 };
String matchingHash = Utils.findMatchingHash("BFQG");
System.out.println(matchingHash);
System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
}
}
| package cecs566_tth;
public class Driver
{
public static void main(String [] args)
{
String matchingHash = Utils.findMatchingHash("BFQG");
System.out.println(matchingHash);
System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
System.out.println(Utils.translateHashValueToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices(matchingHash))));
}
}
| Remove comments and fix function parameter for generating hash. | Remove comments and fix function parameter for generating hash.
| Java | mit | sdicken/cecs566_tth | java | ## Code Before:
package cecs566_tth;
public class Driver
{
public static void main(String [] args)
{
// System.out.println(Utils.translateTotalToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices("I leave twenty million dollars to my friendly cousin Bill."))));
// Integer [] targetNumbers = { 6,25,17,22 };
String matchingHash = Utils.findMatchingHash("BFQG");
System.out.println(matchingHash);
System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
}
}
## Instruction:
Remove comments and fix function parameter for generating hash.
## Code After:
package cecs566_tth;
public class Driver
{
public static void main(String [] args)
{
String matchingHash = Utils.findMatchingHash("BFQG");
System.out.println(matchingHash);
System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
System.out.println(Utils.translateHashValueToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices(matchingHash))));
}
}
| package cecs566_tth;
public class Driver
{
public static void main(String [] args)
{
- // System.out.println(Utils.translateTotalToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices("I leave twenty million dollars to my friendly cousin Bill."))));
- // Integer [] targetNumbers = { 6,25,17,22 };
String matchingHash = Utils.findMatchingHash("BFQG");
System.out.println(matchingHash);
System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
+ System.out.println(Utils.translateHashValueToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices(matchingHash))));
}
} | 3 | 0.214286 | 1 | 2 |
1d3b3e182b6270af1fb56ac5f5acf10809c51957 | .travis.yml | .travis.yml | language: c
compiler:
- gcc
- clang
# Change this to your needs
script: ./bootstrap.sh && make -j3
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep avahi avahi-sharp
- sudo apt-get install mono-mcs
| language: c
compiler:
- gcc
- clang
# Change this to your needs
script: ./bootstrap.sh && make -j3
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep avahi avahi-sharp
- sudo apt-get install python-gi gir1.2-gtk-3.0
- sudo apt-get install mono-mcs
| Install Python GI bindings and GTK on Travis | Install Python GI bindings and GTK on Travis
| YAML | lgpl-2.1 | lathiat/avahi,lathiat/avahi,heftig/avahi,heftig/avahi,heftig/avahi,heftig/avahi,lathiat/avahi,heftig/avahi,lathiat/avahi,lathiat/avahi,heftig/avahi,lathiat/avahi | yaml | ## Code Before:
language: c
compiler:
- gcc
- clang
# Change this to your needs
script: ./bootstrap.sh && make -j3
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep avahi avahi-sharp
- sudo apt-get install mono-mcs
## Instruction:
Install Python GI bindings and GTK on Travis
## Code After:
language: c
compiler:
- gcc
- clang
# Change this to your needs
script: ./bootstrap.sh && make -j3
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep avahi avahi-sharp
- sudo apt-get install python-gi gir1.2-gtk-3.0
- sudo apt-get install mono-mcs
| language: c
compiler:
- gcc
- clang
# Change this to your needs
script: ./bootstrap.sh && make -j3
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep avahi avahi-sharp
+ - sudo apt-get install python-gi gir1.2-gtk-3.0
- sudo apt-get install mono-mcs | 1 | 0.1 | 1 | 0 |
215cbc5892cdab7cbf57c3ccdf08a98ca4a841da | updates.json | updates.json | {
"versionCode": 784,
"message":
{
"en-us": "-Add firebase notification\n-Create update function\n-Create update function\n"
}
}
| {
"versionCode": 784,
"message":
{
"en-us": "-Add firebase notification\n-Create update new version\n"
}
}
| Update new version source code | [None] Update new version source code
| JSON | apache-2.0 | mrprona92/SecretBrand,mrprona92/SecretBrand | json | ## Code Before:
{
"versionCode": 784,
"message":
{
"en-us": "-Add firebase notification\n-Create update function\n-Create update function\n"
}
}
## Instruction:
[None] Update new version source code
## Code After:
{
"versionCode": 784,
"message":
{
"en-us": "-Add firebase notification\n-Create update new version\n"
}
}
| {
"versionCode": 784,
"message":
{
- "en-us": "-Add firebase notification\n-Create update function\n-Create update function\n"
? -- ^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+ "en-us": "-Add firebase notification\n-Create update new version\n"
? ^^^^^ ^
}
} | 2 | 0.285714 | 1 | 1 |
0bf2336392366124910a1d4c0aa29a87a455a104 | .dockerfiles/x86-64-unknown-linux-gnu/Dockerfile | .dockerfiles/x86-64-unknown-linux-gnu/Dockerfile | FROM ubuntu:18.04
ENV PATH "/root/.pony/ponyup/bin:$PATH"
RUN apt-get update \
&& apt-get install -y \
curl
RUN curl -s --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/master/ponyup-init.sh | sh \
&& ponyup update ponyc nightly --libc=gnu \
&& ponyup update stable nightly --libc=gnu \
&& ponyup update corral nightly --libc=gnu
CMD ponyc
| FROM ubuntu:18.04
ENV PATH "/root/.pony/ponyup/bin:$PATH"
RUN apt-get update \
&& apt-get install -y \
curl \
g++
RUN curl -s --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/master/ponyup-init.sh | sh \
&& ponyup update ponyc nightly --libc=gnu \
&& ponyup update stable nightly --libc=gnu \
&& ponyup update corral nightly --libc=gnu
CMD ponyc
| Allow gnu latest images to be used with the Pony playground | Allow gnu latest images to be used with the Pony playground
Was missing dependencies needed to build and link programs in the image.
Closes #3388
| unknown | bsd-2-clause | sgebbie/ponyc,sgebbie/ponyc,cquinn/ponyc,kulibali/ponyc,ponylang/ponyc,kulibali/ponyc,ponylang/ponyc,dipinhora/ponyc,sgebbie/ponyc,dipinhora/ponyc,dipinhora/ponyc,cquinn/ponyc,kulibali/ponyc,jemc/ponyc,sgebbie/ponyc,jemc/ponyc,ponylang/ponyc,jemc/ponyc,cquinn/ponyc,sgebbie/ponyc,kulibali/ponyc,cquinn/ponyc | unknown | ## Code Before:
FROM ubuntu:18.04
ENV PATH "/root/.pony/ponyup/bin:$PATH"
RUN apt-get update \
&& apt-get install -y \
curl
RUN curl -s --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/master/ponyup-init.sh | sh \
&& ponyup update ponyc nightly --libc=gnu \
&& ponyup update stable nightly --libc=gnu \
&& ponyup update corral nightly --libc=gnu
CMD ponyc
## Instruction:
Allow gnu latest images to be used with the Pony playground
Was missing dependencies needed to build and link programs in the image.
Closes #3388
## Code After:
FROM ubuntu:18.04
ENV PATH "/root/.pony/ponyup/bin:$PATH"
RUN apt-get update \
&& apt-get install -y \
curl \
g++
RUN curl -s --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/master/ponyup-init.sh | sh \
&& ponyup update ponyc nightly --libc=gnu \
&& ponyup update stable nightly --libc=gnu \
&& ponyup update corral nightly --libc=gnu
CMD ponyc
| FROM ubuntu:18.04
ENV PATH "/root/.pony/ponyup/bin:$PATH"
RUN apt-get update \
&& apt-get install -y \
- curl
+ curl \
? ++
+ g++
RUN curl -s --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/master/ponyup-init.sh | sh \
&& ponyup update ponyc nightly --libc=gnu \
&& ponyup update stable nightly --libc=gnu \
&& ponyup update corral nightly --libc=gnu
CMD ponyc | 3 | 0.214286 | 2 | 1 |
0f6c5849eeb2f548580539badab0a1267f8f1169 | conf.d/_mason-git.fish | conf.d/_mason-git.fish | alias gs 'git status -s'
alias gp 'git pull'
alias gb 'git branch --color --all -vv'
alias gr 'git remote -vv'
alias gc 'git checkout'
alias gd 'git diff'
alias gdd 'git diff --cached'
alias gf 'git fetch'
alias gclean 'git clean -df; and git checkout -- .'
function git-list-unstaged-files
git ls-files --others --exclude-standard
end
function gl -d 'Git show log'
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
end
alias current-branch 'git rev-parse --abbrev-ref HEAD'
alias all-branches 'git branch | cut -c 3-'
function git-delete-remote-branch -d 'Delete a remote branch'
git push $argv[1] --delete $argv[2]
end
| alias gs 'git status -s'
alias gp 'git pull'
alias gb 'git branch --color --all -vv'
alias gr 'git remote -vv'
alias gc 'git checkout'
alias gd 'git diff'
alias gdd 'git diff --cached'
alias gf 'git fetch'
alias gclean 'git clean -df; and git checkout -- .'
function git-list-unstaged-files
git ls-files --others --exclude-standard
end
function gl -d 'Git show log'
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
end
function gll -d 'Git show more log'
git log --reverse --pretty='# %s%n%b'
end
alias current-branch 'git rev-parse --abbrev-ref HEAD'
alias all-branches 'git branch | cut -c 3-'
function git-delete-remote-branch -d 'Delete a remote branch'
git push $argv[1] --delete $argv[2]
end
| Add `gll` to show detailed logs | Add `gll` to show detailed logs
| fish | mit | masonwan/fish-config,masonwan/fish-config | fish | ## Code Before:
alias gs 'git status -s'
alias gp 'git pull'
alias gb 'git branch --color --all -vv'
alias gr 'git remote -vv'
alias gc 'git checkout'
alias gd 'git diff'
alias gdd 'git diff --cached'
alias gf 'git fetch'
alias gclean 'git clean -df; and git checkout -- .'
function git-list-unstaged-files
git ls-files --others --exclude-standard
end
function gl -d 'Git show log'
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
end
alias current-branch 'git rev-parse --abbrev-ref HEAD'
alias all-branches 'git branch | cut -c 3-'
function git-delete-remote-branch -d 'Delete a remote branch'
git push $argv[1] --delete $argv[2]
end
## Instruction:
Add `gll` to show detailed logs
## Code After:
alias gs 'git status -s'
alias gp 'git pull'
alias gb 'git branch --color --all -vv'
alias gr 'git remote -vv'
alias gc 'git checkout'
alias gd 'git diff'
alias gdd 'git diff --cached'
alias gf 'git fetch'
alias gclean 'git clean -df; and git checkout -- .'
function git-list-unstaged-files
git ls-files --others --exclude-standard
end
function gl -d 'Git show log'
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
end
function gll -d 'Git show more log'
git log --reverse --pretty='# %s%n%b'
end
alias current-branch 'git rev-parse --abbrev-ref HEAD'
alias all-branches 'git branch | cut -c 3-'
function git-delete-remote-branch -d 'Delete a remote branch'
git push $argv[1] --delete $argv[2]
end
| alias gs 'git status -s'
alias gp 'git pull'
alias gb 'git branch --color --all -vv'
alias gr 'git remote -vv'
alias gc 'git checkout'
alias gd 'git diff'
alias gdd 'git diff --cached'
alias gf 'git fetch'
alias gclean 'git clean -df; and git checkout -- .'
function git-list-unstaged-files
git ls-files --others --exclude-standard
end
function gl -d 'Git show log'
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
end
+ function gll -d 'Git show more log'
+ git log --reverse --pretty='# %s%n%b'
+ end
+
alias current-branch 'git rev-parse --abbrev-ref HEAD'
alias all-branches 'git branch | cut -c 3-'
function git-delete-remote-branch -d 'Delete a remote branch'
git push $argv[1] --delete $argv[2]
end | 4 | 0.166667 | 4 | 0 |
7e70bc25a535203acc113ba998d5776a91a2be41 | app/models/peoplefinder/concerns/sanitisable.rb | app/models/peoplefinder/concerns/sanitisable.rb | require 'peoplefinder'
module Peoplefinder::Concerns::Sanitisable
extend ActiveSupport::Concern
included do
class_variable_set(:@@fields_to_sanitise, [])
before_validation :sanitise!
end
def sanitise!
self.class.class_variable_get(:@@fields_to_sanitise).each do |field_name|
field = send(field_name)
field.strip! if field && field.respond_to?(:strip!)
end
end
module ClassMethods
def sanitise_fields(*fields)
class_variable_set(:@@fields_to_sanitise, fields)
end
end
end
| require 'peoplefinder'
module Peoplefinder::Concerns::Sanitisable
extend ActiveSupport::Concern
included do
class_attribute :fields_to_sanitise, instance_writer: false
self.fields_to_sanitise = []
before_validation :sanitise!
end
def sanitise!
self.fields_to_sanitise.each do |field_name|
field = send(field_name)
field.strip! if field && field.respond_to?(:strip!)
end
end
module ClassMethods
def sanitise_fields(*fields)
self.fields_to_sanitise = fields
end
end
end
| Refactor Sanitisable concern to use ActiveSupport class_attribute | Refactor Sanitisable concern to use ActiveSupport class_attribute
| Ruby | mit | MjAbuz/peoplefinder,ministryofjustice/peoplefinder,MjAbuz/peoplefinder,ministryofjustice/peoplefinder,MjAbuz/peoplefinder,ministryofjustice/peoplefinder,ministryofjustice/peoplefinder,ministryofjustice/peoplefinder,MjAbuz/peoplefinder | ruby | ## Code Before:
require 'peoplefinder'
module Peoplefinder::Concerns::Sanitisable
extend ActiveSupport::Concern
included do
class_variable_set(:@@fields_to_sanitise, [])
before_validation :sanitise!
end
def sanitise!
self.class.class_variable_get(:@@fields_to_sanitise).each do |field_name|
field = send(field_name)
field.strip! if field && field.respond_to?(:strip!)
end
end
module ClassMethods
def sanitise_fields(*fields)
class_variable_set(:@@fields_to_sanitise, fields)
end
end
end
## Instruction:
Refactor Sanitisable concern to use ActiveSupport class_attribute
## Code After:
require 'peoplefinder'
module Peoplefinder::Concerns::Sanitisable
extend ActiveSupport::Concern
included do
class_attribute :fields_to_sanitise, instance_writer: false
self.fields_to_sanitise = []
before_validation :sanitise!
end
def sanitise!
self.fields_to_sanitise.each do |field_name|
field = send(field_name)
field.strip! if field && field.respond_to?(:strip!)
end
end
module ClassMethods
def sanitise_fields(*fields)
self.fields_to_sanitise = fields
end
end
end
| require 'peoplefinder'
module Peoplefinder::Concerns::Sanitisable
extend ActiveSupport::Concern
included do
- class_variable_set(:@@fields_to_sanitise, [])
+ class_attribute :fields_to_sanitise, instance_writer: false
+ self.fields_to_sanitise = []
+
before_validation :sanitise!
end
def sanitise!
- self.class.class_variable_get(:@@fields_to_sanitise).each do |field_name|
? ---------------------------- -
+ self.fields_to_sanitise.each do |field_name|
field = send(field_name)
field.strip! if field && field.respond_to?(:strip!)
end
end
module ClassMethods
def sanitise_fields(*fields)
- class_variable_set(:@@fields_to_sanitise, fields)
+ self.fields_to_sanitise = fields
end
end
end | 8 | 0.347826 | 5 | 3 |
9602701f25beca21c126fa160e6c1dfbb413acb4 | app/views/profiles/_form.html.erb | app/views/profiles/_form.html.erb | <% semantic_form_for(@profile) do |f| %>
<%= f.error_messages %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :path %>
<%= f.input :servers, :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
<% end %>
<%= f.buttons %>
<% end %> | <% semantic_form_for(@profile) do |f| %>
<%= f.error_messages %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :path %>
<%= f.input :servers, :collection => Server.find(:all, :order => 'hostname DESC'), :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
<% end %>
<%= f.buttons %>
<% end %> | Order the list of servers | Order the list of servers
| HTML+ERB | isc | Wijnand/retcon-web,driehuis/retcon-web,driehuis/retcon-web,driehuis/retcon-web,driehuis/retcon-web,Wijnand/retcon-web | html+erb | ## Code Before:
<% semantic_form_for(@profile) do |f| %>
<%= f.error_messages %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :path %>
<%= f.input :servers, :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
<% end %>
<%= f.buttons %>
<% end %>
## Instruction:
Order the list of servers
## Code After:
<% semantic_form_for(@profile) do |f| %>
<%= f.error_messages %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :path %>
<%= f.input :servers, :collection => Server.find(:all, :order => 'hostname DESC'), :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
<% end %>
<%= f.buttons %>
<% end %> | <% semantic_form_for(@profile) do |f| %>
<%= f.error_messages %>
<% f.inputs do %>
<%= f.input :name %>
<%= f.input :path %>
- <%= f.input :servers, :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
+ <%= f.input :servers, :collection => Server.find(:all, :order => 'hostname DESC'), :as => :check_boxes, :label => 'Apply to', :hint => 'Quickly apply this profile to all these servers' %>
? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<% end %>
<%= f.buttons %>
<% end %> | 2 | 0.222222 | 1 | 1 |
6d0dc93c234398622adc011cfd5c36371e48750c | test/kolmogorov_music/test/kolmogorov.clj | test/kolmogorov_music/test/kolmogorov.clj | (ns kolmogorov-music.test.kolmogorov
(:require [kolmogorov-music.kolmogorov :as kolmogorov]
[midje.sweet :refer :all]))
(defn foo [x] (inc x))
(def bar (comp foo foo))
(fact "Kolmogorov complexity is how many symbols a definition comprises."
(kolmogorov/complexity foo) => 2)
(fact "The symbol count is recursive within the current namespace."
(kolmogorov/complexity bar) => 7)
(fact "Symbols outside the current namespace are considered atoms."
(kolmogorov/complexity inc) => 0)
| (ns kolmogorov-music.test.kolmogorov
(:require [kolmogorov-music.kolmogorov :as kolmogorov]
[midje.sweet :refer :all]))
(defn foo [x] (inc x))
(defn bar [x] (+ (inc x) x))
(def baz (comp foo foo))
(fact "Kolmogorov complexity is how many symbols a definition comprises."
(kolmogorov/complexity foo) => 2)
(fact "The symbol count includes nested sexprs."
(kolmogorov/complexity bar) => 4)
(fact "The symbol count is recursive within the current namespace."
(kolmogorov/complexity baz) => 7)
(fact "Symbols outside the current namespace are considered atoms."
(kolmogorov/complexity inc) => 0)
| Test that the count works with nested sexprs. | Test that the count works with nested sexprs.
| Clojure | mit | ctford/kolmogorov-music,ctford/kolmogorov-music | clojure | ## Code Before:
(ns kolmogorov-music.test.kolmogorov
(:require [kolmogorov-music.kolmogorov :as kolmogorov]
[midje.sweet :refer :all]))
(defn foo [x] (inc x))
(def bar (comp foo foo))
(fact "Kolmogorov complexity is how many symbols a definition comprises."
(kolmogorov/complexity foo) => 2)
(fact "The symbol count is recursive within the current namespace."
(kolmogorov/complexity bar) => 7)
(fact "Symbols outside the current namespace are considered atoms."
(kolmogorov/complexity inc) => 0)
## Instruction:
Test that the count works with nested sexprs.
## Code After:
(ns kolmogorov-music.test.kolmogorov
(:require [kolmogorov-music.kolmogorov :as kolmogorov]
[midje.sweet :refer :all]))
(defn foo [x] (inc x))
(defn bar [x] (+ (inc x) x))
(def baz (comp foo foo))
(fact "Kolmogorov complexity is how many symbols a definition comprises."
(kolmogorov/complexity foo) => 2)
(fact "The symbol count includes nested sexprs."
(kolmogorov/complexity bar) => 4)
(fact "The symbol count is recursive within the current namespace."
(kolmogorov/complexity baz) => 7)
(fact "Symbols outside the current namespace are considered atoms."
(kolmogorov/complexity inc) => 0)
| (ns kolmogorov-music.test.kolmogorov
(:require [kolmogorov-music.kolmogorov :as kolmogorov]
[midje.sweet :refer :all]))
(defn foo [x] (inc x))
+ (defn bar [x] (+ (inc x) x))
- (def bar (comp foo foo))
? ^
+ (def baz (comp foo foo))
? ^
(fact "Kolmogorov complexity is how many symbols a definition comprises."
(kolmogorov/complexity foo) => 2)
+ (fact "The symbol count includes nested sexprs."
+ (kolmogorov/complexity bar) => 4)
+
(fact "The symbol count is recursive within the current namespace."
- (kolmogorov/complexity bar) => 7)
? ^
+ (kolmogorov/complexity baz) => 7)
? ^
(fact "Symbols outside the current namespace are considered atoms."
(kolmogorov/complexity inc) => 0) | 8 | 0.533333 | 6 | 2 |
36f21a2c68d48e3fa3be9051d849c9031438b772 | examples/greeter.go | examples/greeter.go | package main
import (
eventsource "../."
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (consumers: %d)", es.ConsumersCount())
time.Sleep(2 * time.Second)
}
}()
log.Print("Open URL http://localhost:8080/ in your browser.")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
}
| package main
import (
"gopkg.in/antage/eventsource.v0"
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (consumers: %d)", es.ConsumersCount())
time.Sleep(2 * time.Second)
}
}()
log.Print("Open URL http://localhost:8080/ in your browser.")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
}
| Revert "Revert "Use absolute import URL in example ( doesn't like relative URLs)."" `go get ./...` is full of surprises. | Revert "Revert "Use absolute import URL in example ( doesn't like relative URLs).""
`go get ./...` is full of surprises.
This reverts commit 323289ab27d509f732d2e9055d229de21a4d5d1c.
| Go | mit | antage/eventsource,XuYunnan/eventsource,torfuzx/eventsource,XuYunnan/eventsource | go | ## Code Before:
package main
import (
eventsource "../."
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (consumers: %d)", es.ConsumersCount())
time.Sleep(2 * time.Second)
}
}()
log.Print("Open URL http://localhost:8080/ in your browser.")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
}
## Instruction:
Revert "Revert "Use absolute import URL in example ( doesn't like relative URLs).""
`go get ./...` is full of surprises.
This reverts commit 323289ab27d509f732d2e9055d229de21a4d5d1c.
## Code After:
package main
import (
"gopkg.in/antage/eventsource.v0"
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (consumers: %d)", es.ConsumersCount())
time.Sleep(2 * time.Second)
}
}()
log.Print("Open URL http://localhost:8080/ in your browser.")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
}
| package main
import (
- eventsource "../."
+ "gopkg.in/antage/eventsource.v0"
"log"
"net/http"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/", http.FileServer(http.Dir("./public")))
http.Handle("/events", es)
go func() {
for {
es.SendEventMessage("hello", "", "")
log.Printf("Hello has been sent (consumers: %d)", es.ConsumersCount())
time.Sleep(2 * time.Second)
}
}()
log.Print("Open URL http://localhost:8080/ in your browser.")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal(err)
}
} | 2 | 0.074074 | 1 | 1 |
23a52112a962bbbd8dca6757f9b920fd3207f12c | README.md | README.md | 
Yeoman Generator for AngularJs. Create either a component, directive, controller, service or a filter.
# Useage
```
npm install -g yo generator-yo-ng-js
```
```
yo yo-ng-js
```
Pass your choice as the first argument
```
yo yo-ng-js component
```
Pass the name of your choice as the second argument
```
yo yo-ng-js component my-component-name
```
| 
Yeoman Generator for AngularJs. Generate either a component, directive, controller, service or a filter.
You'll get prompted:
- What you want to generate; controller, component etc
- It's name
- Whether an Angular module should also be generated
- The name of the Angular application (to be used with the module)
# Components and Directives
Components and directives will generate an associated controller and template.
# Usage
## Install
Install [Yeoman](http://yeoman.io/) and yo-ng-js.
```
npm install -g yo generator-yo-ng-js
```
## Get Prompted
Get prompted for what you need to generate; component, directive etc.
```
yo yo-ng-js
```
## Using Arguments
You can shortcut the first two questions by passing some arguments.
Pass what you want to generate as the first argument.
```
yo yo-ng-js component
```
Pass the name of your choice as the second argument.
```
yo yo-ng-js component my-component-name
```
| Update to the readme. Learn how to spell | Update to the readme. Learn how to spell
| Markdown | mit | aarr0n/yo-ng-js,aarr0n/yo-ng-js | markdown | ## Code Before:

Yeoman Generator for AngularJs. Create either a component, directive, controller, service or a filter.
# Useage
```
npm install -g yo generator-yo-ng-js
```
```
yo yo-ng-js
```
Pass your choice as the first argument
```
yo yo-ng-js component
```
Pass the name of your choice as the second argument
```
yo yo-ng-js component my-component-name
```
## Instruction:
Update to the readme. Learn how to spell
## Code After:

Yeoman Generator for AngularJs. Generate either a component, directive, controller, service or a filter.
You'll get prompted:
- What you want to generate; controller, component etc
- It's name
- Whether an Angular module should also be generated
- The name of the Angular application (to be used with the module)
# Components and Directives
Components and directives will generate an associated controller and template.
# Usage
## Install
Install [Yeoman](http://yeoman.io/) and yo-ng-js.
```
npm install -g yo generator-yo-ng-js
```
## Get Prompted
Get prompted for what you need to generate; component, directive etc.
```
yo yo-ng-js
```
## Using Arguments
You can shortcut the first two questions by passing some arguments.
Pass what you want to generate as the first argument.
```
yo yo-ng-js component
```
Pass the name of your choice as the second argument.
```
yo yo-ng-js component my-component-name
```
| 
- Yeoman Generator for AngularJs. Create either a component, directive, controller, service or a filter.
? ^ -
+ Yeoman Generator for AngularJs. Generate either a component, directive, controller, service or a filter.
? ^^^^
+ You'll get prompted:
+
+ - What you want to generate; controller, component etc
+ - It's name
+ - Whether an Angular module should also be generated
+ - The name of the Angular application (to be used with the module)
+
+ # Components and Directives
+
+ Components and directives will generate an associated controller and template.
+
- # Useage
? -
+ # Usage
+
+ ## Install
+
+ Install [Yeoman](http://yeoman.io/) and yo-ng-js.
```
npm install -g yo generator-yo-ng-js
```
+ ## Get Prompted
+
+ Get prompted for what you need to generate; component, directive etc.
```
yo yo-ng-js
```
- Pass your choice as the first argument
+ ## Using Arguments
+
+ You can shortcut the first two questions by passing some arguments.
+
+ Pass what you want to generate as the first argument.
```
yo yo-ng-js component
```
- Pass the name of your choice as the second argument
+ Pass the name of your choice as the second argument.
? +
```
yo yo-ng-js component my-component-name
``` | 30 | 1.153846 | 26 | 4 |
aa2ecf07df978d5a82318b1ab4f2062c7b489f0e | src/main/webapp/WEB-INF/appengine-web.xml | src/main/webapp/WEB-INF/appengine-web.xml | <?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Allows App Engine to send multiple requests to one instance in parallel: -->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- use the Java 8 runtime -->
<runtime>java8</runtime>
<!-- Resource files -->
<resource-files>
<include path="WEB-INF/StaticFiles/*" />
</resource-files>
</appengine-web-app>
| <?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Allows App Engine to send multiple requests to one instance in parallel: -->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- use the Java 8 runtime -->
<runtime>java8</runtime>
<!-- Resource files -->
<resource-files>
<include path="WEB-INF/StaticFiles/*" />
</resource-files>
<!-- Fix Unknown Host error when using ROME -->
<url-stream-handler>urlfetch</url-stream-handler>
</appengine-web-app>
| Fix annoying UnknownHostException when using ROME | Fix annoying UnknownHostException when using ROME
Apparently this happened when migrating to Java 8.
AbstractPlainSocketImpl.connect
Glad that this bot still works with free GAE account because I was getting worried... | XML | mit | daloonik/baconbot,daloonik/baconbot,daloonik/twitfeedbot,daloonik/twitfeedbot | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Allows App Engine to send multiple requests to one instance in parallel: -->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- use the Java 8 runtime -->
<runtime>java8</runtime>
<!-- Resource files -->
<resource-files>
<include path="WEB-INF/StaticFiles/*" />
</resource-files>
</appengine-web-app>
## Instruction:
Fix annoying UnknownHostException when using ROME
Apparently this happened when migrating to Java 8.
AbstractPlainSocketImpl.connect
Glad that this bot still works with free GAE account because I was getting worried...
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Allows App Engine to send multiple requests to one instance in parallel: -->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- use the Java 8 runtime -->
<runtime>java8</runtime>
<!-- Resource files -->
<resource-files>
<include path="WEB-INF/StaticFiles/*" />
</resource-files>
<!-- Fix Unknown Host error when using ROME -->
<url-stream-handler>urlfetch</url-stream-handler>
</appengine-web-app>
| <?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Allows App Engine to send multiple requests to one instance in parallel: -->
<threadsafe>true</threadsafe>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- use the Java 8 runtime -->
<runtime>java8</runtime>
<!-- Resource files -->
<resource-files>
<include path="WEB-INF/StaticFiles/*" />
</resource-files>
-
+
+ <!-- Fix Unknown Host error when using ROME -->
+ <url-stream-handler>urlfetch</url-stream-handler>
+
</appengine-web-app> | 5 | 0.25 | 4 | 1 |
38a2fff751901e5af4cac903f0e69dd35db31e4e | README.md | README.md |
Command-line tools and scripts that use OS X's [FSEvents](http://en.wikipedia.org/wiki/FSEvents) API. Mostly useful for watching a directory and react to changes in it.
## Building
In addition to the typical automake/autoconf/make, you'll need pkg-config. `brew install pkg-config` should do the trick.
Once you have all the dependencies, just run `./autogen.sh` and `make install`.
## Usage examples
Alert if any files in a directory are changed.
notifywait /path/; echo "\007"
Automatically rsync files to a remote server if any of them are changed.
auto_rsync . 192.168.1.127:/var/www
Same as above, but don't copy .pyc files.
notify_loop ~/code/directory rsync -avz --exclude="*.pyc" ~/code/directory/ server.example.com:/stuff/
## Related software
* [inotify-tools](https://github.com/rvoicilas/inotify-tools). The original tools that inspired me to make fsevents-tools.
* [Lsyncd](https://github.com/axkibe/lsyncd). A service to keep files synced between a master and one or more slave servers.
|
[](https://travis-ci.org/ggreer/fsevents-tools)
[](https://floobits.com/ggreer/fsevents-tools/redirect)
Command-line tools and scripts that use OS X's [FSEvents](http://en.wikipedia.org/wiki/FSEvents) API. Mostly useful for watching a directory and react to changes in it.
## Building
In addition to the typical automake/autoconf/make, you'll need pkg-config. `brew install pkg-config` should do the trick.
Once you have all the dependencies, just run `./autogen.sh` and `make install`.
## Usage examples
Alert if any files in a directory are changed.
notifywait /path/; echo "\007"
Automatically rsync files to a remote server if any of them are changed.
auto_rsync . 192.168.1.127:/var/www
Same as above, but don't copy .pyc files.
notify_loop ~/code/directory rsync -avz --exclude="*.pyc" ~/code/directory/ server.example.com:/stuff/
## Related software
* [inotify-tools](https://github.com/rvoicilas/inotify-tools). The original tools that inspired me to make fsevents-tools.
* [Lsyncd](https://github.com/axkibe/lsyncd). A service to keep files synced between a master and one or more slave servers.
| Add build status and Floobits. | Add build status and Floobits.
| Markdown | apache-2.0 | ggreer/fsevents-tools,ggreer/fsevents-tools,ggreer/fsevents-tools | markdown | ## Code Before:
Command-line tools and scripts that use OS X's [FSEvents](http://en.wikipedia.org/wiki/FSEvents) API. Mostly useful for watching a directory and react to changes in it.
## Building
In addition to the typical automake/autoconf/make, you'll need pkg-config. `brew install pkg-config` should do the trick.
Once you have all the dependencies, just run `./autogen.sh` and `make install`.
## Usage examples
Alert if any files in a directory are changed.
notifywait /path/; echo "\007"
Automatically rsync files to a remote server if any of them are changed.
auto_rsync . 192.168.1.127:/var/www
Same as above, but don't copy .pyc files.
notify_loop ~/code/directory rsync -avz --exclude="*.pyc" ~/code/directory/ server.example.com:/stuff/
## Related software
* [inotify-tools](https://github.com/rvoicilas/inotify-tools). The original tools that inspired me to make fsevents-tools.
* [Lsyncd](https://github.com/axkibe/lsyncd). A service to keep files synced between a master and one or more slave servers.
## Instruction:
Add build status and Floobits.
## Code After:
[](https://travis-ci.org/ggreer/fsevents-tools)
[](https://floobits.com/ggreer/fsevents-tools/redirect)
Command-line tools and scripts that use OS X's [FSEvents](http://en.wikipedia.org/wiki/FSEvents) API. Mostly useful for watching a directory and react to changes in it.
## Building
In addition to the typical automake/autoconf/make, you'll need pkg-config. `brew install pkg-config` should do the trick.
Once you have all the dependencies, just run `./autogen.sh` and `make install`.
## Usage examples
Alert if any files in a directory are changed.
notifywait /path/; echo "\007"
Automatically rsync files to a remote server if any of them are changed.
auto_rsync . 192.168.1.127:/var/www
Same as above, but don't copy .pyc files.
notify_loop ~/code/directory rsync -avz --exclude="*.pyc" ~/code/directory/ server.example.com:/stuff/
## Related software
* [inotify-tools](https://github.com/rvoicilas/inotify-tools). The original tools that inspired me to make fsevents-tools.
* [Lsyncd](https://github.com/axkibe/lsyncd). A service to keep files synced between a master and one or more slave servers.
| +
+ [](https://travis-ci.org/ggreer/fsevents-tools)
+
+ [](https://floobits.com/ggreer/fsevents-tools/redirect)
Command-line tools and scripts that use OS X's [FSEvents](http://en.wikipedia.org/wiki/FSEvents) API. Mostly useful for watching a directory and react to changes in it.
## Building
In addition to the typical automake/autoconf/make, you'll need pkg-config. `brew install pkg-config` should do the trick.
Once you have all the dependencies, just run `./autogen.sh` and `make install`.
## Usage examples
Alert if any files in a directory are changed.
notifywait /path/; echo "\007"
Automatically rsync files to a remote server if any of them are changed.
auto_rsync . 192.168.1.127:/var/www
Same as above, but don't copy .pyc files.
notify_loop ~/code/directory rsync -avz --exclude="*.pyc" ~/code/directory/ server.example.com:/stuff/
## Related software
* [inotify-tools](https://github.com/rvoicilas/inotify-tools). The original tools that inspired me to make fsevents-tools.
* [Lsyncd](https://github.com/axkibe/lsyncd). A service to keep files synced between a master and one or more slave servers. | 4 | 0.133333 | 4 | 0 |
dd77c531a612fb0533120751c43454f4fe73ab65 | ontrack-web/src/main/webapp/WEB-INF/views/lib/branches.html | ontrack-web/src/main/webapp/WEB-INF/views/lib/branches.html | <script type="text/javascript" src="${base}/js/branches.js"></script>
<#macro branches project id="branches" create=true>
<@dynamicsection id=id template="Branches.branchTemplate('${project?html}')">
<#if create>
<@dialog id="branch-create-dialog">
<@form_text name="name" label=loc('branch.name') />
<@form_memo name="description" label=loc('branch.description') required=false />
<@dialog_button_cancel />
<@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
</@dialog>
<button id="branch-create-button" type="button" class="btn" onclick="Branches.createBranch('${project?html}')"><@lh key="branch.create" /></button>
</#if>
</@dynamicsection>
<script id="branchTemplate" type="text/html">
<tr>
<td>
<a href="gui/project/{{project.name}}/branch/{{name}}">{{name}}</a>
{{#description}}
<br/>
<span class="description">{{description}}</span>
{{/description}}
</td>
</tr>
</script>
</#macro>
| <script type="text/javascript" src="${base}/js/branches.js"></script>
<#macro branches project id="branches" create=true>
<@dynamicsection id=id template="Branches.branchTemplate('${project?html}')">
<#if create>
<@dialog id="branch-create-dialog">
<@form_text name="name" label=loc('branch.name') />
<@form_memo name="description" label=loc('branch.description') required=false />
<@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
<@dialog_button_cancel />
</@dialog>
<button id="branch-create-button" type="button" class="btn" onclick="Branches.createBranch('${project?html}')"><@lh key="branch.create" /></button>
</#if>
</@dynamicsection>
<script id="branchTemplate" type="text/html">
<tr>
<td>
<a href="gui/project/{{project.name}}/branch/{{name}}">{{name}}</a>
{{#description}}
<br/>
<span class="description">{{description}}</span>
{{/description}}
</td>
</tr>
</script>
</#macro>
| Fix buttons order in branch creation dialog. | Fix buttons order in branch creation dialog. | HTML | mit | dcoraboeuf/ontrack,joansmith/ontrack,joansmith/ontrack,joansmith/ontrack,joansmith/ontrack,dcoraboeuf/ontrack,joansmith/ontrack,dcoraboeuf/ontrack,dcoraboeuf/ontrack | html | ## Code Before:
<script type="text/javascript" src="${base}/js/branches.js"></script>
<#macro branches project id="branches" create=true>
<@dynamicsection id=id template="Branches.branchTemplate('${project?html}')">
<#if create>
<@dialog id="branch-create-dialog">
<@form_text name="name" label=loc('branch.name') />
<@form_memo name="description" label=loc('branch.description') required=false />
<@dialog_button_cancel />
<@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
</@dialog>
<button id="branch-create-button" type="button" class="btn" onclick="Branches.createBranch('${project?html}')"><@lh key="branch.create" /></button>
</#if>
</@dynamicsection>
<script id="branchTemplate" type="text/html">
<tr>
<td>
<a href="gui/project/{{project.name}}/branch/{{name}}">{{name}}</a>
{{#description}}
<br/>
<span class="description">{{description}}</span>
{{/description}}
</td>
</tr>
</script>
</#macro>
## Instruction:
Fix buttons order in branch creation dialog.
## Code After:
<script type="text/javascript" src="${base}/js/branches.js"></script>
<#macro branches project id="branches" create=true>
<@dynamicsection id=id template="Branches.branchTemplate('${project?html}')">
<#if create>
<@dialog id="branch-create-dialog">
<@form_text name="name" label=loc('branch.name') />
<@form_memo name="description" label=loc('branch.description') required=false />
<@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
<@dialog_button_cancel />
</@dialog>
<button id="branch-create-button" type="button" class="btn" onclick="Branches.createBranch('${project?html}')"><@lh key="branch.create" /></button>
</#if>
</@dynamicsection>
<script id="branchTemplate" type="text/html">
<tr>
<td>
<a href="gui/project/{{project.name}}/branch/{{name}}">{{name}}</a>
{{#description}}
<br/>
<span class="description">{{description}}</span>
{{/description}}
</td>
</tr>
</script>
</#macro>
| <script type="text/javascript" src="${base}/js/branches.js"></script>
<#macro branches project id="branches" create=true>
<@dynamicsection id=id template="Branches.branchTemplate('${project?html}')">
<#if create>
<@dialog id="branch-create-dialog">
<@form_text name="name" label=loc('branch.name') />
<@form_memo name="description" label=loc('branch.description') required=false />
+ <@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
<@dialog_button_cancel />
- <@dialog_button id="branch-create-dialog-submit" class="btn-primary" text=loc('general.create') />
</@dialog>
<button id="branch-create-button" type="button" class="btn" onclick="Branches.createBranch('${project?html}')"><@lh key="branch.create" /></button>
</#if>
</@dynamicsection>
<script id="branchTemplate" type="text/html">
<tr>
<td>
<a href="gui/project/{{project.name}}/branch/{{name}}">{{name}}</a>
{{#description}}
<br/>
<span class="description">{{description}}</span>
{{/description}}
</td>
</tr>
</script>
</#macro> | 2 | 0.074074 | 1 | 1 |
8b243ef39db23822e7de0ae9394e8448ead6c521 | _plugins/mesos-video.rb | _plugins/mesos-video.rb | module Jekyll
class RenderMesosVideo < Liquid::Tag
def initialize(tag_name, videoFile, tokens)
super
@videoFile = videoFile.strip!
end
def render(context)
"<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://advanced-mesos-course.s3-website-us-east-1.amazonaws.com/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
end
end
end
Liquid::Template.register_tag 'mesos_video', Jekyll::RenderMesosVideo
| module Jekyll
class RenderMesosVideo < Liquid::Tag
def initialize(tag_name, videoFile, tokens)
super
@videoFile = videoFile.strip!
end
def render(context)
"<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://s3.amazonaws.com/advanced-mesos-course/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
end
end
end
Liquid::Template.register_tag 'mesos_video', Jekyll::RenderMesosVideo
| Use correct URL for https | Use correct URL for https
| Ruby | apache-2.0 | mesosphere/open-docs,mesosphere/open-docs,mesosphere/open-docs,mesosphere/open-docs,mesosphere/open-docs | ruby | ## Code Before:
module Jekyll
class RenderMesosVideo < Liquid::Tag
def initialize(tag_name, videoFile, tokens)
super
@videoFile = videoFile.strip!
end
def render(context)
"<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://advanced-mesos-course.s3-website-us-east-1.amazonaws.com/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
end
end
end
Liquid::Template.register_tag 'mesos_video', Jekyll::RenderMesosVideo
## Instruction:
Use correct URL for https
## Code After:
module Jekyll
class RenderMesosVideo < Liquid::Tag
def initialize(tag_name, videoFile, tokens)
super
@videoFile = videoFile.strip!
end
def render(context)
"<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://s3.amazonaws.com/advanced-mesos-course/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
end
end
end
Liquid::Template.register_tag 'mesos_video', Jekyll::RenderMesosVideo
| module Jekyll
class RenderMesosVideo < Liquid::Tag
def initialize(tag_name, videoFile, tokens)
super
@videoFile = videoFile.strip!
end
def render(context)
- "<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://advanced-mesos-course.s3-website-us-east-1.amazonaws.com/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
? ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
+ "<div class=\"video-lecture-container\"><iframe class=\"smart-player-embed-container-iframe\" id=\"embeddedSmartPlayerInstance\" src=\"https://s3.amazonaws.com/advanced-mesos-course/#{@videoFile}/media/index_player.html?embedIFrameId=embeddedSmartPlayerInstance\" scrolling=\"no\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"
? ^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
end
end
end
Liquid::Template.register_tag 'mesos_video', Jekyll::RenderMesosVideo | 2 | 0.133333 | 1 | 1 |
6afaf2ee4bce41abc100ca69745a95e768d0e9b5 | lib/index.js | lib/index.js | 'use strict'
var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable')
var Plugin = require('vigour-native/lib/bridge/Plugin')
var name = require('../package.json').name
var AlphaColor = new BridgeObservable({
color: {
condition: {
$hex: 'color'
}
},
opacity: {
condition: {
$number: 'percentage'
}
},
useValue: true
}).Constructor
module.exports = exports = new Plugin({
key: name,
background: new AlphaColor(),
text: new AlphaColor(),
display: {}
})
| 'use strict'
var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable')
var Plugin = require('vigour-native/lib/bridge/Plugin')
var name = require('../package.json').name
var AlphaColor = new BridgeObservable({
color: {
// condition: {
// $hex: 'color'
// }
},
opacity: {
// condition: {
// $number: 'percentage'
// }
},
useValue: true
}).Constructor
module.exports = exports = new Plugin({
key: name,
background: new AlphaColor(),
text: new AlphaColor(),
display: {}
})
| Comment out validation for now | Comment out validation for now
| JavaScript | bsd-2-clause | vigour-io/statusbar,vigour-io/statusbar | javascript | ## Code Before:
'use strict'
var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable')
var Plugin = require('vigour-native/lib/bridge/Plugin')
var name = require('../package.json').name
var AlphaColor = new BridgeObservable({
color: {
condition: {
$hex: 'color'
}
},
opacity: {
condition: {
$number: 'percentage'
}
},
useValue: true
}).Constructor
module.exports = exports = new Plugin({
key: name,
background: new AlphaColor(),
text: new AlphaColor(),
display: {}
})
## Instruction:
Comment out validation for now
## Code After:
'use strict'
var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable')
var Plugin = require('vigour-native/lib/bridge/Plugin')
var name = require('../package.json').name
var AlphaColor = new BridgeObservable({
color: {
// condition: {
// $hex: 'color'
// }
},
opacity: {
// condition: {
// $number: 'percentage'
// }
},
useValue: true
}).Constructor
module.exports = exports = new Plugin({
key: name,
background: new AlphaColor(),
text: new AlphaColor(),
display: {}
})
| 'use strict'
var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable')
var Plugin = require('vigour-native/lib/bridge/Plugin')
var name = require('../package.json').name
var AlphaColor = new BridgeObservable({
color: {
- condition: {
+ // condition: {
? +++
- $hex: 'color'
+ // $hex: 'color'
? +++
- }
+ // }
? +++
},
opacity: {
- condition: {
+ // condition: {
? +++
- $number: 'percentage'
+ // $number: 'percentage'
? +++
- }
+ // }
? +++
},
useValue: true
}).Constructor
module.exports = exports = new Plugin({
key: name,
background: new AlphaColor(),
text: new AlphaColor(),
display: {}
}) | 12 | 0.461538 | 6 | 6 |
b86a96cf0812f98ce0562442a84c0d64123c5c01 | spec/lib/human_error_spec.rb | spec/lib/human_error_spec.rb | require 'rspectacular'
require 'human_error'
describe HumanError do
it 'can create an instance of HumanError' do
expect(HumanError.new).to be_a HumanError
end
it 'can configure each instance' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
expect(human_error.configuration.api_version).to eql 'foo'
end
it 'can lookup errors' do
human_error = HumanError.new
expect(human_error.fetch('RequestError')).to be_a HumanError::Errors::RequestError
end
end
| require 'rspectacular'
require 'human_error'
describe HumanError do
it 'can create an instance of HumanError' do
expect(HumanError.new).to be_a HumanError
end
it 'can configure each instance' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
expect(human_error.configuration.api_version).to eql 'foo'
end
it 'can lookup errors' do
human_error = HumanError.new
expect(human_error.fetch('RequestError')).to be_a HumanError::Errors::RequestError
end
it 'can lookup errors based on the local configuration' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
fetched_error = human_error.fetch('RequestError')
expect(fetched_error.api_version).to eql 'foo'
end
end
| Allow local configuration to be passed to looked up errors | Feature: Allow local configuration to be passed to looked up errors
This uses `Configuration#to_h` to generate a set of initialization values that
are passed into each error that is looked up via `HumanError#fetch`.
This allows each instance of `HumanError` to create errors with different
information, even if they are of the same type.
Example:
error = HumanError.new do |config|
config.api_version = 1
end
error.fetch('RequestError').api_version # => 1
but if we created a new `HumanError` instance with an `api_version` of `2` then
calling `fetch('RequestError').api_version` on that instance would yield `2`.
--------------------------------------------------------------------------------
Change-Id: I0c26b3f59af2588dbd52384bdadd8bce0ee5180d
Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
| Ruby | mit | jasnow/human_error,jasnow/human_error | ruby | ## Code Before:
require 'rspectacular'
require 'human_error'
describe HumanError do
it 'can create an instance of HumanError' do
expect(HumanError.new).to be_a HumanError
end
it 'can configure each instance' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
expect(human_error.configuration.api_version).to eql 'foo'
end
it 'can lookup errors' do
human_error = HumanError.new
expect(human_error.fetch('RequestError')).to be_a HumanError::Errors::RequestError
end
end
## Instruction:
Feature: Allow local configuration to be passed to looked up errors
This uses `Configuration#to_h` to generate a set of initialization values that
are passed into each error that is looked up via `HumanError#fetch`.
This allows each instance of `HumanError` to create errors with different
information, even if they are of the same type.
Example:
error = HumanError.new do |config|
config.api_version = 1
end
error.fetch('RequestError').api_version # => 1
but if we created a new `HumanError` instance with an `api_version` of `2` then
calling `fetch('RequestError').api_version` on that instance would yield `2`.
--------------------------------------------------------------------------------
Change-Id: I0c26b3f59af2588dbd52384bdadd8bce0ee5180d
Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
## Code After:
require 'rspectacular'
require 'human_error'
describe HumanError do
it 'can create an instance of HumanError' do
expect(HumanError.new).to be_a HumanError
end
it 'can configure each instance' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
expect(human_error.configuration.api_version).to eql 'foo'
end
it 'can lookup errors' do
human_error = HumanError.new
expect(human_error.fetch('RequestError')).to be_a HumanError::Errors::RequestError
end
it 'can lookup errors based on the local configuration' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
fetched_error = human_error.fetch('RequestError')
expect(fetched_error.api_version).to eql 'foo'
end
end
| require 'rspectacular'
require 'human_error'
describe HumanError do
it 'can create an instance of HumanError' do
expect(HumanError.new).to be_a HumanError
end
it 'can configure each instance' do
human_error = HumanError.new do |config|
config.api_version = 'foo'
end
expect(human_error.configuration.api_version).to eql 'foo'
end
it 'can lookup errors' do
human_error = HumanError.new
expect(human_error.fetch('RequestError')).to be_a HumanError::Errors::RequestError
end
+
+ it 'can lookup errors based on the local configuration' do
+ human_error = HumanError.new do |config|
+ config.api_version = 'foo'
+ end
+
+ fetched_error = human_error.fetch('RequestError')
+
+ expect(fetched_error.api_version).to eql 'foo'
+ end
end | 10 | 0.454545 | 10 | 0 |
8b78ba1c5fd2eacbc5628fd90a697757ad0626d3 | vjousse/requirements/project.txt | vjousse/requirements/project.txt | Django==1.5.2
Markdown==2.3.1
Mezzanine==1.4.10
Pillow==2.1.0
South==0.8.2
bleach==1.2.2
django-appconf==0.6
django-compressor==1.3
django-widget-tweaks==1.3
feedparser==5.1.3
filebrowser-safe==0.2.28
grappelli-safe==0.2.22
gunicorn==18.0
html5lib==0.95
mezzanine-mdown==0.1a3
oauthlib==0.5.1
psycopg2==2.5.1
pytz==2013b
requests==1.2.3
requests-oauthlib==0.3.2
setproctitle==1.1.7
six==1.4.1
wsgiref==0.1.2
| Django==1.5.2
Fabric==1.7.0
Markdown==2.3.1
Mezzanine==1.4.10
Pillow==2.1.0
South==0.8.2
bleach==1.2.2
django-appconf==0.6
django-compressor==1.3
django-widget-tweaks==1.3
feedparser==5.1.3
filebrowser-safe==0.2.28
grappelli-safe==0.2.22
gunicorn==18.0
html5lib==0.95
mezzanine-mdown==0.1a3
oauthlib==0.5.1
paramiko==1.11.0
psycopg2==2.5.1
pycrypto==2.6
pytz==2013b
requests==1.2.3
requests-oauthlib==0.3.2
setproctitle==1.1.7
six==1.4.1
wsgiref==0.1.2
| Add fabric to the requirements | Add fabric to the requirements
| Text | mit | vjousse/viserlalune,vjousse/viserlalune,vjousse/viserlalune,vjousse/viserlalune | text | ## Code Before:
Django==1.5.2
Markdown==2.3.1
Mezzanine==1.4.10
Pillow==2.1.0
South==0.8.2
bleach==1.2.2
django-appconf==0.6
django-compressor==1.3
django-widget-tweaks==1.3
feedparser==5.1.3
filebrowser-safe==0.2.28
grappelli-safe==0.2.22
gunicorn==18.0
html5lib==0.95
mezzanine-mdown==0.1a3
oauthlib==0.5.1
psycopg2==2.5.1
pytz==2013b
requests==1.2.3
requests-oauthlib==0.3.2
setproctitle==1.1.7
six==1.4.1
wsgiref==0.1.2
## Instruction:
Add fabric to the requirements
## Code After:
Django==1.5.2
Fabric==1.7.0
Markdown==2.3.1
Mezzanine==1.4.10
Pillow==2.1.0
South==0.8.2
bleach==1.2.2
django-appconf==0.6
django-compressor==1.3
django-widget-tweaks==1.3
feedparser==5.1.3
filebrowser-safe==0.2.28
grappelli-safe==0.2.22
gunicorn==18.0
html5lib==0.95
mezzanine-mdown==0.1a3
oauthlib==0.5.1
paramiko==1.11.0
psycopg2==2.5.1
pycrypto==2.6
pytz==2013b
requests==1.2.3
requests-oauthlib==0.3.2
setproctitle==1.1.7
six==1.4.1
wsgiref==0.1.2
| Django==1.5.2
+ Fabric==1.7.0
Markdown==2.3.1
Mezzanine==1.4.10
Pillow==2.1.0
South==0.8.2
bleach==1.2.2
django-appconf==0.6
django-compressor==1.3
django-widget-tweaks==1.3
feedparser==5.1.3
filebrowser-safe==0.2.28
grappelli-safe==0.2.22
gunicorn==18.0
html5lib==0.95
mezzanine-mdown==0.1a3
oauthlib==0.5.1
+ paramiko==1.11.0
psycopg2==2.5.1
+ pycrypto==2.6
pytz==2013b
requests==1.2.3
requests-oauthlib==0.3.2
setproctitle==1.1.7
six==1.4.1
wsgiref==0.1.2 | 3 | 0.130435 | 3 | 0 |
3a136a01d0e66bf5a0697fe031c0eb9eab0b81c9 | app/server/methods/permissions.js | app/server/methods/permissions.js | Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
| Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
// Remove existing user permissions
Permissions.remove({ userId });
// add new permissions, if any group IDs provided
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
| Delete existing permission prior to inserting new set | Delete existing permission prior to inserting new set
| JavaScript | agpl-3.0 | brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing | javascript | ## Code Before:
Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
## Instruction:
Delete existing permission prior to inserting new set
## Code After:
Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
// Remove existing user permissions
Permissions.remove({ userId });
// add new permissions, if any group IDs provided
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
| Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
+ // Remove existing user permissions
+ Permissions.remove({ userId });
+
+ // add new permissions, if any group IDs provided
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
}); | 4 | 0.363636 | 4 | 0 |
b1c615198aa184d78c47b08d9b4f451ac9041fa2 | README.md | README.md |
_Geotagged Tweets Explorer_ - Example for the book [Mastering D3.js](http://www.packtpub.com/bring-data-to-life-by-creating-and-deploying-complex-data-visualizations-with-d3js/book)
## Using the Application
|
_Geotagged Tweets Explorer_ - Example for the book [Mastering D3.js](http://www.packtpub.com/bring-data-to-life-by-creating-and-deploying-complex-data-visualizations-with-d3js/book)

| Add a screenshot to the Readme file | Add a screenshot to the Readme file
| Markdown | mit | pnavarrc/chirp-client | markdown | ## Code Before:
_Geotagged Tweets Explorer_ - Example for the book [Mastering D3.js](http://www.packtpub.com/bring-data-to-life-by-creating-and-deploying-complex-data-visualizations-with-d3js/book)
## Using the Application
## Instruction:
Add a screenshot to the Readme file
## Code After:
_Geotagged Tweets Explorer_ - Example for the book [Mastering D3.js](http://www.packtpub.com/bring-data-to-life-by-creating-and-deploying-complex-data-visualizations-with-d3js/book)

|
_Geotagged Tweets Explorer_ - Example for the book [Mastering D3.js](http://www.packtpub.com/bring-data-to-life-by-creating-and-deploying-complex-data-visualizations-with-d3js/book)
+ 
- ## Using the Application
-
-
- | 5 | 0.714286 | 1 | 4 |
95c5ec454f1948ca841a95de2f179047709f2cd7 | inst/tests/test-S3.r | inst/tests/test-S3.r | context('S3 dispatch test')
test_that('S3 methods are found', {
s3 = import('s3')
test = local(getS3method('test', 'character', s3))
expect_that(test, equals(s3$test.character))
# NOT executed locally!
print = getS3method('print', 'test')
expect_that(print, equals(s3$print.test))
})
test_that('can call S3 methods without attaching', {
s3 = import('s3')
expect_that(s3$test(1), equals('test.default'))
expect_that(s3$test('a'), equals('test.character'))
foo = structure(42, class = 'test')
expect_that(print(foo), equals('s3$print.test'))
})
| context('S3 dispatch test')
test_that('S3 generics are recognized', {
foo = function (x) UseMethod('foo')
bar = function (x) print('UseMethod')
baz = function (x) {
x = 42
UseMethod('baz')
}
qux = function (x) {
UseMethod('print')
a = 12
}
quz = function (x)
foo(bar(sum(1, UseMethod('quz'))))
expect_true(is_S3_user_generic('foo'))
expect_false(is_S3_user_generic('bar'))
expect_true(is_S3_user_generic('baz'),
'Multi-statement method not recognized')
expect_true(is_S3_user_generic('qux'),
'Method cannot dispatch to generic of different name')
expect_true(is_S3_user_generic('quz'),
'`UseMethod` can be nested in other calls')
})
test_that('S3 methods are found', {
s3 = import('s3')
test = local(getS3method('test', 'character', s3))
expect_that(test, equals(s3$test.character))
# NOT executed locally!
print = getS3method('print', 'test')
expect_that(print, equals(s3$print.test))
})
test_that('can call S3 methods without attaching', {
s3 = import('s3')
expect_that(s3$test(1), equals('test.default'))
expect_that(s3$test('a'), equals('test.character'))
foo = structure(42, class = 'test')
expect_that(print(foo), equals('s3$print.test'))
})
| Add extensive tests for `is_S3_user_generic` | Add extensive tests for `is_S3_user_generic`
| R | apache-2.0 | klmr/modules,klmr/modules | r | ## Code Before:
context('S3 dispatch test')
test_that('S3 methods are found', {
s3 = import('s3')
test = local(getS3method('test', 'character', s3))
expect_that(test, equals(s3$test.character))
# NOT executed locally!
print = getS3method('print', 'test')
expect_that(print, equals(s3$print.test))
})
test_that('can call S3 methods without attaching', {
s3 = import('s3')
expect_that(s3$test(1), equals('test.default'))
expect_that(s3$test('a'), equals('test.character'))
foo = structure(42, class = 'test')
expect_that(print(foo), equals('s3$print.test'))
})
## Instruction:
Add extensive tests for `is_S3_user_generic`
## Code After:
context('S3 dispatch test')
test_that('S3 generics are recognized', {
foo = function (x) UseMethod('foo')
bar = function (x) print('UseMethod')
baz = function (x) {
x = 42
UseMethod('baz')
}
qux = function (x) {
UseMethod('print')
a = 12
}
quz = function (x)
foo(bar(sum(1, UseMethod('quz'))))
expect_true(is_S3_user_generic('foo'))
expect_false(is_S3_user_generic('bar'))
expect_true(is_S3_user_generic('baz'),
'Multi-statement method not recognized')
expect_true(is_S3_user_generic('qux'),
'Method cannot dispatch to generic of different name')
expect_true(is_S3_user_generic('quz'),
'`UseMethod` can be nested in other calls')
})
test_that('S3 methods are found', {
s3 = import('s3')
test = local(getS3method('test', 'character', s3))
expect_that(test, equals(s3$test.character))
# NOT executed locally!
print = getS3method('print', 'test')
expect_that(print, equals(s3$print.test))
})
test_that('can call S3 methods without attaching', {
s3 = import('s3')
expect_that(s3$test(1), equals('test.default'))
expect_that(s3$test('a'), equals('test.character'))
foo = structure(42, class = 'test')
expect_that(print(foo), equals('s3$print.test'))
})
| context('S3 dispatch test')
+
+ test_that('S3 generics are recognized', {
+ foo = function (x) UseMethod('foo')
+ bar = function (x) print('UseMethod')
+ baz = function (x) {
+ x = 42
+ UseMethod('baz')
+ }
+ qux = function (x) {
+ UseMethod('print')
+ a = 12
+ }
+ quz = function (x)
+ foo(bar(sum(1, UseMethod('quz'))))
+
+ expect_true(is_S3_user_generic('foo'))
+ expect_false(is_S3_user_generic('bar'))
+ expect_true(is_S3_user_generic('baz'),
+ 'Multi-statement method not recognized')
+ expect_true(is_S3_user_generic('qux'),
+ 'Method cannot dispatch to generic of different name')
+ expect_true(is_S3_user_generic('quz'),
+ '`UseMethod` can be nested in other calls')
+ })
test_that('S3 methods are found', {
s3 = import('s3')
test = local(getS3method('test', 'character', s3))
expect_that(test, equals(s3$test.character))
# NOT executed locally!
print = getS3method('print', 'test')
expect_that(print, equals(s3$print.test))
})
test_that('can call S3 methods without attaching', {
s3 = import('s3')
expect_that(s3$test(1), equals('test.default'))
expect_that(s3$test('a'), equals('test.character'))
foo = structure(42, class = 'test')
expect_that(print(foo), equals('s3$print.test'))
}) | 24 | 1.142857 | 24 | 0 |
410b9eb2ddfb21279b650d8abb1cfc0ad8dda6a5 | lib/sirius/semester_calendar.rb | lib/sirius/semester_calendar.rb | require 'ice_cube'
require 'sirius/teaching_time'
module Sirius
class SemesterCalendar
def initialize( teaching_period:, first_week_parity: )
@teaching_period = teaching_period
@first_week_parity = first_week_parity
end
def plan(teaching_time)
week_offset = teaching_time.week_offset(@first_week_parity)
scheduling_start = @teaching_period.starts_at + teaching_time.starts_at.seconds_since_midnight.seconds + week_offset
event_duration = (teaching_time.ends_at - teaching_time.starts_at)
event_schedule = IceCube::Schedule.new(scheduling_start, duration: event_duration)
event_schedule.add_recurrence_rule to_recurrence_rule(teaching_time)
event_schedule.all_occurrences.map { |event_start| Period.new(event_start.to_time, event_start + event_duration) }
end
private
def to_recurrence_rule(teaching_time)
week_frequency = 1 # every week by default
week_frequency = 2 if teaching_time.parity != :both
IceCube::Rule.weekly(week_frequency, :monday).day(teaching_time.day).until(@teaching_period.ends_at)
end
end
end
| require 'ice_cube'
require 'sirius/teaching_time'
module Sirius
class SemesterCalendar
def initialize( teaching_period:, first_week_parity: )
@teaching_period = teaching_period
@first_week_parity = first_week_parity
end
def plan(teaching_time)
week_offset = teaching_time.week_offset(@first_week_parity)
scheduling_start = combine_date_with_time(@teaching_period.starts_at, teaching_time.starts_at) + week_offset
event_duration = (teaching_time.ends_at - teaching_time.starts_at)
event_schedule = IceCube::Schedule.new(scheduling_start, duration: event_duration)
event_schedule.add_recurrence_rule to_recurrence_rule(teaching_time)
event_schedule.all_occurrences.map { |event_start| Period.new(event_start.to_time, event_start + event_duration) }
end
private
def to_recurrence_rule(teaching_time)
week_frequency = 1 # every week by default
week_frequency = 2 if teaching_time.parity != :both
IceCube::Rule.weekly(week_frequency, :monday).day(teaching_time.day).until(@teaching_period.ends_at)
end
def combine_date_with_time(date, time)
Time.new(date.year, date.month, date.day, time.hour, time.min, time.sec)
end
end
end
| Fix scheduling issue with seconds_since_midnight on DST transition day. | Fix scheduling issue with seconds_since_midnight on DST transition day.
| Ruby | mit | cvut/sirius,cvut/sirius | ruby | ## Code Before:
require 'ice_cube'
require 'sirius/teaching_time'
module Sirius
class SemesterCalendar
def initialize( teaching_period:, first_week_parity: )
@teaching_period = teaching_period
@first_week_parity = first_week_parity
end
def plan(teaching_time)
week_offset = teaching_time.week_offset(@first_week_parity)
scheduling_start = @teaching_period.starts_at + teaching_time.starts_at.seconds_since_midnight.seconds + week_offset
event_duration = (teaching_time.ends_at - teaching_time.starts_at)
event_schedule = IceCube::Schedule.new(scheduling_start, duration: event_duration)
event_schedule.add_recurrence_rule to_recurrence_rule(teaching_time)
event_schedule.all_occurrences.map { |event_start| Period.new(event_start.to_time, event_start + event_duration) }
end
private
def to_recurrence_rule(teaching_time)
week_frequency = 1 # every week by default
week_frequency = 2 if teaching_time.parity != :both
IceCube::Rule.weekly(week_frequency, :monday).day(teaching_time.day).until(@teaching_period.ends_at)
end
end
end
## Instruction:
Fix scheduling issue with seconds_since_midnight on DST transition day.
## Code After:
require 'ice_cube'
require 'sirius/teaching_time'
module Sirius
class SemesterCalendar
def initialize( teaching_period:, first_week_parity: )
@teaching_period = teaching_period
@first_week_parity = first_week_parity
end
def plan(teaching_time)
week_offset = teaching_time.week_offset(@first_week_parity)
scheduling_start = combine_date_with_time(@teaching_period.starts_at, teaching_time.starts_at) + week_offset
event_duration = (teaching_time.ends_at - teaching_time.starts_at)
event_schedule = IceCube::Schedule.new(scheduling_start, duration: event_duration)
event_schedule.add_recurrence_rule to_recurrence_rule(teaching_time)
event_schedule.all_occurrences.map { |event_start| Period.new(event_start.to_time, event_start + event_duration) }
end
private
def to_recurrence_rule(teaching_time)
week_frequency = 1 # every week by default
week_frequency = 2 if teaching_time.parity != :both
IceCube::Rule.weekly(week_frequency, :monday).day(teaching_time.day).until(@teaching_period.ends_at)
end
def combine_date_with_time(date, time)
Time.new(date.year, date.month, date.day, time.hour, time.min, time.sec)
end
end
end
| require 'ice_cube'
require 'sirius/teaching_time'
module Sirius
class SemesterCalendar
def initialize( teaching_period:, first_week_parity: )
@teaching_period = teaching_period
@first_week_parity = first_week_parity
end
def plan(teaching_time)
week_offset = teaching_time.week_offset(@first_week_parity)
-
- scheduling_start = @teaching_period.starts_at + teaching_time.starts_at.seconds_since_midnight.seconds + week_offset
? ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ scheduling_start = combine_date_with_time(@teaching_period.starts_at, teaching_time.starts_at) + week_offset
? +++++++++++++++++++++++ ^ ^
event_duration = (teaching_time.ends_at - teaching_time.starts_at)
event_schedule = IceCube::Schedule.new(scheduling_start, duration: event_duration)
event_schedule.add_recurrence_rule to_recurrence_rule(teaching_time)
event_schedule.all_occurrences.map { |event_start| Period.new(event_start.to_time, event_start + event_duration) }
end
private
def to_recurrence_rule(teaching_time)
week_frequency = 1 # every week by default
week_frequency = 2 if teaching_time.parity != :both
IceCube::Rule.weekly(week_frequency, :monday).day(teaching_time.day).until(@teaching_period.ends_at)
end
+ def combine_date_with_time(date, time)
+ Time.new(date.year, date.month, date.day, time.hour, time.min, time.sec)
+ end
+
end
end
| 7 | 0.212121 | 5 | 2 |
cebf65bc8667aa2a7814c71c7bb09c602c0d7f03 | Nimble/Utils/Stringers.swift | Nimble/Utils/Stringers.swift | import Foundation
func _identityAsString(value: NSObject?) -> String {
if value == nil {
return "nil"
}
return NSString(format: "<%p>", value!)
}
func _arrayAsString<T>(items: [T], joiner: String = ", ") -> String {
return items.reduce("") { accum, item in
let prefix = (accum.isEmpty ? "" : joiner)
return accum + prefix + "\(item)"
}
}
@objc protocol NMBStringer {
func NMB_stringify() -> String
}
func stringify<S: SequenceType>(value: S) -> String {
var generator = value.generate()
var strings = [String]()
var value: S.Generator.Element?
do {
value = generator.next()
if value != nil {
strings.append(stringify(value))
}
} while value != nil
let str = ", ".join(strings)
return "[\(str)]"
}
extension NSArray : NMBStringer {
func NMB_stringify() -> String {
let str = self.componentsJoinedByString(", ")
return "[\(str)]"
}
}
func stringify<T>(value: T?) -> String {
if value is Double {
return NSString(format: "%.4f", (value as Double))
}
return toString(value)
}
| import Foundation
func _identityAsString(value: NSObject?) -> String {
if value == nil {
return "nil"
}
return NSString(format: "<%p>", value!)
}
func _arrayAsString<T>(items: [T], joiner: String = ", ") -> String {
return items.reduce("") { accum, item in
let prefix = (accum.isEmpty ? "" : joiner)
return accum + prefix + "\(item)"
}
}
@objc protocol NMBStringer {
func NMB_stringify() -> String
}
func stringify<S: SequenceType>(value: S) -> String {
var generator = value.generate()
var strings = [String]()
var value: S.Generator.Element?
do {
value = generator.next()
if value != nil {
strings.append(stringify(value))
}
} while value != nil
let str = ", ".join(strings)
return "[\(str)]"
}
extension NSArray : NMBStringer {
func NMB_stringify() -> String {
let str = self.componentsJoinedByString(", ")
return "[\(str)]"
}
}
func stringify<T>(value: T) -> String {
if value is Double {
return NSString(format: "%.4f", (value as Double))
}
return toString(value)
}
func stringify<T>(value: T?) -> String {
switch value {
case let .Some(realValue):
return stringify(realValue)
default: return "nil"
}
}
| Fix output of matched values when tests fail. | Fix output of matched values when tests fail.
A previous commit removed the Printable extension on Optional types, since XCode 6.1/Swift 1.1 does not allow external types to have public extensions.
That extension made output of optionals clearer, and this commit restores that functionalityl.
| Swift | apache-2.0 | ashfurrow/Nimble,abbeycode/Nimble,gfontenot/Nimble,mishimay/Nimble,briancroom/Nimble,github/Nimble,msdgwzhy6/Nimble,AnthonyMDev/Nimble,alvinvarghese/Nimble,mrackwitz/Nimble,Quick/Nimble,twobitlabs/Nimble,mrackwitz/Nimble,DanielAsher/Nimble,rbeeger/Nimble,alexbasson/Nimble,octo-technology/Nimble,romankl/Nimble,makezwl/zhao,mishimay/Nimble,abbeycode/Nimble,Quick/Nimble,jeffh/Nimble,msdgwzhy6/Nimble,feinstruktur/Nimble,jeffh/Nimble,NatashaTheRobot/Nimble,briancroom/Nimble,phatblat/Nimble,twobitlabs/Nimble,Quick/Nimble,gfontenot/Nimble,romankl/Nimble,abbeycode/Nimble,NatashaTheRobot/Nimble,alexbasson/Nimble,ScottRobbins/Nimble,makezwl/zhao,alexbasson/Nimble,phatblat/Nimble,dgdosen/Nimble,mishimay/Nimble,dgdosen/Nimble,vtongcoder/Nimble,briancroom/Nimble,feinstruktur/Nimble,AnthonyMDev/Nimble,joemasilotti/Nimble,rbeeger/Nimble,github/Nimble,dgdosen/Nimble,makezwl/zhao,DanielAsher/Nimble,msdgwzhy6/Nimble,DanielAsher/Nimble,abbeycode/Nimble,ScottRobbins/Nimble,gfontenot/Nimble,joemasilotti/Nimble,ScottRobbins/Nimble,mrackwitz/Nimble,alvinvarghese/Nimble,rbeeger/Nimble,ashfurrow/Nimble,nikita-leonov/Nimble,rbeeger/Nimble,romankl/Nimble,octo-technology/Nimble,alvinvarghese/Nimble,octo-technology/Nimble,mrackwitz/Nimble,feinstruktur/Nimble,vtongcoder/Nimble,msdgwzhy6/Nimble,dgdosen/Nimble,gfontenot/Nimble,alexbasson/Nimble,alvinvarghese/Nimble,jrmiddle/Nimble,vtongcoder/Nimble,jrmiddle/Nimble,joemasilotti/Nimble,jeffh/Nimble,ashfurrow/Nimble,nikita-leonov/Nimble,phatblat/Nimble,briancroom/Nimble,nikita-leonov/Nimble,jrmiddle/Nimble,NatashaTheRobot/Nimble,NatashaTheRobot/Nimble,romankl/Nimble,twobitlabs/Nimble,AnthonyMDev/Nimble,jeffh/Nimble,octo-technology/Nimble,jrmiddle/Nimble | swift | ## Code Before:
import Foundation
func _identityAsString(value: NSObject?) -> String {
if value == nil {
return "nil"
}
return NSString(format: "<%p>", value!)
}
func _arrayAsString<T>(items: [T], joiner: String = ", ") -> String {
return items.reduce("") { accum, item in
let prefix = (accum.isEmpty ? "" : joiner)
return accum + prefix + "\(item)"
}
}
@objc protocol NMBStringer {
func NMB_stringify() -> String
}
func stringify<S: SequenceType>(value: S) -> String {
var generator = value.generate()
var strings = [String]()
var value: S.Generator.Element?
do {
value = generator.next()
if value != nil {
strings.append(stringify(value))
}
} while value != nil
let str = ", ".join(strings)
return "[\(str)]"
}
extension NSArray : NMBStringer {
func NMB_stringify() -> String {
let str = self.componentsJoinedByString(", ")
return "[\(str)]"
}
}
func stringify<T>(value: T?) -> String {
if value is Double {
return NSString(format: "%.4f", (value as Double))
}
return toString(value)
}
## Instruction:
Fix output of matched values when tests fail.
A previous commit removed the Printable extension on Optional types, since XCode 6.1/Swift 1.1 does not allow external types to have public extensions.
That extension made output of optionals clearer, and this commit restores that functionalityl.
## Code After:
import Foundation
func _identityAsString(value: NSObject?) -> String {
if value == nil {
return "nil"
}
return NSString(format: "<%p>", value!)
}
func _arrayAsString<T>(items: [T], joiner: String = ", ") -> String {
return items.reduce("") { accum, item in
let prefix = (accum.isEmpty ? "" : joiner)
return accum + prefix + "\(item)"
}
}
@objc protocol NMBStringer {
func NMB_stringify() -> String
}
func stringify<S: SequenceType>(value: S) -> String {
var generator = value.generate()
var strings = [String]()
var value: S.Generator.Element?
do {
value = generator.next()
if value != nil {
strings.append(stringify(value))
}
} while value != nil
let str = ", ".join(strings)
return "[\(str)]"
}
extension NSArray : NMBStringer {
func NMB_stringify() -> String {
let str = self.componentsJoinedByString(", ")
return "[\(str)]"
}
}
func stringify<T>(value: T) -> String {
if value is Double {
return NSString(format: "%.4f", (value as Double))
}
return toString(value)
}
func stringify<T>(value: T?) -> String {
switch value {
case let .Some(realValue):
return stringify(realValue)
default: return "nil"
}
}
| import Foundation
func _identityAsString(value: NSObject?) -> String {
if value == nil {
return "nil"
}
return NSString(format: "<%p>", value!)
}
func _arrayAsString<T>(items: [T], joiner: String = ", ") -> String {
return items.reduce("") { accum, item in
let prefix = (accum.isEmpty ? "" : joiner)
return accum + prefix + "\(item)"
}
}
@objc protocol NMBStringer {
func NMB_stringify() -> String
}
func stringify<S: SequenceType>(value: S) -> String {
var generator = value.generate()
var strings = [String]()
var value: S.Generator.Element?
do {
value = generator.next()
if value != nil {
strings.append(stringify(value))
}
} while value != nil
let str = ", ".join(strings)
return "[\(str)]"
}
extension NSArray : NMBStringer {
func NMB_stringify() -> String {
let str = self.componentsJoinedByString(", ")
return "[\(str)]"
}
}
- func stringify<T>(value: T?) -> String {
? -
+ func stringify<T>(value: T) -> String {
if value is Double {
return NSString(format: "%.4f", (value as Double))
}
return toString(value)
}
+
+ func stringify<T>(value: T?) -> String {
+ switch value {
+ case let .Some(realValue):
+ return stringify(realValue)
+ default: return "nil"
+ }
+ } | 10 | 0.208333 | 9 | 1 |
cce25bed6775f84a0ff9b3a19a86e9b573f47d69 | metadata/pl.narfsoftware.thermometer.txt | metadata/pl.narfsoftware.thermometer.txt | Categories:System
License:???
Web Site:http://www.narfsoftware.pl
Source Code:https://github.com/mateuszbuda/ThermometerExtended2
Issue Tracker:https://github.com/mateuszbuda/ThermometerExtended2/issues
Summary:Ambient conditions with charts
Description:
It displays additional information about various ambient conditions.
You can also choose to save data and examine it on a plot.
Features:
- Temperature
- Relative humidity
- Absolute humidity
- Pressure
- Dew point
- Light
- Magnetic field
Notice:
When you are using Thermometer Extended in Save Data mode, chosen sensors stay active, even if you close application.
That may drain device battery especially quickly, so always remember to stop saving data if you do not need it.
By default this option for all sensors is turned off.
.
Repo Type:git
Repo:https://github.com/mateuszbuda/ThermometerExtended2.git
Build:2.5.2,29
disable=no license: https://github.com/mateuszbuda/ThermometerExtended2/issues/16
commit=e10d6991
srclibs=1:GraphView@638ab6ac76
Auto Update Mode:None
Update Check Mode:Tags
| Categories:System
License:???
Web Site:http://www.narfsoftware.pl
Source Code:https://github.com/mateuszbuda/ThermometerExtended2
Issue Tracker:https://github.com/mateuszbuda/ThermometerExtended2/issues
Auto Name:Thermometer Extended
Summary:Ambient conditions with charts
Description:
It displays additional information about various ambient conditions.
You can also choose to save data and examine it on a plot.
Features:
- Temperature
- Relative humidity
- Absolute humidity
- Pressure
- Dew point
- Light
- Magnetic field
Notice:
When you are using Thermometer Extended in Save Data mode, chosen sensors stay active, even if you close application.
That may drain device battery especially quickly, so always remember to stop saving data if you do not need it.
By default this option for all sensors is turned off.
.
Repo Type:git
Repo:https://github.com/mateuszbuda/ThermometerExtended2.git
Build:2.5.2,29
disable=no license: https://github.com/mateuszbuda/ThermometerExtended2/issues/16
commit=e10d6991
srclibs=1:GraphView@638ab6ac76
Auto Update Mode:None
Update Check Mode:Tags
| Set autoname of Thermometer Extended | Set autoname of Thermometer Extended
| Text | agpl-3.0 | f-droid/fdroid-data,f-droid/fdroiddata,f-droid/fdroiddata | text | ## Code Before:
Categories:System
License:???
Web Site:http://www.narfsoftware.pl
Source Code:https://github.com/mateuszbuda/ThermometerExtended2
Issue Tracker:https://github.com/mateuszbuda/ThermometerExtended2/issues
Summary:Ambient conditions with charts
Description:
It displays additional information about various ambient conditions.
You can also choose to save data and examine it on a plot.
Features:
- Temperature
- Relative humidity
- Absolute humidity
- Pressure
- Dew point
- Light
- Magnetic field
Notice:
When you are using Thermometer Extended in Save Data mode, chosen sensors stay active, even if you close application.
That may drain device battery especially quickly, so always remember to stop saving data if you do not need it.
By default this option for all sensors is turned off.
.
Repo Type:git
Repo:https://github.com/mateuszbuda/ThermometerExtended2.git
Build:2.5.2,29
disable=no license: https://github.com/mateuszbuda/ThermometerExtended2/issues/16
commit=e10d6991
srclibs=1:GraphView@638ab6ac76
Auto Update Mode:None
Update Check Mode:Tags
## Instruction:
Set autoname of Thermometer Extended
## Code After:
Categories:System
License:???
Web Site:http://www.narfsoftware.pl
Source Code:https://github.com/mateuszbuda/ThermometerExtended2
Issue Tracker:https://github.com/mateuszbuda/ThermometerExtended2/issues
Auto Name:Thermometer Extended
Summary:Ambient conditions with charts
Description:
It displays additional information about various ambient conditions.
You can also choose to save data and examine it on a plot.
Features:
- Temperature
- Relative humidity
- Absolute humidity
- Pressure
- Dew point
- Light
- Magnetic field
Notice:
When you are using Thermometer Extended in Save Data mode, chosen sensors stay active, even if you close application.
That may drain device battery especially quickly, so always remember to stop saving data if you do not need it.
By default this option for all sensors is turned off.
.
Repo Type:git
Repo:https://github.com/mateuszbuda/ThermometerExtended2.git
Build:2.5.2,29
disable=no license: https://github.com/mateuszbuda/ThermometerExtended2/issues/16
commit=e10d6991
srclibs=1:GraphView@638ab6ac76
Auto Update Mode:None
Update Check Mode:Tags
| Categories:System
License:???
Web Site:http://www.narfsoftware.pl
Source Code:https://github.com/mateuszbuda/ThermometerExtended2
Issue Tracker:https://github.com/mateuszbuda/ThermometerExtended2/issues
+ Auto Name:Thermometer Extended
Summary:Ambient conditions with charts
Description:
It displays additional information about various ambient conditions.
You can also choose to save data and examine it on a plot.
Features:
- Temperature
- Relative humidity
- Absolute humidity
- Pressure
- Dew point
- Light
- Magnetic field
Notice:
When you are using Thermometer Extended in Save Data mode, chosen sensors stay active, even if you close application.
That may drain device battery especially quickly, so always remember to stop saving data if you do not need it.
By default this option for all sensors is turned off.
.
Repo Type:git
Repo:https://github.com/mateuszbuda/ThermometerExtended2.git
Build:2.5.2,29
disable=no license: https://github.com/mateuszbuda/ThermometerExtended2/issues/16
commit=e10d6991
srclibs=1:GraphView@638ab6ac76
Auto Update Mode:None
Update Check Mode:Tags
| 1 | 0.027027 | 1 | 0 |
820c249122a76b13e1f54e2e082efb97e70d962c | rxproperty/src/main/java/com/github/kubode/rxproperty/ReadOnlyObservableProperty.java | rxproperty/src/main/java/com/github/kubode/rxproperty/ReadOnlyObservableProperty.java | package com.github.kubode.rxproperty;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
/**
* Read-only Observable property.
*
* @param <T> the type of this property.
*/
public class ReadOnlyObservableProperty<T> extends Observable<T> {
/**
* The state of {@link ReadOnlyObservableProperty}.
* Generally, {@link #getObservable()} should emit the most recent value when subscribed.
*
* @param <T> the type of value property and item expected to be observed by the {@link #getObservable()}.
*/
public interface State<T> {
/**
* Returns {@link Observable} of this state.
*
* @return an {@link Observable} that emits the most recent value it has observed
* and all subsequent observed items to each subscribed {@link Observer}.
*/
Observable<T> getObservable();
/**
* Returns value of this state.
*
* @return a value of this state.
*/
T getValue();
}
private final State<T> state;
/**
* Creates a ReadOnlyObservableProperty.
*
* @param state a state of this property.
*/
public ReadOnlyObservableProperty(final State<T> state) {
super(new OnSubscribe<T>() {
@Override
public void call(Subscriber<? super T> subscriber) {
subscriber.add(state.getObservable().subscribe(subscriber));
}
});
this.state = state;
}
/**
* Get value of this property.
*
* @return value of {@link #state#getValue()}.
*/
public T getValue() {
return state.getValue();
}
}
| package com.github.kubode.rxproperty;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
/**
* Read-only Observable property.
*
* @param <T> the type of this property.
*/
public class ReadOnlyObservableProperty<T> extends Observable<T> {
/**
* The state of {@link ReadOnlyObservableProperty}.
* Generally, {@link #getObservable()} should emit the most recent value when subscribed.
*
* @param <T> the type of value property and item expected to be observed by the {@link #getObservable()}.
*/
public interface State<T> {
/**
* Returns {@link Observable} of this state.
*
* @return an {@link Observable} that emits the most recent value it has observed
* and all subsequent observed items to each subscribed {@link Observer}.
*/
Observable<T> getObservable();
/**
* Returns value of this state.
*
* @return a value of this state.
*/
T getValue();
}
private final State<T> state;
/**
* Creates a ReadOnlyObservableProperty.
*
* @param state a state of this property.
*/
public ReadOnlyObservableProperty(final State<T> state) {
super(new OnSubscribe<T>() {
@Override
public void call(Subscriber<? super T> subscriber) {
subscriber.add(state.getObservable().subscribe(subscriber));
}
});
this.state = state;
}
/**
* Get value of this property.
*
* @return value of this property.
*/
public T getValue() {
return state.getValue();
}
}
| Fix fail on javadoc task. | Fix fail on javadoc task.
| Java | apache-2.0 | kubode/RxProperty,kubode/RxProperty,kubode/RxProperty | java | ## Code Before:
package com.github.kubode.rxproperty;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
/**
* Read-only Observable property.
*
* @param <T> the type of this property.
*/
public class ReadOnlyObservableProperty<T> extends Observable<T> {
/**
* The state of {@link ReadOnlyObservableProperty}.
* Generally, {@link #getObservable()} should emit the most recent value when subscribed.
*
* @param <T> the type of value property and item expected to be observed by the {@link #getObservable()}.
*/
public interface State<T> {
/**
* Returns {@link Observable} of this state.
*
* @return an {@link Observable} that emits the most recent value it has observed
* and all subsequent observed items to each subscribed {@link Observer}.
*/
Observable<T> getObservable();
/**
* Returns value of this state.
*
* @return a value of this state.
*/
T getValue();
}
private final State<T> state;
/**
* Creates a ReadOnlyObservableProperty.
*
* @param state a state of this property.
*/
public ReadOnlyObservableProperty(final State<T> state) {
super(new OnSubscribe<T>() {
@Override
public void call(Subscriber<? super T> subscriber) {
subscriber.add(state.getObservable().subscribe(subscriber));
}
});
this.state = state;
}
/**
* Get value of this property.
*
* @return value of {@link #state#getValue()}.
*/
public T getValue() {
return state.getValue();
}
}
## Instruction:
Fix fail on javadoc task.
## Code After:
package com.github.kubode.rxproperty;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
/**
* Read-only Observable property.
*
* @param <T> the type of this property.
*/
public class ReadOnlyObservableProperty<T> extends Observable<T> {
/**
* The state of {@link ReadOnlyObservableProperty}.
* Generally, {@link #getObservable()} should emit the most recent value when subscribed.
*
* @param <T> the type of value property and item expected to be observed by the {@link #getObservable()}.
*/
public interface State<T> {
/**
* Returns {@link Observable} of this state.
*
* @return an {@link Observable} that emits the most recent value it has observed
* and all subsequent observed items to each subscribed {@link Observer}.
*/
Observable<T> getObservable();
/**
* Returns value of this state.
*
* @return a value of this state.
*/
T getValue();
}
private final State<T> state;
/**
* Creates a ReadOnlyObservableProperty.
*
* @param state a state of this property.
*/
public ReadOnlyObservableProperty(final State<T> state) {
super(new OnSubscribe<T>() {
@Override
public void call(Subscriber<? super T> subscriber) {
subscriber.add(state.getObservable().subscribe(subscriber));
}
});
this.state = state;
}
/**
* Get value of this property.
*
* @return value of this property.
*/
public T getValue() {
return state.getValue();
}
}
| package com.github.kubode.rxproperty;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
/**
* Read-only Observable property.
*
* @param <T> the type of this property.
*/
public class ReadOnlyObservableProperty<T> extends Observable<T> {
/**
* The state of {@link ReadOnlyObservableProperty}.
* Generally, {@link #getObservable()} should emit the most recent value when subscribed.
*
* @param <T> the type of value property and item expected to be observed by the {@link #getObservable()}.
*/
public interface State<T> {
/**
* Returns {@link Observable} of this state.
*
* @return an {@link Observable} that emits the most recent value it has observed
* and all subsequent observed items to each subscribed {@link Observer}.
*/
Observable<T> getObservable();
/**
* Returns value of this state.
*
* @return a value of this state.
*/
T getValue();
}
private final State<T> state;
/**
* Creates a ReadOnlyObservableProperty.
*
* @param state a state of this property.
*/
public ReadOnlyObservableProperty(final State<T> state) {
super(new OnSubscribe<T>() {
@Override
public void call(Subscriber<? super T> subscriber) {
subscriber.add(state.getObservable().subscribe(subscriber));
}
});
this.state = state;
}
/**
* Get value of this property.
*
- * @return value of {@link #state#getValue()}.
+ * @return value of this property.
*/
public T getValue() {
return state.getValue();
}
} | 2 | 0.031746 | 1 | 1 |
c7e7b452f4e6d4951bc956fd9fde9445a8f782e3 | src/main/scala/de/uni_potsdam/hpi/coheel/programs/LargeFileTestProgram.scala | src/main/scala/de/uni_potsdam/hpi/coheel/programs/LargeFileTestProgram.scala | package de.uni_potsdam.hpi.coheel.programs
import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._
class LargeFileTestProgram extends CoheelProgram with ProgramDescription {
override def getDescription = "Large file test"
override def buildProgram(env: ExecutionEnvironment): Unit = {
val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")
val result = input.mapPartition { linesIt =>
println(s"READHERE: Reading ${linesIt.size} files.")
List((1, 1))
}.sum(0)
result.print()
}
}
| package de.uni_potsdam.hpi.coheel.programs
import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._
class LargeFileTestProgram extends CoheelProgram with ProgramDescription {
override def getDescription = "Large file test"
override def buildProgram(env: ExecutionEnvironment): Unit = {
val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")
val result = input.mapPartition { linesIt =>
println(s"READHERE: Reading ${linesIt.size} files.")
List((1, 1))
}.sum(0)
result.writeAsText("hdfs://tenemhead2/home/stefan.bunk/large_file_result")
}
}
| Write large file result to disk. | Write large file result to disk.
Former-commit-id: bc0604f1be9c1c256852a2998b01507c83c96219 | Scala | apache-2.0 | stratosphere/coheel,stratosphere/coheel,stratosphere/coheel,stratosphere/coheel | scala | ## Code Before:
package de.uni_potsdam.hpi.coheel.programs
import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._
class LargeFileTestProgram extends CoheelProgram with ProgramDescription {
override def getDescription = "Large file test"
override def buildProgram(env: ExecutionEnvironment): Unit = {
val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")
val result = input.mapPartition { linesIt =>
println(s"READHERE: Reading ${linesIt.size} files.")
List((1, 1))
}.sum(0)
result.print()
}
}
## Instruction:
Write large file result to disk.
Former-commit-id: bc0604f1be9c1c256852a2998b01507c83c96219
## Code After:
package de.uni_potsdam.hpi.coheel.programs
import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._
class LargeFileTestProgram extends CoheelProgram with ProgramDescription {
override def getDescription = "Large file test"
override def buildProgram(env: ExecutionEnvironment): Unit = {
val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")
val result = input.mapPartition { linesIt =>
println(s"READHERE: Reading ${linesIt.size} files.")
List((1, 1))
}.sum(0)
result.writeAsText("hdfs://tenemhead2/home/stefan.bunk/large_file_result")
}
}
| package de.uni_potsdam.hpi.coheel.programs
import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._
class LargeFileTestProgram extends CoheelProgram with ProgramDescription {
override def getDescription = "Large file test"
override def buildProgram(env: ExecutionEnvironment): Unit = {
val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")
val result = input.mapPartition { linesIt =>
println(s"READHERE: Reading ${linesIt.size} files.")
List((1, 1))
}.sum(0)
- result.print()
+ result.writeAsText("hdfs://tenemhead2/home/stefan.bunk/large_file_result")
}
} | 2 | 0.105263 | 1 | 1 |
acd58ce2c12c4fa1a9877c8f8774660e3cef755f | doc/DOCKER.md | doc/DOCKER.md |
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in
order to simplify the process of setting up a development environment.
Given that you have `docker` and `docker-compose` installed, the process should be pretty
straighforward.
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database:
cp docker/docker-compose.development.postgresql docker-compose.yml
2. Uncomment the gem for your favorite database driver from the `Gemfile`.
3. Copy the database configuration from `docker/` for your database. For instance,
to use PostgreSQL:
cp docker/database.postgresql.yml config/database.yml
3. Build the image:
docker-compose build
4. Now you should be able to set up the database:
docker-compose run --rm web rake db:setup
5. (Optional) Run the testsuite to find out whether the application works.
docker-compose run --rm web xvfb-run -a rake spec
6. And, now, you can start the application:
docker-compose up
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock`
files.
|
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in
order to simplify the process of setting up a development environment.
Given that you have `docker` and `docker-compose` installed, the process should be pretty
straighforward.
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database:
cp docker/docker-compose.development.postgresql docker-compose.yml
2. Uncomment the gem for your favorite database driver from the `Gemfile`.
3. Copy the database configuration from `docker/` for your database. For instance,
to use PostgreSQL:
cp docker/database.postgresql.yml config/database.yml
4. Build the image:
docker-compose build
5. Now you should be able to set up the database:
docker-compose run --rm web rake db:setup
When using the mysql container, this fifth step may require that you have
started the database container some seconds in advance, since the official
mysql and mariadb containers need some time to initialize the system.
docker-compose up --detach db
6. (Optional) Run the testsuite to find out whether the application works.
docker-compose run --rm web xvfb-run -a rake spec
7. And, now, you can start the application:
docker-compose up
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock`
files.
| Improve documentation about the mysql docker | Improve documentation about the mysql docker
| Markdown | agpl-3.0 | openSUSE/travel-support-program,openSUSE/travel-support-program,openSUSE/travel-support-program | markdown | ## Code Before:
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in
order to simplify the process of setting up a development environment.
Given that you have `docker` and `docker-compose` installed, the process should be pretty
straighforward.
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database:
cp docker/docker-compose.development.postgresql docker-compose.yml
2. Uncomment the gem for your favorite database driver from the `Gemfile`.
3. Copy the database configuration from `docker/` for your database. For instance,
to use PostgreSQL:
cp docker/database.postgresql.yml config/database.yml
3. Build the image:
docker-compose build
4. Now you should be able to set up the database:
docker-compose run --rm web rake db:setup
5. (Optional) Run the testsuite to find out whether the application works.
docker-compose run --rm web xvfb-run -a rake spec
6. And, now, you can start the application:
docker-compose up
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock`
files.
## Instruction:
Improve documentation about the mysql docker
## Code After:
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in
order to simplify the process of setting up a development environment.
Given that you have `docker` and `docker-compose` installed, the process should be pretty
straighforward.
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database:
cp docker/docker-compose.development.postgresql docker-compose.yml
2. Uncomment the gem for your favorite database driver from the `Gemfile`.
3. Copy the database configuration from `docker/` for your database. For instance,
to use PostgreSQL:
cp docker/database.postgresql.yml config/database.yml
4. Build the image:
docker-compose build
5. Now you should be able to set up the database:
docker-compose run --rm web rake db:setup
When using the mysql container, this fifth step may require that you have
started the database container some seconds in advance, since the official
mysql and mariadb containers need some time to initialize the system.
docker-compose up --detach db
6. (Optional) Run the testsuite to find out whether the application works.
docker-compose run --rm web xvfb-run -a rake spec
7. And, now, you can start the application:
docker-compose up
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock`
files.
|
This repository includes a `Dockerfile` and a set of `docker-compose` configuration examples in
order to simplify the process of setting up a development environment.
Given that you have `docker` and `docker-compose` installed, the process should be pretty
straighforward.
1. Select a `docker-compose` configuration file from the `docker/` directory and copy it as
`docker-compose.yml`. For instance, to run the application using a PostgreSQL database:
cp docker/docker-compose.development.postgresql docker-compose.yml
2. Uncomment the gem for your favorite database driver from the `Gemfile`.
3. Copy the database configuration from `docker/` for your database. For instance,
to use PostgreSQL:
cp docker/database.postgresql.yml config/database.yml
- 3. Build the image:
? ^
+ 4. Build the image:
? ^
docker-compose build
- 4. Now you should be able to set up the database:
? ^
+ 5. Now you should be able to set up the database:
? ^
docker-compose run --rm web rake db:setup
+ When using the mysql container, this fifth step may require that you have
+ started the database container some seconds in advance, since the official
+ mysql and mariadb containers need some time to initialize the system.
+
+ docker-compose up --detach db
+
- 5. (Optional) Run the testsuite to find out whether the application works.
? ^
+ 6. (Optional) Run the testsuite to find out whether the application works.
? ^
docker-compose run --rm web xvfb-run -a rake spec
- 6. And, now, you can start the application:
? ^
+ 7. And, now, you can start the application:
? ^
docker-compose up
For now on, you will need to rebuild the image whenever you change the `Gemfile` or `Gemfile.lock`
files. | 14 | 0.388889 | 10 | 4 |
0bb47e5c55ca75b447b459208a9e1c9dd56ead77 | cmd/promxy/config.yaml | cmd/promxy/config.yaml | global:
evaluation_interval: 5s
# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
- "*rule"
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "127.0.0.1:12345"
# Our own server-group configs
server_groups:
- static_configs:
- targets:
- localhost:9090
- static_configs:
- targets:
- localhost:9091
| global:
evaluation_interval: 5s
external_labels:
source: promxy
# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
- "*rule"
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "127.0.0.1:12345"
##
### Promxy configuration
##
server_groups:
- static_configs:
- targets:
- localhost:9090
- static_configs:
- targets:
- localhost:9091
| Update comments to show more features | Update comments to show more features
| YAML | mit | jacksontj/promxy,jacksontj/promxy | yaml | ## Code Before:
global:
evaluation_interval: 5s
# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
- "*rule"
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "127.0.0.1:12345"
# Our own server-group configs
server_groups:
- static_configs:
- targets:
- localhost:9090
- static_configs:
- targets:
- localhost:9091
## Instruction:
Update comments to show more features
## Code After:
global:
evaluation_interval: 5s
external_labels:
source: promxy
# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
- "*rule"
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "127.0.0.1:12345"
##
### Promxy configuration
##
server_groups:
- static_configs:
- targets:
- localhost:9090
- static_configs:
- targets:
- localhost:9091
| global:
evaluation_interval: 5s
+ external_labels:
+ source: promxy
# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
- "*rule"
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "127.0.0.1:12345"
- # Our own server-group configs
+ ##
+ ### Promxy configuration
+ ##
server_groups:
- static_configs:
- targets:
- localhost:9090
- static_configs:
- targets:
- localhost:9091 | 6 | 0.25 | 5 | 1 |
4e18989972d5df6be98ad8f180225d58692d9994 | lib/oga/xml/namespace.rb | lib/oga/xml/namespace.rb | module Oga
module XML
##
# The Namespace class contains information about XML namespaces such as the
# name and URI.
#
class Namespace
attr_accessor :name, :uri
##
# @param [Hash] options
#
# @option options [String] :name
# @option options [String] :uri
#
def initialize(options = {})
@name = options[:name]
@uri = options[:uri]
end
##
# @return [String]
#
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga
| module Oga
module XML
##
# The Namespace class contains information about XML namespaces such as the
# name and URI.
#
class Namespace
attr_accessor :name
##
# @param [Hash] options
#
# @option options [String] :name
#
def initialize(options = {})
@name = options[:name]
end
##
# @return [String]
#
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga
| Remove the uri attribute from Namespace. | Remove the uri attribute from Namespace.
Oga won't be handling URIs any time soon. The rationale is that they server zero
purpose when it comes to just parsing XML. Another goal of Oga is to make it
easy to modify and reserialize documents back to XML. If namespaces would also
store the URIs this would make this process more difficult.
| Ruby | mpl-2.0 | altmetric/oga,jeffreybaird/oga,dfockler/oga,ttasanen/oga,altmetric/oga,jeffreybaird/oga,ttasanen/oga,ttasanen/oga,jeffreybaird/oga,dfockler/oga,YorickPeterse/oga,altmetric/oga,jeffreybaird/oga,YorickPeterse/oga,dfockler/oga,altmetric/oga,dfockler/oga,YorickPeterse/oga,jeffreybaird/oga,ttasanen/oga,YorickPeterse/oga,dfockler/oga,ttasanen/oga,YorickPeterse/oga,altmetric/oga | ruby | ## Code Before:
module Oga
module XML
##
# The Namespace class contains information about XML namespaces such as the
# name and URI.
#
class Namespace
attr_accessor :name, :uri
##
# @param [Hash] options
#
# @option options [String] :name
# @option options [String] :uri
#
def initialize(options = {})
@name = options[:name]
@uri = options[:uri]
end
##
# @return [String]
#
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga
## Instruction:
Remove the uri attribute from Namespace.
Oga won't be handling URIs any time soon. The rationale is that they server zero
purpose when it comes to just parsing XML. Another goal of Oga is to make it
easy to modify and reserialize documents back to XML. If namespaces would also
store the URIs this would make this process more difficult.
## Code After:
module Oga
module XML
##
# The Namespace class contains information about XML namespaces such as the
# name and URI.
#
class Namespace
attr_accessor :name
##
# @param [Hash] options
#
# @option options [String] :name
#
def initialize(options = {})
@name = options[:name]
end
##
# @return [String]
#
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga
| module Oga
module XML
##
# The Namespace class contains information about XML namespaces such as the
# name and URI.
#
class Namespace
- attr_accessor :name, :uri
? ------
+ attr_accessor :name
##
# @param [Hash] options
#
# @option options [String] :name
- # @option options [String] :uri
#
def initialize(options = {})
@name = options[:name]
- @uri = options[:uri]
end
##
# @return [String]
#
def to_s
return name.to_s
end
##
# @return [String]
#
def inspect
return "Namespace(name: #{name.inspect})"
end
end # Namespace
end # XML
end # Oga | 4 | 0.111111 | 1 | 3 |
20adcf2d1c43df8ffa27dfcbe67e6443adadc353 | test/index.js | test/index.js | /* eslint-disable func-names, no-use-before-define */
import co from 'co';
import test from 'blue-tape';
import agent from 'promisify-supertest';
import createApplication from '../src';
const setup = () => {
return agent(createApplication().callback());
};
test('GET /', (sub) => {
sub.test('responds with OK status code', co.wrap(function* (assert) {
const app = setup();
yield app
.get('/')
.expect(statusCodeToBeOk)
.end();
function statusCodeToBeOk({statusCode}) {
const okStatusCode = 200;
assert.equal(statusCode, okStatusCode, 'should be status OK');
}
}));
});
| /* eslint-disable func-names, no-use-before-define */
import co from 'co';
import test from 'blue-tape';
import createTestAgent from 'promisify-supertest';
import createApplication from '../src';
test('GET /', (sub) => {
sub.test('responds with OK status code', co.wrap(function* (assert) {
const app = setup();
yield app
.get('/')
.expect(statusCodeToBeOk)
.end();
function statusCodeToBeOk({statusCode}) {
const okStatusCode = 200;
assert.equal(statusCode, okStatusCode, 'should be status OK');
}
}));
sub.test('responds with JSON content type', co.wrap(function* (assert) {
const fixture = setup();
yield fixture
.get('/')
.expect(contentTypeToBeJson)
.end();
function contentTypeToBeJson({type}) {
const expectedType = 'application/json';
assert.equal(type, expectedType, 'should be application/json');
}
}));
sub.test('responds with an object with `hold on` and `let go` keys',
co.wrap(function* (assert) {
const fixture = setup();
yield fixture
.get('/')
.expect(bodyToBeTruthy)
.expect(bodyToHaveKeys('hold on', 'let go'))
.end();
function bodyToBeTruthy({body}) {
assert.ok(body, 'should be truthy');
}
function bodyToHaveKeys(...keys) {
return function bodyToHaveKeysAssertion({body}) {
keys.forEach((key) => {
assert.ok(key in body, `should have key ${key}`);
});
};
}
}));
});
function setup() {
const app = createApplication();
return createTestAgent(app.callback());
}
| Add root route content and content type tests. | Add root route content and content type tests.
| JavaScript | isc | francisbrito/let-go-hold-on-api | javascript | ## Code Before:
/* eslint-disable func-names, no-use-before-define */
import co from 'co';
import test from 'blue-tape';
import agent from 'promisify-supertest';
import createApplication from '../src';
const setup = () => {
return agent(createApplication().callback());
};
test('GET /', (sub) => {
sub.test('responds with OK status code', co.wrap(function* (assert) {
const app = setup();
yield app
.get('/')
.expect(statusCodeToBeOk)
.end();
function statusCodeToBeOk({statusCode}) {
const okStatusCode = 200;
assert.equal(statusCode, okStatusCode, 'should be status OK');
}
}));
});
## Instruction:
Add root route content and content type tests.
## Code After:
/* eslint-disable func-names, no-use-before-define */
import co from 'co';
import test from 'blue-tape';
import createTestAgent from 'promisify-supertest';
import createApplication from '../src';
test('GET /', (sub) => {
sub.test('responds with OK status code', co.wrap(function* (assert) {
const app = setup();
yield app
.get('/')
.expect(statusCodeToBeOk)
.end();
function statusCodeToBeOk({statusCode}) {
const okStatusCode = 200;
assert.equal(statusCode, okStatusCode, 'should be status OK');
}
}));
sub.test('responds with JSON content type', co.wrap(function* (assert) {
const fixture = setup();
yield fixture
.get('/')
.expect(contentTypeToBeJson)
.end();
function contentTypeToBeJson({type}) {
const expectedType = 'application/json';
assert.equal(type, expectedType, 'should be application/json');
}
}));
sub.test('responds with an object with `hold on` and `let go` keys',
co.wrap(function* (assert) {
const fixture = setup();
yield fixture
.get('/')
.expect(bodyToBeTruthy)
.expect(bodyToHaveKeys('hold on', 'let go'))
.end();
function bodyToBeTruthy({body}) {
assert.ok(body, 'should be truthy');
}
function bodyToHaveKeys(...keys) {
return function bodyToHaveKeysAssertion({body}) {
keys.forEach((key) => {
assert.ok(key in body, `should have key ${key}`);
});
};
}
}));
});
function setup() {
const app = createApplication();
return createTestAgent(app.callback());
}
| /* eslint-disable func-names, no-use-before-define */
import co from 'co';
import test from 'blue-tape';
- import agent from 'promisify-supertest';
+ import createTestAgent from 'promisify-supertest';
? +++ +++++++
import createApplication from '../src';
-
- const setup = () => {
- return agent(createApplication().callback());
- };
test('GET /', (sub) => {
sub.test('responds with OK status code', co.wrap(function* (assert) {
const app = setup();
yield app
.get('/')
.expect(statusCodeToBeOk)
.end();
function statusCodeToBeOk({statusCode}) {
const okStatusCode = 200;
assert.equal(statusCode, okStatusCode, 'should be status OK');
}
}));
+
+ sub.test('responds with JSON content type', co.wrap(function* (assert) {
+ const fixture = setup();
+
+ yield fixture
+ .get('/')
+ .expect(contentTypeToBeJson)
+ .end();
+
+ function contentTypeToBeJson({type}) {
+ const expectedType = 'application/json';
+
+ assert.equal(type, expectedType, 'should be application/json');
+ }
+ }));
+ sub.test('responds with an object with `hold on` and `let go` keys',
+ co.wrap(function* (assert) {
+ const fixture = setup();
+
+ yield fixture
+ .get('/')
+ .expect(bodyToBeTruthy)
+ .expect(bodyToHaveKeys('hold on', 'let go'))
+ .end();
+
+ function bodyToBeTruthy({body}) {
+ assert.ok(body, 'should be truthy');
+ }
+
+ function bodyToHaveKeys(...keys) {
+ return function bodyToHaveKeysAssertion({body}) {
+ keys.forEach((key) => {
+ assert.ok(key in body, `should have key ${key}`);
+ });
+ };
+ }
+ }));
});
+
+ function setup() {
+ const app = createApplication();
+
+ return createTestAgent(app.callback());
+ } | 49 | 1.75 | 44 | 5 |
38d9a85bc23bfcf3e44081d3077bbd5ca333fdf3 | src/damis/api/serializers.py | src/damis/api/serializers.py | from django.contrib.auth.models import User, Group
from rest_framework import serializers
from damis.models import Dataset, Algorithm, Experiment
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('url', 'name')
class DatasetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dataset
fields = ('title', 'licence', 'description', 'author', 'created', 'file', 'file_format')
class AlgorithmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Algorithm
fields = ('title', 'user', 'file', 'executable_file', 'created', 'updated')
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Experiment
fields = ('title', 'start', 'finish', 'user')
| from django.contrib.auth.models import User, Group
from rest_framework import serializers
from damis.models import Dataset, Algorithm, Experiment
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('url', 'name')
class DatasetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dataset
fields = ('title', 'licence', 'description', 'author', 'created', 'file', 'file_format')
class AlgorithmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Algorithm
fields = ('title', 'user', 'file', 'executable_file', 'created', 'updated')
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Experiment
fields = ('title', 'start', 'finish', 'user', 'status')
| Allow modify experiment status via REST API. | Allow modify experiment status via REST API.
| Python | agpl-3.0 | InScience/DAMIS-old,InScience/DAMIS-old | python | ## Code Before:
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from damis.models import Dataset, Algorithm, Experiment
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('url', 'name')
class DatasetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dataset
fields = ('title', 'licence', 'description', 'author', 'created', 'file', 'file_format')
class AlgorithmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Algorithm
fields = ('title', 'user', 'file', 'executable_file', 'created', 'updated')
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Experiment
fields = ('title', 'start', 'finish', 'user')
## Instruction:
Allow modify experiment status via REST API.
## Code After:
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from damis.models import Dataset, Algorithm, Experiment
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('url', 'name')
class DatasetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dataset
fields = ('title', 'licence', 'description', 'author', 'created', 'file', 'file_format')
class AlgorithmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Algorithm
fields = ('title', 'user', 'file', 'executable_file', 'created', 'updated')
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Experiment
fields = ('title', 'start', 'finish', 'user', 'status')
| from django.contrib.auth.models import User, Group
from rest_framework import serializers
from damis.models import Dataset, Algorithm, Experiment
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('url', 'name')
class DatasetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dataset
fields = ('title', 'licence', 'description', 'author', 'created', 'file', 'file_format')
class AlgorithmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Algorithm
fields = ('title', 'user', 'file', 'executable_file', 'created', 'updated')
class ExperimentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Experiment
- fields = ('title', 'start', 'finish', 'user')
+ fields = ('title', 'start', 'finish', 'user', 'status')
? ++++++++++
| 2 | 0.068966 | 1 | 1 |
a0d55d17471a1e4f150740cdce880b4c8e4bf9da | src/css/core/index.styl | src/css/core/index.styl |
//////////////////// cmui ////////////////////
/* --------------------------------------------- */
/** use nib for vendor prefix **/
@import 'nib'
/* --------------------------------------------- */
/** unify browser style **/
@import '../vendor/normalize'
@import '../vendor/zero'
/* --------------------------------------------- */
/** cmui helper **/
@import '../helper/config'
@import '../helper/selector'
@import '../helper/class'
/* --------------------------------------------- */
/** modules **/
@import './var'
@import './common'
@import './text'
@import './icon'
@import './btn'
@import './layout'
@import './overlay'
@import './list'
|
//////////////////// cmui ////////////////////
/* --------------------------------------------- */
/** unify browser style **/
@import '../vendor/normalize'
@import '../vendor/zero'
/* --------------------------------------------- */
/** cmui helper **/
@import '../helper/config'
@import '../helper/selector'
@import '../helper/class'
/* --------------------------------------------- */
/** modules **/
@import './var'
@import './common'
@import './text'
@import './icon'
@import './btn'
@import './layout'
@import './overlay'
@import './list'
| Remove manual importing of `nib`. | Remove manual importing of `nib`.
| Stylus | mit | CMUI/CMUI,CMUI/CMUI,cssmagic/CMUI,cssmagic/CMUI | stylus | ## Code Before:
//////////////////// cmui ////////////////////
/* --------------------------------------------- */
/** use nib for vendor prefix **/
@import 'nib'
/* --------------------------------------------- */
/** unify browser style **/
@import '../vendor/normalize'
@import '../vendor/zero'
/* --------------------------------------------- */
/** cmui helper **/
@import '../helper/config'
@import '../helper/selector'
@import '../helper/class'
/* --------------------------------------------- */
/** modules **/
@import './var'
@import './common'
@import './text'
@import './icon'
@import './btn'
@import './layout'
@import './overlay'
@import './list'
## Instruction:
Remove manual importing of `nib`.
## Code After:
//////////////////// cmui ////////////////////
/* --------------------------------------------- */
/** unify browser style **/
@import '../vendor/normalize'
@import '../vendor/zero'
/* --------------------------------------------- */
/** cmui helper **/
@import '../helper/config'
@import '../helper/selector'
@import '../helper/class'
/* --------------------------------------------- */
/** modules **/
@import './var'
@import './common'
@import './text'
@import './icon'
@import './btn'
@import './layout'
@import './overlay'
@import './list'
|
//////////////////// cmui ////////////////////
-
- /* --------------------------------------------- */
- /** use nib for vendor prefix **/
- @import 'nib'
/* --------------------------------------------- */
/** unify browser style **/
@import '../vendor/normalize'
@import '../vendor/zero'
/* --------------------------------------------- */
/** cmui helper **/
@import '../helper/config'
@import '../helper/selector'
@import '../helper/class'
/* --------------------------------------------- */
/** modules **/
@import './var'
@import './common'
@import './text'
@import './icon'
@import './btn'
@import './layout'
@import './overlay'
@import './list' | 4 | 0.142857 | 0 | 4 |
4d84ca88ce54544b2e1d1b6f32a7a142f14fabe9 | pkgs/development/php-packages/swoole/default.nix | pkgs/development/php-packages/swoole/default.nix | { lib, buildPecl, php, valgrind, pcre2 }:
buildPecl {
pname = "swoole";
version = "4.6.7";
sha256 = "107wp403z8skkqrcm240vyyy6wqx5a4v2bqhlshlknyi14r2v165";
buildInputs = [ valgrind pcre2 ];
internalDeps = lib.optionals (lib.versionOlder php.version "7.4") [ php.extensions.hash ];
doCheck = true;
checkTarget = "tests";
meta = with lib; {
description = "Coroutine-based concurrency library for PHP";
license = licenses.asl20;
homepage = "https://www.swoole.co.uk/";
maintainers = teams.php.members;
};
}
| { lib, stdenv, buildPecl, php, valgrind, pcre2 }:
buildPecl {
pname = "swoole";
version = "4.6.7";
sha256 = "107wp403z8skkqrcm240vyyy6wqx5a4v2bqhlshlknyi14r2v165";
buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin) [ valgrind ];
internalDeps = lib.optionals (lib.versionOlder php.version "7.4") [ php.extensions.hash ];
doCheck = true;
checkTarget = "tests";
meta = with lib; {
description = "Coroutine-based concurrency library for PHP";
license = licenses.asl20;
homepage = "https://www.swoole.co.uk/";
maintainers = teams.php.members;
};
}
| Fix Swoole PHP extension on Darwin by marking Valgrind as an optional dependency | Fix Swoole PHP extension on Darwin by marking Valgrind as an optional dependency
| Nix | mit | NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs | nix | ## Code Before:
{ lib, buildPecl, php, valgrind, pcre2 }:
buildPecl {
pname = "swoole";
version = "4.6.7";
sha256 = "107wp403z8skkqrcm240vyyy6wqx5a4v2bqhlshlknyi14r2v165";
buildInputs = [ valgrind pcre2 ];
internalDeps = lib.optionals (lib.versionOlder php.version "7.4") [ php.extensions.hash ];
doCheck = true;
checkTarget = "tests";
meta = with lib; {
description = "Coroutine-based concurrency library for PHP";
license = licenses.asl20;
homepage = "https://www.swoole.co.uk/";
maintainers = teams.php.members;
};
}
## Instruction:
Fix Swoole PHP extension on Darwin by marking Valgrind as an optional dependency
## Code After:
{ lib, stdenv, buildPecl, php, valgrind, pcre2 }:
buildPecl {
pname = "swoole";
version = "4.6.7";
sha256 = "107wp403z8skkqrcm240vyyy6wqx5a4v2bqhlshlknyi14r2v165";
buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin) [ valgrind ];
internalDeps = lib.optionals (lib.versionOlder php.version "7.4") [ php.extensions.hash ];
doCheck = true;
checkTarget = "tests";
meta = with lib; {
description = "Coroutine-based concurrency library for PHP";
license = licenses.asl20;
homepage = "https://www.swoole.co.uk/";
maintainers = teams.php.members;
};
}
| - { lib, buildPecl, php, valgrind, pcre2 }:
+ { lib, stdenv, buildPecl, php, valgrind, pcre2 }:
? ++++++++
buildPecl {
pname = "swoole";
version = "4.6.7";
sha256 = "107wp403z8skkqrcm240vyyy6wqx5a4v2bqhlshlknyi14r2v165";
- buildInputs = [ valgrind pcre2 ];
+ buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin) [ valgrind ];
internalDeps = lib.optionals (lib.versionOlder php.version "7.4") [ php.extensions.hash ];
doCheck = true;
checkTarget = "tests";
meta = with lib; {
description = "Coroutine-based concurrency library for PHP";
license = licenses.asl20;
homepage = "https://www.swoole.co.uk/";
maintainers = teams.php.members;
};
} | 4 | 0.190476 | 2 | 2 |
d554a4b56416cd7b114882d125dfa81b0ebd8d69 | docs/requirements.rtd.txt | docs/requirements.rtd.txt | advancedhttpserver>=1.2.0
alembic>=0.8.5
boltons>=16.1.1
dnspython>=1.12.0
geoip2>=2.2.0
geojson>=1.3.2
icalendar>=3.9.2
ipaddress>=1.0.16
Jinja2>=2.8
markupsafe>=0.23
msgpack-python>=0.4.7
paramiko>=1.16.0
pyotp>=2.0.1
python-dateutil>=2.5.1
python-pam>=1.8.2
pytz>=2016.1
PyYAML>=3.11
requests>=2.9.1
six>=1.10.0
smoke-zephyr>=1.0.2
SQLAlchemy>=1.0.12
termcolor>=1.1.0
tzlocal>=1.2.2
XlsxWriter>=0.8.4
# additional sphinx-specific requirements
docutils>=0.12
sphinx>=1.4.1
sphinxcontrib-domaintools>=0.1
sphinxcontrib-httpdomain>=1.4.0
| advancedhttpserver>=1.2.0
alembic>=0.8.5
boltons>=16.1.1
dnspython>=1.12.0
geoip2>=2.2.0
geojson>=1.3.2
icalendar>=3.9.2
ipaddress>=1.0.16
Jinja2>=2.8
markupsafe>=0.23
msgpack-python>=0.4.7
paramiko>=1.16.0
pluginbase>=0.3
pyotp>=2.0.1
python-dateutil>=2.5.1
python-pam>=1.8.2
pytz>=2016.1
PyYAML>=3.11
requests>=2.9.1
six>=1.10.0
smoke-zephyr>=1.0.2
SQLAlchemy>=1.0.12
termcolor>=1.1.0
tzlocal>=1.2.2
XlsxWriter>=0.8.4
# additional sphinx-specific requirements
docutils>=0.12
sphinx>=1.4.1
sphinxcontrib-domaintools>=0.1
sphinxcontrib-httpdomain>=1.4.0
| Add pluginbase to the RTD requirements file | Add pluginbase to the RTD requirements file
| Text | bsd-3-clause | securestate/king-phisher,hdemeyer/king-phisher,zeroSteiner/king-phisher,wolfthefallen/king-phisher,securestate/king-phisher,securestate/king-phisher,zeroSteiner/king-phisher,zeroSteiner/king-phisher,zeroSteiner/king-phisher,wolfthefallen/king-phisher,securestate/king-phisher,guitarmanj/king-phisher,securestate/king-phisher,wolfthefallen/king-phisher,hdemeyer/king-phisher,zeroSteiner/king-phisher,hdemeyer/king-phisher,guitarmanj/king-phisher,guitarmanj/king-phisher,guitarmanj/king-phisher,wolfthefallen/king-phisher,hdemeyer/king-phisher,wolfthefallen/king-phisher | text | ## Code Before:
advancedhttpserver>=1.2.0
alembic>=0.8.5
boltons>=16.1.1
dnspython>=1.12.0
geoip2>=2.2.0
geojson>=1.3.2
icalendar>=3.9.2
ipaddress>=1.0.16
Jinja2>=2.8
markupsafe>=0.23
msgpack-python>=0.4.7
paramiko>=1.16.0
pyotp>=2.0.1
python-dateutil>=2.5.1
python-pam>=1.8.2
pytz>=2016.1
PyYAML>=3.11
requests>=2.9.1
six>=1.10.0
smoke-zephyr>=1.0.2
SQLAlchemy>=1.0.12
termcolor>=1.1.0
tzlocal>=1.2.2
XlsxWriter>=0.8.4
# additional sphinx-specific requirements
docutils>=0.12
sphinx>=1.4.1
sphinxcontrib-domaintools>=0.1
sphinxcontrib-httpdomain>=1.4.0
## Instruction:
Add pluginbase to the RTD requirements file
## Code After:
advancedhttpserver>=1.2.0
alembic>=0.8.5
boltons>=16.1.1
dnspython>=1.12.0
geoip2>=2.2.0
geojson>=1.3.2
icalendar>=3.9.2
ipaddress>=1.0.16
Jinja2>=2.8
markupsafe>=0.23
msgpack-python>=0.4.7
paramiko>=1.16.0
pluginbase>=0.3
pyotp>=2.0.1
python-dateutil>=2.5.1
python-pam>=1.8.2
pytz>=2016.1
PyYAML>=3.11
requests>=2.9.1
six>=1.10.0
smoke-zephyr>=1.0.2
SQLAlchemy>=1.0.12
termcolor>=1.1.0
tzlocal>=1.2.2
XlsxWriter>=0.8.4
# additional sphinx-specific requirements
docutils>=0.12
sphinx>=1.4.1
sphinxcontrib-domaintools>=0.1
sphinxcontrib-httpdomain>=1.4.0
| advancedhttpserver>=1.2.0
alembic>=0.8.5
boltons>=16.1.1
dnspython>=1.12.0
geoip2>=2.2.0
geojson>=1.3.2
icalendar>=3.9.2
ipaddress>=1.0.16
Jinja2>=2.8
markupsafe>=0.23
msgpack-python>=0.4.7
paramiko>=1.16.0
+ pluginbase>=0.3
pyotp>=2.0.1
python-dateutil>=2.5.1
python-pam>=1.8.2
pytz>=2016.1
PyYAML>=3.11
requests>=2.9.1
six>=1.10.0
smoke-zephyr>=1.0.2
SQLAlchemy>=1.0.12
termcolor>=1.1.0
tzlocal>=1.2.2
XlsxWriter>=0.8.4
# additional sphinx-specific requirements
docutils>=0.12
sphinx>=1.4.1
sphinxcontrib-domaintools>=0.1
sphinxcontrib-httpdomain>=1.4.0 | 1 | 0.033333 | 1 | 0 |
79bb94f51cd2dca65479cb39f6c365c4c372b0ca | forumuser/models.py | forumuser/models.py | from django.contrib.auth.models import AbstractUser, Group
from django.db import models
class ForumUser(AbstractUser):
def __unicode__(self):
return '%(username)s (%(email)s)' % {
'username': self.username,
'email': self.email
}
| from django.contrib.auth.models import AbstractUser, Group
from django.db import models
class ForumUser(AbstractUser):
items_per_page = models.PositiveSmallIntegerField(blank=True, null=True)
def __unicode__(self):
return '%(username)s (%(email)s)' % {
'username': self.username,
'email': self.email
}
| Add items per page as a preference to the forumm user model | Add items per page as a preference to the forumm user model
| Python | mit | hellsgate1001/thatforum_django,hellsgate1001/thatforum_django,hellsgate1001/thatforum_django | python | ## Code Before:
from django.contrib.auth.models import AbstractUser, Group
from django.db import models
class ForumUser(AbstractUser):
def __unicode__(self):
return '%(username)s (%(email)s)' % {
'username': self.username,
'email': self.email
}
## Instruction:
Add items per page as a preference to the forumm user model
## Code After:
from django.contrib.auth.models import AbstractUser, Group
from django.db import models
class ForumUser(AbstractUser):
items_per_page = models.PositiveSmallIntegerField(blank=True, null=True)
def __unicode__(self):
return '%(username)s (%(email)s)' % {
'username': self.username,
'email': self.email
}
| from django.contrib.auth.models import AbstractUser, Group
from django.db import models
class ForumUser(AbstractUser):
+ items_per_page = models.PositiveSmallIntegerField(blank=True, null=True)
+
def __unicode__(self):
return '%(username)s (%(email)s)' % {
'username': self.username,
'email': self.email
} | 2 | 0.2 | 2 | 0 |
97b6894671c0906393aea5aa43e632a35bd2aa27 | penchy/tests/test_util.py | penchy/tests/test_util.py | import os
import unittest2
from penchy import util
class ClasspathTest(unittest2.TestCase):
def test_valid_options(self):
expected = 'foo:bar:baz'
options = ['-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
expected = 'foo:bar:baz'
options = ['-classpath', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_multiple_classpaths(self):
expected = 'foo:bar:baz'
options = ['-cp', 'com:org:de', '-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_only_option(self):
options = ['-cp']
self.assertEquals(util.extract_classpath(options), '')
class TempdirTest(unittest2.TestCase):
def test_change(self):
cwd = os.getcwd()
with util.tempdir():
self.assertNotEquals(cwd, os.getcwd())
| import os
import unittest2
from penchy import util
class ClasspathTest(unittest2.TestCase):
def test_valid_options(self):
expected = 'foo:bar:baz'
options = ['-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
expected = 'foo:bar:baz'
options = ['-classpath', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_multiple_classpaths(self):
expected = 'foo:bar:baz'
options = ['-cp', 'com:org:de', '-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_only_option(self):
options = ['-cp']
self.assertEquals(util.extract_classpath(options), '')
class TempdirTest(unittest2.TestCase):
def test_change(self):
cwd = os.getcwd()
with util.tempdir():
self.assertNotEquals(cwd, os.getcwd())
self.assertEquals(cwd, os.getcwd())
| Check if tempdir returns to former cwd. | tests: Check if tempdir returns to former cwd.
Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>
| Python | mit | fhirschmann/penchy,fhirschmann/penchy | python | ## Code Before:
import os
import unittest2
from penchy import util
class ClasspathTest(unittest2.TestCase):
def test_valid_options(self):
expected = 'foo:bar:baz'
options = ['-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
expected = 'foo:bar:baz'
options = ['-classpath', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_multiple_classpaths(self):
expected = 'foo:bar:baz'
options = ['-cp', 'com:org:de', '-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_only_option(self):
options = ['-cp']
self.assertEquals(util.extract_classpath(options), '')
class TempdirTest(unittest2.TestCase):
def test_change(self):
cwd = os.getcwd()
with util.tempdir():
self.assertNotEquals(cwd, os.getcwd())
## Instruction:
tests: Check if tempdir returns to former cwd.
Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>
## Code After:
import os
import unittest2
from penchy import util
class ClasspathTest(unittest2.TestCase):
def test_valid_options(self):
expected = 'foo:bar:baz'
options = ['-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
expected = 'foo:bar:baz'
options = ['-classpath', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_multiple_classpaths(self):
expected = 'foo:bar:baz'
options = ['-cp', 'com:org:de', '-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_only_option(self):
options = ['-cp']
self.assertEquals(util.extract_classpath(options), '')
class TempdirTest(unittest2.TestCase):
def test_change(self):
cwd = os.getcwd()
with util.tempdir():
self.assertNotEquals(cwd, os.getcwd())
self.assertEquals(cwd, os.getcwd())
| import os
import unittest2
from penchy import util
class ClasspathTest(unittest2.TestCase):
def test_valid_options(self):
expected = 'foo:bar:baz'
options = ['-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
expected = 'foo:bar:baz'
options = ['-classpath', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_multiple_classpaths(self):
expected = 'foo:bar:baz'
options = ['-cp', 'com:org:de', '-cp', expected]
self.assertEquals(util.extract_classpath(options), expected)
def test_only_option(self):
options = ['-cp']
self.assertEquals(util.extract_classpath(options), '')
class TempdirTest(unittest2.TestCase):
def test_change(self):
cwd = os.getcwd()
with util.tempdir():
self.assertNotEquals(cwd, os.getcwd())
+ self.assertEquals(cwd, os.getcwd()) | 1 | 0.033333 | 1 | 0 |
1ca99587b5cea04a1292bcaee3ee36ff8fd19212 | metadata/com.jorgecastillo.kanadrill.txt | metadata/com.jorgecastillo.kanadrill.txt | Categories:Office
License:FreeBSD
Web Site:
Source Code:https://github.com/jorgecastillo/KanaDrill
Issue Tracker:https://github.com/jorgecastillo/KanaDrill/issues
Auto Name:KanaDrill
Summary:Learn the Japanese kana
Description:
Learn the Japanese kana through repetition
.
Repo Type:git
Repo:https://github.com/jorgecastillo/KanaDrill
Build:1.0.9,9
commit=5c36e8c30644cfc2b0a8e7946506cb31cbbacbf4
target=android-19
Build:1.1.0,10
commit=802769c4fc7862a2e5b6dfc42faf2ec47fa031a3
gradle=yes
subdir=app
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1.0
Current Version Code:10
| Categories:Office
License:FreeBSD
Web Site:
Source Code:https://github.com/jorgecastillo/KanaDrill
Issue Tracker:https://github.com/jorgecastillo/KanaDrill/issues
Auto Name:KanaDrill
Summary:Learn the Japanese kana
Description:
Learn the Japanese kana through repetition
.
Repo Type:git
Repo:https://github.com/jorgecastillo/KanaDrill
Build:1.0.9,9
commit=5c36e8c30644cfc2b0a8e7946506cb31cbbacbf4
target=android-19
Build:1.1.0,10
commit=802769c4fc7862a2e5b6dfc42faf2ec47fa031a3
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1.1
Current Version Code:11
| Update CV of KanaDrill to 1.1.1 (11) | Update CV of KanaDrill to 1.1.1 (11)
| Text | agpl-3.0 | f-droid/fdroiddata,f-droid/fdroid-data,f-droid/fdroiddata | text | ## Code Before:
Categories:Office
License:FreeBSD
Web Site:
Source Code:https://github.com/jorgecastillo/KanaDrill
Issue Tracker:https://github.com/jorgecastillo/KanaDrill/issues
Auto Name:KanaDrill
Summary:Learn the Japanese kana
Description:
Learn the Japanese kana through repetition
.
Repo Type:git
Repo:https://github.com/jorgecastillo/KanaDrill
Build:1.0.9,9
commit=5c36e8c30644cfc2b0a8e7946506cb31cbbacbf4
target=android-19
Build:1.1.0,10
commit=802769c4fc7862a2e5b6dfc42faf2ec47fa031a3
gradle=yes
subdir=app
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1.0
Current Version Code:10
## Instruction:
Update CV of KanaDrill to 1.1.1 (11)
## Code After:
Categories:Office
License:FreeBSD
Web Site:
Source Code:https://github.com/jorgecastillo/KanaDrill
Issue Tracker:https://github.com/jorgecastillo/KanaDrill/issues
Auto Name:KanaDrill
Summary:Learn the Japanese kana
Description:
Learn the Japanese kana through repetition
.
Repo Type:git
Repo:https://github.com/jorgecastillo/KanaDrill
Build:1.0.9,9
commit=5c36e8c30644cfc2b0a8e7946506cb31cbbacbf4
target=android-19
Build:1.1.0,10
commit=802769c4fc7862a2e5b6dfc42faf2ec47fa031a3
subdir=app
gradle=yes
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.1.1
Current Version Code:11
| Categories:Office
License:FreeBSD
Web Site:
Source Code:https://github.com/jorgecastillo/KanaDrill
Issue Tracker:https://github.com/jorgecastillo/KanaDrill/issues
Auto Name:KanaDrill
Summary:Learn the Japanese kana
Description:
Learn the Japanese kana through repetition
.
Repo Type:git
Repo:https://github.com/jorgecastillo/KanaDrill
Build:1.0.9,9
commit=5c36e8c30644cfc2b0a8e7946506cb31cbbacbf4
target=android-19
Build:1.1.0,10
commit=802769c4fc7862a2e5b6dfc42faf2ec47fa031a3
+ subdir=app
gradle=yes
- subdir=app
Auto Update Mode:None
Update Check Mode:RepoManifest
- Current Version:1.1.0
? ^
+ Current Version:1.1.1
? ^
- Current Version Code:10
? ^
+ Current Version Code:11
? ^
| 6 | 0.206897 | 3 | 3 |
0569ea8748745cd73bf72817daad99d79dfa4981 | false-negative.txt | false-negative.txt | My phone is more or less screwed.
Reckon you'd lose less blood having a major heart op!!
One broken string, one shock from a microphone, and one admonition from the sound guy to rock less hard. Success! Thanks for coming.
Sitting next to Dan Winship here at the @WebKitGTK hackfest, turned out it was a missing TCP_NODELAY. Fixed! HTTPS now 33% less slow :)
| Reckon you'd lose less blood having a major heart op!!
| Remove a few more freshly-passing cases | Remove a few more freshly-passing cases
| Text | mit | wjt/fewerror,wjt/fewerror | text | ## Code Before:
My phone is more or less screwed.
Reckon you'd lose less blood having a major heart op!!
One broken string, one shock from a microphone, and one admonition from the sound guy to rock less hard. Success! Thanks for coming.
Sitting next to Dan Winship here at the @WebKitGTK hackfest, turned out it was a missing TCP_NODELAY. Fixed! HTTPS now 33% less slow :)
## Instruction:
Remove a few more freshly-passing cases
## Code After:
Reckon you'd lose less blood having a major heart op!!
| - My phone is more or less screwed.
Reckon you'd lose less blood having a major heart op!!
- One broken string, one shock from a microphone, and one admonition from the sound guy to rock less hard. Success! Thanks for coming.
- Sitting next to Dan Winship here at the @WebKitGTK hackfest, turned out it was a missing TCP_NODELAY. Fixed! HTTPS now 33% less slow :) | 3 | 0.75 | 0 | 3 |
ebf519cdcd7b6a50d249ca11ddefc4539aafafbc | common/util/src/main/java/roart/common/util/IOUtil.java | common/util/src/main/java/roart/common/util/IOUtil.java | package roart.common.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class IOUtil {
public static byte[] toByteArray(InputStream is) throws IOException {
return IOUtils.toByteArray(is, Integer.MAX_VALUE);
}
}
| package roart.common.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class IOUtil {
public static byte[] toByteArray(InputStream is) throws IOException {
return is.readNBytes(Integer.MAX_VALUE - 8);
}
}
| Fix for big string limit (I47). | Fix for big string limit (I47).
| Java | agpl-3.0 | rroart/aether,rroart/aether,rroart/aether,rroart/aether,rroart/aether | java | ## Code Before:
package roart.common.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class IOUtil {
public static byte[] toByteArray(InputStream is) throws IOException {
return IOUtils.toByteArray(is, Integer.MAX_VALUE);
}
}
## Instruction:
Fix for big string limit (I47).
## Code After:
package roart.common.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class IOUtil {
public static byte[] toByteArray(InputStream is) throws IOException {
return is.readNBytes(Integer.MAX_VALUE - 8);
}
}
| package roart.common.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class IOUtil {
public static byte[] toByteArray(InputStream is) throws IOException {
- return IOUtils.toByteArray(is, Integer.MAX_VALUE);
? ---- - ^^ ^^^^^ ----
+ return is.readNBytes(Integer.MAX_VALUE - 8);
? ^^^^^ ^ ++++
}
} | 2 | 0.166667 | 1 | 1 |
c0abea4100e9d453680f39c14b5b30f9e4e686f5 | src/carousel.js | src/carousel.js | import Vue from "vue";
import VueResource from "vue-resource";
import {store} from "./store/store";
import Photos from "./components/Photos.vue";
import Theater from "./components/Theater.vue";
Vue.use(VueResource);
Vue.config.debug = true;
const carousel = new Vue({
el: "#your-application-id",
store,
components: {
Photos,
Theater
},
mounted() {
// Debug purpose
if (Vue.config.debug) {
console.log("Debug is on");
}
}
});
| import Vue from "vue";
import {store} from "./store/store";
import Photos from "./components/Photos.vue";
import Theater from "./components/Theater.vue";
const carousel = new Vue({
el: "#your-application-id",
store,
components: {
Photos,
Theater
},
});
| Remove debug code from the main entry file | Remove debug code from the main entry file
| JavaScript | mit | ludo237/photo-gallery,ludo237/vuejs-carousel,ludo237/photo-gallery,ludo237/vuejs-carousel | javascript | ## Code Before:
import Vue from "vue";
import VueResource from "vue-resource";
import {store} from "./store/store";
import Photos from "./components/Photos.vue";
import Theater from "./components/Theater.vue";
Vue.use(VueResource);
Vue.config.debug = true;
const carousel = new Vue({
el: "#your-application-id",
store,
components: {
Photos,
Theater
},
mounted() {
// Debug purpose
if (Vue.config.debug) {
console.log("Debug is on");
}
}
});
## Instruction:
Remove debug code from the main entry file
## Code After:
import Vue from "vue";
import {store} from "./store/store";
import Photos from "./components/Photos.vue";
import Theater from "./components/Theater.vue";
const carousel = new Vue({
el: "#your-application-id",
store,
components: {
Photos,
Theater
},
});
| import Vue from "vue";
- import VueResource from "vue-resource";
import {store} from "./store/store";
-
import Photos from "./components/Photos.vue";
import Theater from "./components/Theater.vue";
-
- Vue.use(VueResource);
- Vue.config.debug = true;
const carousel = new Vue({
el: "#your-application-id",
store,
components: {
Photos,
Theater
},
-
- mounted() {
- // Debug purpose
- if (Vue.config.debug) {
- console.log("Debug is on");
- }
- }
}); | 12 | 0.444444 | 0 | 12 |
d8d450b035b264adbe3ff36d09bd6ee5c069ea2d | ci_environment/perlbrew/recipes/multi.rb | ci_environment/perlbrew/recipes/multi.rb | include_recipe "perlbrew"
home = node.travis_build_environment.home
brew = "source #{home}/perl5/perlbrew/etc/bashrc && perlbrew"
env = { 'HOME' => home }
user = node.travis_build_environment.user
setup = lambda do |bash|
bash.user user
bash.environment env
end
bash "install cpanm" do
setup.call(self)
code "#{brew} install-cpanm"
not_if "ls #{home}/perl5/perlbrew/bin | grep cpanm"
end
node.perlbrew.perls.each do |pl|
args = pl[:arguments].to_s
args << " --notest"
bash "installing #{pl[:version]} as #{pl[:name]} with Perlbrew arguments: #{args}" do
setup.call(self)
code "#{brew} install #{pl[:version]} --as #{pl[:name]} #{args}"
not_if "ls #{home}/perl5/perlbrew/perls | grep #{pl[:name]}"
end
end
| include_recipe "perlbrew"
home = node.travis_build_environment.home
brew = "source #{home}/perl5/perlbrew/etc/bashrc && perlbrew"
env = { 'HOME' => home }
user = node.travis_build_environment.user
setup = lambda do |bash|
bash.user user
bash.environment env
end
bash "install cpanm" do
setup.call(self)
code "#{brew} install-cpanm"
not_if "ls #{home}/perl5/perlbrew/bin | grep cpanm"
end
node.perlbrew.perls.each do |pl|
args = pl[:arguments].to_s
args << " --notest"
bash "installing #{pl[:version]} as #{pl[:name]} with Perlbrew arguments: #{args}" do
setup.call(self)
code "#{brew} install #{pl[:version]} --as #{pl[:name]} #{args}"
not_if "ls #{home}/perl5/perlbrew/perls | grep #{pl[:name]}"
end
bash "preinstall Dist::Zilla" do
setup.call(self)
code "#{brew} use #{pl[:name]} && cpanm Dist::Zilla --force"
end
end
| Revert "Screw Dist::Zilla, it takes forever to install and fails VM provisioning 3 times out of 4" | Revert "Screw Dist::Zilla, it takes forever to install and fails VM provisioning 3 times out of 4"
This reverts commit c246ca59f87d68ef917e3dfadaaf475e9d600f18.
Lets give it another shot with mirroring.
| Ruby | mit | vinaykaradia/travis-cookbook-cloned,ljharb/travis-cookbooks,bd808/travis-cookbooks,tianon/travis-cookbooks,ardock/travis-cookbooks,gavioto/travis-cookbooks,Acidburn0zzz/travis-cookbooks,Distelli/travis-cookbooks,Distelli/travis-cookbooks,dracos/travis-cookbooks,dstufft/travis-cookbooks,vinaykaradia/travis-cookbook-cloned,Zarthus/travis-cookbooks,spurti-chopra/travis-cookbooks,tianon/travis-cookbooks,dracos/travis-cookbooks,tianon/travis-cookbooks,DanielG/travis-cookbooks,DanielG/travis-cookbooks,dracos/travis-cookbooks,travis-ci/travis-cookbooks,ljharb/travis-cookbooks,Distelli/travis-cookbooks,ljharb/travis-cookbooks,Zarthus/travis-cookbooks,travis-ci/travis-cookbooks,0xCCD/travis-cookbooks,Distelli/travis-cookbooks,ardock/travis-cookbooks,travis-ci/travis-cookbooks,alex/travis-cookbooks,ardock/travis-cookbooks,tianon/travis-cookbooks,Acidburn0zzz/travis-cookbooks,Acidburn0zzz/travis-cookbooks,vinaykaradia/travis-cookbook-cloned,DanielG/travis-cookbooks,johanneswuerbach/travis-cookbooks,dstufft/travis-cookbooks,Zarthus/travis-cookbooks,johanneswuerbach/travis-cookbooks,spurti-chopra/travis-cookbooks,gavioto/travis-cookbooks,gavioto/travis-cookbooks,vinaykaradia/travis-cookbook-cloned,tianon/travis-cookbooks,gavioto/travis-cookbooks,0xCCD/travis-cookbooks,Acidburn0zzz/travis-cookbooks,DanielG/travis-cookbooks,alex/travis-cookbooks,spurti-chopra/travis-cookbooks,dracos/travis-cookbooks,bd808/travis-cookbooks,johanneswuerbach/travis-cookbooks,Zarthus/travis-cookbooks,vinaykaradia/travis-cookbook-cloned,ardock/travis-cookbooks,bd808/travis-cookbooks | ruby | ## Code Before:
include_recipe "perlbrew"
home = node.travis_build_environment.home
brew = "source #{home}/perl5/perlbrew/etc/bashrc && perlbrew"
env = { 'HOME' => home }
user = node.travis_build_environment.user
setup = lambda do |bash|
bash.user user
bash.environment env
end
bash "install cpanm" do
setup.call(self)
code "#{brew} install-cpanm"
not_if "ls #{home}/perl5/perlbrew/bin | grep cpanm"
end
node.perlbrew.perls.each do |pl|
args = pl[:arguments].to_s
args << " --notest"
bash "installing #{pl[:version]} as #{pl[:name]} with Perlbrew arguments: #{args}" do
setup.call(self)
code "#{brew} install #{pl[:version]} --as #{pl[:name]} #{args}"
not_if "ls #{home}/perl5/perlbrew/perls | grep #{pl[:name]}"
end
end
## Instruction:
Revert "Screw Dist::Zilla, it takes forever to install and fails VM provisioning 3 times out of 4"
This reverts commit c246ca59f87d68ef917e3dfadaaf475e9d600f18.
Lets give it another shot with mirroring.
## Code After:
include_recipe "perlbrew"
home = node.travis_build_environment.home
brew = "source #{home}/perl5/perlbrew/etc/bashrc && perlbrew"
env = { 'HOME' => home }
user = node.travis_build_environment.user
setup = lambda do |bash|
bash.user user
bash.environment env
end
bash "install cpanm" do
setup.call(self)
code "#{brew} install-cpanm"
not_if "ls #{home}/perl5/perlbrew/bin | grep cpanm"
end
node.perlbrew.perls.each do |pl|
args = pl[:arguments].to_s
args << " --notest"
bash "installing #{pl[:version]} as #{pl[:name]} with Perlbrew arguments: #{args}" do
setup.call(self)
code "#{brew} install #{pl[:version]} --as #{pl[:name]} #{args}"
not_if "ls #{home}/perl5/perlbrew/perls | grep #{pl[:name]}"
end
bash "preinstall Dist::Zilla" do
setup.call(self)
code "#{brew} use #{pl[:name]} && cpanm Dist::Zilla --force"
end
end
| include_recipe "perlbrew"
home = node.travis_build_environment.home
brew = "source #{home}/perl5/perlbrew/etc/bashrc && perlbrew"
env = { 'HOME' => home }
user = node.travis_build_environment.user
setup = lambda do |bash|
bash.user user
bash.environment env
end
bash "install cpanm" do
setup.call(self)
code "#{brew} install-cpanm"
not_if "ls #{home}/perl5/perlbrew/bin | grep cpanm"
end
node.perlbrew.perls.each do |pl|
args = pl[:arguments].to_s
args << " --notest"
bash "installing #{pl[:version]} as #{pl[:name]} with Perlbrew arguments: #{args}" do
setup.call(self)
code "#{brew} install #{pl[:version]} --as #{pl[:name]} #{args}"
not_if "ls #{home}/perl5/perlbrew/perls | grep #{pl[:name]}"
end
+
+ bash "preinstall Dist::Zilla" do
+ setup.call(self)
+ code "#{brew} use #{pl[:name]} && cpanm Dist::Zilla --force"
+ end
end
| 5 | 0.172414 | 5 | 0 |
b58755b65a37c5c131b30946bdb7ca64808acefa | acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb | acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb | require "mixlib/shellout"
require "bundler"
describe "Chef Fips Integration Specs" do
def windows?
if RUBY_PLATFORM =~ /mswin|mingw|windows/
true
else
false
end
end
let(:omnibus_root) do
if windows?
"c:/opscode/chef"
else
"/opt/chef"
end
end
let(:env) do
{
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
"BUNDLE_IGNORE_CONFIG" => "true",
"BUNDLE_FROZEN" => "1",
"CHEF_FIPS" => "1"
}
end
let(:chef_dir) do
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
cmd.error!
cmd.stdout.chomp
end
def run_rspec_test(test)
Bundler.with_clean_env do
cmd = Mixlib::ShellOut.new(
"bundle exec rspec -f documentation -t ~requires_git #{test}",
env: env, cwd: chef_dir, timeout: 3600
)
cmd.run_command.error!
end
end
it "passes the integration specs" do
run_rspec_test("spec/integration")
end
end
| require "mixlib/shellout"
require "bundler"
describe "Chef Fips Integration Specs" do
def windows?
if RUBY_PLATFORM =~ /mswin|mingw|windows/
true
else
false
end
end
let(:omnibus_root) do
if windows?
"c:/opscode/chef"
else
"/opt/chef"
end
end
let(:env) do
{
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
"BUNDLE_IGNORE_CONFIG" => "true",
"BUNDLE_FROZEN" => "1",
"CHEF_FIPS" => "1"
}
end
let(:chef_dir) do
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
cmd.error!
cmd.stdout.chomp
end
def run_rspec_test(test)
Bundler.with_clean_env do
cmd = Mixlib::ShellOut.new(
"bundle exec rspec -f documentation -t ~requires_git #{test}",
env: env, cwd: chef_dir, timeout: 3600
)
cmd.run_command.error!
end
end
it "passes the integration specs" do
skip
#run_rspec_test("spec/integration")
end
end
| Disable FIPS integration tests for now. | Disable FIPS integration tests for now.
| Ruby | apache-2.0 | mattray/chef,MsysTechnologiesllc/chef,MsysTechnologiesllc/chef,youngjl1/chef,onlyhavecans/chef,nathwill/chef,docwhat/chef,mattray/chef,criteo-forks/chef,webframp/chef,mattray/chef,b002368/chef-repo,sanditiffin/chef,b002368/chef-repo,jonlives/chef,onlyhavecans/chef,Tensibai/chef,Kast0rTr0y/chef,ChaosCloud/chef,juliandunn/chef,webframp/chef,jkerry/chef,nvwls/chef,evan2645/chef,strangelittlemonkey/chef,someara/chef,MsysTechnologiesllc/chef,b002368/chef-repo,b002368/chef-repo,sanditiffin/chef,mikedodge04/chef,jaymzh/chef,martinisoft/chef,tbunnyman/chef,nathwill/chef,ranjib/chef,strangelittlemonkey/chef,oclaussen/chef,mwrock/chef,strangelittlemonkey/chef,jonlives/chef,tomdoherty/chef,docwhat/chef,someara/chef,gene1wood/chef,Kast0rTr0y/chef,mwrock/chef,jonlives/chef,someara/chef,mikedodge04/chef,mal/chef,nathwill/chef,Ppjet6/chef,evan2645/chef,evan2645/chef,criteo-forks/chef,mwrock/chef,higanworks/chef,juliandunn/chef,Kast0rTr0y/chef,jkerry/chef,tbunnyman/chef,ChaosCloud/chef,tbunnyman/chef,ranjib/chef,gene1wood/chef,higanworks/chef,mal/chef,webframp/chef,Ppjet6/chef,tbunnyman/chef,b002368/chef-repo,nathwill/chef,ChaosCloud/chef,strangelittlemonkey/chef,nvwls/chef,sanditiffin/chef,oclaussen/chef,docwhat/chef,webframp/chef,Ppjet6/chef,brettcave/chef,nathwill/chef,evan2645/chef,ranjib/chef,sanditiffin/chef,tomdoherty/chef,Kast0rTr0y/chef,b002368/chef-repo,robmul/chef,webframp/chef,mal/chef,juliandunn/chef,mal/chef,tomdoherty/chef,criteo-forks/chef,martinisoft/chef,brettcave/chef,chef/chef,docwhat/chef,jkerry/chef,onlyhavecans/chef,criteo-forks/chef,ChaosCloud/chef,higanworks/chef,chef/chef,Ppjet6/chef,gene1wood/chef,brettcave/chef,robmul/chef,Ppjet6/chef,chef/chef,martinisoft/chef,tas50/chef-1,oclaussen/chef,Tensibai/chef,mal/chef,sanditiffin/chef,Tensibai/chef,jkerry/chef,youngjl1/chef,tas50/chef-1,tas50/chef-1,evan2645/chef,jkerry/chef,mwrock/chef,brettcave/chef,sanditiffin/chef,criteo-forks/chef,chef/chef,someara/chef,tbunnyman/chef,criteo-forks/chef,Tensibai/chef,higanworks/chef,tbunnyman/chef,oclaussen/chef,nvwls/chef,nathwill/chef,tas50/chef-1,onlyhavecans/chef,docwhat/chef,brettcave/chef,docwhat/chef,onlyhavecans/chef,onlyhavecans/chef,someara/chef,juliandunn/chef,brettcave/chef,robmul/chef,evan2645/chef,robmul/chef,mikedodge04/chef,tomdoherty/chef,oclaussen/chef,tomdoherty/chef,Ppjet6/chef,ranjib/chef,juliandunn/chef,nvwls/chef,mikedodge04/chef,youngjl1/chef,mattray/chef,youngjl1/chef,jonlives/chef,higanworks/chef,jaymzh/chef,martinisoft/chef,nvwls/chef,youngjl1/chef,ChaosCloud/chef,ranjib/chef,youngjl1/chef,mattray/chef,jonlives/chef,ranjib/chef,jonlives/chef,webframp/chef,mikedodge04/chef,robmul/chef,mal/chef,jaymzh/chef,oclaussen/chef,someara/chef,MsysTechnologiesllc/chef,jaymzh/chef,jkerry/chef,strangelittlemonkey/chef,mikedodge04/chef,Kast0rTr0y/chef,martinisoft/chef,Kast0rTr0y/chef,gene1wood/chef,Tensibai/chef,nvwls/chef,ChaosCloud/chef,robmul/chef,strangelittlemonkey/chef | ruby | ## Code Before:
require "mixlib/shellout"
require "bundler"
describe "Chef Fips Integration Specs" do
def windows?
if RUBY_PLATFORM =~ /mswin|mingw|windows/
true
else
false
end
end
let(:omnibus_root) do
if windows?
"c:/opscode/chef"
else
"/opt/chef"
end
end
let(:env) do
{
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
"BUNDLE_IGNORE_CONFIG" => "true",
"BUNDLE_FROZEN" => "1",
"CHEF_FIPS" => "1"
}
end
let(:chef_dir) do
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
cmd.error!
cmd.stdout.chomp
end
def run_rspec_test(test)
Bundler.with_clean_env do
cmd = Mixlib::ShellOut.new(
"bundle exec rspec -f documentation -t ~requires_git #{test}",
env: env, cwd: chef_dir, timeout: 3600
)
cmd.run_command.error!
end
end
it "passes the integration specs" do
run_rspec_test("spec/integration")
end
end
## Instruction:
Disable FIPS integration tests for now.
## Code After:
require "mixlib/shellout"
require "bundler"
describe "Chef Fips Integration Specs" do
def windows?
if RUBY_PLATFORM =~ /mswin|mingw|windows/
true
else
false
end
end
let(:omnibus_root) do
if windows?
"c:/opscode/chef"
else
"/opt/chef"
end
end
let(:env) do
{
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
"BUNDLE_IGNORE_CONFIG" => "true",
"BUNDLE_FROZEN" => "1",
"CHEF_FIPS" => "1"
}
end
let(:chef_dir) do
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
cmd.error!
cmd.stdout.chomp
end
def run_rspec_test(test)
Bundler.with_clean_env do
cmd = Mixlib::ShellOut.new(
"bundle exec rspec -f documentation -t ~requires_git #{test}",
env: env, cwd: chef_dir, timeout: 3600
)
cmd.run_command.error!
end
end
it "passes the integration specs" do
skip
#run_rspec_test("spec/integration")
end
end
| require "mixlib/shellout"
require "bundler"
describe "Chef Fips Integration Specs" do
def windows?
if RUBY_PLATFORM =~ /mswin|mingw|windows/
true
else
false
end
end
let(:omnibus_root) do
if windows?
"c:/opscode/chef"
else
"/opt/chef"
end
end
let(:env) do
{
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
"BUNDLE_IGNORE_CONFIG" => "true",
"BUNDLE_FROZEN" => "1",
"CHEF_FIPS" => "1"
}
end
let(:chef_dir) do
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
cmd.error!
cmd.stdout.chomp
end
def run_rspec_test(test)
Bundler.with_clean_env do
cmd = Mixlib::ShellOut.new(
"bundle exec rspec -f documentation -t ~requires_git #{test}",
env: env, cwd: chef_dir, timeout: 3600
)
cmd.run_command.error!
end
end
it "passes the integration specs" do
+ skip
- run_rspec_test("spec/integration")
+ #run_rspec_test("spec/integration")
? +
end
end | 3 | 0.058824 | 2 | 1 |
77810a5f2a2652b88e8a9e6bf860b0b47cebe3c1 | app/helpers/invoice_helper.rb | app/helpers/invoice_helper.rb | module InvoiceHelper
def invoice_states_as_collection
states = Invoice::STATES
states.inject({}) do |result, state|
result[t(state, :scope => 'invoice.state')] = state
result
end
end
def suggested_invoices_for_booking(booking)
invoices = Invoice.open_balance.where(:amount => booking.amount)
invoices << booking.reference if booking.reference
invoices.collect{|invoice| [invoice.to_s(:long), invoice.id]}
end
def invoice_label(invoice)
invoice_state_label(invoice.state)
end
def t_invoice_filter(state)
t(state, :scope => 'invoice.state')
end
def invoice_state_label(state, active = true)
type = case state.to_s
when 'canceled', 'reactivated'
nil
when 'paid'
'success'
when 'reminded', '2xreminded', '3xreminded', 'encashment'
'important'
when 'booked', 'written_off'
'info'
end
type = 'disabled' unless active
boot_label(t(state, :scope => 'invoice.state'), type)
end
end
| module InvoiceHelper
def invoice_states_as_collection
states = Invoice::STATES
states.inject({}) do |result, state|
result[t(state, :scope => 'invoice.state')] = state
result
end
end
def suggested_invoices_for_booking(booking)
invoices = Invoice.open_balance.where(:amount => booking.amount)
# Include currently referenced invoice
invoices << booking.reference if booking.reference
invoices = invoices.uniq
invoices.collect{|invoice| [invoice.to_s(:long), invoice.id]}
end
def invoice_label(invoice)
invoice_state_label(invoice.state)
end
def t_invoice_filter(state)
t(state, :scope => 'invoice.state')
end
def invoice_state_label(state, active = true)
type = case state.to_s
when 'canceled', 'reactivated'
nil
when 'paid'
'success'
when 'reminded', '2xreminded', '3xreminded', 'encashment'
'important'
when 'booked', 'written_off'
'info'
end
type = 'disabled' unless active
boot_label(t(state, :scope => 'invoice.state'), type)
end
end
| Fix currently referenced invoice being included twice in suggestion list. | Fix currently referenced invoice being included twice in suggestion list.
| Ruby | agpl-3.0 | wtag/bookyt,huerlisi/bookyt,hauledev/bookyt,huerlisi/bookyt,hauledev/bookyt,xuewenfei/bookyt,silvermind/bookyt,wtag/bookyt,hauledev/bookyt,xuewenfei/bookyt,huerlisi/bookyt,gaapt/bookyt,hauledev/bookyt,silvermind/bookyt,wtag/bookyt,xuewenfei/bookyt,silvermind/bookyt,silvermind/bookyt,gaapt/bookyt,gaapt/bookyt,gaapt/bookyt | ruby | ## Code Before:
module InvoiceHelper
def invoice_states_as_collection
states = Invoice::STATES
states.inject({}) do |result, state|
result[t(state, :scope => 'invoice.state')] = state
result
end
end
def suggested_invoices_for_booking(booking)
invoices = Invoice.open_balance.where(:amount => booking.amount)
invoices << booking.reference if booking.reference
invoices.collect{|invoice| [invoice.to_s(:long), invoice.id]}
end
def invoice_label(invoice)
invoice_state_label(invoice.state)
end
def t_invoice_filter(state)
t(state, :scope => 'invoice.state')
end
def invoice_state_label(state, active = true)
type = case state.to_s
when 'canceled', 'reactivated'
nil
when 'paid'
'success'
when 'reminded', '2xreminded', '3xreminded', 'encashment'
'important'
when 'booked', 'written_off'
'info'
end
type = 'disabled' unless active
boot_label(t(state, :scope => 'invoice.state'), type)
end
end
## Instruction:
Fix currently referenced invoice being included twice in suggestion list.
## Code After:
module InvoiceHelper
def invoice_states_as_collection
states = Invoice::STATES
states.inject({}) do |result, state|
result[t(state, :scope => 'invoice.state')] = state
result
end
end
def suggested_invoices_for_booking(booking)
invoices = Invoice.open_balance.where(:amount => booking.amount)
# Include currently referenced invoice
invoices << booking.reference if booking.reference
invoices = invoices.uniq
invoices.collect{|invoice| [invoice.to_s(:long), invoice.id]}
end
def invoice_label(invoice)
invoice_state_label(invoice.state)
end
def t_invoice_filter(state)
t(state, :scope => 'invoice.state')
end
def invoice_state_label(state, active = true)
type = case state.to_s
when 'canceled', 'reactivated'
nil
when 'paid'
'success'
when 'reminded', '2xreminded', '3xreminded', 'encashment'
'important'
when 'booked', 'written_off'
'info'
end
type = 'disabled' unless active
boot_label(t(state, :scope => 'invoice.state'), type)
end
end
| module InvoiceHelper
def invoice_states_as_collection
states = Invoice::STATES
states.inject({}) do |result, state|
result[t(state, :scope => 'invoice.state')] = state
result
end
end
def suggested_invoices_for_booking(booking)
invoices = Invoice.open_balance.where(:amount => booking.amount)
+
+ # Include currently referenced invoice
invoices << booking.reference if booking.reference
+ invoices = invoices.uniq
invoices.collect{|invoice| [invoice.to_s(:long), invoice.id]}
end
def invoice_label(invoice)
invoice_state_label(invoice.state)
end
def t_invoice_filter(state)
t(state, :scope => 'invoice.state')
end
def invoice_state_label(state, active = true)
type = case state.to_s
when 'canceled', 'reactivated'
nil
when 'paid'
'success'
when 'reminded', '2xreminded', '3xreminded', 'encashment'
'important'
when 'booked', 'written_off'
'info'
end
type = 'disabled' unless active
boot_label(t(state, :scope => 'invoice.state'), type)
end
end | 3 | 0.073171 | 3 | 0 |
a2a1f3482f4f01ad8086e9e4cab7c6f460ec5367 | src/client.rs | src/client.rs | use hyper::client::Client;
use hyper::client::response::Response;
use hyper::error::Error;
use hyper::header::Headers;
use hyper::method::Method;
/// Trait that represents some methods to send a specific request
pub trait GetResponse {
/// Given a specific URL, get the response from the target server
fn get_http_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL and an header, get the response from the target server
fn get_http_response_using_headers(&self,
url: &str,
header: Headers)
-> Result<Response, Error>;
}
impl GetResponse for Client {
fn get_http_response(&self, url: &str) -> Result<Response, Error> {
self.get_http_response_using_headers(url, Headers::new())
}
fn get_http_response_using_headers(&self,
url: &str,
custom_header: Headers)
-> Result<Response, Error> {
self.request(Method::Get, url).headers(custom_header).send()
}
} | use hyper::client::Client;
use hyper::client::response::Response;
use hyper::error::Error;
use hyper::header::Headers;
use hyper::method::Method;
/// Trait that represents some methods to send a specific request
pub trait GetResponse {
/// Given a specific URL, get the header without the content body (useful to not waste time,
/// ressources and informations)
fn get_head_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL, get the response from the target server
fn get_http_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL and an header, get the response from the target server
fn get_http_response_using_headers(&self,
url: &str,
header: Headers)
-> Result<Response, Error>;
}
impl GetResponse for Client {
fn get_head_response(&self, url: &str) -> Result<Response, Error> {
self.request(Method::Head, url).send()
}
fn get_http_response(&self, url: &str) -> Result<Response, Error> {
self.get_http_response_using_headers(url, Headers::new())
}
fn get_http_response_using_headers(&self,
url: &str,
custom_header: Headers)
-> Result<Response, Error> {
self.request(Method::Get, url).headers(custom_header).send()
}
}
| Add a method trait to get a header response from a server request, without any content body | Add a method trait to get a header response from a server request, without any content body
| Rust | mit | derniercri/snatch | rust | ## Code Before:
use hyper::client::Client;
use hyper::client::response::Response;
use hyper::error::Error;
use hyper::header::Headers;
use hyper::method::Method;
/// Trait that represents some methods to send a specific request
pub trait GetResponse {
/// Given a specific URL, get the response from the target server
fn get_http_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL and an header, get the response from the target server
fn get_http_response_using_headers(&self,
url: &str,
header: Headers)
-> Result<Response, Error>;
}
impl GetResponse for Client {
fn get_http_response(&self, url: &str) -> Result<Response, Error> {
self.get_http_response_using_headers(url, Headers::new())
}
fn get_http_response_using_headers(&self,
url: &str,
custom_header: Headers)
-> Result<Response, Error> {
self.request(Method::Get, url).headers(custom_header).send()
}
}
## Instruction:
Add a method trait to get a header response from a server request, without any content body
## Code After:
use hyper::client::Client;
use hyper::client::response::Response;
use hyper::error::Error;
use hyper::header::Headers;
use hyper::method::Method;
/// Trait that represents some methods to send a specific request
pub trait GetResponse {
/// Given a specific URL, get the header without the content body (useful to not waste time,
/// ressources and informations)
fn get_head_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL, get the response from the target server
fn get_http_response(&self, url: &str) -> Result<Response, Error>;
/// Given a specific URL and an header, get the response from the target server
fn get_http_response_using_headers(&self,
url: &str,
header: Headers)
-> Result<Response, Error>;
}
impl GetResponse for Client {
fn get_head_response(&self, url: &str) -> Result<Response, Error> {
self.request(Method::Head, url).send()
}
fn get_http_response(&self, url: &str) -> Result<Response, Error> {
self.get_http_response_using_headers(url, Headers::new())
}
fn get_http_response_using_headers(&self,
url: &str,
custom_header: Headers)
-> Result<Response, Error> {
self.request(Method::Get, url).headers(custom_header).send()
}
}
| use hyper::client::Client;
use hyper::client::response::Response;
use hyper::error::Error;
use hyper::header::Headers;
use hyper::method::Method;
/// Trait that represents some methods to send a specific request
pub trait GetResponse {
+ /// Given a specific URL, get the header without the content body (useful to not waste time,
+ /// ressources and informations)
+ fn get_head_response(&self, url: &str) -> Result<Response, Error>;
+
/// Given a specific URL, get the response from the target server
fn get_http_response(&self, url: &str) -> Result<Response, Error>;
-
+
/// Given a specific URL and an header, get the response from the target server
fn get_http_response_using_headers(&self,
url: &str,
header: Headers)
-> Result<Response, Error>;
}
impl GetResponse for Client {
+ fn get_head_response(&self, url: &str) -> Result<Response, Error> {
+ self.request(Method::Head, url).send()
+ }
+
fn get_http_response(&self, url: &str) -> Result<Response, Error> {
self.get_http_response_using_headers(url, Headers::new())
}
fn get_http_response_using_headers(&self,
url: &str,
custom_header: Headers)
-> Result<Response, Error> {
self.request(Method::Get, url).headers(custom_header).send()
}
} | 10 | 0.333333 | 9 | 1 |
12728f6b924a3d45f78b3955cb9fcb563db6a81f | pida_abc_type.py | pida_abc_type.py | from abc import ABCMeta, abstractmethod
class IdaTypes:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, data):
raise NotImplementedError()
@abstractmethod
def get_name(self):
raise NotImplementedError()
@abstractmethod
def get_type(self):
raise NotImplementedError()
| from abc import ABCMeta, abstractmethod
class IdaTypes:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, data):
raise NotImplementedError()
@abstractmethod
def get_type(self):
raise NotImplementedError()
| Delete abstract method get name | Delete abstract method get name
| Python | mit | goodwinxp/ATFGenerator,goodwinxp/ATFGenerator,goodwinxp/ATFGenerator | python | ## Code Before:
from abc import ABCMeta, abstractmethod
class IdaTypes:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, data):
raise NotImplementedError()
@abstractmethod
def get_name(self):
raise NotImplementedError()
@abstractmethod
def get_type(self):
raise NotImplementedError()
## Instruction:
Delete abstract method get name
## Code After:
from abc import ABCMeta, abstractmethod
class IdaTypes:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, data):
raise NotImplementedError()
@abstractmethod
def get_type(self):
raise NotImplementedError()
| from abc import ABCMeta, abstractmethod
class IdaTypes:
__metaclass__ = ABCMeta
@abstractmethod
def decode(self, data):
raise NotImplementedError()
@abstractmethod
- def get_name(self):
- raise NotImplementedError()
-
- @abstractmethod
def get_type(self):
raise NotImplementedError() | 4 | 0.235294 | 0 | 4 |
43be597f0b625a8df161054889e32dae112ddefc | spec/sitemap_generator/interpreter_spec.rb | spec/sitemap_generator/interpreter_spec.rb | require 'spec_helper'
require 'sitemap_generator/interpreter'
describe SitemapGenerator::Interpreter do
# The interpreter doesn't have the URL helpers included for some reason, so it
# fails when adding links. That messes up later specs unless we reset the sitemap object.
after :all do
SitemapGenerator::Sitemap = SitemapGenerator::LinkSet.new
end
it "should find the config file if Rails.root doesn't end in a slash" do
rails_root = Rails.root.to_s.sub(/\/$/, '')
Rails.expects(:root).returns(rails_root).at_least_once
lambda { SitemapGenerator::Interpreter.run }.should_not raise_exception(Errno::ENOENT)
end
it "should set the verbose option" do
SitemapGenerator::Interpreter.any_instance.expects(:instance_eval)
interpreter = SitemapGenerator::Interpreter.run(:verbose => true)
interpreter.instance_variable_get(:@linkset).verbose.should be_true
end
end | require 'spec_helper'
require 'sitemap_generator/interpreter'
describe SitemapGenerator::Interpreter do
# The interpreter doesn't have the URL helpers included for some reason, so it
# fails when adding links. That messes up later specs unless we reset the sitemap object.
after :all do
SitemapGenerator::Sitemap.reset!
end
it "should find the config file if Rails.root doesn't end in a slash" do
rails_root = Rails.root.to_s.sub(/\/$/, '')
Rails.expects(:root).returns(rails_root).at_least_once
lambda { SitemapGenerator::Interpreter.run }.should_not raise_exception(Errno::ENOENT)
end
it "should set the verbose option" do
SitemapGenerator::Interpreter.any_instance.expects(:instance_eval)
interpreter = SitemapGenerator::Interpreter.run(:verbose => true)
interpreter.instance_variable_get(:@linkset).verbose.should be_true
end
end
| Use the reset! method in the interpreter spec | Use the reset! method in the interpreter spec | Ruby | mit | Velid/sitemap_generator,PikachuEXE/sitemap_generator,edusegzy/sitemap_generator,bolshakov/sitemap_generator,zBMNForks/sitemap_generator,bolshakov/sitemap_generator,kjvarga/sitemap_generator,Velid/sitemap_generator,edusegzy/sitemap_generator,HisanoTakayasu/sitemap_generator,masterweb121/sitemap_generator,zBMNForks/sitemap_generator,SalzmanGroup/sitemap_generator,PikachuEXE/sitemap_generator,HisanoTakayasu/sitemap_generator,SalzmanGroup/sitemap_generator,masterweb121/sitemap_generator | ruby | ## Code Before:
require 'spec_helper'
require 'sitemap_generator/interpreter'
describe SitemapGenerator::Interpreter do
# The interpreter doesn't have the URL helpers included for some reason, so it
# fails when adding links. That messes up later specs unless we reset the sitemap object.
after :all do
SitemapGenerator::Sitemap = SitemapGenerator::LinkSet.new
end
it "should find the config file if Rails.root doesn't end in a slash" do
rails_root = Rails.root.to_s.sub(/\/$/, '')
Rails.expects(:root).returns(rails_root).at_least_once
lambda { SitemapGenerator::Interpreter.run }.should_not raise_exception(Errno::ENOENT)
end
it "should set the verbose option" do
SitemapGenerator::Interpreter.any_instance.expects(:instance_eval)
interpreter = SitemapGenerator::Interpreter.run(:verbose => true)
interpreter.instance_variable_get(:@linkset).verbose.should be_true
end
end
## Instruction:
Use the reset! method in the interpreter spec
## Code After:
require 'spec_helper'
require 'sitemap_generator/interpreter'
describe SitemapGenerator::Interpreter do
# The interpreter doesn't have the URL helpers included for some reason, so it
# fails when adding links. That messes up later specs unless we reset the sitemap object.
after :all do
SitemapGenerator::Sitemap.reset!
end
it "should find the config file if Rails.root doesn't end in a slash" do
rails_root = Rails.root.to_s.sub(/\/$/, '')
Rails.expects(:root).returns(rails_root).at_least_once
lambda { SitemapGenerator::Interpreter.run }.should_not raise_exception(Errno::ENOENT)
end
it "should set the verbose option" do
SitemapGenerator::Interpreter.any_instance.expects(:instance_eval)
interpreter = SitemapGenerator::Interpreter.run(:verbose => true)
interpreter.instance_variable_get(:@linkset).verbose.should be_true
end
end
| require 'spec_helper'
require 'sitemap_generator/interpreter'
describe SitemapGenerator::Interpreter do
# The interpreter doesn't have the URL helpers included for some reason, so it
# fails when adding links. That messes up later specs unless we reset the sitemap object.
after :all do
- SitemapGenerator::Sitemap = SitemapGenerator::LinkSet.new
+ SitemapGenerator::Sitemap.reset!
end
it "should find the config file if Rails.root doesn't end in a slash" do
rails_root = Rails.root.to_s.sub(/\/$/, '')
Rails.expects(:root).returns(rails_root).at_least_once
lambda { SitemapGenerator::Interpreter.run }.should_not raise_exception(Errno::ENOENT)
end
-
+
it "should set the verbose option" do
SitemapGenerator::Interpreter.any_instance.expects(:instance_eval)
interpreter = SitemapGenerator::Interpreter.run(:verbose => true)
interpreter.instance_variable_get(:@linkset).verbose.should be_true
end
end | 4 | 0.181818 | 2 | 2 |
01100bb3c535677d8c36c81ae16b9f44c182d4ad | js/background.js | js/background.js | chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.want == "cookies") {
chrome.cookies.getAll({}, function(cookieList) {
var cookies = [];
var wanted_cookies = ["d2lSessionVal", "d2lSecureSessionVal"];
for (var i in cookieList) {
if (wanted_cookies.indexOf(cookieList[i].name) > -1) {
cookies.push({name: cookieList[i].name, val: cookieList[i].value});
}
}
sendResponse({cookies: cookies});
});
}
return true;
});
| chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.want == "cookies") {
chrome.cookies.getAll({}, function(cookieList) {
var cookies = {};
var wanted_cookies = ["d2lSessionVal", "d2lSecureSessionVal"];
for (var i in cookieList) {
if (wanted_cookies.indexOf(cookieList[i].name) > -1) {
cookies[cookieList[i].name] = cookieList[i].value;
}
}
sendResponse({cookies: cookies});
});
}
return true;
});
| Change cookies from array to object | Change cookies from array to object
| JavaScript | mit | Speenah/rit-mycourses-file-downloader | javascript | ## Code Before:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.want == "cookies") {
chrome.cookies.getAll({}, function(cookieList) {
var cookies = [];
var wanted_cookies = ["d2lSessionVal", "d2lSecureSessionVal"];
for (var i in cookieList) {
if (wanted_cookies.indexOf(cookieList[i].name) > -1) {
cookies.push({name: cookieList[i].name, val: cookieList[i].value});
}
}
sendResponse({cookies: cookies});
});
}
return true;
});
## Instruction:
Change cookies from array to object
## Code After:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.want == "cookies") {
chrome.cookies.getAll({}, function(cookieList) {
var cookies = {};
var wanted_cookies = ["d2lSessionVal", "d2lSecureSessionVal"];
for (var i in cookieList) {
if (wanted_cookies.indexOf(cookieList[i].name) > -1) {
cookies[cookieList[i].name] = cookieList[i].value;
}
}
sendResponse({cookies: cookies});
});
}
return true;
});
| chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.want == "cookies") {
chrome.cookies.getAll({}, function(cookieList) {
- var cookies = [];
? ^^
+ var cookies = {};
? ^^
var wanted_cookies = ["d2lSessionVal", "d2lSecureSessionVal"];
for (var i in cookieList) {
if (wanted_cookies.indexOf(cookieList[i].name) > -1) {
- cookies.push({name: cookieList[i].name, val: cookieList[i].value});
? ^^^^^^^^^^^^^ ^ ^^^^ --
+ cookies[cookieList[i].name] = cookieList[i].value;
? ^ ^ ^
}
}
sendResponse({cookies: cookies});
});
}
return true;
});
| 4 | 0.210526 | 2 | 2 |
ee33df0c5c35339239ce82662d295dc2204035a5 | assets/scripts/bookmark/controller/BookMark.js | assets/scripts/bookmark/controller/BookMark.js | angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
if (data.status != 200) {
return;
}
for (var i = $scope.bookmarks.length - 1; i >= 0; i--) {
if ($scope.bookmarks[i].id != id) {
continue;
}
$scope.bookmarks.splice(i, 1);
}
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | Save one request on bookmark delete. | Save one request on bookmark delete.
| JavaScript | mit | Cacodaimon/CacoCloud,Cacodaimon/CacoCloud,Cacodaimon/CacoCloud,Cacodaimon/CacoCloud | javascript | ## Code Before:
angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
});
## Instruction:
Save one request on bookmark delete.
## Code After:
angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
if (data.status != 200) {
return;
}
for (var i = $scope.bookmarks.length - 1; i >= 0; i--) {
if ($scope.bookmarks[i].id != id) {
continue;
}
$scope.bookmarks.splice(i, 1);
}
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
- BookMarkREST.all({}, function (data) {
- $scope.bookmarks = data.response;
+ if (data.status != 200) {
+ return;
- });
? --
+ }
+
+ for (var i = $scope.bookmarks.length - 1; i >= 0; i--) {
+ if ($scope.bookmarks[i].id != id) {
+ continue;
+ }
+
+ $scope.bookmarks.splice(i, 1);
+ }
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | 14 | 0.358974 | 11 | 3 |
368241313dff3de5d0ce41d663fc5414ed27c918 | src/main/java/j2html/tags/InlineStaticResource.java | src/main/java/j2html/tags/InlineStaticResource.java | package j2html.tags;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import j2html.Config;
import j2html.utils.CSSMin;
import j2html.utils.JSMin;
import static j2html.TagCreator.*;
public class InlineStaticResource {
public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}
public static ContainerTag get(String path, TargetFormat format) {
String fileString = getFileAsString(path);
switch (format) {
case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
case JS_MIN : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
case CSS : return style().with(rawHtml(fileString));
case JS : return script().with(rawHtml(fileString));
default : throw new RuntimeException("Invalid target format");
}
}
public static String getFileAsString(String path) {
try {
return readFileAsString(InlineStaticResource.class.getResource(path).getPath());
} catch (Exception e1) {
try {
return readFileAsString(path);
} catch (Exception e2) {
throw new RuntimeException("Couldn't find file with path='" + path + "'");
}
}
}
/**
* @author kjheimark <3
*/
private static String readFileAsString(String path) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new FileReader(path));
StringBuilder sb = new StringBuilder();
int c;
while ((c = bufferedReader.read()) >= 0 && c >= 0) {
sb.append((char) c);
}
return sb.toString();
}
}
| package j2html.tags;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;
import j2html.Config;
import static j2html.TagCreator.*;
public class InlineStaticResource {
public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}
public static ContainerTag get(String path, TargetFormat format) {
String fileString = getFileAsString(path);
switch (format) {
case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
case JS_MIN : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
case CSS : return style().with(rawHtml(fileString));
case JS : return script().with(rawHtml(fileString));
default : throw new RuntimeException("Invalid target format");
}
}
public static String getFileAsString(String path) {
try {
return streamToString(InlineStaticResource.class.getResourceAsStream(path));
} catch (Exception expected) { // we don't ask users to specify classpath or file-system
try {
return streamToString(new FileInputStream(path));
} catch (Exception exception) {
throw new RuntimeException("Couldn't find file with path='" + path + "'");
}
}
}
private static String streamToString(InputStream inputStream) {
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
}
| Allow reading static resources from jars | Allow reading static resources from jars
| Java | apache-2.0 | tipsy/j2html,tipsy/j2html,tipsy/j2html | java | ## Code Before:
package j2html.tags;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import j2html.Config;
import j2html.utils.CSSMin;
import j2html.utils.JSMin;
import static j2html.TagCreator.*;
public class InlineStaticResource {
public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}
public static ContainerTag get(String path, TargetFormat format) {
String fileString = getFileAsString(path);
switch (format) {
case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
case JS_MIN : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
case CSS : return style().with(rawHtml(fileString));
case JS : return script().with(rawHtml(fileString));
default : throw new RuntimeException("Invalid target format");
}
}
public static String getFileAsString(String path) {
try {
return readFileAsString(InlineStaticResource.class.getResource(path).getPath());
} catch (Exception e1) {
try {
return readFileAsString(path);
} catch (Exception e2) {
throw new RuntimeException("Couldn't find file with path='" + path + "'");
}
}
}
/**
* @author kjheimark <3
*/
private static String readFileAsString(String path) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new FileReader(path));
StringBuilder sb = new StringBuilder();
int c;
while ((c = bufferedReader.read()) >= 0 && c >= 0) {
sb.append((char) c);
}
return sb.toString();
}
}
## Instruction:
Allow reading static resources from jars
## Code After:
package j2html.tags;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;
import j2html.Config;
import static j2html.TagCreator.*;
public class InlineStaticResource {
public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}
public static ContainerTag get(String path, TargetFormat format) {
String fileString = getFileAsString(path);
switch (format) {
case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
case JS_MIN : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
case CSS : return style().with(rawHtml(fileString));
case JS : return script().with(rawHtml(fileString));
default : throw new RuntimeException("Invalid target format");
}
}
public static String getFileAsString(String path) {
try {
return streamToString(InlineStaticResource.class.getResourceAsStream(path));
} catch (Exception expected) { // we don't ask users to specify classpath or file-system
try {
return streamToString(new FileInputStream(path));
} catch (Exception exception) {
throw new RuntimeException("Couldn't find file with path='" + path + "'");
}
}
}
private static String streamToString(InputStream inputStream) {
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
}
| package j2html.tags;
- import java.io.BufferedReader;
- import java.io.FileReader;
? ^ ^^^
+ import java.io.FileInputStream;
? ^^^^^^^^ ^
- import java.io.IOException;
+ import java.io.InputStream;
+ import java.util.Scanner;
import j2html.Config;
- import j2html.utils.CSSMin;
- import j2html.utils.JSMin;
import static j2html.TagCreator.*;
public class InlineStaticResource {
public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}
public static ContainerTag get(String path, TargetFormat format) {
String fileString = getFileAsString(path);
switch (format) {
case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
case JS_MIN : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
case CSS : return style().with(rawHtml(fileString));
case JS : return script().with(rawHtml(fileString));
default : throw new RuntimeException("Invalid target format");
}
}
public static String getFileAsString(String path) {
try {
- return readFileAsString(InlineStaticResource.class.getResource(path).getPath());
? ^^^^^^^ ----------
+ return streamToString(InlineStaticResource.class.getResourceAsStream(path));
? ++ ^^^ ++++++++
- } catch (Exception e1) {
+ } catch (Exception expected) { // we don't ask users to specify classpath or file-system
try {
- return readFileAsString(path);
+ return streamToString(new FileInputStream(path));
- } catch (Exception e2) {
? ^
+ } catch (Exception exception) {
? ^^^^^^^^
throw new RuntimeException("Couldn't find file with path='" + path + "'");
}
}
}
+ private static String streamToString(InputStream inputStream) {
+ Scanner s = new Scanner(inputStream).useDelimiter("\\A");
+ return s.hasNext() ? s.next() : "";
- /**
- * @author kjheimark <3
- */
- private static String readFileAsString(String path) throws IOException {
- BufferedReader bufferedReader = new BufferedReader(new FileReader(path));
- StringBuilder sb = new StringBuilder();
- int c;
- while ((c = bufferedReader.read()) >= 0 && c >= 0) {
- sb.append((char) c);
- }
- return sb.toString();
}
}
| 30 | 0.555556 | 10 | 20 |
958fe51f514f35d90cc606dd95e3c24e81c8fb35 | src/lib.rs | src/lib.rs | //! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! use bear::fixture;
//!
//! // Get a content of 'tests/fixtures/hello.txt'
//! let content = fixture("hello.txt");
//!
//! // Do whatever you want with it
//! ```
#![doc(html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
html_root_url = "https://simnalamburt.github.io/bear")]
use std::path::Path;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
/// Open a file from the 'tests/fixtures' directory, and return its content as a `String`
///
/// Example
/// --------
///
/// ```rust
/// use bear::fixture;
///
/// // Get a content of 'tests/fixtures/hello.txt'
/// let content = fixture("hello.txt");
///
/// /* Do whatever you want with it */
/// ```
pub fn fixture(filename: &str) -> String {
let path = Path::new("tests").join("fixtures").join(filename);
let file = File::open(&path).unwrap();
let mut reader = BufReader::new(file);
let mut ret = String::new();
reader.read_to_string(&mut ret).unwrap();
ret
}
| //! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! use bear::fixture;
//!
//! // Get a content of 'tests/fixtures/hello.txt'
//! let content = fixture("hello.txt");
//!
//! // Do whatever you want with it
//! ```
#![doc(
html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
html_root_url = "https://simnalamburt.github.io/bear"
)]
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
/// Open a file from the 'tests/fixtures' directory, and return its content as a `String`
///
/// Example
/// --------
///
/// ```rust
/// use bear::fixture;
///
/// // Get a content of 'tests/fixtures/hello.txt'
/// let content = fixture("hello.txt");
///
/// /* Do whatever you want with it */
/// ```
pub fn fixture(filename: &str) -> String {
let path = Path::new("tests").join("fixtures").join(filename);
let file = File::open(&path).unwrap();
let mut reader = BufReader::new(file);
let mut ret = String::new();
reader.read_to_string(&mut ret).unwrap();
ret
}
| Format codes with `cargo fmt` | Format codes with `cargo fmt`
| Rust | bsd-2-clause | simnalamburt/bear | rust | ## Code Before:
//! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! use bear::fixture;
//!
//! // Get a content of 'tests/fixtures/hello.txt'
//! let content = fixture("hello.txt");
//!
//! // Do whatever you want with it
//! ```
#![doc(html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
html_root_url = "https://simnalamburt.github.io/bear")]
use std::path::Path;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
/// Open a file from the 'tests/fixtures' directory, and return its content as a `String`
///
/// Example
/// --------
///
/// ```rust
/// use bear::fixture;
///
/// // Get a content of 'tests/fixtures/hello.txt'
/// let content = fixture("hello.txt");
///
/// /* Do whatever you want with it */
/// ```
pub fn fixture(filename: &str) -> String {
let path = Path::new("tests").join("fixtures").join(filename);
let file = File::open(&path).unwrap();
let mut reader = BufReader::new(file);
let mut ret = String::new();
reader.read_to_string(&mut ret).unwrap();
ret
}
## Instruction:
Format codes with `cargo fmt`
## Code After:
//! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! use bear::fixture;
//!
//! // Get a content of 'tests/fixtures/hello.txt'
//! let content = fixture("hello.txt");
//!
//! // Do whatever you want with it
//! ```
#![doc(
html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
html_root_url = "https://simnalamburt.github.io/bear"
)]
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
/// Open a file from the 'tests/fixtures' directory, and return its content as a `String`
///
/// Example
/// --------
///
/// ```rust
/// use bear::fixture;
///
/// // Get a content of 'tests/fixtures/hello.txt'
/// let content = fixture("hello.txt");
///
/// /* Do whatever you want with it */
/// ```
pub fn fixture(filename: &str) -> String {
let path = Path::new("tests").join("fixtures").join(filename);
let file = File::open(&path).unwrap();
let mut reader = BufReader::new(file);
let mut ret = String::new();
reader.read_to_string(&mut ret).unwrap();
ret
}
| //! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! use bear::fixture;
//!
//! // Get a content of 'tests/fixtures/hello.txt'
//! let content = fixture("hello.txt");
//!
//! // Do whatever you want with it
//! ```
+ #![doc(
- #![doc(html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
? ^^^^^^^ ---
+ html_logo_url = "https://simnalamburt.github.io/bear/cute.png",
? ^^^^
- html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
? ---
+ html_favicon_url = "https://simnalamburt.github.io/bear/cute.png",
- html_root_url = "https://simnalamburt.github.io/bear")]
? --- --- --
+ html_root_url = "https://simnalamburt.github.io/bear"
+ )]
+ use std::fs::File;
+ use std::io::prelude::*;
+ use std::io::BufReader;
use std::path::Path;
- use std::fs::File;
- use std::io::BufReader;
- use std::io::prelude::*;
/// Open a file from the 'tests/fixtures' directory, and return its content as a `String`
///
/// Example
/// --------
///
/// ```rust
/// use bear::fixture;
///
/// // Get a content of 'tests/fixtures/hello.txt'
/// let content = fixture("hello.txt");
///
/// /* Do whatever you want with it */
/// ```
pub fn fixture(filename: &str) -> String {
let path = Path::new("tests").join("fixtures").join(filename);
let file = File::open(&path).unwrap();
let mut reader = BufReader::new(file);
let mut ret = String::new();
reader.read_to_string(&mut ret).unwrap();
ret
} | 14 | 0.297872 | 8 | 6 |
b69d41368f49fef19d3440940df07da0f9a03006 | web/router.ex | web/router.ex | defmodule HaruElixirApi.Router do
use HaruElixirApi.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", HaruElixirApi do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
end
## Entity
post "/classes/:classname", WriteController, :create_entity
put "/classes/:classname/:id", WriteController, :update_entity
delete "/classes/:classname/:id", WriteController, :delete_entity
delete "/classes/:classname", WriteController, :delete_class
## Config
post "/config", WriteController, :create_config
put "/config", WriteController, :update_config
delete "/config", WriteController, :delete_config
end
| defmodule HaruElixirApi.Router do
use HaruElixirApi.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", HaruElixirApi do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
end
## Entity
post "/classes/:classname", WriteController, :create_entity
put "/classes/:classname/:id", WriteController, :update_entity
delete "/classes/:classname/:id", WriteController, :delete_entity
delete "/classes/:classname", WriteController, :delete_class
## Config
post "/config", WriteController, :create_config
put "/config", WriteController, :update_config
delete "/config", WriteController, :delete_config
## Review crawler
post "/reiview/fetch", WriteController, :fetch_review
end
| Add fetch review crawling route | Add fetch review crawling route
| Elixir | mit | haruio/haru-elixir-api,haruio/haru-elixir-api | elixir | ## Code Before:
defmodule HaruElixirApi.Router do
use HaruElixirApi.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", HaruElixirApi do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
end
## Entity
post "/classes/:classname", WriteController, :create_entity
put "/classes/:classname/:id", WriteController, :update_entity
delete "/classes/:classname/:id", WriteController, :delete_entity
delete "/classes/:classname", WriteController, :delete_class
## Config
post "/config", WriteController, :create_config
put "/config", WriteController, :update_config
delete "/config", WriteController, :delete_config
end
## Instruction:
Add fetch review crawling route
## Code After:
defmodule HaruElixirApi.Router do
use HaruElixirApi.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", HaruElixirApi do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
end
## Entity
post "/classes/:classname", WriteController, :create_entity
put "/classes/:classname/:id", WriteController, :update_entity
delete "/classes/:classname/:id", WriteController, :delete_entity
delete "/classes/:classname", WriteController, :delete_class
## Config
post "/config", WriteController, :create_config
put "/config", WriteController, :update_config
delete "/config", WriteController, :delete_config
## Review crawler
post "/reiview/fetch", WriteController, :fetch_review
end
| defmodule HaruElixirApi.Router do
use HaruElixirApi.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", HaruElixirApi do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
end
## Entity
post "/classes/:classname", WriteController, :create_entity
put "/classes/:classname/:id", WriteController, :update_entity
delete "/classes/:classname/:id", WriteController, :delete_entity
delete "/classes/:classname", WriteController, :delete_class
## Config
post "/config", WriteController, :create_config
put "/config", WriteController, :update_config
delete "/config", WriteController, :delete_config
+ ## Review crawler
+ post "/reiview/fetch", WriteController, :fetch_review
+
+
end | 4 | 0.121212 | 4 | 0 |
6f316e4e99ea1732e96e483956bb0f597de2b95e | lib/rbNFA.rb | lib/rbNFA.rb | require "rbNFA/version"
module RbNFA
class Regexp
def initialize(string)
end
end
end
| require "rbNFA/version"
module RbNFA
class Regexp
def initialize(string)
end
end
class Lexer
def lex(regexp)
return []
end
end
end
| Add basic implementation for first test in regexp. | Add basic implementation for first test in regexp.
| Ruby | mit | bambuchaAdm/rbNFA | ruby | ## Code Before:
require "rbNFA/version"
module RbNFA
class Regexp
def initialize(string)
end
end
end
## Instruction:
Add basic implementation for first test in regexp.
## Code After:
require "rbNFA/version"
module RbNFA
class Regexp
def initialize(string)
end
end
class Lexer
def lex(regexp)
return []
end
end
end
| require "rbNFA/version"
module RbNFA
class Regexp
def initialize(string)
end
end
+
+ class Lexer
+ def lex(regexp)
+ return []
+ end
+ end
end | 6 | 0.666667 | 6 | 0 |
d19925ed263bca27c5f983e5cfb3c4ebd8dbd8e0 | src/com/twu/biblioteca/BibliotecaApp.java | src/com/twu/biblioteca/BibliotecaApp.java | package com.twu.biblioteca;
import java.util.ArrayList;
public class BibliotecaApp {
private ArrayList<Book> books;
public static void main(String[] args) {
System.out.println("Welcome to Biblioteca!");
}
}
| package com.twu.biblioteca;
import java.util.ArrayList;
public class BibliotecaApp {
public static void main(String[] args) {
ArrayList<Book> books = new ArrayList<Book>();
books.add(new Book("Harry Potter"));
books.add(new Book("Lord of the Rings"));
System.out.println("Welcome to Biblioteca!");
for (Book book : books)
System.out.println(book.getName());
}
}
| Print books on startup of biblioteca | Print books on startup of biblioteca
| Java | apache-2.0 | galperie/twu-biblioteca-EllenAndAkon | java | ## Code Before:
package com.twu.biblioteca;
import java.util.ArrayList;
public class BibliotecaApp {
private ArrayList<Book> books;
public static void main(String[] args) {
System.out.println("Welcome to Biblioteca!");
}
}
## Instruction:
Print books on startup of biblioteca
## Code After:
package com.twu.biblioteca;
import java.util.ArrayList;
public class BibliotecaApp {
public static void main(String[] args) {
ArrayList<Book> books = new ArrayList<Book>();
books.add(new Book("Harry Potter"));
books.add(new Book("Lord of the Rings"));
System.out.println("Welcome to Biblioteca!");
for (Book book : books)
System.out.println(book.getName());
}
}
| package com.twu.biblioteca;
import java.util.ArrayList;
public class BibliotecaApp {
- private ArrayList<Book> books;
-
public static void main(String[] args) {
+ ArrayList<Book> books = new ArrayList<Book>();
+ books.add(new Book("Harry Potter"));
+ books.add(new Book("Lord of the Rings"));
System.out.println("Welcome to Biblioteca!");
-
+ for (Book book : books)
+ System.out.println(book.getName());
}
} | 8 | 0.571429 | 5 | 3 |
06eca4fcf397cc296e0886e8b6fe035a11b76195 | app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx | app/assets/javascripts/components/UserShowComponents/UserShow.js.jsx | var UserShow = React.createClass({
render: function(){
return (
<div className="user_show_wrapper">
<br/>
<div className="ui stackable three column centered grid">
<div className="column">
<h3 className="ui horizontal divider header"> About Me </h3>
< UserProfileCard user={this.props.user} same_user={this.props.same_user} />
<br></br>
< Badges badges={this.props.badges} />
</div>
<div className=" column">
< UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} />
</div>
</div>
</div>
)
}
})
| var UserShow = React.createClass({
componentWillMount: function() {
document.title ="FixStart | "+ this.props.user.first_name +" "+ this.props.user.last_name;
},
render: function(){
return (
<div className="user_show_wrapper">
<br/>
<div className="ui stackable three column centered grid">
<div className="column">
<h3 className="ui horizontal divider header"> About Me </h3>
< UserProfileCard user={this.props.user} same_user={this.props.same_user} />
<br></br>
< Badges badges={this.props.badges} />
</div>
<div className=" column">
< UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} />
</div>
</div>
</div>
)
}
})
| Add personalized first name for a given user | Add personalized first name for a given user
| JSX | mit | ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter | jsx | ## Code Before:
var UserShow = React.createClass({
render: function(){
return (
<div className="user_show_wrapper">
<br/>
<div className="ui stackable three column centered grid">
<div className="column">
<h3 className="ui horizontal divider header"> About Me </h3>
< UserProfileCard user={this.props.user} same_user={this.props.same_user} />
<br></br>
< Badges badges={this.props.badges} />
</div>
<div className=" column">
< UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} />
</div>
</div>
</div>
)
}
})
## Instruction:
Add personalized first name for a given user
## Code After:
var UserShow = React.createClass({
componentWillMount: function() {
document.title ="FixStart | "+ this.props.user.first_name +" "+ this.props.user.last_name;
},
render: function(){
return (
<div className="user_show_wrapper">
<br/>
<div className="ui stackable three column centered grid">
<div className="column">
<h3 className="ui horizontal divider header"> About Me </h3>
< UserProfileCard user={this.props.user} same_user={this.props.same_user} />
<br></br>
< Badges badges={this.props.badges} />
</div>
<div className=" column">
< UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} />
</div>
</div>
</div>
)
}
})
| var UserShow = React.createClass({
+
+ componentWillMount: function() {
+ document.title ="FixStart | "+ this.props.user.first_name +" "+ this.props.user.last_name;
+ },
+
render: function(){
return (
<div className="user_show_wrapper">
<br/>
<div className="ui stackable three column centered grid">
<div className="column">
<h3 className="ui horizontal divider header"> About Me </h3>
< UserProfileCard user={this.props.user} same_user={this.props.same_user} />
<br></br>
< Badges badges={this.props.badges} />
</div>
<div className=" column">
< UserActivity user={this.props.user} issues={this.props.issues} fixes={this.props.fixes} watches={this.props.watches} same_user={this.props.same_user} />
</div>
</div>
</div>
)
}
}) | 5 | 0.192308 | 5 | 0 |
a39a7cb4a4e8cb0c9083d7094a4e4cff32328c5c | apps/rewardedads/README.md | apps/rewardedads/README.md |
This app implements the verifier side of Server-Side Verification of Google
AdMob Rewarded Ads.
## Snapshots
This app has yet not been released, though you can still play with it using
snapshot versions.
Snapshots of this app built from the master branch are available through Maven
using version `HEAD-SNAPSHOT`. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/HEAD-SNAPSHOT).
To add a dependency using Maven:
```xml
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>HEAD-SNAPSHOT</version>
</dependency>
```
|
This app implements the verifier side of Server-Side Verification of Google
AdMob Rewarded Ads.
## Latest Release
The most recent release is
[1.2.2](https://github.com/google/tink/releases/tag/v1.2.2), released
2019-01-24. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/1.2.2).
The Maven group ID is `com.google.crypto.tink`, and the artifact ID is
`apps-rewardedads`.
To add a dependency using Maven:
```xml
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>1.2.2</version>
</dependency>
```
## Snapshots
Snapshots of this app built from the master branch are available through Maven
using version `HEAD-SNAPSHOT`. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/HEAD-SNAPSHOT).
To add a dependency using Maven:
```xml
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>HEAD-SNAPSHOT</version>
</dependency>
```
| Update the rewardedads documentation to reflect it's release state. | Update the rewardedads documentation to reflect it's release state.
PiperOrigin-RevId: 245332714
GitOrigin-RevId: 56556412700aeac006a61105cda55059f486e8c7
| Markdown | apache-2.0 | google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink | markdown | ## Code Before:
This app implements the verifier side of Server-Side Verification of Google
AdMob Rewarded Ads.
## Snapshots
This app has yet not been released, though you can still play with it using
snapshot versions.
Snapshots of this app built from the master branch are available through Maven
using version `HEAD-SNAPSHOT`. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/HEAD-SNAPSHOT).
To add a dependency using Maven:
```xml
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>HEAD-SNAPSHOT</version>
</dependency>
```
## Instruction:
Update the rewardedads documentation to reflect it's release state.
PiperOrigin-RevId: 245332714
GitOrigin-RevId: 56556412700aeac006a61105cda55059f486e8c7
## Code After:
This app implements the verifier side of Server-Side Verification of Google
AdMob Rewarded Ads.
## Latest Release
The most recent release is
[1.2.2](https://github.com/google/tink/releases/tag/v1.2.2), released
2019-01-24. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/1.2.2).
The Maven group ID is `com.google.crypto.tink`, and the artifact ID is
`apps-rewardedads`.
To add a dependency using Maven:
```xml
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>1.2.2</version>
</dependency>
```
## Snapshots
Snapshots of this app built from the master branch are available through Maven
using version `HEAD-SNAPSHOT`. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/HEAD-SNAPSHOT).
To add a dependency using Maven:
```xml
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>HEAD-SNAPSHOT</version>
</dependency>
```
|
This app implements the verifier side of Server-Side Verification of Google
AdMob Rewarded Ads.
+ ## Latest Release
+
+ The most recent release is
+ [1.2.2](https://github.com/google/tink/releases/tag/v1.2.2), released
+ 2019-01-24. API docs can be found
+ [here](https://google.github.com/tink/javadoc/apps-rewardedads/1.2.2).
+
+ The Maven group ID is `com.google.crypto.tink`, and the artifact ID is
+ `apps-rewardedads`.
+
+ To add a dependency using Maven:
+
+ ```xml
+ <dependency>
+ <groupId>com.google.crypto.tink</groupId>
+ <artifactId>apps-rewardedads</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ ```
+
## Snapshots
-
- This app has yet not been released, though you can still play with it using
- snapshot versions.
Snapshots of this app built from the master branch are available through Maven
using version `HEAD-SNAPSHOT`. API docs can be found
[here](https://google.github.com/tink/javadoc/apps-rewardedads/HEAD-SNAPSHOT).
To add a dependency using Maven:
```xml
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>HEAD-SNAPSHOT</version>
</dependency>
``` | 23 | 0.621622 | 20 | 3 |
b829724f163c81a0ebcd024d0f894eb410fe599a | .travis.yml | .travis.yml | language: c++
arch:
- arm64
os:
- linux
compiler:
- gcc
before_install:
- sudo apt-get install -y build-essential
script:
- make check
| language: c++
arch:
- arm64
os:
- linux
compiler:
- gcc
- clang
before_install:
- sudo apt-get install -y build-essential
script:
- make check
| Add Clang compiler for testing | CI: Add Clang compiler for testing
| YAML | mit | DLTcollab/sse2neon,DLTcollab/sse2neon,DLTcollab/sse2neon | yaml | ## Code Before:
language: c++
arch:
- arm64
os:
- linux
compiler:
- gcc
before_install:
- sudo apt-get install -y build-essential
script:
- make check
## Instruction:
CI: Add Clang compiler for testing
## Code After:
language: c++
arch:
- arm64
os:
- linux
compiler:
- gcc
- clang
before_install:
- sudo apt-get install -y build-essential
script:
- make check
| language: c++
arch:
- arm64
os:
- linux
compiler:
- gcc
+ - clang
before_install:
- sudo apt-get install -y build-essential
script:
- make check | 1 | 0.0625 | 1 | 0 |
af13dad5184057e7013868bbda7c2e508130215c | lib/node_modules/@stdlib/utils/parse-json/docs/repl.txt | lib/node_modules/@stdlib/utils/parse-json/docs/repl.txt |
{{alias}}( str[, reviver] )
Attempts to parse a string as JSON.
The implementation differs to the native `JSON.parse()` function as follows:
- it throws a `TypeError` if provided any value which is not a `string`.
- it throws a `SyntaxError` if unable to parse a `string` as JSON.
- it throws a `TypeError` if provided a `reviver` argument which is not a
function.
Parameters
----------
str: string
String to parse.
reviver: Function
Transformation function.
Examples
--------
> var obj = {{alias}}( '{"beep":"boop"}' )
{ 'beep': 'boop' }
// Provide a reviver:
> function reviver( key, value ) {
> if ( key === '' ) { return value; }
> if ( key === 'beep' ) { return value; }
> };
> var str = '{"beep":"boop","a":"b"}';
> var out = {{alias}}( str, reviver )
{ 'beep': 'boop' }
See Also
--------
|
{{alias}}( str[, reviver] )
Attempts to parse a string as JSON.
Function behavior differs from `JSON.parse()` as follows:
- throws a `TypeError` if provided any value which is not a string.
- throws a `TypeError` if provided a `reviver` argument which is not a
function.
- returns, rather than throws, a `SyntaxError` if unable to parse a string
as JSON.
Parameters
----------
str: string
String to parse.
reviver: Function
Transformation function.
Returns
-------
out: any|Error
Parsed value or an error.
Examples
--------
> var obj = {{alias}}( '{"beep":"boop"}' )
{ 'beep': 'boop' }
// Provide a reviver:
> function reviver( key, value ) {
> if ( key === '' ) { return value; }
> if ( key === 'beep' ) { return value; }
> };
> var str = '{"beep":"boop","a":"b"}';
> var out = {{alias}}( str, reviver )
{ 'beep': 'boop' }
See Also
--------
| Add missing returns section and fix behavior desc | Add missing returns section and fix behavior desc
| Text | 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 | text | ## Code Before:
{{alias}}( str[, reviver] )
Attempts to parse a string as JSON.
The implementation differs to the native `JSON.parse()` function as follows:
- it throws a `TypeError` if provided any value which is not a `string`.
- it throws a `SyntaxError` if unable to parse a `string` as JSON.
- it throws a `TypeError` if provided a `reviver` argument which is not a
function.
Parameters
----------
str: string
String to parse.
reviver: Function
Transformation function.
Examples
--------
> var obj = {{alias}}( '{"beep":"boop"}' )
{ 'beep': 'boop' }
// Provide a reviver:
> function reviver( key, value ) {
> if ( key === '' ) { return value; }
> if ( key === 'beep' ) { return value; }
> };
> var str = '{"beep":"boop","a":"b"}';
> var out = {{alias}}( str, reviver )
{ 'beep': 'boop' }
See Also
--------
## Instruction:
Add missing returns section and fix behavior desc
## Code After:
{{alias}}( str[, reviver] )
Attempts to parse a string as JSON.
Function behavior differs from `JSON.parse()` as follows:
- throws a `TypeError` if provided any value which is not a string.
- throws a `TypeError` if provided a `reviver` argument which is not a
function.
- returns, rather than throws, a `SyntaxError` if unable to parse a string
as JSON.
Parameters
----------
str: string
String to parse.
reviver: Function
Transformation function.
Returns
-------
out: any|Error
Parsed value or an error.
Examples
--------
> var obj = {{alias}}( '{"beep":"boop"}' )
{ 'beep': 'boop' }
// Provide a reviver:
> function reviver( key, value ) {
> if ( key === '' ) { return value; }
> if ( key === 'beep' ) { return value; }
> };
> var str = '{"beep":"boop","a":"b"}';
> var out = {{alias}}( str, reviver )
{ 'beep': 'boop' }
See Also
--------
|
{{alias}}( str[, reviver] )
Attempts to parse a string as JSON.
- The implementation differs to the native `JSON.parse()` function as follows:
+ Function behavior differs from `JSON.parse()` as follows:
- - it throws a `TypeError` if provided any value which is not a `string`.
? --- - -
+ - throws a `TypeError` if provided any value which is not a string.
- - it throws a `SyntaxError` if unable to parse a `string` as JSON.
- - it throws a `TypeError` if provided a `reviver` argument which is not a
? ---
+ - throws a `TypeError` if provided a `reviver` argument which is not a
function.
+ - returns, rather than throws, a `SyntaxError` if unable to parse a string
+ as JSON.
Parameters
----------
str: string
String to parse.
reviver: Function
Transformation function.
+
+ Returns
+ -------
+ out: any|Error
+ Parsed value or an error.
Examples
--------
> var obj = {{alias}}( '{"beep":"boop"}' )
{ 'beep': 'boop' }
// Provide a reviver:
> function reviver( key, value ) {
> if ( key === '' ) { return value; }
> if ( key === 'beep' ) { return value; }
> };
> var str = '{"beep":"boop","a":"b"}';
> var out = {{alias}}( str, reviver )
{ 'beep': 'boop' }
See Also
--------
| 14 | 0.388889 | 10 | 4 |
fe854afd83199b142bd0160168c4684db9465866 | models/post/columns.yaml | models/post/columns.yaml |
columns:
title:
label: Title
searchable: true
author:
label: Author
relation: user
select: @login
searchable: true
categories:
label: Categories
relation: categories
select: @name
searchable: true
created_at:
label: Created
type: date
updated_at:
label: Updated
type: date
published_at:
label: Published
type: date |
columns:
title:
label: Title
searchable: true
# author:
# label: Author
# relation: user
# select: @login
# searchable: true
categories:
label: Categories
relation: categories
select: @name
searchable: true
created_at:
label: Created
type: date
updated_at:
label: Updated
type: date
published_at:
label: Published
type: date | Comment out author column (not used) | Comment out author column (not used)
| YAML | mit | vojtasvoboda/blog-plugin,rainlab/blog-plugin,vojtasvoboda/blog-plugin,rainlab/blog-plugin,rainlab/blog-plugin,vojtasvoboda/blog-plugin | yaml | ## Code Before:
columns:
title:
label: Title
searchable: true
author:
label: Author
relation: user
select: @login
searchable: true
categories:
label: Categories
relation: categories
select: @name
searchable: true
created_at:
label: Created
type: date
updated_at:
label: Updated
type: date
published_at:
label: Published
type: date
## Instruction:
Comment out author column (not used)
## Code After:
columns:
title:
label: Title
searchable: true
# author:
# label: Author
# relation: user
# select: @login
# searchable: true
categories:
label: Categories
relation: categories
select: @name
searchable: true
created_at:
label: Created
type: date
updated_at:
label: Updated
type: date
published_at:
label: Published
type: date |
columns:
title:
label: Title
searchable: true
- author:
+ # author:
? ++
- label: Author
+ # label: Author
? ++
- relation: user
+ # relation: user
? ++
- select: @login
+ # select: @login
? ++
- searchable: true
+ # searchable: true
? ++
categories:
label: Categories
relation: categories
select: @name
searchable: true
created_at:
label: Created
type: date
updated_at:
label: Updated
type: date
published_at:
label: Published
type: date | 10 | 0.333333 | 5 | 5 |
b893dd772fbaf05e5867ae4e91bac947a678a8b7 | README.md | README.md | NotJenkins
==========
An effort to replace Jenkins with a very small shell script
| NotJenkins
==========
An effort to replace Jenkins with a very small shell script
URL Structure
=============
POST /api/NotJenkins/hook/github/:type
:type can be pull_request, push, issue, etc
GET /api/NotJenkins/pull
lists all pull requests we've built
GET /api/NotJenkins/pull/:pull-id
Shows information about a pull request - including how many times we've built it
GET /api/NotJenkins/pull/:pull-id/:build-id
Show a specific build, with full details about what failed. Every time a PR is update, we add a new build
| Add some info to readme | Add some info to readme
| Markdown | mit | LoonyPandora/NotJenkins,LoonyPandora/NotJenkins | markdown | ## Code Before:
NotJenkins
==========
An effort to replace Jenkins with a very small shell script
## Instruction:
Add some info to readme
## Code After:
NotJenkins
==========
An effort to replace Jenkins with a very small shell script
URL Structure
=============
POST /api/NotJenkins/hook/github/:type
:type can be pull_request, push, issue, etc
GET /api/NotJenkins/pull
lists all pull requests we've built
GET /api/NotJenkins/pull/:pull-id
Shows information about a pull request - including how many times we've built it
GET /api/NotJenkins/pull/:pull-id/:build-id
Show a specific build, with full details about what failed. Every time a PR is update, we add a new build
| NotJenkins
==========
An effort to replace Jenkins with a very small shell script
+
+
+
+ URL Structure
+ =============
+
+ POST /api/NotJenkins/hook/github/:type
+
+ :type can be pull_request, push, issue, etc
+
+
+ GET /api/NotJenkins/pull
+
+ lists all pull requests we've built
+
+
+ GET /api/NotJenkins/pull/:pull-id
+
+ Shows information about a pull request - including how many times we've built it
+
+
+ GET /api/NotJenkins/pull/:pull-id/:build-id
+
+ Show a specific build, with full details about what failed. Every time a PR is update, we add a new build
+
+ | 26 | 6.5 | 26 | 0 |
74536d269f37f28a57e2acbe4728866b1b2673f7 | README.md | README.md |
The library allows you to organize access to configuration data in yaml format, taking into account the environment.
## Install
go get github.com/roomink/gosya
## Usage
In the folder example complete example of use.
```go
import "github.com/roomink/gosya"
settings := &Settings{}
err := gosya.Merge(settings, path, env)
```
`Merge` function takes several arguments:
* `settings` A pointer to a structure that will project data from yaml.
* `path` Path where the configuration files.
* `env` Environment, for which the configuration is formed.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
|
The library allows you to organize access to configuration data in yaml format, taking into account the environment.
## Install
go get github.com/roomink/gosya
## Usage
In the folder example complete example of use.
```go
import "github.com/roomink/gosya"
settings := &Settings{}
err := gosya.Merge(settings, path, env)
```
Organize files in the config directory
path_to_config
├── settings
│ └── development.yml
├── settings.local.yml
└── settings.yml
`Merge` function takes several arguments:
* `settings` A pointer to a structure that will project data from yaml.
* `path` Path where the configuration files.
* `env` Environment, for which the configuration is formed.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
| Add tree view for dir config | Add tree view for dir config
| Markdown | mit | roomink/gosya | markdown | ## Code Before:
The library allows you to organize access to configuration data in yaml format, taking into account the environment.
## Install
go get github.com/roomink/gosya
## Usage
In the folder example complete example of use.
```go
import "github.com/roomink/gosya"
settings := &Settings{}
err := gosya.Merge(settings, path, env)
```
`Merge` function takes several arguments:
* `settings` A pointer to a structure that will project data from yaml.
* `path` Path where the configuration files.
* `env` Environment, for which the configuration is formed.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Instruction:
Add tree view for dir config
## Code After:
The library allows you to organize access to configuration data in yaml format, taking into account the environment.
## Install
go get github.com/roomink/gosya
## Usage
In the folder example complete example of use.
```go
import "github.com/roomink/gosya"
settings := &Settings{}
err := gosya.Merge(settings, path, env)
```
Organize files in the config directory
path_to_config
├── settings
│ └── development.yml
├── settings.local.yml
└── settings.yml
`Merge` function takes several arguments:
* `settings` A pointer to a structure that will project data from yaml.
* `path` Path where the configuration files.
* `env` Environment, for which the configuration is formed.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
|
The library allows you to organize access to configuration data in yaml format, taking into account the environment.
## Install
go get github.com/roomink/gosya
## Usage
In the folder example complete example of use.
```go
import "github.com/roomink/gosya"
settings := &Settings{}
err := gosya.Merge(settings, path, env)
```
+ Organize files in the config directory
+
+ path_to_config
+ ├── settings
+ │ └── development.yml
+ ├── settings.local.yml
+ └── settings.yml
+
`Merge` function takes several arguments:
* `settings` A pointer to a structure that will project data from yaml.
* `path` Path where the configuration files.
* `env` Environment, for which the configuration is formed.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request | 8 | 0.266667 | 8 | 0 |
cf1e6ce337fe35b8db93bde6bae837ead2c8c0da | fish/config.fish | fish/config.fish | alias ll="exa -lg --group-directories-first"
alias csvcol="column -s, -t"
alias open-rust-doc="open /usr/share/doc/rust/html/index.html"
abbr --add g git
abbr --add v nvim
abbr --add tree "ll --tree"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
set -p PATH ~/.cargo/bin
set -a PATH ~/.local/bin
set -a PATH ~/.emacs.d/bin
set -a PATH ~/.ghcup/bin
set -a PATH ~/.cabal/bin
set -a PATH ~/Documents/go/bin
set -a PATH ~/.local/share/npm/bin
set -x GOPATH "$HOME/Documents/go"
set -x VISUAL /usr/bin/nvim
set -x EDITOR /usr/bin/nvim
set -x OSTYPE linux
eval (direnv hook fish)
| alias ll="exa -lg --group-directories-first"
alias csvcol="column -s, -t"
alias open-rust-doc="open /usr/share/doc/rust/html/index.html"
abbr --add g git
abbr --add v nvim
abbr --add tree "ll --tree"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
set -p PATH ~/.cargo/bin
set -a PATH ~/.local/bin
set -a PATH ~/.emacs.d/bin
set -a PATH ~/.ghcup/bin
set -a PATH ~/.cabal/bin
set -a PATH ~/Documents/go/bin
set -a PATH ~/.local/share/npm/bin
set -x GOPATH "$HOME/Documents/go"
set -x VISUAL /usr/bin/nvim
set -x EDITOR /usr/bin/nvim
set -x OSTYPE linux
eval (direnv hook fish)
function tmux-set-pane-title
if test -n $TMUX
printf "\033]2;%s\033\ \n" "$argv"
end
end
function ssh
tmux-set-pane-title "$argv"
command ssh $argv
tmux-set-pane-title (hostname)
end
| Set tmux pane title on ssh | [fish] Set tmux pane title on ssh
| fish | mit | mpardalos/dotfiles,mpardalos/dotfiles | fish | ## Code Before:
alias ll="exa -lg --group-directories-first"
alias csvcol="column -s, -t"
alias open-rust-doc="open /usr/share/doc/rust/html/index.html"
abbr --add g git
abbr --add v nvim
abbr --add tree "ll --tree"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
set -p PATH ~/.cargo/bin
set -a PATH ~/.local/bin
set -a PATH ~/.emacs.d/bin
set -a PATH ~/.ghcup/bin
set -a PATH ~/.cabal/bin
set -a PATH ~/Documents/go/bin
set -a PATH ~/.local/share/npm/bin
set -x GOPATH "$HOME/Documents/go"
set -x VISUAL /usr/bin/nvim
set -x EDITOR /usr/bin/nvim
set -x OSTYPE linux
eval (direnv hook fish)
## Instruction:
[fish] Set tmux pane title on ssh
## Code After:
alias ll="exa -lg --group-directories-first"
alias csvcol="column -s, -t"
alias open-rust-doc="open /usr/share/doc/rust/html/index.html"
abbr --add g git
abbr --add v nvim
abbr --add tree "ll --tree"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
set -p PATH ~/.cargo/bin
set -a PATH ~/.local/bin
set -a PATH ~/.emacs.d/bin
set -a PATH ~/.ghcup/bin
set -a PATH ~/.cabal/bin
set -a PATH ~/Documents/go/bin
set -a PATH ~/.local/share/npm/bin
set -x GOPATH "$HOME/Documents/go"
set -x VISUAL /usr/bin/nvim
set -x EDITOR /usr/bin/nvim
set -x OSTYPE linux
eval (direnv hook fish)
function tmux-set-pane-title
if test -n $TMUX
printf "\033]2;%s\033\ \n" "$argv"
end
end
function ssh
tmux-set-pane-title "$argv"
command ssh $argv
tmux-set-pane-title (hostname)
end
| alias ll="exa -lg --group-directories-first"
alias csvcol="column -s, -t"
alias open-rust-doc="open /usr/share/doc/rust/html/index.html"
abbr --add g git
abbr --add v nvim
abbr --add tree "ll --tree"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
set -p PATH ~/.cargo/bin
set -a PATH ~/.local/bin
set -a PATH ~/.emacs.d/bin
set -a PATH ~/.ghcup/bin
set -a PATH ~/.cabal/bin
set -a PATH ~/Documents/go/bin
set -a PATH ~/.local/share/npm/bin
set -x GOPATH "$HOME/Documents/go"
set -x VISUAL /usr/bin/nvim
set -x EDITOR /usr/bin/nvim
set -x OSTYPE linux
eval (direnv hook fish)
+
+ function tmux-set-pane-title
+ if test -n $TMUX
+ printf "\033]2;%s\033\ \n" "$argv"
+ end
+ end
+
+ function ssh
+ tmux-set-pane-title "$argv"
+ command ssh $argv
+ tmux-set-pane-title (hostname)
+ end | 12 | 0.461538 | 12 | 0 |
8dae4e93c79aad655381e97ef1faf9c9246a3199 | examples/README.md | examples/README.md |
* [Sample Grammars.](https://github.com/SAP/chevrotain/blob/master/examples/grammars)
* [Common Lexer issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/lexer)
* [Common Parser issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
* [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
These examples are used as integration tests and are tested on each and every commit/pull request.
Therefore they are **guaranteed** to be up to date and valid.
|
* [Sample Grammars.](https://github.com/SAP/chevrotain/blob/master/examples/grammars)
* [Common Lexer issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/lexer)
* [Common Parser issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
* [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/implementation_languages)
These examples are used as integration tests and are tested on each and every commit/pull request.
Therefore they are **guaranteed** to be up to date and valid.
| Fix invalid URLs in docs | Fix invalid URLs in docs | Markdown | apache-2.0 | SAP/chevrotain,SAP/chevrotain,SAP/chevrotain,SAP/chevrotain | markdown | ## Code Before:
* [Sample Grammars.](https://github.com/SAP/chevrotain/blob/master/examples/grammars)
* [Common Lexer issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/lexer)
* [Common Parser issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
* [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
These examples are used as integration tests and are tested on each and every commit/pull request.
Therefore they are **guaranteed** to be up to date and valid.
## Instruction:
Fix invalid URLs in docs
## Code After:
* [Sample Grammars.](https://github.com/SAP/chevrotain/blob/master/examples/grammars)
* [Common Lexer issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/lexer)
* [Common Parser issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
* [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/implementation_languages)
These examples are used as integration tests and are tested on each and every commit/pull request.
Therefore they are **guaranteed** to be up to date and valid.
|
* [Sample Grammars.](https://github.com/SAP/chevrotain/blob/master/examples/grammars)
* [Common Lexer issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/lexer)
* [Common Parser issues/scenarios and how to resolve them.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
- * [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/parser)
? ^ --
+ * [Implementing Chevrotain parsers using different JavaScript flavors and compile to JavaScript languages.](https://github.com/SAP/chevrotain/blob/master/examples/implementation_languages)
? ++ ++++++ ^^^^^^^^^^^^^
These examples are used as integration tests and are tested on each and every commit/pull request.
Therefore they are **guaranteed** to be up to date and valid. | 2 | 0.166667 | 1 | 1 |
42e6d587d8569c28858d2a9da1e649857200fc88 | system/src/Grav/Common/GPM/Local/Package.php | system/src/Grav/Common/GPM/Local/Package.php | <?php
namespace Grav\Common\GPM\Local;
use Grav\Common\Data\Data;
use Grav\Common\GPM\Common\Package as BasePackage;
class Package extends BasePackage
{
protected $settings;
public function __construct(Data $package, $package_type = null)
{
$data = new Data($package->blueprints()->toArray());
parent::__construct($data, $package_type);
$this->settings = $package->toArray();
$html_description = \Parsedown::instance()->line($this->description);
$this->data->set('slug', $this->name);
$this->data->set('description_html', $html_description);
$this->data->set('description_plain', strip_tags($html_description));
$this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name));
}
/**
* @return mixed
*/
public function isEnabled()
{
return $this->settings['enabled'];
}
}
| <?php
namespace Grav\Common\GPM\Local;
use Grav\Common\Data\Data;
use Grav\Common\GPM\Common\Package as BasePackage;
class Package extends BasePackage
{
protected $settings;
public function __construct(Data $package, $package_type = null)
{
$data = new Data($package->blueprints()->toArray());
parent::__construct($data, $package_type);
$this->settings = $package->toArray();
$html_description = \Parsedown::instance()->line($this->description);
$this->data->set('slug', strtolower($this->name));
$this->data->set('description_html', $html_description);
$this->data->set('description_plain', strip_tags($html_description));
$this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name));
}
/**
* @return mixed
*/
public function isEnabled()
{
return $this->settings['enabled'];
}
}
| Fix slug to be lowercase | Fix slug to be lowercase
| PHP | mit | jeremykenedy/grav,Pumpapa/chriswalters.nl,Vivalldi/grav,lennerd/grav,chkir/grav,webuxr/iamrs,beacloudgenius/grav,tcsizmadia/grav,nunull/grav,dimayakovlev/grav,Sommerregen/grav,tomzx/blog.tomrochette.com,getgrav/grav,jeffam/grav,tomzx/blog.tomrochette.com,notklaatu/grav,JamesPan/gravbox,sylvestrelucia/grav,gigago/grav,Pumpapa/jacinthawalters.nl,userfrosting/learn,userfrosting/learn,tomzx/blog.tomrochette.com,JamesPan/gravbox,notklaatu/grav,undesign/undesign.github.io,JamesPan/gravbox,toovy/grav,attiks/grav,Silwereth/grav,z3cka/grav,jinxboy13/grav,dimayakovlev/grav,getgrav/grav,shortsofia/testesitegrav.github.io,undesign/undesign.github.io,toovy/grav,Pumpapa/lucaswalters.nl,DonLiborio/grav,Vivalldi/grav,JamesPan/gravbox,joeyhenricks/a-broke-vegan,stell/grav,ccardinaux/grav-test,Pumpapa/lucaswalters.nl,joeyhenricks/a-broke-vegan,iMoonThailand/grav,userfrosting/learn,Pumpapa/lucaswalters.nl,sylvestrelucia/grav,sylvestrelucia/grav,tomzx/blog.tomrochette.com,TheHiddenHaku/alessiobottiroli-website-grav,userfrosting/learn,sylvestrelucia/grav | php | ## Code Before:
<?php
namespace Grav\Common\GPM\Local;
use Grav\Common\Data\Data;
use Grav\Common\GPM\Common\Package as BasePackage;
class Package extends BasePackage
{
protected $settings;
public function __construct(Data $package, $package_type = null)
{
$data = new Data($package->blueprints()->toArray());
parent::__construct($data, $package_type);
$this->settings = $package->toArray();
$html_description = \Parsedown::instance()->line($this->description);
$this->data->set('slug', $this->name);
$this->data->set('description_html', $html_description);
$this->data->set('description_plain', strip_tags($html_description));
$this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name));
}
/**
* @return mixed
*/
public function isEnabled()
{
return $this->settings['enabled'];
}
}
## Instruction:
Fix slug to be lowercase
## Code After:
<?php
namespace Grav\Common\GPM\Local;
use Grav\Common\Data\Data;
use Grav\Common\GPM\Common\Package as BasePackage;
class Package extends BasePackage
{
protected $settings;
public function __construct(Data $package, $package_type = null)
{
$data = new Data($package->blueprints()->toArray());
parent::__construct($data, $package_type);
$this->settings = $package->toArray();
$html_description = \Parsedown::instance()->line($this->description);
$this->data->set('slug', strtolower($this->name));
$this->data->set('description_html', $html_description);
$this->data->set('description_plain', strip_tags($html_description));
$this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name));
}
/**
* @return mixed
*/
public function isEnabled()
{
return $this->settings['enabled'];
}
}
| <?php
namespace Grav\Common\GPM\Local;
use Grav\Common\Data\Data;
use Grav\Common\GPM\Common\Package as BasePackage;
class Package extends BasePackage
{
protected $settings;
public function __construct(Data $package, $package_type = null)
{
$data = new Data($package->blueprints()->toArray());
parent::__construct($data, $package_type);
$this->settings = $package->toArray();
$html_description = \Parsedown::instance()->line($this->description);
- $this->data->set('slug', $this->name);
+ $this->data->set('slug', strtolower($this->name));
? +++++++++++ +
$this->data->set('description_html', $html_description);
$this->data->set('description_plain', strip_tags($html_description));
$this->data->set('symlink', is_link(USER_DIR . $package_type . DS . $this->name));
}
/**
* @return mixed
*/
public function isEnabled()
{
return $this->settings['enabled'];
}
} | 2 | 0.0625 | 1 | 1 |
9296a5f2f0730fe7378c9da4d191c4fd62ad3ef9 | app/controllers/class_enrollments_controller.rb | app/controllers/class_enrollments_controller.rb | class ClassEnrollmentsController < ApplicationController
active_scaffold :class_enrollment do |config|
config.list.sorting = {:enrollment => 'ASC'}
config.list.columns = [:enrollment, :situation, :grade, :attendance]
config.create.label = :create_class_enrollment_label
config.update.label = :update_class_enrollment_label
config.columns[:enrollment].clear_link
config.columns[:course_class].clear_link
config.columns[:enrollment].form_ui = :record_select
config.columns[:course_class].form_ui = :record_select
config.columns[:situation].form_ui = :select
config.columns[:situation].options = {:options => ClassEnrollment::SITUATIONS}
config.columns =
[:enrollment, :course_class, :situation, :grade, :attendance, :obs]
end
record_select :per_page => 10, :search_on => [:name], :order_by => 'name', :full_text_search => true
end | class ClassEnrollmentsController < ApplicationController
active_scaffold :class_enrollment do |config|
config.list.sorting = {:enrollment => 'ASC'}
config.list.columns = [:enrollment,:course_class, :situation, :grade, :attendance]
config.create.label = :create_class_enrollment_label
config.update.label = :update_class_enrollment_label
config.columns[:enrollment].clear_link
config.columns[:course_class].clear_link
config.columns[:enrollment].form_ui = :record_select
config.columns[:course_class].form_ui = :record_select
config.columns[:situation].form_ui = :select
config.columns[:situation].options = {:options => ClassEnrollment::SITUATIONS}
config.columns =
[:enrollment, :course_class, :situation, :grade, :attendance, :obs]
end
record_select :per_page => 10, :search_on => [:name], :order_by => 'name', :full_text_search => true
end | Add class to list view | Add class to list view
| Ruby | mit | tiagoamaro/sapos,tiagoamaro/sapos,tiagoamaro/sapos,gems-uff/sapos,gems-uff/sapos,gems-uff/sapos | ruby | ## Code Before:
class ClassEnrollmentsController < ApplicationController
active_scaffold :class_enrollment do |config|
config.list.sorting = {:enrollment => 'ASC'}
config.list.columns = [:enrollment, :situation, :grade, :attendance]
config.create.label = :create_class_enrollment_label
config.update.label = :update_class_enrollment_label
config.columns[:enrollment].clear_link
config.columns[:course_class].clear_link
config.columns[:enrollment].form_ui = :record_select
config.columns[:course_class].form_ui = :record_select
config.columns[:situation].form_ui = :select
config.columns[:situation].options = {:options => ClassEnrollment::SITUATIONS}
config.columns =
[:enrollment, :course_class, :situation, :grade, :attendance, :obs]
end
record_select :per_page => 10, :search_on => [:name], :order_by => 'name', :full_text_search => true
end
## Instruction:
Add class to list view
## Code After:
class ClassEnrollmentsController < ApplicationController
active_scaffold :class_enrollment do |config|
config.list.sorting = {:enrollment => 'ASC'}
config.list.columns = [:enrollment,:course_class, :situation, :grade, :attendance]
config.create.label = :create_class_enrollment_label
config.update.label = :update_class_enrollment_label
config.columns[:enrollment].clear_link
config.columns[:course_class].clear_link
config.columns[:enrollment].form_ui = :record_select
config.columns[:course_class].form_ui = :record_select
config.columns[:situation].form_ui = :select
config.columns[:situation].options = {:options => ClassEnrollment::SITUATIONS}
config.columns =
[:enrollment, :course_class, :situation, :grade, :attendance, :obs]
end
record_select :per_page => 10, :search_on => [:name], :order_by => 'name', :full_text_search => true
end | class ClassEnrollmentsController < ApplicationController
active_scaffold :class_enrollment do |config|
config.list.sorting = {:enrollment => 'ASC'}
- config.list.columns = [:enrollment, :situation, :grade, :attendance]
+ config.list.columns = [:enrollment,:course_class, :situation, :grade, :attendance]
? ++++++++++++++
config.create.label = :create_class_enrollment_label
config.update.label = :update_class_enrollment_label
config.columns[:enrollment].clear_link
config.columns[:course_class].clear_link
config.columns[:enrollment].form_ui = :record_select
config.columns[:course_class].form_ui = :record_select
config.columns[:situation].form_ui = :select
config.columns[:situation].options = {:options => ClassEnrollment::SITUATIONS}
config.columns =
[:enrollment, :course_class, :situation, :grade, :attendance, :obs]
end
record_select :per_page => 10, :search_on => [:name], :order_by => 'name', :full_text_search => true
end | 2 | 0.1 | 1 | 1 |
895e6f4a5a574466bf517b998ac15d2cce4e541c | test/lib/rails_sso/failure_app_test.rb | test/lib/rails_sso/failure_app_test.rb | require 'test_helper'
class RailsSso::FailureAppTest < ActiveSupport::TestCase
test "regular call runs respond action and redirects to sso" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 302, response.first
assert_equal 'http://test.host/sso/', response.second['Location']
end
test "json call runs respond action and renders 401" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host',
'CONTENT_TYPE' => 'application/json'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 401, response.first
end
end
| require 'test_helper'
class RailsSso::FailureAppTest < ActiveSupport::TestCase
test "regular call runs respond action and redirects to sso" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 302, response.first
assert_equal 'http://test.host/sso/', response.second['Location']
end
test "json call runs respond action and renders 401" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host',
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 401, response.first
end
end
| Adjust test to xhr? in failure app | [fix] Adjust test to xhr? in failure app
| Ruby | mit | monterail/rails_sso,monterail/rails_sso,monterail/rails_sso | ruby | ## Code Before:
require 'test_helper'
class RailsSso::FailureAppTest < ActiveSupport::TestCase
test "regular call runs respond action and redirects to sso" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 302, response.first
assert_equal 'http://test.host/sso/', response.second['Location']
end
test "json call runs respond action and renders 401" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host',
'CONTENT_TYPE' => 'application/json'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 401, response.first
end
end
## Instruction:
[fix] Adjust test to xhr? in failure app
## Code After:
require 'test_helper'
class RailsSso::FailureAppTest < ActiveSupport::TestCase
test "regular call runs respond action and redirects to sso" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 302, response.first
assert_equal 'http://test.host/sso/', response.second['Location']
end
test "json call runs respond action and renders 401" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host',
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 401, response.first
end
end
| require 'test_helper'
class RailsSso::FailureAppTest < ActiveSupport::TestCase
test "regular call runs respond action and redirects to sso" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 302, response.first
assert_equal 'http://test.host/sso/', response.second['Location']
end
test "json call runs respond action and renders 401" do
env = {
'REQUEST_URI' => 'http://test.host',
'HTTP_HOST' => 'test.host',
- 'CONTENT_TYPE' => 'application/json'
+ 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
}
response = RailsSso::FailureApp.call(env).to_a
assert_equal 401, response.first
end
end | 2 | 0.08 | 1 | 1 |
873cbb7550075b9bc281f8875f1ac2089a28d4b5 | README.md | README.md |
[](http://badge.fury.io/js/uid2)
Generate unique ids. Pass in a `length` and it returns a `string`.
## Installation
npm install uid2
## Examples
Without a callback it is synchronous:
```js
uid(10)
// => "hbswt489ts"
```
With a callback it is asynchronous:
```js
uid(10, function (err, id) {
if (err) throw err;
// id => "hbswt489ts"
});
```
## License
MIT
|
[](http://badge.fury.io/js/uid2)
Generate unique ids. Pass in a `length` and it returns a `string`.
## Installation
npm install uid2
## Examples
Without a callback it is synchronous:
```js
const uid = require('uid2');
const id = uid(10);
// id => "hbswt489ts"
```
With a callback it is asynchronous:
```js
const uid = require('uid2');
uid(10, function (err, id) {
if (err) throw err;
// id => "hbswt489ts"
});
```
Imported via `uid2/promises` it returns a `Promise`:
```js
const uid = require('uid2/promises');
async function foo() {
const id = await uid(10);
// id => "hbswt489ts"
}
```
## License
MIT
| Update docs with Promise support, minor tweaks | Update docs with Promise support, minor tweaks
| Markdown | mit | coreh/uid2 | markdown | ## Code Before:
[](http://badge.fury.io/js/uid2)
Generate unique ids. Pass in a `length` and it returns a `string`.
## Installation
npm install uid2
## Examples
Without a callback it is synchronous:
```js
uid(10)
// => "hbswt489ts"
```
With a callback it is asynchronous:
```js
uid(10, function (err, id) {
if (err) throw err;
// id => "hbswt489ts"
});
```
## License
MIT
## Instruction:
Update docs with Promise support, minor tweaks
## Code After:
[](http://badge.fury.io/js/uid2)
Generate unique ids. Pass in a `length` and it returns a `string`.
## Installation
npm install uid2
## Examples
Without a callback it is synchronous:
```js
const uid = require('uid2');
const id = uid(10);
// id => "hbswt489ts"
```
With a callback it is asynchronous:
```js
const uid = require('uid2');
uid(10, function (err, id) {
if (err) throw err;
// id => "hbswt489ts"
});
```
Imported via `uid2/promises` it returns a `Promise`:
```js
const uid = require('uid2/promises');
async function foo() {
const id = await uid(10);
// id => "hbswt489ts"
}
```
## License
MIT
|
[](http://badge.fury.io/js/uid2)
Generate unique ids. Pass in a `length` and it returns a `string`.
## Installation
npm install uid2
## Examples
Without a callback it is synchronous:
```js
- uid(10)
+ const uid = require('uid2');
+
+ const id = uid(10);
- // => "hbswt489ts"
+ // id => "hbswt489ts"
? +++
```
With a callback it is asynchronous:
```js
+ const uid = require('uid2');
+
uid(10, function (err, id) {
if (err) throw err;
// id => "hbswt489ts"
});
```
+ Imported via `uid2/promises` it returns a `Promise`:
+
+ ```js
+ const uid = require('uid2/promises');
+
+ async function foo() {
+ const id = await uid(10);
+ // id => "hbswt489ts"
+ }
+ ```
+
## License
MIT | 19 | 0.612903 | 17 | 2 |
2fef6d417fdb50a213d32d7ffbb511e1b92a8050 | README.md | README.md | White skin for Rainmeter
|
White skin for Rainmeter.
License: [MIT](https://github.com/Harrix/Harrix-Rainmeter-Skin/blob/master/LICENSE.md). | Add license in markdown format | Add license in markdown format
| Markdown | mit | Harrix/Harrix-Rainmeter-Skin,Harrix/Harrix-Rainmeter-Skin,Harrix/Harrix-Rainmeter-Skin | markdown | ## Code Before:
White skin for Rainmeter
## Instruction:
Add license in markdown format
## Code After:
White skin for Rainmeter.
License: [MIT](https://github.com/Harrix/Harrix-Rainmeter-Skin/blob/master/LICENSE.md). | +
- White skin for Rainmeter
+ White skin for Rainmeter.
? +
+
+ License: [MIT](https://github.com/Harrix/Harrix-Rainmeter-Skin/blob/master/LICENSE.md). | 5 | 5 | 4 | 1 |
ccb021e4f672b02d63236207573cc5f7746012e2 | apps/uploads/management/commands/process_uploads.py | apps/uploads/management/commands/process_uploads.py |
import logging
LOGGER = logging.getLogger('apps.uploads')
from django.core.management.base import BaseCommand, CommandError
from apps.uploads.models import DropboxUploadFile, ManualUploadFile
class Command(BaseCommand):
help = """Regular run of new dropbox links:
manage.py process_uploads
"""
def handle(self, **options):
for cls in [DropboxUploadFile, ManualUploadFile]:
for d_file in cls.objects.filter(retrieval_start__isnull=True):
print " + Downloading: %s" % d_file.url
d_file.download_now()
if d_file.retrieval_error:
print " ! Error downloading"
| """Download from urls any uploads from outside sources"""
import logging
from django.utils.timezone import now
from django.core.management.base import BaseCommand, CommandError
from apps.uploads.models import DropboxUploadFile, ManualUploadFile, ResumableUploadFile
LOGGER = logging.getLogger('apps.uploads')
class Command(BaseCommand):
"""Run command for uploads"""
help = __doc__ + """:
manage.py process_uploads
"""
@staticmethod
def handle(**_):
"""Handle script call"""
for cls in (DropboxUploadFile, ManualUploadFile):
for d_file in cls.objects.filter(retrieval_start__isnull=True):
print " + Downloading: %s" % d_file.url
d_file.download_now()
if d_file.retrieval_error:
print " ! Error downloading"
count = ResumableUploadFile.objects.filter(retrieval_start__isnull=True).update(
retrieval_error='Retry resumable upload, can not happen in server.',
retrieval_start=now(),
)
if count:
print(" * Resumable uploads marked as impossible: {}".format(count))
| Mark resuable uploads as broken if they are | Mark resuable uploads as broken if they are
| Python | agpl-3.0 | IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site | python | ## Code Before:
import logging
LOGGER = logging.getLogger('apps.uploads')
from django.core.management.base import BaseCommand, CommandError
from apps.uploads.models import DropboxUploadFile, ManualUploadFile
class Command(BaseCommand):
help = """Regular run of new dropbox links:
manage.py process_uploads
"""
def handle(self, **options):
for cls in [DropboxUploadFile, ManualUploadFile]:
for d_file in cls.objects.filter(retrieval_start__isnull=True):
print " + Downloading: %s" % d_file.url
d_file.download_now()
if d_file.retrieval_error:
print " ! Error downloading"
## Instruction:
Mark resuable uploads as broken if they are
## Code After:
"""Download from urls any uploads from outside sources"""
import logging
from django.utils.timezone import now
from django.core.management.base import BaseCommand, CommandError
from apps.uploads.models import DropboxUploadFile, ManualUploadFile, ResumableUploadFile
LOGGER = logging.getLogger('apps.uploads')
class Command(BaseCommand):
"""Run command for uploads"""
help = __doc__ + """:
manage.py process_uploads
"""
@staticmethod
def handle(**_):
"""Handle script call"""
for cls in (DropboxUploadFile, ManualUploadFile):
for d_file in cls.objects.filter(retrieval_start__isnull=True):
print " + Downloading: %s" % d_file.url
d_file.download_now()
if d_file.retrieval_error:
print " ! Error downloading"
count = ResumableUploadFile.objects.filter(retrieval_start__isnull=True).update(
retrieval_error='Retry resumable upload, can not happen in server.',
retrieval_start=now(),
)
if count:
print(" * Resumable uploads marked as impossible: {}".format(count))
| + """Download from urls any uploads from outside sources"""
+ import logging
- import logging
+ from django.utils.timezone import now
+ from django.core.management.base import BaseCommand, CommandError
+ from apps.uploads.models import DropboxUploadFile, ManualUploadFile, ResumableUploadFile
+
LOGGER = logging.getLogger('apps.uploads')
- from django.core.management.base import BaseCommand, CommandError
- from apps.uploads.models import DropboxUploadFile, ManualUploadFile
-
class Command(BaseCommand):
- help = """Regular run of new dropbox links:
+ """Run command for uploads"""
+ help = __doc__ + """:
manage.py process_uploads
"""
- def handle(self, **options):
+ @staticmethod
+ def handle(**_):
+ """Handle script call"""
- for cls in [DropboxUploadFile, ManualUploadFile]:
? ^ ^
+ for cls in (DropboxUploadFile, ManualUploadFile):
? ^ ^
for d_file in cls.objects.filter(retrieval_start__isnull=True):
print " + Downloading: %s" % d_file.url
d_file.download_now()
if d_file.retrieval_error:
print " ! Error downloading"
-
+ count = ResumableUploadFile.objects.filter(retrieval_start__isnull=True).update(
+ retrieval_error='Retry resumable upload, can not happen in server.',
+ retrieval_start=now(),
+ )
+ if count:
+ print(" * Resumable uploads marked as impossible: {}".format(count)) | 26 | 1.238095 | 18 | 8 |
aadb5a7cfeb4c662d7a38ca56c8caccb6352d6ed | src/main/java/client/command/Commands.java | src/main/java/client/command/Commands.java | package client.command;
public enum Commands {
Username(new String[]{"/username", "/name", "/u"}, Username.class),
Team(new String[]{"/team", "/t"}, Team.class),
Contract(new String[]{"/contract"}, Contract.class),
Create(new String[]{"/create", "/c"}, Create.class),
Join(new String[]{"/join", "/j"}, Join.class),
ListPlayers(new String[]{"/list-players"}, ListPlayers.class),
ListChannel(new String[]{"/list-channel"}, ListChannel.class),
Leave(new String[]{"/leave", "/l"}, Leave.class),
ShowCards(new String[]{"/show-cards"}, ShowCards.class),
ShowTable(new String[]{"/show-table"}, ShowTable.class),
PlayCard(new String[]{"/play"}, PlayCard.class),
ShowContract(new String[]{"/show-contract"}, ShowContract.class);
private String[] aliases;
private Class command;
Commands(String[] aliases, Class command) {
this.aliases = aliases;
this.command = command;
}
public static Class from(String text) throws Exception {
for (Commands command : Commands.values()) {
for (String alias : command.getAliases()) {
if (text.startsWith(alias + ' ')) {
return command.getCommand();
}
}
}
throw new Exception();
}
public String[] getAliases() {
return this.aliases;
}
public Class getCommand() {
return this.command;
}
}
| package client.command;
public enum Commands {
Username(new String[]{"/username", "/name", "/u", "/n"}, Username.class),
Team(new String[]{"/team", "/t"}, Team.class),
Contract(new String[]{"/put-contract", "/contract"}, Contract.class),
Create(new String[]{"/create", "/c"}, Create.class),
Join(new String[]{"/join", "/j"}, Join.class),
ListPlayers(new String[]{"/list-players", "/players"}, ListPlayers.class),
ListChannel(new String[]{"/list-channels", "/channels"}, ListChannel.class),
Leave(new String[]{"/leave", "/l"}, Leave.class),
ShowCards(new String[]{"/show-cards", "/cards"}, ShowCards.class),
ShowTable(new String[]{"/show-table", "/table"}, ShowTable.class),
PlayCard(new String[]{"/play", "/p"}, PlayCard.class),
ShowContract(new String[]{"/show-contract"}, ShowContract.class);
private String[] aliases;
private Class command;
Commands(String[] aliases, Class command) {
this.aliases = aliases;
this.command = command;
}
public static Class from(String text) throws Exception {
for (Commands command : Commands.values()) {
for (String alias : command.getAliases()) {
if (text.split("\\s+")[0].equals(alias)) {
return command.getCommand();
}
}
}
throw new Exception();
}
public String[] getAliases() {
return this.aliases;
}
public Class getCommand() {
return this.command;
}
}
| Fix a bug when a command like "/list-players" is miss-spelled and "/leave" is executed cause of its alias "/l". And add some aliases. | Fix a bug when a command like "/list-players" is miss-spelled and "/leave" is executed cause of its alias "/l". And add some aliases.
| Java | unlicense | scorsi/epitech-jcoinche | java | ## Code Before:
package client.command;
public enum Commands {
Username(new String[]{"/username", "/name", "/u"}, Username.class),
Team(new String[]{"/team", "/t"}, Team.class),
Contract(new String[]{"/contract"}, Contract.class),
Create(new String[]{"/create", "/c"}, Create.class),
Join(new String[]{"/join", "/j"}, Join.class),
ListPlayers(new String[]{"/list-players"}, ListPlayers.class),
ListChannel(new String[]{"/list-channel"}, ListChannel.class),
Leave(new String[]{"/leave", "/l"}, Leave.class),
ShowCards(new String[]{"/show-cards"}, ShowCards.class),
ShowTable(new String[]{"/show-table"}, ShowTable.class),
PlayCard(new String[]{"/play"}, PlayCard.class),
ShowContract(new String[]{"/show-contract"}, ShowContract.class);
private String[] aliases;
private Class command;
Commands(String[] aliases, Class command) {
this.aliases = aliases;
this.command = command;
}
public static Class from(String text) throws Exception {
for (Commands command : Commands.values()) {
for (String alias : command.getAliases()) {
if (text.startsWith(alias + ' ')) {
return command.getCommand();
}
}
}
throw new Exception();
}
public String[] getAliases() {
return this.aliases;
}
public Class getCommand() {
return this.command;
}
}
## Instruction:
Fix a bug when a command like "/list-players" is miss-spelled and "/leave" is executed cause of its alias "/l". And add some aliases.
## Code After:
package client.command;
public enum Commands {
Username(new String[]{"/username", "/name", "/u", "/n"}, Username.class),
Team(new String[]{"/team", "/t"}, Team.class),
Contract(new String[]{"/put-contract", "/contract"}, Contract.class),
Create(new String[]{"/create", "/c"}, Create.class),
Join(new String[]{"/join", "/j"}, Join.class),
ListPlayers(new String[]{"/list-players", "/players"}, ListPlayers.class),
ListChannel(new String[]{"/list-channels", "/channels"}, ListChannel.class),
Leave(new String[]{"/leave", "/l"}, Leave.class),
ShowCards(new String[]{"/show-cards", "/cards"}, ShowCards.class),
ShowTable(new String[]{"/show-table", "/table"}, ShowTable.class),
PlayCard(new String[]{"/play", "/p"}, PlayCard.class),
ShowContract(new String[]{"/show-contract"}, ShowContract.class);
private String[] aliases;
private Class command;
Commands(String[] aliases, Class command) {
this.aliases = aliases;
this.command = command;
}
public static Class from(String text) throws Exception {
for (Commands command : Commands.values()) {
for (String alias : command.getAliases()) {
if (text.split("\\s+")[0].equals(alias)) {
return command.getCommand();
}
}
}
throw new Exception();
}
public String[] getAliases() {
return this.aliases;
}
public Class getCommand() {
return this.command;
}
}
| package client.command;
public enum Commands {
- Username(new String[]{"/username", "/name", "/u"}, Username.class),
+ Username(new String[]{"/username", "/name", "/u", "/n"}, Username.class),
? ++++++
Team(new String[]{"/team", "/t"}, Team.class),
- Contract(new String[]{"/contract"}, Contract.class),
+ Contract(new String[]{"/put-contract", "/contract"}, Contract.class),
? +++++++++++++++++
Create(new String[]{"/create", "/c"}, Create.class),
Join(new String[]{"/join", "/j"}, Join.class),
- ListPlayers(new String[]{"/list-players"}, ListPlayers.class),
+ ListPlayers(new String[]{"/list-players", "/players"}, ListPlayers.class),
? ++++++++++++
- ListChannel(new String[]{"/list-channel"}, ListChannel.class),
+ ListChannel(new String[]{"/list-channels", "/channels"}, ListChannel.class),
? ++++++++++++++
Leave(new String[]{"/leave", "/l"}, Leave.class),
- ShowCards(new String[]{"/show-cards"}, ShowCards.class),
+ ShowCards(new String[]{"/show-cards", "/cards"}, ShowCards.class),
? ++++++++++
- ShowTable(new String[]{"/show-table"}, ShowTable.class),
+ ShowTable(new String[]{"/show-table", "/table"}, ShowTable.class),
? ++++++++++
- PlayCard(new String[]{"/play"}, PlayCard.class),
+ PlayCard(new String[]{"/play", "/p"}, PlayCard.class),
? ++++++
ShowContract(new String[]{"/show-contract"}, ShowContract.class);
private String[] aliases;
private Class command;
Commands(String[] aliases, Class command) {
this.aliases = aliases;
this.command = command;
}
public static Class from(String text) throws Exception {
for (Commands command : Commands.values()) {
for (String alias : command.getAliases()) {
- if (text.startsWith(alias + ' ')) {
+ if (text.split("\\s+")[0].equals(alias)) {
return command.getCommand();
}
}
}
throw new Exception();
}
public String[] getAliases() {
return this.aliases;
}
public Class getCommand() {
return this.command;
}
} | 16 | 0.347826 | 8 | 8 |
66ce2e75ea131ad486e0123ba53decfda12041a7 | app/controllers/audiences_controller.rb | app/controllers/audiences_controller.rb | class AudiencesController < ApplicationController
def show
@guides = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
render :json => @guides.collect do |g|
{
:title => g.title,
:tags => g.tags,
:url => admin_guide_url(g)
}
end
end
end
| class AudiencesController < ApplicationController
def show
publications = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
details = publications.to_a.collect do |g|
{
:title => g.title,
:tags => g.container.tags,
:url => guide_url(:id => g.container.slug, :format => :json)
}
end
render :json => details
end
end
| Extend audiences API code to better include transactions | Extend audiences API code to better include transactions
| Ruby | mit | alphagov/publisher,leftees/publisher,telekomatrix/publisher,alphagov/publisher,telekomatrix/publisher,theodi/publisher,telekomatrix/publisher,theodi/publisher,theodi/publisher,theodi/publisher,alphagov/publisher,leftees/publisher,leftees/publisher,telekomatrix/publisher,leftees/publisher | ruby | ## Code Before:
class AudiencesController < ApplicationController
def show
@guides = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
render :json => @guides.collect do |g|
{
:title => g.title,
:tags => g.tags,
:url => admin_guide_url(g)
}
end
end
end
## Instruction:
Extend audiences API code to better include transactions
## Code After:
class AudiencesController < ApplicationController
def show
publications = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
details = publications.to_a.collect do |g|
{
:title => g.title,
:tags => g.container.tags,
:url => guide_url(:id => g.container.slug, :format => :json)
}
end
render :json => details
end
end
| class AudiencesController < ApplicationController
def show
- @guides = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
? ^^ ^^
+ publications = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
? ^ ++ ^^^^^^
- render :json => @guides.collect do |g|
+ details = publications.to_a.collect do |g|
{
:title => g.title,
- :tags => g.tags,
+ :tags => g.container.tags,
? ++++++++++
- :url => admin_guide_url(g)
+ :url => guide_url(:id => g.container.slug, :format => :json)
}
end
+
+ render :json => details
end
end | 10 | 0.833333 | 6 | 4 |
d42f27d2745e198ff4bd8c6ad73134e6e340dfc1 | Resources/views/Layouts/default.html.twig | Resources/views/Layouts/default.html.twig | {% extends '::base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/koalacontent/css/main.css')}}" type="text/css" media="screen" title="no title" charset="utf-8"/>
{% endblock %}
{% block body %}
<div id="wrapper">
{% block menu %}<nav id="menu">{{knp_menu_render(menu.main_menu)}}</nav>{% endblock %}
{% block content %}
<div id="main">
{{mercury_editable('content')}}
</div>
{% endblock %}
</div>
{% endblock %}
| {% extends '::base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/koalacontent/css/main.css')}}" type="text/css" media="screen" title="no title" charset="utf-8"/>
{% endblock %}
{% block body %}
<div id="wrapper">
{% block menu %}<nav id="menu">{{knp_menu_render(menu.main_menu)}}</nav>{% endblock %}
{% block content %}
<div id="main">
{{mercury_full('content')}}
</div>
{% endblock %}
</div>
{% endblock %}
{% block javascripts %}
<script src="{{asset('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
{% endblock %} | Fix default template for new version of Mercury | Fix default template for new version of Mercury
| Twig | mit | flojon/KoalaContentBundle,flojon/KoalaContentBundle,flojon/KoalaContentBundle | twig | ## Code Before:
{% extends '::base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/koalacontent/css/main.css')}}" type="text/css" media="screen" title="no title" charset="utf-8"/>
{% endblock %}
{% block body %}
<div id="wrapper">
{% block menu %}<nav id="menu">{{knp_menu_render(menu.main_menu)}}</nav>{% endblock %}
{% block content %}
<div id="main">
{{mercury_editable('content')}}
</div>
{% endblock %}
</div>
{% endblock %}
## Instruction:
Fix default template for new version of Mercury
## Code After:
{% extends '::base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/koalacontent/css/main.css')}}" type="text/css" media="screen" title="no title" charset="utf-8"/>
{% endblock %}
{% block body %}
<div id="wrapper">
{% block menu %}<nav id="menu">{{knp_menu_render(menu.main_menu)}}</nav>{% endblock %}
{% block content %}
<div id="main">
{{mercury_full('content')}}
</div>
{% endblock %}
</div>
{% endblock %}
{% block javascripts %}
<script src="{{asset('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
{% endblock %} | {% extends '::base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{asset('bundles/koalacontent/css/main.css')}}" type="text/css" media="screen" title="no title" charset="utf-8"/>
{% endblock %}
{% block body %}
<div id="wrapper">
{% block menu %}<nav id="menu">{{knp_menu_render(menu.main_menu)}}</nav>{% endblock %}
{% block content %}
<div id="main">
- {{mercury_editable('content')}}
? ^^^^^^ ^
+ {{mercury_full('content')}}
? ^^ ^
</div>
{% endblock %}
</div>
{% endblock %}
+
+ {% block javascripts %}
+ <script src="{{asset('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
+ {% endblock %} | 6 | 0.375 | 5 | 1 |
9c79f9f7b9348a643f5ddefff01892dc55344dd1 | src/Cerad/Bundle/AppBundle/Resources/views/CeradPerson/Project/PersonPersons/Show/PersonPersonsShowTwigHelp.html.twig | src/Cerad/Bundle/AppBundle/Resources/views/CeradPerson/Project/PersonPersons/Show/PersonPersonsShowTwigHelp.html.twig | <div class="app_table" id="notes">
<table class="app_help">
<thead>
<th>Notes on Adding a Person to Your Crew</th>
</thead>
<tbody>
<tr>
<td width="15%">
<ul>
<li>Adding a person to your crew allows you to sign them up for games.</li>
<li>The person must have already created an account on ZAYSO.</li>
<li>You must enter the person's full name exactly as it appears in ZAYSO. Ask your teammates their full name as it is in ZAYSO</li>
<li>Use Family for family members, Peer for others.</li>
<li><strong>Please make sure the person knows you will be assigning their games.</strong></li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
| <div class="app_table" id="notes">
<table class="app_help">
<thead>
<th>Notes on Adding a Person to Your Crew</th>
</thead>
<tbody>
<tr>
<td width="15%">
<ul>
<li>Adding a person to your crew allows you to sign them up for games.</li>
<li>The person must have already created an account on ZAYSO.</li>
<li>For a bit of security, you need to know the person's 8 digit AYSO ID.</li>
<li>Use Family for family members, Peer for others.</li>
<li><strong>Please make sure the person knows you will be assigning their games.</strong></li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
| Add Person now uses aysoid instead of name. | Add Person now uses aysoid instead of name. | Twig | mit | cerad/aysonatgames,cerad/aysonatgames,cerad/aysonatgames | twig | ## Code Before:
<div class="app_table" id="notes">
<table class="app_help">
<thead>
<th>Notes on Adding a Person to Your Crew</th>
</thead>
<tbody>
<tr>
<td width="15%">
<ul>
<li>Adding a person to your crew allows you to sign them up for games.</li>
<li>The person must have already created an account on ZAYSO.</li>
<li>You must enter the person's full name exactly as it appears in ZAYSO. Ask your teammates their full name as it is in ZAYSO</li>
<li>Use Family for family members, Peer for others.</li>
<li><strong>Please make sure the person knows you will be assigning their games.</strong></li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
## Instruction:
Add Person now uses aysoid instead of name.
## Code After:
<div class="app_table" id="notes">
<table class="app_help">
<thead>
<th>Notes on Adding a Person to Your Crew</th>
</thead>
<tbody>
<tr>
<td width="15%">
<ul>
<li>Adding a person to your crew allows you to sign them up for games.</li>
<li>The person must have already created an account on ZAYSO.</li>
<li>For a bit of security, you need to know the person's 8 digit AYSO ID.</li>
<li>Use Family for family members, Peer for others.</li>
<li><strong>Please make sure the person knows you will be assigning their games.</strong></li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
| <div class="app_table" id="notes">
<table class="app_help">
<thead>
<th>Notes on Adding a Person to Your Crew</th>
</thead>
<tbody>
<tr>
<td width="15%">
<ul>
<li>Adding a person to your crew allows you to sign them up for games.</li>
<li>The person must have already created an account on ZAYSO.</li>
- <li>You must enter the person's full name exactly as it appears in ZAYSO. Ask your teammates their full name as it is in ZAYSO</li>
+ <li>For a bit of security, you need to know the person's 8 digit AYSO ID.</li>
<li>Use Family for family members, Peer for others.</li>
<li><strong>Please make sure the person knows you will be assigning their games.</strong></li>
</ul>
</td>
</tr>
</tbody>
</table>
</div> | 2 | 0.1 | 1 | 1 |
e872d08c87d75b2fc474567595890741cff93d36 | config/demo.json | config/demo.json | {
"app": {
"format": "csv",
"write_to_file": false
},
"index": {
"default": {
"id": "<RECORDING_ID>",
"auth": {
"username": "<USERNNAME>",
"api_key": "<API_KEY>"
}
}
},
"analysis": {
"freqDist": [
{
"target": "fb.parent.author.gender"
}
],
"timeSeries": [
{
"interval": "day"
}
]
}
} | {
"app": {
"format": "csv",
"write_to_file": false
},
"index": {
"default": {
"id": "<RECORDING_ID>",
"auth": {
"username": "<USERNNAME>",
"api_key": "<API_KEY>"
}
}
},
"analysis": {
"freqDist": [
{
"target": "fb.parent.author.gender"
}
],
"timeSeries": [
{
"interval": "day"
}
]
}
} | Use json as default config example. | Use json as default config example.
| JSON | mit | haganbt/pepp,haganbt/pepp | json | ## Code Before:
{
"app": {
"format": "csv",
"write_to_file": false
},
"index": {
"default": {
"id": "<RECORDING_ID>",
"auth": {
"username": "<USERNNAME>",
"api_key": "<API_KEY>"
}
}
},
"analysis": {
"freqDist": [
{
"target": "fb.parent.author.gender"
}
],
"timeSeries": [
{
"interval": "day"
}
]
}
}
## Instruction:
Use json as default config example.
## Code After:
{
"app": {
"format": "csv",
"write_to_file": false
},
"index": {
"default": {
"id": "<RECORDING_ID>",
"auth": {
"username": "<USERNNAME>",
"api_key": "<API_KEY>"
}
}
},
"analysis": {
"freqDist": [
{
"target": "fb.parent.author.gender"
}
],
"timeSeries": [
{
"interval": "day"
}
]
}
} | {
- "app": {
? --
+ "app": {
- "format": "csv",
? ----
+ "format": "csv",
- "write_to_file": false
? ----
+ "write_to_file": false
- },
? --
+ },
- "index": {
? --
+ "index": {
- "default": {
? ----
+ "default": {
- "id": "<RECORDING_ID>",
? ------
+ "id": "<RECORDING_ID>",
- "auth": {
? ------
+ "auth": {
- "username": "<USERNNAME>",
? --------
+ "username": "<USERNNAME>",
- "api_key": "<API_KEY>"
? --------
+ "api_key": "<API_KEY>"
- }
- }
? --
+ }
- },
? -
+ }
+ },
- "analysis": {
? --
+ "analysis": {
- "freqDist": [
? ----
+ "freqDist": [
- {
+ {
- "target": "fb.parent.author.gender"
? --------
+ "target": "fb.parent.author.gender"
- }
+ }
- ],
? ----
+ ],
- "timeSeries": [
? ----
+ "timeSeries": [
- {
+ {
- "interval": "day"
? --------
+ "interval": "day"
- }
+ }
- ]
- }
? ^
+ ]
? ^
+ }
} | 50 | 1.612903 | 25 | 25 |
a311bd567177e3188a6b87dd1cc947f43cfd40f4 | remoting/webapp/me2mom/manifest.json | remoting/webapp/me2mom/manifest.json | {
"name": "__MSG_PRODUCT_NAME__ BETA",
"version": "1.2.UNIQUE_VERSION",
"description": "__MSG_PRODUCT_DESCRIPTION__",
"default_locale": "en",
"app": {
"launch": {
"local_path": "choice.html"
}
},
"icons": {
"128": "chromoting128.png",
"48": "chromoting48.png",
"16": "chromoting16.png"
},
"content_scripts": [
{
"matches": [
"https://talkgadget.google.com/talkgadget/blank",
"https://talkgadget.google.com/talkgadget/blank?*"
],
"js": [ "cs_oauth2_trampoline.js" ]
}
],
"permissions": [
"tabs",
"https://accounts.google.com/o/oauth2/*",
"https://www.google.com/accounts/*",
"https://www.googleapis.com/chromoting/*",
"https://talkgadget.google.com/talkgadget/*"
],
"plugins": [
{ "path": "remoting_host_plugin.dll", "public": false },
{ "path": "libremoting_host_plugin.ia32.so", "public": false },
{ "path": "libremoting_host_plugin.x64.so", "public": false },
{ "path": "remoting_host_plugin.plugin", "public": false }
]
}
| {
"name": "__MSG_PRODUCT_NAME__ BETA",
"version": "1.2.UNIQUE_VERSION",
"description": "__MSG_PRODUCT_DESCRIPTION__",
"default_locale": "en",
"app": {
"launch": {
"local_path": "choice.html"
}
},
"icons": {
"128": "chromoting128.png",
"48": "chromoting48.png",
"16": "chromoting16.png"
},
"content_scripts": [
{
"matches": [
"https://talkgadget.google.com/talkgadget/blank",
"https://talkgadget.google.com/talkgadget/blank?*"
],
"js": [ "cs_oauth2_trampoline.js" ]
}
],
"permissions": [
"https://accounts.google.com/o/oauth2/*",
"https://www.google.com/accounts/*",
"https://www.googleapis.com/chromoting/*",
"https://talkgadget.google.com/talkgadget/*"
],
"plugins": [
{ "path": "remoting_host_plugin.dll", "public": false },
{ "path": "libremoting_host_plugin.ia32.so", "public": false },
{ "path": "libremoting_host_plugin.x64.so", "public": false },
{ "path": "remoting_host_plugin.plugin", "public": false }
]
}
| Remove tabs permission for the webapp. | Remove tabs permission for the webapp.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8120012
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@103808 0039d316-1c4b-4281-b951-d872f2087c98
| JSON | bsd-3-clause | Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,fujunwei/chromium-crosswalk,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,mogoweb/chromium-crosswalk,anirudhSK/chromium,rogerwang/chromium,krieger-od/nwjs_chromium.src,ChromiumWebApps/chromium,axinging/chromium-crosswalk,ltilve/chromium,keishi/chromium,dednal/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,robclark/chromium,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,robclark/chromium,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,zcbenz/cefode-chromium,dushu1203/chromium.src,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,junmin-zhu/chromium-rivertrail,axinging/chromium-crosswalk,Chilledheart/chromium,TheTypoMaster/chromium-crosswalk,ltilve/chromium,Jonekee/chromium.src,Just-D/chromium-1,bright-sparks/chromium-spacewalk,M4sse/chromium.src,jaruba/chromium.src,Fireblend/chromium-crosswalk,keishi/chromium,timopulkkinen/BubbleFish,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,zcbenz/cefode-chromium,M4sse/chromium.src,hgl888/chromium-crosswalk,timopulkkinen/BubbleFish,fujunwei/chromium-crosswalk,patrickm/chromium.src,axinging/chromium-crosswalk,junmin-zhu/chromium-rivertrail,rogerwang/chromium,M4sse/chromium.src,markYoungH/chromium.src,axinging/chromium-crosswalk,markYoungH/chromium.src,chuan9/chromium-crosswalk,dednal/chromium.src,bright-sparks/chromium-spacewalk,PeterWangIntel/chromium-crosswalk,dushu1203/chromium.src,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Chilledheart/chromium,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,zcbenz/cefode-chromium,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,keishi/chromium,krieger-od/nwjs_chromium.src,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,Just-D/chromium-1,M4sse/chromium.src,Fireblend/chromium-crosswalk,littlstar/chromium.src,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,littlstar/chromium.src,hujiajie/pa-chromium,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,pozdnyakov/chromium-crosswalk,bright-sparks/chromium-spacewalk,mogoweb/chromium-crosswalk,Jonekee/chromium.src,chuan9/chromium-crosswalk,markYoungH/chromium.src,robclark/chromium,mogoweb/chromium-crosswalk,patrickm/chromium.src,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,littlstar/chromium.src,robclark/chromium,littlstar/chromium.src,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk,Chilledheart/chromium,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,Just-D/chromium-1,anirudhSK/chromium,hujiajie/pa-chromium,pozdnyakov/chromium-crosswalk,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,jaruba/chromium.src,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,hujiajie/pa-chromium,littlstar/chromium.src,Just-D/chromium-1,robclark/chromium,patrickm/chromium.src,ltilve/chromium,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,patrickm/chromium.src,ltilve/chromium,anirudhSK/chromium,anirudhSK/chromium,anirudhSK/chromium,littlstar/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,nacl-webkit/chrome_deps,fujunwei/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,jaruba/chromium.src,ondra-novak/chromium.src,ondra-novak/chromium.src,M4sse/chromium.src,ondra-novak/chromium.src,pozdnyakov/chromium-crosswalk,Fireblend/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,Chilledheart/chromium,anirudhSK/chromium,anirudhSK/chromium,keishi/chromium,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,jaruba/chromium.src,bright-sparks/chromium-spacewalk,Chilledheart/chromium,robclark/chromium,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,ondra-novak/chromium.src,dednal/chromium.src,markYoungH/chromium.src,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,bright-sparks/chromium-spacewalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,junmin-zhu/chromium-rivertrail,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,Jonekee/chromium.src,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,dednal/chromium.src,pozdnyakov/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,junmin-zhu/chromium-rivertrail,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,dushu1203/chromium.src,mogoweb/chromium-crosswalk,robclark/chromium,Chilledheart/chromium,keishi/chromium,timopulkkinen/BubbleFish,rogerwang/chromium,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,Chilledheart/chromium,robclark/chromium,junmin-zhu/chromium-rivertrail,dednal/chromium.src,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,ondra-novak/chromium.src,zcbenz/cefode-chromium,dushu1203/chromium.src,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,ChromiumWebApps/chromium,rogerwang/chromium,Jonekee/chromium.src,dednal/chromium.src,M4sse/chromium.src,hujiajie/pa-chromium,Jonekee/chromium.src,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,zcbenz/cefode-chromium,axinging/chromium-crosswalk,nacl-webkit/chrome_deps,ltilve/chromium,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,keishi/chromium,dednal/chromium.src,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,rogerwang/chromium,TheTypoMaster/chromium-crosswalk,bright-sparks/chromium-spacewalk,zcbenz/cefode-chromium,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,ChromiumWebApps/chromium,ltilve/chromium,Jonekee/chromium.src,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,timopulkkinen/BubbleFish,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,anirudhSK/chromium,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,ChromiumWebApps/chromium,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,nacl-webkit/chrome_deps,rogerwang/chromium,markYoungH/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,zcbenz/cefode-chromium,rogerwang/chromium,timopulkkinen/BubbleFish,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,ltilve/chromium,jaruba/chromium.src,ChromiumWebApps/chromium,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,jaruba/chromium.src,rogerwang/chromium,keishi/chromium,keishi/chromium,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,zcbenz/cefode-chromium,patrickm/chromium.src,hgl888/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,timopulkkinen/BubbleFish,jaruba/chromium.src,anirudhSK/chromium,ChromiumWebApps/chromium,robclark/chromium,timopulkkinen/BubbleFish,M4sse/chromium.src,axinging/chromium-crosswalk,ltilve/chromium,zcbenz/cefode-chromium,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,junmin-zhu/chromium-rivertrail,zcbenz/cefode-chromium,jaruba/chromium.src,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,anirudhSK/chromium,Fireblend/chromium-crosswalk,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,keishi/chromium,nacl-webkit/chrome_deps,keishi/chromium,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,hujiajie/pa-chromium,Pluto-tv/chromium-crosswalk,dushu1203/chromium.src,Jonekee/chromium.src,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,ondra-novak/chromium.src,markYoungH/chromium.src,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,hgl888/chromium-crosswalk,ondra-novak/chromium.src,mogoweb/chromium-crosswalk,robclark/chromium,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,patrickm/chromium.src,TheTypoMaster/chromium-crosswalk,keishi/chromium,hujiajie/pa-chromium,hujiajie/pa-chromium,junmin-zhu/chromium-rivertrail,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,mohamed--abdel-maksoud/chromium.src,ltilve/chromium | json | ## Code Before:
{
"name": "__MSG_PRODUCT_NAME__ BETA",
"version": "1.2.UNIQUE_VERSION",
"description": "__MSG_PRODUCT_DESCRIPTION__",
"default_locale": "en",
"app": {
"launch": {
"local_path": "choice.html"
}
},
"icons": {
"128": "chromoting128.png",
"48": "chromoting48.png",
"16": "chromoting16.png"
},
"content_scripts": [
{
"matches": [
"https://talkgadget.google.com/talkgadget/blank",
"https://talkgadget.google.com/talkgadget/blank?*"
],
"js": [ "cs_oauth2_trampoline.js" ]
}
],
"permissions": [
"tabs",
"https://accounts.google.com/o/oauth2/*",
"https://www.google.com/accounts/*",
"https://www.googleapis.com/chromoting/*",
"https://talkgadget.google.com/talkgadget/*"
],
"plugins": [
{ "path": "remoting_host_plugin.dll", "public": false },
{ "path": "libremoting_host_plugin.ia32.so", "public": false },
{ "path": "libremoting_host_plugin.x64.so", "public": false },
{ "path": "remoting_host_plugin.plugin", "public": false }
]
}
## Instruction:
Remove tabs permission for the webapp.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8120012
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@103808 0039d316-1c4b-4281-b951-d872f2087c98
## Code After:
{
"name": "__MSG_PRODUCT_NAME__ BETA",
"version": "1.2.UNIQUE_VERSION",
"description": "__MSG_PRODUCT_DESCRIPTION__",
"default_locale": "en",
"app": {
"launch": {
"local_path": "choice.html"
}
},
"icons": {
"128": "chromoting128.png",
"48": "chromoting48.png",
"16": "chromoting16.png"
},
"content_scripts": [
{
"matches": [
"https://talkgadget.google.com/talkgadget/blank",
"https://talkgadget.google.com/talkgadget/blank?*"
],
"js": [ "cs_oauth2_trampoline.js" ]
}
],
"permissions": [
"https://accounts.google.com/o/oauth2/*",
"https://www.google.com/accounts/*",
"https://www.googleapis.com/chromoting/*",
"https://talkgadget.google.com/talkgadget/*"
],
"plugins": [
{ "path": "remoting_host_plugin.dll", "public": false },
{ "path": "libremoting_host_plugin.ia32.so", "public": false },
{ "path": "libremoting_host_plugin.x64.so", "public": false },
{ "path": "remoting_host_plugin.plugin", "public": false }
]
}
| {
"name": "__MSG_PRODUCT_NAME__ BETA",
"version": "1.2.UNIQUE_VERSION",
"description": "__MSG_PRODUCT_DESCRIPTION__",
"default_locale": "en",
"app": {
"launch": {
"local_path": "choice.html"
}
},
"icons": {
"128": "chromoting128.png",
"48": "chromoting48.png",
"16": "chromoting16.png"
},
"content_scripts": [
{
"matches": [
"https://talkgadget.google.com/talkgadget/blank",
"https://talkgadget.google.com/talkgadget/blank?*"
],
"js": [ "cs_oauth2_trampoline.js" ]
}
],
"permissions": [
- "tabs",
"https://accounts.google.com/o/oauth2/*",
"https://www.google.com/accounts/*",
"https://www.googleapis.com/chromoting/*",
"https://talkgadget.google.com/talkgadget/*"
],
"plugins": [
{ "path": "remoting_host_plugin.dll", "public": false },
{ "path": "libremoting_host_plugin.ia32.so", "public": false },
{ "path": "libremoting_host_plugin.x64.so", "public": false },
{ "path": "remoting_host_plugin.plugin", "public": false }
]
} | 1 | 0.026316 | 0 | 1 |
e17b37b7b61380cb7c6414e238029e340593d3bd | build/build.sh | build/build.sh | set -e
wd=$(realpath $(dirname $0)/..)
source ${wd}/build/config.sh
export DIST_DIR=dist
rm -rf $DIST_DIR
mkdir $DIST_DIR
tar --create . | docker run --rm -e VERSION=${VERSION} -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
cd $DIST_DIR
tar --extract --file=build.tar
rm -f build.tar
# Homebrew - binary must be called phraseapp, because the binary name inside
# the tar will be made available system wide
cp phraseapp_macosx_amd64 phraseapp
tar cfz phraseapp_macosx_amd64.tar.gz phraseapp
rm phraseapp
for name in phraseapp_linux_386 phraseapp_linux_amd64; do
tar cfz ${name}.tar.gz $name
done
if ! which zip > /dev/null; then
echo "zip not installed"
fi
zip phraseapp_windows_amd64.exe.zip phraseapp_windows_amd64.exe > /dev/null
echo "Version: ${VERSION}"
echo "Build at: ${CURRENT_DATE}"
echo "Brew hash: $(sha256sum phraseapp_macosx_amd64.tar.gz | cut -d ' ' -f 1)"
echo "Build output: $(pwd)"
| set -e
wd=$(realpath $(dirname $0)/..)
source ${wd}/build/config.sh
export DIST_DIR=dist
rm -rf $DIST_DIR
mkdir $DIST_DIR
tar --create . | docker run --rm -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
cd $DIST_DIR
tar --extract --file=build.tar
rm -f build.tar
# Homebrew - binary must be called phraseapp, because the binary name inside
# the tar will be made available system wide
cp phraseapp_macosx_amd64 phraseapp
tar cfz phraseapp_macosx_amd64.tar.gz phraseapp
rm phraseapp
for name in phraseapp_linux_386 phraseapp_linux_amd64; do
tar cfz ${name}.tar.gz $name
done
if ! which zip > /dev/null; then
echo "zip not installed"
fi
zip phraseapp_windows_amd64.exe.zip phraseapp_windows_amd64.exe > /dev/null
echo "Version: ${VERSION}"
echo "Build at: ${CURRENT_DATE}"
echo "Brew hash: $(sha256sum phraseapp_macosx_amd64.tar.gz | cut -d ' ' -f 1)"
echo "Build output: $(pwd)"
| Remove not required env from container | Remove not required env from container
| Shell | mit | phrase/phraseapp-client,phrase/phraseapp-client | shell | ## Code Before:
set -e
wd=$(realpath $(dirname $0)/..)
source ${wd}/build/config.sh
export DIST_DIR=dist
rm -rf $DIST_DIR
mkdir $DIST_DIR
tar --create . | docker run --rm -e VERSION=${VERSION} -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
cd $DIST_DIR
tar --extract --file=build.tar
rm -f build.tar
# Homebrew - binary must be called phraseapp, because the binary name inside
# the tar will be made available system wide
cp phraseapp_macosx_amd64 phraseapp
tar cfz phraseapp_macosx_amd64.tar.gz phraseapp
rm phraseapp
for name in phraseapp_linux_386 phraseapp_linux_amd64; do
tar cfz ${name}.tar.gz $name
done
if ! which zip > /dev/null; then
echo "zip not installed"
fi
zip phraseapp_windows_amd64.exe.zip phraseapp_windows_amd64.exe > /dev/null
echo "Version: ${VERSION}"
echo "Build at: ${CURRENT_DATE}"
echo "Brew hash: $(sha256sum phraseapp_macosx_amd64.tar.gz | cut -d ' ' -f 1)"
echo "Build output: $(pwd)"
## Instruction:
Remove not required env from container
## Code After:
set -e
wd=$(realpath $(dirname $0)/..)
source ${wd}/build/config.sh
export DIST_DIR=dist
rm -rf $DIST_DIR
mkdir $DIST_DIR
tar --create . | docker run --rm -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
cd $DIST_DIR
tar --extract --file=build.tar
rm -f build.tar
# Homebrew - binary must be called phraseapp, because the binary name inside
# the tar will be made available system wide
cp phraseapp_macosx_amd64 phraseapp
tar cfz phraseapp_macosx_amd64.tar.gz phraseapp
rm phraseapp
for name in phraseapp_linux_386 phraseapp_linux_amd64; do
tar cfz ${name}.tar.gz $name
done
if ! which zip > /dev/null; then
echo "zip not installed"
fi
zip phraseapp_windows_amd64.exe.zip phraseapp_windows_amd64.exe > /dev/null
echo "Version: ${VERSION}"
echo "Build at: ${CURRENT_DATE}"
echo "Brew hash: $(sha256sum phraseapp_macosx_amd64.tar.gz | cut -d ' ' -f 1)"
echo "Build output: $(pwd)"
| set -e
wd=$(realpath $(dirname $0)/..)
source ${wd}/build/config.sh
export DIST_DIR=dist
rm -rf $DIST_DIR
mkdir $DIST_DIR
- tar --create . | docker run --rm -e VERSION=${VERSION} -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
? ----------------------
+ tar --create . | docker run --rm -i golang:$GOVERSION bash -c "$(cat build/docker_build.sh)" > ${DIST_DIR}/build.tar
cd $DIST_DIR
tar --extract --file=build.tar
rm -f build.tar
# Homebrew - binary must be called phraseapp, because the binary name inside
# the tar will be made available system wide
cp phraseapp_macosx_amd64 phraseapp
tar cfz phraseapp_macosx_amd64.tar.gz phraseapp
rm phraseapp
for name in phraseapp_linux_386 phraseapp_linux_amd64; do
tar cfz ${name}.tar.gz $name
done
if ! which zip > /dev/null; then
echo "zip not installed"
fi
zip phraseapp_windows_amd64.exe.zip phraseapp_windows_amd64.exe > /dev/null
echo "Version: ${VERSION}"
echo "Build at: ${CURRENT_DATE}"
echo "Brew hash: $(sha256sum phraseapp_macosx_amd64.tar.gz | cut -d ' ' -f 1)"
echo "Build output: $(pwd)" | 2 | 0.055556 | 1 | 1 |
85c35acf702d7d4ebc0482e3eb4bf3247dfd2b42 | README.md | README.md |
go2xcode converts a Go package into a Xcode project that targets iOS 8.3.
```
$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project.
```
Note: go2xcode requires darwin/arm and darwin/arm64 cross compilers. |
go2xcode converts a Go package into a Xcode project that targets iOS 8.3.
```
$ go get github.com/rakyll/go2xcode
```
## Usage
```
$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project.
```
Note: go2xcode requires Go 1.5 darwin/arm and darwin/arm64 cross compilers.
In order to build these cross compilers, you need to Go 1.5 source.
Go 1.5 requires Go 1.4. Read more about this requirement at
http://golang.org/s/go15bootstrap.
Set GOROOT_BOOTSTRAP to the GOROOT of your existing 1.4 installation or
follow the steps below to checkout go1.4 from the source and build.
```
$ git clone https://go.googlesource.com/go $HOME/go1.4
$ cd $HOME/go1.4
$ git checkout go1.4.1
$ cd src && ./make.bash
```
Clone and build Go 1.5 and add Go 1.5 bin to your path.
```
$ git clone https://go.googlesource.com/go $HOME/go
$ cd $HOME/go/src && ./make.bash
$ export PATH=$PATH:$HOME/go/bin
```
And build the cross compilers.
```
$ GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
$ CGO_ENABLED=1 GOARCH=arm64 CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
```
| Add build instructions for cross compilers. | Add build instructions for cross compilers.
| Markdown | bsd-3-clause | rakyll/go2xcode | markdown | ## Code Before:
go2xcode converts a Go package into a Xcode project that targets iOS 8.3.
```
$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project.
```
Note: go2xcode requires darwin/arm and darwin/arm64 cross compilers.
## Instruction:
Add build instructions for cross compilers.
## Code After:
go2xcode converts a Go package into a Xcode project that targets iOS 8.3.
```
$ go get github.com/rakyll/go2xcode
```
## Usage
```
$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project.
```
Note: go2xcode requires Go 1.5 darwin/arm and darwin/arm64 cross compilers.
In order to build these cross compilers, you need to Go 1.5 source.
Go 1.5 requires Go 1.4. Read more about this requirement at
http://golang.org/s/go15bootstrap.
Set GOROOT_BOOTSTRAP to the GOROOT of your existing 1.4 installation or
follow the steps below to checkout go1.4 from the source and build.
```
$ git clone https://go.googlesource.com/go $HOME/go1.4
$ cd $HOME/go1.4
$ git checkout go1.4.1
$ cd src && ./make.bash
```
Clone and build Go 1.5 and add Go 1.5 bin to your path.
```
$ git clone https://go.googlesource.com/go $HOME/go
$ cd $HOME/go/src && ./make.bash
$ export PATH=$PATH:$HOME/go/bin
```
And build the cross compilers.
```
$ GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
$ CGO_ENABLED=1 GOARCH=arm64 CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
```
|
go2xcode converts a Go package into a Xcode project that targets iOS 8.3.
+
+
+ ```
+ $ go get github.com/rakyll/go2xcode
+ ```
+
+ ## Usage
```
$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project.
```
- Note: go2xcode requires darwin/arm and darwin/arm64 cross compilers.
+ Note: go2xcode requires Go 1.5 darwin/arm and darwin/arm64 cross compilers.
? +++++++
+
+ In order to build these cross compilers, you need to Go 1.5 source.
+
+ Go 1.5 requires Go 1.4. Read more about this requirement at
+ http://golang.org/s/go15bootstrap.
+ Set GOROOT_BOOTSTRAP to the GOROOT of your existing 1.4 installation or
+ follow the steps below to checkout go1.4 from the source and build.
+
+ ```
+ $ git clone https://go.googlesource.com/go $HOME/go1.4
+ $ cd $HOME/go1.4
+ $ git checkout go1.4.1
+ $ cd src && ./make.bash
+ ```
+
+ Clone and build Go 1.5 and add Go 1.5 bin to your path.
+
+ ```
+ $ git clone https://go.googlesource.com/go $HOME/go
+ $ cd $HOME/go/src && ./make.bash
+ $ export PATH=$PATH:$HOME/go/bin
+ ```
+
+ And build the cross compilers.
+
+ ```
+ $ GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
+ CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
+
+ $ CGO_ENABLED=1 GOARCH=arm64 CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
+ CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
+ ``` | 41 | 3.727273 | 40 | 1 |
2574ee5c44e6ccf0a790e7bd156bdf3dc3db33b9 | README.md | README.md | Tool for handling downtimes for freeform and similar roleplaying games. This tool has been largely designed for use by the Oxford University Roleplaying Soceity, but may be of use in other use-cases.
Bugs, comments and other requests to jhogg41 .a.t. gmail
# Installation
1. Recommend you create a virtualenv:
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
2. Change the security key in the gom_server/gom_server/settings.py
3. Adjust database settings as you wish.
4. Serve the gom_client/app directory as static web root of www.gom.com.
5. Serve gom_server/wsgi.py as a WSGI webapp at api.gom.com
| Tool for handling downtimes for freeform and similar roleplaying games. This tool has been largely designed for use by the Oxford University Roleplaying Soceity, but may be of use in other use-cases.
Bugs, comments and other requests to jhogg41 .a.t. gmail
## Installation
1. Recommend you create a virtualenv:
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
pip install django-rest-auth
2. Change the security key in the gom_server/gom_server/settings.py
3. Adjust database settings as you wish. Run ./manage.py migrate to instantiate.
4. Serve the gom_client/app directory as static web root of www.gom.com.
5. Serve gom_server/wsgi.py as a WSGI webapp at api.gom.com
| Add extra package for auth | Add extra package for auth
| Markdown | bsd-2-clause | jhogg41/gm-o-matic,jhogg41/gm-o-matic,jhogg41/gm-o-matic | markdown | ## Code Before:
Tool for handling downtimes for freeform and similar roleplaying games. This tool has been largely designed for use by the Oxford University Roleplaying Soceity, but may be of use in other use-cases.
Bugs, comments and other requests to jhogg41 .a.t. gmail
# Installation
1. Recommend you create a virtualenv:
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
2. Change the security key in the gom_server/gom_server/settings.py
3. Adjust database settings as you wish.
4. Serve the gom_client/app directory as static web root of www.gom.com.
5. Serve gom_server/wsgi.py as a WSGI webapp at api.gom.com
## Instruction:
Add extra package for auth
## Code After:
Tool for handling downtimes for freeform and similar roleplaying games. This tool has been largely designed for use by the Oxford University Roleplaying Soceity, but may be of use in other use-cases.
Bugs, comments and other requests to jhogg41 .a.t. gmail
## Installation
1. Recommend you create a virtualenv:
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
pip install django-rest-auth
2. Change the security key in the gom_server/gom_server/settings.py
3. Adjust database settings as you wish. Run ./manage.py migrate to instantiate.
4. Serve the gom_client/app directory as static web root of www.gom.com.
5. Serve gom_server/wsgi.py as a WSGI webapp at api.gom.com
| Tool for handling downtimes for freeform and similar roleplaying games. This tool has been largely designed for use by the Oxford University Roleplaying Soceity, but may be of use in other use-cases.
Bugs, comments and other requests to jhogg41 .a.t. gmail
- # Installation
+ ## Installation
? +
1. Recommend you create a virtualenv:
virtualenv env
source env/bin/activate
pip install django
pip install djangorestframework
+ pip install django-rest-auth
2. Change the security key in the gom_server/gom_server/settings.py
- 3. Adjust database settings as you wish.
+ 3. Adjust database settings as you wish. Run ./manage.py migrate to instantiate.
4. Serve the gom_client/app directory as static web root of www.gom.com.
5. Serve gom_server/wsgi.py as a WSGI webapp at api.gom.com | 5 | 0.357143 | 3 | 2 |
4a568906863d5f85b86103e01d6af3862369767e | test/javascripts/unit/closed-organisation-hide-date_test.js | test/javascripts/unit/closed-organisation-hide-date_test.js | module("create-new", {
setup: function() {
$('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
}
});
test("Should hide child elements", function() {
var $select = $('.organisation_govuk_status'),
$group = $('#organisation_closed_at_group');
GOVUK.hideClosedAtDates();
ok($group.find('*').is(':hidden');
});
| module("create-new", {
setup: function() {
$('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open" selected="selected">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
}
});
test("Should hide child elements", function() {
var $select = $('.organisation_govuk_status'),
$group = $('#organisation_closed_at_group');
GOVUK.hideClosedAtDates();
ok($group.find('*').is(':hidden'));
});
| Fix broken closed-organisation hide-date test | Fix broken closed-organisation hide-date test
| JavaScript | mit | askl56/whitehall,hotvulcan/whitehall,askl56/whitehall,robinwhittleton/whitehall,YOTOV-LIMITED/whitehall,YOTOV-LIMITED/whitehall,robinwhittleton/whitehall,ggoral/whitehall,alphagov/whitehall,alphagov/whitehall,ggoral/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,alphagov/whitehall,ggoral/whitehall,alphagov/whitehall,ggoral/whitehall,robinwhittleton/whitehall,hotvulcan/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,hotvulcan/whitehall,hotvulcan/whitehall,robinwhittleton/whitehall | javascript | ## Code Before:
module("create-new", {
setup: function() {
$('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
}
});
test("Should hide child elements", function() {
var $select = $('.organisation_govuk_status'),
$group = $('#organisation_closed_at_group');
GOVUK.hideClosedAtDates();
ok($group.find('*').is(':hidden');
});
## Instruction:
Fix broken closed-organisation hide-date test
## Code After:
module("create-new", {
setup: function() {
$('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open" selected="selected">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
}
});
test("Should hide child elements", function() {
var $select = $('.organisation_govuk_status'),
$group = $('#organisation_closed_at_group');
GOVUK.hideClosedAtDates();
ok($group.find('*').is(':hidden'));
});
| module("create-new", {
setup: function() {
- $('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
+ $('#qunit-fixture').append('<select id="organisation_govuk_status" name="organisation_govuk_status"><option value="closed">Closed</option><option value="open" selected="selected">Open</option></select><div id="organisation_closed_at_group"><label for="organisation_closed_at">Closed at?</label><input id="test_child"></div>');
? ++++++++++++++++++++
}
});
test("Should hide child elements", function() {
var $select = $('.organisation_govuk_status'),
$group = $('#organisation_closed_at_group');
GOVUK.hideClosedAtDates();
- ok($group.find('*').is(':hidden');
+ ok($group.find('*').is(':hidden'));
? +
}); | 4 | 0.333333 | 2 | 2 |
63186deb5621b6f89ac726c3bdca4e90d9d3cf26 | src/main/webapp/index.html | src/main/webapp/index.html | <!DOCTYPE html>
<html>
<head>
<meta
charset="UTF-8"
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Overnightly</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
</head>
<body>
<div class="row">
<div class="col s12 m4">
<div class="card">
<div class="card-image">
<img src="assets/img/placeholder.png" />
<span class="card-title">Testing out Materialize</span>
</div>
<div class="card-content">
<p>Wow, it really works!</p>
</div>
</div>
</div>
</div>
<script async defer src="script.js"></script>
<script
async
defer
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"
></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta
charset="UTF-8"
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Overnightly</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
</head>
<body>
<div class="row">
<div class="col s12 m4">
<div class="card">
<div class="card-image">
<img src="assets/img/placeholder.png" />
<span class="card-title">Testing out Materialize</span>
</div>
<div class="card-content">
<p>Wow, it really works!</p>
</div>
</div>
</div>
</div>
<script src="script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
| Remove async and defer from script tags | Remove async and defer from script tags
| HTML | apache-2.0 | googleinterns/step27-2020,googleinterns/step27-2020,googleinterns/step27-2020 | html | ## Code Before:
<!DOCTYPE html>
<html>
<head>
<meta
charset="UTF-8"
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Overnightly</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
</head>
<body>
<div class="row">
<div class="col s12 m4">
<div class="card">
<div class="card-image">
<img src="assets/img/placeholder.png" />
<span class="card-title">Testing out Materialize</span>
</div>
<div class="card-content">
<p>Wow, it really works!</p>
</div>
</div>
</div>
</div>
<script async defer src="script.js"></script>
<script
async
defer
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"
></script>
</body>
</html>
## Instruction:
Remove async and defer from script tags
## Code After:
<!DOCTYPE html>
<html>
<head>
<meta
charset="UTF-8"
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Overnightly</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
</head>
<body>
<div class="row">
<div class="col s12 m4">
<div class="card">
<div class="card-image">
<img src="assets/img/placeholder.png" />
<span class="card-title">Testing out Materialize</span>
</div>
<div class="card-content">
<p>Wow, it really works!</p>
</div>
</div>
</div>
</div>
<script src="script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta
charset="UTF-8"
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Overnightly</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
</head>
<body>
<div class="row">
<div class="col s12 m4">
<div class="card">
<div class="card-image">
<img src="assets/img/placeholder.png" />
<span class="card-title">Testing out Materialize</span>
</div>
<div class="card-content">
<p>Wow, it really works!</p>
</div>
</div>
</div>
</div>
- <script async defer src="script.js"></script>
? ------------
+ <script src="script.js"></script>
- <script
- async
- defer
- src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"
? ^
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
? ^^^^^^^ ++++++++++
- ></script>
</body>
</html> | 8 | 0.210526 | 2 | 6 |
7ac0966184167e02a6120939a5433a9476fc9619 | client/src/styles/_components.scss | client/src/styles/_components.scss | @import '../views/git-importer/components/git-importer/style';
@import '../views/git-importer/components/error-list/style';
@import '../views/git-importer/components/error-item/style';
| @import '../views/git-importer/components/git-importer/style';
| Remove stray references to error components in styles | Remove stray references to error components in styles
| SCSS | bsd-2-clause | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | scss | ## Code Before:
@import '../views/git-importer/components/git-importer/style';
@import '../views/git-importer/components/error-list/style';
@import '../views/git-importer/components/error-item/style';
## Instruction:
Remove stray references to error components in styles
## Code After:
@import '../views/git-importer/components/git-importer/style';
| @import '../views/git-importer/components/git-importer/style';
- @import '../views/git-importer/components/error-list/style';
- @import '../views/git-importer/components/error-item/style'; | 2 | 0.666667 | 0 | 2 |
0333f7635e5f974e47d510496f815a09f9763c5c | app/views/databases/show.html.slim | app/views/databases/show.html.slim | div.database data-id=@database.id
div.details
p
strong
'Name:
span.editable data-url="/databases/#{@database.id}" data-attribute='database[name]'
= @database.name
'
p
strong
'Shareable Link:
= link_to database_url(@database), database_url(@database), title: 'Share this URL to share access to your DB'
div.tables
ul.list
li
a#add-table = 'Add Table'
- @database.tables.each do |table|
li
a data-id=table.id data-name=table.name
= table.name
div.table data-id=current_table.try(:id)
p
strong Name:
span.editable
= @table.name
p
strong ID:
= @table.id
== render 'tables/table'
= link_to 'Edit this Database', edit_database_path(@database)
| div.database data-id=@database.id
div.details
p
strong
'Name:
span.editable data-url="/databases/#{@database.id}" data-attribute='database[name]'
= @database.name
'
p
strong
'Shareable Link:
= link_to database_url(@database), database_url(@database), title: 'Share this URL to share access to your DB'
div.tables
ul.list
li
a#add-table = 'Add Table'
- @database.tables.each do |table|
li
a data-id=table.id data-name=table.name
= table.name
div.table data-id=current_table.try(:id)
p
strong Name:
span.editable
= @table.name
p
strong ID:
= @table.id
== render 'tables/table'
== render 'columns/form'
= link_to 'Edit this Database', edit_database_path(@database)
| Include column edit form on database view | Include column edit form on database view
| Slim | mit | boochtek/DynamicDB,boochtek/DynamicDB,boochtek/DynamicDB | slim | ## Code Before:
div.database data-id=@database.id
div.details
p
strong
'Name:
span.editable data-url="/databases/#{@database.id}" data-attribute='database[name]'
= @database.name
'
p
strong
'Shareable Link:
= link_to database_url(@database), database_url(@database), title: 'Share this URL to share access to your DB'
div.tables
ul.list
li
a#add-table = 'Add Table'
- @database.tables.each do |table|
li
a data-id=table.id data-name=table.name
= table.name
div.table data-id=current_table.try(:id)
p
strong Name:
span.editable
= @table.name
p
strong ID:
= @table.id
== render 'tables/table'
= link_to 'Edit this Database', edit_database_path(@database)
## Instruction:
Include column edit form on database view
## Code After:
div.database data-id=@database.id
div.details
p
strong
'Name:
span.editable data-url="/databases/#{@database.id}" data-attribute='database[name]'
= @database.name
'
p
strong
'Shareable Link:
= link_to database_url(@database), database_url(@database), title: 'Share this URL to share access to your DB'
div.tables
ul.list
li
a#add-table = 'Add Table'
- @database.tables.each do |table|
li
a data-id=table.id data-name=table.name
= table.name
div.table data-id=current_table.try(:id)
p
strong Name:
span.editable
= @table.name
p
strong ID:
= @table.id
== render 'tables/table'
== render 'columns/form'
= link_to 'Edit this Database', edit_database_path(@database)
| div.database data-id=@database.id
div.details
p
strong
'Name:
span.editable data-url="/databases/#{@database.id}" data-attribute='database[name]'
= @database.name
'
p
strong
'Shareable Link:
= link_to database_url(@database), database_url(@database), title: 'Share this URL to share access to your DB'
div.tables
ul.list
li
a#add-table = 'Add Table'
- @database.tables.each do |table|
li
a data-id=table.id data-name=table.name
= table.name
div.table data-id=current_table.try(:id)
p
strong Name:
span.editable
= @table.name
p
strong ID:
= @table.id
== render 'tables/table'
+ == render 'columns/form'
= link_to 'Edit this Database', edit_database_path(@database) | 1 | 0.029412 | 1 | 0 |
7976a11fc2338b8206de178e688301ea468db6fb | src/hours.js | src/hours.js | const hours = [];
for (let i = 0; i < 24; i++) {
hours.push(i);
}
export default hours;
| const hours = [];
for (let i = 0; i < 24; i++) {
if (i < 10) {
hours.push(`0${i}`);
} else {
hours.push(`${i}`);
}
}
export default hours;
| Use more human-friendly hour strings | Use more human-friendly hour strings
Still only 24h clock, but I'll get to am/pm later.
| JavaScript | mit | trotzig/react-available-times,trotzig/react-available-times | javascript | ## Code Before:
const hours = [];
for (let i = 0; i < 24; i++) {
hours.push(i);
}
export default hours;
## Instruction:
Use more human-friendly hour strings
Still only 24h clock, but I'll get to am/pm later.
## Code After:
const hours = [];
for (let i = 0; i < 24; i++) {
if (i < 10) {
hours.push(`0${i}`);
} else {
hours.push(`${i}`);
}
}
export default hours;
| const hours = [];
for (let i = 0; i < 24; i++) {
+ if (i < 10) {
+ hours.push(`0${i}`);
+ } else {
- hours.push(i);
+ hours.push(`${i}`);
? ++ +++ ++
+ }
}
export default hours; | 6 | 1 | 5 | 1 |
c9e038b21021acce1fb7395d1ac912fe41cbd86f | _posts/2017-09-16-alexander-titov-site-launched.md | _posts/2017-09-16-alexander-titov-site-launched.md | ---
layout: post
title: "Alexander Titov's personal site has been launched today!"
date: 2017-09-16
---
<p>Hi everyone,</p>
<p>My name is Alexander Titov. I am a CPU HW Architect/Micro-Architect/Researcher and EECS Lecturer.
I am also like writing code in C++ and Python.</p>
<p>Finally, I managed to start my own personal site. I am going to use it to post my lectures, articles, and thoughts.</p>
<p>The site is hosted on <a href="pages.github.com"> GitHun Page</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
I found it quite easy (to be honest, I am familiar with HTML and CSS). I recommend following
<a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site.</p>
<p>Regards,<br>Alexander</p>
| ---
layout: post
title: "Alexander's personal site has been launched today!"
date: 2017-09-16
---
<p>Hi everyone,</p>
<p>My name is Alexander Titov. I am a CPU HW Architect/Micro-Architect/Researcher and EECS Lecturer.
I am also like writing code in C++ and Python.</p>
<p>Finally, I managed to start my own personal site. I am going to use it to post my lectures, articles, and thoughts.</p>
<p>The site is hosted on <a href="pages.github.com">GitHub Pages</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
I found it quite easy (but, to be honest, I am familiar with <a href="https://www.w3schools.com/html/">HTML</a> and
<a href="https://www.w3schools.com/css/">CSS</a>). I recommend following
<a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site on
<a href="pages.github.com">GitHub Pages</a>.</p>
<p>Regards,<br>Alexander</p>
| Update the post title and fix typos in the text | Update the post title and fix typos in the text | Markdown | mit | alexander-titov/alexander-titov.github.io | markdown | ## Code Before:
---
layout: post
title: "Alexander Titov's personal site has been launched today!"
date: 2017-09-16
---
<p>Hi everyone,</p>
<p>My name is Alexander Titov. I am a CPU HW Architect/Micro-Architect/Researcher and EECS Lecturer.
I am also like writing code in C++ and Python.</p>
<p>Finally, I managed to start my own personal site. I am going to use it to post my lectures, articles, and thoughts.</p>
<p>The site is hosted on <a href="pages.github.com"> GitHun Page</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
I found it quite easy (to be honest, I am familiar with HTML and CSS). I recommend following
<a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site.</p>
<p>Regards,<br>Alexander</p>
## Instruction:
Update the post title and fix typos in the text
## Code After:
---
layout: post
title: "Alexander's personal site has been launched today!"
date: 2017-09-16
---
<p>Hi everyone,</p>
<p>My name is Alexander Titov. I am a CPU HW Architect/Micro-Architect/Researcher and EECS Lecturer.
I am also like writing code in C++ and Python.</p>
<p>Finally, I managed to start my own personal site. I am going to use it to post my lectures, articles, and thoughts.</p>
<p>The site is hosted on <a href="pages.github.com">GitHub Pages</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
I found it quite easy (but, to be honest, I am familiar with <a href="https://www.w3schools.com/html/">HTML</a> and
<a href="https://www.w3schools.com/css/">CSS</a>). I recommend following
<a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site on
<a href="pages.github.com">GitHub Pages</a>.</p>
<p>Regards,<br>Alexander</p>
| ---
layout: post
- title: "Alexander Titov's personal site has been launched today!"
? ------
+ title: "Alexander's personal site has been launched today!"
date: 2017-09-16
---
<p>Hi everyone,</p>
<p>My name is Alexander Titov. I am a CPU HW Architect/Micro-Architect/Researcher and EECS Lecturer.
I am also like writing code in C++ and Python.</p>
<p>Finally, I managed to start my own personal site. I am going to use it to post my lectures, articles, and thoughts.</p>
- <p>The site is hosted on <a href="pages.github.com"> GitHun Page</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
? - ^
+ <p>The site is hosted on <a href="pages.github.com">GitHub Pages</a> and powered by <a href="http://jekyllrb.com">Jekyll</a>.
? ^ +
- I found it quite easy (to be honest, I am familiar with HTML and CSS). I recommend following
+ I found it quite easy (but, to be honest, I am familiar with <a href="https://www.w3schools.com/html/">HTML</a> and
+ <a href="https://www.w3schools.com/css/">CSS</a>). I recommend following
- <a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site.</p>
? ^^^^^
+ <a href="http://jmcglone.com/guides/github-pages/">this instruction</a> if you want to start your own site on
? ^^^
+ <a href="pages.github.com">GitHub Pages</a>.</p>
<p>Regards,<br>Alexander</p> | 10 | 0.555556 | 6 | 4 |
1792c29b96b190100d505bc5639c21acc7474750 | db/geodata.sql | db/geodata.sql | CREATE TABLE IF NOT EXISTS `locations` (
`locid` mediumint(8) unsigned NOT NULL,
`latitude` float(8,4) NOT NULL,
`longitude` float(8,4) NOT NULL,
`ipcount` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`locid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| CREATE TABLE IF NOT EXISTS `locations` (
`locid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`latitude` float(8,4) NOT NULL,
`longitude` float(8,4) NOT NULL,
`ipcount` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`locid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;
| Change Location table to use Auto Increment key. | Change Location table to use Auto Increment key.
| SQL | mit | salscode/ipv4-heatmap,salscode/ipv4-heatmap,salscode/ipv4-heatmap | sql | ## Code Before:
CREATE TABLE IF NOT EXISTS `locations` (
`locid` mediumint(8) unsigned NOT NULL,
`latitude` float(8,4) NOT NULL,
`longitude` float(8,4) NOT NULL,
`ipcount` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`locid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
## Instruction:
Change Location table to use Auto Increment key.
## Code After:
CREATE TABLE IF NOT EXISTS `locations` (
`locid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`latitude` float(8,4) NOT NULL,
`longitude` float(8,4) NOT NULL,
`ipcount` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`locid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;
| CREATE TABLE IF NOT EXISTS `locations` (
- `locid` mediumint(8) unsigned NOT NULL,
+ `locid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
? +++++++++++++++
`latitude` float(8,4) NOT NULL,
`longitude` float(8,4) NOT NULL,
`ipcount` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`locid`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;
? +++++++++++++++++
| 4 | 0.571429 | 2 | 2 |
f07f10e5acdc4c00343fe55b75452ba7456c1ba5 | src/main/resources/app/_layouts/empty.html | src/main/resources/app/_layouts/empty.html | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PicShare</title>
<head>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
</style>
<!-- Compiled and minified JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<!-- Font -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
[[ body ]]
</body>
| ---
materialize: [
materialize.min.css,
jquery.min.js,
materialize.min.js
]
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PicShare</title>
<head>
[[webjar materialize]]
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
</style>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
[[ body ]]
</body>
| Use webjar handler to load jquery and materialize | Use webjar handler to load jquery and materialize
| HTML | apache-2.0 | obourgain/PicShare,obourgain/PicShare | html | ## Code Before:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PicShare</title>
<head>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
</style>
<!-- Compiled and minified JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<!-- Font -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
[[ body ]]
</body>
## Instruction:
Use webjar handler to load jquery and materialize
## Code After:
---
materialize: [
materialize.min.css,
jquery.min.js,
materialize.min.js
]
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PicShare</title>
<head>
[[webjar materialize]]
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
</style>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
[[ body ]]
</body>
| + ---
+ materialize: [
+ materialize.min.css,
+ jquery.min.js,
+ materialize.min.js
+ ]
+ ---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PicShare</title>
<head>
+ [[webjar materialize]]
- <!-- Compiled and minified CSS -->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
</style>
-
- <!-- Compiled and minified JavaScript -->
- <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
-
- <!-- Font -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
[[ body ]]
</body> | 16 | 0.571429 | 8 | 8 |
61518d5fec350f1ff2c35176853f4d71e1cf379b | Support/lib/spec/mate.rb | Support/lib/spec/mate.rb |
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
require "rubygems"
require "bundler"
Bundler.setup
elsif File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
unless File.directory?(rspec_lib)
raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
end
$LOAD_PATH.unshift(rspec_lib)
end
begin
require 'spec/autorun'
rescue LoadError
require 'rspec/core'
end
def rspec2?
defined?(RSpec)
end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'
|
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
require "rubygems"
require "bundler"
Bundler.setup
elsif File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
unless File.directory?(rspec_lib)
raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
end
$LOAD_PATH.unshift(rspec_lib)
end
begin
require 'spec/autorun'
rescue LoadError
require 'rspec/core'
ENV['DISABLE_RSPEC_AUTORUN'] = "true"
end
def rspec2?
defined?(RSpec)
end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'
| Disable rspec autorun for rspec 2 | Disable rspec autorun for rspec 2
| Ruby | mit | rspec/rspec.tmbundle,infininight/rspec-tmbundle,infininight/rspec-tmbundle,die-antwort/rspec-tmbundle,chip/rspec-tmbundle,die-antwort/rspec-tmbundle,rspec/rspec.tmbundle | ruby | ## Code Before:
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
require "rubygems"
require "bundler"
Bundler.setup
elsif File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
unless File.directory?(rspec_lib)
raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
end
$LOAD_PATH.unshift(rspec_lib)
end
begin
require 'spec/autorun'
rescue LoadError
require 'rspec/core'
end
def rspec2?
defined?(RSpec)
end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'
## Instruction:
Disable rspec autorun for rspec 2
## Code After:
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
require "rubygems"
require "bundler"
Bundler.setup
elsif File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
unless File.directory?(rspec_lib)
raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
end
$LOAD_PATH.unshift(rspec_lib)
end
begin
require 'spec/autorun'
rescue LoadError
require 'rspec/core'
ENV['DISABLE_RSPEC_AUTORUN'] = "true"
end
def rspec2?
defined?(RSpec)
end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'
|
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
require "rubygems"
require "bundler"
Bundler.setup
elsif File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
unless File.directory?(rspec_lib)
raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
end
$LOAD_PATH.unshift(rspec_lib)
end
begin
require 'spec/autorun'
rescue LoadError
require 'rspec/core'
+ ENV['DISABLE_RSPEC_AUTORUN'] = "true"
end
def rspec2?
defined?(RSpec)
end
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command' | 1 | 0.032258 | 1 | 0 |
105ba3afdf6ff3fa4c88b235febdb42ede6bb231 | lib/twat/subcommands/finger.rb | lib/twat/subcommands/finger.rb | module Twat::Subcommands
class Finger < Base
def run
raise ArgumentRequired if @argv.length == 0
auth!
begin
Twitter.user_timeline(@argv[0], :count => @argv[1] || 1).each do |tweet|
format(tweet)
end
rescue Twitter::NotFound
puts "#{@argv[0].bold.red} doesn't appear to be a valid user"
end
end
def self.usage
"Usage: twat finger USERNAME [count]"
end
end
COMMANDS['finger'] = Finger
end
| module Twat::Subcommands
class Finger < Base
def run
needs_arguments(1)
auth!
begin
Twitter.user_timeline(@argv[0], :count => @argv[1] || 1).each do |tweet|
format(tweet)
end
rescue Twitter::NotFound
puts "#{@argv[0].bold.red} doesn't appear to be a valid user"
end
end
def self.usage
"Usage: twat finger USERNAME [count]"
end
end
COMMANDS['finger'] = Finger
end
| Update to use internal spec | Update to use internal spec
| Ruby | mit | richo/twat | ruby | ## Code Before:
module Twat::Subcommands
class Finger < Base
def run
raise ArgumentRequired if @argv.length == 0
auth!
begin
Twitter.user_timeline(@argv[0], :count => @argv[1] || 1).each do |tweet|
format(tweet)
end
rescue Twitter::NotFound
puts "#{@argv[0].bold.red} doesn't appear to be a valid user"
end
end
def self.usage
"Usage: twat finger USERNAME [count]"
end
end
COMMANDS['finger'] = Finger
end
## Instruction:
Update to use internal spec
## Code After:
module Twat::Subcommands
class Finger < Base
def run
needs_arguments(1)
auth!
begin
Twitter.user_timeline(@argv[0], :count => @argv[1] || 1).each do |tweet|
format(tweet)
end
rescue Twitter::NotFound
puts "#{@argv[0].bold.red} doesn't appear to be a valid user"
end
end
def self.usage
"Usage: twat finger USERNAME [count]"
end
end
COMMANDS['finger'] = Finger
end
| module Twat::Subcommands
class Finger < Base
def run
- raise ArgumentRequired if @argv.length == 0
+ needs_arguments(1)
auth!
begin
Twitter.user_timeline(@argv[0], :count => @argv[1] || 1).each do |tweet|
format(tweet)
end
rescue Twitter::NotFound
puts "#{@argv[0].bold.red} doesn't appear to be a valid user"
end
end
def self.usage
"Usage: twat finger USERNAME [count]"
end
end
COMMANDS['finger'] = Finger
end | 2 | 0.086957 | 1 | 1 |
0906148b8c9bdb64b770487e05176ed391d58999 | app/models/page_part.rb | app/models/page_part.rb | class PagePart < ActiveRecord::Base
# Default Order
default_scope :order => 'name'
# Associations
belongs_to :page, :touch => true
# Validations
validates_presence_of :name
validates_length_of :name, :maximum => 100
validates_length_of :filter_id, :maximum => 25, :allow_nil => true
validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true
object_id_attr :filter, TextFilter
def after_initialize
self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end
| class PagePart < ActiveRecord::Base
# Default Order
default_scope :order => 'name'
# Associations
belongs_to :page
# Validations
validates_presence_of :name
validates_length_of :name, :maximum => 100
validates_length_of :filter_id, :maximum => 25, :allow_nil => true
validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true
object_id_attr :filter, TextFilter
def after_initialize
self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end
| Revert "Touch page timestamp when updating a part" | Revert "Touch page timestamp when updating a part"
This reverts commit b83063904b9761fa3ffa854db3766507bc7cf9f2.
| Ruby | mit | jcasimir/radiant,LytayTOUCH/radiant,LytayTOUCH/radiant,radiant/radiant,carols10cents/trusty-cms,ahjohannessen/radiant,pgharts/trusty-cms,radiant/radiant,jcasimir/radiant,blj/radiant,ahjohannessen/radiant,amcoder/trusty-cms,uneek/Site-Kosmopolead,uneek/Site-Kosmopolead,zflat/trusty-cms,carols10cents/trusty-cms,blj/radiant,ahjohannessen/radiant,zflat/trusty-cms,amcoder/trusty-cms,ahjohannessen/radiant,radiant/radiant,blj/radiant,carols10cents/trusty-cms,LytayTOUCH/radiant,pgharts/trusty-cms,amcoder/trusty-cms,carols10cents/trusty-cms,pgharts/trusty-cms,LytayTOUCH/radiant,zflat/trusty-cms,zflat/trusty-cms,blj/radiant,radiant/radiant,amcoder/trusty-cms | ruby | ## Code Before:
class PagePart < ActiveRecord::Base
# Default Order
default_scope :order => 'name'
# Associations
belongs_to :page, :touch => true
# Validations
validates_presence_of :name
validates_length_of :name, :maximum => 100
validates_length_of :filter_id, :maximum => 25, :allow_nil => true
validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true
object_id_attr :filter, TextFilter
def after_initialize
self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end
## Instruction:
Revert "Touch page timestamp when updating a part"
This reverts commit b83063904b9761fa3ffa854db3766507bc7cf9f2.
## Code After:
class PagePart < ActiveRecord::Base
# Default Order
default_scope :order => 'name'
# Associations
belongs_to :page
# Validations
validates_presence_of :name
validates_length_of :name, :maximum => 100
validates_length_of :filter_id, :maximum => 25, :allow_nil => true
validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true
object_id_attr :filter, TextFilter
def after_initialize
self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end
| class PagePart < ActiveRecord::Base
# Default Order
default_scope :order => 'name'
# Associations
- belongs_to :page, :touch => true
+ belongs_to :page
# Validations
validates_presence_of :name
validates_length_of :name, :maximum => 100
validates_length_of :filter_id, :maximum => 25, :allow_nil => true
validates_numericality_of :id, :page_id, :allow_nil => true, :only_integer => true
object_id_attr :filter, TextFilter
def after_initialize
self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end | 2 | 0.095238 | 1 | 1 |
7640fe42a5d75407236e0c8584c3192d96a26c51 | alignak_webui/plugins/common/views/_nothing_found.tpl | alignak_webui/plugins/common/views/_nothing_found.tpl |
<div class="panel-heading">
<center class="alert-warning">
%if search_string:
<h3>{{_('What a bummer! We could not find anything.')}}</h3>
{{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}
%else:
<h3>{{_('No elements found.')}}</h3>
%end
</center>
</div> | <div class="text-center alert alert-warning">
%if search_string:
<h4>{{_('What a bummer! We could not find anything.')}}</h4>
<p>{{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}</p>
%else:
<h4>{{_('No elements found.')}}</h4>
%end
</div>
| Clean message when nothing found in an elements list | Clean message when nothing found in an elements list
| Smarty | agpl-3.0 | Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui,Alignak-monitoring-contrib/alignak-webui | smarty | ## Code Before:
<div class="panel-heading">
<center class="alert-warning">
%if search_string:
<h3>{{_('What a bummer! We could not find anything.')}}</h3>
{{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}
%else:
<h3>{{_('No elements found.')}}</h3>
%end
</center>
</div>
## Instruction:
Clean message when nothing found in an elements list
## Code After:
<div class="text-center alert alert-warning">
%if search_string:
<h4>{{_('What a bummer! We could not find anything.')}}</h4>
<p>{{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}</p>
%else:
<h4>{{_('No elements found.')}}</h4>
%end
</div>
| + <div class="text-center alert alert-warning">
-
- <div class="panel-heading">
- <center class="alert-warning">
%if search_string:
- <h3>{{_('What a bummer! We could not find anything.')}}</h3>
? ^ ^
+ <h4>{{_('What a bummer! We could not find anything.')}}</h4>
? ^ ^
- {{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}
+ <p>{{_('Use the filters or the bookmarks to find what you are looking for, or try a new search query.')}}</p>
? +++ ++++
%else:
- <h3>{{_('No elements found.')}}</h3>
? ^ ^
+ <h4>{{_('No elements found.')}}</h4>
? ^ ^
%end
- </center>
</div> | 11 | 1 | 4 | 7 |
8e9ebfcf0377f7a5e2bceefaf0b0f8f37831b68d | lib/Gen/Blog.php | lib/Gen/Blog.php | <?php
namespace Gen;
class Blog
{
protected $util;
public function __construct(Util $util)
{
$this->util = $util;
}
public function getIndex($dir, $skip = []) {
$out = ['blogs' => []];
foreach ($this->util->scan($dir, 'twig') as $entry) {
if (!in_array($entry['file'], $skip)) {
if (preg_match('#content(.*+)#', $entry['path'], $results)) {
$path = $results[1];
$file = $this->util->replaceExtension($entry['file'], 'html');
$title = ucfirst(str_replace('-', ' ', $this->util->replaceExtension($file, '')));
$out['blogs'][] = [
'title' => $title,
'path' => $path . '/' . $file
];
}
}
}
return $out;
}
}
| <?php
namespace Gen;
class Blog
{
protected $util;
public function __construct(Util $util)
{
$this->util = $util;
}
public function getIndex($dir, $skip = []) {
$out = ['blogs' => []];
foreach ($this->util->scan($dir, 'twig') as $entry) {
if (!in_array($entry['file'], $skip)) {
if (preg_match('#content(.*+)#', $entry['path'], $results)) {
$meta = [];
$metaFile = $this->util->replaceExtension($entry['file'], 'meta.php');
if (file_exists($entry['path'] . '/' . $metaFile)) {
$meta = (array) include $entry['path'] . '/' . $metaFile;
}
$partUrl = $results[1];
$file = $this->util->replaceExtension($entry['file'], 'html');
$title = ucfirst(str_replace('-', ' ', $this->util->replaceExtension($file, '')));
$out['blogs'][] = [
'title' => $title,
'path' => $path . '/' . $file
];
}
}
}
return $out;
}
}
| Add the ability for individual blog entries to read a *.meta.php file. | Add the ability for individual blog entries to read a *.meta.php file.
| PHP | mit | trq/Gen | php | ## Code Before:
<?php
namespace Gen;
class Blog
{
protected $util;
public function __construct(Util $util)
{
$this->util = $util;
}
public function getIndex($dir, $skip = []) {
$out = ['blogs' => []];
foreach ($this->util->scan($dir, 'twig') as $entry) {
if (!in_array($entry['file'], $skip)) {
if (preg_match('#content(.*+)#', $entry['path'], $results)) {
$path = $results[1];
$file = $this->util->replaceExtension($entry['file'], 'html');
$title = ucfirst(str_replace('-', ' ', $this->util->replaceExtension($file, '')));
$out['blogs'][] = [
'title' => $title,
'path' => $path . '/' . $file
];
}
}
}
return $out;
}
}
## Instruction:
Add the ability for individual blog entries to read a *.meta.php file.
## Code After:
<?php
namespace Gen;
class Blog
{
protected $util;
public function __construct(Util $util)
{
$this->util = $util;
}
public function getIndex($dir, $skip = []) {
$out = ['blogs' => []];
foreach ($this->util->scan($dir, 'twig') as $entry) {
if (!in_array($entry['file'], $skip)) {
if (preg_match('#content(.*+)#', $entry['path'], $results)) {
$meta = [];
$metaFile = $this->util->replaceExtension($entry['file'], 'meta.php');
if (file_exists($entry['path'] . '/' . $metaFile)) {
$meta = (array) include $entry['path'] . '/' . $metaFile;
}
$partUrl = $results[1];
$file = $this->util->replaceExtension($entry['file'], 'html');
$title = ucfirst(str_replace('-', ' ', $this->util->replaceExtension($file, '')));
$out['blogs'][] = [
'title' => $title,
'path' => $path . '/' . $file
];
}
}
}
return $out;
}
}
| <?php
namespace Gen;
class Blog
{
protected $util;
public function __construct(Util $util)
{
$this->util = $util;
}
public function getIndex($dir, $skip = []) {
$out = ['blogs' => []];
foreach ($this->util->scan($dir, 'twig') as $entry) {
if (!in_array($entry['file'], $skip)) {
if (preg_match('#content(.*+)#', $entry['path'], $results)) {
+
+ $meta = [];
+ $metaFile = $this->util->replaceExtension($entry['file'], 'meta.php');
+ if (file_exists($entry['path'] . '/' . $metaFile)) {
+ $meta = (array) include $entry['path'] . '/' . $metaFile;
+ }
+
- $path = $results[1];
? ^
+ $partUrl = $results[1];
? + ^^^
$file = $this->util->replaceExtension($entry['file'], 'html');
$title = ucfirst(str_replace('-', ' ', $this->util->replaceExtension($file, '')));
$out['blogs'][] = [
'title' => $title,
'path' => $path . '/' . $file
];
}
}
}
return $out;
}
} | 9 | 0.264706 | 8 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.