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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dd77428bf46393630b67b089e54fb485694704d0 | lib/monarchy.rb | lib/monarchy.rb | require 'closure_tree'
require 'configurations'
require 'active_record_union'
require 'monarchy/exceptions'
require 'monarchy/validators'
require 'monarchy/tasks'
require 'monarchy/engine'
require 'monarchy/acts_as_role'
require 'monarchy/acts_as_member'
require 'monarchy/acts_as_user'
require 'monarchy/acts_as_resource'
require 'monarchy/acts_as_hierarchy'
module Monarchy
cattr_accessor :resource_classes
def self.resource_classes
@resource_classes ||= []
end
include Configurations
configuration_defaults do |config|
config.member_class_name = 'Monarchy::Member'
config.role_class_name = 'Monarchy::Role'
config.member_force_revoke = false
end
not_configured do |prop|
raise NoMethodError, "Monarchy requires a #{prop} to be configured"
end
def self.member_class
Monarchy.configuration.member_class_name.safe_constantize
end
def self.role_class
Monarchy.configuration.role_class_name.safe_constantize
end
def self.user_class
klass = Monarchy.configuration.user_class_name.safe_constantize
klass ? klass : raise(ArgumentError, 'User class has to be initialized or exist!')
end
end
| require 'closure_tree'
require 'configurations'
require 'active_record_union'
require 'monarchy/exceptions'
require 'monarchy/validators'
require 'monarchy/tasks'
require 'monarchy/engine'
require 'monarchy/acts_as_role'
require 'monarchy/acts_as_member'
require 'monarchy/acts_as_user'
require 'monarchy/acts_as_resource'
require 'monarchy/acts_as_hierarchy'
module Monarchy
cattr_accessor :resource_classes
def self.resource_classes
@resource_classes ||= []
end
include Configurations
configuration_defaults do |config|
config.member_class_name = 'Monarchy::Member'
config.role_class_name = 'Monarchy::Role'
config.members_access_revoke = false
config.revoke_strategy = :revoke_member
end
not_configured do |property|
raise Monarchy::Exceptions::ConfigNotDefined, property
end
def self.member_class
Monarchy.configuration.member_class_name.safe_constantize || classNotDefined('Member')
end
def self.role_class
Monarchy.configuration.role_class_name.safe_constantize || classNotDefined('Role')
end
def self.user_class
Monarchy.configuration.user_class_name.safe_constantize || classNotDefined('User')
end
private
def classNotDefined(class_name)
raise Monarchy::Exceptions::ClassNotDefined, class_name
end
end
| Replace custom exceptions with MCE | Replace custom exceptions with MCE
| Ruby | mit | Exelord/Treelify,Exelord/Treelify,Exelord/Monarchy,Exelord/Treelify,Exelord/Monarchy,Exelord/Monarchy,Exelord/Treelify,Exelord/Monarchy | ruby | ## Code Before:
require 'closure_tree'
require 'configurations'
require 'active_record_union'
require 'monarchy/exceptions'
require 'monarchy/validators'
require 'monarchy/tasks'
require 'monarchy/engine'
require 'monarchy/acts_as_role'
require 'monarchy/acts_as_member'
require 'monarchy/acts_as_user'
require 'monarchy/acts_as_resource'
require 'monarchy/acts_as_hierarchy'
module Monarchy
cattr_accessor :resource_classes
def self.resource_classes
@resource_classes ||= []
end
include Configurations
configuration_defaults do |config|
config.member_class_name = 'Monarchy::Member'
config.role_class_name = 'Monarchy::Role'
config.member_force_revoke = false
end
not_configured do |prop|
raise NoMethodError, "Monarchy requires a #{prop} to be configured"
end
def self.member_class
Monarchy.configuration.member_class_name.safe_constantize
end
def self.role_class
Monarchy.configuration.role_class_name.safe_constantize
end
def self.user_class
klass = Monarchy.configuration.user_class_name.safe_constantize
klass ? klass : raise(ArgumentError, 'User class has to be initialized or exist!')
end
end
## Instruction:
Replace custom exceptions with MCE
## Code After:
require 'closure_tree'
require 'configurations'
require 'active_record_union'
require 'monarchy/exceptions'
require 'monarchy/validators'
require 'monarchy/tasks'
require 'monarchy/engine'
require 'monarchy/acts_as_role'
require 'monarchy/acts_as_member'
require 'monarchy/acts_as_user'
require 'monarchy/acts_as_resource'
require 'monarchy/acts_as_hierarchy'
module Monarchy
cattr_accessor :resource_classes
def self.resource_classes
@resource_classes ||= []
end
include Configurations
configuration_defaults do |config|
config.member_class_name = 'Monarchy::Member'
config.role_class_name = 'Monarchy::Role'
config.members_access_revoke = false
config.revoke_strategy = :revoke_member
end
not_configured do |property|
raise Monarchy::Exceptions::ConfigNotDefined, property
end
def self.member_class
Monarchy.configuration.member_class_name.safe_constantize || classNotDefined('Member')
end
def self.role_class
Monarchy.configuration.role_class_name.safe_constantize || classNotDefined('Role')
end
def self.user_class
Monarchy.configuration.user_class_name.safe_constantize || classNotDefined('User')
end
private
def classNotDefined(class_name)
raise Monarchy::Exceptions::ClassNotDefined, class_name
end
end
| require 'closure_tree'
require 'configurations'
require 'active_record_union'
require 'monarchy/exceptions'
require 'monarchy/validators'
require 'monarchy/tasks'
require 'monarchy/engine'
require 'monarchy/acts_as_role'
require 'monarchy/acts_as_member'
require 'monarchy/acts_as_user'
require 'monarchy/acts_as_resource'
require 'monarchy/acts_as_hierarchy'
module Monarchy
cattr_accessor :resource_classes
def self.resource_classes
@resource_classes ||= []
end
include Configurations
configuration_defaults do |config|
config.member_class_name = 'Monarchy::Member'
config.role_class_name = 'Monarchy::Role'
- config.member_force_revoke = false
? ^^^
+ config.members_access_revoke = false
? + ^^ ++
+ config.revoke_strategy = :revoke_member
end
- not_configured do |prop|
+ not_configured do |property|
? ++++
- raise NoMethodError, "Monarchy requires a #{prop} to be configured"
+ raise Monarchy::Exceptions::ConfigNotDefined, property
end
def self.member_class
- Monarchy.configuration.member_class_name.safe_constantize
+ Monarchy.configuration.member_class_name.safe_constantize || classNotDefined('Member')
? +++++++++++++++++++++++++++++
end
def self.role_class
- Monarchy.configuration.role_class_name.safe_constantize
+ Monarchy.configuration.role_class_name.safe_constantize || classNotDefined('Role')
? +++++++++++++++++++++++++++
end
def self.user_class
- klass = Monarchy.configuration.user_class_name.safe_constantize
? --------
+ Monarchy.configuration.user_class_name.safe_constantize || classNotDefined('User')
? +++++++++++++++++++++++++++
- klass ? klass : raise(ArgumentError, 'User class has to be initialized or exist!')
+ end
+
+ private
+
+ def classNotDefined(class_name)
+ raise Monarchy::Exceptions::ClassNotDefined, class_name
end
end | 20 | 0.425532 | 13 | 7 |
03b01e0654cd89a8548db3bd5929c3620f183dae | addon/-private/errors.js | addon/-private/errors.js | function createErrorMessage(missingProperty) {
return `\`${missingProperty}\` must be provided. This should be ensured by the build process.
If you\'re seeing this message, please file a bug report because something is wrong.`;
}
/**
* @class MissingPropertyError
* @private
*/
export function MissingPropertyError(missingProperty) {
this.name = 'MissingPropertyError';
this.stack = (new Error()).stack;
this.message = createErrorMessage(missingProperty);
}
MissingPropertyError.prototype = new Error;
/**
* @class StepNameError
* @private
*/
export function StepNameError(message) {
this.name = 'StepNameError';
this.message = message;
this.stack = (new Error()).stack;
}
StepNameError.prototype = new Error;
| function createErrorMessage(missingProperty) {
return `\`${missingProperty}\` must be provided as static value.
If you\'re seeing this message, you're likely either iterating over some data
to create your steps or doing something to provide the value dynamically. This
is currently unsupported by \`ember-steps\`. Please see the following for more
information:
https://github.com/alexlafroscia/ember-steps/wiki/dynamically-generating-steps`;
}
/**
* @class MissingPropertyError
* @private
*/
export function MissingPropertyError(missingProperty) {
this.name = 'MissingPropertyError';
this.stack = (new Error()).stack;
this.message = createErrorMessage(missingProperty);
}
MissingPropertyError.prototype = new Error;
/**
* @class StepNameError
* @private
*/
export function StepNameError(message) {
this.name = 'StepNameError';
this.message = message;
this.stack = (new Error()).stack;
}
StepNameError.prototype = new Error;
| Update error message when `currentStep` is dynamic | Update error message when `currentStep` is dynamic
| JavaScript | mit | alexlafroscia/ember-steps,alexlafroscia/ember-steps,KamiKillertO/ember-steps,Bartheleway/ember-steps,KamiKillertO/ember-steps,Bartheleway/ember-steps,alexlafroscia/ember-steps | javascript | ## Code Before:
function createErrorMessage(missingProperty) {
return `\`${missingProperty}\` must be provided. This should be ensured by the build process.
If you\'re seeing this message, please file a bug report because something is wrong.`;
}
/**
* @class MissingPropertyError
* @private
*/
export function MissingPropertyError(missingProperty) {
this.name = 'MissingPropertyError';
this.stack = (new Error()).stack;
this.message = createErrorMessage(missingProperty);
}
MissingPropertyError.prototype = new Error;
/**
* @class StepNameError
* @private
*/
export function StepNameError(message) {
this.name = 'StepNameError';
this.message = message;
this.stack = (new Error()).stack;
}
StepNameError.prototype = new Error;
## Instruction:
Update error message when `currentStep` is dynamic
## Code After:
function createErrorMessage(missingProperty) {
return `\`${missingProperty}\` must be provided as static value.
If you\'re seeing this message, you're likely either iterating over some data
to create your steps or doing something to provide the value dynamically. This
is currently unsupported by \`ember-steps\`. Please see the following for more
information:
https://github.com/alexlafroscia/ember-steps/wiki/dynamically-generating-steps`;
}
/**
* @class MissingPropertyError
* @private
*/
export function MissingPropertyError(missingProperty) {
this.name = 'MissingPropertyError';
this.stack = (new Error()).stack;
this.message = createErrorMessage(missingProperty);
}
MissingPropertyError.prototype = new Error;
/**
* @class StepNameError
* @private
*/
export function StepNameError(message) {
this.name = 'StepNameError';
this.message = message;
this.stack = (new Error()).stack;
}
StepNameError.prototype = new Error;
| function createErrorMessage(missingProperty) {
- return `\`${missingProperty}\` must be provided. This should be ensured by the build process.
+ return `\`${missingProperty}\` must be provided as static value.
- If you\'re seeing this message, please file a bug report because something is wrong.`;
+ If you\'re seeing this message, you're likely either iterating over some data
+ to create your steps or doing something to provide the value dynamically. This
+ is currently unsupported by \`ember-steps\`. Please see the following for more
+ information:
+
+ https://github.com/alexlafroscia/ember-steps/wiki/dynamically-generating-steps`;
}
/**
* @class MissingPropertyError
* @private
*/
export function MissingPropertyError(missingProperty) {
this.name = 'MissingPropertyError';
this.stack = (new Error()).stack;
this.message = createErrorMessage(missingProperty);
}
MissingPropertyError.prototype = new Error;
/**
* @class StepNameError
* @private
*/
export function StepNameError(message) {
this.name = 'StepNameError';
this.message = message;
this.stack = (new Error()).stack;
}
StepNameError.prototype = new Error; | 9 | 0.333333 | 7 | 2 |
397eb3ee376acec005a8d7b5a4c2b2e0193a938d | tests/test_bookmarks.py | tests/test_bookmarks.py | import bookmarks
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.app = bookmarks.app.test_client()
# with bookmarks.app.app_context():
bookmarks.database.init_db()
def tearDown(self):
# with bookmarks.app.app_context():
bookmarks.database.db_session.remove()
bookmarks.database.Base.metadata.drop_all(
bind=bookmarks.database.engine)
def test_empty_db(self):
rv = self.app.get('/')
assert b'There aren\'t any bookmarks yet.' in rv.data
def register(self, username, name, email, password):
return self.app.post('/register_user/', data=dict(
username=username,
name=name,
email=email,
password=password,
confirm=password
), follow_redirects=True)
def login(self, username, password):
return self.app.post('/login', data=dict(
username=username,
password=password,
confirm=password
), follow_redirects=True)
def logout(self):
return self.app.get('/logout', follow_redirects=True)
def test_register(self):
username = 'byanofsky'
name = 'Brandon Yanofsky'
email = 'byanofsky@me.com'
password = 'Brandon123'
rv = self.register(username, name, email, password)
# print(rv.data)
assert (b'Successfully registered ' in rv.data)
if __name__ == '__main__':
unittest.main()
| import bookmarks
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.app = bookmarks.app.test_client()
# with bookmarks.app.app_context():
bookmarks.database.init_db()
def tearDown(self):
# with bookmarks.app.app_context():
bookmarks.database.db_session.remove()
bookmarks.database.Base.metadata.drop_all(
bind=bookmarks.database.engine)
def test_empty_db(self):
rv = self.app.get('/')
assert b'There aren\'t any bookmarks yet.' in rv.data
def register(self, username, name, email, password, confirm=None):
return self.app.post('/register_user/', data=dict(
username=username,
name=name,
email=email,
password=password,
confirm=confirm
), follow_redirects=True)
def login(self, username, password):
return self.app.post('/login', data=dict(
username=username,
password=password,
confirm=password
), follow_redirects=True)
def logout(self):
return self.app.get('/logout', follow_redirects=True)
def test_register(self):
username = 'byanofsky'
name = 'Brandon Yanofsky'
email = 'byanofsky@me.com'
password = 'Brandon123'
rv = self.register(username, name, email, password)
# print(rv.data)
assert (b'Successfully registered ' in rv.data)
if __name__ == '__main__':
unittest.main()
| Add param for confirm field on register test func | Add param for confirm field on register test func
| Python | apache-2.0 | byanofsky/bookmarks,byanofsky/bookmarks,byanofsky/bookmarks | python | ## Code Before:
import bookmarks
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.app = bookmarks.app.test_client()
# with bookmarks.app.app_context():
bookmarks.database.init_db()
def tearDown(self):
# with bookmarks.app.app_context():
bookmarks.database.db_session.remove()
bookmarks.database.Base.metadata.drop_all(
bind=bookmarks.database.engine)
def test_empty_db(self):
rv = self.app.get('/')
assert b'There aren\'t any bookmarks yet.' in rv.data
def register(self, username, name, email, password):
return self.app.post('/register_user/', data=dict(
username=username,
name=name,
email=email,
password=password,
confirm=password
), follow_redirects=True)
def login(self, username, password):
return self.app.post('/login', data=dict(
username=username,
password=password,
confirm=password
), follow_redirects=True)
def logout(self):
return self.app.get('/logout', follow_redirects=True)
def test_register(self):
username = 'byanofsky'
name = 'Brandon Yanofsky'
email = 'byanofsky@me.com'
password = 'Brandon123'
rv = self.register(username, name, email, password)
# print(rv.data)
assert (b'Successfully registered ' in rv.data)
if __name__ == '__main__':
unittest.main()
## Instruction:
Add param for confirm field on register test func
## Code After:
import bookmarks
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.app = bookmarks.app.test_client()
# with bookmarks.app.app_context():
bookmarks.database.init_db()
def tearDown(self):
# with bookmarks.app.app_context():
bookmarks.database.db_session.remove()
bookmarks.database.Base.metadata.drop_all(
bind=bookmarks.database.engine)
def test_empty_db(self):
rv = self.app.get('/')
assert b'There aren\'t any bookmarks yet.' in rv.data
def register(self, username, name, email, password, confirm=None):
return self.app.post('/register_user/', data=dict(
username=username,
name=name,
email=email,
password=password,
confirm=confirm
), follow_redirects=True)
def login(self, username, password):
return self.app.post('/login', data=dict(
username=username,
password=password,
confirm=password
), follow_redirects=True)
def logout(self):
return self.app.get('/logout', follow_redirects=True)
def test_register(self):
username = 'byanofsky'
name = 'Brandon Yanofsky'
email = 'byanofsky@me.com'
password = 'Brandon123'
rv = self.register(username, name, email, password)
# print(rv.data)
assert (b'Successfully registered ' in rv.data)
if __name__ == '__main__':
unittest.main()
| import bookmarks
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.app = bookmarks.app.test_client()
# with bookmarks.app.app_context():
bookmarks.database.init_db()
def tearDown(self):
# with bookmarks.app.app_context():
bookmarks.database.db_session.remove()
bookmarks.database.Base.metadata.drop_all(
bind=bookmarks.database.engine)
def test_empty_db(self):
rv = self.app.get('/')
assert b'There aren\'t any bookmarks yet.' in rv.data
- def register(self, username, name, email, password):
+ def register(self, username, name, email, password, confirm=None):
? ++++++++++++++
return self.app.post('/register_user/', data=dict(
username=username,
name=name,
email=email,
password=password,
- confirm=password
? ^^^^^ ^
+ confirm=confirm
? ^ +++ ^
), follow_redirects=True)
def login(self, username, password):
return self.app.post('/login', data=dict(
username=username,
password=password,
confirm=password
), follow_redirects=True)
def logout(self):
return self.app.get('/logout', follow_redirects=True)
def test_register(self):
username = 'byanofsky'
name = 'Brandon Yanofsky'
email = 'byanofsky@me.com'
password = 'Brandon123'
rv = self.register(username, name, email, password)
# print(rv.data)
assert (b'Successfully registered ' in rv.data)
if __name__ == '__main__':
unittest.main() | 4 | 0.078431 | 2 | 2 |
8e738a1b7fa27323247cd05b1108f3a27ca92c45 | CONTRIBUTING.md | CONTRIBUTING.md |
Follow these steps to make a contribution to any of CF open source repositories:
1. Ensure that you have completed our CLA Agreement for
[individuals](http://www.cloudfoundry.org/individualcontribution.pdf) or
[corporations](http://www.cloudfoundry.org/corpcontribution.pdf).
1. Set your name and email (these should match the information on your submitted CLA)
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
1. See [development docs](docs/README.md) to start contributing to BOSH.
|
Follow these steps to make a contribution to any of CF open source repositories:
1. Ensure that you have completed our CLA Agreement for
[individuals](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Individual_CLA.pdf) or
[corporations](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Corporate_CLA.pdf).
1. Set your name and email (these should match the information on your submitted CLA)
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
1. See [development docs](docs/README.md) to start contributing to BOSH.
| Fix Bosh contributor agreement links. | Fix Bosh contributor agreement links.
The PDF's linked from the Bosh contributing document are broken. The
helpful bot that tells you to sign a contribution agreement linked me to
these correct versions.
| Markdown | apache-2.0 | barthy1/bosh,barthy1/bosh,barthy1/bosh,barthy1/bosh | markdown | ## Code Before:
Follow these steps to make a contribution to any of CF open source repositories:
1. Ensure that you have completed our CLA Agreement for
[individuals](http://www.cloudfoundry.org/individualcontribution.pdf) or
[corporations](http://www.cloudfoundry.org/corpcontribution.pdf).
1. Set your name and email (these should match the information on your submitted CLA)
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
1. See [development docs](docs/README.md) to start contributing to BOSH.
## Instruction:
Fix Bosh contributor agreement links.
The PDF's linked from the Bosh contributing document are broken. The
helpful bot that tells you to sign a contribution agreement linked me to
these correct versions.
## Code After:
Follow these steps to make a contribution to any of CF open source repositories:
1. Ensure that you have completed our CLA Agreement for
[individuals](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Individual_CLA.pdf) or
[corporations](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Corporate_CLA.pdf).
1. Set your name and email (these should match the information on your submitted CLA)
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
1. See [development docs](docs/README.md) to start contributing to BOSH.
|
Follow these steps to make a contribution to any of CF open source repositories:
1. Ensure that you have completed our CLA Agreement for
- [individuals](http://www.cloudfoundry.org/individualcontribution.pdf) or
- [corporations](http://www.cloudfoundry.org/corpcontribution.pdf).
+ [individuals](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Individual_CLA.pdf) or
+ [corporations](https://www.cloudfoundry.org/wp-content/uploads/2015/07/CFF_Corporate_CLA.pdf).
1. Set your name and email (these should match the information on your submitted CLA)
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@example.com"
1. See [development docs](docs/README.md) to start contributing to BOSH. | 4 | 0.307692 | 2 | 2 |
3c457803b23696ccc263e640dede70650ab2ce68 | index.html | index.html | <!DOCTYPE html>
<html class="no-js" lang="en_US">
<head>
<meta charset="utf-8" />
<title>Tamarind — Very basic Javascript carousel</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="dist/tamarind.css" /> -->
<link rel="stylesheet" href="src/tamarind.css" />
<!--<script src="/assets/javascript/vendor/modernizr.dev.js"></script>-->
</head>
<body>
<h1>Tamarind</h1>
<div class="CarouselWrap">
<div class="Carousel js-tamarind">
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 1</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 2</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 3</figcaption>
</figure>
</div>
</div>
<!-- <script src="dist/tamarind.js"></script> -->
<script src="src/tamarind.js"></script>
</body>
</html> | <!DOCTYPE html>
<html class="no-js" lang="en_US">
<head>
<meta charset="utf-8" />
<title>Tamarind — Very basic Javascript carousel</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="dist/tamarind.css" /> -->
<link rel="stylesheet" href="src/tamarind.css" />
<!--<script src="/assets/javascript/vendor/modernizr.dev.js"></script>-->
</head>
<body>
<h1>Tamarind</h1>
<div class="CarouselWrap">
<div class="Carousel js-tamarind">
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 1</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 2</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 3</figcaption>
</figure>
</div>
</div>
<!-- <script src="dist/tamarind.js"></script> -->
<script src="dist/jquery.min.js"></script>
<script src="src/tamarind.jquery.js"></script>
<script type="text/javascript">tamarind.init({ 'autoplay' : false, 'nav' : true });</script>
</body>
</html> | Load jquery variant in demontration. | Load jquery variant in demontration.
| HTML | mit | fatpixelstudio/Tamarind | html | ## Code Before:
<!DOCTYPE html>
<html class="no-js" lang="en_US">
<head>
<meta charset="utf-8" />
<title>Tamarind — Very basic Javascript carousel</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="dist/tamarind.css" /> -->
<link rel="stylesheet" href="src/tamarind.css" />
<!--<script src="/assets/javascript/vendor/modernizr.dev.js"></script>-->
</head>
<body>
<h1>Tamarind</h1>
<div class="CarouselWrap">
<div class="Carousel js-tamarind">
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 1</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 2</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 3</figcaption>
</figure>
</div>
</div>
<!-- <script src="dist/tamarind.js"></script> -->
<script src="src/tamarind.js"></script>
</body>
</html>
## Instruction:
Load jquery variant in demontration.
## Code After:
<!DOCTYPE html>
<html class="no-js" lang="en_US">
<head>
<meta charset="utf-8" />
<title>Tamarind — Very basic Javascript carousel</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="dist/tamarind.css" /> -->
<link rel="stylesheet" href="src/tamarind.css" />
<!--<script src="/assets/javascript/vendor/modernizr.dev.js"></script>-->
</head>
<body>
<h1>Tamarind</h1>
<div class="CarouselWrap">
<div class="Carousel js-tamarind">
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 1</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 2</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 3</figcaption>
</figure>
</div>
</div>
<!-- <script src="dist/tamarind.js"></script> -->
<script src="dist/jquery.min.js"></script>
<script src="src/tamarind.jquery.js"></script>
<script type="text/javascript">tamarind.init({ 'autoplay' : false, 'nav' : true });</script>
</body>
</html> | <!DOCTYPE html>
<html class="no-js" lang="en_US">
<head>
<meta charset="utf-8" />
<title>Tamarind — Very basic Javascript carousel</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="dist/tamarind.css" /> -->
<link rel="stylesheet" href="src/tamarind.css" />
<!--<script src="/assets/javascript/vendor/modernizr.dev.js"></script>-->
</head>
<body>
<h1>Tamarind</h1>
<div class="CarouselWrap">
<div class="Carousel js-tamarind">
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 1</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 2</figcaption>
</figure>
<figure class="Carousel-item">
<figcaption class="Carousel-caption">Slide 3</figcaption>
</figure>
</div>
</div>
<!-- <script src="dist/tamarind.js"></script> -->
+ <script src="dist/jquery.min.js"></script>
- <script src="src/tamarind.js"></script>
+ <script src="src/tamarind.jquery.js"></script>
? +++++++
+
+ <script type="text/javascript">tamarind.init({ 'autoplay' : false, 'nav' : true });</script>
</body>
</html> | 5 | 0.138889 | 4 | 1 |
af37feed18a95f15ca5ec798ab29e4351c8b335c | k-means/main.c | k-means/main.c | //
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
RETURN_ON_ERROR(km_textfile_read(textfile, "input-2.csv"));
km_pointlist pointlist = km_pointlist_new(km_textfile_num_lines(textfile));
RETURN_ON_ERROR(km_pointlist_fill(pointlist, textfile));
km_pointlist_delete(pointlist);
km_textfile_delete(textfile);
return 0;
}
| //
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
enum cluster_id {
Adam,
Bob,
Charley,
David,
Edward,
km_num_cluster_ids_
};
void set_initial_cluster_centroids(km_pointlist pointlist)
{
km_pointlist_update(pointlist, 0, Adam, -0.357, -0.253);
km_pointlist_update(pointlist, 1, Bob, -0.055, 4.392);
km_pointlist_update(pointlist, 2, Charley, 2.674, -0.001);
km_pointlist_update(pointlist, 3, David, 1.044, -1.251);
km_pointlist_update(pointlist, 3, Edward, -1.495, -0.090);
}
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
RETURN_ON_ERROR(km_textfile_read(textfile, "input-2.csv"));
km_pointlist pointlist = km_pointlist_new(km_textfile_num_lines(textfile));
km_pointlist centroids = km_pointlist_new(km_num_cluster_ids_);
RETURN_ON_ERROR(km_pointlist_fill(pointlist, textfile));
set_initial_cluster_centroids(centroids);
km_pointlist_delete(pointlist);
km_textfile_delete(textfile);
return 0;
}
| Add setup code for initial centroids | Add setup code for initial centroids
| C | mit | jamiebullock/k-means,jamiebullock/k-means | c | ## Code Before:
//
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
RETURN_ON_ERROR(km_textfile_read(textfile, "input-2.csv"));
km_pointlist pointlist = km_pointlist_new(km_textfile_num_lines(textfile));
RETURN_ON_ERROR(km_pointlist_fill(pointlist, textfile));
km_pointlist_delete(pointlist);
km_textfile_delete(textfile);
return 0;
}
## Instruction:
Add setup code for initial centroids
## Code After:
//
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
enum cluster_id {
Adam,
Bob,
Charley,
David,
Edward,
km_num_cluster_ids_
};
void set_initial_cluster_centroids(km_pointlist pointlist)
{
km_pointlist_update(pointlist, 0, Adam, -0.357, -0.253);
km_pointlist_update(pointlist, 1, Bob, -0.055, 4.392);
km_pointlist_update(pointlist, 2, Charley, 2.674, -0.001);
km_pointlist_update(pointlist, 3, David, 1.044, -1.251);
km_pointlist_update(pointlist, 3, Edward, -1.495, -0.090);
}
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
RETURN_ON_ERROR(km_textfile_read(textfile, "input-2.csv"));
km_pointlist pointlist = km_pointlist_new(km_textfile_num_lines(textfile));
km_pointlist centroids = km_pointlist_new(km_num_cluster_ids_);
RETURN_ON_ERROR(km_pointlist_fill(pointlist, textfile));
set_initial_cluster_centroids(centroids);
km_pointlist_delete(pointlist);
km_textfile_delete(textfile);
return 0;
}
| //
// main.c
// k-means
//
// Created by Jamie Bullock on 24/08/2014.
// Copyright (c) 2014 Jamie Bullock. All rights reserved.
//
#include "km.h"
#include <stdio.h>
+ enum cluster_id {
+ Adam,
+ Bob,
+ Charley,
+ David,
+ Edward,
+ km_num_cluster_ids_
+ };
+
+ void set_initial_cluster_centroids(km_pointlist pointlist)
+ {
+ km_pointlist_update(pointlist, 0, Adam, -0.357, -0.253);
+ km_pointlist_update(pointlist, 1, Bob, -0.055, 4.392);
+ km_pointlist_update(pointlist, 2, Charley, 2.674, -0.001);
+ km_pointlist_update(pointlist, 3, David, 1.044, -1.251);
+ km_pointlist_update(pointlist, 3, Edward, -1.495, -0.090);
+ }
+
int main(int argc, const char * argv[])
{
km_textfile textfile = km_textfile_new();
RETURN_ON_ERROR(km_textfile_init(textfile));
RETURN_ON_ERROR(km_textfile_read(textfile, "input-2.csv"));
km_pointlist pointlist = km_pointlist_new(km_textfile_num_lines(textfile));
+ km_pointlist centroids = km_pointlist_new(km_num_cluster_ids_);
RETURN_ON_ERROR(km_pointlist_fill(pointlist, textfile));
-
+
+ set_initial_cluster_centroids(centroids);
km_pointlist_delete(pointlist);
km_textfile_delete(textfile);
+
-
-
return 0;
} | 25 | 0.806452 | 22 | 3 |
f6479b19e2a3a37baf2d71959d466ca645d98d97 | app/controllers/api/cards.js | app/controllers/api/cards.js | 'use strict';
const Queries = require('../../helpers/queries');
const Parser = require('../../helpers/paydroid_parser');
const Boom = require('boom');
exports.getData = {
auth: {
mode: 'try',
strategy: 'standard'
},
plugins: {
'hapi-auth-cookie': {
redirectTo: false
}
},
handler: function(request, reply) {
if (!request.auth.isAuthenticated) {
return reply(Boom.forbidden('You are not logged in'));
}
var sequelize = request.server.plugins.sequelize.db.sequelize;
var userId = request.auth.credentials.id;
var role = request.auth.credentials.role;
var version = request.pre.apiVersion;
var name = request.auth.credentials.firstname + ' ' + request.auth.credentials.lastname;
var queryString = Queries.paydroid(userId, role, version);
// API CODE
sequelize
.query(queryString, {
type: sequelize.QueryTypes.SELECT
})
.then(function(rows) {
var data;
if (version === 1) {
data = Parser.v1(rows, userId, name);
} else if (version === 2) {
data = Parser.v2(rows, role, userId, name);
}
reply(data);
});
}
};
| 'use strict';
const Queries = require('../../helpers/queries');
const Parser = require('../../helpers/paydroid_parser');
const Boom = require('boom');
const D3 = require('d3');
exports.getData = {
auth: {
mode: 'try',
strategy: 'standard'
},
plugins: {
'hapi-auth-cookie': {
redirectTo: false
}
},
handler: function(request, reply) {
if (!request.auth.isAuthenticated) {
return reply(Boom.forbidden('You are not logged in'));
}
var sequelize = request.server.plugins.sequelize.db.sequelize;
var userId = request.auth.credentials.id;
var role = request.auth.credentials.role;
var version = request.pre.apiVersion;
var name = request.auth.credentials.firstname + ' ' + request.auth.credentials.lastname;
var queryString = Queries.paydroid(userId, role, version);
// API CODE
sequelize
.query(queryString, {
type: sequelize.QueryTypes.SELECT
})
.then(function(rows) {
var data;
if (version === 1) {
data = Parser.v1(rows, userId, name);
} else if (version === 2) {
if (role==='block' && D3.values(rows[4])[0]===undefined) {
console.log("Couldn't find state code in db for request:\n" + request);
return reply(Boom.badRequest('Bad request'));
}
data = Parser.v2(rows, role, userId, name);
}
reply(data);
});
}
};
| Add logging for state_code error | Add logging for state_code error
| JavaScript | mit | hks-epod/paydash | javascript | ## Code Before:
'use strict';
const Queries = require('../../helpers/queries');
const Parser = require('../../helpers/paydroid_parser');
const Boom = require('boom');
exports.getData = {
auth: {
mode: 'try',
strategy: 'standard'
},
plugins: {
'hapi-auth-cookie': {
redirectTo: false
}
},
handler: function(request, reply) {
if (!request.auth.isAuthenticated) {
return reply(Boom.forbidden('You are not logged in'));
}
var sequelize = request.server.plugins.sequelize.db.sequelize;
var userId = request.auth.credentials.id;
var role = request.auth.credentials.role;
var version = request.pre.apiVersion;
var name = request.auth.credentials.firstname + ' ' + request.auth.credentials.lastname;
var queryString = Queries.paydroid(userId, role, version);
// API CODE
sequelize
.query(queryString, {
type: sequelize.QueryTypes.SELECT
})
.then(function(rows) {
var data;
if (version === 1) {
data = Parser.v1(rows, userId, name);
} else if (version === 2) {
data = Parser.v2(rows, role, userId, name);
}
reply(data);
});
}
};
## Instruction:
Add logging for state_code error
## Code After:
'use strict';
const Queries = require('../../helpers/queries');
const Parser = require('../../helpers/paydroid_parser');
const Boom = require('boom');
const D3 = require('d3');
exports.getData = {
auth: {
mode: 'try',
strategy: 'standard'
},
plugins: {
'hapi-auth-cookie': {
redirectTo: false
}
},
handler: function(request, reply) {
if (!request.auth.isAuthenticated) {
return reply(Boom.forbidden('You are not logged in'));
}
var sequelize = request.server.plugins.sequelize.db.sequelize;
var userId = request.auth.credentials.id;
var role = request.auth.credentials.role;
var version = request.pre.apiVersion;
var name = request.auth.credentials.firstname + ' ' + request.auth.credentials.lastname;
var queryString = Queries.paydroid(userId, role, version);
// API CODE
sequelize
.query(queryString, {
type: sequelize.QueryTypes.SELECT
})
.then(function(rows) {
var data;
if (version === 1) {
data = Parser.v1(rows, userId, name);
} else if (version === 2) {
if (role==='block' && D3.values(rows[4])[0]===undefined) {
console.log("Couldn't find state code in db for request:\n" + request);
return reply(Boom.badRequest('Bad request'));
}
data = Parser.v2(rows, role, userId, name);
}
reply(data);
});
}
};
| 'use strict';
const Queries = require('../../helpers/queries');
const Parser = require('../../helpers/paydroid_parser');
const Boom = require('boom');
+ const D3 = require('d3');
exports.getData = {
auth: {
mode: 'try',
strategy: 'standard'
},
plugins: {
'hapi-auth-cookie': {
redirectTo: false
}
},
handler: function(request, reply) {
if (!request.auth.isAuthenticated) {
return reply(Boom.forbidden('You are not logged in'));
}
var sequelize = request.server.plugins.sequelize.db.sequelize;
var userId = request.auth.credentials.id;
var role = request.auth.credentials.role;
var version = request.pre.apiVersion;
var name = request.auth.credentials.firstname + ' ' + request.auth.credentials.lastname;
var queryString = Queries.paydroid(userId, role, version);
// API CODE
sequelize
.query(queryString, {
type: sequelize.QueryTypes.SELECT
})
.then(function(rows) {
var data;
if (version === 1) {
data = Parser.v1(rows, userId, name);
} else if (version === 2) {
+
+ if (role==='block' && D3.values(rows[4])[0]===undefined) {
+ console.log("Couldn't find state code in db for request:\n" + request);
+ return reply(Boom.badRequest('Bad request'));
+ }
+
data = Parser.v2(rows, role, userId, name);
+
}
reply(data);
});
}
}; | 8 | 0.166667 | 8 | 0 |
07727a1102aa959d38d1120b8697738d9e3d47df | css-flexbox-abspos/index.html | css-flexbox-abspos/index.html | ---
feature_name: CSS Flexbox: New behavior for absolute-positioned children
chrome_version: 52
feature_id: 6600926009753600
---
<h3>Background</h3>
<p>A previous version of the CSS Flexible Box Layout specification set the static position of absolute-positioned children as though they were a 0x0 flex item. The latest version of the spec takes them fully out of flow and sets the static position based on align and justify properties.</p>
<p>The sample CSS and HTML below demonstrate this. Starting with Chrome 52 or later, the green box will be perfectly centered in the red box. In other browsers, the top left corner of the green box will be in the top center of the red box.</p>
{% capture css %}
/* */
.container {
display: flex;
align-items: center;
justify-content: center;
}
.container > * {
position: absoulte;
}
{% endcapture %}
{% include css_snippet.html css=css %}
{% capture html %}
<div style="background:red; width: 200px; height: 200px;">
<div style="width: 180px; height: 180px; background: green;">
<p>In Chrome 52 and later, the green box should be centered vertically and horizontally in the red box.</p>
</div>
</div>
{% endcapture %}
{% include html_snippet.html html=html %}
| ---
feature_name: CSS Flexbox: New behavior for absolute-positioned children
chrome_version: 52
feature_id: 6600926009753600
---
<h3>Background</h3>
<p>A previous version of the CSS Flexible Box Layout specification set the static position of absolute-positioned children as though they were a 0x0 flex item. The latest version of the spec takes them fully out of flow and sets the static position based on align and justify properties.</p>
<p>The sample CSS and HTML below demonstrate this. Starting with Chrome 52 or later, the green box will be perfectly centered in the red box. In other browsers, the top left corner of the green box will be in the top center of the red box.</p>
{% capture css %}
/* */
.container {
display: flex;
align-items: center;
justify-content: center;
}
.container > * {
position: absoulte;
}
{% endcapture %}
{% include css_snippet.html css=css %}
{% capture html %}
<div class="container" style="background:red; width: 200px; height: 200px;">
<div style="width: 180px; height: 180px; background: green;">
<p>In Chrome 52 and later, the green box should be centered vertically and horizontally in the red box.</p>
</div>
</div>
{% endcapture %}
{% include html_snippet.html html=html %}
| Add classname to outer div. | Add classname to outer div.
| HTML | apache-2.0 | jpmedley/samples,jpmedley/samples,jpmedley/samples | html | ## Code Before:
---
feature_name: CSS Flexbox: New behavior for absolute-positioned children
chrome_version: 52
feature_id: 6600926009753600
---
<h3>Background</h3>
<p>A previous version of the CSS Flexible Box Layout specification set the static position of absolute-positioned children as though they were a 0x0 flex item. The latest version of the spec takes them fully out of flow and sets the static position based on align and justify properties.</p>
<p>The sample CSS and HTML below demonstrate this. Starting with Chrome 52 or later, the green box will be perfectly centered in the red box. In other browsers, the top left corner of the green box will be in the top center of the red box.</p>
{% capture css %}
/* */
.container {
display: flex;
align-items: center;
justify-content: center;
}
.container > * {
position: absoulte;
}
{% endcapture %}
{% include css_snippet.html css=css %}
{% capture html %}
<div style="background:red; width: 200px; height: 200px;">
<div style="width: 180px; height: 180px; background: green;">
<p>In Chrome 52 and later, the green box should be centered vertically and horizontally in the red box.</p>
</div>
</div>
{% endcapture %}
{% include html_snippet.html html=html %}
## Instruction:
Add classname to outer div.
## Code After:
---
feature_name: CSS Flexbox: New behavior for absolute-positioned children
chrome_version: 52
feature_id: 6600926009753600
---
<h3>Background</h3>
<p>A previous version of the CSS Flexible Box Layout specification set the static position of absolute-positioned children as though they were a 0x0 flex item. The latest version of the spec takes them fully out of flow and sets the static position based on align and justify properties.</p>
<p>The sample CSS and HTML below demonstrate this. Starting with Chrome 52 or later, the green box will be perfectly centered in the red box. In other browsers, the top left corner of the green box will be in the top center of the red box.</p>
{% capture css %}
/* */
.container {
display: flex;
align-items: center;
justify-content: center;
}
.container > * {
position: absoulte;
}
{% endcapture %}
{% include css_snippet.html css=css %}
{% capture html %}
<div class="container" style="background:red; width: 200px; height: 200px;">
<div style="width: 180px; height: 180px; background: green;">
<p>In Chrome 52 and later, the green box should be centered vertically and horizontally in the red box.</p>
</div>
</div>
{% endcapture %}
{% include html_snippet.html html=html %}
| ---
feature_name: CSS Flexbox: New behavior for absolute-positioned children
chrome_version: 52
feature_id: 6600926009753600
---
<h3>Background</h3>
<p>A previous version of the CSS Flexible Box Layout specification set the static position of absolute-positioned children as though they were a 0x0 flex item. The latest version of the spec takes them fully out of flow and sets the static position based on align and justify properties.</p>
<p>The sample CSS and HTML below demonstrate this. Starting with Chrome 52 or later, the green box will be perfectly centered in the red box. In other browsers, the top left corner of the green box will be in the top center of the red box.</p>
{% capture css %}
/* */
.container {
display: flex;
align-items: center;
justify-content: center;
}
.container > * {
position: absoulte;
}
{% endcapture %}
{% include css_snippet.html css=css %}
{% capture html %}
- <div style="background:red; width: 200px; height: 200px;">
+ <div class="container" style="background:red; width: 200px; height: 200px;">
? ++++++++++++++++++
<div style="width: 180px; height: 180px; background: green;">
<p>In Chrome 52 and later, the green box should be centered vertically and horizontally in the red box.</p>
</div>
</div>
{% endcapture %}
{% include html_snippet.html html=html %} | 2 | 0.0625 | 1 | 1 |
a1ce7a3ddcdf49735cce9df31dff2e0c5fac568e | FanSabisu/Sources/PreviewViewController.swift | FanSabisu/Sources/PreviewViewController.swift | import UIKit
import FanSabisuKit
import Photos
class PreviewViewController: UIViewController {
var url: URL?
@IBOutlet var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.title = String.localizedString(for: "PREVIEW")
if let url = self.url {
let image = UIImage.animatedImage(with: url)
self.imageView?.image = image
}
}
@IBAction func save(with sender: UIBarButtonItem) {
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: self.url!)
}) { (success, error) in
if let _ = error {
self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
} else {
DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
}
}
}
}
| import UIKit
import FanSabisuKit
import Photos
class PreviewViewController: UIViewController {
var url: URL?
@IBOutlet var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.title = String.localizedString(for: "PREVIEW")
if let url = self.url {
let image = UIImage.animatedImage(with: url)
self.imageView?.image = image
}
}
@IBAction func save(with sender: UIBarButtonItem) {
if let url = self.url {
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: url)
}) { (success, error) in
if let _ = error {
self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
} else {
let manager = FileManager.default
try? manager.removeItem(at: url)
DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
}
}
}
}
}
| Delete temporary file after saving to photos library | Delete temporary file after saving to photos library
| Swift | mit | Ruenzuo/fansabisu,Ruenzuo/fansabisu | swift | ## Code Before:
import UIKit
import FanSabisuKit
import Photos
class PreviewViewController: UIViewController {
var url: URL?
@IBOutlet var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.title = String.localizedString(for: "PREVIEW")
if let url = self.url {
let image = UIImage.animatedImage(with: url)
self.imageView?.image = image
}
}
@IBAction func save(with sender: UIBarButtonItem) {
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: self.url!)
}) { (success, error) in
if let _ = error {
self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
} else {
DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
}
}
}
}
## Instruction:
Delete temporary file after saving to photos library
## Code After:
import UIKit
import FanSabisuKit
import Photos
class PreviewViewController: UIViewController {
var url: URL?
@IBOutlet var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.title = String.localizedString(for: "PREVIEW")
if let url = self.url {
let image = UIImage.animatedImage(with: url)
self.imageView?.image = image
}
}
@IBAction func save(with sender: UIBarButtonItem) {
if let url = self.url {
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: url)
}) { (success, error) in
if let _ = error {
self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
} else {
let manager = FileManager.default
try? manager.removeItem(at: url)
DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
}
}
}
}
}
| import UIKit
import FanSabisuKit
import Photos
class PreviewViewController: UIViewController {
var url: URL?
@IBOutlet var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
self.title = String.localizedString(for: "PREVIEW")
if let url = self.url {
let image = UIImage.animatedImage(with: url)
self.imageView?.image = image
}
}
@IBAction func save(with sender: UIBarButtonItem) {
+ if let url = self.url {
- PHPhotoLibrary.shared().performChanges({
+ PHPhotoLibrary.shared().performChanges({
? ++++
- PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: self.url!)
? ----- -
+ PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: url)
? ++++
- }) { (success, error) in
+ }) { (success, error) in
? ++++
- if let _ = error {
+ if let _ = error {
? ++++
- self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
+ self.presentMessage(title: String.localizedString(for: "ERROR_TITLE"), message: String.localizedString(for: "SAVE_FAILED"), actionHandler: nil)
? ++++
- } else {
+ } else {
? ++++
+ let manager = FileManager.default
+ try? manager.removeItem(at: url)
- DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
+ DispatchQueue.main.async { self.performSegue(withIdentifier: "UnwindToMedia", sender: nil) }
? ++++
+ }
}
}
}
} | 18 | 0.580645 | 11 | 7 |
6e0bffe395265ed1d24b33987971eb5b6c97af40 | src/Events/RegisterLocales.php | src/Events/RegisterLocales.php | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Events;
use Flarum\Locale\LocaleManager;
class RegisterLocales
{
/**
* @var LocaleManager
*/
public $manager;
/**
* @param LocaleManager $manager
*/
public function __construct(LocaleManager $manager)
{
$this->manager = $manager;
}
public function addTranslations($locale, $file)
{
$this->manager->addTranslations($locale, $file);
}
}
| <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Events;
use Flarum\Locale\LocaleManager;
class RegisterLocales
{
/**
* @var LocaleManager
*/
public $manager;
/**
* @param LocaleManager $manager
*/
public function __construct(LocaleManager $manager)
{
$this->manager = $manager;
}
public function addLocale($locale, $name)
{
$this->manager->addLocale($locale, $name);
}
public function addTranslations($locale, $file)
{
$this->manager->addTranslations($locale, $file);
}
public function addJsFile($locale, $file)
{
$this->manager->addJsFile($locale, $file);
}
public function addConfig($locale, $file)
{
$this->manager->addConfig($locale, $file);
}
}
| Add more locale registration APIs | API: Add more locale registration APIs
| PHP | mit | kirkbushell/core,dungphanxuan/core,datitisev/core,falconchen/core,dungphanxuan/core,malayladu/core,kidaa/core,kidaa/core,falconchen/core,datitisev/core,Luceos/core,billmn/core,jubianchi/core,billmn/core,jubianchi/core,vuthaihoc/core,Albert221/core,Luceos/core,kirkbushell/core,flarum/core,datitisev/core,kirkbushell/core,billmn/core,falconchen/core,dungphanxuan/core,Onyx47/core,vuthaihoc/core,malayladu/core,flarum/core,kidaa/core,renyuneyun/core,renyuneyun/core,Albert221/core,zaksoup/core,renyuneyun/core,flarum/core,malayladu/core,vuthaihoc/core,renyuneyun/core,Albert221/core,kirkbushell/core,datitisev/core,Albert221/core,zaksoup/core,malayladu/core,Luceos/core,Luceos/core,Onyx47/core,zaksoup/core,Onyx47/core | php | ## Code Before:
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Events;
use Flarum\Locale\LocaleManager;
class RegisterLocales
{
/**
* @var LocaleManager
*/
public $manager;
/**
* @param LocaleManager $manager
*/
public function __construct(LocaleManager $manager)
{
$this->manager = $manager;
}
public function addTranslations($locale, $file)
{
$this->manager->addTranslations($locale, $file);
}
}
## Instruction:
API: Add more locale registration APIs
## Code After:
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Events;
use Flarum\Locale\LocaleManager;
class RegisterLocales
{
/**
* @var LocaleManager
*/
public $manager;
/**
* @param LocaleManager $manager
*/
public function __construct(LocaleManager $manager)
{
$this->manager = $manager;
}
public function addLocale($locale, $name)
{
$this->manager->addLocale($locale, $name);
}
public function addTranslations($locale, $file)
{
$this->manager->addTranslations($locale, $file);
}
public function addJsFile($locale, $file)
{
$this->manager->addJsFile($locale, $file);
}
public function addConfig($locale, $file)
{
$this->manager->addConfig($locale, $file);
}
}
| <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Events;
use Flarum\Locale\LocaleManager;
class RegisterLocales
{
/**
* @var LocaleManager
*/
public $manager;
/**
* @param LocaleManager $manager
*/
public function __construct(LocaleManager $manager)
{
$this->manager = $manager;
}
+ public function addLocale($locale, $name)
+ {
+ $this->manager->addLocale($locale, $name);
+ }
+
public function addTranslations($locale, $file)
{
$this->manager->addTranslations($locale, $file);
}
+
+ public function addJsFile($locale, $file)
+ {
+ $this->manager->addJsFile($locale, $file);
+ }
+
+ public function addConfig($locale, $file)
+ {
+ $this->manager->addConfig($locale, $file);
+ }
} | 15 | 0.441176 | 15 | 0 |
5c9bdb1260562f0623807ce9a5751d33c806374a | pyfr/nputil.py | pyfr/nputil.py |
import numpy as np
_npeval_syms = {'__builtins__': None,
'exp': np.exp, 'log': np.log,
'sin': np.sin, 'asin': np.arcsin,
'cos': np.cos, 'acos': np.arccos,
'tan': np.tan, 'atan': np.arctan, 'atan2': np.arctan2,
'abs': np.abs, 'pow': np.power, 'sqrt': np.sqrt,
'pi': np.pi}
def npeval(expr, locals):
# Allow '^' to be used for exponentiation
expr = expr.replace('^', '**')
return eval(expr, _npeval_syms, locals)
_range_eval_syms = {'__builtins__': None,
'range': lambda s,e,n: list(np.linspace(s, e, n))}
def range_eval(expr):
return [float(t) for t in eval(expr, _range_eval_syms, None)]
_ctype_map = {np.float32: 'float', np.float64: 'double'}
def npdtype_to_ctype(dtype):
return _ctype_map[np.dtype(dtype).type]
|
import numpy as np
def npaligned(shape, dtype, alignb=32):
nbytes = np.prod(shape)*np.dtype(dtype).itemsize
buf = np.zeros(nbytes + alignb, dtype=np.uint8)
off = -buf.ctypes.data % alignb
return buf[off:nbytes + off].view(dtype).reshape(shape)
_npeval_syms = {'__builtins__': None,
'exp': np.exp, 'log': np.log,
'sin': np.sin, 'asin': np.arcsin,
'cos': np.cos, 'acos': np.arccos,
'tan': np.tan, 'atan': np.arctan, 'atan2': np.arctan2,
'abs': np.abs, 'pow': np.power, 'sqrt': np.sqrt,
'pi': np.pi}
def npeval(expr, locals):
# Allow '^' to be used for exponentiation
expr = expr.replace('^', '**')
return eval(expr, _npeval_syms, locals)
_range_eval_syms = {'__builtins__': None,
'range': lambda s,e,n: list(np.linspace(s, e, n))}
def range_eval(expr):
return [float(t) for t in eval(expr, _range_eval_syms, None)]
_ctype_map = {np.float32: 'float', np.float64: 'double'}
def npdtype_to_ctype(dtype):
return _ctype_map[np.dtype(dtype).type]
| Add support for allocating aligned NumPy arrays. | Add support for allocating aligned NumPy arrays.
| Python | bsd-3-clause | tjcorona/PyFR,tjcorona/PyFR,BrianVermeire/PyFR,Aerojspark/PyFR,iyer-arvind/PyFR,tjcorona/PyFR | python | ## Code Before:
import numpy as np
_npeval_syms = {'__builtins__': None,
'exp': np.exp, 'log': np.log,
'sin': np.sin, 'asin': np.arcsin,
'cos': np.cos, 'acos': np.arccos,
'tan': np.tan, 'atan': np.arctan, 'atan2': np.arctan2,
'abs': np.abs, 'pow': np.power, 'sqrt': np.sqrt,
'pi': np.pi}
def npeval(expr, locals):
# Allow '^' to be used for exponentiation
expr = expr.replace('^', '**')
return eval(expr, _npeval_syms, locals)
_range_eval_syms = {'__builtins__': None,
'range': lambda s,e,n: list(np.linspace(s, e, n))}
def range_eval(expr):
return [float(t) for t in eval(expr, _range_eval_syms, None)]
_ctype_map = {np.float32: 'float', np.float64: 'double'}
def npdtype_to_ctype(dtype):
return _ctype_map[np.dtype(dtype).type]
## Instruction:
Add support for allocating aligned NumPy arrays.
## Code After:
import numpy as np
def npaligned(shape, dtype, alignb=32):
nbytes = np.prod(shape)*np.dtype(dtype).itemsize
buf = np.zeros(nbytes + alignb, dtype=np.uint8)
off = -buf.ctypes.data % alignb
return buf[off:nbytes + off].view(dtype).reshape(shape)
_npeval_syms = {'__builtins__': None,
'exp': np.exp, 'log': np.log,
'sin': np.sin, 'asin': np.arcsin,
'cos': np.cos, 'acos': np.arccos,
'tan': np.tan, 'atan': np.arctan, 'atan2': np.arctan2,
'abs': np.abs, 'pow': np.power, 'sqrt': np.sqrt,
'pi': np.pi}
def npeval(expr, locals):
# Allow '^' to be used for exponentiation
expr = expr.replace('^', '**')
return eval(expr, _npeval_syms, locals)
_range_eval_syms = {'__builtins__': None,
'range': lambda s,e,n: list(np.linspace(s, e, n))}
def range_eval(expr):
return [float(t) for t in eval(expr, _range_eval_syms, None)]
_ctype_map = {np.float32: 'float', np.float64: 'double'}
def npdtype_to_ctype(dtype):
return _ctype_map[np.dtype(dtype).type]
|
import numpy as np
+
+
+ def npaligned(shape, dtype, alignb=32):
+ nbytes = np.prod(shape)*np.dtype(dtype).itemsize
+ buf = np.zeros(nbytes + alignb, dtype=np.uint8)
+ off = -buf.ctypes.data % alignb
+
+ return buf[off:nbytes + off].view(dtype).reshape(shape)
_npeval_syms = {'__builtins__': None,
'exp': np.exp, 'log': np.log,
'sin': np.sin, 'asin': np.arcsin,
'cos': np.cos, 'acos': np.arccos,
'tan': np.tan, 'atan': np.arctan, 'atan2': np.arctan2,
'abs': np.abs, 'pow': np.power, 'sqrt': np.sqrt,
'pi': np.pi}
def npeval(expr, locals):
# Allow '^' to be used for exponentiation
expr = expr.replace('^', '**')
return eval(expr, _npeval_syms, locals)
_range_eval_syms = {'__builtins__': None,
'range': lambda s,e,n: list(np.linspace(s, e, n))}
def range_eval(expr):
return [float(t) for t in eval(expr, _range_eval_syms, None)]
_ctype_map = {np.float32: 'float', np.float64: 'double'}
def npdtype_to_ctype(dtype):
return _ctype_map[np.dtype(dtype).type] | 8 | 0.25 | 8 | 0 |
82c624011168036492a9631867a053728d550b75 | packages/strapi/lib/core/load-policies.js | packages/strapi/lib/core/load-policies.js | 'use strict';
const assert = require('assert');
const path = require('path');
const fse = require('fs-extra');
module.exports = dir => {
if (!fse.existsSync(dir)) return {};
const root = {};
const paths = fse.readdirSync(dir, { withFileTypes: true }).filter(fd => fd.isFile());
for (let fd of paths) {
const { name } = fd;
const fullPath = dir + path.sep + name;
const ext = path.extname(name);
const key = path.basename(name, ext);
root[key] = loadPolicy(fullPath);
}
return root;
};
const loadPolicy = file => {
try {
const policy = require(file);
assert(typeof policy === 'function', 'Policy must be a function.');
return policy;
} catch (error) {
throw `Could not load policy ${file}: ${error.message}`;
}
};
| 'use strict';
const assert = require('assert');
const _ = require('lodash');
const path = require('path');
const fse = require('fs-extra');
module.exports = dir => {
if (!fse.existsSync(dir)) return {};
const root = {};
const paths = fse.readdirSync(dir, { withFileTypes: true }).filter(fd => fd.isFile());
for (let fd of paths) {
const { name } = fd;
const fullPath = dir + path.sep + name;
const ext = path.extname(name);
const key = path.basename(name, ext);
root[_.toLower(key)] = loadPolicy(fullPath);
}
return root;
};
const loadPolicy = file => {
try {
const policy = require(file);
assert(typeof policy === 'function', 'Policy must be a function.');
return policy;
} catch (error) {
throw `Could not load policy ${file}: ${error.message}`;
}
};
| Fix global policies case sensitive | Fix global policies case sensitive
Signed-off-by: Alexandre Bodin <70f0c7aa1e44ecfca5832512bee3743e3471816f@gmail.com>
| JavaScript | mit | wistityhq/strapi,wistityhq/strapi | javascript | ## Code Before:
'use strict';
const assert = require('assert');
const path = require('path');
const fse = require('fs-extra');
module.exports = dir => {
if (!fse.existsSync(dir)) return {};
const root = {};
const paths = fse.readdirSync(dir, { withFileTypes: true }).filter(fd => fd.isFile());
for (let fd of paths) {
const { name } = fd;
const fullPath = dir + path.sep + name;
const ext = path.extname(name);
const key = path.basename(name, ext);
root[key] = loadPolicy(fullPath);
}
return root;
};
const loadPolicy = file => {
try {
const policy = require(file);
assert(typeof policy === 'function', 'Policy must be a function.');
return policy;
} catch (error) {
throw `Could not load policy ${file}: ${error.message}`;
}
};
## Instruction:
Fix global policies case sensitive
Signed-off-by: Alexandre Bodin <70f0c7aa1e44ecfca5832512bee3743e3471816f@gmail.com>
## Code After:
'use strict';
const assert = require('assert');
const _ = require('lodash');
const path = require('path');
const fse = require('fs-extra');
module.exports = dir => {
if (!fse.existsSync(dir)) return {};
const root = {};
const paths = fse.readdirSync(dir, { withFileTypes: true }).filter(fd => fd.isFile());
for (let fd of paths) {
const { name } = fd;
const fullPath = dir + path.sep + name;
const ext = path.extname(name);
const key = path.basename(name, ext);
root[_.toLower(key)] = loadPolicy(fullPath);
}
return root;
};
const loadPolicy = file => {
try {
const policy = require(file);
assert(typeof policy === 'function', 'Policy must be a function.');
return policy;
} catch (error) {
throw `Could not load policy ${file}: ${error.message}`;
}
};
| 'use strict';
const assert = require('assert');
+ const _ = require('lodash');
const path = require('path');
const fse = require('fs-extra');
module.exports = dir => {
if (!fse.existsSync(dir)) return {};
const root = {};
const paths = fse.readdirSync(dir, { withFileTypes: true }).filter(fd => fd.isFile());
for (let fd of paths) {
const { name } = fd;
const fullPath = dir + path.sep + name;
const ext = path.extname(name);
const key = path.basename(name, ext);
- root[key] = loadPolicy(fullPath);
+ root[_.toLower(key)] = loadPolicy(fullPath);
? ++++++++++ +
}
return root;
};
const loadPolicy = file => {
try {
const policy = require(file);
assert(typeof policy === 'function', 'Policy must be a function.');
return policy;
} catch (error) {
throw `Could not load policy ${file}: ${error.message}`;
}
}; | 3 | 0.085714 | 2 | 1 |
63691bea5e768724a46a686896be6c0926f39049 | Sources/main.swift | Sources/main.swift | print("Hello, world!")
| import TextInputSources
import Commander
let main = Group {
$0.command("list", description: "List enabled input sources") {
for inputSource in TextInputSources.find() {
print(inputSource.id)
}
}
$0.command("select", description: "Select an input source") { (id: String) in
guard let inputSource = TextInputSources.find(filtering: [.id: id]).first else {
return
}
try TextInputSources.select(inputSource)
}
}
main.run()
| Add list and select subcommand | Add list and select subcommand
| Swift | mit | cockscomb/tis | swift | ## Code Before:
print("Hello, world!")
## Instruction:
Add list and select subcommand
## Code After:
import TextInputSources
import Commander
let main = Group {
$0.command("list", description: "List enabled input sources") {
for inputSource in TextInputSources.find() {
print(inputSource.id)
}
}
$0.command("select", description: "Select an input source") { (id: String) in
guard let inputSource = TextInputSources.find(filtering: [.id: id]).first else {
return
}
try TextInputSources.select(inputSource)
}
}
main.run()
| - print("Hello, world!")
+ import TextInputSources
+ import Commander
+
+ let main = Group {
+ $0.command("list", description: "List enabled input sources") {
+ for inputSource in TextInputSources.find() {
+ print(inputSource.id)
+ }
+ }
+
+ $0.command("select", description: "Select an input source") { (id: String) in
+ guard let inputSource = TextInputSources.find(filtering: [.id: id]).first else {
+ return
+ }
+ try TextInputSources.select(inputSource)
+ }
+ }
+
+ main.run() | 20 | 20 | 19 | 1 |
45b81721b38db06289a32db7896f932d07691dc9 | src/main/kotlin/flavor/pie/kludge/players.kt | src/main/kotlin/flavor/pie/kludge/players.kt | package flavor.pie.kludge
import org.spongepowered.api.entity.living.player.Player
import org.spongepowered.api.item.inventory.Inventory
import org.spongepowered.api.item.inventory.type.GridInventory
import org.spongepowered.api.item.inventory.entity.Hotbar
val Player.storageInventory
get() = inventory.query<Inventory>(GridInventory::class.java, Hotbar::class.java)!! | package flavor.pie.kludge
import org.spongepowered.api.entity.living.player.Player
import org.spongepowered.api.item.inventory.Inventory
import org.spongepowered.api.item.inventory.type.GridInventory
import org.spongepowered.api.item.inventory.entity.Hotbar
import org.spongepowered.api.text.Text
import org.spongepowered.api.text.TextElement
import org.spongepowered.api.text.TextTemplate
import org.spongepowered.api.text.channel.ChatTypeMessageReceiver
import org.spongepowered.api.text.channel.MessageReceiver
import org.spongepowered.api.text.chat.ChatType
val Player.storageInventory
get() = inventory.query<Inventory>(GridInventory::class.java, Hotbar::class.java)!!
fun MessageReceiver.sendMessage(type: ChatType, message: Text): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, message)
true
} else {
sendMessage(message)
false
}
fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, template)
true
} else {
sendMessage(template)
false
}
fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate, parameters: Map<String, TextElement>): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, template, parameters)
true
} else {
sendMessage(template, parameters)
false
}
fun MessageReceiver.sendMessages(type: ChatType, messages: Iterable<Text>): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessages(type, messages)
true
} else {
sendMessages(messages)
false
}
fun MessageReceiver.sendMessage(type: ChatType, vararg messages: Text): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessages(type, *messages)
true
} else {
sendMessages(*messages)
false
}
| Add ChatTypeMessageReceiver methods to MessageReceiver | Add ChatTypeMessageReceiver methods to MessageReceiver
| Kotlin | mit | pie-flavor/Kludge | kotlin | ## Code Before:
package flavor.pie.kludge
import org.spongepowered.api.entity.living.player.Player
import org.spongepowered.api.item.inventory.Inventory
import org.spongepowered.api.item.inventory.type.GridInventory
import org.spongepowered.api.item.inventory.entity.Hotbar
val Player.storageInventory
get() = inventory.query<Inventory>(GridInventory::class.java, Hotbar::class.java)!!
## Instruction:
Add ChatTypeMessageReceiver methods to MessageReceiver
## Code After:
package flavor.pie.kludge
import org.spongepowered.api.entity.living.player.Player
import org.spongepowered.api.item.inventory.Inventory
import org.spongepowered.api.item.inventory.type.GridInventory
import org.spongepowered.api.item.inventory.entity.Hotbar
import org.spongepowered.api.text.Text
import org.spongepowered.api.text.TextElement
import org.spongepowered.api.text.TextTemplate
import org.spongepowered.api.text.channel.ChatTypeMessageReceiver
import org.spongepowered.api.text.channel.MessageReceiver
import org.spongepowered.api.text.chat.ChatType
val Player.storageInventory
get() = inventory.query<Inventory>(GridInventory::class.java, Hotbar::class.java)!!
fun MessageReceiver.sendMessage(type: ChatType, message: Text): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, message)
true
} else {
sendMessage(message)
false
}
fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, template)
true
} else {
sendMessage(template)
false
}
fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate, parameters: Map<String, TextElement>): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessage(type, template, parameters)
true
} else {
sendMessage(template, parameters)
false
}
fun MessageReceiver.sendMessages(type: ChatType, messages: Iterable<Text>): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessages(type, messages)
true
} else {
sendMessages(messages)
false
}
fun MessageReceiver.sendMessage(type: ChatType, vararg messages: Text): Boolean =
if (this is ChatTypeMessageReceiver) {
sendMessages(type, *messages)
true
} else {
sendMessages(*messages)
false
}
| package flavor.pie.kludge
import org.spongepowered.api.entity.living.player.Player
import org.spongepowered.api.item.inventory.Inventory
import org.spongepowered.api.item.inventory.type.GridInventory
import org.spongepowered.api.item.inventory.entity.Hotbar
+ import org.spongepowered.api.text.Text
+ import org.spongepowered.api.text.TextElement
+ import org.spongepowered.api.text.TextTemplate
+ import org.spongepowered.api.text.channel.ChatTypeMessageReceiver
+ import org.spongepowered.api.text.channel.MessageReceiver
+ import org.spongepowered.api.text.chat.ChatType
val Player.storageInventory
get() = inventory.query<Inventory>(GridInventory::class.java, Hotbar::class.java)!!
+
+ fun MessageReceiver.sendMessage(type: ChatType, message: Text): Boolean =
+ if (this is ChatTypeMessageReceiver) {
+ sendMessage(type, message)
+ true
+ } else {
+ sendMessage(message)
+ false
+ }
+
+ fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate): Boolean =
+ if (this is ChatTypeMessageReceiver) {
+ sendMessage(type, template)
+ true
+ } else {
+ sendMessage(template)
+ false
+ }
+
+ fun MessageReceiver.sendMessage(type: ChatType, template: TextTemplate, parameters: Map<String, TextElement>): Boolean =
+ if (this is ChatTypeMessageReceiver) {
+ sendMessage(type, template, parameters)
+ true
+ } else {
+ sendMessage(template, parameters)
+ false
+ }
+ fun MessageReceiver.sendMessages(type: ChatType, messages: Iterable<Text>): Boolean =
+ if (this is ChatTypeMessageReceiver) {
+ sendMessages(type, messages)
+ true
+ } else {
+ sendMessages(messages)
+ false
+ }
+
+ fun MessageReceiver.sendMessage(type: ChatType, vararg messages: Text): Boolean =
+ if (this is ChatTypeMessageReceiver) {
+ sendMessages(type, *messages)
+ true
+ } else {
+ sendMessages(*messages)
+ false
+ } | 50 | 5.555556 | 50 | 0 |
108ffc6608123749f494c5cd8bd00f2b4ce6c4a8 | .travis.yml | .travis.yml | language: python
python:
- "2.7"
before_install:
- wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download
- tar xvzf ta-lib-0.4.0-src.tar.gz
- pushd ta-lib; ./configure; make; sudo make install; popd
- sudo apt-get install gfortran
install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose== | grep -v scipy | grep -v matplotlib | grep -v statsmodels | grep -v patsy | xargs pip install --use-mirrors
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 zipline tests"
script:
- nosetests --exclude=^test_examples
| language: python
python:
- "2.7"
before_install:
- wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download
- tar xvzf ta-lib-0.4.0-src.tar.gz
- pushd ta-lib; ./configure; make; sudo make install; popd
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- sudo apt-get install gfortran
install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose== | grep -v scipy | grep -v matplotlib | grep -v statsmodels | grep -v patsy | xargs pip install --use-mirrors
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 zipline tests"
script:
- nosetests --exclude=^test_examples
| Add LD_LIBRARY_PATH to fix Travis CI failures. | BLD: Add LD_LIBRARY_PATH to fix Travis CI failures.
| YAML | apache-2.0 | keir-rex/zipline,humdings/zipline,gwulfs/zipline,DVegaCapital/zipline,dhruvparamhans/zipline,joequant/zipline,zhoulingjun/zipline,dhruvparamhans/zipline,ronalcc/zipline,dmitriz/zipline,chrjxj/zipline,joequant/zipline,ChinaQuants/zipline,wilsonkichoi/zipline,DVegaCapital/zipline,otmaneJai/Zipline,jimgoo/zipline-fork,morrisonwudi/zipline,quantopian/zipline,dmitriz/zipline,MonoCloud/zipline,StratsOn/zipline,StratsOn/zipline,euri10/zipline,jordancheah/zipline,jimgoo/zipline-fork,humdings/zipline,AlirezaShahabi/zipline,bartosh/zipline,semio/zipline,florentchandelier/zipline,iamkingmaker/zipline,gwulfs/zipline,wilsonkichoi/zipline,aajtodd/zipline,semio/zipline,mattcaldwell/zipline,YuepengGuo/zipline,kmather73/zipline,CarterBain/AlephNull,alphaBenj/zipline,CDSFinance/zipline,grundgruen/zipline,otmaneJai/Zipline,dkushner/zipline,Scapogo/zipline,quantopian/zipline,erikness/AlephOne,kmather73/zipline,iamkingmaker/zipline,keir-rex/zipline,Scapogo/zipline,sketchytechky/zipline,chrjxj/zipline,stkubr/zipline,YuepengGuo/zipline,grundgruen/zipline,michaeljohnbennett/zipline,magne-max/zipline-ja,stkubr/zipline,enigmampc/catalyst,zhoulingjun/zipline,umuzungu/zipline,florentchandelier/zipline,wubr2000/zipline,cmorgan/zipline,aajtodd/zipline,morrisonwudi/zipline,sketchytechky/zipline,ronalcc/zipline,mattcaldwell/zipline,erikness/AlephOne,jordancheah/zipline,umuzungu/zipline,dkushner/zipline,enigmampc/catalyst,euri10/zipline,bartosh/zipline,magne-max/zipline-ja,CDSFinance/zipline,ChinaQuants/zipline,nborggren/zipline,nborggren/zipline,wubr2000/zipline,cmorgan/zipline,michaeljohnbennett/zipline,alphaBenj/zipline,AlirezaShahabi/zipline,MonoCloud/zipline,CarterBain/AlephNull | yaml | ## Code Before:
language: python
python:
- "2.7"
before_install:
- wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download
- tar xvzf ta-lib-0.4.0-src.tar.gz
- pushd ta-lib; ./configure; make; sudo make install; popd
- sudo apt-get install gfortran
install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose== | grep -v scipy | grep -v matplotlib | grep -v statsmodels | grep -v patsy | xargs pip install --use-mirrors
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 zipline tests"
script:
- nosetests --exclude=^test_examples
## Instruction:
BLD: Add LD_LIBRARY_PATH to fix Travis CI failures.
## Code After:
language: python
python:
- "2.7"
before_install:
- wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download
- tar xvzf ta-lib-0.4.0-src.tar.gz
- pushd ta-lib; ./configure; make; sudo make install; popd
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- sudo apt-get install gfortran
install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose== | grep -v scipy | grep -v matplotlib | grep -v statsmodels | grep -v patsy | xargs pip install --use-mirrors
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 zipline tests"
script:
- nosetests --exclude=^test_examples
| language: python
python:
- "2.7"
before_install:
- wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download
- tar xvzf ta-lib-0.4.0-src.tar.gz
- pushd ta-lib; ./configure; make; sudo make install; popd
+ - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- sudo apt-get install gfortran
install:
- cat etc/requirements_dev.txt | grep -v "^#" | grep -v "^$" | grep -v ipython | grep -v nose== | grep -v scipy | grep -v matplotlib | grep -v statsmodels | grep -v patsy | xargs pip install --use-mirrors
- etc/ordered_pip.sh etc/requirements.txt
before_script:
- "flake8 zipline tests"
script:
- nosetests --exclude=^test_examples | 1 | 0.066667 | 1 | 0 |
c65c49225dd35415ee878ba5779c03c9a13db9fb | package.json | package.json | {
"name": "functional-programming-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha --require babel-polyfill --compilers js:babel-register exercises/**/*.spec.js"
},
"author": "Tyrone Tudehope",
"license": "Apache-2.0",
"dependencies": {
"accounting": "^0.4.1",
"babel-polyfill": "^6.22.0",
"ramda": "^0.23.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
}
| {
"name": "functional-programming-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"example:part1": "babel-node exercises/part1/example",
"test": "mocha --require babel-polyfill --compilers js:babel-register exercises/**/*.spec.js"
},
"author": "Tyrone Tudehope",
"license": "Apache-2.0",
"dependencies": {
"accounting": "^0.4.1",
"babel-polyfill": "^6.22.0",
"ramda": "^0.23.0",
"request": "^2.79.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
}
| Implement HN version of book example | Implement HN version of book example
| JSON | apache-2.0 | johnnynotsolucky/mostly-adequate-guide-answers | json | ## Code Before:
{
"name": "functional-programming-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha --require babel-polyfill --compilers js:babel-register exercises/**/*.spec.js"
},
"author": "Tyrone Tudehope",
"license": "Apache-2.0",
"dependencies": {
"accounting": "^0.4.1",
"babel-polyfill": "^6.22.0",
"ramda": "^0.23.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
}
## Instruction:
Implement HN version of book example
## Code After:
{
"name": "functional-programming-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"example:part1": "babel-node exercises/part1/example",
"test": "mocha --require babel-polyfill --compilers js:babel-register exercises/**/*.spec.js"
},
"author": "Tyrone Tudehope",
"license": "Apache-2.0",
"dependencies": {
"accounting": "^0.4.1",
"babel-polyfill": "^6.22.0",
"ramda": "^0.23.0",
"request": "^2.79.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
}
| {
"name": "functional-programming-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
+ "example:part1": "babel-node exercises/part1/example",
"test": "mocha --require babel-polyfill --compilers js:babel-register exercises/**/*.spec.js"
},
"author": "Tyrone Tudehope",
"license": "Apache-2.0",
"dependencies": {
"accounting": "^0.4.1",
"babel-polyfill": "^6.22.0",
- "ramda": "^0.23.0"
+ "ramda": "^0.23.0",
? +
+ "request": "^2.79.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"mocha": "^3.2.0"
}
} | 4 | 0.173913 | 3 | 1 |
c0142a4b11b3580a0357b0a0df55ec657731c22b | packages/io/ioctl.yaml | packages/io/ioctl.yaml | homepage: ''
changelog-type: ''
hash: 3145af9dd5acd0a0ee22da02d14290cd23abce20205ce9ffaa995dd7f2e67445
test-bench-deps: {}
maintainer: uzytkownik2@gmail.com
synopsis: Type-safe I/O control package
changelog: ''
basic-deps:
unix: -any
base: ! '>=3 && <5'
network: -any
all-versions:
- 0.0.1
author: Maciej Piechotka
latest: 0.0.1
description-type: haddock
description: Package allowing type-safe I/O control
license-name: MIT
| homepage: ''
changelog-type: ''
hash: 5861ee9cdf3a2159fce85e3f9213b99bbbb0132e0ff85af7fc23df5215bd2096
test-bench-deps: {}
maintainer: uzytkownik2@gmail.com
synopsis: Type-safe I/O control package
changelog: ''
basic-deps:
unix: -any
base: ! '>=3 && <5'
network: <2.9
all-versions:
- 0.0.1
author: Maciej Piechotka
latest: 0.0.1
description-type: haddock
description: Package allowing type-safe I/O control
license-name: MIT
| Update from Hackage at 2019-06-19T11:31:12Z | Update from Hackage at 2019-06-19T11:31:12Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: ''
changelog-type: ''
hash: 3145af9dd5acd0a0ee22da02d14290cd23abce20205ce9ffaa995dd7f2e67445
test-bench-deps: {}
maintainer: uzytkownik2@gmail.com
synopsis: Type-safe I/O control package
changelog: ''
basic-deps:
unix: -any
base: ! '>=3 && <5'
network: -any
all-versions:
- 0.0.1
author: Maciej Piechotka
latest: 0.0.1
description-type: haddock
description: Package allowing type-safe I/O control
license-name: MIT
## Instruction:
Update from Hackage at 2019-06-19T11:31:12Z
## Code After:
homepage: ''
changelog-type: ''
hash: 5861ee9cdf3a2159fce85e3f9213b99bbbb0132e0ff85af7fc23df5215bd2096
test-bench-deps: {}
maintainer: uzytkownik2@gmail.com
synopsis: Type-safe I/O control package
changelog: ''
basic-deps:
unix: -any
base: ! '>=3 && <5'
network: <2.9
all-versions:
- 0.0.1
author: Maciej Piechotka
latest: 0.0.1
description-type: haddock
description: Package allowing type-safe I/O control
license-name: MIT
| homepage: ''
changelog-type: ''
- hash: 3145af9dd5acd0a0ee22da02d14290cd23abce20205ce9ffaa995dd7f2e67445
+ hash: 5861ee9cdf3a2159fce85e3f9213b99bbbb0132e0ff85af7fc23df5215bd2096
test-bench-deps: {}
maintainer: uzytkownik2@gmail.com
synopsis: Type-safe I/O control package
changelog: ''
basic-deps:
unix: -any
base: ! '>=3 && <5'
- network: -any
+ network: <2.9
all-versions:
- 0.0.1
author: Maciej Piechotka
latest: 0.0.1
description-type: haddock
description: Package allowing type-safe I/O control
license-name: MIT | 4 | 0.222222 | 2 | 2 |
8161ec1fc511ba948451ce121c863ca878ef482d | tests/test_pool.py | tests/test_pool.py | import random
import unittest
from aioes.pool import RandomSelector
class TestRandomSelector(unittest.TestCase):
def setUp(self):
random.seed(123456)
def tearDown(self):
random.seed(None)
def test_select(self):
s = RandomSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
| import random
import unittest
from aioes.pool import RandomSelector, RoundRobinSelector
class TestRandomSelector(unittest.TestCase):
def setUp(self):
random.seed(123456)
def tearDown(self):
random.seed(None)
def test_select(self):
s = RandomSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
class TestRoundRobinSelector(unittest.TestCase):
def test_select(self):
s = RoundRobinSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
r = s.select([1, 2, 3])
self.assertEqual(3, r)
r = s.select([1, 2, 3])
self.assertEqual(1, r)
r = s.select([1, 2, 3])
self.assertEqual(2, r)
| Add test for round-robin selector | Add test for round-robin selector
| Python | apache-2.0 | aio-libs/aioes | python | ## Code Before:
import random
import unittest
from aioes.pool import RandomSelector
class TestRandomSelector(unittest.TestCase):
def setUp(self):
random.seed(123456)
def tearDown(self):
random.seed(None)
def test_select(self):
s = RandomSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
## Instruction:
Add test for round-robin selector
## Code After:
import random
import unittest
from aioes.pool import RandomSelector, RoundRobinSelector
class TestRandomSelector(unittest.TestCase):
def setUp(self):
random.seed(123456)
def tearDown(self):
random.seed(None)
def test_select(self):
s = RandomSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
class TestRoundRobinSelector(unittest.TestCase):
def test_select(self):
s = RoundRobinSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
r = s.select([1, 2, 3])
self.assertEqual(3, r)
r = s.select([1, 2, 3])
self.assertEqual(1, r)
r = s.select([1, 2, 3])
self.assertEqual(2, r)
| import random
import unittest
- from aioes.pool import RandomSelector
+ from aioes.pool import RandomSelector, RoundRobinSelector
? ++++++++++++++++++++
class TestRandomSelector(unittest.TestCase):
def setUp(self):
random.seed(123456)
def tearDown(self):
random.seed(None)
def test_select(self):
s = RandomSelector()
r = s.select([1, 2, 3])
self.assertEqual(2, r)
+
+
+ class TestRoundRobinSelector(unittest.TestCase):
+
+ def test_select(self):
+ s = RoundRobinSelector()
+ r = s.select([1, 2, 3])
+ self.assertEqual(2, r)
+ r = s.select([1, 2, 3])
+ self.assertEqual(3, r)
+ r = s.select([1, 2, 3])
+ self.assertEqual(1, r)
+ r = s.select([1, 2, 3])
+ self.assertEqual(2, r) | 16 | 0.888889 | 15 | 1 |
dc6d7f0a619ee86903dca7931247fc7c87209921 | agreement.rb | agreement.rb | require 'ticket_sharing/client'
require 'ticket_sharing/json_support'
module TicketSharing
class Agreement
attr_accessor :direction, :remote_url, :status
def initialize(attrs = {})
self.direction = attrs['direction'] if attrs['direction']
self.remote_url = attrs['remote_url'] if attrs['remote_url']
self.status = attrs['status'] if attrs['status']
end
def self.parse(json)
attributes = JsonSupport.decode(json)
agreement = new(attributes)
end
def to_json
attributes = { :direction => direction }
JsonSupport.encode(attributes)
end
def send_to_partner
client = Client.new(remote_url)
client.post('/agreements', self.to_json)
client.success?
end
end
end
| require 'ticket_sharing/client'
require 'ticket_sharing/json_support'
module TicketSharing
class Agreement
FIELDS = [:receiver_url, :sender_url, :status, :uuid]
attr_accessor *FIELDS
def initialize(attrs = {})
FIELDS.each do |attribute|
self.send("#{attribute}=", attrs[attribute.to_s])
end
end
def self.parse(json)
attributes = JsonSupport.decode(json)
agreement = new(attributes)
end
def to_json
attributes = FIELDS.inject({}) do |attrs, field|
attrs[field.to_s] = send(field)
attrs
end
JsonSupport.encode(attributes)
end
# Maybe something like:
# client.send_agreement(self.to_json)
def send_to(url)
client = Client.new(url)
client.post('/agreements', self.to_json)
client.success?
end
def remote_url
receiver_url + '/agreements'
end
end
end
| Add sender url and receiver url to Agreement | Add sender url and receiver url to Agreement
The agreement object should be the same on either side.
| Ruby | apache-2.0 | zendesk/ticket_sharing | ruby | ## Code Before:
require 'ticket_sharing/client'
require 'ticket_sharing/json_support'
module TicketSharing
class Agreement
attr_accessor :direction, :remote_url, :status
def initialize(attrs = {})
self.direction = attrs['direction'] if attrs['direction']
self.remote_url = attrs['remote_url'] if attrs['remote_url']
self.status = attrs['status'] if attrs['status']
end
def self.parse(json)
attributes = JsonSupport.decode(json)
agreement = new(attributes)
end
def to_json
attributes = { :direction => direction }
JsonSupport.encode(attributes)
end
def send_to_partner
client = Client.new(remote_url)
client.post('/agreements', self.to_json)
client.success?
end
end
end
## Instruction:
Add sender url and receiver url to Agreement
The agreement object should be the same on either side.
## Code After:
require 'ticket_sharing/client'
require 'ticket_sharing/json_support'
module TicketSharing
class Agreement
FIELDS = [:receiver_url, :sender_url, :status, :uuid]
attr_accessor *FIELDS
def initialize(attrs = {})
FIELDS.each do |attribute|
self.send("#{attribute}=", attrs[attribute.to_s])
end
end
def self.parse(json)
attributes = JsonSupport.decode(json)
agreement = new(attributes)
end
def to_json
attributes = FIELDS.inject({}) do |attrs, field|
attrs[field.to_s] = send(field)
attrs
end
JsonSupport.encode(attributes)
end
# Maybe something like:
# client.send_agreement(self.to_json)
def send_to(url)
client = Client.new(url)
client.post('/agreements', self.to_json)
client.success?
end
def remote_url
receiver_url + '/agreements'
end
end
end
| require 'ticket_sharing/client'
require 'ticket_sharing/json_support'
module TicketSharing
class Agreement
- attr_accessor :direction, :remote_url, :status
+ FIELDS = [:receiver_url, :sender_url, :status, :uuid]
+ attr_accessor *FIELDS
def initialize(attrs = {})
- self.direction = attrs['direction'] if attrs['direction']
- self.remote_url = attrs['remote_url'] if attrs['remote_url']
- self.status = attrs['status'] if attrs['status']
+ FIELDS.each do |attribute|
+ self.send("#{attribute}=", attrs[attribute.to_s])
+ end
end
def self.parse(json)
attributes = JsonSupport.decode(json)
agreement = new(attributes)
end
def to_json
- attributes = { :direction => direction }
+ attributes = FIELDS.inject({}) do |attrs, field|
+ attrs[field.to_s] = send(field)
+ attrs
+ end
+
JsonSupport.encode(attributes)
end
- def send_to_partner
+ # Maybe something like:
+ # client.send_agreement(self.to_json)
+ def send_to(url)
- client = Client.new(remote_url)
? -------
+ client = Client.new(url)
client.post('/agreements', self.to_json)
client.success?
end
+ def remote_url
+ receiver_url + '/agreements'
+ end
+
end
end | 25 | 0.78125 | 18 | 7 |
1a3c251abe2e8ebf3020a21a3449abae6b04c2b1 | perf/tests/test_system.py | perf/tests/test_system.py | import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the system configuration to run benchmarks'
'|OK! System ready for benchmarking'
'|WARNING: no operation available for your platform)'
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
self.assertEqual(proc.returncode, 2, msg=proc)
if __name__ == "__main__":
unittest.main()
| import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the system configuration to run benchmarks'
'|OK! System ready for benchmarking'
'|WARNING: no operation available for your platform)'
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
# The return code is either 0 if the system is tuned or 2 if the
# system isn't
self.assertIn(proc.returncode, (0, 2), msg=proc)
if __name__ == "__main__":
unittest.main()
| Fix test_show test to support tuned systems | Fix test_show test to support tuned systems
| Python | mit | vstinner/pyperf,haypo/perf | python | ## Code Before:
import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the system configuration to run benchmarks'
'|OK! System ready for benchmarking'
'|WARNING: no operation available for your platform)'
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
self.assertEqual(proc.returncode, 2, msg=proc)
if __name__ == "__main__":
unittest.main()
## Instruction:
Fix test_show test to support tuned systems
## Code After:
import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the system configuration to run benchmarks'
'|OK! System ready for benchmarking'
'|WARNING: no operation available for your platform)'
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
# The return code is either 0 if the system is tuned or 2 if the
# system isn't
self.assertIn(proc.returncode, (0, 2), msg=proc)
if __name__ == "__main__":
unittest.main()
| import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the system configuration to run benchmarks'
'|OK! System ready for benchmarking'
'|WARNING: no operation available for your platform)'
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
+ # The return code is either 0 if the system is tuned or 2 if the
+ # system isn't
- self.assertEqual(proc.returncode, 2, msg=proc)
? ^^^^^
+ self.assertIn(proc.returncode, (0, 2), msg=proc)
? ^^ ++++ +
if __name__ == "__main__":
unittest.main() | 4 | 0.173913 | 3 | 1 |
f875b5e9bd0e215faa952b9d6855e70ca6b3e68b | Xcode/ESP/src/examples/user_touche.cpp | Xcode/ESP/src/examples/user_touche.cpp | /** @example user_touche.cpp
Touche example.
*/
#include <ESP.h>
BinaryIntArraySerialStream stream(0, 115200, 160);
GestureRecognitionPipeline pipeline;
void setup()
{
useInputStream(stream);
pipeline.addFeatureExtractionModule(TimeseriesBuffer(1, 160));
usePipeline(pipeline);
} | /** @example user_touche.cpp
Touche example.
*/
#include <ESP.h>
BinaryIntArraySerialStream stream(0, 115200, 160);
GestureRecognitionPipeline pipeline;
void setup()
{
useInputStream(stream);
pipeline.addFeatureExtractionModule(TimeseriesBuffer(1, 160));
pipeline.setClassifier(SVM(SVM::POLY_KERNEL, SVM::C_SVC, false, true, true, 0.1, 1.0, 0, 0.5, 2));
usePipeline(pipeline);
} | Add SVM classifier to Touche example. | Add SVM classifier to Touche example.
It seems to do some (very) basic recognition successfully, so I’m
saying that this fixes #245, although I think it still needs lots of
work.
| C++ | bsd-3-clause | damellis/ESP,damellis/ESP | c++ | ## Code Before:
/** @example user_touche.cpp
Touche example.
*/
#include <ESP.h>
BinaryIntArraySerialStream stream(0, 115200, 160);
GestureRecognitionPipeline pipeline;
void setup()
{
useInputStream(stream);
pipeline.addFeatureExtractionModule(TimeseriesBuffer(1, 160));
usePipeline(pipeline);
}
## Instruction:
Add SVM classifier to Touche example.
It seems to do some (very) basic recognition successfully, so I’m
saying that this fixes #245, although I think it still needs lots of
work.
## Code After:
/** @example user_touche.cpp
Touche example.
*/
#include <ESP.h>
BinaryIntArraySerialStream stream(0, 115200, 160);
GestureRecognitionPipeline pipeline;
void setup()
{
useInputStream(stream);
pipeline.addFeatureExtractionModule(TimeseriesBuffer(1, 160));
pipeline.setClassifier(SVM(SVM::POLY_KERNEL, SVM::C_SVC, false, true, true, 0.1, 1.0, 0, 0.5, 2));
usePipeline(pipeline);
} | /** @example user_touche.cpp
Touche example.
*/
#include <ESP.h>
BinaryIntArraySerialStream stream(0, 115200, 160);
GestureRecognitionPipeline pipeline;
void setup()
{
useInputStream(stream);
pipeline.addFeatureExtractionModule(TimeseriesBuffer(1, 160));
+ pipeline.setClassifier(SVM(SVM::POLY_KERNEL, SVM::C_SVC, false, true, true, 0.1, 1.0, 0, 0.5, 2));
usePipeline(pipeline);
} | 1 | 0.0625 | 1 | 0 |
c6c4bf9cd9d2ae7340cccdc336fa689212745220 | bootstrap/module.php | bootstrap/module.php | <?php
declare(strict_types=1);
use Cortex\Foundation\Http\Middleware\Clockwork;
use Illuminate\Database\Eloquent\Relations\Relation;
return function () {
// Bind route models and constrains
Route::pattern('locale', '[a-z]{2}');
Route::pattern('accessarea', '[a-zA-Z0-9-_]+');
Route::model('media', config('medialibrary.media_model'));
Route::model('accessarea', config('cortex.foundation.models.accessarea'));
// Map relations
Relation::morphMap([
'media' => config('medialibrary.media_model'),
'accessarea' => config('cortex.foundation.models.accessarea'),
]);
// Append middleware to the 'web' middleware group
$this->app->environment('production') || Route::pushMiddlewareToGroup('web', Clockwork::class);
};
| <?php
declare(strict_types=1);
use Cortex\Foundation\Http\Middleware\Clockwork;
use Illuminate\Database\Eloquent\Relations\Relation;
return function () {
// Bind route models and constrains
Route::pattern('locale', '[a-z]{2}');
Route::pattern('media', '[a-zA-Z0-9-_]+');
Route::pattern('accessarea', '[a-zA-Z0-9-_]+');
Route::model('media', config('media-library.media_model'));
Route::model('accessarea', config('cortex.foundation.models.accessarea'));
// Map relations
Relation::morphMap([
'media' => config('media-library.media_model'),
'accessarea' => config('cortex.foundation.models.accessarea'),
]);
// Append middleware to the 'web' middleware group
$this->app->environment('production') || Route::pushMiddlewareToGroup('web', Clockwork::class);
};
| Fix media deletion issues and media model implicit binding | Fix media deletion issues and media model implicit binding
| PHP | mit | rinvex/cortex-foundation | php | ## Code Before:
<?php
declare(strict_types=1);
use Cortex\Foundation\Http\Middleware\Clockwork;
use Illuminate\Database\Eloquent\Relations\Relation;
return function () {
// Bind route models and constrains
Route::pattern('locale', '[a-z]{2}');
Route::pattern('accessarea', '[a-zA-Z0-9-_]+');
Route::model('media', config('medialibrary.media_model'));
Route::model('accessarea', config('cortex.foundation.models.accessarea'));
// Map relations
Relation::morphMap([
'media' => config('medialibrary.media_model'),
'accessarea' => config('cortex.foundation.models.accessarea'),
]);
// Append middleware to the 'web' middleware group
$this->app->environment('production') || Route::pushMiddlewareToGroup('web', Clockwork::class);
};
## Instruction:
Fix media deletion issues and media model implicit binding
## Code After:
<?php
declare(strict_types=1);
use Cortex\Foundation\Http\Middleware\Clockwork;
use Illuminate\Database\Eloquent\Relations\Relation;
return function () {
// Bind route models and constrains
Route::pattern('locale', '[a-z]{2}');
Route::pattern('media', '[a-zA-Z0-9-_]+');
Route::pattern('accessarea', '[a-zA-Z0-9-_]+');
Route::model('media', config('media-library.media_model'));
Route::model('accessarea', config('cortex.foundation.models.accessarea'));
// Map relations
Relation::morphMap([
'media' => config('media-library.media_model'),
'accessarea' => config('cortex.foundation.models.accessarea'),
]);
// Append middleware to the 'web' middleware group
$this->app->environment('production') || Route::pushMiddlewareToGroup('web', Clockwork::class);
};
| <?php
declare(strict_types=1);
use Cortex\Foundation\Http\Middleware\Clockwork;
use Illuminate\Database\Eloquent\Relations\Relation;
return function () {
// Bind route models and constrains
Route::pattern('locale', '[a-z]{2}');
+ Route::pattern('media', '[a-zA-Z0-9-_]+');
Route::pattern('accessarea', '[a-zA-Z0-9-_]+');
- Route::model('media', config('medialibrary.media_model'));
+ Route::model('media', config('media-library.media_model'));
? +
Route::model('accessarea', config('cortex.foundation.models.accessarea'));
// Map relations
Relation::morphMap([
- 'media' => config('medialibrary.media_model'),
+ 'media' => config('media-library.media_model'),
? +
'accessarea' => config('cortex.foundation.models.accessarea'),
]);
// Append middleware to the 'web' middleware group
$this->app->environment('production') || Route::pushMiddlewareToGroup('web', Clockwork::class);
}; | 5 | 0.217391 | 3 | 2 |
31a4253288637070f50a398cd80250176e785a19 | rnacentral_pipeline/cli/genes.py | rnacentral_pipeline/cli/genes.py |
import click
from rnacentral_pipeline.rnacentral.genes import build, write
@click.group("genes")
def cli():
"""
A group of commands dealing with building genes.
"""
pass
@cli.command("build")
@click.option("--format", type=click.Choice(write.Format.names(), case_sensitive=False))
@click.argument("data_file", type=click.File("r"))
@click.argument("output", type=click.File("w"))
def build_genes(data_file, output, format=None):
"""
Build the genes for the given data file. This assumes that the file is
already split into reasonable chunks.
"""
data = build.from_json(data_file)
write.write(data, write.Format.from_name(format), output)
|
import click
from rnacentral_pipeline.rnacentral.genes import build, write
@click.group("genes")
def cli():
"""
A group of commands dealing with building genes.
"""
pass
@cli.command("build")
@click.option(
"--format",
default="csv",
type=click.Choice(write.Format.names(), case_sensitive=False),
)
@click.argument("data_file", type=click.File("r"))
@click.argument("output", type=click.File("w"))
def build_genes(data_file, output, format=None):
"""
Build the genes for the given data file. The file can contain all data for a
specific assembly.
"""
data = build.from_json(data_file)
write.write(data, write.Format.from_name(format), output)
| Clean up CLI a bit | Clean up CLI a bit
Default arguments are useful.
| Python | apache-2.0 | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | python | ## Code Before:
import click
from rnacentral_pipeline.rnacentral.genes import build, write
@click.group("genes")
def cli():
"""
A group of commands dealing with building genes.
"""
pass
@cli.command("build")
@click.option("--format", type=click.Choice(write.Format.names(), case_sensitive=False))
@click.argument("data_file", type=click.File("r"))
@click.argument("output", type=click.File("w"))
def build_genes(data_file, output, format=None):
"""
Build the genes for the given data file. This assumes that the file is
already split into reasonable chunks.
"""
data = build.from_json(data_file)
write.write(data, write.Format.from_name(format), output)
## Instruction:
Clean up CLI a bit
Default arguments are useful.
## Code After:
import click
from rnacentral_pipeline.rnacentral.genes import build, write
@click.group("genes")
def cli():
"""
A group of commands dealing with building genes.
"""
pass
@cli.command("build")
@click.option(
"--format",
default="csv",
type=click.Choice(write.Format.names(), case_sensitive=False),
)
@click.argument("data_file", type=click.File("r"))
@click.argument("output", type=click.File("w"))
def build_genes(data_file, output, format=None):
"""
Build the genes for the given data file. The file can contain all data for a
specific assembly.
"""
data = build.from_json(data_file)
write.write(data, write.Format.from_name(format), output)
|
import click
from rnacentral_pipeline.rnacentral.genes import build, write
@click.group("genes")
def cli():
"""
A group of commands dealing with building genes.
"""
pass
@cli.command("build")
+ @click.option(
+ "--format",
+ default="csv",
- @click.option("--format", type=click.Choice(write.Format.names(), case_sensitive=False))
? ^^^^^^^^^^^^^^^^^^^^^^^^^ ^
+ type=click.Choice(write.Format.names(), case_sensitive=False),
? ^^^ ^
+ )
@click.argument("data_file", type=click.File("r"))
@click.argument("output", type=click.File("w"))
def build_genes(data_file, output, format=None):
"""
- Build the genes for the given data file. This assumes that the file is
- already split into reasonable chunks.
+ Build the genes for the given data file. The file can contain all data for a
+ specific assembly.
"""
data = build.from_json(data_file)
write.write(data, write.Format.from_name(format), output) | 10 | 0.4 | 7 | 3 |
a1e9d8bbb5aede506d9272225fc7463184c17f0a | lib/sync_checker/checks/details_check.rb | lib/sync_checker/checks/details_check.rb | require 'equivalent-xml'
module SyncChecker
module Checks
DetailsCheck = Struct.new(:expected_details) do
attr_reader :content_item
def call(response)
failures = []
if response.response_code == 200
@content_item = JSON.parse(response.body)
if run_check?
expected_details.each do |k, v|
failures << check_key(k, v)
end
end
end
failures.compact
end
private
def run_check?
%w(redirect gone).exclude?(content_item["schema_name"])
end
def check_key(key, value)
return check_body if key.to_s == "body"
response_value = content_item["details"][key.to_s]
return "expected details to contain '#{key}' == '#{value}'" if response_value.nil?
if response_value != value
"expected details '#{key}' to equal '#{value}' but got '#{response_value}'"
end
end
def check_body
"details body doesn't match" unless body_is_equivalent?
end
def body_is_equivalent?
content_body = content_item["details"]["body"]
content_body.gsub!(/<td>\s*<\/td>/, "<td> </td>") if content_body
expected_body = expected_details[:body]
EquivalentXml.equivalent?(
content_body,
expected_body
)
end
end
end
end
| require 'equivalent-xml'
module SyncChecker
module Checks
DetailsCheck = Struct.new(:expected_details) do
attr_reader :content_item
def call(response)
failures = []
if response.response_code == 200
@content_item = JSON.parse(response.body)
if run_check?
expected_details.each do |k, v|
failures << check_key(k, v)
end
end
end
failures.compact
end
private
def run_check?
%w(redirect gone).exclude?(content_item["schema_name"])
end
def check_key(key, value)
return check_body if key.to_s == "body"
response_value = content_item["details"][key.to_s]
return "expected details to contain '#{key}' == '#{value}'" if response_value.nil?
if response_value != value
"expected details '#{key}' to equal '#{value}' but got '#{response_value}'"
end
end
def check_body
"details body doesn't match" unless body_is_equivalent?
end
def body_is_equivalent?
content_body = content_item["details"]["body"]
content_body.gsub!(/<td>\s*<\/td>/, "<td> </td>") if content_body
expected_body = expected_details[:body]
EquivalentXml.equivalent?(
string_to_xml(content_body),
string_to_xml(expected_body)
)
end
def string_to_xml(string)
Nokogiri::HTML(string)
end
end
end
end
| Use Nokogiri::HTML in sync_check details body | Use Nokogiri::HTML in sync_check details body
| Ruby | mit | alphagov/whitehall,alphagov/whitehall,alphagov/whitehall,alphagov/whitehall | ruby | ## Code Before:
require 'equivalent-xml'
module SyncChecker
module Checks
DetailsCheck = Struct.new(:expected_details) do
attr_reader :content_item
def call(response)
failures = []
if response.response_code == 200
@content_item = JSON.parse(response.body)
if run_check?
expected_details.each do |k, v|
failures << check_key(k, v)
end
end
end
failures.compact
end
private
def run_check?
%w(redirect gone).exclude?(content_item["schema_name"])
end
def check_key(key, value)
return check_body if key.to_s == "body"
response_value = content_item["details"][key.to_s]
return "expected details to contain '#{key}' == '#{value}'" if response_value.nil?
if response_value != value
"expected details '#{key}' to equal '#{value}' but got '#{response_value}'"
end
end
def check_body
"details body doesn't match" unless body_is_equivalent?
end
def body_is_equivalent?
content_body = content_item["details"]["body"]
content_body.gsub!(/<td>\s*<\/td>/, "<td> </td>") if content_body
expected_body = expected_details[:body]
EquivalentXml.equivalent?(
content_body,
expected_body
)
end
end
end
end
## Instruction:
Use Nokogiri::HTML in sync_check details body
## Code After:
require 'equivalent-xml'
module SyncChecker
module Checks
DetailsCheck = Struct.new(:expected_details) do
attr_reader :content_item
def call(response)
failures = []
if response.response_code == 200
@content_item = JSON.parse(response.body)
if run_check?
expected_details.each do |k, v|
failures << check_key(k, v)
end
end
end
failures.compact
end
private
def run_check?
%w(redirect gone).exclude?(content_item["schema_name"])
end
def check_key(key, value)
return check_body if key.to_s == "body"
response_value = content_item["details"][key.to_s]
return "expected details to contain '#{key}' == '#{value}'" if response_value.nil?
if response_value != value
"expected details '#{key}' to equal '#{value}' but got '#{response_value}'"
end
end
def check_body
"details body doesn't match" unless body_is_equivalent?
end
def body_is_equivalent?
content_body = content_item["details"]["body"]
content_body.gsub!(/<td>\s*<\/td>/, "<td> </td>") if content_body
expected_body = expected_details[:body]
EquivalentXml.equivalent?(
string_to_xml(content_body),
string_to_xml(expected_body)
)
end
def string_to_xml(string)
Nokogiri::HTML(string)
end
end
end
end
| require 'equivalent-xml'
module SyncChecker
module Checks
DetailsCheck = Struct.new(:expected_details) do
attr_reader :content_item
def call(response)
failures = []
if response.response_code == 200
@content_item = JSON.parse(response.body)
if run_check?
expected_details.each do |k, v|
failures << check_key(k, v)
end
end
end
failures.compact
end
private
def run_check?
%w(redirect gone).exclude?(content_item["schema_name"])
end
def check_key(key, value)
return check_body if key.to_s == "body"
response_value = content_item["details"][key.to_s]
return "expected details to contain '#{key}' == '#{value}'" if response_value.nil?
if response_value != value
"expected details '#{key}' to equal '#{value}' but got '#{response_value}'"
end
end
def check_body
"details body doesn't match" unless body_is_equivalent?
end
def body_is_equivalent?
content_body = content_item["details"]["body"]
content_body.gsub!(/<td>\s*<\/td>/, "<td> </td>") if content_body
expected_body = expected_details[:body]
+ EquivalentXml.equivalent?(
+ string_to_xml(content_body),
+ string_to_xml(expected_body)
+ )
+ end
+ def string_to_xml(string)
+ Nokogiri::HTML(string)
- EquivalentXml.equivalent?(
- content_body,
- expected_body
- )
end
end
end
end | 11 | 0.215686 | 7 | 4 |
51e3f7a1fbb857b00a3102287849bc925198d473 | tests/helpers/mixins/assertions.py | tests/helpers/mixins/assertions.py | import json
class AssertionsAssertionsMixin:
def assertSortedEqual(self, one, two):
"""Assert that the sorted of the two equal"""
self.assertEqual(sorted(one), sorted(two))
def assertJsonDictEqual(self, one, two):
"""Assert the two dictionaries are the same, print out as json if not"""
try:
self.assertEqual(one, two)
except AssertionError:
print("Got =============>")
print(json.dumps(one, indent=2, sort_keys=True))
print("Expected --------------->")
print(json.dumps(two, indent=2, sort_keys=True))
raise
| from harpoon.errors import HarpoonError
from contextlib import contextmanager
import json
class NotSpecified(object):
"""Tell the difference between empty and None"""
class AssertionsAssertionsMixin:
def assertSortedEqual(self, one, two):
"""Assert that the sorted of the two equal"""
self.assertEqual(sorted(one), sorted(two))
def assertJsonDictEqual(self, one, two):
"""Assert the two dictionaries are the same, print out as json if not"""
try:
self.assertEqual(one, two)
except AssertionError:
print("Got =============>")
print(json.dumps(one, indent=2, sort_keys=True))
print("Expected --------------->")
print(json.dumps(two, indent=2, sort_keys=True))
raise
@contextmanager
def fuzzyAssertRaisesError(self, expected_kls, expected_msg_regex=NotSpecified, **values):
"""
Assert that something raises a particular type of error.
The error raised must be a subclass of the expected_kls
Have a message that matches the specified regex.
And have atleast the values specified in it's kwargs.
"""
try:
yield
except HarpoonError as error:
try:
assert issubclass(error.__class__, expected_kls)
if expected_msg_regex is not NotSpecified:
self.assertRegexpMatches(expected_msg_regex, error.message)
errors = values.get("_errors")
if "_errors" in values:
del values["_errors"]
self.assertDictContainsSubset(values, error.kwargs)
if errors:
self.assertEqual(sorted(error.errors), sorted(errors))
except AssertionError:
print "Got error: {0}".format(error)
print "Expected: {0}: {1}: {2}".format(expected_kls, expected_msg_regex, values)
raise
else:
assert False, "Expected an exception to be raised\n\texpected_kls: {0}\n\texpected_msg_regex: {1}\n\thave_atleast: {2}".format(
expected_kls, expected_msg_regex, values
)
| Add a fuzzyAssertRaisesError helper for checking against HarpoonError | Add a fuzzyAssertRaisesError helper for checking against HarpoonError
| Python | mit | delfick/harpoon,realestate-com-au/harpoon,delfick/harpoon,realestate-com-au/harpoon | python | ## Code Before:
import json
class AssertionsAssertionsMixin:
def assertSortedEqual(self, one, two):
"""Assert that the sorted of the two equal"""
self.assertEqual(sorted(one), sorted(two))
def assertJsonDictEqual(self, one, two):
"""Assert the two dictionaries are the same, print out as json if not"""
try:
self.assertEqual(one, two)
except AssertionError:
print("Got =============>")
print(json.dumps(one, indent=2, sort_keys=True))
print("Expected --------------->")
print(json.dumps(two, indent=2, sort_keys=True))
raise
## Instruction:
Add a fuzzyAssertRaisesError helper for checking against HarpoonError
## Code After:
from harpoon.errors import HarpoonError
from contextlib import contextmanager
import json
class NotSpecified(object):
"""Tell the difference between empty and None"""
class AssertionsAssertionsMixin:
def assertSortedEqual(self, one, two):
"""Assert that the sorted of the two equal"""
self.assertEqual(sorted(one), sorted(two))
def assertJsonDictEqual(self, one, two):
"""Assert the two dictionaries are the same, print out as json if not"""
try:
self.assertEqual(one, two)
except AssertionError:
print("Got =============>")
print(json.dumps(one, indent=2, sort_keys=True))
print("Expected --------------->")
print(json.dumps(two, indent=2, sort_keys=True))
raise
@contextmanager
def fuzzyAssertRaisesError(self, expected_kls, expected_msg_regex=NotSpecified, **values):
"""
Assert that something raises a particular type of error.
The error raised must be a subclass of the expected_kls
Have a message that matches the specified regex.
And have atleast the values specified in it's kwargs.
"""
try:
yield
except HarpoonError as error:
try:
assert issubclass(error.__class__, expected_kls)
if expected_msg_regex is not NotSpecified:
self.assertRegexpMatches(expected_msg_regex, error.message)
errors = values.get("_errors")
if "_errors" in values:
del values["_errors"]
self.assertDictContainsSubset(values, error.kwargs)
if errors:
self.assertEqual(sorted(error.errors), sorted(errors))
except AssertionError:
print "Got error: {0}".format(error)
print "Expected: {0}: {1}: {2}".format(expected_kls, expected_msg_regex, values)
raise
else:
assert False, "Expected an exception to be raised\n\texpected_kls: {0}\n\texpected_msg_regex: {1}\n\thave_atleast: {2}".format(
expected_kls, expected_msg_regex, values
)
| + from harpoon.errors import HarpoonError
+
+ from contextlib import contextmanager
import json
+
+ class NotSpecified(object):
+ """Tell the difference between empty and None"""
class AssertionsAssertionsMixin:
def assertSortedEqual(self, one, two):
"""Assert that the sorted of the two equal"""
self.assertEqual(sorted(one), sorted(two))
def assertJsonDictEqual(self, one, two):
"""Assert the two dictionaries are the same, print out as json if not"""
try:
self.assertEqual(one, two)
except AssertionError:
print("Got =============>")
print(json.dumps(one, indent=2, sort_keys=True))
print("Expected --------------->")
print(json.dumps(two, indent=2, sort_keys=True))
raise
+ @contextmanager
+ def fuzzyAssertRaisesError(self, expected_kls, expected_msg_regex=NotSpecified, **values):
+ """
+ Assert that something raises a particular type of error.
+
+ The error raised must be a subclass of the expected_kls
+ Have a message that matches the specified regex.
+
+ And have atleast the values specified in it's kwargs.
+ """
+ try:
+ yield
+ except HarpoonError as error:
+ try:
+ assert issubclass(error.__class__, expected_kls)
+ if expected_msg_regex is not NotSpecified:
+ self.assertRegexpMatches(expected_msg_regex, error.message)
+
+ errors = values.get("_errors")
+ if "_errors" in values:
+ del values["_errors"]
+
+ self.assertDictContainsSubset(values, error.kwargs)
+ if errors:
+ self.assertEqual(sorted(error.errors), sorted(errors))
+ except AssertionError:
+ print "Got error: {0}".format(error)
+ print "Expected: {0}: {1}: {2}".format(expected_kls, expected_msg_regex, values)
+ raise
+ else:
+ assert False, "Expected an exception to be raised\n\texpected_kls: {0}\n\texpected_msg_regex: {1}\n\thave_atleast: {2}".format(
+ expected_kls, expected_msg_regex, values
+ )
+ | 40 | 2.222222 | 40 | 0 |
e3f1fad06642bc38837cf7fe8a8b22d256c7b2c8 | .github/workflows/main.yml | .github/workflows/main.yml | name: CI
on:
push:
branches: [ master, clang-9 ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Setup cmake
run: cmake -DBUILD_TESTS=ON ./
- name: Compile
run: make
- name: Run tests
run: ./test/etl_tests
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: Testfile
path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make
| name: CI
on:
push:
branches: [ master, clang-9, hotfix/clang-9 ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Setup cmake
run: cmake -DBUILD_TESTS=ON ./
- name: Compile
run: make
- name: Run tests
run: ./test/etl_tests
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: Testfile
path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make
| Add hotfix/clang-9 to branch list | Add hotfix/clang-9 to branch list
| YAML | mit | ETLCPP/etl,ETLCPP/etl,ETLCPP/etl,ETLCPP/etl | yaml | ## Code Before:
name: CI
on:
push:
branches: [ master, clang-9 ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Setup cmake
run: cmake -DBUILD_TESTS=ON ./
- name: Compile
run: make
- name: Run tests
run: ./test/etl_tests
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: Testfile
path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make
## Instruction:
Add hotfix/clang-9 to branch list
## Code After:
name: CI
on:
push:
branches: [ master, clang-9, hotfix/clang-9 ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Setup cmake
run: cmake -DBUILD_TESTS=ON ./
- name: Compile
run: make
- name: Run tests
run: ./test/etl_tests
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: Testfile
path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make
| name: CI
on:
push:
- branches: [ master, clang-9 ]
+ branches: [ master, clang-9, hotfix/clang-9 ]
? ++++++++++++++++
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- uses: actions/checkout@v2
- name: Setup cmake
run: cmake -DBUILD_TESTS=ON ./
- name: Compile
run: make
- name: Run tests
run: ./test/etl_tests
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: Testfile
path: test/etl_tests
build-clang-9-Linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build with Clang 9
run: |
export CC=clang-9
export CXX=clang++-9
cmake -D BUILD_TESTS=ON ./
make | 2 | 0.047619 | 1 | 1 |
d82580647ea3c85fc14dbcc3db470867ef7499a6 | ql/test/qlpack.yml | ql/test/qlpack.yml | name: codeql/go-tests
version: 0.0.2
dependencies:
codeql/go-queries: ^0.0.2
codeql/go-all: ^0.0.2
extractor: go
| name: codeql/go-tests
version: 0.0.2
dependencies:
codeql/go-queries: ^0.0.2
codeql/go-all: ^0.0.2
codeql/go-examples: ^0.0.2
extractor: go
| Add reference to `codeql/go-examples` pack from test pack | Add reference to `codeql/go-examples` pack from test pack
| YAML | mit | github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql-go,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql-go | yaml | ## Code Before:
name: codeql/go-tests
version: 0.0.2
dependencies:
codeql/go-queries: ^0.0.2
codeql/go-all: ^0.0.2
extractor: go
## Instruction:
Add reference to `codeql/go-examples` pack from test pack
## Code After:
name: codeql/go-tests
version: 0.0.2
dependencies:
codeql/go-queries: ^0.0.2
codeql/go-all: ^0.0.2
codeql/go-examples: ^0.0.2
extractor: go
| name: codeql/go-tests
version: 0.0.2
dependencies:
codeql/go-queries: ^0.0.2
codeql/go-all: ^0.0.2
+ codeql/go-examples: ^0.0.2
extractor: go | 1 | 0.166667 | 1 | 0 |
ee9336038d6237f5481c53996764d0d92ca7adef | resources/languages/plugin/simpleaccreg/resources.properties | resources/languages/plugin/simpleaccreg/resources.properties | initialAccountRegistration=Configure all your favorite protocols in one click.
signin=Sign in
signup=Sign up | initialAccountRegistration=Configure all your favorite protocols in one click.
signin=Sign in
signup=Sign up
cancel=Cancel | Fix cancel button label in the Account registration form. | Fix cancel button label in the Account registration form.
| INI | apache-2.0 | jibaro/jitsi,bhatvv/jitsi,ringdna/jitsi,laborautonomo/jitsi,level7systems/jitsi,level7systems/jitsi,mckayclarey/jitsi,iant-gmbh/jitsi,iant-gmbh/jitsi,mckayclarey/jitsi,tuijldert/jitsi,marclaporte/jitsi,martin7890/jitsi,martin7890/jitsi,bhatvv/jitsi,dkcreinoso/jitsi,pplatek/jitsi,jitsi/jitsi,Metaswitch/jitsi,tuijldert/jitsi,gpolitis/jitsi,procandi/jitsi,cobratbq/jitsi,Metaswitch/jitsi,459below/jitsi,bebo/jitsi,damencho/jitsi,laborautonomo/jitsi,gpolitis/jitsi,pplatek/jitsi,459below/jitsi,damencho/jitsi,ibauersachs/jitsi,dkcreinoso/jitsi,jitsi/jitsi,bebo/jitsi,ringdna/jitsi,cobratbq/jitsi,martin7890/jitsi,mckayclarey/jitsi,459below/jitsi,procandi/jitsi,pplatek/jitsi,459below/jitsi,procandi/jitsi,marclaporte/jitsi,tuijldert/jitsi,iant-gmbh/jitsi,iant-gmbh/jitsi,marclaporte/jitsi,marclaporte/jitsi,bebo/jitsi,mckayclarey/jitsi,ibauersachs/jitsi,bhatvv/jitsi,HelioGuilherme66/jitsi,martin7890/jitsi,level7systems/jitsi,gpolitis/jitsi,HelioGuilherme66/jitsi,jibaro/jitsi,gpolitis/jitsi,laborautonomo/jitsi,damencho/jitsi,laborautonomo/jitsi,iant-gmbh/jitsi,jitsi/jitsi,ibauersachs/jitsi,martin7890/jitsi,ibauersachs/jitsi,bebo/jitsi,bebo/jitsi,dkcreinoso/jitsi,pplatek/jitsi,tuijldert/jitsi,gpolitis/jitsi,dkcreinoso/jitsi,jitsi/jitsi,damencho/jitsi,cobratbq/jitsi,HelioGuilherme66/jitsi,HelioGuilherme66/jitsi,jibaro/jitsi,ringdna/jitsi,procandi/jitsi,459below/jitsi,bhatvv/jitsi,level7systems/jitsi,procandi/jitsi,marclaporte/jitsi,jitsi/jitsi,ringdna/jitsi,jibaro/jitsi,pplatek/jitsi,cobratbq/jitsi,dkcreinoso/jitsi,mckayclarey/jitsi,jibaro/jitsi,Metaswitch/jitsi,laborautonomo/jitsi,cobratbq/jitsi,damencho/jitsi,ringdna/jitsi,bhatvv/jitsi,ibauersachs/jitsi,level7systems/jitsi,Metaswitch/jitsi,tuijldert/jitsi,HelioGuilherme66/jitsi | ini | ## Code Before:
initialAccountRegistration=Configure all your favorite protocols in one click.
signin=Sign in
signup=Sign up
## Instruction:
Fix cancel button label in the Account registration form.
## Code After:
initialAccountRegistration=Configure all your favorite protocols in one click.
signin=Sign in
signup=Sign up
cancel=Cancel | initialAccountRegistration=Configure all your favorite protocols in one click.
signin=Sign in
signup=Sign up
+ cancel=Cancel | 1 | 0.333333 | 1 | 0 |
0c9fae6997ad390c4ac7ffc75bd2fcfd27ced8a5 | pan-domain-auth-verification/src/main/scala/com/gu/pandomainauth/PublicSettings.scala | pan-domain-auth-verification/src/main/scala/com/gu/pandomainauth/PublicSettings.scala | package com.gu.pandomainauth
import dispatch._
import scala.concurrent.Future
object PublicSettings {
val bucketName = "pan-domain-auth-settings"
val cookieName = "gutoolsAuth"
val assymCookieName = s"$cookieName-assym"
def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[Either[Throwable, String]] = {
val req = host("s3-eu-west-1.amazonaws.com").secure / bucketName / s"$domain.settings.public"
client(req OK as.String).either.left.map(new PublicKeyAcquisitionException(_)).map { attemptedKey =>
attemptedKey.right.flatMap(validateKey)
}
}
private[pandomainauth] def validateKey(pubKey: String): Either[Throwable, String] = {
if ("[a-zA-Z0-9+/]+={0,3}".r.pattern.matcher(pubKey).matches) Right(pubKey)
else Left(PublicKeyFormatException)
}
class PublicKeyAcquisitionException(cause: Throwable) extends Exception(cause.getMessage, cause)
object PublicKeyFormatException extends Exception("Invalid public key")
}
| package com.gu.pandomainauth
import dispatch._
import scala.concurrent.Future
object PublicSettings {
val bucketName = "pan-domain-auth-settings"
val cookieName = "gutoolsAuth"
val assymCookieName = s"$cookieName-assym"
def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[String] = {
val req = host("s3-eu-west-1.amazonaws.com").secure / bucketName / s"$domain.settings.public"
client(req OK as.String).either.left.map(new PublicKeyAcquisitionException(_)).map { attemptedKey =>
attemptedKey.right.flatMap(validateKey)
} flatMap {
case Right(key) => Future.successful(key)
case Left(err) => Future.failed(err)
}
}
private[pandomainauth] def validateKey(pubKey: String): Either[Throwable, String] = {
if ("[a-zA-Z0-9+/]+={0,3}".r.pattern.matcher(pubKey).matches) Right(pubKey)
else Left(PublicKeyFormatException)
}
class PublicKeyAcquisitionException(cause: Throwable) extends Exception(cause.getMessage, cause)
object PublicKeyFormatException extends Exception("Invalid public key")
}
| Simplify function that fetches the publicKey | Simplify function that fetches the publicKey
Since the Left of the response's Either was a throwable, it's simpler
to use Future's success/failure mechanism.
| Scala | apache-2.0 | guardian/pan-domain-authentication,linearregression/pan-domain-authentication,m4tx/pan-domain-authentication,guardian/pan-domain-authentication,guardian/pan-domain-authentication,m4tx/pan-domain-authentication,guardian/pan-domain-authentication,linearregression/pan-domain-authentication | scala | ## Code Before:
package com.gu.pandomainauth
import dispatch._
import scala.concurrent.Future
object PublicSettings {
val bucketName = "pan-domain-auth-settings"
val cookieName = "gutoolsAuth"
val assymCookieName = s"$cookieName-assym"
def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[Either[Throwable, String]] = {
val req = host("s3-eu-west-1.amazonaws.com").secure / bucketName / s"$domain.settings.public"
client(req OK as.String).either.left.map(new PublicKeyAcquisitionException(_)).map { attemptedKey =>
attemptedKey.right.flatMap(validateKey)
}
}
private[pandomainauth] def validateKey(pubKey: String): Either[Throwable, String] = {
if ("[a-zA-Z0-9+/]+={0,3}".r.pattern.matcher(pubKey).matches) Right(pubKey)
else Left(PublicKeyFormatException)
}
class PublicKeyAcquisitionException(cause: Throwable) extends Exception(cause.getMessage, cause)
object PublicKeyFormatException extends Exception("Invalid public key")
}
## Instruction:
Simplify function that fetches the publicKey
Since the Left of the response's Either was a throwable, it's simpler
to use Future's success/failure mechanism.
## Code After:
package com.gu.pandomainauth
import dispatch._
import scala.concurrent.Future
object PublicSettings {
val bucketName = "pan-domain-auth-settings"
val cookieName = "gutoolsAuth"
val assymCookieName = s"$cookieName-assym"
def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[String] = {
val req = host("s3-eu-west-1.amazonaws.com").secure / bucketName / s"$domain.settings.public"
client(req OK as.String).either.left.map(new PublicKeyAcquisitionException(_)).map { attemptedKey =>
attemptedKey.right.flatMap(validateKey)
} flatMap {
case Right(key) => Future.successful(key)
case Left(err) => Future.failed(err)
}
}
private[pandomainauth] def validateKey(pubKey: String): Either[Throwable, String] = {
if ("[a-zA-Z0-9+/]+={0,3}".r.pattern.matcher(pubKey).matches) Right(pubKey)
else Left(PublicKeyFormatException)
}
class PublicKeyAcquisitionException(cause: Throwable) extends Exception(cause.getMessage, cause)
object PublicKeyFormatException extends Exception("Invalid public key")
}
| package com.gu.pandomainauth
import dispatch._
import scala.concurrent.Future
object PublicSettings {
val bucketName = "pan-domain-auth-settings"
val cookieName = "gutoolsAuth"
val assymCookieName = s"$cookieName-assym"
- def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[Either[Throwable, String]] = {
? ------------------ -
+ def getPublicKey(domain: String)(implicit client: Http, ec: scala.concurrent.ExecutionContext): Future[String] = {
val req = host("s3-eu-west-1.amazonaws.com").secure / bucketName / s"$domain.settings.public"
client(req OK as.String).either.left.map(new PublicKeyAcquisitionException(_)).map { attemptedKey =>
attemptedKey.right.flatMap(validateKey)
+ } flatMap {
+ case Right(key) => Future.successful(key)
+ case Left(err) => Future.failed(err)
}
}
private[pandomainauth] def validateKey(pubKey: String): Either[Throwable, String] = {
if ("[a-zA-Z0-9+/]+={0,3}".r.pattern.matcher(pubKey).matches) Right(pubKey)
else Left(PublicKeyFormatException)
}
class PublicKeyAcquisitionException(cause: Throwable) extends Exception(cause.getMessage, cause)
object PublicKeyFormatException extends Exception("Invalid public key")
} | 5 | 0.185185 | 4 | 1 |
50130fa011104806cc66331fe5a6ebc3f98c9d5c | vistrails/packages/tej/widgets.py | vistrails/packages/tej/widgets.py | from __future__ import division
from PyQt4 import QtGui
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
class ShellSourceConfigurationWidget(SourceConfigurationWidget):
"""Configuration widget for SubmitShellJob.
Allows the user to edit a shell script that will be run on the server.
"""
def __init__(self, module, controller, parent=None):
SourceConfigurationWidget.__init__(self, module, controller,
QtGui.QTextEdit,
has_inputs=False, has_outputs=False,
parent=parent)
| from __future__ import division
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
from vistrails.gui.modules.string_configure import TextEditor
class ShellSourceConfigurationWidget(SourceConfigurationWidget):
"""Configuration widget for SubmitShellJob.
Allows the user to edit a shell script that will be run on the server.
"""
def __init__(self, module, controller, parent=None):
SourceConfigurationWidget.__init__(self, module, controller,
TextEditor,
has_inputs=False, has_outputs=False,
parent=parent)
| Use smart text editor in tej.SubmitShellJob | Use smart text editor in tej.SubmitShellJob
| Python | bsd-3-clause | minesense/VisTrails,VisTrails/VisTrails,hjanime/VisTrails,hjanime/VisTrails,hjanime/VisTrails,minesense/VisTrails,VisTrails/VisTrails,hjanime/VisTrails,minesense/VisTrails,VisTrails/VisTrails,VisTrails/VisTrails,minesense/VisTrails,minesense/VisTrails,hjanime/VisTrails,VisTrails/VisTrails | python | ## Code Before:
from __future__ import division
from PyQt4 import QtGui
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
class ShellSourceConfigurationWidget(SourceConfigurationWidget):
"""Configuration widget for SubmitShellJob.
Allows the user to edit a shell script that will be run on the server.
"""
def __init__(self, module, controller, parent=None):
SourceConfigurationWidget.__init__(self, module, controller,
QtGui.QTextEdit,
has_inputs=False, has_outputs=False,
parent=parent)
## Instruction:
Use smart text editor in tej.SubmitShellJob
## Code After:
from __future__ import division
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
from vistrails.gui.modules.string_configure import TextEditor
class ShellSourceConfigurationWidget(SourceConfigurationWidget):
"""Configuration widget for SubmitShellJob.
Allows the user to edit a shell script that will be run on the server.
"""
def __init__(self, module, controller, parent=None):
SourceConfigurationWidget.__init__(self, module, controller,
TextEditor,
has_inputs=False, has_outputs=False,
parent=parent)
| from __future__ import division
- from PyQt4 import QtGui
-
from vistrails.gui.modules.source_configure import SourceConfigurationWidget
+ from vistrails.gui.modules.string_configure import TextEditor
class ShellSourceConfigurationWidget(SourceConfigurationWidget):
"""Configuration widget for SubmitShellJob.
Allows the user to edit a shell script that will be run on the server.
"""
def __init__(self, module, controller, parent=None):
SourceConfigurationWidget.__init__(self, module, controller,
- QtGui.QTextEdit,
? -------
+ TextEditor,
? ++
has_inputs=False, has_outputs=False,
parent=parent) | 5 | 0.294118 | 2 | 3 |
332d319d5291340371534aa1ba51ccced31705de | README.md | README.md | A static web site starter kit using Gulp and Hugo static site generator
## How to use
## Features
## Documentation
You're reading it. For further info see docs for incorportated tools
(Gulp)[https://github.com/gulpjs/gulp/tree/master/docs]
(Hugo)[https://gohugo.io/overview/introduction/]
### Gulp plugins used
(gulp-sass)[https://www.npmjs.com/package/gulp-sass]
(gulp-sourcemaps)[https://www.npmjs.com/package/gulp-sourcemaps]
(gulp-postcss)[https://www.npmjs.com/package/gulp-postcss]
### PostCSS plugins used
(Autoprefixer)[https://www.npmjs.com/package/autoprefixer]
(Colorguard)[https://www.npmjs.com/package/colorguard]
(PostCSS Reporter)[https://www.npmjs.com/package/postcss-reporter]
## Someday features
Yeoman generator to generate this.
| A static web site starter kit using Gulp and Hugo static site generator
## How to use
## Features
## Documentation
You're reading it. For further info see docs for incorportated tools
(Gulp)[https://github.com/gulpjs/gulp/tree/master/docs]
(Hugo)[https://gohugo.io/overview/introduction/]
### Gulp plugins used
(gulp-load-plugins)[https://www.npmjs.com/package/gulp-load-plugins]
(gulp-sass)[https://www.npmjs.com/package/gulp-sass]
(gulp-sourcemaps)[https://www.npmjs.com/package/gulp-sourcemaps]
(gulp-postcss)[https://www.npmjs.com/package/gulp-postcss]
(gulp-uglify)[https://www.npmjs.com/package/gulp-uglify]
### PostCSS plugins used
(Autoprefixer)[https://www.npmjs.com/package/autoprefixer]
(Colorguard)[https://www.npmjs.com/package/colorguard]
(PostCSS Reporter)[https://www.npmjs.com/package/postcss-reporter]
## Someday features
Yeoman generator to generate this.
| Add more links to gulp plugins used | Add more links to gulp plugins used
| Markdown | mit | adrinux/web-starter-hugo,adrinux/web-starter-hugo | markdown | ## Code Before:
A static web site starter kit using Gulp and Hugo static site generator
## How to use
## Features
## Documentation
You're reading it. For further info see docs for incorportated tools
(Gulp)[https://github.com/gulpjs/gulp/tree/master/docs]
(Hugo)[https://gohugo.io/overview/introduction/]
### Gulp plugins used
(gulp-sass)[https://www.npmjs.com/package/gulp-sass]
(gulp-sourcemaps)[https://www.npmjs.com/package/gulp-sourcemaps]
(gulp-postcss)[https://www.npmjs.com/package/gulp-postcss]
### PostCSS plugins used
(Autoprefixer)[https://www.npmjs.com/package/autoprefixer]
(Colorguard)[https://www.npmjs.com/package/colorguard]
(PostCSS Reporter)[https://www.npmjs.com/package/postcss-reporter]
## Someday features
Yeoman generator to generate this.
## Instruction:
Add more links to gulp plugins used
## Code After:
A static web site starter kit using Gulp and Hugo static site generator
## How to use
## Features
## Documentation
You're reading it. For further info see docs for incorportated tools
(Gulp)[https://github.com/gulpjs/gulp/tree/master/docs]
(Hugo)[https://gohugo.io/overview/introduction/]
### Gulp plugins used
(gulp-load-plugins)[https://www.npmjs.com/package/gulp-load-plugins]
(gulp-sass)[https://www.npmjs.com/package/gulp-sass]
(gulp-sourcemaps)[https://www.npmjs.com/package/gulp-sourcemaps]
(gulp-postcss)[https://www.npmjs.com/package/gulp-postcss]
(gulp-uglify)[https://www.npmjs.com/package/gulp-uglify]
### PostCSS plugins used
(Autoprefixer)[https://www.npmjs.com/package/autoprefixer]
(Colorguard)[https://www.npmjs.com/package/colorguard]
(PostCSS Reporter)[https://www.npmjs.com/package/postcss-reporter]
## Someday features
Yeoman generator to generate this.
| A static web site starter kit using Gulp and Hugo static site generator
## How to use
## Features
## Documentation
You're reading it. For further info see docs for incorportated tools
(Gulp)[https://github.com/gulpjs/gulp/tree/master/docs]
(Hugo)[https://gohugo.io/overview/introduction/]
### Gulp plugins used
+ (gulp-load-plugins)[https://www.npmjs.com/package/gulp-load-plugins]
(gulp-sass)[https://www.npmjs.com/package/gulp-sass]
(gulp-sourcemaps)[https://www.npmjs.com/package/gulp-sourcemaps]
(gulp-postcss)[https://www.npmjs.com/package/gulp-postcss]
+ (gulp-uglify)[https://www.npmjs.com/package/gulp-uglify]
### PostCSS plugins used
(Autoprefixer)[https://www.npmjs.com/package/autoprefixer]
(Colorguard)[https://www.npmjs.com/package/colorguard]
(PostCSS Reporter)[https://www.npmjs.com/package/postcss-reporter]
## Someday features
Yeoman generator to generate this. | 2 | 0.068966 | 2 | 0 |
cefc3d6a30159564b2287f8b803585282fadf1e5 | app/src/main/res/layout/list_item.xml | app/src/main/res/layout/list_item.xml | <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/vorschau"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/icon"
android:paddingBottom="10dp"
android:textColor="#CC0033"
android:textSize="16dp" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_toRightOf="@+id/icon"
android:paddingLeft="10dp"
android:textColor="#3399FF"
android:textSize="14dp" />
</RelativeLayout> | <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/vorschau"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/icon"
android:paddingBottom="10dp"
android:textColor="#CC0033"
android:textSize="16sp" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_toEndOf="@+id/icon"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#3399FF"
android:textSize="14sp" />
</RelativeLayout> | Improve layout as suggested by AndroidStudio | Improve layout as suggested by AndroidStudio
| XML | apache-2.0 | eMTeeWare/eMTeeSeason | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/vorschau"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/icon"
android:paddingBottom="10dp"
android:textColor="#CC0033"
android:textSize="16dp" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_toRightOf="@+id/icon"
android:paddingLeft="10dp"
android:textColor="#3399FF"
android:textSize="14dp" />
</RelativeLayout>
## Instruction:
Improve layout as suggested by AndroidStudio
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/vorschau"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/icon"
android:paddingBottom="10dp"
android:textColor="#CC0033"
android:textSize="16sp" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_toEndOf="@+id/icon"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="#3399FF"
android:textSize="14sp" />
</RelativeLayout> | <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/vorschau"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toRightOf="@+id/icon"
? ^^^^^
+ android:layout_toEndOf="@+id/icon"
? ^^^
android:paddingBottom="10dp"
android:textColor="#CC0033"
- android:textSize="16dp" />
? ^
+ android:textSize="16sp" />
? ^
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
- android:layout_toRightOf="@+id/icon"
? ^^^^^
+ android:layout_toEndOf="@+id/icon"
? ^^^
- android:paddingLeft="10dp"
? ^^^
+ android:paddingStart="10dp"
? ^^^^
+ android:paddingEnd="10dp"
android:textColor="#3399FF"
- android:textSize="14dp" />
? ^
+ android:textSize="14sp" />
? ^
</RelativeLayout> | 11 | 0.354839 | 6 | 5 |
2f9fef47e9d0278260bcbf83f29272678c7ce85b | CHANGES.md | CHANGES.md |
1. New method getResolver() to export a resolver class instance.
2. require() and resolve() now take an optional options object. Options allow use of user defined resolver and root directory.
3. Calculation of root directory improved.
## Version 0.1.0
1. Now exports one function with other methods attached. So: loader.require() becomes loader().
| 1. Added an importDirectory() method to load all modules in a directory.
## Version 0.2.0
1. New method getResolver() to export a resolver class instance.
2. require() and resolve() now take an optional options object. Options allow use of user defined resolver and root directory.
3. Calculation of root directory improved.
## Version 0.1.0
1. Now exports one function with other methods attached. So: loader.require() becomes loader().
| Update to reflect changes in v0.3.0 | Update to reflect changes in v0.3.0 | Markdown | mit | ssimpo/require-extra,ssimpo/require-extra | markdown | ## Code Before:
1. New method getResolver() to export a resolver class instance.
2. require() and resolve() now take an optional options object. Options allow use of user defined resolver and root directory.
3. Calculation of root directory improved.
## Version 0.1.0
1. Now exports one function with other methods attached. So: loader.require() becomes loader().
## Instruction:
Update to reflect changes in v0.3.0
## Code After:
1. Added an importDirectory() method to load all modules in a directory.
## Version 0.2.0
1. New method getResolver() to export a resolver class instance.
2. require() and resolve() now take an optional options object. Options allow use of user defined resolver and root directory.
3. Calculation of root directory improved.
## Version 0.1.0
1. Now exports one function with other methods attached. So: loader.require() becomes loader().
| + 1. Added an importDirectory() method to load all modules in a directory.
+
+ ## Version 0.2.0
1. New method getResolver() to export a resolver class instance.
2. require() and resolve() now take an optional options object. Options allow use of user defined resolver and root directory.
3. Calculation of root directory improved.
## Version 0.1.0
1. Now exports one function with other methods attached. So: loader.require() becomes loader().
| 3 | 0.333333 | 3 | 0 |
366937921cfb13fd83fb5964d0373be48e3c8564 | cmsplugin_plain_text/models.py | cmsplugin_plain_text/models.py | from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Plaintext(CMSPlugin):
body = models.TextField(_('Plaintext'))
def __unicode__(self):
return self.body
| from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Plaintext(CMSPlugin):
body = models.TextField(_('Plaintext'))
def __unicode__(self):
return self.body
def __str__(self):
return self.body
| Add `__str__` method to support Python 3 | Add `__str__` method to support Python 3
| Python | bsd-3-clause | chschuermann/cmsplugin-plain-text,chschuermann/cmsplugin-plain-text | python | ## Code Before:
from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Plaintext(CMSPlugin):
body = models.TextField(_('Plaintext'))
def __unicode__(self):
return self.body
## Instruction:
Add `__str__` method to support Python 3
## Code After:
from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Plaintext(CMSPlugin):
body = models.TextField(_('Plaintext'))
def __unicode__(self):
return self.body
def __str__(self):
return self.body
| from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Plaintext(CMSPlugin):
body = models.TextField(_('Plaintext'))
def __unicode__(self):
return self.body
+
+ def __str__(self):
+ return self.body | 3 | 0.3 | 3 | 0 |
5e9955e7604dfeced82c0d4e62e483ef20d5949d | fakeetc.gemspec | fakeetc.gemspec | require File.expand_path('../lib/fakeetc/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Sebastian Boehm']
gem.email = ['sebastian@sometimesfood.org']
gem.license = 'MIT'
gem.summary = 'A fake Etc module for your tests'
gem.homepage = 'https://github.com/sometimesfood/fakeetc'
gem.description = <<EOS
FakeEtc is a fake Etc module for your tests.
EOS
gem.files = Dir['{bin,lib,man,spec}/**/*',
'Rakefile',
'README.md',
'NEWS.md',
'LICENSE'] & `git ls-files -z`.split("\0")
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'fakeetc'
gem.require_paths = ['lib']
gem.version = FakeEtc::VERSION
gem.add_development_dependency 'rake', '~> 10.4.2'
gem.add_development_dependency 'minitest', '~> 5.6.0'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
end
| require File.expand_path('../lib/fakeetc/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Sebastian Boehm']
gem.email = ['sebastian@sometimesfood.org']
gem.license = 'MIT'
gem.summary = 'A fake Etc module for your tests'
gem.homepage = 'https://github.com/sometimesfood/fakeetc'
gem.description = <<EOS
FakeEtc is a fake Etc module for your tests.
EOS
gem.files = Dir['{bin,lib,man,spec}/**/*',
'Rakefile',
'README.md',
'NEWS.md',
'LICENSE'] & `git ls-files -z`.split("\0")
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'fakeetc'
gem.require_paths = ['lib']
gem.version = FakeEtc::VERSION
gem.required_ruby_version = '>= 1.9.3'
gem.add_development_dependency 'rake', '~> 10.4.2'
gem.add_development_dependency 'minitest', '~> 5.6.0'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
end
| Add required Ruby version to gemspec | Add required Ruby version to gemspec
| Ruby | mit | sometimesfood/fakeetc | ruby | ## Code Before:
require File.expand_path('../lib/fakeetc/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Sebastian Boehm']
gem.email = ['sebastian@sometimesfood.org']
gem.license = 'MIT'
gem.summary = 'A fake Etc module for your tests'
gem.homepage = 'https://github.com/sometimesfood/fakeetc'
gem.description = <<EOS
FakeEtc is a fake Etc module for your tests.
EOS
gem.files = Dir['{bin,lib,man,spec}/**/*',
'Rakefile',
'README.md',
'NEWS.md',
'LICENSE'] & `git ls-files -z`.split("\0")
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'fakeetc'
gem.require_paths = ['lib']
gem.version = FakeEtc::VERSION
gem.add_development_dependency 'rake', '~> 10.4.2'
gem.add_development_dependency 'minitest', '~> 5.6.0'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
end
## Instruction:
Add required Ruby version to gemspec
## Code After:
require File.expand_path('../lib/fakeetc/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Sebastian Boehm']
gem.email = ['sebastian@sometimesfood.org']
gem.license = 'MIT'
gem.summary = 'A fake Etc module for your tests'
gem.homepage = 'https://github.com/sometimesfood/fakeetc'
gem.description = <<EOS
FakeEtc is a fake Etc module for your tests.
EOS
gem.files = Dir['{bin,lib,man,spec}/**/*',
'Rakefile',
'README.md',
'NEWS.md',
'LICENSE'] & `git ls-files -z`.split("\0")
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'fakeetc'
gem.require_paths = ['lib']
gem.version = FakeEtc::VERSION
gem.required_ruby_version = '>= 1.9.3'
gem.add_development_dependency 'rake', '~> 10.4.2'
gem.add_development_dependency 'minitest', '~> 5.6.0'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
end
| require File.expand_path('../lib/fakeetc/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['Sebastian Boehm']
gem.email = ['sebastian@sometimesfood.org']
gem.license = 'MIT'
gem.summary = 'A fake Etc module for your tests'
gem.homepage = 'https://github.com/sometimesfood/fakeetc'
gem.description = <<EOS
FakeEtc is a fake Etc module for your tests.
EOS
gem.files = Dir['{bin,lib,man,spec}/**/*',
'Rakefile',
'README.md',
'NEWS.md',
'LICENSE'] & `git ls-files -z`.split("\0")
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = 'fakeetc'
gem.require_paths = ['lib']
gem.version = FakeEtc::VERSION
+ gem.required_ruby_version = '>= 1.9.3'
+
gem.add_development_dependency 'rake', '~> 10.4.2'
gem.add_development_dependency 'minitest', '~> 5.6.0'
gem.add_development_dependency 'yard', '~> 0.8.7.6'
end | 2 | 0.074074 | 2 | 0 |
5afd7d6884b996be0a0569541f711d479f9e6c32 | Project2/apptbook/src/main/java/edu/pdx/cs410J/chances/TextParser.java | Project2/apptbook/src/main/java/edu/pdx/cs410J/chances/TextParser.java | package edu.pdx.cs410J.chances;
import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;
/**
* @author chancesnow
*/
public class TextParser implements AppointmentBookParser
{
@Override
public AbstractAppointmentBook parse() throws ParserException
{
return null;
}
}
| package edu.pdx.cs410J.chances;
import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;
import java.io.File;
/**
* @author chancesnow
*/
public class TextParser implements AppointmentBookParser
{
private File file;
public TextParser(String filePath)
{
file = new File(filePath);
if (!file.exists() || !file.isDirectory()) {
file = null;
}
}
@Override
public AbstractAppointmentBook parse() throws ParserException
{
return null;
}
}
| Add constructor accepting file path | Add constructor accepting file path
| Java | mit | chances/cs410-adv-java,chances/cs410-adv-java,chances/cs410-adv-java | java | ## Code Before:
package edu.pdx.cs410J.chances;
import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;
/**
* @author chancesnow
*/
public class TextParser implements AppointmentBookParser
{
@Override
public AbstractAppointmentBook parse() throws ParserException
{
return null;
}
}
## Instruction:
Add constructor accepting file path
## Code After:
package edu.pdx.cs410J.chances;
import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;
import java.io.File;
/**
* @author chancesnow
*/
public class TextParser implements AppointmentBookParser
{
private File file;
public TextParser(String filePath)
{
file = new File(filePath);
if (!file.exists() || !file.isDirectory()) {
file = null;
}
}
@Override
public AbstractAppointmentBook parse() throws ParserException
{
return null;
}
}
| package edu.pdx.cs410J.chances;
import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;
+ import java.io.File;
+
/**
* @author chancesnow
*/
public class TextParser implements AppointmentBookParser
{
+ private File file;
+
+ public TextParser(String filePath)
+ {
+ file = new File(filePath);
+
+ if (!file.exists() || !file.isDirectory()) {
+ file = null;
+ }
+ }
+
@Override
public AbstractAppointmentBook parse() throws ParserException
{
return null;
}
} | 13 | 0.764706 | 13 | 0 |
cc929a194926328bde6f7d25e0a606eb07a85219 | index.css | index.css | html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}
header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}
header h1 {
font-size: 50px;
font-weight: 100;
margin: 0;
padding: 0;
}
.menu {
height: 35px;
width: 100%;
background-color: darkmagenta;
}
.container {
height: 100%;
display: flex;
display: -webkit-flex;
}
#sidebar {
width: 150px;
background-color:rgb(38, 50, 56);
}
#feeds {
width: 250px;
overflow: hidden;
background-color: yellow;
}
#feeds:hover {
overflow-y: scroll;
}
#feed-active{
color: coral;
}
.feed {
}
#preview {
flex: 1;
background-color: green;
} | html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}
header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}
header h1 {
font-size: 50px;
font-weight: 100;
margin: 0;
padding: 0;
}
.menu {
height: 35px;
width: 100%;
background-color: darkmagenta;
}
.container {
height: 100%;
display: flex;
display: -webkit-flex;
}
#sidebar {
width: 150px;
background-color:rgb(38, 50, 56);
color: white;
}
#feeds {
width: 250px;
overflow: hidden;
background-color: yellow;
}
#feeds:hover {
overflow-y: scroll;
}
#feed-active{
color: coral;
}
.feed {
}
#preview {
flex: 1;
background-color: green;
} | Fix so that sidebar is readable | Fix so that sidebar is readable
| CSS | mit | kevbui/bruit,kevbui/bruit | css | ## Code Before:
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}
header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}
header h1 {
font-size: 50px;
font-weight: 100;
margin: 0;
padding: 0;
}
.menu {
height: 35px;
width: 100%;
background-color: darkmagenta;
}
.container {
height: 100%;
display: flex;
display: -webkit-flex;
}
#sidebar {
width: 150px;
background-color:rgb(38, 50, 56);
}
#feeds {
width: 250px;
overflow: hidden;
background-color: yellow;
}
#feeds:hover {
overflow-y: scroll;
}
#feed-active{
color: coral;
}
.feed {
}
#preview {
flex: 1;
background-color: green;
}
## Instruction:
Fix so that sidebar is readable
## Code After:
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}
header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}
header h1 {
font-size: 50px;
font-weight: 100;
margin: 0;
padding: 0;
}
.menu {
height: 35px;
width: 100%;
background-color: darkmagenta;
}
.container {
height: 100%;
display: flex;
display: -webkit-flex;
}
#sidebar {
width: 150px;
background-color:rgb(38, 50, 56);
color: white;
}
#feeds {
width: 250px;
overflow: hidden;
background-color: yellow;
}
#feeds:hover {
overflow-y: scroll;
}
#feed-active{
color: coral;
}
.feed {
}
#preview {
flex: 1;
background-color: green;
} | html,
body {
padding: 0;
margin: 0;
height: 100%;
}
body {
font-family: -apple-system, 'Helvetica Neue', Helvetica, sans-serif;
}
header {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
margin-top: -125px;
margin-left: -250px;
text-align: center;
}
header h1 {
font-size: 50px;
font-weight: 100;
margin: 0;
padding: 0;
}
.menu {
height: 35px;
width: 100%;
background-color: darkmagenta;
}
.container {
height: 100%;
display: flex;
display: -webkit-flex;
}
#sidebar {
width: 150px;
background-color:rgb(38, 50, 56);
+ color: white;
}
#feeds {
width: 250px;
overflow: hidden;
background-color: yellow;
}
#feeds:hover {
overflow-y: scroll;
}
#feed-active{
color: coral;
}
.feed {
}
#preview {
flex: 1;
background-color: green;
} | 1 | 0.014706 | 1 | 0 |
ab6293bbe039cb0c939493c3b921f114ad68645b | tests/test_plugin_execute.py | tests/test_plugin_execute.py |
from irc3.testing import BotTestCase
class ExecutePluginTestCase(BotTestCase):
config = {
'includes': [
'onebot.plugins.execute'
],
'onebot.plugins.execute': {
'commands': [
'command1',
'command2'
]
}
}
def setUp(self):
super(ExecutePluginTestCase, self).setUp()
self.callFTU()
self.bot.db = {}
def test_command_allowed(self):
self.bot.notify('connection_made')
self.assertSent(['command1', 'command2'])
|
from irc3.testing import BotTestCase
class ExecutePluginTestCase(BotTestCase):
config = {
'includes': [
'onebot.plugins.execute'
],
'onebot.plugins.execute': {
'commands': [
'command1',
'command2'
]
}
}
def setUp(self):
super(ExecutePluginTestCase, self).setUp()
self.callFTU()
self.bot.db = {}
def test_connection_made(self):
self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
self.assertSent(['command1', 'command2'])
| Fix test for connection made | Fix test for connection made
| Python | bsd-3-clause | thomwiggers/onebot | python | ## Code Before:
from irc3.testing import BotTestCase
class ExecutePluginTestCase(BotTestCase):
config = {
'includes': [
'onebot.plugins.execute'
],
'onebot.plugins.execute': {
'commands': [
'command1',
'command2'
]
}
}
def setUp(self):
super(ExecutePluginTestCase, self).setUp()
self.callFTU()
self.bot.db = {}
def test_command_allowed(self):
self.bot.notify('connection_made')
self.assertSent(['command1', 'command2'])
## Instruction:
Fix test for connection made
## Code After:
from irc3.testing import BotTestCase
class ExecutePluginTestCase(BotTestCase):
config = {
'includes': [
'onebot.plugins.execute'
],
'onebot.plugins.execute': {
'commands': [
'command1',
'command2'
]
}
}
def setUp(self):
super(ExecutePluginTestCase, self).setUp()
self.callFTU()
self.bot.db = {}
def test_connection_made(self):
self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
self.assertSent(['command1', 'command2'])
|
from irc3.testing import BotTestCase
class ExecutePluginTestCase(BotTestCase):
config = {
'includes': [
'onebot.plugins.execute'
],
'onebot.plugins.execute': {
'commands': [
'command1',
'command2'
]
}
}
def setUp(self):
super(ExecutePluginTestCase, self).setUp()
self.callFTU()
self.bot.db = {}
- def test_command_allowed(self):
- self.bot.notify('connection_made')
+ def test_connection_made(self):
+ self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
self.assertSent(['command1', 'command2']) | 4 | 0.153846 | 2 | 2 |
9d4dca76abb3f6fb0f107c93874942496f4f8e7b | src/healthcheck/__init__.py | src/healthcheck/__init__.py |
import requests
class Healthcheck:
def __init__(self):
pass
def _result(self, site, health, response=None, message=None):
result = {
"name": site["name"],
"health": health
}
if message:
result["message"] = message
if response is not None:
result["status"] = response.status_code
result["response_time_ms"] = int(response.elapsed.total_seconds() * 1000)
return result
def check_site(self, site):
response = None
try:
response = requests.get(site["url"])
if response.status_code not in site["acceptable_statuses"]:
print("Bad status code: {}".format(response.status_code))
return self._result(site, "DOWN", response, "Unacceptable status code")
for mandatory_string in site.get("mandatory_strings", []):
if mandatory_string not in response.text:
print("String not found in response: " + mandatory_string)
return self._result(site, "DOWN", response, "String not found in response: {}".format(mandatory_string))
return self._result(site, "UP", response)
except Exception as err:
print(err)
return self._result(site, "UNKNOWN", response, "Exception while trying to check site health: {}".format(err))
|
import requests
class Healthcheck:
def __init__(self):
pass
def _result(self, site, health, response=None, message=None):
result = {
"name": site["name"],
"health": health
}
if message:
result["message"] = message
if response is not None:
result["status"] = response.status_code
result["response_time_ms"] = int(response.elapsed.total_seconds() * 1000)
return result
def check_site(self, site):
response = None
try:
print(f"Checking site {site['name']}")
response = requests.get(site["url"])
if response.status_code not in site["acceptable_statuses"]:
print("Bad status code: {}".format(response.status_code))
return self._result(site, "DOWN", response, "Unacceptable status code")
for mandatory_string in site.get("mandatory_strings", []):
if mandatory_string not in response.text:
print("String not found in response: " + mandatory_string)
return self._result(site, "DOWN", response, "String not found in response: {}".format(mandatory_string))
return self._result(site, "UP", response)
except Exception as err:
print(err)
return self._result(site, "UNKNOWN", response, "Exception while trying to check site health: {}".format(err))
| Debug print each health check | Debug print each health check
| Python | mit | Vilsepi/nysseituu,Vilsepi/nysseituu | python | ## Code Before:
import requests
class Healthcheck:
def __init__(self):
pass
def _result(self, site, health, response=None, message=None):
result = {
"name": site["name"],
"health": health
}
if message:
result["message"] = message
if response is not None:
result["status"] = response.status_code
result["response_time_ms"] = int(response.elapsed.total_seconds() * 1000)
return result
def check_site(self, site):
response = None
try:
response = requests.get(site["url"])
if response.status_code not in site["acceptable_statuses"]:
print("Bad status code: {}".format(response.status_code))
return self._result(site, "DOWN", response, "Unacceptable status code")
for mandatory_string in site.get("mandatory_strings", []):
if mandatory_string not in response.text:
print("String not found in response: " + mandatory_string)
return self._result(site, "DOWN", response, "String not found in response: {}".format(mandatory_string))
return self._result(site, "UP", response)
except Exception as err:
print(err)
return self._result(site, "UNKNOWN", response, "Exception while trying to check site health: {}".format(err))
## Instruction:
Debug print each health check
## Code After:
import requests
class Healthcheck:
def __init__(self):
pass
def _result(self, site, health, response=None, message=None):
result = {
"name": site["name"],
"health": health
}
if message:
result["message"] = message
if response is not None:
result["status"] = response.status_code
result["response_time_ms"] = int(response.elapsed.total_seconds() * 1000)
return result
def check_site(self, site):
response = None
try:
print(f"Checking site {site['name']}")
response = requests.get(site["url"])
if response.status_code not in site["acceptable_statuses"]:
print("Bad status code: {}".format(response.status_code))
return self._result(site, "DOWN", response, "Unacceptable status code")
for mandatory_string in site.get("mandatory_strings", []):
if mandatory_string not in response.text:
print("String not found in response: " + mandatory_string)
return self._result(site, "DOWN", response, "String not found in response: {}".format(mandatory_string))
return self._result(site, "UP", response)
except Exception as err:
print(err)
return self._result(site, "UNKNOWN", response, "Exception while trying to check site health: {}".format(err))
|
import requests
class Healthcheck:
def __init__(self):
pass
def _result(self, site, health, response=None, message=None):
result = {
"name": site["name"],
"health": health
}
if message:
result["message"] = message
if response is not None:
result["status"] = response.status_code
result["response_time_ms"] = int(response.elapsed.total_seconds() * 1000)
return result
def check_site(self, site):
response = None
try:
+ print(f"Checking site {site['name']}")
response = requests.get(site["url"])
if response.status_code not in site["acceptable_statuses"]:
print("Bad status code: {}".format(response.status_code))
return self._result(site, "DOWN", response, "Unacceptable status code")
for mandatory_string in site.get("mandatory_strings", []):
if mandatory_string not in response.text:
print("String not found in response: " + mandatory_string)
return self._result(site, "DOWN", response, "String not found in response: {}".format(mandatory_string))
return self._result(site, "UP", response)
except Exception as err:
print(err)
return self._result(site, "UNKNOWN", response, "Exception while trying to check site health: {}".format(err)) | 1 | 0.027778 | 1 | 0 |
079fd7936d29c487e31a3850aba852b0e20436e0 | src/Input/Cabal.hs | src/Input/Cabal.hs | {-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-}
module Input.Cabal(parseCabal) where
import Data.List.Extra
import System.FilePath
import Control.Applicative
import qualified Data.Map as Map
import qualified Data.ByteString.Lazy.Char8 as LBS
import Util
-- items are stored as:
-- QuickCheck/2.7.5/QuickCheck.cabal
-- QuickCheck/2.7.6/QuickCheck.cabal
parseCabal :: (String -> Bool) -> IO (Map.Map String [String])
parseCabal want = foldl f Map.empty <$> tarballReadFiles "input/cabal.tar.gz"
where
-- rely on the fact the highest version is last, and lazy evaluation
-- skips us from actually parsing the previous values
f mp (name, body) | want pkg = Map.insert pkg (extractCabal $ LBS.unpack body) mp
| otherwise = mp
where pkg = takeBaseName name
extractCabal :: String -> [String]
extractCabal src = f ["license"] ++ f ["category"] ++ f ["author","maintainer"]
where
f name = nub [ "@" ++ head name ++ " " ++ intercalate ", " xs
| x <- lines src, let (a,b) = break (== ':') x, lower a `elem` name
, let xs = filter (/= "") $ map g $ split (`elem` ",&") $ drop 1 b, not $ null xs]
g = unwords . filter ('@' `notElem`) . words . takeWhile (`notElem` "<(")
| {-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-}
module Input.Cabal(parseCabal) where
import Data.List.Extra
import System.FilePath
import Control.Applicative
import qualified Data.Map as Map
import qualified Data.ByteString.Lazy.Char8 as LBS
import Util
-- items are stored as:
-- QuickCheck/2.7.5/QuickCheck.cabal
-- QuickCheck/2.7.6/QuickCheck.cabal
parseCabal :: (String -> Bool) -> IO (Map.Map String [String])
parseCabal want = foldl f Map.empty <$> tarballReadFiles "input/cabal.tar.gz"
where
-- rely on the fact the highest version is last, and lazy evaluation
-- skips us from actually parsing the previous values
f mp (name, body) | want pkg = Map.insert pkg (extractCabal $ LBS.unpack body) mp
| otherwise = mp
where pkg = takeBaseName name
extractCabal :: String -> [String]
extractCabal src = f ["license"] ++ f ["category"] ++ f ["author","maintainer"]
where
f name = nub [ "@" ++ head name ++ " " ++ intercalate ", " xs
| x <- lines src, let (a,b) = break (== ':') x, lower a `elem` name
, let xs = filter (/= "") $ map g $ concatMap (splitOn "and") $ split (`elem` ",&") $ drop 1 b, not $ null xs]
g = unwords . filter ('@' `notElem`) . words . takeWhile (`notElem` "<(")
| Split author names on "and" | Split author names on "and"
| Haskell | bsd-3-clause | ndmitchell/hoogle,ndmitchell/hoogle,BartAdv/hoogle,wolftune/hoogle,wolftune/hoogle,ndmitchell/hoogle,ndmitchell/hogle-dead,ndmitchell/hogle-dead,wolftune/hoogle,BartAdv/hoogle,wolftune/hoogle,BartAdv/hoogle,BartAdv/hoogle | haskell | ## Code Before:
{-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-}
module Input.Cabal(parseCabal) where
import Data.List.Extra
import System.FilePath
import Control.Applicative
import qualified Data.Map as Map
import qualified Data.ByteString.Lazy.Char8 as LBS
import Util
-- items are stored as:
-- QuickCheck/2.7.5/QuickCheck.cabal
-- QuickCheck/2.7.6/QuickCheck.cabal
parseCabal :: (String -> Bool) -> IO (Map.Map String [String])
parseCabal want = foldl f Map.empty <$> tarballReadFiles "input/cabal.tar.gz"
where
-- rely on the fact the highest version is last, and lazy evaluation
-- skips us from actually parsing the previous values
f mp (name, body) | want pkg = Map.insert pkg (extractCabal $ LBS.unpack body) mp
| otherwise = mp
where pkg = takeBaseName name
extractCabal :: String -> [String]
extractCabal src = f ["license"] ++ f ["category"] ++ f ["author","maintainer"]
where
f name = nub [ "@" ++ head name ++ " " ++ intercalate ", " xs
| x <- lines src, let (a,b) = break (== ':') x, lower a `elem` name
, let xs = filter (/= "") $ map g $ split (`elem` ",&") $ drop 1 b, not $ null xs]
g = unwords . filter ('@' `notElem`) . words . takeWhile (`notElem` "<(")
## Instruction:
Split author names on "and"
## Code After:
{-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-}
module Input.Cabal(parseCabal) where
import Data.List.Extra
import System.FilePath
import Control.Applicative
import qualified Data.Map as Map
import qualified Data.ByteString.Lazy.Char8 as LBS
import Util
-- items are stored as:
-- QuickCheck/2.7.5/QuickCheck.cabal
-- QuickCheck/2.7.6/QuickCheck.cabal
parseCabal :: (String -> Bool) -> IO (Map.Map String [String])
parseCabal want = foldl f Map.empty <$> tarballReadFiles "input/cabal.tar.gz"
where
-- rely on the fact the highest version is last, and lazy evaluation
-- skips us from actually parsing the previous values
f mp (name, body) | want pkg = Map.insert pkg (extractCabal $ LBS.unpack body) mp
| otherwise = mp
where pkg = takeBaseName name
extractCabal :: String -> [String]
extractCabal src = f ["license"] ++ f ["category"] ++ f ["author","maintainer"]
where
f name = nub [ "@" ++ head name ++ " " ++ intercalate ", " xs
| x <- lines src, let (a,b) = break (== ':') x, lower a `elem` name
, let xs = filter (/= "") $ map g $ concatMap (splitOn "and") $ split (`elem` ",&") $ drop 1 b, not $ null xs]
g = unwords . filter ('@' `notElem`) . words . takeWhile (`notElem` "<(")
| {-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-}
module Input.Cabal(parseCabal) where
import Data.List.Extra
import System.FilePath
import Control.Applicative
import qualified Data.Map as Map
import qualified Data.ByteString.Lazy.Char8 as LBS
import Util
-- items are stored as:
-- QuickCheck/2.7.5/QuickCheck.cabal
-- QuickCheck/2.7.6/QuickCheck.cabal
parseCabal :: (String -> Bool) -> IO (Map.Map String [String])
parseCabal want = foldl f Map.empty <$> tarballReadFiles "input/cabal.tar.gz"
where
-- rely on the fact the highest version is last, and lazy evaluation
-- skips us from actually parsing the previous values
f mp (name, body) | want pkg = Map.insert pkg (extractCabal $ LBS.unpack body) mp
| otherwise = mp
where pkg = takeBaseName name
extractCabal :: String -> [String]
extractCabal src = f ["license"] ++ f ["category"] ++ f ["author","maintainer"]
where
f name = nub [ "@" ++ head name ++ " " ++ intercalate ", " xs
| x <- lines src, let (a,b) = break (== ':') x, lower a `elem` name
- , let xs = filter (/= "") $ map g $ split (`elem` ",&") $ drop 1 b, not $ null xs]
+ , let xs = filter (/= "") $ map g $ concatMap (splitOn "and") $ split (`elem` ",&") $ drop 1 b, not $ null xs]
? ++++++++++++++++++++++++++++
g = unwords . filter ('@' `notElem`) . words . takeWhile (`notElem` "<(") | 2 | 0.064516 | 1 | 1 |
e7f923488ebf589aa78f7dc37792ffba3fffd2a3 | pyinfra_kubernetes/defaults.py | pyinfra_kubernetes/defaults.py | DEFAULTS = {
# Install
'kubernetes_version': None, # must be provided
'kubernetes_download_base_url': 'https://dl.k8s.io',
'kubernetes_install_dir': '/usr/local/kubernetes',
'kubernetes_bin_dir': '/usr/local/bin',
'kubernetes_conf_dir': '/etc/kubernetes',
# Config
'kubernetes_service_cidr': None, # must be provided
'kubernetes_master_url': 'http://127.0.0.1',
}
| DEFAULTS = {
# Install
'kubernetes_version': None, # must be provided
'kubernetes_download_base_url': 'https://dl.k8s.io',
'kubernetes_install_dir': '/usr/local/kubernetes',
'kubernetes_bin_dir': '/usr/local/bin',
'kubernetes_conf_dir': '/etc/kubernetes',
# Config
'kubernetes_service_cidr': None, # must be provided
# API server URL for master components (controller-manager, scheduler)
'kubernetes_master_url': 'http://127.0.0.1',
}
| Update comment about default data. | Update comment about default data.
| Python | mit | EDITD/pyinfra-kubernetes,EDITD/pyinfra-kubernetes | python | ## Code Before:
DEFAULTS = {
# Install
'kubernetes_version': None, # must be provided
'kubernetes_download_base_url': 'https://dl.k8s.io',
'kubernetes_install_dir': '/usr/local/kubernetes',
'kubernetes_bin_dir': '/usr/local/bin',
'kubernetes_conf_dir': '/etc/kubernetes',
# Config
'kubernetes_service_cidr': None, # must be provided
'kubernetes_master_url': 'http://127.0.0.1',
}
## Instruction:
Update comment about default data.
## Code After:
DEFAULTS = {
# Install
'kubernetes_version': None, # must be provided
'kubernetes_download_base_url': 'https://dl.k8s.io',
'kubernetes_install_dir': '/usr/local/kubernetes',
'kubernetes_bin_dir': '/usr/local/bin',
'kubernetes_conf_dir': '/etc/kubernetes',
# Config
'kubernetes_service_cidr': None, # must be provided
# API server URL for master components (controller-manager, scheduler)
'kubernetes_master_url': 'http://127.0.0.1',
}
| DEFAULTS = {
# Install
'kubernetes_version': None, # must be provided
'kubernetes_download_base_url': 'https://dl.k8s.io',
'kubernetes_install_dir': '/usr/local/kubernetes',
'kubernetes_bin_dir': '/usr/local/bin',
'kubernetes_conf_dir': '/etc/kubernetes',
# Config
'kubernetes_service_cidr': None, # must be provided
+
+ # API server URL for master components (controller-manager, scheduler)
'kubernetes_master_url': 'http://127.0.0.1',
} | 2 | 0.166667 | 2 | 0 |
b4c80ad43ecbd1f204777678b957a0d26933e228 | README.md | README.md |
Create and run performance tests using Clojure. For reporting uses Gatling under the hood.
Note! Currently the version is at proof-of-concept stage and lacks lot of features.
## Installation
Add the following to your `project.clj` `:dependencies`:
```clojure
[clj-gatling "0.0.2"]
```
## Usage
```clojure
(use 'clj-gatling.core)
(defn example-request [user-id]
(println (str "Simulating request for user #" user-id))
(Thread/sleep (rand 1000))
true)
(run-simulation
{:name "Test-scenario"
:requests [{:name "Example-request" :fn example-request}]} 2)
```
See example project from [here](https://github.com/mhjort/clj-gatling-example)
## License
Copyright (C) 2014 Markus Hjort
Distributed under the Eclipse Public License, the same as Clojure.
|
Create and run performance tests using Clojure. For reporting uses Gatling under the hood.
Note! Currently this is more of a proof-of-concept and lacks lot of features.
The integration to Gatling is also far from perfect.
## Installation
Add the following to your `project.clj` `:dependencies`:
```clojure
[clj-gatling "0.0.2"]
```
## Usage
```clojure
(use 'clj-gatling.core)
(defn example-request [user-id]
(println (str "Simulating request for user #" user-id))
(Thread/sleep (rand 1000))
true)
(run-simulation
{:name "Test-scenario"
:requests [{:name "Example-request" :fn example-request}]} 2)
```
See example project from [here](https://github.com/mhjort/clj-gatling-example)
## License
Copyright (C) 2014 Markus Hjort
Distributed under the Eclipse Public License, the same as Clojure.
| Improve note text in readme | Improve note text in readme
| Markdown | epl-1.0 | mhjort/clj-gatling | markdown | ## Code Before:
Create and run performance tests using Clojure. For reporting uses Gatling under the hood.
Note! Currently the version is at proof-of-concept stage and lacks lot of features.
## Installation
Add the following to your `project.clj` `:dependencies`:
```clojure
[clj-gatling "0.0.2"]
```
## Usage
```clojure
(use 'clj-gatling.core)
(defn example-request [user-id]
(println (str "Simulating request for user #" user-id))
(Thread/sleep (rand 1000))
true)
(run-simulation
{:name "Test-scenario"
:requests [{:name "Example-request" :fn example-request}]} 2)
```
See example project from [here](https://github.com/mhjort/clj-gatling-example)
## License
Copyright (C) 2014 Markus Hjort
Distributed under the Eclipse Public License, the same as Clojure.
## Instruction:
Improve note text in readme
## Code After:
Create and run performance tests using Clojure. For reporting uses Gatling under the hood.
Note! Currently this is more of a proof-of-concept and lacks lot of features.
The integration to Gatling is also far from perfect.
## Installation
Add the following to your `project.clj` `:dependencies`:
```clojure
[clj-gatling "0.0.2"]
```
## Usage
```clojure
(use 'clj-gatling.core)
(defn example-request [user-id]
(println (str "Simulating request for user #" user-id))
(Thread/sleep (rand 1000))
true)
(run-simulation
{:name "Test-scenario"
:requests [{:name "Example-request" :fn example-request}]} 2)
```
See example project from [here](https://github.com/mhjort/clj-gatling-example)
## License
Copyright (C) 2014 Markus Hjort
Distributed under the Eclipse Public License, the same as Clojure.
|
Create and run performance tests using Clojure. For reporting uses Gatling under the hood.
- Note! Currently the version is at proof-of-concept stage and lacks lot of features.
? ^^^^^ --- - ------
+ Note! Currently this is more of a proof-of-concept and lacks lot of features.
? ^ ++++++++
+ The integration to Gatling is also far from perfect.
## Installation
Add the following to your `project.clj` `:dependencies`:
```clojure
[clj-gatling "0.0.2"]
```
## Usage
```clojure
(use 'clj-gatling.core)
(defn example-request [user-id]
(println (str "Simulating request for user #" user-id))
(Thread/sleep (rand 1000))
true)
(run-simulation
{:name "Test-scenario"
:requests [{:name "Example-request" :fn example-request}]} 2)
```
See example project from [here](https://github.com/mhjort/clj-gatling-example)
## License
Copyright (C) 2014 Markus Hjort
Distributed under the Eclipse Public License, the same as Clojure. | 3 | 0.083333 | 2 | 1 |
49e6414f7b3b91e26b7a691d2c4f5166e9c5653b | scripts/main.sh | scripts/main.sh |
set -e -x
export DEBIAN_FRONTEND=noninteractive
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# ssh config
bash /vagrant/scripts/ssh.sh
# apt-get installs
bash /vagrant/scripts/apt-get.sh
# Setup nginx
bash /vagrant/scripts/nginx.sh
# pip installs
bash /vagrant/scripts/pip.sh
# Make the prompt look nicer
bash /vagrant/scripts/prompt.sh
# .profile settings
bash /vagrant/scripts/profile.sh
# git config
bash /vagrant/scripts/git.sh
# PostgreSQL
bash /vagrant/scripts/postgresql.sh
# Redis
bash /vagrant/scripts/redis.sh
# Node.js
bash /vagrant/scripts/nodejs.sh
# Install boards-backend
bash /vagrant/scripts/boards-backend/install.sh
# Install boards-web
bash /vagrant/scripts/boards-web/install.sh
|
set -e -x
export DEBIAN_FRONTEND=noninteractive
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# ssh config
bash /vagrant/scripts/ssh.sh
# apt-get installs
bash /vagrant/scripts/apt-get.sh
# Setup nginx
bash /vagrant/scripts/nginx.sh
# pip installs
bash /vagrant/scripts/pip.sh
# Make the prompt look nicer
bash /vagrant/scripts/prompt.sh
# .profile settings
bash /vagrant/scripts/profile.sh
# git config
bash /vagrant/scripts/git.sh
# PostgreSQL
bash /vagrant/scripts/postgresql.sh
# Redis
bash /vagrant/scripts/redis.sh
# Node.js
bash /vagrant/scripts/nodejs.sh
# Install boards-backend
bash /vagrant/scripts/boards-backend/install.sh
# Install boards-web
bash /vagrant/scripts/boards-web/install.sh
# Fix permissions in apps folder
chown -R vagrant:vagrant apps/
| Fix permissions in apps folder after installing | Fix permissions in apps folder after installing | Shell | agpl-3.0 | GetBlimp/boards | shell | ## Code Before:
set -e -x
export DEBIAN_FRONTEND=noninteractive
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# ssh config
bash /vagrant/scripts/ssh.sh
# apt-get installs
bash /vagrant/scripts/apt-get.sh
# Setup nginx
bash /vagrant/scripts/nginx.sh
# pip installs
bash /vagrant/scripts/pip.sh
# Make the prompt look nicer
bash /vagrant/scripts/prompt.sh
# .profile settings
bash /vagrant/scripts/profile.sh
# git config
bash /vagrant/scripts/git.sh
# PostgreSQL
bash /vagrant/scripts/postgresql.sh
# Redis
bash /vagrant/scripts/redis.sh
# Node.js
bash /vagrant/scripts/nodejs.sh
# Install boards-backend
bash /vagrant/scripts/boards-backend/install.sh
# Install boards-web
bash /vagrant/scripts/boards-web/install.sh
## Instruction:
Fix permissions in apps folder after installing
## Code After:
set -e -x
export DEBIAN_FRONTEND=noninteractive
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# ssh config
bash /vagrant/scripts/ssh.sh
# apt-get installs
bash /vagrant/scripts/apt-get.sh
# Setup nginx
bash /vagrant/scripts/nginx.sh
# pip installs
bash /vagrant/scripts/pip.sh
# Make the prompt look nicer
bash /vagrant/scripts/prompt.sh
# .profile settings
bash /vagrant/scripts/profile.sh
# git config
bash /vagrant/scripts/git.sh
# PostgreSQL
bash /vagrant/scripts/postgresql.sh
# Redis
bash /vagrant/scripts/redis.sh
# Node.js
bash /vagrant/scripts/nodejs.sh
# Install boards-backend
bash /vagrant/scripts/boards-backend/install.sh
# Install boards-web
bash /vagrant/scripts/boards-web/install.sh
# Fix permissions in apps folder
chown -R vagrant:vagrant apps/
|
set -e -x
export DEBIAN_FRONTEND=noninteractive
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# ssh config
bash /vagrant/scripts/ssh.sh
# apt-get installs
bash /vagrant/scripts/apt-get.sh
# Setup nginx
bash /vagrant/scripts/nginx.sh
# pip installs
bash /vagrant/scripts/pip.sh
# Make the prompt look nicer
bash /vagrant/scripts/prompt.sh
# .profile settings
bash /vagrant/scripts/profile.sh
# git config
bash /vagrant/scripts/git.sh
# PostgreSQL
bash /vagrant/scripts/postgresql.sh
# Redis
bash /vagrant/scripts/redis.sh
# Node.js
bash /vagrant/scripts/nodejs.sh
# Install boards-backend
bash /vagrant/scripts/boards-backend/install.sh
# Install boards-web
bash /vagrant/scripts/boards-web/install.sh
+
+ # Fix permissions in apps folder
+ chown -R vagrant:vagrant apps/ | 3 | 0.075 | 3 | 0 |
9ff495a270b4d0aef058fa4c785fd7ba30017066 | src/components/Github/Loading.jsx | src/components/Github/Loading.jsx | import React, { View, Text } from 'react-native';
export default () => {
return (
<View>
<Text>
Loading items...
</Text>
</View>
);
};
| import React, { View, Text } from 'react-native';
export default () => {
return (
<View style={styles.container}>
<Text>
Logout ...
</Text>
</View>
);
};
const styles = {
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
}; | Add logout screen as component | Add logout screen as component
| JSX | mit | jseminck/react-native-github-feed,jseminck/react-native-github-feed,jseminck/react-native-github-feed | jsx | ## Code Before:
import React, { View, Text } from 'react-native';
export default () => {
return (
<View>
<Text>
Loading items...
</Text>
</View>
);
};
## Instruction:
Add logout screen as component
## Code After:
import React, { View, Text } from 'react-native';
export default () => {
return (
<View style={styles.container}>
<Text>
Logout ...
</Text>
</View>
);
};
const styles = {
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
}; | import React, { View, Text } from 'react-native';
export default () => {
return (
- <View>
+ <View style={styles.container}>
<Text>
- Loading items...
? ---- -----
+ Logout ...
? +++
</Text>
</View>
);
};
+
+ const styles = {
+ container: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center'
+ }
+ }; | 12 | 1.090909 | 10 | 2 |
73f8e32393a247e668c1a7840683c7e1176a6a72 | .travis.yml | .travis.yml | language: ruby
rvm:
- 2.3.4
cache: bundler
branches:
only:
- master
install:
- bundle install
script:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- JEKYLL_ENV=production jgd -u https://$GH_TOKEN@github.com/grab/engineering-blog.git
| language: ruby
rvm:
- 2.6.1
cache: bundler
branches:
only:
- master
before_install:
- gem install bundler
install:
- bundle install
script:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- JEKYLL_ENV=production jgd -u https://$GH_TOKEN@github.com/grab/engineering-blog.git
| Upgrade RVM to v2.6.1 and install Bundler 2.0 | Upgrade RVM to v2.6.1 and install Bundler 2.0
| YAML | mit | grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog,grab/engineering-blog | yaml | ## Code Before:
language: ruby
rvm:
- 2.3.4
cache: bundler
branches:
only:
- master
install:
- bundle install
script:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- JEKYLL_ENV=production jgd -u https://$GH_TOKEN@github.com/grab/engineering-blog.git
## Instruction:
Upgrade RVM to v2.6.1 and install Bundler 2.0
## Code After:
language: ruby
rvm:
- 2.6.1
cache: bundler
branches:
only:
- master
before_install:
- gem install bundler
install:
- bundle install
script:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- JEKYLL_ENV=production jgd -u https://$GH_TOKEN@github.com/grab/engineering-blog.git
| language: ruby
rvm:
- - 2.3.4
+ - 2.6.1
cache: bundler
branches:
only:
- master
+ before_install:
+ - gem install bundler
install:
- bundle install
script:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- JEKYLL_ENV=production jgd -u https://$GH_TOKEN@github.com/grab/engineering-blog.git | 4 | 0.307692 | 3 | 1 |
be73da58aa89a35541c04b042b9ddb17c947a710 | window/window.go | window/window.go | package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorSize() (int, int)
//Close() error
Width() int
Height() int
Viewport() intgeom.Point2
}
| package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorSize() (int, int)
//Close() error
Width() int
Height() int
Viewport() intgeom.Point2
Quit()
SetViewportBounds(intgeom.Rect2)
}
| Add Quit and SetViewportBounds to Window | Add Quit and SetViewportBounds to Window
| Go | apache-2.0 | oakmound/oak,oakmound/oak,oakmound/oak | go | ## Code Before:
package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorSize() (int, int)
//Close() error
Width() int
Height() int
Viewport() intgeom.Point2
}
## Instruction:
Add Quit and SetViewportBounds to Window
## Code After:
package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorSize() (int, int)
//Close() error
Width() int
Height() int
Viewport() intgeom.Point2
Quit()
SetViewportBounds(intgeom.Rect2)
}
| package window
import "github.com/oakmound/oak/v2/alg/intgeom"
type Window interface {
SetFullScreen(bool) error
SetBorderless(bool) error
SetTopMost(bool) error
SetTitle(string) error
SetTrayIcon(string) error
ShowNotification(title, msg string, icon bool) error
MoveWindow(x, y, w, h int) error
//GetMonitorSize() (int, int)
//Close() error
Width() int
Height() int
Viewport() intgeom.Point2
+ Quit()
+ SetViewportBounds(intgeom.Rect2)
} | 2 | 0.111111 | 2 | 0 |
921add2eaf95b7aad3f3b4dbb27229e429b2a518 | railseventstore.org/source/docs/migrating_messages.html.md | railseventstore.org/source/docs/migrating_messages.html.md | ---
title: Migrating existing events
---
Sometimes it is convenient to update existing historical events. Instead of introducing a new event in a different version (`SomethingHappened-v2`), we might prefer the simplicity of adding a new field to existing events via migration. Such as for example `tenant_id` when we introduce multi-tenancy to our application. There are various tread-offs here (you are rewriting a history after all), but we assume you understand them well if you decide to go this way.
Another valid use-case can be when you decide to migrate to a different mapper (ie from YAML to Protobuf).
Note that events are updated using "upsert" capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
### Add data and metadata to existing events
```ruby
event_store.read.in_batches.each_batch do |events|
events.each do |ev|
ev.data[:tenant_id] = 1
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
end
```
### Change event type
```ruby
event_store.read.in_batches.each_batch do |events|
events = events.select{|ev| OldType === ev }.map do |ev|
NewType.new(
event_id: ev.event_id,
data: ev.data,
metadata: ev.metadata,
)
end
event_store.overwrite(events)
end
```
| ---
title: Migrating existing events
---
Sometimes it is convenient to update existing historical events. Instead of introducing a new event in a different version (`SomethingHappened-v2`), we might prefer the simplicity of adding a new field to existing events via migration. Such as for example `tenant_id` when we introduce multi-tenancy to our application. There are various tread-offs here (you are rewriting a history after all), but we assume you understand them well if you decide to go this way.
Another valid use-case can be when you decide to migrate to a different mapper (ie from YAML to Protobuf).
Note that events are updated using upsert capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
### Add data and metadata to existing events
```ruby
event_store.read.each_batch do |events|
events.each do |ev|
ev.data[:tenant_id] = 1
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
end
```
### Change event type
```ruby
event_store.read.of_type([OldType]).each_batch do |events|
event_store.overwrite(events.map { |ev|
NewType.new(
event_id: ev.event_id,
data: ev.data,
metadata: ev.metadata,
)
})
end
```
| Use the read API like the docs suggest. | Use the read API like the docs suggest.
| Markdown | mit | arkency/rails_event_store,RailsEventStore/rails_event_store,arkency/rails_event_store,RailsEventStore/rails_event_store,mpraglowski/rails_event_store,arkency/rails_event_store,mpraglowski/rails_event_store,mpraglowski/rails_event_store,RailsEventStore/rails_event_store,RailsEventStore/rails_event_store,mpraglowski/rails_event_store,arkency/rails_event_store | markdown | ## Code Before:
---
title: Migrating existing events
---
Sometimes it is convenient to update existing historical events. Instead of introducing a new event in a different version (`SomethingHappened-v2`), we might prefer the simplicity of adding a new field to existing events via migration. Such as for example `tenant_id` when we introduce multi-tenancy to our application. There are various tread-offs here (you are rewriting a history after all), but we assume you understand them well if you decide to go this way.
Another valid use-case can be when you decide to migrate to a different mapper (ie from YAML to Protobuf).
Note that events are updated using "upsert" capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
### Add data and metadata to existing events
```ruby
event_store.read.in_batches.each_batch do |events|
events.each do |ev|
ev.data[:tenant_id] = 1
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
end
```
### Change event type
```ruby
event_store.read.in_batches.each_batch do |events|
events = events.select{|ev| OldType === ev }.map do |ev|
NewType.new(
event_id: ev.event_id,
data: ev.data,
metadata: ev.metadata,
)
end
event_store.overwrite(events)
end
```
## Instruction:
Use the read API like the docs suggest.
## Code After:
---
title: Migrating existing events
---
Sometimes it is convenient to update existing historical events. Instead of introducing a new event in a different version (`SomethingHappened-v2`), we might prefer the simplicity of adding a new field to existing events via migration. Such as for example `tenant_id` when we introduce multi-tenancy to our application. There are various tread-offs here (you are rewriting a history after all), but we assume you understand them well if you decide to go this way.
Another valid use-case can be when you decide to migrate to a different mapper (ie from YAML to Protobuf).
Note that events are updated using upsert capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
### Add data and metadata to existing events
```ruby
event_store.read.each_batch do |events|
events.each do |ev|
ev.data[:tenant_id] = 1
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
end
```
### Change event type
```ruby
event_store.read.of_type([OldType]).each_batch do |events|
event_store.overwrite(events.map { |ev|
NewType.new(
event_id: ev.event_id,
data: ev.data,
metadata: ev.metadata,
)
})
end
```
| ---
title: Migrating existing events
---
Sometimes it is convenient to update existing historical events. Instead of introducing a new event in a different version (`SomethingHappened-v2`), we might prefer the simplicity of adding a new field to existing events via migration. Such as for example `tenant_id` when we introduce multi-tenancy to our application. There are various tread-offs here (you are rewriting a history after all), but we assume you understand them well if you decide to go this way.
Another valid use-case can be when you decide to migrate to a different mapper (ie from YAML to Protobuf).
- Note that events are updated using "upsert" capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
? - -
+ Note that events are updated using upsert capabilities of your MySQL, PostgreSQL or Sqlite 3.24.0+ database.
### Add data and metadata to existing events
```ruby
- event_store.read.in_batches.each_batch do |events|
? -----------
+ event_store.read.each_batch do |events|
events.each do |ev|
- ev.data[:tenant_id] = 1
+ ev.data[:tenant_id] = 1
? ++++
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
end
```
### Change event type
```ruby
- event_store.read.in_batches.each_batch do |events|
? ^^ -- ^^ ^
+ event_store.read.of_type([OldType]).each_batch do |events|
? ^^ ^^ ^^^^^^^^^^^
- events = events.select{|ev| OldType === ev }.map do |ev|
+ event_store.overwrite(events.map { |ev|
- NewType.new(
+ NewType.new(
? ++
- event_id: ev.event_id,
+ event_id: ev.event_id,
? ++
- data: ev.data,
+ data: ev.data,
? ++
- metadata: ev.metadata,
+ metadata: ev.metadata,
? ++
- )
+ )
? ++
+ })
- end
- event_store.overwrite(events)
end
``` | 23 | 0.638889 | 11 | 12 |
4f6d64f62b9b6700916c6ffb8931c2c1bb7c65a6 | README.md | README.md |
Controller that show a list of items that can be selectable.

|
Controller that show a list of items that can be selectable.

## Installation
**Copy** **BWSelectViewController** dir into your project.
## How to use it
BWSelectViewController *vc = [[BWSelectViewController alloc] init];
vc.items = [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", @"Item4", nil];
vc.multiSelection = NO;
vc.allowEmpty = YES;
[vc setDidSelectBlock:^(NSArray *selectedIndexPaths, BWSelectViewController *controller) {
NSLog(@"%@", selectedIndexPaths);
}];
[self.navigationController pushViewController:vc animated:YES];
## ARC
BWSelectViewController is ARC only. | Update readme with usage instruction | Update readme with usage instruction
| Markdown | apache-2.0 | brunow/BWSelectViewController | markdown | ## Code Before:
Controller that show a list of items that can be selectable.

## Instruction:
Update readme with usage instruction
## Code After:
Controller that show a list of items that can be selectable.

## Installation
**Copy** **BWSelectViewController** dir into your project.
## How to use it
BWSelectViewController *vc = [[BWSelectViewController alloc] init];
vc.items = [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", @"Item4", nil];
vc.multiSelection = NO;
vc.allowEmpty = YES;
[vc setDidSelectBlock:^(NSArray *selectedIndexPaths, BWSelectViewController *controller) {
NSLog(@"%@", selectedIndexPaths);
}];
[self.navigationController pushViewController:vc animated:YES];
## ARC
BWSelectViewController is ARC only. |
Controller that show a list of items that can be selectable.

+
+ ## Installation
+
+ **Copy** **BWSelectViewController** dir into your project.
+
+ ## How to use it
+
+ BWSelectViewController *vc = [[BWSelectViewController alloc] init];
+ vc.items = [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", @"Item4", nil];
+ vc.multiSelection = NO;
+ vc.allowEmpty = YES;
+
+ [vc setDidSelectBlock:^(NSArray *selectedIndexPaths, BWSelectViewController *controller) {
+ NSLog(@"%@", selectedIndexPaths);
+ }];
+
+ [self.navigationController pushViewController:vc animated:YES];
+
+ ## ARC
+
+ BWSelectViewController is ARC only. | 21 | 5.25 | 21 | 0 |
d125e6c0fc0844b0bd0984fffca14071af9b671e | lib/ferrety_ferret.rb | lib/ferrety_ferret.rb | require "ferrety_ferret/version"
require "httparty"
module Ferrety
class Ferret
attr_accessor :alerts
def initialize(params)
clear_alerts
end
private
def add_alert(alert_text)
@alerts << alert_text
end
def clear_alerts
@alerts = []
end
end
class HoneyBadger < Ferret
def search(term, url)
page = fetch_page(url)
if page.upcase.scan(term.upcase).any?
add_alert("The page at #{url} matched the term #{term}")
end
end
def fetch_page(url)
HTTParty.get(url)
end
end
end
| require "ferrety_ferret/version"
require "httparty"
module Ferrety
class Ferret
attr_accessor :alerts
def initialize(params)
clear_alerts
params = parse(params)
end
private
def parse(params)
if params.is_a?(Hash)
params
else
JSON.parse(params)
end
end
def add_alert(alert_text)
@alerts << alert_text
end
def clear_alerts
@alerts = []
end
end
class HoneyBadger < Ferret
def search(term, url)
page = fetch_page(url)
if page.upcase.scan(term.upcase).any?
add_alert("The page at #{url} matched the term #{term}")
end
end
def fetch_page(url)
HTTParty.get(url)
end
end
end
| Add acceptance of JSON and Hash params | Add acceptance of JSON and Hash params
| Ruby | mit | marktabler/ferrety_ferret | ruby | ## Code Before:
require "ferrety_ferret/version"
require "httparty"
module Ferrety
class Ferret
attr_accessor :alerts
def initialize(params)
clear_alerts
end
private
def add_alert(alert_text)
@alerts << alert_text
end
def clear_alerts
@alerts = []
end
end
class HoneyBadger < Ferret
def search(term, url)
page = fetch_page(url)
if page.upcase.scan(term.upcase).any?
add_alert("The page at #{url} matched the term #{term}")
end
end
def fetch_page(url)
HTTParty.get(url)
end
end
end
## Instruction:
Add acceptance of JSON and Hash params
## Code After:
require "ferrety_ferret/version"
require "httparty"
module Ferrety
class Ferret
attr_accessor :alerts
def initialize(params)
clear_alerts
params = parse(params)
end
private
def parse(params)
if params.is_a?(Hash)
params
else
JSON.parse(params)
end
end
def add_alert(alert_text)
@alerts << alert_text
end
def clear_alerts
@alerts = []
end
end
class HoneyBadger < Ferret
def search(term, url)
page = fetch_page(url)
if page.upcase.scan(term.upcase).any?
add_alert("The page at #{url} matched the term #{term}")
end
end
def fetch_page(url)
HTTParty.get(url)
end
end
end
| require "ferrety_ferret/version"
require "httparty"
module Ferrety
class Ferret
attr_accessor :alerts
def initialize(params)
clear_alerts
+ params = parse(params)
end
private
+
+ def parse(params)
+ if params.is_a?(Hash)
+ params
+ else
+ JSON.parse(params)
+ end
+ end
def add_alert(alert_text)
@alerts << alert_text
end
def clear_alerts
@alerts = []
end
end
class HoneyBadger < Ferret
def search(term, url)
page = fetch_page(url)
if page.upcase.scan(term.upcase).any?
add_alert("The page at #{url} matched the term #{term}")
end
end
def fetch_page(url)
HTTParty.get(url)
end
end
end | 9 | 0.243243 | 9 | 0 |
c38c7224734744e6fd2dffc89e528d9b60fa358c | docs/modules/ROOT/pages/whats-new.adoc | docs/modules/ROOT/pages/whats-new.adoc | [[new]]
= What's New in Spring Security 5.7
Spring Security 5.7 provides a number of new features.
Below are the highlights of the release.
[[whats-new-servlet]]
== Servlet
* Web
** Introduced xref:servlet/authentication/persistence.adoc#requestattributesecuritycontextrepository[`RequestAttributeSecurityContextRepository`]
** Introduced xref:servlet/authentication/persistence.adoc#securitycontextholderfilter[`SecurityContextHolderFilter`] - Ability to require explicit saving of the `SecurityContext`
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerOAuth2AuthorizedClientProvider`
[[whats-new-webflux]]
== WebFlux
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerReactiveOAuth2AuthorizedClientProvider`
| [[new]]
= What's New in Spring Security 5.7
Spring Security 5.7 provides a number of new features.
Below are the highlights of the release.
[[whats-new-servlet]]
== Servlet
* Web
** Introduced xref:servlet/authentication/persistence.adoc#requestattributesecuritycontextrepository[`RequestAttributeSecurityContextRepository`]
** Introduced xref:servlet/authentication/persistence.adoc#securitycontextholderfilter[`SecurityContextHolderFilter`] - Ability to require explicit saving of the `SecurityContext`
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerOAuth2AuthorizedClientProvider`
** Allow customizing claims on https://github.com/spring-projects/spring-security/issues/9855[JWT client assertions]
[[whats-new-webflux]]
== WebFlux
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerReactiveOAuth2AuthorizedClientProvider`
| Update What's New for 5.7 | Update What's New for 5.7
| AsciiDoc | apache-2.0 | spring-projects/spring-security,spring-projects/spring-security,spring-projects/spring-security,spring-projects/spring-security,spring-projects/spring-security,spring-projects/spring-security,spring-projects/spring-security | asciidoc | ## Code Before:
[[new]]
= What's New in Spring Security 5.7
Spring Security 5.7 provides a number of new features.
Below are the highlights of the release.
[[whats-new-servlet]]
== Servlet
* Web
** Introduced xref:servlet/authentication/persistence.adoc#requestattributesecuritycontextrepository[`RequestAttributeSecurityContextRepository`]
** Introduced xref:servlet/authentication/persistence.adoc#securitycontextholderfilter[`SecurityContextHolderFilter`] - Ability to require explicit saving of the `SecurityContext`
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerOAuth2AuthorizedClientProvider`
[[whats-new-webflux]]
== WebFlux
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerReactiveOAuth2AuthorizedClientProvider`
## Instruction:
Update What's New for 5.7
## Code After:
[[new]]
= What's New in Spring Security 5.7
Spring Security 5.7 provides a number of new features.
Below are the highlights of the release.
[[whats-new-servlet]]
== Servlet
* Web
** Introduced xref:servlet/authentication/persistence.adoc#requestattributesecuritycontextrepository[`RequestAttributeSecurityContextRepository`]
** Introduced xref:servlet/authentication/persistence.adoc#securitycontextholderfilter[`SecurityContextHolderFilter`] - Ability to require explicit saving of the `SecurityContext`
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerOAuth2AuthorizedClientProvider`
** Allow customizing claims on https://github.com/spring-projects/spring-security/issues/9855[JWT client assertions]
[[whats-new-webflux]]
== WebFlux
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerReactiveOAuth2AuthorizedClientProvider`
| [[new]]
= What's New in Spring Security 5.7
Spring Security 5.7 provides a number of new features.
Below are the highlights of the release.
[[whats-new-servlet]]
== Servlet
* Web
** Introduced xref:servlet/authentication/persistence.adoc#requestattributesecuritycontextrepository[`RequestAttributeSecurityContextRepository`]
** Introduced xref:servlet/authentication/persistence.adoc#securitycontextholderfilter[`SecurityContextHolderFilter`] - Ability to require explicit saving of the `SecurityContext`
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerOAuth2AuthorizedClientProvider`
+ ** Allow customizing claims on https://github.com/spring-projects/spring-security/issues/9855[JWT client assertions]
[[whats-new-webflux]]
== WebFlux
* OAuth 2.0 Client
** Allow configuring https://github.com/spring-projects/spring-security/issues/6548[PKCE for confidential clients]
** Allow configuring a https://github.com/spring-projects/spring-security/issues/9812[JWT assertion resolver] in `JwtBearerReactiveOAuth2AuthorizedClientProvider` | 1 | 0.038462 | 1 | 0 |
31b9ace0f65a5a5717ed9521b57d8d9e18f24070 | travisBuild.sh | travisBuild.sh |
run_tests() {
$GOPATH/bin/goveralls -service=travis-ci
./tests.sh --skip-go-test
}
release() {
env VERSION=$TRAVIS_TAG ./release.sh
}
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Pull Requests.
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
run_tests
elif [ "$TRAVIS_TAG" == "" ]; then
# Pushed branches.
echo -e "Build Branch $TRAVIS_BRANCH"
run_tests
else
# $TRAVIS_PULL_REQUEST == "false" and $TRAVIS_TAG != "" -> Releases.
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
release
fi
|
run_tests() {
$GOPATH/bin/goveralls -service=travis-ci
./tests.sh --skip-go-test
}
run_tests
| Remove old release mechanism from Travis | Remove old release mechanism from Travis
| Shell | apache-2.0 | sbarzowski/go-jsonnet,sbarzowski/go-jsonnet,google/go-jsonnet,sbarzowski/go-jsonnet,google/go-jsonnet,google/go-jsonnet,google/go-jsonnet,sbarzowski/go-jsonnet,sbarzowski/go-jsonnet,google/go-jsonnet | shell | ## Code Before:
run_tests() {
$GOPATH/bin/goveralls -service=travis-ci
./tests.sh --skip-go-test
}
release() {
env VERSION=$TRAVIS_TAG ./release.sh
}
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Pull Requests.
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
run_tests
elif [ "$TRAVIS_TAG" == "" ]; then
# Pushed branches.
echo -e "Build Branch $TRAVIS_BRANCH"
run_tests
else
# $TRAVIS_PULL_REQUEST == "false" and $TRAVIS_TAG != "" -> Releases.
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
release
fi
## Instruction:
Remove old release mechanism from Travis
## Code After:
run_tests() {
$GOPATH/bin/goveralls -service=travis-ci
./tests.sh --skip-go-test
}
run_tests
|
run_tests() {
$GOPATH/bin/goveralls -service=travis-ci
./tests.sh --skip-go-test
}
+ run_tests
- release() {
- env VERSION=$TRAVIS_TAG ./release.sh
- }
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
- # Pull Requests.
- echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
- run_tests
- elif [ "$TRAVIS_TAG" == "" ]; then
- # Pushed branches.
- echo -e "Build Branch $TRAVIS_BRANCH"
- run_tests
- else
- # $TRAVIS_PULL_REQUEST == "false" and $TRAVIS_TAG != "" -> Releases.
- echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
- release
- fi
- | 18 | 0.75 | 1 | 17 |
be23c953f8f27a8d178022d3ecb44f461100bbc5 | tests/__init__.py | tests/__init__.py | """Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
example_dir = os.path.join(cache_dir, topoflow_dir,
'topoflow', 'examples', 'Treynor_Iowa')
| """Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
example_dir = os.path.join(cache_dir, topoflow_dir,
'topoflow', 'examples', 'Treynor_Iowa')
# Used by tests for D8 and Erode components.
data_dir = os.path.join(os.path.abspath('..'), 'data')
test_dir = os.path.dirname(__file__)
| Add path to data directory | Add path to data directory
| Python | mit | mdpiper/topoflow-cmi-testing | python | ## Code Before:
"""Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
example_dir = os.path.join(cache_dir, topoflow_dir,
'topoflow', 'examples', 'Treynor_Iowa')
## Instruction:
Add path to data directory
## Code After:
"""Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
example_dir = os.path.join(cache_dir, topoflow_dir,
'topoflow', 'examples', 'Treynor_Iowa')
# Used by tests for D8 and Erode components.
data_dir = os.path.join(os.path.abspath('..'), 'data')
test_dir = os.path.dirname(__file__)
| """Tests for running TopoFlow components in CMI."""
import os
def locate_topoflow(cache_dir):
for x in os.listdir(cache_dir):
if x.startswith('topoflow'):
return x
root_dir = '/home/csdms/wmt/topoflow.0'
cache_dir = os.path.join(root_dir, 'cache')
topoflow_dir = locate_topoflow(cache_dir)
example_dir = os.path.join(cache_dir, topoflow_dir,
'topoflow', 'examples', 'Treynor_Iowa')
+
+ # Used by tests for D8 and Erode components.
+ data_dir = os.path.join(os.path.abspath('..'), 'data')
+ test_dir = os.path.dirname(__file__) | 4 | 0.266667 | 4 | 0 |
53b5f96a154213f2d5ba9d2639729f3fa42d8d07 | lib/notifiable/mpns/nverinaud/single_notifier.rb | lib/notifiable/mpns/nverinaud/single_notifier.rb | require 'notifiable'
require 'ruby-mpns'
module Notifiable
module Mpns
module Nverinaud
class SingleNotifier < Notifiable::NotifierBase
protected
def enqueue(notification, device_token)
options = {content: notification.message}
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, options
case response.code.to_i
when 200
processed(notification, device_token)
when 404
Rails.logger.info "De-registering device token: #{device_token.id}"
device_token.update_attribute('is_valid', false)
else
Rails.logger.error "Error sending notification: #{response.code}"
end
end
end
end
end
end | require 'notifiable'
require 'ruby-mpns'
module Notifiable
module Mpns
module Nverinaud
class SingleNotifier < Notifiable::NotifierBase
protected
def enqueue(notification, device_token)
data = {}
# title
title = notification.provider_value(device_token.provider, :title)
data[:title] = title if title
# content
content = notification.provider_value(device_token.provider, :message)
data[:content] = content if content
# custom attributes
custom_attributes = notification.provider_value(device_token.provider, :params)
data.merge!({:params => custom_attributes}) if custom_attributes
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data
case response.code.to_i
when 200
processed(notification, device_token)
when 404
Rails.logger.info "De-registering device token: #{device_token.id}"
device_token.update_attribute('is_valid', false)
else
Rails.logger.error "Error sending notification: #{response.code}"
end
end
end
end
end
end | Update notifier to pass title and custom attributes | Update notifier to pass title and custom attributes
| Ruby | apache-2.0 | FutureWorkshops/notifiable-mpns-nverinaud,FutureWorkshops/notifiable-mpns-nverinaud,FutureWorkshops/notifiable-mpns-nverinaud | ruby | ## Code Before:
require 'notifiable'
require 'ruby-mpns'
module Notifiable
module Mpns
module Nverinaud
class SingleNotifier < Notifiable::NotifierBase
protected
def enqueue(notification, device_token)
options = {content: notification.message}
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, options
case response.code.to_i
when 200
processed(notification, device_token)
when 404
Rails.logger.info "De-registering device token: #{device_token.id}"
device_token.update_attribute('is_valid', false)
else
Rails.logger.error "Error sending notification: #{response.code}"
end
end
end
end
end
end
## Instruction:
Update notifier to pass title and custom attributes
## Code After:
require 'notifiable'
require 'ruby-mpns'
module Notifiable
module Mpns
module Nverinaud
class SingleNotifier < Notifiable::NotifierBase
protected
def enqueue(notification, device_token)
data = {}
# title
title = notification.provider_value(device_token.provider, :title)
data[:title] = title if title
# content
content = notification.provider_value(device_token.provider, :message)
data[:content] = content if content
# custom attributes
custom_attributes = notification.provider_value(device_token.provider, :params)
data.merge!({:params => custom_attributes}) if custom_attributes
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data
case response.code.to_i
when 200
processed(notification, device_token)
when 404
Rails.logger.info "De-registering device token: #{device_token.id}"
device_token.update_attribute('is_valid', false)
else
Rails.logger.error "Error sending notification: #{response.code}"
end
end
end
end
end
end | require 'notifiable'
require 'ruby-mpns'
module Notifiable
module Mpns
module Nverinaud
class SingleNotifier < Notifiable::NotifierBase
protected
def enqueue(notification, device_token)
+
+ data = {}
- options = {content: notification.message}
+ # title
+ title = notification.provider_value(device_token.provider, :title)
+ data[:title] = title if title
+
+ # content
+ content = notification.provider_value(device_token.provider, :message)
+ data[:content] = content if content
+
+ # custom attributes
+ custom_attributes = notification.provider_value(device_token.provider, :params)
+ data.merge!({:params => custom_attributes}) if custom_attributes
+
- response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, options
? ^^ ^^^^
+ response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data
? ^^ ^
case response.code.to_i
when 200
processed(notification, device_token)
when 404
Rails.logger.info "De-registering device token: #{device_token.id}"
device_token.update_attribute('is_valid', false)
else
Rails.logger.error "Error sending notification: #{response.code}"
end
end
end
end
end
end | 17 | 0.607143 | 15 | 2 |
1986acdeee892475cc59fd2fffd1718a7e8166a2 | .travis.yml | .travis.yml | language: objective-c
osx_image: xcode8
| language: objective-c
osx_image: xcode8
xcode_project: TDRedux.xcodeproj
xcode_scheme: TDRedux
script:
- xcodebuild \
-project TDRedux.xcodeproj \
-scheme TDRedux \
-destination "OS=10.0,name=iPhone 6s Plus" \
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
GCC_GENERATE_TEST_COVERAGE_FILES=YES \
test | xcpretty -c
| Use xcodebuild + xcpretty because xctool is DEAD for Xcode 8 | Use xcodebuild + xcpretty because xctool is DEAD for Xcode 8
Stole the snippet from
[here](https://github.com/NicholasTD07/SwiftDailyAPI/blob/develop/.travis.yml)
| YAML | mit | NicholasTD07/TDRedux.swift,NicholasTD07/TDRedux.swift,NicholasTD07/TDRedux.swift | yaml | ## Code Before:
language: objective-c
osx_image: xcode8
## Instruction:
Use xcodebuild + xcpretty because xctool is DEAD for Xcode 8
Stole the snippet from
[here](https://github.com/NicholasTD07/SwiftDailyAPI/blob/develop/.travis.yml)
## Code After:
language: objective-c
osx_image: xcode8
xcode_project: TDRedux.xcodeproj
xcode_scheme: TDRedux
script:
- xcodebuild \
-project TDRedux.xcodeproj \
-scheme TDRedux \
-destination "OS=10.0,name=iPhone 6s Plus" \
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
GCC_GENERATE_TEST_COVERAGE_FILES=YES \
test | xcpretty -c
| language: objective-c
osx_image: xcode8
+ xcode_project: TDRedux.xcodeproj
+ xcode_scheme: TDRedux
+
+ script:
+ - xcodebuild \
+ -project TDRedux.xcodeproj \
+ -scheme TDRedux \
+ -destination "OS=10.0,name=iPhone 6s Plus" \
+ GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
+ GCC_GENERATE_TEST_COVERAGE_FILES=YES \
+ test | xcpretty -c | 11 | 5.5 | 11 | 0 |
1ef862b55d7e6f93bac6ab2ecb9ab172c57c99b9 | _posts/2015/2015-02-18-Get-videos-from-youtube-with-docker-part-2.md | _posts/2015/2015-02-18-Get-videos-from-youtube-with-docker-part-2.md | ---
layout: posts
date: 2015-02-18
author:
name: Adrien Lecharpentier
email: adrien.lecharpentier@gmail.com
title: Get videos from Youtube with Docker - part 2
tags: docker youtube-dl en shell
---
In my previous post {% post 2015-02-06-Get-videos-from-youtube-with-docker %}, I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
So I made a `shell` script to easily use my docker container.
```shell
#!/bin/sh
## Author: Adrien Lecharpentier <adrien.lecharpentier@gmail.com>
status=$(boot2docker status)
if [ "${status}" != "running" ]; then
boot2docker start
fi
docker run -ti -v "$(pwd)":/downloads alecharp/get-videos:latest $@
```
This way, I can easily download any youtube (or other) videos without having to remember every argument to give to the docker command. I only have to say:
```shell
sh get-videos.sh $URL
```
and it downloads the video in the current folder.
You can find the script here : https://gist.github.com/alecharp/768cd7bf7f7c4d87609f
Thanks for reading.
| ---
layout: posts
date: 2015-02-18
author:
name: Adrien Lecharpentier
email: adrien.lecharpentier@gmail.com
title: Get videos from Youtube with Docker - part 2
tags: docker youtube-dl en shell
---
In my previous post [here]({% post_url 2015-02-06-Get-videos-from-youtube-with-docker %}), I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
So I made a `shell` script to easily use my docker container.
```shell
#!/bin/sh
## Author: Adrien Lecharpentier <adrien.lecharpentier@gmail.com>
status=$(boot2docker status)
if [ "${status}" != "running" ]; then
boot2docker start
fi
docker run -ti -v "$(pwd)":/downloads alecharp/get-videos:latest $@
```
This way, I can easily download any youtube (or other) videos without having to remember every argument to give to the docker command. I only have to say:
```shell
sh get-videos.sh $URL
```
and it downloads the video in the current folder.
You can find the script here : https://gist.github.com/alecharp/768cd7bf7f7c4d87609f
Thanks for reading.
| Fix post link to part 1 | Fix post link to part 1 | Markdown | mit | alecharp/blog.lecharpentier.org,alecharp/blog | markdown | ## Code Before:
---
layout: posts
date: 2015-02-18
author:
name: Adrien Lecharpentier
email: adrien.lecharpentier@gmail.com
title: Get videos from Youtube with Docker - part 2
tags: docker youtube-dl en shell
---
In my previous post {% post 2015-02-06-Get-videos-from-youtube-with-docker %}, I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
So I made a `shell` script to easily use my docker container.
```shell
#!/bin/sh
## Author: Adrien Lecharpentier <adrien.lecharpentier@gmail.com>
status=$(boot2docker status)
if [ "${status}" != "running" ]; then
boot2docker start
fi
docker run -ti -v "$(pwd)":/downloads alecharp/get-videos:latest $@
```
This way, I can easily download any youtube (or other) videos without having to remember every argument to give to the docker command. I only have to say:
```shell
sh get-videos.sh $URL
```
and it downloads the video in the current folder.
You can find the script here : https://gist.github.com/alecharp/768cd7bf7f7c4d87609f
Thanks for reading.
## Instruction:
Fix post link to part 1
## Code After:
---
layout: posts
date: 2015-02-18
author:
name: Adrien Lecharpentier
email: adrien.lecharpentier@gmail.com
title: Get videos from Youtube with Docker - part 2
tags: docker youtube-dl en shell
---
In my previous post [here]({% post_url 2015-02-06-Get-videos-from-youtube-with-docker %}), I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
So I made a `shell` script to easily use my docker container.
```shell
#!/bin/sh
## Author: Adrien Lecharpentier <adrien.lecharpentier@gmail.com>
status=$(boot2docker status)
if [ "${status}" != "running" ]; then
boot2docker start
fi
docker run -ti -v "$(pwd)":/downloads alecharp/get-videos:latest $@
```
This way, I can easily download any youtube (or other) videos without having to remember every argument to give to the docker command. I only have to say:
```shell
sh get-videos.sh $URL
```
and it downloads the video in the current folder.
You can find the script here : https://gist.github.com/alecharp/768cd7bf7f7c4d87609f
Thanks for reading.
| ---
layout: posts
date: 2015-02-18
author:
name: Adrien Lecharpentier
email: adrien.lecharpentier@gmail.com
title: Get videos from Youtube with Docker - part 2
tags: docker youtube-dl en shell
---
- In my previous post {% post 2015-02-06-Get-videos-from-youtube-with-docker %}, I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
+ In my previous post [here]({% post_url 2015-02-06-Get-videos-from-youtube-with-docker %}), I've shown how I get fetch videos from Youtube from my command line without installing anything else than Docker. But the command to type is way too complicated
? +++++++ ++++ +
So I made a `shell` script to easily use my docker container.
```shell
#!/bin/sh
## Author: Adrien Lecharpentier <adrien.lecharpentier@gmail.com>
status=$(boot2docker status)
if [ "${status}" != "running" ]; then
boot2docker start
fi
docker run -ti -v "$(pwd)":/downloads alecharp/get-videos:latest $@
```
This way, I can easily download any youtube (or other) videos without having to remember every argument to give to the docker command. I only have to say:
```shell
sh get-videos.sh $URL
```
and it downloads the video in the current folder.
You can find the script here : https://gist.github.com/alecharp/768cd7bf7f7c4d87609f
Thanks for reading. | 2 | 0.055556 | 1 | 1 |
90e25af43b6cf526751769ddfd211bf287631376 | requirements.txt | requirements.txt | https://github.com/maraujop/django-crispy-forms/archive/dev.zip#egg=django-crispy-forms
# TODO: Replace this when 1.7 is released
https://www.djangoproject.com/download/1.7c3/tarball/
Markdown==2.4.1
Pillow==2.5.1
argparse==1.2.1
astroid==1.1.1
dj-database-url==0.3.0
dj-static==0.0.6
django-appconf==0.6
django-forms-bootstrap==3.0.0
django-user-accounts==1.0c9
easy-thumbnails==2.0.1
flake8==2.2.2
gunicorn==19.1.0
logilab-common==0.62.0
mccabe==0.2.1
pep8==1.5.7
pinax-theme-bootstrap-account==1.0b2
psycopg2==2.5.3
pyflakes==0.8.1
pylint==1.2.1
pytz==2014.4
six==1.7.3
static3==0.5.1
wsgiref==0.1.2
| https://github.com/maraujop/django-crispy-forms/archive/dev.zip#egg=django-crispy-forms
Markdown==2.4.1
Pillow==2.5.1
argparse==1.2.1
astroid==1.1.1
dj-database-url==0.3.0
dj-static==0.0.6
django==1.7
django-appconf==0.6
django-forms-bootstrap==3.0.0
django-oauth2-provider==0.2.6.1
django-user-accounts==1.0c9
easy-thumbnails==2.0.1
flake8==2.2.2
gunicorn==19.1.0
logilab-common==0.62.0
mccabe==0.2.1
pep8==1.5.7
pinax-theme-bootstrap-account==1.0b2
psycopg2==2.5.3
pyflakes==0.8.1
pylint==1.2.1
pytz==2014.4
six==1.7.3
static3==0.5.1
wsgiref==0.1.2
| Upgrade to Django 1.7 final | Upgrade to Django 1.7 final
| Text | mit | OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans | text | ## Code Before:
https://github.com/maraujop/django-crispy-forms/archive/dev.zip#egg=django-crispy-forms
# TODO: Replace this when 1.7 is released
https://www.djangoproject.com/download/1.7c3/tarball/
Markdown==2.4.1
Pillow==2.5.1
argparse==1.2.1
astroid==1.1.1
dj-database-url==0.3.0
dj-static==0.0.6
django-appconf==0.6
django-forms-bootstrap==3.0.0
django-user-accounts==1.0c9
easy-thumbnails==2.0.1
flake8==2.2.2
gunicorn==19.1.0
logilab-common==0.62.0
mccabe==0.2.1
pep8==1.5.7
pinax-theme-bootstrap-account==1.0b2
psycopg2==2.5.3
pyflakes==0.8.1
pylint==1.2.1
pytz==2014.4
six==1.7.3
static3==0.5.1
wsgiref==0.1.2
## Instruction:
Upgrade to Django 1.7 final
## Code After:
https://github.com/maraujop/django-crispy-forms/archive/dev.zip#egg=django-crispy-forms
Markdown==2.4.1
Pillow==2.5.1
argparse==1.2.1
astroid==1.1.1
dj-database-url==0.3.0
dj-static==0.0.6
django==1.7
django-appconf==0.6
django-forms-bootstrap==3.0.0
django-oauth2-provider==0.2.6.1
django-user-accounts==1.0c9
easy-thumbnails==2.0.1
flake8==2.2.2
gunicorn==19.1.0
logilab-common==0.62.0
mccabe==0.2.1
pep8==1.5.7
pinax-theme-bootstrap-account==1.0b2
psycopg2==2.5.3
pyflakes==0.8.1
pylint==1.2.1
pytz==2014.4
six==1.7.3
static3==0.5.1
wsgiref==0.1.2
| ERROR: type should be string, got " https://github.com/maraujop/django-crispy-forms/archive/dev.zip#egg=django-crispy-forms\n- # TODO: Replace this when 1.7 is released\n- https://www.djangoproject.com/download/1.7c3/tarball/\n Markdown==2.4.1\n Pillow==2.5.1\n argparse==1.2.1\n astroid==1.1.1\n dj-database-url==0.3.0\n dj-static==0.0.6\n+ django==1.7\n django-appconf==0.6\n django-forms-bootstrap==3.0.0\n+ django-oauth2-provider==0.2.6.1\n django-user-accounts==1.0c9\n easy-thumbnails==2.0.1\n flake8==2.2.2\n gunicorn==19.1.0\n logilab-common==0.62.0\n mccabe==0.2.1\n pep8==1.5.7\n pinax-theme-bootstrap-account==1.0b2\n psycopg2==2.5.3\n pyflakes==0.8.1\n pylint==1.2.1\n pytz==2014.4\n six==1.7.3\n static3==0.5.1\n wsgiref==0.1.2" | 4 | 0.153846 | 2 | 2 |
fd8ce9d91eb74012d2dd570351b8423bdae866d0 | style.css | style.css | svg #ring {
opacity: 0.2;
}
svg #logs {
opacity: 0.2;
}
svg .server {
}
svg .follower {
fill: red;
}
svg .candidate {
fill: yellow;
}
svg .leader {
fill: green;
}
svg .server path {
fill: none;
stroke: black;
}
svg .server text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .message.request {
fill: blue;
stroke: blue;
}
svg .message.reply {
/* fill with no opacity so it's clickable */
fill: blue;
fill-opacity: 0;
stroke: blue;
}
svg .log {
fill: none;
stroke: gray;
}
svg .entry rect {
fill: none;
stroke: black;
stroke-width: 2;
}
svg .entry text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .nextIndex {
fill: green;
fill-opacity: .5;
}
| svg #ring {
opacity: 0.2;
}
svg #logs {
opacity: 0.2;
}
svg .server {
}
svg .follower {
fill: red;
}
svg .candidate {
fill: yellow;
}
svg .leader {
fill: green;
}
svg .server path {
fill: none;
stroke: black;
}
svg .server text {
text-anchor: middle;
alignment-baseline: central;
text-align: center;
}
svg .server a:hover {
text-decoration: none;
}
svg .message.request {
fill: blue;
stroke: blue;
}
svg .message.reply {
/* fill with no opacity so it's clickable */
fill: blue;
fill-opacity: 0;
stroke: blue;
}
svg .log {
fill: none;
stroke: gray;
}
svg .entry rect {
fill: none;
stroke: black;
stroke-width: 2;
}
svg .entry text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .nextIndex {
fill: green;
fill-opacity: .5;
}
| Remove underline when hovering over server | Remove underline when hovering over server
| CSS | isc | ongardie/raftscope,ongardie/raftscope,sekcheong/raftscope,tempbottle/raftscope,sekcheong/raftscope,tempbottle/raftscope | css | ## Code Before:
svg #ring {
opacity: 0.2;
}
svg #logs {
opacity: 0.2;
}
svg .server {
}
svg .follower {
fill: red;
}
svg .candidate {
fill: yellow;
}
svg .leader {
fill: green;
}
svg .server path {
fill: none;
stroke: black;
}
svg .server text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .message.request {
fill: blue;
stroke: blue;
}
svg .message.reply {
/* fill with no opacity so it's clickable */
fill: blue;
fill-opacity: 0;
stroke: blue;
}
svg .log {
fill: none;
stroke: gray;
}
svg .entry rect {
fill: none;
stroke: black;
stroke-width: 2;
}
svg .entry text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .nextIndex {
fill: green;
fill-opacity: .5;
}
## Instruction:
Remove underline when hovering over server
## Code After:
svg #ring {
opacity: 0.2;
}
svg #logs {
opacity: 0.2;
}
svg .server {
}
svg .follower {
fill: red;
}
svg .candidate {
fill: yellow;
}
svg .leader {
fill: green;
}
svg .server path {
fill: none;
stroke: black;
}
svg .server text {
text-anchor: middle;
alignment-baseline: central;
text-align: center;
}
svg .server a:hover {
text-decoration: none;
}
svg .message.request {
fill: blue;
stroke: blue;
}
svg .message.reply {
/* fill with no opacity so it's clickable */
fill: blue;
fill-opacity: 0;
stroke: blue;
}
svg .log {
fill: none;
stroke: gray;
}
svg .entry rect {
fill: none;
stroke: black;
stroke-width: 2;
}
svg .entry text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .nextIndex {
fill: green;
fill-opacity: .5;
}
| svg #ring {
opacity: 0.2;
}
svg #logs {
opacity: 0.2;
}
svg .server {
}
svg .follower {
fill: red;
}
svg .candidate {
fill: yellow;
}
svg .leader {
fill: green;
}
svg .server path {
fill: none;
stroke: black;
}
svg .server text {
text-anchor: middle;
alignment-baseline: central;
- text-align: center';
? -
+ text-align: center;
+ }
+
+ svg .server a:hover {
+ text-decoration: none;
}
svg .message.request {
fill: blue;
stroke: blue;
}
svg .message.reply {
/* fill with no opacity so it's clickable */
fill: blue;
fill-opacity: 0;
stroke: blue;
}
svg .log {
fill: none;
stroke: gray;
}
svg .entry rect {
fill: none;
stroke: black;
stroke-width: 2;
}
svg .entry text {
text-anchor: middle;
alignment-baseline: central;
text-align: center';
}
svg .nextIndex {
fill: green;
fill-opacity: .5;
} | 6 | 0.089552 | 5 | 1 |
d976e01015aea0860393e6da1b1e7c09c2c59952 | test/test_helper.js | test/test_helper.js | import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
| import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
| Add global navigator setting to modify the error, 'navigator is not defined', in testing with react-router link | Add global navigator setting to modify the error, 'navigator is not defined', in testing with react-router link
| JavaScript | mit | DeAnnHuang/ReduxSimpleStarter,zivolution921/ReduxSimpleStarter2,carlos-agu/BlogPosts,YacYac/ReduxSimpleStarter,sebasj/udemy-react-redux-blog,Bojan17/weatherApp,roelver/twotter,robertorb21/ReduxSimpleStarter,erlinis/ReduxSimpleStarter,josephcode773/reactYoutubeViewer,paulofabiano/react-redux-blog,allenyin55/reading_with_Annie,rcwlabs/yt-react,JAstbury/react-simple-game,raviwu/react-weather,gaspar-tovar-civitas/jobsityChallenge,LeoArouca/ReactRedux_Part4,gothbarbie/client-auth,vamsikoduri/udemy_next_level_redux,feineken/weather-redux,rahavMatan/react-phonecat,ASH-khan/ReduxMiddleware,ljones140/react_redux_weather_app,JosephLeon/redux-simple-starter-tutorial,kaloudiyi/VotePlexClient,MsZlets/Circles,camboio/ibis,hlgbls/ReduxSimpleStarter,SRosenshein/react-auth-client,dmichaelglenn/react_udemy,andrewdc92/react-crud-blog,nimibahar/reduxBlog,RaneWallin/FCCLeaderboard,DeAnnHuang/ReduxSimpleStarter,cynthiacd/capstone-factoring-app,IvanMigov/ReactAuthenticationClient,phirefly/react-redux-starter,TheeSweeney/ReactReview,bambery/udemy-react-booklist,AaronBDC/blogRRR,dakotahavel/weather-chart,angela-cheng/simpleBlog,ArashDai/portfolio,dushyant/ReactWeatherApp,ftoresan/react-redux-course,sebasj/udemy-react-redux-blog,johnnyvf24/hellochess-v2,finfort/TodoReactApp,giapiazze/react-redux-weather,hekgarcia/ReduxSimpleStarter,JunyuChen-0115/ReactWithRedux,nik149/react_test,carlos-agu/BlogPosts,alirezahi/ReminderPro,LeeLa-Jet/nick,erjin/ReduxSimpleStarter,alexkarevoll/ReduxSimpleTester,kevinsangnguyen/WeatherAPIReactRedux,bolivierjr/Weather-Chart-App,marktong11/blog,marktong11/blog,roelver/twotter,gsambrotta/weather-app-redux,ljones140/react_redux_weather_app,Jcook894/Blog_App,jetshoji/Asia_Trip,tpechacek/redux-blog,AdinoyiSadiq/back-office-tool,eandy5000/react_auth,hamholla/concentration,vikasv/ReactWithRedux,Alex-Windle/rijksmuseum_api,Fendoro/YouTubeVideoList,AdinoyiSadiq/back-office-tool,makxks/ReactBlog,TheeSweeney/ReactReview,OatsAndSquats25/React-redux-weather-app,dragonman225/TODO-React,seanrtaylor/ReactWeather,kprzybylowski/redux,nbreath/react-practice,Alex-Windle/rijksmuseum_api,ajdeleon/weather,mateusrdgs/ReactTraining,sohail87/ReduxWeather,Activesite/ReduxMiddleware,RichardDorn/mastermind-clone,rahavMatan/react-phonecat,lCavazzani/ReactReduxStarter,julianomoreira/ReduxSimpleStarter,periman2/DungeonRoller,vmandic/ReduxBlogEntries,milangupta511/react-todo-list,madi031/ReactRouterBlog,MaxwellKendall/Book-Project,shashankp250/Youtube_clone,CalinoviciPaul/react,juneshaw/ReactBlog,giapiazze/react-redux-weather,josebigio/PodCast,fifiteen82726/ReduxSimpleStarter,AnushaBalusu/ReactReduxStarterApp,puan0601/dronetube,walker808/exploreMapBoxHack,nimibahar/reduxBlog,izabelka/redux-simple-starter,mdunnegan/ReactFrontEndAuthentication,Legaspi21/react-redux,deinde/React_Higher_Order_Components,finfort/TodoReactApp,khanhhq2k/react-youtube-search-api,OatsAndSquats25/React-redux-weather-app,aloaiza/ReduxSimpleStarter,manuelescamilla/youtube-browser,Activesite/Middleware,vndeguzman/redux-exercise,arbianchi/familiestogether-react,arbianchi/familiestogether-react,eunbigo91/ReduxSimpleStarter,StephenGrider/ReduxSimpleStarter,harshattray/w_track,JAstbury/react-simple-game,huynhtastic/ReduxSimpleStarter,michaeldumalag/react-blog,rafaalb/BlogsReact,yonarbel/reactWeatherApp,Eleutherado/ReactBasicBlog,aquajach/react_redux_tutorial,Rickardkamel/React-Testing,mateusrdgs/ReactTraining,dustin520/ReduxSimpleStarter,tlantz77/ReactWeather,daveprochazka/ReduxSimpleStarter,danielnavram/React-youtube-api,dcporter44/tunefest-frontend,danielnavram/React-youtube-api,JenPhD/ReactYouTubeSearch,MrmRed/test,majalcmaj/ReactJSCourse,Karthik9321/ReduxSimpleStarter,paulofabiano/react-redux-blog,johnnyvf24/hellochess-v2,wongjenn/redux-weather-app,mdunnegan/ReactFrontEndAuthentication,vanessamuller/ReduxSimpleStarter,jocelio/meuclima,hollymhofer/ReduxForms,majalcmaj/ReactJSCourse,yonarbel/reactWeatherApp,alexkarevoll/ReduxSimpleTester,darknight1983/React_Youtube_searchSite,tuncatunc/react-blog,morthenn/ReduxSimpleStarter,RegOpz/RegOpzWebApp,tanimmahmud/React_youtube_search,harunawaizumi/weather_graph,kanokgan/ReduxSimpleStarter,iamwithnail/react-redux,ezetreezy/reactTesting,dpano/redux-d,iamwithnail/react-redux,spartanhooah/BlogApp,TheBitsDontByte/React_SimpleYoutube,Alex-Windle/redux_weather_API,unhommequidort/redux_blog,steeeeee/udemy-react-redux-blog,majalcmaj/ReactJSCourse,huynhtastic/ReduxSimpleStarter,Alex-Windle/redux_weather_API,jordanyryan/JDTube,erdgabios/react-youtube-search,alxDiaz/reactFirstProject,Jdraju/TelcoMNP,ajdeleon/weather,icartusacrimea/portfolio_reactredux,noframes/react-youtube-search,SupachaiChaipratum/ReduxSimpleStarter,OscarDeDios/cursoUdemyReact,D7Torres/react-forecastsparks,framirez224/youtube-search,matwej/IAmHungryFor,maorefaeli/BookList,makxks/ReactBlog,LawynnJana/weneedanidea,lCavazzani/ReactReduxStarter,christophertphillips/react-video-interface,polettoweb/ReactReduxStarter,nushicoco/books_rabbit,mchaelml/Atom-React,relaunched/book_list,ASH-khan/ReduxMiddleware,davidmferris/showhopper_v3_client,vamsikoduri/udemy_next_level_redux,jetshoji/Asia_Trip,fifiteen82726/ReduxSimpleStarter,MartinMattyZahradnik/Assignment,Schachte/React-Routes-Learning,reactjs-andru1989/blog,jordanyryan/JDTube,IvanMigov/ReactAuthenticationClient,ravindraranwala/countdowntimerapp,darknight1983/React_Youtube_searchSite,vominhhoang308/ReduxSimpleStarter,dcporter44/tunefest-frontend,ArashDai/portfolio,phirefly/react-redux-starter,lingyaomeng1/youtube-search,erjin/ReduxSimpleStarter,tgundavelli/React_Udemy,budaminof/scoreboard,venus-nautiyal/react_app,khanhhq2k/react-youtube-search-api,nimibahar/newReduxBlog,dukarc/lolchamps,SRosenshein/react-auth-client,bryanbuitrago/reactVideoApp,josebigio/PodCast,Ianpig/mobile-select,stewarea/React-Youtube,GuroKung/react-redux-starter,peterussell/udemy-4-redux-wx,camboio/ibis,tareq-rar/reduxReact,OscarDeDios/cursoUdemyReact,Rickardkamel/React-Testing,fahadqazi/react-redux,kanokgan/ReduxSimpleStarter,julianomoreira/ReduxSimpleStarter,JosephLeon/redux-simple-starter-tutorial,richgurney/ReduxBlogBoilerPlate,nik149/react_test,jeroenmies/WeatherForecast,morthenn/ReduxSimpleStarter,cynthiacd/capstone-factoring-app,LeeLa-Jet/nick,relaunched/book_list,michaeldumalag/react-blog,harshattray/w_track,CalinoviciPaul/react,gothbarbie/client-auth,laniywh/game-of-life,dakotahavel/weather-chart,ezetreezy/reactTesting,nicolasmsg/react-blog,kyrogue/ReactReduxStart,briceth/reactBlog,christophertphillips/react-video-interface,cgonul/MyReduxSimpleStarter,andreassiegel/react-redux,yingchen0706/ReduxForm,nfcortega89/nikkotoonaughty,hisastry/udemy-react,manjarb/ReduxSimpleStarter,JoshHarris85/React-Video-Player,benjaminboruff/CityWeather,ProstoBoris/ReactMemoryGame,IanY57/ReduxSimpleStarter,yingchen0706/ReduxForm,erdgabios/react-youtube-search,mustafashakeel/reduxexample-family,tareq-rar/reduxReact,periman2/DungeonRoller,ercekal/client-side-auth-react,nilvisa/LEK_react-with-redux,maorefaeli/BookList,raninho/learning-reactjs,simondate/Youtube-react-app,vikasv/ReactWithRedux,JunyuChen-0115/ReactWithRedux,natcreates/react-learning,kristingreenslit/react-redux-weather-browser,MartinMattyZahradnik/Assignment,zivolution921/ReduxSimpleStarter2,eandy5000/react_auth,sean1rose/WeatherApp,RegOpz/RegOpzWebApp,leventku/redux-idea-tiles,Bassov/Weather,dragonman225/TODO-React,jocelio/meuclima,simondate/Youtube-react-app,jeroenmies/WeatherForecast,edwardcroh/traveler,wongjenn/redux-weather-app,nsepehr/weatherApp,StephanYu/modern_redux_weather_forecast,kprzybylowski/redux,YacYac/ReduxSimpleStarter,oldirony/react-router-playground,pporche87/react-youtube-clone,raviwu/react-weather,pornarong/weather-redux,nilvisa/LEK_react-with-redux,liyan90s/react-redux-funtime,mustafashakeel/reduxexample-family,dpano/redux-d,andreassiegel/react-redux,mdunnegan/ReduxDrumApp,vominhhoang308/ReduxSimpleStarter,skywindzz/higher-order-component,IanY57/ReduxSimpleStarter,ckwong93/TailsFromTheCrypt,merry75/ReduxBookLibrary,dustin520/ReduxSimpleStarter,matwej/IAmHungryFor,kaloudiyi/VotePlexClient,natcreates/react-learning,vndeguzman/redux-exercise,pporche87/react-youtube-clone,Szalbik/reacttodos,albertchanged/YouTube-Topics,RegOpz/RegOpzWebApp,JenPhD/ReactYouTubeSearch,daveprochazka/ReduxSimpleStarter,AdinoyiSadiq/back-office-tool,Szalbik/reacttodos,blueeyess/redux-intermediate,merry75/ReduxBookLibrary,Fendoro/YouTubeVideoList,vtkamiji/react-aula4,richgurney/ReactTemperatureApp,hekgarcia/ReduxSimpleStarter,ravindraranwala/countdowntimerapp,manjarb/ReduxSimpleStarter,puan0601/dronetube,davidmferris/showhopper_v3_client,RichardDorn/mastermind-clone,KamillaKhabibrakhmanova/redux_blog,venus-nautiyal/react_app,ckwong93/TailsFromTheCrypt,bolivierjr/Weather-Chart-App,rickywid/micdb,framirez224/youtube-search,enuber/Redux_starter,ravindraranwala/piglatinconverterapp,nicolasmsg/react-blog,steeeeee/udemy-react-redux-blog,nimibahar/newReduxBlog,vtkamiji/react-aula4,eunbigo91/ReduxSimpleStarter,ravindraranwala/piglatinconverterapp,izabelka/redux-simple-starter,TheBitsDontByte/React_SimpleYoutube,Bojan17/weatherApp,kristingreenslit/react-redux-weather-browser,JeremyWeisener/Test,MrmRed/test,mlombard82/weatherApp,liyan90s/react-redux-funtime,mlombard82/weatherApp,vanessamuller/ReduxSimpleStarter,Legaspi21/react-redux,AnushaBalusu/ReactReduxStarterApp,dragonman225/TODO-React,tomdzi5/redux4,StephanYu/modern_redux_weather_forecast,AaronBDC/blogRRR,laniywh/game-of-life,oldirony/react-router-playground,vanpeta/react-reduct-blog,edwardcroh/traveler,nushicoco/books_rabbit,raninho/learning-reactjs,unhommequidort/redux_blog,walker808/exploreMapBoxHack,noframes/react-youtube-search,Activesite/ReduxMiddleware,milangupta511/react-todo-list,Funkycamel/Modern-React-with-Redux-React-Router-and-Redux-Form-Section-9,hlgbls/ReduxSimpleStarter,lingyaomeng1/youtube-search,vtkamiji/react-aula3,Jaime691/ReactTube,sohail87/ReduxWeather,laharidas/ReactReduxTesting,StephenGrider/ReduxSimpleStarter,cgonul/MyReduxSimpleStarter,icartusacrimea/portfolio_reactredux,andrewdc92/react-crud-blog,angela-cheng/simpleBlog,deinde/React_Higher_Order_Components,MaxwellKendall/Book-Project,tuncatunc/react-blog,JeremyWeisener/Test,SupachaiChaipratum/ReduxSimpleStarter,budaminof/scoreboard,asengardeon/react-video-player,flpelluz/weatherApp,Bentopi/React_Youtube_UI,rafaalb/BlogsReact,D7Torres/react-forecastsparks,tpechacek/redux-blog,Jdraju/TelcoMNP,eduarmreyes/ReactWeatherApp,Phani17/WeatherReport,yihan940211/WTFSIGTP,ProstoBoris/ReactMemoryGame,abramin/reduxStarter,erlinis/ReduxSimpleStarter,Funkycamel/Modern-React-with-Redux-React-Router-and-Redux-Form-Section-9,polettoweb/ReactReduxStarter,nsepehr/weatherApp,warniel08/React-MockTubeTut,josephcode773/reactYoutubeViewer,lukebergen/react-redux-reference,tlantz77/ReactWeather,reactjs-andru1989/blog,rickywid/micdb,allenyin55/reading_with_Annie,kyrogue/ReactReduxStart,eduarmreyes/ReactWeatherApp,dukarc/lolchamps,KaeyangTheG/react-chessboard,hisastry/udemy-react,dom-mages/reactTesting,josebigio/PodCast,tanimmahmud/React_youtube_search,RaulEscobarRivas/client,MarekTalpas/GL_hire,gabriellisboa/reduxStudies,blueeyess/redux-intermediate,manuelescamilla/youtube-browser,kevinsangnguyen/WeatherAPIReactRedux,robertorb21/ReduxSimpleStarter,fahadqazi/react-redux,scottjbarr/blinky,RaulEscobarRivas/client,gaspar-tovar-civitas/jobsityChallenge,enuber/Redux_starter,christat/react-redux,gabriellisboa/reduxStudies,Shohin93/ReactRedux,seanrtaylor/ReactWeather,MarekTalpas/GL_hire,ric9176/hoc,JoshHarris85/React-Video-Player,theoryNine/react-video-browser,ercekal/client-side-auth-react,Ianpig/mobile-select,stewarea/React-Youtube,feineken/weather-redux,Karthik9321/ReduxSimpleStarter,Schachte/React-Routes-Learning,pornarong/weather-redux,hamholla/concentration,yihan940211/WTFSIGTP,sean1rose/WeatherApp,leventku/redux-idea-tiles,richgurney/ReduxBlogBoilerPlate,Phani17/WeatherReport,briceth/reactBlog,bambery/udemy-react-booklist,juneshaw/ReactBlog,Shohin93/ReactRedux,harunawaizumi/weather_graph,rcwlabs/yt-react,tomdzi5/redux4,alirezahi/ReminderPro,aquajach/react_redux_tutorial,jstowers/ReduxBlogApp,Eleutherado/ReactBasicBlog,Jcook894/Blog_App,shashankp250/Youtube_clone,Jaime691/ReactTube,peterussell/udemy-4-redux-wx,MsZlets/Circles,vanpeta/react-reduct-blog,alxDiaz/reactFirstProject,vtkamiji/react-aula3,GuroKung/react-redux-starter,johnnyvf24/hellochess-v2,hollymhofer/ReduxForms,lukebergen/react-redux-reference,ric9176/hoc,gsambrotta/weather-app-redux,ftoresan/react-redux-course,RaneWallin/FCCLeaderboard,Activesite/Middleware,Bassov/Weather,benjaminboruff/CityWeather,jstowers/ReduxBlogApp,nbreath/react-practice,laharidas/ReactReduxTesting,tgundavelli/React_Udemy,RaneWallin/FCCLeaderboard,mchaelml/Atom-React,vmandic/ReduxBlogEntries,KamillaKhabibrakhmanova/redux_blog,theoryNine/react-video-browser,ryanmagoon/simple-blog,LawynnJana/weneedanidea,ryanmagoon/simple-blog,KaeyangTheG/react-chessboard,spartanhooah/BlogApp,mdunnegan/ReduxDrumApp,LeoArouca/ReactRedux_Part4,nfcortega89/nikkotoonaughty,madi031/ReactRouterBlog,christat/react-redux,albertchanged/YouTube-Topics,skywindzz/higher-order-component,Bentopi/React_Youtube_UI,abramin/reduxStarter,bryanbuitrago/reactVideoApp,dom-mages/reactTesting,dushyant/ReactWeatherApp,asengardeon/react-video-player,warniel08/React-MockTubeTut,hamholla/concentration,aloaiza/ReduxSimpleStarter,dmichaelglenn/react_udemy,scottjbarr/blinky,flpelluz/weatherApp | javascript | ## Code Before:
import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
## Instruction:
Add global navigator setting to modify the error, 'navigator is not defined', in testing with react-router link
## Code After:
import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
| import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
+ global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect}; | 1 | 0.028571 | 1 | 0 |
1acfad3d4ed8625c7d541e1b731c4fa9c930d677 | playbooks/workflow/docker-restart.sh | playbooks/workflow/docker-restart.sh | set -x
n=0
until [ "$n" -ge 5 ]
do
sudo restart docker
output=`docker run artifacts/base:latest wget http://www.google.com 2>&1`
if [[ "$output" == *"failed"* ]]; then
echo "Docker did not start properly! Trying to restart..."
n=$[$n+1]
sleep 3
else
echo "Docker network is working properly!"
break
fi
done
set +x
| n=0
until [ "$n" -ge 5 ]
do
sudo restart docker
output=`docker run artifacts/base:latest wget http://www.google.com 2>&1`
if [[ "$output" == *"failed"* ]]; then
echo "Docker did not start properly! Trying to restart..."
n=$[$n+1]
sleep 3
else
echo "Docker network is working properly!"
break
fi
done
| Remove debugging from docker restart script. | Remove debugging from docker restart script.
| Shell | apache-2.0 | manuelesimi/elasticluster-config-tools | shell | ## Code Before:
set -x
n=0
until [ "$n" -ge 5 ]
do
sudo restart docker
output=`docker run artifacts/base:latest wget http://www.google.com 2>&1`
if [[ "$output" == *"failed"* ]]; then
echo "Docker did not start properly! Trying to restart..."
n=$[$n+1]
sleep 3
else
echo "Docker network is working properly!"
break
fi
done
set +x
## Instruction:
Remove debugging from docker restart script.
## Code After:
n=0
until [ "$n" -ge 5 ]
do
sudo restart docker
output=`docker run artifacts/base:latest wget http://www.google.com 2>&1`
if [[ "$output" == *"failed"* ]]; then
echo "Docker did not start properly! Trying to restart..."
n=$[$n+1]
sleep 3
else
echo "Docker network is working properly!"
break
fi
done
| - set -x
n=0
until [ "$n" -ge 5 ]
do
sudo restart docker
output=`docker run artifacts/base:latest wget http://www.google.com 2>&1`
if [[ "$output" == *"failed"* ]]; then
echo "Docker did not start properly! Trying to restart..."
n=$[$n+1]
sleep 3
else
echo "Docker network is working properly!"
break
fi
done
- set +x | 2 | 0.125 | 0 | 2 |
2f42b4af34396bef942330a0ca7545e1c30627c1 | src/Repositories/RepositoryFactory.php | src/Repositories/RepositoryFactory.php | <?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolution.
*
* @var array
*/
protected $overrides = [];
/**
* Create new instance of RepositoryFactory.
*
* @param array $overrides
*
* @return void
*/
public function __construct(array $overrides = [])
{
$this->overrides = $overrides;
}
/**
* Get repository for the corresponding model.
* If $key is null return instance of the factory.
*
* @param string|null $key
*
* @return mixed
*/
public function get($key = null)
{
if (!empty($key)) {
$class = null;
if (array_has($this->overrides, $key)) {
$class = array_get($this->overrides, $key);
} else {
$class = $this->build($key);
}
return resolve($class);
}
return $this;
}
/**
* Build the path of the Repository class.
*
* @param string $key
*
* @return string
*/
protected function build($key)
{
return app()->getNamespace() . $this->laravel['config']['les.repository_namespace'] . '\\' . studly_case(str_singular($key)) . 'Repository';
}
}
| <?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolution.
*
* @var array
*/
protected $overrides = [];
/**
* Create new instance of RepositoryFactory.
*
* @param array $overrides
*
* @return void
*/
public function __construct(array $overrides = [])
{
$this->overrides = $overrides;
}
/**
* Get repository for the corresponding model.
* If $key is null return instance of the factory.
*
* @param string|null $key
*
* @return mixed
*/
public function get($key = null)
{
if (!empty($key)) {
$class = null;
if (array_has($this->overrides, $key)) {
$class = array_get($this->overrides, $key);
} else {
$class = $this->build($key);
}
return resolve($class);
}
return $this;
}
/**
* Build the path of the Repository class.
*
* @param string $key
*
* @return string
*/
protected function build($key)
{
return app()->getNamespace() . config('les.repository_namespace') . '\\' . studly_case(str_singular($key)) . 'Repository';
}
}
| Call to config helper function instead of an instance of the container | Call to config helper function instead of an instance of the container
| PHP | mit | gearhub/laravel-enhancement-suite | php | ## Code Before:
<?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolution.
*
* @var array
*/
protected $overrides = [];
/**
* Create new instance of RepositoryFactory.
*
* @param array $overrides
*
* @return void
*/
public function __construct(array $overrides = [])
{
$this->overrides = $overrides;
}
/**
* Get repository for the corresponding model.
* If $key is null return instance of the factory.
*
* @param string|null $key
*
* @return mixed
*/
public function get($key = null)
{
if (!empty($key)) {
$class = null;
if (array_has($this->overrides, $key)) {
$class = array_get($this->overrides, $key);
} else {
$class = $this->build($key);
}
return resolve($class);
}
return $this;
}
/**
* Build the path of the Repository class.
*
* @param string $key
*
* @return string
*/
protected function build($key)
{
return app()->getNamespace() . $this->laravel['config']['les.repository_namespace'] . '\\' . studly_case(str_singular($key)) . 'Repository';
}
}
## Instruction:
Call to config helper function instead of an instance of the container
## Code After:
<?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolution.
*
* @var array
*/
protected $overrides = [];
/**
* Create new instance of RepositoryFactory.
*
* @param array $overrides
*
* @return void
*/
public function __construct(array $overrides = [])
{
$this->overrides = $overrides;
}
/**
* Get repository for the corresponding model.
* If $key is null return instance of the factory.
*
* @param string|null $key
*
* @return mixed
*/
public function get($key = null)
{
if (!empty($key)) {
$class = null;
if (array_has($this->overrides, $key)) {
$class = array_get($this->overrides, $key);
} else {
$class = $this->build($key);
}
return resolve($class);
}
return $this;
}
/**
* Build the path of the Repository class.
*
* @param string $key
*
* @return string
*/
protected function build($key)
{
return app()->getNamespace() . config('les.repository_namespace') . '\\' . studly_case(str_singular($key)) . 'Repository';
}
}
| <?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolution.
*
* @var array
*/
protected $overrides = [];
/**
* Create new instance of RepositoryFactory.
*
* @param array $overrides
*
* @return void
*/
public function __construct(array $overrides = [])
{
$this->overrides = $overrides;
}
/**
* Get repository for the corresponding model.
* If $key is null return instance of the factory.
*
* @param string|null $key
*
* @return mixed
*/
public function get($key = null)
{
if (!empty($key)) {
$class = null;
if (array_has($this->overrides, $key)) {
$class = array_get($this->overrides, $key);
} else {
$class = $this->build($key);
}
return resolve($class);
}
return $this;
}
/**
* Build the path of the Repository class.
*
* @param string $key
*
* @return string
*/
protected function build($key)
{
- return app()->getNamespace() . $this->laravel['config']['les.repository_namespace'] . '\\' . studly_case(str_singular($key)) . 'Repository';
? ---------------- ^^^ ^
+ return app()->getNamespace() . config('les.repository_namespace') . '\\' . studly_case(str_singular($key)) . 'Repository';
? ^ ^
}
} | 2 | 0.03125 | 1 | 1 |
abf2426015bf3df7a1cce70c737be1681e36f3ec | metadata/org.androidsoft.app.permission.txt | metadata/org.androidsoft.app.permission.txt | Categories:System
License:GPLv3
Web Site:http://www.androidsoft.org
Source Code:https://code.google.com/p/androidsoft/source
Issue Tracker:https://code.google.com/p/androidsoft/issues
Auto Name:Permission Friendly Apps
Summary:Rank apps by permissions
Description:
Gives a rating to each app, based on how much influence they can have.
.
Repo Type:srclib
Repo:AndroidSoft
Build:1.4.1,12
commit=64
subdir=permission
prebuild=rm -rf releases
target=android-15
Build:1.4.2,13
commit=66
subdir=permission
prebuild=rm -rf releases
target=android-15
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.4.2
Current Version Code:13
No Source Since:1.4.2.1
| Categories:System
License:GPLv3
Web Site:http://www.androidsoft.org
Source Code:https://github.com/androidsoft-org/androidsoft-permission
Issue Tracker:https://github.com/androidsoft-org/androidsoft-permission/issues
Auto Name:Permission Friendly Apps
Summary:Rank apps by permissions
Description:
Gives a rating to each app, based on how much influence they can have.
.
#Repo Type:srclib
#Repo:AndroidSoft
Repo Type:git
Repo:https://github.com/androidsoft-org/androidsoft-permission
Build:1.4.1,12
commit=64
subdir=permission
prebuild=rm -rf releases
target=android-15
Build:1.4.2,13
commit=66
subdir=permission
prebuild=rm -rf releases
target=android-15
# new repo
Build:2.1.0,18
commit=b8c9aa2f920575101168449185f5b3a68ea4e383
gradle=yes
srclibs=androidsoft-lib-utils@3b08e29969c71f7f599d7db9316d3e7871387ddb,androidsoft-lib-credits@8285334f07c5b2695a047d43d9b4f589cac02edc
rm=libs/*,sign.gradle
prebuild=cp -fR $$androidsoft-lib-utils$$/src/main/java/org src/main/java/ && \
cp -fR $$androidsoft-lib-credits$$/src/main/java/org src/main/java/ && \
sed -i -e '/sign.gradle/d' build.gradle
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:2.1.0
Current Version Code:18
| Update Permission Friendly Apps to 2.1.0 (18) | Update Permission Friendly Apps to 2.1.0 (18)
| Text | agpl-3.0 | f-droid/fdroid-data,f-droid/fdroiddata,f-droid/fdroiddata | text | ## Code Before:
Categories:System
License:GPLv3
Web Site:http://www.androidsoft.org
Source Code:https://code.google.com/p/androidsoft/source
Issue Tracker:https://code.google.com/p/androidsoft/issues
Auto Name:Permission Friendly Apps
Summary:Rank apps by permissions
Description:
Gives a rating to each app, based on how much influence they can have.
.
Repo Type:srclib
Repo:AndroidSoft
Build:1.4.1,12
commit=64
subdir=permission
prebuild=rm -rf releases
target=android-15
Build:1.4.2,13
commit=66
subdir=permission
prebuild=rm -rf releases
target=android-15
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:1.4.2
Current Version Code:13
No Source Since:1.4.2.1
## Instruction:
Update Permission Friendly Apps to 2.1.0 (18)
## Code After:
Categories:System
License:GPLv3
Web Site:http://www.androidsoft.org
Source Code:https://github.com/androidsoft-org/androidsoft-permission
Issue Tracker:https://github.com/androidsoft-org/androidsoft-permission/issues
Auto Name:Permission Friendly Apps
Summary:Rank apps by permissions
Description:
Gives a rating to each app, based on how much influence they can have.
.
#Repo Type:srclib
#Repo:AndroidSoft
Repo Type:git
Repo:https://github.com/androidsoft-org/androidsoft-permission
Build:1.4.1,12
commit=64
subdir=permission
prebuild=rm -rf releases
target=android-15
Build:1.4.2,13
commit=66
subdir=permission
prebuild=rm -rf releases
target=android-15
# new repo
Build:2.1.0,18
commit=b8c9aa2f920575101168449185f5b3a68ea4e383
gradle=yes
srclibs=androidsoft-lib-utils@3b08e29969c71f7f599d7db9316d3e7871387ddb,androidsoft-lib-credits@8285334f07c5b2695a047d43d9b4f589cac02edc
rm=libs/*,sign.gradle
prebuild=cp -fR $$androidsoft-lib-utils$$/src/main/java/org src/main/java/ && \
cp -fR $$androidsoft-lib-credits$$/src/main/java/org src/main/java/ && \
sed -i -e '/sign.gradle/d' build.gradle
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:2.1.0
Current Version Code:18
| Categories:System
License:GPLv3
Web Site:http://www.androidsoft.org
- Source Code:https://code.google.com/p/androidsoft/source
- Issue Tracker:https://code.google.com/p/androidsoft/issues
+ Source Code:https://github.com/androidsoft-org/androidsoft-permission
+ Issue Tracker:https://github.com/androidsoft-org/androidsoft-permission/issues
Auto Name:Permission Friendly Apps
Summary:Rank apps by permissions
Description:
Gives a rating to each app, based on how much influence they can have.
.
- Repo Type:srclib
+ #Repo Type:srclib
? +
- Repo:AndroidSoft
+ #Repo:AndroidSoft
? +
+ Repo Type:git
+ Repo:https://github.com/androidsoft-org/androidsoft-permission
Build:1.4.1,12
commit=64
subdir=permission
prebuild=rm -rf releases
target=android-15
Build:1.4.2,13
commit=66
subdir=permission
prebuild=rm -rf releases
target=android-15
+ # new repo
+ Build:2.1.0,18
+ commit=b8c9aa2f920575101168449185f5b3a68ea4e383
+ gradle=yes
+ srclibs=androidsoft-lib-utils@3b08e29969c71f7f599d7db9316d3e7871387ddb,androidsoft-lib-credits@8285334f07c5b2695a047d43d9b4f589cac02edc
+ rm=libs/*,sign.gradle
+ prebuild=cp -fR $$androidsoft-lib-utils$$/src/main/java/org src/main/java/ && \
+ cp -fR $$androidsoft-lib-credits$$/src/main/java/org src/main/java/ && \
+ sed -i -e '/sign.gradle/d' build.gradle
+
Auto Update Mode:None
Update Check Mode:RepoManifest
- Current Version:1.4.2
? ^^^
+ Current Version:2.1.0
? ++ ^
- Current Version Code:13
? ^
+ Current Version Code:18
? ^
- No Source Since:1.4.2.1
- | 26 | 0.764706 | 18 | 8 |
1ce4c261092ad1653f598473235015f199b51e4a | app/controllers/guide_container_controller.rb | app/controllers/guide_container_controller.rb | class GuideContainerController < ApplicationController
include Mumuki::Laboratory::Controllers::Content
before_action :set_guide
def show
if current_user?
@stats = subject.stats_for(current_user)
@next_exercise = subject.next_exercise(current_user)
else
@next_exercise = subject.first_exercise
end
end
private
def set_guide
raise Mumuki::Domain::NotFoundError if subject.nil?
@guide = subject.guide
end
end
| class GuideContainerController < ApplicationController
include Mumuki::Laboratory::Controllers::Content
before_action :set_guide
def show
@stats = subject.stats_for(current_user)
@next_exercise = subject.next_exercise(current_user)
end
private
def set_guide
@guide = subject.guide
end
end
| Use domain updated method to simplify logic | Use domain updated method to simplify logic
| Ruby | agpl-3.0 | mumuki/mumuki-laboratory,mumuki/mumuki-laboratory,mumuki/mumuki-laboratory,mumuki/mumuki-laboratory | ruby | ## Code Before:
class GuideContainerController < ApplicationController
include Mumuki::Laboratory::Controllers::Content
before_action :set_guide
def show
if current_user?
@stats = subject.stats_for(current_user)
@next_exercise = subject.next_exercise(current_user)
else
@next_exercise = subject.first_exercise
end
end
private
def set_guide
raise Mumuki::Domain::NotFoundError if subject.nil?
@guide = subject.guide
end
end
## Instruction:
Use domain updated method to simplify logic
## Code After:
class GuideContainerController < ApplicationController
include Mumuki::Laboratory::Controllers::Content
before_action :set_guide
def show
@stats = subject.stats_for(current_user)
@next_exercise = subject.next_exercise(current_user)
end
private
def set_guide
@guide = subject.guide
end
end
| class GuideContainerController < ApplicationController
include Mumuki::Laboratory::Controllers::Content
before_action :set_guide
def show
- if current_user?
- @stats = subject.stats_for(current_user)
? --
+ @stats = subject.stats_for(current_user)
- @next_exercise = subject.next_exercise(current_user)
? --
+ @next_exercise = subject.next_exercise(current_user)
- else
- @next_exercise = subject.first_exercise
- end
end
private
def set_guide
- raise Mumuki::Domain::NotFoundError if subject.nil?
@guide = subject.guide
end
end | 9 | 0.428571 | 2 | 7 |
45b38870c53d942acd6cfe8519ae59226641891f | CHANGELOG.md | CHANGELOG.md | * Replace 'c' variable in couchtato.js tasks module with a more descriptive 'util'
* Replace cradle with nano, replace nomnom and Config with bagofholding
### 0.0.5
* Fix version flag
* Fix commands-flags association
* Change default batch size and page size to 1000
### 0.0.4
* Add bulk save/remove support
* Upgrade log4js to 0.3.8, nomnom to 1.0.0
### 0.0.3
* Add startkey and endkey range support
### 0.0.2
* Fix authentication username and password properties
* Fix number of pages command line arg
### 0.0.1
* Initial version
| * Replace 'c' variable in couchtato.js tasks module with a more descriptive 'util'
* Replace cradle with nano, replace nomnom and Config with bagofholding
* Remove -d option, nano as a couchdb driver is fine
### 0.0.5
* Fix version flag
* Fix commands-flags association
* Change default batch size and page size to 1000
### 0.0.4
* Add bulk save/remove support
* Upgrade log4js to 0.3.8, nomnom to 1.0.0
### 0.0.3
* Add startkey and endkey range support
### 0.0.2
* Fix authentication username and password properties
* Fix number of pages command line arg
### 0.0.1
* Initial version
| Add note about removing custom driver support. | Add note about removing custom driver support.
| Markdown | mit | cliffano/couchtato | markdown | ## Code Before:
* Replace 'c' variable in couchtato.js tasks module with a more descriptive 'util'
* Replace cradle with nano, replace nomnom and Config with bagofholding
### 0.0.5
* Fix version flag
* Fix commands-flags association
* Change default batch size and page size to 1000
### 0.0.4
* Add bulk save/remove support
* Upgrade log4js to 0.3.8, nomnom to 1.0.0
### 0.0.3
* Add startkey and endkey range support
### 0.0.2
* Fix authentication username and password properties
* Fix number of pages command line arg
### 0.0.1
* Initial version
## Instruction:
Add note about removing custom driver support.
## Code After:
* Replace 'c' variable in couchtato.js tasks module with a more descriptive 'util'
* Replace cradle with nano, replace nomnom and Config with bagofholding
* Remove -d option, nano as a couchdb driver is fine
### 0.0.5
* Fix version flag
* Fix commands-flags association
* Change default batch size and page size to 1000
### 0.0.4
* Add bulk save/remove support
* Upgrade log4js to 0.3.8, nomnom to 1.0.0
### 0.0.3
* Add startkey and endkey range support
### 0.0.2
* Fix authentication username and password properties
* Fix number of pages command line arg
### 0.0.1
* Initial version
| * Replace 'c' variable in couchtato.js tasks module with a more descriptive 'util'
* Replace cradle with nano, replace nomnom and Config with bagofholding
+ * Remove -d option, nano as a couchdb driver is fine
### 0.0.5
* Fix version flag
* Fix commands-flags association
* Change default batch size and page size to 1000
### 0.0.4
* Add bulk save/remove support
* Upgrade log4js to 0.3.8, nomnom to 1.0.0
### 0.0.3
* Add startkey and endkey range support
### 0.0.2
* Fix authentication username and password properties
* Fix number of pages command line arg
### 0.0.1
* Initial version
| 1 | 0.045455 | 1 | 0 |
1a62ede32054d03a17391e6e6033fd7402cde12b | snapcraft.yaml | snapcraft.yaml | name: micro
version: git
summary: A modern and intuitive terminal-based text editor
description: |
Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
confinement: classic
apps:
micro:
command: bin/micro
parts:
micro:
source: .
source-type: git
plugin: go
build-packages: [make]
prepare: |
mkdir -p ../go/src/github.com/zyedidia/micro
cp -R . ../go/src/github.com/zyedidia/micro
build: |
export GOPATH=$(pwd)/../go
export GOBIN=$(pwd)/../go/bin
cd ../go/src/github.com/zyedidia/micro
make install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/micro $SNAPCRAFT_PART_INSTALL/bin/
| name: micro
version: git
summary: A modern and intuitive terminal-based text editor
description: |
Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
confinement: classic
apps:
micro:
command: bin/micro
parts:
go:
source-tag: go1.10
micro:
after: [go]
source: .
source-type: git
plugin: nil
build-packages: [make]
prepare: |
mkdir -p ../go/src/github.com/zyedidia/micro
cp -R . ../go/src/github.com/zyedidia/micro
build: |
export GOPATH=$(pwd)/../go
export GOBIN=$(pwd)/../go/bin
cd ../go/src/github.com/zyedidia/micro
make install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/micro $SNAPCRAFT_PART_INSTALL/bin/
| Build snap using up-to-date golang | Build snap using up-to-date golang
| YAML | mit | zyedidia/micro,zyedidia/micro | yaml | ## Code Before:
name: micro
version: git
summary: A modern and intuitive terminal-based text editor
description: |
Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
confinement: classic
apps:
micro:
command: bin/micro
parts:
micro:
source: .
source-type: git
plugin: go
build-packages: [make]
prepare: |
mkdir -p ../go/src/github.com/zyedidia/micro
cp -R . ../go/src/github.com/zyedidia/micro
build: |
export GOPATH=$(pwd)/../go
export GOBIN=$(pwd)/../go/bin
cd ../go/src/github.com/zyedidia/micro
make install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/micro $SNAPCRAFT_PART_INSTALL/bin/
## Instruction:
Build snap using up-to-date golang
## Code After:
name: micro
version: git
summary: A modern and intuitive terminal-based text editor
description: |
Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
confinement: classic
apps:
micro:
command: bin/micro
parts:
go:
source-tag: go1.10
micro:
after: [go]
source: .
source-type: git
plugin: nil
build-packages: [make]
prepare: |
mkdir -p ../go/src/github.com/zyedidia/micro
cp -R . ../go/src/github.com/zyedidia/micro
build: |
export GOPATH=$(pwd)/../go
export GOBIN=$(pwd)/../go/bin
cd ../go/src/github.com/zyedidia/micro
make install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/micro $SNAPCRAFT_PART_INSTALL/bin/
| name: micro
version: git
summary: A modern and intuitive terminal-based text editor
description: |
Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
confinement: classic
apps:
micro:
command: bin/micro
parts:
+ go:
+ source-tag: go1.10
micro:
+ after: [go]
source: .
source-type: git
- plugin: go
? ^^
+ plugin: nil
? ^^^
build-packages: [make]
prepare: |
mkdir -p ../go/src/github.com/zyedidia/micro
cp -R . ../go/src/github.com/zyedidia/micro
build: |
export GOPATH=$(pwd)/../go
export GOBIN=$(pwd)/../go/bin
cd ../go/src/github.com/zyedidia/micro
make install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
mv ../go/bin/micro $SNAPCRAFT_PART_INSTALL/bin/ | 5 | 0.166667 | 4 | 1 |
c092a5e83a7ca60d930986b42069360f6800062d | src/main/clojure/lazytest/attach.clj | src/main/clojure/lazytest/attach.clj | (ns lazytest.attach
(:use [lazytest.groups :only (group?)]))
(defn groups-var
"Creates or returns the Var storing Groups in namespace n."
[n]
(or (ns-resolve n '*lazytest-groups*)
(intern n (with-meta '*lazytest-groups* {:private true}) #{})))
(defn groups
"Returns the Groups for namespace n"
[n]
(var-get (groups-var n)))
(defn all-groups
"Returns a sequence of all Groups in all namespaces."
[]
(mapcat (comp seq groups) (all-ns)))
(defn add-group
"Adds Group g to namespace n."
[n g]
{:pre [(group? g)
(the-ns n)]}
{:post [(some #{g} (seq (groups n)))]}
(alter-var-root (groups-var (the-ns n)) conj g))
| (ns lazytest.attach)
(defn groups
"Returns the Groups for namespace n"
[n]
(map var-get (filter #(::group (meta %)) (vals (ns-interns n)))))
(defn all-groups
"Returns a sequence of all Groups in all namespaces."
[]
(mapcat groups (all-ns)))
(defn add-group
"Adds Group g to namespace n."
[n g]
(intern n (with-meta (gensym "lazytest-group-") {::group true}) g))
(defn clear-groups
"Removes all test groups from namespace n."
[n]
(doseq [[sym v] (ns-interns n)]
(when (::group (meta v))
(ns-unmap n sym))))
| Attach interns new vars instead of using a single var | Attach interns new vars instead of using a single var
| Clojure | epl-1.0 | stuartsierra/lazytest | clojure | ## Code Before:
(ns lazytest.attach
(:use [lazytest.groups :only (group?)]))
(defn groups-var
"Creates or returns the Var storing Groups in namespace n."
[n]
(or (ns-resolve n '*lazytest-groups*)
(intern n (with-meta '*lazytest-groups* {:private true}) #{})))
(defn groups
"Returns the Groups for namespace n"
[n]
(var-get (groups-var n)))
(defn all-groups
"Returns a sequence of all Groups in all namespaces."
[]
(mapcat (comp seq groups) (all-ns)))
(defn add-group
"Adds Group g to namespace n."
[n g]
{:pre [(group? g)
(the-ns n)]}
{:post [(some #{g} (seq (groups n)))]}
(alter-var-root (groups-var (the-ns n)) conj g))
## Instruction:
Attach interns new vars instead of using a single var
## Code After:
(ns lazytest.attach)
(defn groups
"Returns the Groups for namespace n"
[n]
(map var-get (filter #(::group (meta %)) (vals (ns-interns n)))))
(defn all-groups
"Returns a sequence of all Groups in all namespaces."
[]
(mapcat groups (all-ns)))
(defn add-group
"Adds Group g to namespace n."
[n g]
(intern n (with-meta (gensym "lazytest-group-") {::group true}) g))
(defn clear-groups
"Removes all test groups from namespace n."
[n]
(doseq [[sym v] (ns-interns n)]
(when (::group (meta v))
(ns-unmap n sym))))
| - (ns lazytest.attach
+ (ns lazytest.attach)
? +
- (:use [lazytest.groups :only (group?)]))
-
- (defn groups-var
- "Creates or returns the Var storing Groups in namespace n."
- [n]
- (or (ns-resolve n '*lazytest-groups*)
- (intern n (with-meta '*lazytest-groups* {:private true}) #{})))
(defn groups
"Returns the Groups for namespace n"
[n]
- (var-get (groups-var n)))
+ (map var-get (filter #(::group (meta %)) (vals (ns-interns n)))))
(defn all-groups
"Returns a sequence of all Groups in all namespaces."
[]
- (mapcat (comp seq groups) (all-ns)))
? ---------- -
+ (mapcat groups (all-ns)))
(defn add-group
"Adds Group g to namespace n."
[n g]
+ (intern n (with-meta (gensym "lazytest-group-") {::group true}) g))
- {:pre [(group? g)
- (the-ns n)]}
- {:post [(some #{g} (seq (groups n)))]}
- (alter-var-root (groups-var (the-ns n)) conj g))
+ (defn clear-groups
+ "Removes all test groups from namespace n."
+ [n]
+ (doseq [[sym v] (ns-interns n)]
+ (when (::group (meta v))
+ (ns-unmap n sym)))) | 24 | 0.888889 | 10 | 14 |
5e2ff962a4427fa08b960ac53ff09553453b2bb9 | test/Tooling/remove-cstr-calls.cpp | test/Tooling/remove-cstr-calls.cpp | // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ '$(llvm-config --cppflags all)' -c %s","file":"%s"}]' > %t/compile_commands.json
// RUN: remove-cstr-calls %t %s | FileCheck %s
#include <string>
namespace llvm { struct StringRef { StringRef(const char *p); }; }
void f1(const std::string &s) {
f1(s.c_str()); // CHECK:remove-cstr-calls.cpp:11:6:11:14:s
}
void f2(const llvm::StringRef r) {
std::string s;
f2(s.c_str()); // CHECK:remove-cstr-calls.cpp:15:6:15:14:s
}
void f3(const llvm::StringRef &r) {
std::string s;
f3(s.c_str()); // CHECK:remove-cstr-calls.cpp:19:6:19:14:s
}
| // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ '$(llvm-config --cppflags all)' -c %s","file":"%s"}]' > %t/compile_commands.json
// RUN: remove-cstr-calls %t %s | FileCheck %s
// XFAIL: *
#include <string>
namespace llvm { struct StringRef { StringRef(const char *p); }; }
void f1(const std::string &s) {
f1(s.c_str()); // CHECK:remove-cstr-calls.cpp:11:6:11:14:s
}
void f2(const llvm::StringRef r) {
std::string s;
f2(s.c_str()); // CHECK:remove-cstr-calls.cpp:15:6:15:14:s
}
void f3(const llvm::StringRef &r) {
std::string s;
f3(s.c_str()); // CHECK:remove-cstr-calls.cpp:19:6:19:14:s
}
| Fix test breakage due to example not being built. | Fix test breakage due to example not being built.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@132376 91177308-0d34-0410-b5e6-96231b3b80d8
| C++ | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang | c++ | ## Code Before:
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ '$(llvm-config --cppflags all)' -c %s","file":"%s"}]' > %t/compile_commands.json
// RUN: remove-cstr-calls %t %s | FileCheck %s
#include <string>
namespace llvm { struct StringRef { StringRef(const char *p); }; }
void f1(const std::string &s) {
f1(s.c_str()); // CHECK:remove-cstr-calls.cpp:11:6:11:14:s
}
void f2(const llvm::StringRef r) {
std::string s;
f2(s.c_str()); // CHECK:remove-cstr-calls.cpp:15:6:15:14:s
}
void f3(const llvm::StringRef &r) {
std::string s;
f3(s.c_str()); // CHECK:remove-cstr-calls.cpp:19:6:19:14:s
}
## Instruction:
Fix test breakage due to example not being built.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@132376 91177308-0d34-0410-b5e6-96231b3b80d8
## Code After:
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ '$(llvm-config --cppflags all)' -c %s","file":"%s"}]' > %t/compile_commands.json
// RUN: remove-cstr-calls %t %s | FileCheck %s
// XFAIL: *
#include <string>
namespace llvm { struct StringRef { StringRef(const char *p); }; }
void f1(const std::string &s) {
f1(s.c_str()); // CHECK:remove-cstr-calls.cpp:11:6:11:14:s
}
void f2(const llvm::StringRef r) {
std::string s;
f2(s.c_str()); // CHECK:remove-cstr-calls.cpp:15:6:15:14:s
}
void f3(const llvm::StringRef &r) {
std::string s;
f3(s.c_str()); // CHECK:remove-cstr-calls.cpp:19:6:19:14:s
}
| // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ '$(llvm-config --cppflags all)' -c %s","file":"%s"}]' > %t/compile_commands.json
// RUN: remove-cstr-calls %t %s | FileCheck %s
+ // XFAIL: *
#include <string>
namespace llvm { struct StringRef { StringRef(const char *p); }; }
void f1(const std::string &s) {
f1(s.c_str()); // CHECK:remove-cstr-calls.cpp:11:6:11:14:s
}
void f2(const llvm::StringRef r) {
std::string s;
f2(s.c_str()); // CHECK:remove-cstr-calls.cpp:15:6:15:14:s
}
void f3(const llvm::StringRef &r) {
std::string s;
f3(s.c_str()); // CHECK:remove-cstr-calls.cpp:19:6:19:14:s
} | 1 | 0.05 | 1 | 0 |
0a7b0d3b112e3d14f238c0179166a74b48e44dfc | .gitlab-ci.yml | .gitlab-ci.yml | image: registry.gitlab.gnome.org/gnome/glib-networking/master:v8
fedora-x86_64:
script:
# Sadly, GCC 9's LeakSanitizer is quite crashy, #86.
# So we will run our tests under asan only once.
- meson -Db_sanitize=address
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- ASAN_OPTIONS=fast_unwind_on_malloc=0 meson test --verbose --timeout-multiplier=10 -C build/
- rm -rf build/
# Now again, this time without asan. We will additionally test installation.
- meson --prefix=$HOME/glib-networking-installed
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- meson test -v -C build/ --repeat=500
- meson install -C build/
artifacts:
paths:
- build/test-results
when: on_failure
| image: registry.gitlab.gnome.org/gnome/glib-networking/master:v8
fedora-x86_64:
tags: [ privileged ]
script:
# Sadly, GCC 9's LeakSanitizer is quite crashy, #86.
# So we will run our tests under asan only once.
- meson -Db_sanitize=address
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- ASAN_OPTIONS=fast_unwind_on_malloc=0 meson test --verbose --timeout-multiplier=10 -C build/
- rm -rf build/
# Now again, this time without asan. We will additionally test installation.
- meson --prefix=$HOME/glib-networking-installed
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- meson test -v -C build/ --repeat=500
- meson install -C build/
artifacts:
paths:
- build/test-results
when: on_failure
| Tag CI jobs as privileged | Tag CI jobs as privileged
This is now required to use asan. Who knows why.
| YAML | lgpl-2.1 | GNOME/glib-networking,GNOME/glib-networking,GNOME/glib-networking | yaml | ## Code Before:
image: registry.gitlab.gnome.org/gnome/glib-networking/master:v8
fedora-x86_64:
script:
# Sadly, GCC 9's LeakSanitizer is quite crashy, #86.
# So we will run our tests under asan only once.
- meson -Db_sanitize=address
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- ASAN_OPTIONS=fast_unwind_on_malloc=0 meson test --verbose --timeout-multiplier=10 -C build/
- rm -rf build/
# Now again, this time without asan. We will additionally test installation.
- meson --prefix=$HOME/glib-networking-installed
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- meson test -v -C build/ --repeat=500
- meson install -C build/
artifacts:
paths:
- build/test-results
when: on_failure
## Instruction:
Tag CI jobs as privileged
This is now required to use asan. Who knows why.
## Code After:
image: registry.gitlab.gnome.org/gnome/glib-networking/master:v8
fedora-x86_64:
tags: [ privileged ]
script:
# Sadly, GCC 9's LeakSanitizer is quite crashy, #86.
# So we will run our tests under asan only once.
- meson -Db_sanitize=address
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- ASAN_OPTIONS=fast_unwind_on_malloc=0 meson test --verbose --timeout-multiplier=10 -C build/
- rm -rf build/
# Now again, this time without asan. We will additionally test installation.
- meson --prefix=$HOME/glib-networking-installed
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- meson test -v -C build/ --repeat=500
- meson install -C build/
artifacts:
paths:
- build/test-results
when: on_failure
| image: registry.gitlab.gnome.org/gnome/glib-networking/master:v8
fedora-x86_64:
+ tags: [ privileged ]
script:
# Sadly, GCC 9's LeakSanitizer is quite crashy, #86.
# So we will run our tests under asan only once.
- meson -Db_sanitize=address
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- ASAN_OPTIONS=fast_unwind_on_malloc=0 meson test --verbose --timeout-multiplier=10 -C build/
- rm -rf build/
# Now again, this time without asan. We will additionally test installation.
- meson --prefix=$HOME/glib-networking-installed
-Dgnutls=enabled
-Dopenssl=enabled
-Dlibproxy=enabled
-Dgnome_proxy=enabled
-Dwerror=true
build/
- ninja -C build/
- meson test -v -C build/ --repeat=500
- meson install -C build/
artifacts:
paths:
- build/test-results
when: on_failure | 1 | 0.03125 | 1 | 0 |
e6c9968070a2c7ed7b271dc583414e0cc0a47d0d | _includes/_related.html | _includes/_related.html | {% assign related_posts = site.related_posts | where:"lang", page.lang | where:"type", 'posts' %}
{% if related_posts.size > 0 %}
<div class="related-articles">
{% assign translations = site.data.translations[page.lang] %}
{% assign navigation = site.data.navigation[page.lang] %}
<h4>{{ translations.related }} <small class="pull-right">(<a href="{{ site.url }}/{{ site.data.navigation[1].blog }}">{{ translations.viewallposts }}</a>)</small></h4>
<ul>
{% for post in related_posts limit:3 %}
<li><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %} | {% assign related_posts = site.related_posts | where:"lang", page.lang | where:"type", 'posts' %}
{% if related_posts.size > 0 %}
<div class="related-articles">
{% assign translations = site.data.translations[page.lang] %}
{% assign navigation = site.data.navigation[page.lang] %}
<h4>{{ translations.related }} <small class="pull-right">(<a href="{{ navigation.blog.url }}">{{ translations.viewallposts }}</a>)</small></h4>
<ul>
{% for post in related_posts limit:3 %}
<li><a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %} | Fix view all link on blog posts. | Fix view all link on blog posts.
| HTML | mit | btcdrak/bitcoincore.org,btcdrak/bitcoincore.org,btcdrak/bitcoincore.org,bitcoin-core/bitcoincore.org,bitcoin-core/bitcoincore.org,bitcoin-core/bitcoincore.org,bitcoin-core/bitcoincore.org,bitcoin-core/bitcoincore.org,bitcoin-core/bitcoincore.org | html | ## Code Before:
{% assign related_posts = site.related_posts | where:"lang", page.lang | where:"type", 'posts' %}
{% if related_posts.size > 0 %}
<div class="related-articles">
{% assign translations = site.data.translations[page.lang] %}
{% assign navigation = site.data.navigation[page.lang] %}
<h4>{{ translations.related }} <small class="pull-right">(<a href="{{ site.url }}/{{ site.data.navigation[1].blog }}">{{ translations.viewallposts }}</a>)</small></h4>
<ul>
{% for post in related_posts limit:3 %}
<li><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %}
## Instruction:
Fix view all link on blog posts.
## Code After:
{% assign related_posts = site.related_posts | where:"lang", page.lang | where:"type", 'posts' %}
{% if related_posts.size > 0 %}
<div class="related-articles">
{% assign translations = site.data.translations[page.lang] %}
{% assign navigation = site.data.navigation[page.lang] %}
<h4>{{ translations.related }} <small class="pull-right">(<a href="{{ navigation.blog.url }}">{{ translations.viewallposts }}</a>)</small></h4>
<ul>
{% for post in related_posts limit:3 %}
<li><a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %} | {% assign related_posts = site.related_posts | where:"lang", page.lang | where:"type", 'posts' %}
{% if related_posts.size > 0 %}
<div class="related-articles">
{% assign translations = site.data.translations[page.lang] %}
{% assign navigation = site.data.navigation[page.lang] %}
- <h4>{{ translations.related }} <small class="pull-right">(<a href="{{ site.url }}/{{ site.data.navigation[1].blog }}">{{ translations.viewallposts }}</a>)</small></h4>
? ------------------------- ---
+ <h4>{{ translations.related }} <small class="pull-right">(<a href="{{ navigation.blog.url }}">{{ translations.viewallposts }}</a>)</small></h4>
? ++++
<ul>
{% for post in related_posts limit:3 %}
- <li><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
? --------------
+ <li><a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %} | 4 | 0.285714 | 2 | 2 |
ce395c437bb5e2fb3495648d6675318f43cfa938 | test/common-declarations-test.js | test/common-declarations-test.js |
import test from 'ava'
import jsdom from 'jsdom-global'
import cxs from '../src'
jsdom('<html></html>')
test.beforeEach(t => {
cxs.clearCache()
t.context.style = {
display: 'block',
textAlign: 'center',
fontSize: 48,
':hover': {
textDecoration: 'none'
},
'h1': {
display: 'inline-block'
},
'@media screen': {
display: 'table'
}
}
t.context.cx = cxs(t.context.style)
})
test('extracts common declarations', t => {
t.plan(2)
const rules = cxs.rules
t.regex(rules[0].css, /^\.cxs\-display\-block/)
t.regex(rules[1].css, /^\.cxs\-text-align-center/)
})
test('does not extract common declarations from nested rules', t => {
t.plan(2)
t.false(/inline\-block/.test(t.context.cx))
t.false(/table/.test(t.context.cx))
})
test('extracted declarations are included in className', t => {
t.is(t.context.cx.split(' ').length, 3)
})
|
import test from 'ava'
import jsdom from 'jsdom-global'
import cxs from '../src'
jsdom('<html></html>')
test.beforeEach(t => {
cxs.clearCache()
t.context.style = {
display: 'block',
textAlign: 'center',
fontSize: 48,
':hover': {
textDecoration: 'none'
},
'h1': {
display: 'inline-block'
},
'@media screen': {
display: 'table'
},
'@keyframes hello': {
from: {
display: 'block'
},
'50%': {
display: 'table'
},
to: {
display: 'inline-block'
}
}
}
t.context.cx = cxs(t.context.style)
})
test('extracts common declarations', t => {
t.plan(2)
const rules = cxs.rules
t.regex(rules[0].css, /^\.cxs\-display\-block/)
t.regex(rules[1].css, /^\.cxs\-text-align-center/)
})
test('does not extract common declarations from nested rules', t => {
t.plan(3)
t.false(/text\-decoration\-none/.test(t.context.cx))
t.false(/inline\-block/.test(t.context.cx))
t.false(/table/.test(t.context.cx))
})
test('extracted declarations are included in className', t => {
t.is(t.context.cx.split(' ').length, 3)
})
| Add more robust test case | Add more robust test case
| JavaScript | mit | jxnblk/cxs | javascript | ## Code Before:
import test from 'ava'
import jsdom from 'jsdom-global'
import cxs from '../src'
jsdom('<html></html>')
test.beforeEach(t => {
cxs.clearCache()
t.context.style = {
display: 'block',
textAlign: 'center',
fontSize: 48,
':hover': {
textDecoration: 'none'
},
'h1': {
display: 'inline-block'
},
'@media screen': {
display: 'table'
}
}
t.context.cx = cxs(t.context.style)
})
test('extracts common declarations', t => {
t.plan(2)
const rules = cxs.rules
t.regex(rules[0].css, /^\.cxs\-display\-block/)
t.regex(rules[1].css, /^\.cxs\-text-align-center/)
})
test('does not extract common declarations from nested rules', t => {
t.plan(2)
t.false(/inline\-block/.test(t.context.cx))
t.false(/table/.test(t.context.cx))
})
test('extracted declarations are included in className', t => {
t.is(t.context.cx.split(' ').length, 3)
})
## Instruction:
Add more robust test case
## Code After:
import test from 'ava'
import jsdom from 'jsdom-global'
import cxs from '../src'
jsdom('<html></html>')
test.beforeEach(t => {
cxs.clearCache()
t.context.style = {
display: 'block',
textAlign: 'center',
fontSize: 48,
':hover': {
textDecoration: 'none'
},
'h1': {
display: 'inline-block'
},
'@media screen': {
display: 'table'
},
'@keyframes hello': {
from: {
display: 'block'
},
'50%': {
display: 'table'
},
to: {
display: 'inline-block'
}
}
}
t.context.cx = cxs(t.context.style)
})
test('extracts common declarations', t => {
t.plan(2)
const rules = cxs.rules
t.regex(rules[0].css, /^\.cxs\-display\-block/)
t.regex(rules[1].css, /^\.cxs\-text-align-center/)
})
test('does not extract common declarations from nested rules', t => {
t.plan(3)
t.false(/text\-decoration\-none/.test(t.context.cx))
t.false(/inline\-block/.test(t.context.cx))
t.false(/table/.test(t.context.cx))
})
test('extracted declarations are included in className', t => {
t.is(t.context.cx.split(' ').length, 3)
})
|
import test from 'ava'
import jsdom from 'jsdom-global'
import cxs from '../src'
jsdom('<html></html>')
test.beforeEach(t => {
cxs.clearCache()
t.context.style = {
display: 'block',
textAlign: 'center',
fontSize: 48,
':hover': {
textDecoration: 'none'
},
'h1': {
display: 'inline-block'
},
'@media screen': {
display: 'table'
+ },
+ '@keyframes hello': {
+ from: {
+ display: 'block'
+ },
+ '50%': {
+ display: 'table'
+ },
+ to: {
+ display: 'inline-block'
+ }
}
}
t.context.cx = cxs(t.context.style)
})
test('extracts common declarations', t => {
t.plan(2)
const rules = cxs.rules
t.regex(rules[0].css, /^\.cxs\-display\-block/)
t.regex(rules[1].css, /^\.cxs\-text-align-center/)
})
test('does not extract common declarations from nested rules', t => {
- t.plan(2)
? ^
+ t.plan(3)
? ^
+ t.false(/text\-decoration\-none/.test(t.context.cx))
t.false(/inline\-block/.test(t.context.cx))
t.false(/table/.test(t.context.cx))
})
test('extracted declarations are included in className', t => {
t.is(t.context.cx.split(' ').length, 3)
}) | 14 | 0.304348 | 13 | 1 |
b24aca6da2513aff7e07ce97715a36eb8e9eff2c | var/spack/packages/ravel/package.py | var/spack/packages/ravel/package.py | from spack import *
class Ravel(Package):
"""Ravel is a parallel communication trace visualization tool that
orders events according to logical time."""
homepage = "https://github.com/scalability-llnl/ravel"
version('1.0', git="ssh://git@cz-stash.llnl.gov:7999/pave/ravel.git",
branch='features/otf2export')
depends_on('cmake@2.8.9:')
depends_on('muster@1.0.1:')
depends_on('otf')
depends_on('otf2')
depends_on('qt@5:')
def install(self, spec, prefix):
cmake(*std_cmake_args)
make()
make("install")
| from spack import *
class Ravel(Package):
"""Ravel is a parallel communication trace visualization tool that
orders events according to logical time."""
homepage = "https://github.com/scalability-llnl/ravel"
version('1.0.0', git="https://github.com/scalability-llnl/ravel.git",
branch='master')
depends_on('cmake@2.8.9:')
depends_on('muster@1.0.1:')
depends_on('otf')
depends_on('otf2')
depends_on('qt@5:')
def install(self, spec, prefix):
cmake('-Wno-dev', *std_cmake_args)
make()
make("install")
| Add -Wno-dev to avoid cmake policy warnings. | Add -Wno-dev to avoid cmake policy warnings.
| Python | lgpl-2.1 | lgarren/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,tmerrick1/spack,mfherbst/spack,EmreAtes/spack,TheTimmy/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,krafczyk/spack,iulian787/spack,TheTimmy/spack,krafczyk/spack,EmreAtes/spack,EmreAtes/spack,EmreAtes/spack,TheTimmy/spack,iulian787/spack,matthiasdiener/spack,skosukhin/spack,lgarren/spack,lgarren/spack,tmerrick1/spack,LLNL/spack,skosukhin/spack,mfherbst/spack,TheTimmy/spack,tmerrick1/spack,TheTimmy/spack,iulian787/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack,lgarren/spack,tmerrick1/spack,iulian787/spack,lgarren/spack,mfherbst/spack,LLNL/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,skosukhin/spack,matthiasdiener/spack,skosukhin/spack,matthiasdiener/spack,skosukhin/spack | python | ## Code Before:
from spack import *
class Ravel(Package):
"""Ravel is a parallel communication trace visualization tool that
orders events according to logical time."""
homepage = "https://github.com/scalability-llnl/ravel"
version('1.0', git="ssh://git@cz-stash.llnl.gov:7999/pave/ravel.git",
branch='features/otf2export')
depends_on('cmake@2.8.9:')
depends_on('muster@1.0.1:')
depends_on('otf')
depends_on('otf2')
depends_on('qt@5:')
def install(self, spec, prefix):
cmake(*std_cmake_args)
make()
make("install")
## Instruction:
Add -Wno-dev to avoid cmake policy warnings.
## Code After:
from spack import *
class Ravel(Package):
"""Ravel is a parallel communication trace visualization tool that
orders events according to logical time."""
homepage = "https://github.com/scalability-llnl/ravel"
version('1.0.0', git="https://github.com/scalability-llnl/ravel.git",
branch='master')
depends_on('cmake@2.8.9:')
depends_on('muster@1.0.1:')
depends_on('otf')
depends_on('otf2')
depends_on('qt@5:')
def install(self, spec, prefix):
cmake('-Wno-dev', *std_cmake_args)
make()
make("install")
| from spack import *
class Ravel(Package):
"""Ravel is a parallel communication trace visualization tool that
orders events according to logical time."""
homepage = "https://github.com/scalability-llnl/ravel"
+ version('1.0.0', git="https://github.com/scalability-llnl/ravel.git",
+ branch='master')
-
- version('1.0', git="ssh://git@cz-stash.llnl.gov:7999/pave/ravel.git",
- branch='features/otf2export')
depends_on('cmake@2.8.9:')
depends_on('muster@1.0.1:')
depends_on('otf')
depends_on('otf2')
depends_on('qt@5:')
def install(self, spec, prefix):
- cmake(*std_cmake_args)
+ cmake('-Wno-dev', *std_cmake_args)
? ++++++++++++
make()
make("install") | 7 | 0.304348 | 3 | 4 |
1ec22c41df1680e9ba92a53618c2fb1f8bcfa7d6 | README.md | README.md | Project repo for the WWC PDX website
[this is a work in progress - check back soon for updated versions]
### WEBSITE PROPOSED REDESIGN
[Current desktop mockup prototype](https://xd.adobe.com/view/e20a88af-fcee-441d-a2b5-2493744d2247/)
[Current mobile mockup prototype](https://xd.adobe.com/view/16d03437-a576-4108-969d-38c4a99804e7/)
### OLD WEBPAGE

#### ATTRIBUTIONS
* [patternlab-node](https://github.com/pattern-lab/patternlab-node)
* [starterkit-mustache-demo](https://github.com/pattern-lab/starterkit-mustache-demo) | Project repo for the WWC PDX website (Temporary link: https://wwcodeportland.github.io/wwc-website/)
[this is a work in progress - check back soon for updated versions]
### WEBSITE PROPOSED REDESIGN
[Current desktop mockup prototype](https://xd.adobe.com/view/e20a88af-fcee-441d-a2b5-2493744d2247/)
[Current mobile mockup prototype](https://xd.adobe.com/view/16d03437-a576-4108-969d-38c4a99804e7/)
### OLD WEBPAGE

#### ATTRIBUTIONS
* [patternlab-node](https://github.com/pattern-lab/patternlab-node)
* [starterkit-mustache-demo](https://github.com/pattern-lab/starterkit-mustache-demo)
| Add temporary development link to readme.md | Add temporary development link to readme.md | Markdown | mit | scholachoi/wwc-website,scholachoi/wwc-website,scholachoi/wwc-website | markdown | ## Code Before:
Project repo for the WWC PDX website
[this is a work in progress - check back soon for updated versions]
### WEBSITE PROPOSED REDESIGN
[Current desktop mockup prototype](https://xd.adobe.com/view/e20a88af-fcee-441d-a2b5-2493744d2247/)
[Current mobile mockup prototype](https://xd.adobe.com/view/16d03437-a576-4108-969d-38c4a99804e7/)
### OLD WEBPAGE

#### ATTRIBUTIONS
* [patternlab-node](https://github.com/pattern-lab/patternlab-node)
* [starterkit-mustache-demo](https://github.com/pattern-lab/starterkit-mustache-demo)
## Instruction:
Add temporary development link to readme.md
## Code After:
Project repo for the WWC PDX website (Temporary link: https://wwcodeportland.github.io/wwc-website/)
[this is a work in progress - check back soon for updated versions]
### WEBSITE PROPOSED REDESIGN
[Current desktop mockup prototype](https://xd.adobe.com/view/e20a88af-fcee-441d-a2b5-2493744d2247/)
[Current mobile mockup prototype](https://xd.adobe.com/view/16d03437-a576-4108-969d-38c4a99804e7/)
### OLD WEBPAGE

#### ATTRIBUTIONS
* [patternlab-node](https://github.com/pattern-lab/patternlab-node)
* [starterkit-mustache-demo](https://github.com/pattern-lab/starterkit-mustache-demo)
| - Project repo for the WWC PDX website
+ Project repo for the WWC PDX website (Temporary link: https://wwcodeportland.github.io/wwc-website/)
[this is a work in progress - check back soon for updated versions]
### WEBSITE PROPOSED REDESIGN
[Current desktop mockup prototype](https://xd.adobe.com/view/e20a88af-fcee-441d-a2b5-2493744d2247/)
[Current mobile mockup prototype](https://xd.adobe.com/view/16d03437-a576-4108-969d-38c4a99804e7/)
### OLD WEBPAGE

#### ATTRIBUTIONS
* [patternlab-node](https://github.com/pattern-lab/patternlab-node)
* [starterkit-mustache-demo](https://github.com/pattern-lab/starterkit-mustache-demo) | 2 | 0.133333 | 1 | 1 |
e8f89a2a6587ee9d4e1b4e4206648e65ee41873d | test/python/CMakeLists.txt | test/python/CMakeLists.txt | include(UsePythonTest)
set(python_tests
element
molecule
rings
smarts
smiles
smirks
)
foreach(pytest ${python_tests})
add_python_test(pytest_${pytest} ${pytest}.py)
set_tests_properties(pytest_${pytest} PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
endforeach()
| include(UsePythonTest)
set(python_tests
element
molecule
rings
smarts
smiles
smirks
)
foreach(pytest ${python_tests})
set_source_files_properties(test${pybindtest}.py PROPERTIES
PYTHONPATH "${CMAKE_BINARY_DIR}/bindings/python"
HEDATADIR "${CMAKE_SOURCE_DIR}/data")
add_python_test(pytest_${pytest} ${pytest}.py)
set_tests_properties(pytest_${pytest} PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
endforeach()
| Set PYTHON path for tests | Set PYTHON path for tests
| Text | bsd-3-clause | timvdm/Helium,timvdm/Helium,ahasgw/Helium,timvdm/Helium,timvdm/Helium,ahasgw/Helium,ahasgw/Helium | text | ## Code Before:
include(UsePythonTest)
set(python_tests
element
molecule
rings
smarts
smiles
smirks
)
foreach(pytest ${python_tests})
add_python_test(pytest_${pytest} ${pytest}.py)
set_tests_properties(pytest_${pytest} PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
endforeach()
## Instruction:
Set PYTHON path for tests
## Code After:
include(UsePythonTest)
set(python_tests
element
molecule
rings
smarts
smiles
smirks
)
foreach(pytest ${python_tests})
set_source_files_properties(test${pybindtest}.py PROPERTIES
PYTHONPATH "${CMAKE_BINARY_DIR}/bindings/python"
HEDATADIR "${CMAKE_SOURCE_DIR}/data")
add_python_test(pytest_${pytest} ${pytest}.py)
set_tests_properties(pytest_${pytest} PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
endforeach()
| include(UsePythonTest)
set(python_tests
element
molecule
rings
smarts
smiles
smirks
)
foreach(pytest ${python_tests})
+ set_source_files_properties(test${pybindtest}.py PROPERTIES
+ PYTHONPATH "${CMAKE_BINARY_DIR}/bindings/python"
+ HEDATADIR "${CMAKE_SOURCE_DIR}/data")
add_python_test(pytest_${pytest} ${pytest}.py)
set_tests_properties(pytest_${pytest} PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
endforeach() | 3 | 0.1875 | 3 | 0 |
d2076e0a51297202bb088c27c9597d8ed7edaca6 | requirements/testing.txt | requirements/testing.txt | coverage==4.0.3
factory_boy==2.6.1
six==1.10.0
python-dateutil==2.5.2
mock==1.3.0
| coverage==4.0.3
factory_boy==2.6.1
mock==1.3.0
| Remove duplicate entries from requirement files | Remove duplicate entries from requirement files
| Text | mit | ajaniv/django-core-utils | text | ## Code Before:
coverage==4.0.3
factory_boy==2.6.1
six==1.10.0
python-dateutil==2.5.2
mock==1.3.0
## Instruction:
Remove duplicate entries from requirement files
## Code After:
coverage==4.0.3
factory_boy==2.6.1
mock==1.3.0
| coverage==4.0.3
factory_boy==2.6.1
- six==1.10.0
- python-dateutil==2.5.2
mock==1.3.0
| 2 | 0.333333 | 0 | 2 |
a4eb2a8bb6bcf06de82a0074b619174f5ec23bc7 | src/main.sh | src/main.sh | #
#Call soureces #
#
#######################################################
source message.sh
source program.sh
source helpers.sh
#######################################################
#
#Run ==> main() #
#
#######################################################
make_directory "log" "../"
update_repositories
install_all_programs
| #
#Call soureces #
#
#######################################################
source message.sh
source program.sh
source helpers.sh
#######################################################
#
#Run ==> main() #
#
#######################################################
make_directory "log" "../"
update_repositories
install_all_programs
| Add comment and clean code | Add comment and clean code
| Shell | mit | nimaebrazi/debian-base-packeage-installer | shell | ## Code Before:
#
#Call soureces #
#
#######################################################
source message.sh
source program.sh
source helpers.sh
#######################################################
#
#Run ==> main() #
#
#######################################################
make_directory "log" "../"
update_repositories
install_all_programs
## Instruction:
Add comment and clean code
## Code After:
#
#Call soureces #
#
#######################################################
source message.sh
source program.sh
source helpers.sh
#######################################################
#
#Run ==> main() #
#
#######################################################
make_directory "log" "../"
update_repositories
install_all_programs
| #
- #Call soureces #
? ^^ --------
+ #Call soureces #
? ^^^^^^^^^^^^^^^^
#
#######################################################
source message.sh
source program.sh
source helpers.sh
#######################################################
#
- #Run ==> main() #
+ #Run ==> main() #
#
#######################################################
make_directory "log" "../"
update_repositories
install_all_programs | 4 | 0.190476 | 2 | 2 |
3947f2a84cc2af009c5018157b8b84e0ddfcfd94 | app/components/Markdown/extra-keys.js | app/components/Markdown/extra-keys.js | import { saveAs } from 'file-saver';
export const Tags = {
STRONG: '**',
ITALIC: '_',
};
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}
export function addOrRemoveTag(tag, selection) {
const regex = new RegExp(`^${escapeRegExp(tag)}([^]+?)${escapeRegExp(tag)}$`);
const matches = selection.match(regex, 'gi');
if (null !== matches) {
return matches[1];
}
return `${tag}${selection}${tag}`;
}
const extraKeys = {
'Cmd-Z': (cm) => {
cm.undo();
},
'Cmd-B': (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
},
'Cmd-I': (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
},
'Cmd-S': (cm) => {
saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
},
};
export default extraKeys;
| import { saveAs } from 'file-saver';
import codemirror from 'codemirror';
import isEqual from 'lodash.isequal';
const mac = isEqual(codemirror.keyMap.default, codemirror.keyMap.macDefault);
const pre = mac ? 'Cmd-' : 'Ctrl-';
export const Tags = {
STRONG: '**',
ITALIC: '_',
};
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}
export function addOrRemoveTag(tag, selection) {
const regex = new RegExp(`^${escapeRegExp(tag)}([^]+?)${escapeRegExp(tag)}$`);
const matches = selection.match(regex, 'gi');
if (null !== matches) {
return matches[1];
}
return `${tag}${selection}${tag}`;
}
const extraKeys = {};
extraKeys[`${pre}Z`] = (cm) => {
cm.undo();
};
extraKeys[`${pre}B`] = (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
};
extraKeys[`${pre}I`] = (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
};
extraKeys[`${pre}S`] = (cm) => {
saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
};
export default extraKeys;
| Add dynamic prefix for windows/mac shortcuts | Add dynamic prefix for windows/mac shortcuts
| JavaScript | mit | PaulDebus/monod,TailorDev/monod,PaulDebus/monod,PaulDebus/monod,TailorDev/monod,TailorDev/monod | javascript | ## Code Before:
import { saveAs } from 'file-saver';
export const Tags = {
STRONG: '**',
ITALIC: '_',
};
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}
export function addOrRemoveTag(tag, selection) {
const regex = new RegExp(`^${escapeRegExp(tag)}([^]+?)${escapeRegExp(tag)}$`);
const matches = selection.match(regex, 'gi');
if (null !== matches) {
return matches[1];
}
return `${tag}${selection}${tag}`;
}
const extraKeys = {
'Cmd-Z': (cm) => {
cm.undo();
},
'Cmd-B': (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
},
'Cmd-I': (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
},
'Cmd-S': (cm) => {
saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
},
};
export default extraKeys;
## Instruction:
Add dynamic prefix for windows/mac shortcuts
## Code After:
import { saveAs } from 'file-saver';
import codemirror from 'codemirror';
import isEqual from 'lodash.isequal';
const mac = isEqual(codemirror.keyMap.default, codemirror.keyMap.macDefault);
const pre = mac ? 'Cmd-' : 'Ctrl-';
export const Tags = {
STRONG: '**',
ITALIC: '_',
};
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}
export function addOrRemoveTag(tag, selection) {
const regex = new RegExp(`^${escapeRegExp(tag)}([^]+?)${escapeRegExp(tag)}$`);
const matches = selection.match(regex, 'gi');
if (null !== matches) {
return matches[1];
}
return `${tag}${selection}${tag}`;
}
const extraKeys = {};
extraKeys[`${pre}Z`] = (cm) => {
cm.undo();
};
extraKeys[`${pre}B`] = (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
};
extraKeys[`${pre}I`] = (cm) => {
cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
};
extraKeys[`${pre}S`] = (cm) => {
saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
};
export default extraKeys;
| import { saveAs } from 'file-saver';
+ import codemirror from 'codemirror';
+ import isEqual from 'lodash.isequal';
+ const mac = isEqual(codemirror.keyMap.default, codemirror.keyMap.macDefault);
+ const pre = mac ? 'Cmd-' : 'Ctrl-';
export const Tags = {
STRONG: '**',
ITALIC: '_',
};
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}
export function addOrRemoveTag(tag, selection) {
const regex = new RegExp(`^${escapeRegExp(tag)}([^]+?)${escapeRegExp(tag)}$`);
const matches = selection.match(regex, 'gi');
if (null !== matches) {
return matches[1];
}
return `${tag}${selection}${tag}`;
}
- const extraKeys = {
+ const extraKeys = {};
? ++
- 'Cmd-Z': (cm) => {
+
+ extraKeys[`${pre}Z`] = (cm) => {
- cm.undo();
? --
+ cm.undo();
- },
- 'Cmd-B': (cm) => {
+ };
+
+ extraKeys[`${pre}B`] = (cm) => {
- cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
? --
+ cm.replaceSelection(addOrRemoveTag(Tags.STRONG, cm.getSelection()), 'around');
- },
- 'Cmd-I': (cm) => {
+ };
+
+ extraKeys[`${pre}I`] = (cm) => {
- cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
? --
+ cm.replaceSelection(addOrRemoveTag(Tags.ITALIC, cm.getSelection()), 'around');
- },
- 'Cmd-S': (cm) => {
+ };
+
+ extraKeys[`${pre}S`] = (cm) => {
- saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
? --
+ saveAs(new Blob([cm.getValue()], { type: 'text/plain' }), 'monod.md');
- },
};
export default extraKeys; | 33 | 0.846154 | 20 | 13 |
c722958694b0098345995b5c59a7aeeac7ec6262 | tests/integration/connect-test.js | tests/integration/connect-test.js | import Socket from 'src/socket'
import {LongPoll} from 'src/transports'
import {pause, resume} from 'tests/utils'
QUnit.test('can connect', function(assert){
assert.expect(1)
let socket = new Socket("ws://localhost:4000/socket", {transport: LongPoll})
socket.connect()
let channel = socket.channel("rooms:lobby", {})
// pause QUnit so that we can wait for an asynchronous response
pause(assert)
channel
.join()
.receive("ok", resp => {
assert.ok(true, "A join response was received")
// a response was received, continue with tests
resume(assert)
})
});
| import Socket from 'src/socket'
import {WebSocket, LongPoll} from 'src/transports'
import {pause, resume} from 'tests/utils'
[{name: 'WebSocket', klass: WebSocket}, {name: 'LongPoll', klass: LongPoll}].forEach(item => {
const {name, klass} = item
QUnit.test(`${name} can connect`, function(assert){
assert.expect(2)
let socket = new Socket("ws://localhost:4000/socket", {transport: klass})
socket.connect()
let channel = socket.channel("rooms:lobby", {})
// pause QUnit so that we can wait for an asynchronous response
pause(assert)
channel
.join()
.receive("ok", resp => {
assert.ok(true, "A join response was received")
channel
.push("ping", {lang: "Elixir"})
.receive("ok", resp => {
assert.ok(true, "Message echoed")
resume(assert)
})
})
});
})
| Test basic connection and message sending for both transports | Test basic connection and message sending for both transports
| JavaScript | mit | jerel/phoenix_js | javascript | ## Code Before:
import Socket from 'src/socket'
import {LongPoll} from 'src/transports'
import {pause, resume} from 'tests/utils'
QUnit.test('can connect', function(assert){
assert.expect(1)
let socket = new Socket("ws://localhost:4000/socket", {transport: LongPoll})
socket.connect()
let channel = socket.channel("rooms:lobby", {})
// pause QUnit so that we can wait for an asynchronous response
pause(assert)
channel
.join()
.receive("ok", resp => {
assert.ok(true, "A join response was received")
// a response was received, continue with tests
resume(assert)
})
});
## Instruction:
Test basic connection and message sending for both transports
## Code After:
import Socket from 'src/socket'
import {WebSocket, LongPoll} from 'src/transports'
import {pause, resume} from 'tests/utils'
[{name: 'WebSocket', klass: WebSocket}, {name: 'LongPoll', klass: LongPoll}].forEach(item => {
const {name, klass} = item
QUnit.test(`${name} can connect`, function(assert){
assert.expect(2)
let socket = new Socket("ws://localhost:4000/socket", {transport: klass})
socket.connect()
let channel = socket.channel("rooms:lobby", {})
// pause QUnit so that we can wait for an asynchronous response
pause(assert)
channel
.join()
.receive("ok", resp => {
assert.ok(true, "A join response was received")
channel
.push("ping", {lang: "Elixir"})
.receive("ok", resp => {
assert.ok(true, "Message echoed")
resume(assert)
})
})
});
})
| import Socket from 'src/socket'
- import {LongPoll} from 'src/transports'
+ import {WebSocket, LongPoll} from 'src/transports'
? +++++++++++
import {pause, resume} from 'tests/utils'
+ [{name: 'WebSocket', klass: WebSocket}, {name: 'LongPoll', klass: LongPoll}].forEach(item => {
- QUnit.test('can connect', function(assert){
- assert.expect(1)
+ const {name, klass} = item
- let socket = new Socket("ws://localhost:4000/socket", {transport: LongPoll})
- socket.connect()
- let channel = socket.channel("rooms:lobby", {})
+ QUnit.test(`${name} can connect`, function(assert){
+ assert.expect(2)
- // pause QUnit so that we can wait for an asynchronous response
- pause(assert)
+ let socket = new Socket("ws://localhost:4000/socket", {transport: klass})
+ socket.connect()
+ let channel = socket.channel("rooms:lobby", {})
- channel
- .join()
- .receive("ok", resp => {
- assert.ok(true, "A join response was received")
- // a response was received, continue with tests
- resume(assert)
- })
- });
+ // pause QUnit so that we can wait for an asynchronous response
+ pause(assert)
+
+ channel
+ .join()
+ .receive("ok", resp => {
+ assert.ok(true, "A join response was received")
+
+ channel
+ .push("ping", {lang: "Elixir"})
+ .receive("ok", resp => {
+ assert.ok(true, "Message echoed")
+ resume(assert)
+ })
+
+ })
+
+ });
+
+ })
+ | 45 | 1.875 | 29 | 16 |
f1273bfc2221ede04c093f0a2279aa2e027902a3 | ObjectiveSugar.podspec | ObjectiveSugar.podspec | Pod::Spec.new do |s|
s.name = 'ObjectiveSugar'
s.version = '1.0.0'
s.summary = 'Objective C additions for humans. Write ObjC _like a boss_.'
s.description = '-map, -each, -select, unless(true){}, -includes, -upto, -downto, and many more!'
s.homepage = 'https://github.com/mneorr/ObjectiveSugar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = [{ 'Marin Usalj' => "mneorr@gmail.com" }, { 'Neil Cowburn' => 'git@neilcowburn.com' }]
s.source = { :git => 'https://github.com/mneorr/ObjectiveSugar.git', :tag => s.version.to_s }
s.ios.deployment_target = '4.0'
s.osx.deployment_target = '10.6'
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end
| Pod::Spec.new do |s|
s.name = 'ObjectiveSugar'
s.version = '1.0.0'
s.summary = 'Objective C additions for humans. Write ObjC _like a boss_.'
s.description = '-map, -each, -select, unless(true){}, -includes, -upto, -downto, and many more!'
s.homepage = 'https://github.com/mneorr/ObjectiveSugar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = [{ 'Marin Usalj' => "mneorr@gmail.com" }, { 'Neil Cowburn' => 'git@neilcowburn.com' }]
s.source = { :git => 'https://github.com/mneorr/ObjectiveSugar.git', :tag => s.version.to_s }
s.ios.deployment_target = '4.0'
s.osx.deployment_target = '10.6'
s.requires_arc = true
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end
| Add requires_arc flag to podspec. | Add requires_arc flag to podspec.
| Ruby | mit | oarrabi/ObjectiveSugar,gank0326/ObjectiveSugar,orta/ObjectiveSugar,ManagerOrganization/ObjectiveSugar,supermarin/ObjectiveSugar,rizvve/ObjectiveSugar,target/ObjectiveSugar,Anish-kumar-dev/ObjectiveSugar | ruby | ## Code Before:
Pod::Spec.new do |s|
s.name = 'ObjectiveSugar'
s.version = '1.0.0'
s.summary = 'Objective C additions for humans. Write ObjC _like a boss_.'
s.description = '-map, -each, -select, unless(true){}, -includes, -upto, -downto, and many more!'
s.homepage = 'https://github.com/mneorr/ObjectiveSugar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = [{ 'Marin Usalj' => "mneorr@gmail.com" }, { 'Neil Cowburn' => 'git@neilcowburn.com' }]
s.source = { :git => 'https://github.com/mneorr/ObjectiveSugar.git', :tag => s.version.to_s }
s.ios.deployment_target = '4.0'
s.osx.deployment_target = '10.6'
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end
## Instruction:
Add requires_arc flag to podspec.
## Code After:
Pod::Spec.new do |s|
s.name = 'ObjectiveSugar'
s.version = '1.0.0'
s.summary = 'Objective C additions for humans. Write ObjC _like a boss_.'
s.description = '-map, -each, -select, unless(true){}, -includes, -upto, -downto, and many more!'
s.homepage = 'https://github.com/mneorr/ObjectiveSugar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = [{ 'Marin Usalj' => "mneorr@gmail.com" }, { 'Neil Cowburn' => 'git@neilcowburn.com' }]
s.source = { :git => 'https://github.com/mneorr/ObjectiveSugar.git', :tag => s.version.to_s }
s.ios.deployment_target = '4.0'
s.osx.deployment_target = '10.6'
s.requires_arc = true
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end
| Pod::Spec.new do |s|
s.name = 'ObjectiveSugar'
s.version = '1.0.0'
s.summary = 'Objective C additions for humans. Write ObjC _like a boss_.'
s.description = '-map, -each, -select, unless(true){}, -includes, -upto, -downto, and many more!'
s.homepage = 'https://github.com/mneorr/ObjectiveSugar'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = [{ 'Marin Usalj' => "mneorr@gmail.com" }, { 'Neil Cowburn' => 'git@neilcowburn.com' }]
s.source = { :git => 'https://github.com/mneorr/ObjectiveSugar.git', :tag => s.version.to_s }
s.ios.deployment_target = '4.0'
s.osx.deployment_target = '10.6'
+ s.requires_arc = true
+
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end | 2 | 0.133333 | 2 | 0 |
b91293f507ff2e1d7a87ae575664c6359a10ba6f | lib/certmeister/version.rb | lib/certmeister/version.rb | require 'semver'
module Certmeister
VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
end
| begin
require 'semver'
module Certmeister
VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
end
rescue LoadError
$stderr.puts "warning: ignoring missing semver gem for initial bundle"
$stderr.puts "warning: please run bundle again to fix certmeister version number"
module Certmeister
VERSION = '0'
end
end
| Work around chick-egg problem with semver2 | Work around chick-egg problem with semver2
Our gemspec uses semver2 to get our version number. Bundler uses our
gemspec to get our version unumber. We use bundler to install semver2.
| Ruby | mit | sheldonh/certmeister | ruby | ## Code Before:
require 'semver'
module Certmeister
VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
end
## Instruction:
Work around chick-egg problem with semver2
Our gemspec uses semver2 to get our version number. Bundler uses our
gemspec to get our version unumber. We use bundler to install semver2.
## Code After:
begin
require 'semver'
module Certmeister
VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
end
rescue LoadError
$stderr.puts "warning: ignoring missing semver gem for initial bundle"
$stderr.puts "warning: please run bundle again to fix certmeister version number"
module Certmeister
VERSION = '0'
end
end
| - require 'semver'
+ begin
- module Certmeister
+ require 'semver'
+ module Certmeister
+
- VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
+ VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
? ++
-
+
+ end
+
+ rescue LoadError
+
+ $stderr.puts "warning: ignoring missing semver gem for initial bundle"
+ $stderr.puts "warning: please run bundle again to fix certmeister version number"
+
+ module Certmeister
+
+ VERSION = '0'
+
+ end
+
end
+
+ | 25 | 3.571429 | 21 | 4 |
baebdb786d9a0f019a6a5d0cefc447ae90e5f57b | ci-keys.xml | ci-keys.xml | <?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="crashlytics_api_key"></string>
<string name="backend_api_key"></string>
<string name="admin_password_hash"></string>
</resources> | <?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="crashlytics_api_key">DUMMY_CRASHLYTICS_KEY</string>
<string name="backend_api_key">DUMMY_BACKEND_KEY</string>
<string name="admin_password_hash">5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8</string>
</resources> | Add values for dummy ci keys | Add values for dummy ci keys
| XML | mit | mnipper/AndroidSurvey,DukeMobileTech/AndroidSurvey,mnipper/AndroidSurvey,mnipper/AndroidSurvey | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="crashlytics_api_key"></string>
<string name="backend_api_key"></string>
<string name="admin_password_hash"></string>
</resources>
## Instruction:
Add values for dummy ci keys
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="crashlytics_api_key">DUMMY_CRASHLYTICS_KEY</string>
<string name="backend_api_key">DUMMY_BACKEND_KEY</string>
<string name="admin_password_hash">5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8</string>
</resources> | <?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
- <string name="crashlytics_api_key"></string>
+ <string name="crashlytics_api_key">DUMMY_CRASHLYTICS_KEY</string>
? +++++++++++++++++++++
- <string name="backend_api_key"></string>
+ <string name="backend_api_key">DUMMY_BACKEND_KEY</string>
? +++++++++++++++++
- <string name="admin_password_hash"></string>
+ <string name="admin_password_hash">5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8</string>
</resources> | 6 | 0.75 | 3 | 3 |
5420d368c064953842023ccc07b531b071ec3514 | src/tests/test_login_page.py | src/tests/test_login_page.py | from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector("li.user.user-dropdown.dropdown")
| from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
from src.lib.constants import selector
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector(selector.LoginPage.BUTTON_LOGIN)
| Modify login page test to use selectors defined in the module constants. | Modify login page test to use selectors defined in the module constants.
| Python | apache-2.0 | edofic/ggrc-core,kr41/ggrc-core,jmakov/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,jmakov/ggrc-core,josthkko/ggrc-core | python | ## Code Before:
from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector("li.user.user-dropdown.dropdown")
## Instruction:
Modify login page test to use selectors defined in the module constants.
## Code After:
from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
from src.lib.constants import selector
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
self.driver.find_element_by_css_selector(selector.LoginPage.BUTTON_LOGIN)
| from src.lib.page.login import LoginPage
from src.lib.base import BaseTest
+ from src.lib.constants import selector
class TestLoginPage(BaseTest):
def test_login_as_admin(self):
login_page = LoginPage(self.driver)
login_page.login()
- self.driver.find_element_by_css_selector("li.user.user-dropdown.dropdown")
+ self.driver.find_element_by_css_selector(selector.LoginPage.BUTTON_LOGIN)
| 3 | 0.25 | 2 | 1 |
e91b7ba133e0d903300e7355e6dfba8fa0ea76ff | requirements.txt | requirements.txt | MySQL-python
numpy
mpipe
wget
SQLAlchemy
Flask
Flask-SQLAlchemy
| coils==1.0.6
Flask==0.10.1
Flask-SQLAlchemy==1.0
gunicorn==19.1.1
mpipe==1.0.7
MySQL-python==1.2.5
numpy==1.8.2
SQLAlchemy==0.9.7
wget==2.2
| Add Gunicorn and coils, and add versions to all packages. | Add Gunicorn and coils, and add versions to all packages.
| Text | mit | vmlaker/wabbit,vmlaker/wabbit,vmlaker/wabbit,vmlaker/wabbit | text | ## Code Before:
MySQL-python
numpy
mpipe
wget
SQLAlchemy
Flask
Flask-SQLAlchemy
## Instruction:
Add Gunicorn and coils, and add versions to all packages.
## Code After:
coils==1.0.6
Flask==0.10.1
Flask-SQLAlchemy==1.0
gunicorn==19.1.1
mpipe==1.0.7
MySQL-python==1.2.5
numpy==1.8.2
SQLAlchemy==0.9.7
wget==2.2
| + coils==1.0.6
+ Flask==0.10.1
- MySQL-python
- numpy
-
- mpipe
- wget
- SQLAlchemy
- Flask
- Flask-SQLAlchemy
+ Flask-SQLAlchemy==1.0
? +++++
+ gunicorn==19.1.1
+ mpipe==1.0.7
+ MySQL-python==1.2.5
+ numpy==1.8.2
+ SQLAlchemy==0.9.7
+ wget==2.2 | 17 | 2.125 | 9 | 8 |
4a1490453d45521f64e5b24cd1af61f61cce6902 | test/site-tests.ts | test/site-tests.ts | require('mocha');
require('chai').should();
import { sites, SiteOptions } from '../';
describe('site', () => {
it('can be retrieved after being created', async () => {
let exists = await sites.exists('TestSite');
if (exists) {
await sites.remove('TestSite');
}
await sites.add({
name: 'TestSite',
protocol: 'http',
host: 'testsiteurl',
port: 12345,
path: 'C:\\inetpub\\wwwroot'
} as SiteOptions);
let site = await sites.get('TestSite');
site.name.should.equal('TestSite');
site.bindings.should.equal('http/*:12345:testsiteurl');
});
});
| require('mocha');
require('chai').should();
import * as uuid from 'uuid';
import { sites, SiteOptions } from '../';
describe('site', () => {
it('can be retrieved after being created', async () => {
let siteName = uuid();
try {
await sites.add({
name: siteName,
protocol: 'http',
host: siteName,
port: 80,
path: 'C:\\inetpub\\wwwroot'
} as SiteOptions);
let site = await sites.get(siteName);
site.name.should.equal(siteName);
site.bindings.should.equal(`http/*:80:${siteName}`);
} finally {
if (await sites.exists(siteName)) {
await sites.remove(siteName);
}
}
});
});
| Make test cleanup after itself | Make test cleanup after itself
| TypeScript | mit | ChristopherHaws/node-iis-manager | typescript | ## Code Before:
require('mocha');
require('chai').should();
import { sites, SiteOptions } from '../';
describe('site', () => {
it('can be retrieved after being created', async () => {
let exists = await sites.exists('TestSite');
if (exists) {
await sites.remove('TestSite');
}
await sites.add({
name: 'TestSite',
protocol: 'http',
host: 'testsiteurl',
port: 12345,
path: 'C:\\inetpub\\wwwroot'
} as SiteOptions);
let site = await sites.get('TestSite');
site.name.should.equal('TestSite');
site.bindings.should.equal('http/*:12345:testsiteurl');
});
});
## Instruction:
Make test cleanup after itself
## Code After:
require('mocha');
require('chai').should();
import * as uuid from 'uuid';
import { sites, SiteOptions } from '../';
describe('site', () => {
it('can be retrieved after being created', async () => {
let siteName = uuid();
try {
await sites.add({
name: siteName,
protocol: 'http',
host: siteName,
port: 80,
path: 'C:\\inetpub\\wwwroot'
} as SiteOptions);
let site = await sites.get(siteName);
site.name.should.equal(siteName);
site.bindings.should.equal(`http/*:80:${siteName}`);
} finally {
if (await sites.exists(siteName)) {
await sites.remove(siteName);
}
}
});
});
| require('mocha');
require('chai').should();
+ import * as uuid from 'uuid';
import { sites, SiteOptions } from '../';
describe('site', () => {
it('can be retrieved after being created', async () => {
- let exists = await sites.exists('TestSite');
- if (exists) {
+ let siteName = uuid();
+
+ try {
+ await sites.add({
+ name: siteName,
+ protocol: 'http',
+ host: siteName,
+ port: 80,
+ path: 'C:\\inetpub\\wwwroot'
+ } as SiteOptions);
+
+ let site = await sites.get(siteName);
+
+ site.name.should.equal(siteName);
+ site.bindings.should.equal(`http/*:80:${siteName}`);
+ } finally {
+ if (await sites.exists(siteName)) {
- await sites.remove('TestSite');
? --- -- ^
+ await sites.remove(siteName);
? + ^^^^
+ }
}
-
- await sites.add({
- name: 'TestSite',
- protocol: 'http',
- host: 'testsiteurl',
- port: 12345,
- path: 'C:\\inetpub\\wwwroot'
- } as SiteOptions);
-
- let site = await sites.get('TestSite');
-
- site.name.should.equal('TestSite');
- site.bindings.should.equal('http/*:12345:testsiteurl');
});
}); | 36 | 1.44 | 20 | 16 |
5ed8792a36f62c95467c0af96d965bc9643b4ad9 | README.md | README.md |
Simple extensions to `Struct` to make it more compatable with `Hash` without the performance penalties of `OpenStruct`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'super_struct'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_struct
## Usage
```ruby
require 'super_struct'
attributes = { name: 'John Doe' }
class Customer < SuperStruct.new(attributes)
def has_attribute?(attribute)
members.include?(attribute.to_sym)
end
end
john_doe = Customer.new(attributes)
=> #<struct Customer name="John Doe">
john_doe.name
=> 'John Doe'
```
## Testing
```ruby
bundle install --path .bundle/bundle
bundle exec rake spec
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/super_struct/fork )
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 a new Pull Request
|
[](https://travis-ci.org/bramswenson/super_struct)
Simple extensions to `Struct` to make it more compatable with `Hash` without the performance penalties of `OpenStruct`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'super_struct'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_struct
## Usage
```ruby
require 'super_struct'
attributes = { name: 'John Doe' }
class Customer < SuperStruct.new(attributes)
def has_attribute?(attribute)
members.include?(attribute.to_sym)
end
end
john_doe = Customer.new(attributes)
=> #<struct Customer name="John Doe">
john_doe.name
=> 'John Doe'
```
## Testing
```ruby
bundle install --path .bundle/bundle
bundle exec rake spec
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/super_struct/fork )
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 a new Pull Request
| Add travis build status badge | Add travis build status badge
| Markdown | mit | bramswenson/super_struct | markdown | ## Code Before:
Simple extensions to `Struct` to make it more compatable with `Hash` without the performance penalties of `OpenStruct`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'super_struct'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_struct
## Usage
```ruby
require 'super_struct'
attributes = { name: 'John Doe' }
class Customer < SuperStruct.new(attributes)
def has_attribute?(attribute)
members.include?(attribute.to_sym)
end
end
john_doe = Customer.new(attributes)
=> #<struct Customer name="John Doe">
john_doe.name
=> 'John Doe'
```
## Testing
```ruby
bundle install --path .bundle/bundle
bundle exec rake spec
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/super_struct/fork )
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 a new Pull Request
## Instruction:
Add travis build status badge
## Code After:
[](https://travis-ci.org/bramswenson/super_struct)
Simple extensions to `Struct` to make it more compatable with `Hash` without the performance penalties of `OpenStruct`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'super_struct'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_struct
## Usage
```ruby
require 'super_struct'
attributes = { name: 'John Doe' }
class Customer < SuperStruct.new(attributes)
def has_attribute?(attribute)
members.include?(attribute.to_sym)
end
end
john_doe = Customer.new(attributes)
=> #<struct Customer name="John Doe">
john_doe.name
=> 'John Doe'
```
## Testing
```ruby
bundle install --path .bundle/bundle
bundle exec rake spec
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/super_struct/fork )
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 a new Pull Request
| +
+ [](https://travis-ci.org/bramswenson/super_struct)
Simple extensions to `Struct` to make it more compatable with `Hash` without the performance penalties of `OpenStruct`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'super_struct'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install super_struct
## Usage
```ruby
require 'super_struct'
attributes = { name: 'John Doe' }
class Customer < SuperStruct.new(attributes)
def has_attribute?(attribute)
members.include?(attribute.to_sym)
end
end
john_doe = Customer.new(attributes)
=> #<struct Customer name="John Doe">
john_doe.name
=> 'John Doe'
```
## Testing
```ruby
bundle install --path .bundle/bundle
bundle exec rake spec
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/super_struct/fork )
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 a new Pull Request | 2 | 0.039216 | 2 | 0 |
7844af9a429710026f5604c4dbc6a6d54fdc35a6 | raw/assets/css/layout/rekap/pengukuran/gardu/admin/rekap_pengukuran_gardu_admin_common_layout.css | raw/assets/css/layout/rekap/pengukuran/gardu/admin/rekap_pengukuran_gardu_admin_common_layout.css | th, td {
white-space: nowrap;
text-align: center;
}
.table > thead > tr > th {
padding: 8px 32px;
}
| th, td {
white-space: nowrap;
text-align: center;
}
.table > thead > tr > th {
padding: 8px 32px;
}
.yadcf-filter-wrapper {
display: block;
}
.dataTables_filter {
display: none;
}
| Add yadcf and datatable search box style | Add yadcf and datatable search box style
| CSS | mit | Syafiqq/server-gardu-reporter,Syafiqq/server-gardu-reporter,Syafiqq/server-gardu-reporter,Syafiqq/server-gardu-reporter | css | ## Code Before:
th, td {
white-space: nowrap;
text-align: center;
}
.table > thead > tr > th {
padding: 8px 32px;
}
## Instruction:
Add yadcf and datatable search box style
## Code After:
th, td {
white-space: nowrap;
text-align: center;
}
.table > thead > tr > th {
padding: 8px 32px;
}
.yadcf-filter-wrapper {
display: block;
}
.dataTables_filter {
display: none;
}
| th, td {
white-space: nowrap;
text-align: center;
}
.table > thead > tr > th {
padding: 8px 32px;
}
+
+ .yadcf-filter-wrapper {
+ display: block;
+ }
+
+ .dataTables_filter {
+ display: none;
+ } | 8 | 1 | 8 | 0 |
4a4dbfd142e2f8fca3e82d7790ace4ed88bb0b3f | djangocms_spa/urls.py | djangocms_spa/urls.py | from django.conf.urls import url
from .views import SpaCmsPageDetailApiView
urlpatterns = [
url(r'^(?P<language_code>[\w-]+)/pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
url(r'^(?P<language_code>[\w-]+)/pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
]
| from django.conf.urls import url
from .views import SpaCmsPageDetailApiView
urlpatterns = [
url(r'^pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
url(r'^pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
]
| Remove language code from path | Remove language code from path
We no longer need the language detection in the URL. The locale
middleware already handles the language properly and we can consume
it from the request.
| Python | mit | dreipol/djangocms-spa,dreipol/djangocms-spa | python | ## Code Before:
from django.conf.urls import url
from .views import SpaCmsPageDetailApiView
urlpatterns = [
url(r'^(?P<language_code>[\w-]+)/pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
url(r'^(?P<language_code>[\w-]+)/pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
]
## Instruction:
Remove language code from path
We no longer need the language detection in the URL. The locale
middleware already handles the language properly and we can consume
it from the request.
## Code After:
from django.conf.urls import url
from .views import SpaCmsPageDetailApiView
urlpatterns = [
url(r'^pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
url(r'^pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
]
| from django.conf.urls import url
from .views import SpaCmsPageDetailApiView
urlpatterns = [
- url(r'^(?P<language_code>[\w-]+)/pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
? --------------------------
+ url(r'^pages/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail_home'),
- url(r'^(?P<language_code>[\w-]+)/pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
? --------------------------
+ url(r'^pages/(?P<path>.*)/$', SpaCmsPageDetailApiView.as_view(), name='cms_page_detail'),
] | 4 | 0.5 | 2 | 2 |
b47f8e0dc217f7eedc855e69f621d1a259c430e8 | pkg/shell/shell_unix_test.go | pkg/shell/shell_unix_test.go | //go:build !windows && !plan9 && !js
package shell
import (
"strings"
"syscall"
"testing"
"src.elv.sh/pkg/must"
. "src.elv.sh/pkg/prog/progtest"
"src.elv.sh/pkg/testutil"
)
func TestSignal_USR1(t *testing.T) {
Test(t, &Program{},
ThatElvish("-c", "kill -USR1 $pid").WritesStderrContaining("src.elv.sh/pkg/shell"))
}
func TestSignal_Ignored(t *testing.T) {
testutil.InTempDir(t)
Test(t, &Program{},
ThatElvish("-log", "logCHLD", "-c", "kill -CHLD $pid").DoesNothing())
wantLogCHLD := "signal " + syscall.SIGCHLD.String()
if logCHLD := must.ReadFileString("logCHLD"); !strings.Contains(logCHLD, wantLogCHLD) {
t.Errorf("want log when getting SIGCHLD to contain %q; got:\n%s", wantLogCHLD, logCHLD)
}
}
| //go:build !windows && !plan9 && !js
package shell
import (
"fmt"
"strings"
"syscall"
"testing"
"time"
"src.elv.sh/pkg/must"
. "src.elv.sh/pkg/prog/progtest"
"src.elv.sh/pkg/testutil"
)
func TestSignal_USR1(t *testing.T) {
Test(t, &Program{},
ThatElvish("-c", killCmd("USR1")).WritesStderrContaining("src.elv.sh/pkg/shell"))
}
func TestSignal_Ignored(t *testing.T) {
testutil.InTempDir(t)
Test(t, &Program{},
ThatElvish("-log", "logCHLD", "-c", killCmd("CHLD")).DoesNothing())
wantLogCHLD := "signal " + syscall.SIGCHLD.String()
if logCHLD := must.ReadFileString("logCHLD"); !strings.Contains(logCHLD, wantLogCHLD) {
t.Errorf("want log when getting SIGCHLD to contain %q; got:\n%s", wantLogCHLD, logCHLD)
}
}
func killCmd(name string) string {
// Add a delay after kill to ensure that the signal is handled.
return fmt.Sprintf("kill -%v $pid; sleep %v", name, testutil.Scaled(10*time.Millisecond))
}
| Add a short delay in signal handling test. | pkg/shell: Add a short delay in signal handling test.
| Go | bsd-2-clause | elves/elvish,elves/elvish,elves/elvish,elves/elvish,elves/elvish | go | ## Code Before:
//go:build !windows && !plan9 && !js
package shell
import (
"strings"
"syscall"
"testing"
"src.elv.sh/pkg/must"
. "src.elv.sh/pkg/prog/progtest"
"src.elv.sh/pkg/testutil"
)
func TestSignal_USR1(t *testing.T) {
Test(t, &Program{},
ThatElvish("-c", "kill -USR1 $pid").WritesStderrContaining("src.elv.sh/pkg/shell"))
}
func TestSignal_Ignored(t *testing.T) {
testutil.InTempDir(t)
Test(t, &Program{},
ThatElvish("-log", "logCHLD", "-c", "kill -CHLD $pid").DoesNothing())
wantLogCHLD := "signal " + syscall.SIGCHLD.String()
if logCHLD := must.ReadFileString("logCHLD"); !strings.Contains(logCHLD, wantLogCHLD) {
t.Errorf("want log when getting SIGCHLD to contain %q; got:\n%s", wantLogCHLD, logCHLD)
}
}
## Instruction:
pkg/shell: Add a short delay in signal handling test.
## Code After:
//go:build !windows && !plan9 && !js
package shell
import (
"fmt"
"strings"
"syscall"
"testing"
"time"
"src.elv.sh/pkg/must"
. "src.elv.sh/pkg/prog/progtest"
"src.elv.sh/pkg/testutil"
)
func TestSignal_USR1(t *testing.T) {
Test(t, &Program{},
ThatElvish("-c", killCmd("USR1")).WritesStderrContaining("src.elv.sh/pkg/shell"))
}
func TestSignal_Ignored(t *testing.T) {
testutil.InTempDir(t)
Test(t, &Program{},
ThatElvish("-log", "logCHLD", "-c", killCmd("CHLD")).DoesNothing())
wantLogCHLD := "signal " + syscall.SIGCHLD.String()
if logCHLD := must.ReadFileString("logCHLD"); !strings.Contains(logCHLD, wantLogCHLD) {
t.Errorf("want log when getting SIGCHLD to contain %q; got:\n%s", wantLogCHLD, logCHLD)
}
}
func killCmd(name string) string {
// Add a delay after kill to ensure that the signal is handled.
return fmt.Sprintf("kill -%v $pid; sleep %v", name, testutil.Scaled(10*time.Millisecond))
}
| //go:build !windows && !plan9 && !js
package shell
import (
+ "fmt"
"strings"
"syscall"
"testing"
+ "time"
"src.elv.sh/pkg/must"
. "src.elv.sh/pkg/prog/progtest"
"src.elv.sh/pkg/testutil"
)
func TestSignal_USR1(t *testing.T) {
Test(t, &Program{},
- ThatElvish("-c", "kill -USR1 $pid").WritesStderrContaining("src.elv.sh/pkg/shell"))
? - ^^ -----
+ ThatElvish("-c", killCmd("USR1")).WritesStderrContaining("src.elv.sh/pkg/shell"))
? ^^^^^ +
}
func TestSignal_Ignored(t *testing.T) {
testutil.InTempDir(t)
Test(t, &Program{},
- ThatElvish("-log", "logCHLD", "-c", "kill -CHLD $pid").DoesNothing())
? - ^^ -----
+ ThatElvish("-log", "logCHLD", "-c", killCmd("CHLD")).DoesNothing())
? ^^^^^ +
wantLogCHLD := "signal " + syscall.SIGCHLD.String()
if logCHLD := must.ReadFileString("logCHLD"); !strings.Contains(logCHLD, wantLogCHLD) {
t.Errorf("want log when getting SIGCHLD to contain %q; got:\n%s", wantLogCHLD, logCHLD)
}
}
+
+ func killCmd(name string) string {
+ // Add a delay after kill to ensure that the signal is handled.
+ return fmt.Sprintf("kill -%v $pid; sleep %v", name, testutil.Scaled(10*time.Millisecond))
+ } | 11 | 0.366667 | 9 | 2 |
1e3fc84cd1d0aa004fb69d18ca392af8877cc07a | features/support/capybara.rb | features/support/capybara.rb | require 'spinach/capybara'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90)
end
Spinach.hooks.on_tag("javascript") do
Capybara.current_driver = Capybara.javascript_driver
end
Capybara.default_wait_time = 60
Capybara.ignore_hidden_elements = false
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
| require 'spinach/capybara'
require 'capybara/poltergeist'
# Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: timeout)
end
Spinach.hooks.on_tag("javascript") do
Capybara.current_driver = Capybara.javascript_driver
end
Capybara.default_wait_time = timeout
Capybara.ignore_hidden_elements = false
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
| Reduce timeout for non-CI features | Reduce timeout for non-CI features
| Ruby | mit | delkyd/gitlabhq,allysonbarros/gitlabhq,Tyrael/gitlabhq,bigsurge/gitlabhq,jrjang/gitlabhq,SVArago/gitlabhq,iiet/iiet-git,folpindo/gitlabhq,screenpages/gitlabhq,michaKFromParis/gitlabhq,nmav/gitlabhq,tk23/gitlabhq,DanielZhangQingLong/gitlabhq,williamherry/gitlabhq,koreamic/gitlabhq,fgbreel/gitlabhq,mrb/gitlabhq,allistera/gitlabhq,Tyrael/gitlabhq,wangcan2014/gitlabhq,bozaro/gitlabhq,whluwit/gitlabhq,jrjang/gitlabhq,WSDC-NITWarangal/gitlabhq,sekcheong/gitlabhq,pulkit21/gitlabhq,dplarson/gitlabhq,jaepyoung/gitlabhq,zBMNForks/gitlabhq,hacsoc/gitlabhq,fantasywind/gitlabhq,H3Chief/gitlabhq,WSDC-NITWarangal/gitlabhq,gopeter/gitlabhq,jirutka/gitlabhq,ttasanen/gitlabhq,dreampet/gitlab,yonglehou/gitlabhq,yama07/gitlabhq,chadyred/gitlabhq,folpindo/gitlabhq,martijnvermaat/gitlabhq,fpgentil/gitlabhq,vjustov/gitlabhq,mavimo/gitlabhq,koreamic/gitlabhq,fgbreel/gitlabhq,szechyjs/gitlabhq,pulkit21/gitlabhq,ksoichiro/gitlabhq,daiyu/gitlab-zh,ayufan/gitlabhq,Razer6/gitlabhq,aaronsnyder/gitlabhq,wangcan2014/gitlabhq,chadyred/gitlabhq,fscherwi/gitlabhq,vjustov/gitlabhq,pjknkda/gitlabhq,theodi/gitlabhq,Burick/gitlabhq,k4zzk/gitlabhq,fpgentil/gitlabhq,salipro4ever/gitlabhq,ngpestelos/gitlabhq,OlegGirko/gitlab-ce,liyakun/gitlabhq,jirutka/gitlabhq,martijnvermaat/gitlabhq,julianengel/gitlabhq,ordiychen/gitlabhq,luzhongyang/gitlabhq,stanhu/gitlabhq,ikappas/gitlabhq,hzy001/gitlabhq,openwide-java/gitlabhq,ordiychen/gitlabhq,hacsoc/gitlabhq,icedwater/gitlabhq,duduribeiro/gitlabhq,revaret/gitlabhq,per-garden/gitlabhq,LytayTOUCH/gitlabhq,openwide-java/gitlabhq,rebecamendez/gitlabhq,hq804116393/gitlabhq,mente/gitlabhq,hacsoc/gitlabhq,rhels/gitlabhq,revaret/gitlabhq,gorgee/gitlabhq,sue445/gitlabhq,folpindo/gitlabhq,martijnvermaat/gitlabhq,t-zuehlsdorff/gitlabhq,mr-dxdy/gitlabhq,screenpages/gitlabhq,sakishum/gitlabhq,MauriceMohlek/gitlabhq,OtkurBiz/gitlabhq,sekcheong/gitlabhq,fantasywind/gitlabhq,daiyu/gitlab-zh,bbodenmiller/gitlabhq,luzhongyang/gitlabhq,LUMC/gitlabhq,kemenaran/gitlabhq,it33/gitlabhq,cinderblock/gitlabhq,martijnvermaat/gitlabhq,jrjang/gitlabhq,DanielZhangQingLong/gitlabhq,chadyred/gitlabhq,julianengel/gitlabhq,bbodenmiller/gitlabhq,aaronsnyder/gitlabhq,eliasp/gitlabhq,H3Chief/gitlabhq,williamherry/gitlabhq,luzhongyang/gitlabhq,LytayTOUCH/gitlabhq,bbodenmiller/gitlabhq,tk23/gitlabhq,michaKFromParis/gitlabhq,shinexiao/gitlabhq,michaKFromParis/gitlabhqold,jrjang/gitlabhq,sonalkr132/gitlabhq,ttasanen/gitlabhq,yfaizal/gitlabhq,axilleas/gitlabhq,zrbsprite/gitlabhq,nmav/gitlabhq,darkrasid/gitlabhq,fscherwi/gitlabhq,ayufan/gitlabhq,larryli/gitlabhq,dreampet/gitlab,Devin001/gitlabhq,fearenales/gitlabhq,openwide-java/gitlabhq,fantasywind/gitlabhq,johnmyqin/gitlabhq,SVArago/gitlabhq,mr-dxdy/gitlabhq,daiyu/gitlab-zh,k4zzk/gitlabhq,TheWatcher/gitlabhq,H3Chief/gitlabhq,darkrasid/gitlabhq,fpgentil/gitlabhq,initiummedia/gitlabhq,williamherry/gitlabhq,koreamic/gitlabhq,theonlydoo/gitlabhq,t-zuehlsdorff/gitlabhq,stanhu/gitlabhq,dwrensha/gitlabhq,ttasanen/gitlabhq,jirutka/gitlabhq,yama07/gitlabhq,rumpelsepp/gitlabhq,jrjang/gitlab-ce,LUMC/gitlabhq,Datacom/gitlabhq,zrbsprite/gitlabhq,sekcheong/gitlabhq,mente/gitlabhq,Burick/gitlabhq,wangcan2014/gitlabhq,nguyen-tien-mulodo/gitlabhq,shinexiao/gitlabhq,duduribeiro/gitlabhq,liyakun/gitlabhq,dukex/gitlabhq,chenrui2014/gitlabhq,k4zzk/gitlabhq,eliasp/gitlabhq,htve/GitlabForChinese,flashbuckets/gitlabhq,jaepyoung/gitlabhq,tim-hoff/gitlabhq,mmkassem/gitlabhq,johnmyqin/gitlabhq,joalmeid/gitlabhq,Exeia/gitlabhq,manfer/gitlabhq,delkyd/gitlabhq,Exeia/gitlabhq,vjustov/gitlabhq,stanhu/gitlabhq,gorgee/gitlabhq,htve/GitlabForChinese,initiummedia/gitlabhq,rebecamendez/gitlabhq,mr-dxdy/gitlabhq,julianengel/gitlabhq,Soullivaneuh/gitlabhq,sekcheong/gitlabhq,dplarson/gitlabhq,lvfeng1130/gitlabhq,theodi/gitlabhq,hzy001/gitlabhq,since2014/gitlabhq,louahola/gitlabhq,fearenales/gitlabhq,pjknkda/gitlabhq,icedwater/gitlabhq,delkyd/gitlabhq,ikappas/gitlabhq,since2014/gitlabhq,sonalkr132/gitlabhq,ordiychen/gitlabhq,LytayTOUCH/gitlabhq,michaKFromParis/gitlabhq,kemenaran/gitlabhq,fendoudeqingchunhh/gitlabhq,youprofit/gitlabhq,it33/gitlabhq,NKMR6194/gitlabhq,michaKFromParis/sparkslab,openwide-java/gitlabhq,jvanbaarsen/gitlabhq,NKMR6194/gitlabhq,theodi/gitlabhq,shinexiao/gitlabhq,flashbuckets/gitlabhq,ikappas/gitlabhq,zrbsprite/gitlabhq,yfaizal/gitlabhq,folpindo/gitlabhq,Burick/gitlabhq,gopeter/gitlabhq,dwrensha/gitlabhq,chenrui2014/gitlabhq,mmkassem/gitlabhq,dvrylc/gitlabhq,bozaro/gitlabhq,darkrasid/gitlabhq,jrjang/gitlab-ce,lvfeng1130/gitlabhq,delkyd/gitlabhq,H3Chief/gitlabhq,iiet/iiet-git,hq804116393/gitlabhq,julianengel/gitlabhq,rumpelsepp/gitlabhq,gorgee/gitlabhq,fscherwi/gitlabhq,MauriceMohlek/gitlabhq,hzy001/gitlabhq,allysonbarros/gitlabhq,it33/gitlabhq,dwrensha/gitlabhq,Exeia/gitlabhq,jvanbaarsen/gitlabhq,kitech/gitlabhq,t-zuehlsdorff/gitlabhq,SVArago/gitlabhq,zBMNForks/gitlabhq,Telekom-PD/gitlabhq,yatish27/gitlabhq,initiummedia/gitlabhq,mrb/gitlabhq,kemenaran/gitlabhq,dplarson/gitlabhq,MauriceMohlek/gitlabhq,martinma4/gitlabhq,louahola/gitlabhq,copystudy/gitlabhq,screenpages/gitlabhq,youprofit/gitlabhq,stoplightio/gitlabhq,ksoichiro/gitlabhq,duduribeiro/gitlabhq,zrbsprite/gitlabhq,OlegGirko/gitlab-ce,yama07/gitlabhq,cinderblock/gitlabhq,since2014/gitlabhq,larryli/gitlabhq,LUMC/gitlabhq,liyakun/gitlabhq,darkrasid/gitlabhq,flashbuckets/gitlabhq,pjknkda/gitlabhq,childbamboo/gitlabhq,shinexiao/gitlabhq,eliasp/gitlabhq,sakishum/gitlabhq,dukex/gitlabhq,ngpestelos/gitlabhq,luzhongyang/gitlabhq,theodi/gitlabhq,Burick/gitlabhq,OtkurBiz/gitlabhq,htve/GitlabForChinese,joalmeid/gitlabhq,yfaizal/gitlabhq,Telekom-PD/gitlabhq,fantasywind/gitlabhq,liyakun/gitlabhq,OlegGirko/gitlab-ce,Exeia/gitlabhq,whluwit/gitlabhq,it33/gitlabhq,yatish27/gitlabhq,bigsurge/gitlabhq,manfer/gitlabhq,ayufan/gitlabhq,revaret/gitlabhq,yatish27/gitlabhq,yama07/gitlabhq,nguyen-tien-mulodo/gitlabhq,stanhu/gitlabhq,aaronsnyder/gitlabhq,LUMC/gitlabhq,sakishum/gitlabhq,szechyjs/gitlabhq,pjknkda/gitlabhq,kemenaran/gitlabhq,aaronsnyder/gitlabhq,johnmyqin/gitlabhq,mr-dxdy/gitlabhq,cinderblock/gitlabhq,cui-liqiang/gitlab-ce,Soullivaneuh/gitlabhq,sue445/gitlabhq,cui-liqiang/gitlab-ce,fearenales/gitlabhq,fearenales/gitlabhq,sakishum/gitlabhq,rhels/gitlabhq,allysonbarros/gitlabhq,zBMNForks/gitlabhq,bbodenmiller/gitlabhq,TheWatcher/gitlabhq,ayufan/gitlabhq,allistera/gitlabhq,michaKFromParis/sparkslab,childbamboo/gitlabhq,duduribeiro/gitlabhq,OlegGirko/gitlab-ce,dvrylc/gitlabhq,allistera/gitlabhq,ngpestelos/gitlabhq,bozaro/gitlabhq,k4zzk/gitlabhq,cinderblock/gitlabhq,tim-hoff/gitlabhq,whluwit/gitlabhq,michaKFromParis/sparkslab,michaKFromParis/gitlabhqold,cui-liqiang/gitlab-ce,Telekom-PD/gitlabhq,Tyrael/gitlabhq,ksoichiro/gitlabhq,eliasp/gitlabhq,larryli/gitlabhq,dukex/gitlabhq,martinma4/gitlabhq,fendoudeqingchunhh/gitlabhq,childbamboo/gitlabhq,sue445/gitlabhq,fscherwi/gitlabhq,johnmyqin/gitlabhq,gopeter/gitlabhq,dvrylc/gitlabhq,axilleas/gitlabhq,joalmeid/gitlabhq,per-garden/gitlabhq,ferdinandrosario/gitlabhq,michaKFromParis/gitlabhq,Telekom-PD/gitlabhq,per-garden/gitlabhq,bozaro/gitlabhq,hzy001/gitlabhq,ngpestelos/gitlabhq,mente/gitlabhq,stoplightio/gitlabhq,fgbreel/gitlabhq,chenrui2014/gitlabhq,copystudy/gitlabhq,yonglehou/gitlabhq,rebecamendez/gitlabhq,larryli/gitlabhq,stoplightio/gitlabhq,allysonbarros/gitlabhq,michaKFromParis/gitlabhqold,htve/GitlabForChinese,hacsoc/gitlabhq,TheWatcher/gitlabhq,jvanbaarsen/gitlabhq,nmav/gitlabhq,Devin001/gitlabhq,DanielZhangQingLong/gitlabhq,dvrylc/gitlabhq,mavimo/gitlabhq,yonglehou/gitlabhq,NKMR6194/gitlabhq,copystudy/gitlabhq,Devin001/gitlabhq,Datacom/gitlabhq,mrb/gitlabhq,sue445/gitlabhq,rhels/gitlabhq,Soullivaneuh/gitlabhq,jrjang/gitlab-ce,mmkassem/gitlabhq,chadyred/gitlabhq,youprofit/gitlabhq,rumpelsepp/gitlabhq,mente/gitlabhq,ferdinandrosario/gitlabhq,yatish27/gitlabhq,Datacom/gitlabhq,kitech/gitlabhq,fendoudeqingchunhh/gitlabhq,jvanbaarsen/gitlabhq,iiet/iiet-git,youprofit/gitlabhq,zBMNForks/gitlabhq,hq804116393/gitlabhq,vjustov/gitlabhq,wangcan2014/gitlabhq,fendoudeqingchunhh/gitlabhq,yfaizal/gitlabhq,lvfeng1130/gitlabhq,screenpages/gitlabhq,initiummedia/gitlabhq,bigsurge/gitlabhq,koreamic/gitlabhq,cui-liqiang/gitlab-ce,revaret/gitlabhq,gopeter/gitlabhq,Razer6/gitlabhq,ferdinandrosario/gitlabhq,salipro4ever/gitlabhq,stoplightio/gitlabhq,WSDC-NITWarangal/gitlabhq,pulkit21/gitlabhq,Tyrael/gitlabhq,lvfeng1130/gitlabhq,jrjang/gitlab-ce,allistera/gitlabhq,jirutka/gitlabhq,tk23/gitlabhq,mavimo/gitlabhq,dwrensha/gitlabhq,mmkassem/gitlabhq,martinma4/gitlabhq,t-zuehlsdorff/gitlabhq,theonlydoo/gitlabhq,daiyu/gitlab-zh,salipro4ever/gitlabhq,flashbuckets/gitlabhq,szechyjs/gitlabhq,TheWatcher/gitlabhq,joalmeid/gitlabhq,fgbreel/gitlabhq,childbamboo/gitlabhq,NKMR6194/gitlabhq,iiet/iiet-git,kitech/gitlabhq,manfer/gitlabhq,since2014/gitlabhq,manfer/gitlabhq,mavimo/gitlabhq,michaKFromParis/sparkslab,hq804116393/gitlabhq,rebecamendez/gitlabhq,icedwater/gitlabhq,DanielZhangQingLong/gitlabhq,sonalkr132/gitlabhq,tk23/gitlabhq,louahola/gitlabhq,tempbottle/gitlabhq,Razer6/gitlabhq,tempbottle/gitlabhq,gorgee/gitlabhq,louahola/gitlabhq,nguyen-tien-mulodo/gitlabhq,rhels/gitlabhq,chenrui2014/gitlabhq,nmav/gitlabhq,ferdinandrosario/gitlabhq,WSDC-NITWarangal/gitlabhq,ordiychen/gitlabhq,Devin001/gitlabhq,ttasanen/gitlabhq,rumpelsepp/gitlabhq,whluwit/gitlabhq,dreampet/gitlab,OtkurBiz/gitlabhq,axilleas/gitlabhq,SVArago/gitlabhq,theonlydoo/gitlabhq,tempbottle/gitlabhq,LytayTOUCH/gitlabhq,fpgentil/gitlabhq,jaepyoung/gitlabhq,ksoichiro/gitlabhq,mrb/gitlabhq,Soullivaneuh/gitlabhq,kitech/gitlabhq,bigsurge/gitlabhq,dplarson/gitlabhq,jaepyoung/gitlabhq,tim-hoff/gitlabhq,szechyjs/gitlabhq,salipro4ever/gitlabhq,MauriceMohlek/gitlabhq,OtkurBiz/gitlabhq,Razer6/gitlabhq,per-garden/gitlabhq,Datacom/gitlabhq,icedwater/gitlabhq,nguyen-tien-mulodo/gitlabhq,axilleas/gitlabhq,williamherry/gitlabhq,copystudy/gitlabhq,michaKFromParis/gitlabhqold,pulkit21/gitlabhq,sonalkr132/gitlabhq,yonglehou/gitlabhq,tempbottle/gitlabhq,ikappas/gitlabhq,theonlydoo/gitlabhq,martinma4/gitlabhq,dukex/gitlabhq,tim-hoff/gitlabhq,dreampet/gitlab | ruby | ## Code Before:
require 'spinach/capybara'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90)
end
Spinach.hooks.on_tag("javascript") do
Capybara.current_driver = Capybara.javascript_driver
end
Capybara.default_wait_time = 60
Capybara.ignore_hidden_elements = false
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
## Instruction:
Reduce timeout for non-CI features
## Code After:
require 'spinach/capybara'
require 'capybara/poltergeist'
# Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: timeout)
end
Spinach.hooks.on_tag("javascript") do
Capybara.current_driver = Capybara.javascript_driver
end
Capybara.default_wait_time = timeout
Capybara.ignore_hidden_elements = false
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run
| require 'spinach/capybara'
require 'capybara/poltergeist'
+ # Give CI some extra time
+ timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
+
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
- Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90)
? ^^
+ Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: timeout)
? ^^^^^^^
end
Spinach.hooks.on_tag("javascript") do
Capybara.current_driver = Capybara.javascript_driver
end
- Capybara.default_wait_time = 60
? ^^
+ Capybara.default_wait_time = timeout
? ^^^^^^^
Capybara.ignore_hidden_elements = false
require 'capybara-screenshot/spinach'
# Keep only the screenshots generated from the last failing test suite
Capybara::Screenshot.prune_strategy = :keep_last_run | 7 | 0.368421 | 5 | 2 |
c249f0b17072ec37c55e8b325207c8190799998a | script/jshint.sh | script/jshint.sh |
set -e
echo "Linting with Jshint …"
jshint js/jquery.imadaem.js
jshint test/*.js
|
set -e
echo "Linting source …"
jshint js/jquery.imadaem.js
echo "Linting tests …"
jshint test/*.js
| Add comment for test linting | Add comment for test linting
| Shell | mit | penibelst/imadaem,penibelst/imadaem,penibelst/imadaem | shell | ## Code Before:
set -e
echo "Linting with Jshint …"
jshint js/jquery.imadaem.js
jshint test/*.js
## Instruction:
Add comment for test linting
## Code After:
set -e
echo "Linting source …"
jshint js/jquery.imadaem.js
echo "Linting tests …"
jshint test/*.js
|
set -e
- echo "Linting with Jshint …"
+ echo "Linting source …"
jshint js/jquery.imadaem.js
+
+ echo "Linting tests …"
jshint test/*.js | 4 | 0.666667 | 3 | 1 |
bc39e2cb6b5c44bb6ba10d921ba142648edfa16f | app/models/concerns/account/fraud_validator.rb | app/models/concerns/account/fraud_validator.rb | require 'active_support/concern'
class Account < ActiveRecord::Base
module Account::FraudValidator
extend ActiveSupport::Concern
VALID_FRAUD_SCORE = 40
VALIDATION_REASONS = ["None", "Minfraud", "IP history", "Risky card attempts"]
def fraud_validation_reason(ip)
return case
when !minfraud_safe? ; 1
when !safe_ip?(ip) ; 2
when !permissible_card_attempts? ; 3
else ; 0
end
end
# Checks against minfraud data we have on db
def minfraud_safe?
return true if primary_billing_card.blank? || primary_billing_card.fraud_safe?
# fraud_body = JSON.parse primary_billing_card.fraud_body
(primary_billing_card.fraud_verified? &&
primary_billing_card.fraud_score <= VALID_FRAUD_SCORE
# !fraud_body["anonymous_proxy"] &&
# fraud_body["country_match"] &&
# fraud_body["proxy_score"] < 2.0
) rescue false
end
# Check list of IPs that has a history for fraud
def safe_ip?(ip)
RiskyIpAddress.count(ip_address: ip) == 0
end
# Number of bad / risky card attempts
def permissible_card_attempts?
risky_card_attempts <= 3
end
end
end
| require 'active_support/concern'
class Account < ActiveRecord::Base
module Account::FraudValidator
extend ActiveSupport::Concern
VALID_FRAUD_SCORE = 40
VALIDATION_REASONS = ["None", "Minfraud", "IP history", "Risky card attempts"]
def fraud_validation_reason(ip)
return case
when !minfraud_safe? ; 1
when !safe_ip?(ip) ; 2
when !permissible_card_attempts? ; 3
else ; 0
end
end
# Checks against minfraud data we have on db
def minfraud_safe?
return true if primary_billing_card.blank? || primary_billing_card.fraud_safe?
# fraud_body = JSON.parse primary_billing_card.fraud_body
(primary_billing_card.fraud_verified? &&
primary_billing_card.fraud_score <= VALID_FRAUD_SCORE
# !fraud_body["anonymous_proxy"] &&
# fraud_body["country_match"] &&
# fraud_body["proxy_score"] < 2.0
) rescue false
end
# Check list of IPs that has a history for fraud
def safe_ip?(ip)
RiskyIpAddress.where(ip_address: ip).count == 0
end
# Number of bad / risky card attempts
def permissible_card_attempts?
risky_card_attempts <= 3
end
end
end
| Fix IP history false positives | Fix IP history false positives | Ruby | apache-2.0 | OnApp/cloudnet,OnApp/cloudnet,OnApp/cloudnet,OnApp/cloudnet | ruby | ## Code Before:
require 'active_support/concern'
class Account < ActiveRecord::Base
module Account::FraudValidator
extend ActiveSupport::Concern
VALID_FRAUD_SCORE = 40
VALIDATION_REASONS = ["None", "Minfraud", "IP history", "Risky card attempts"]
def fraud_validation_reason(ip)
return case
when !minfraud_safe? ; 1
when !safe_ip?(ip) ; 2
when !permissible_card_attempts? ; 3
else ; 0
end
end
# Checks against minfraud data we have on db
def minfraud_safe?
return true if primary_billing_card.blank? || primary_billing_card.fraud_safe?
# fraud_body = JSON.parse primary_billing_card.fraud_body
(primary_billing_card.fraud_verified? &&
primary_billing_card.fraud_score <= VALID_FRAUD_SCORE
# !fraud_body["anonymous_proxy"] &&
# fraud_body["country_match"] &&
# fraud_body["proxy_score"] < 2.0
) rescue false
end
# Check list of IPs that has a history for fraud
def safe_ip?(ip)
RiskyIpAddress.count(ip_address: ip) == 0
end
# Number of bad / risky card attempts
def permissible_card_attempts?
risky_card_attempts <= 3
end
end
end
## Instruction:
Fix IP history false positives
## Code After:
require 'active_support/concern'
class Account < ActiveRecord::Base
module Account::FraudValidator
extend ActiveSupport::Concern
VALID_FRAUD_SCORE = 40
VALIDATION_REASONS = ["None", "Minfraud", "IP history", "Risky card attempts"]
def fraud_validation_reason(ip)
return case
when !minfraud_safe? ; 1
when !safe_ip?(ip) ; 2
when !permissible_card_attempts? ; 3
else ; 0
end
end
# Checks against minfraud data we have on db
def minfraud_safe?
return true if primary_billing_card.blank? || primary_billing_card.fraud_safe?
# fraud_body = JSON.parse primary_billing_card.fraud_body
(primary_billing_card.fraud_verified? &&
primary_billing_card.fraud_score <= VALID_FRAUD_SCORE
# !fraud_body["anonymous_proxy"] &&
# fraud_body["country_match"] &&
# fraud_body["proxy_score"] < 2.0
) rescue false
end
# Check list of IPs that has a history for fraud
def safe_ip?(ip)
RiskyIpAddress.where(ip_address: ip).count == 0
end
# Number of bad / risky card attempts
def permissible_card_attempts?
risky_card_attempts <= 3
end
end
end
| require 'active_support/concern'
class Account < ActiveRecord::Base
module Account::FraudValidator
extend ActiveSupport::Concern
VALID_FRAUD_SCORE = 40
VALIDATION_REASONS = ["None", "Minfraud", "IP history", "Risky card attempts"]
def fraud_validation_reason(ip)
return case
when !minfraud_safe? ; 1
when !safe_ip?(ip) ; 2
when !permissible_card_attempts? ; 3
else ; 0
end
end
# Checks against minfraud data we have on db
def minfraud_safe?
return true if primary_billing_card.blank? || primary_billing_card.fraud_safe?
# fraud_body = JSON.parse primary_billing_card.fraud_body
(primary_billing_card.fraud_verified? &&
primary_billing_card.fraud_score <= VALID_FRAUD_SCORE
# !fraud_body["anonymous_proxy"] &&
# fraud_body["country_match"] &&
# fraud_body["proxy_score"] < 2.0
) rescue false
end
# Check list of IPs that has a history for fraud
def safe_ip?(ip)
- RiskyIpAddress.count(ip_address: ip) == 0
? ^^^^^
+ RiskyIpAddress.where(ip_address: ip).count == 0
? ^^^^^ ++++++
end
# Number of bad / risky card attempts
def permissible_card_attempts?
risky_card_attempts <= 3
end
end
end | 2 | 0.04878 | 1 | 1 |
9592c8be12d66d386aa29b3eaa248552a5c52556 | recipes/jupyterlab-sos/meta.yaml | recipes/jupyterlab-sos/meta.yaml | {% set name = "jupyterlab-sos" %}
{% set version = "0.5.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://registry.npmjs.org/jupyterlab-sos/-/jupyterlab-sos-{{ version }}.tgz
sha256: afbfa0c906a45db6e97b12731d308de89e80990833401355198f75f455328de5
build:
number: 0
requirements:
build:
- nodejs
host:
- jupyterlab
- python >=3.5
run:
- jupyterlab
- nodejs
- python >=3.5
- jupyterlab-transient-display-data
test:
commands:
- jupyter labextension list | grep jupyterlab-sos # [unix]
- jupyter labextension list | findstr jupyterlab-sos # [win]
- jupyter lab build
about:
home: https://github.com/vatlab/jupyterlab-sos
license: BSD 3-Clause
license_family: BSD
license_file: LICENSE
summary: A JupyterLab extension for SoS Polyglot Notebook and Workflow System
dev_url: https://github.com/vatlab/jupyterlab-sos
extra:
recipe-maintainers:
- BoPeng
| {% set name = "jupyterlab-sos" %}
{% set version = "0.5.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://registry.npmjs.org/jupyterlab-sos/-/jupyterlab-sos-{{ version }}.tgz
sha256: afbfa0c906a45db6e97b12731d308de89e80990833401355198f75f455328de5
build:
number: 0
noarch: python
requirements:
build:
- nodejs
host:
- jupyterlab
- python >=3.5
run:
- jupyterlab
- nodejs
- python >=3.5
- jupyterlab-transient-display-data
test:
commands:
- jupyter labextension list | grep jupyterlab-sos # [unix]
- jupyter labextension list | findstr jupyterlab-sos # [win]
- jupyter lab build
about:
home: https://github.com/vatlab/jupyterlab-sos
license: BSD 3-Clause
license_family: BSD
license_file: LICENSE
summary: A JupyterLab extension for SoS Polyglot Notebook and Workflow System
dev_url: https://github.com/vatlab/jupyterlab-sos
extra:
recipe-maintainers:
- BoPeng
| Change back to noarch: python | Change back to noarch: python | YAML | bsd-3-clause | chrisburr/staged-recipes,hadim/staged-recipes,mariusvniekerk/staged-recipes,kwilcox/staged-recipes,stuertz/staged-recipes,ocefpaf/staged-recipes,jakirkham/staged-recipes,jakirkham/staged-recipes,birdsarah/staged-recipes,patricksnape/staged-recipes,scopatz/staged-recipes,igortg/staged-recipes,conda-forge/staged-recipes,mcs07/staged-recipes,chrisburr/staged-recipes,petrushy/staged-recipes,synapticarbors/staged-recipes,dschreij/staged-recipes,asmeurer/staged-recipes,mariusvniekerk/staged-recipes,SylvainCorlay/staged-recipes,Juanlu001/staged-recipes,goanpeca/staged-recipes,ReimarBauer/staged-recipes,ocefpaf/staged-recipes,johanneskoester/staged-recipes,kwilcox/staged-recipes,synapticarbors/staged-recipes,jochym/staged-recipes,isuruf/staged-recipes,petrushy/staged-recipes,jochym/staged-recipes,scopatz/staged-recipes,conda-forge/staged-recipes,goanpeca/staged-recipes,asmeurer/staged-recipes,igortg/staged-recipes,patricksnape/staged-recipes,mcs07/staged-recipes,hadim/staged-recipes,dschreij/staged-recipes,birdsarah/staged-recipes,stuertz/staged-recipes,johanneskoester/staged-recipes,Juanlu001/staged-recipes,ReimarBauer/staged-recipes,SylvainCorlay/staged-recipes,isuruf/staged-recipes | yaml | ## Code Before:
{% set name = "jupyterlab-sos" %}
{% set version = "0.5.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://registry.npmjs.org/jupyterlab-sos/-/jupyterlab-sos-{{ version }}.tgz
sha256: afbfa0c906a45db6e97b12731d308de89e80990833401355198f75f455328de5
build:
number: 0
requirements:
build:
- nodejs
host:
- jupyterlab
- python >=3.5
run:
- jupyterlab
- nodejs
- python >=3.5
- jupyterlab-transient-display-data
test:
commands:
- jupyter labextension list | grep jupyterlab-sos # [unix]
- jupyter labextension list | findstr jupyterlab-sos # [win]
- jupyter lab build
about:
home: https://github.com/vatlab/jupyterlab-sos
license: BSD 3-Clause
license_family: BSD
license_file: LICENSE
summary: A JupyterLab extension for SoS Polyglot Notebook and Workflow System
dev_url: https://github.com/vatlab/jupyterlab-sos
extra:
recipe-maintainers:
- BoPeng
## Instruction:
Change back to noarch: python
## Code After:
{% set name = "jupyterlab-sos" %}
{% set version = "0.5.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://registry.npmjs.org/jupyterlab-sos/-/jupyterlab-sos-{{ version }}.tgz
sha256: afbfa0c906a45db6e97b12731d308de89e80990833401355198f75f455328de5
build:
number: 0
noarch: python
requirements:
build:
- nodejs
host:
- jupyterlab
- python >=3.5
run:
- jupyterlab
- nodejs
- python >=3.5
- jupyterlab-transient-display-data
test:
commands:
- jupyter labextension list | grep jupyterlab-sos # [unix]
- jupyter labextension list | findstr jupyterlab-sos # [win]
- jupyter lab build
about:
home: https://github.com/vatlab/jupyterlab-sos
license: BSD 3-Clause
license_family: BSD
license_file: LICENSE
summary: A JupyterLab extension for SoS Polyglot Notebook and Workflow System
dev_url: https://github.com/vatlab/jupyterlab-sos
extra:
recipe-maintainers:
- BoPeng
| {% set name = "jupyterlab-sos" %}
{% set version = "0.5.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://registry.npmjs.org/jupyterlab-sos/-/jupyterlab-sos-{{ version }}.tgz
sha256: afbfa0c906a45db6e97b12731d308de89e80990833401355198f75f455328de5
build:
number: 0
+ noarch: python
requirements:
build:
- nodejs
host:
- jupyterlab
- python >=3.5
run:
- jupyterlab
- nodejs
- python >=3.5
- jupyterlab-transient-display-data
test:
commands:
- jupyter labextension list | grep jupyterlab-sos # [unix]
- jupyter labextension list | findstr jupyterlab-sos # [win]
- jupyter lab build
about:
home: https://github.com/vatlab/jupyterlab-sos
license: BSD 3-Clause
license_family: BSD
license_file: LICENSE
summary: A JupyterLab extension for SoS Polyglot Notebook and Workflow System
dev_url: https://github.com/vatlab/jupyterlab-sos
extra:
recipe-maintainers:
- BoPeng | 1 | 0.022727 | 1 | 0 |
e580b1c8dc4e2a09feaa5b6be00a3e8d1ea31e01 | src/mailgun-transport.js | src/mailgun-transport.js | 'use strict';
var Mailgun = require('mailgun-js');
var packageData = require('../package.json');
module.exports = function(options) {
return new MailgunTransport(options);
};
function MailgunTransport(options) {
this.options = options || {};
this.name = 'Mailgun';
this.version = packageData.version;
}
MailgunTransport.prototype.send = function (mail, callback) {
var mailgun = Mailgun({
apiKey: this.options.auth.api_key,
domain: this.options.auth.domain || ''
});
var data = {
from: mail.data.from,
to: mail.data.to,
subject: mail.data.subject,
text: mail.data.text
}
mailgun.messages().send(data,
function (err, body) {
if (err) {
console.log(err);
return callback(err);
}
return callback();
}
);
};
| 'use strict';
var Mailgun = require('mailgun-js');
var packageData = require('../package.json');
module.exports = function(options) {
return new MailgunTransport(options);
};
function MailgunTransport(options) {
this.options = options || {};
this.name = 'Mailgun';
this.version = packageData.version;
}
MailgunTransport.prototype.send = function (mail, callback) {
var mailgun = Mailgun({
apiKey: this.options.auth.api_key,
domain: this.options.auth.domain || ''
});
var data = {
from: mail.data.from,
to: mail.data.to,
subject: mail.data.subject,
text: mail.data.text,
html: mail.data.html
}
mailgun.messages().send(data,
function (err, body) {
if (err) {
console.log(err);
return callback(err);
}
return callback();
}
);
};
| Add in support for passing through the html param | Add in support for passing through the html param | JavaScript | mit | orliesaurus/nodemailer-mailgun-transport,wmcmurray/nodemailer-mailgun-transport,rasteiner/nodemailer-mailgun-transport | javascript | ## Code Before:
'use strict';
var Mailgun = require('mailgun-js');
var packageData = require('../package.json');
module.exports = function(options) {
return new MailgunTransport(options);
};
function MailgunTransport(options) {
this.options = options || {};
this.name = 'Mailgun';
this.version = packageData.version;
}
MailgunTransport.prototype.send = function (mail, callback) {
var mailgun = Mailgun({
apiKey: this.options.auth.api_key,
domain: this.options.auth.domain || ''
});
var data = {
from: mail.data.from,
to: mail.data.to,
subject: mail.data.subject,
text: mail.data.text
}
mailgun.messages().send(data,
function (err, body) {
if (err) {
console.log(err);
return callback(err);
}
return callback();
}
);
};
## Instruction:
Add in support for passing through the html param
## Code After:
'use strict';
var Mailgun = require('mailgun-js');
var packageData = require('../package.json');
module.exports = function(options) {
return new MailgunTransport(options);
};
function MailgunTransport(options) {
this.options = options || {};
this.name = 'Mailgun';
this.version = packageData.version;
}
MailgunTransport.prototype.send = function (mail, callback) {
var mailgun = Mailgun({
apiKey: this.options.auth.api_key,
domain: this.options.auth.domain || ''
});
var data = {
from: mail.data.from,
to: mail.data.to,
subject: mail.data.subject,
text: mail.data.text,
html: mail.data.html
}
mailgun.messages().send(data,
function (err, body) {
if (err) {
console.log(err);
return callback(err);
}
return callback();
}
);
};
| 'use strict';
var Mailgun = require('mailgun-js');
var packageData = require('../package.json');
module.exports = function(options) {
return new MailgunTransport(options);
};
function MailgunTransport(options) {
this.options = options || {};
this.name = 'Mailgun';
this.version = packageData.version;
}
MailgunTransport.prototype.send = function (mail, callback) {
var mailgun = Mailgun({
apiKey: this.options.auth.api_key,
domain: this.options.auth.domain || ''
});
var data = {
from: mail.data.from,
to: mail.data.to,
subject: mail.data.subject,
- text: mail.data.text
+ text: mail.data.text,
? +
+ html: mail.data.html
}
mailgun.messages().send(data,
function (err, body) {
if (err) {
console.log(err);
return callback(err);
}
return callback();
}
);
};
| 3 | 0.073171 | 2 | 1 |
9438224c47cb220ebcfa48ed41835659c90f928c | app/assets/javascripts/uploadcare/widget/templates/styles.jst.ejs.erb | app/assets/javascripts/uploadcare/widget/templates/styles.jst.ejs.erb | <%=
raw = Rails.application.assets.find_asset('uploadcare/widget.css').body
YUI::CssCompressor.new.compress(raw)
%>
| // = depend_on uploadcare/widget.css
<%=
raw = Rails.application.assets.find_asset('uploadcare/widget.css').body
YUI::CssCompressor.new.compress(raw)
%>
| Recompile styles JST on source change | Recompile styles JST on source change
| HTML+ERB | bsd-2-clause | uploadcare/uploadcare-widget,prognostikos/uploadcare-widget,toscale/uploadcare-widget,toscale/uploadcare-widget,toscale/uploadcare-widget,prognostikos/uploadcare-widget,uploadcare/uploadcare-widget,BIGWOO/uploadcare-widget,BIGWOO/uploadcare-widget,prognostikos/uploadcare-widget,BIGWOO/uploadcare-widget | html+erb | ## Code Before:
<%=
raw = Rails.application.assets.find_asset('uploadcare/widget.css').body
YUI::CssCompressor.new.compress(raw)
%>
## Instruction:
Recompile styles JST on source change
## Code After:
// = depend_on uploadcare/widget.css
<%=
raw = Rails.application.assets.find_asset('uploadcare/widget.css').body
YUI::CssCompressor.new.compress(raw)
%>
| + // = depend_on uploadcare/widget.css
<%=
raw = Rails.application.assets.find_asset('uploadcare/widget.css').body
YUI::CssCompressor.new.compress(raw)
%> | 1 | 0.25 | 1 | 0 |
18970109a56963d3891ed47e2b8cead757bc28c2 | src/Duffer/Unified.hs | src/Duffer/Unified.hs | module Duffer.Unified where
import Data.Bool (bool)
import Duffer.Loose
import Duffer.Loose.Objects (Ref, GitObject)
import Duffer.Pack
import Duffer.WithRepo
readObject :: Ref -> WithRepo (Maybe GitObject)
readObject ref = hasLooseObject ref >>= bool
(readPackObject ref)
(readLooseObject ref)
writeObject :: GitObject -> WithRepo Ref
writeObject = writeLooseObject
resolveRef :: FilePath -> WithRepo (Maybe GitObject)
resolveRef refPath = hasLooseRef refPath >>= bool
(resolveLooseRef refPath)
(resolvePackRef refPath)
| module Duffer.Unified where
import Data.Bool (bool)
import Duffer.Loose
import Duffer.Loose.Objects (Ref, GitObject)
import Duffer.Pack
import Duffer.WithRepo
readObject :: Ref -> WithRepo (Maybe GitObject)
readObject ref = hasLooseObject ref >>= bool
(readPackObject ref)
(readLooseObject ref)
writeObject :: GitObject -> WithRepo Ref
writeObject = writeLooseObject
resolveRef :: FilePath -> WithRepo (Maybe GitObject)
resolveRef refPath = hasLooseRef refPath >>= bool
(resolvePackRef refPath)
(resolveLooseRef refPath)
| Correct order of bool parameters. | Correct order of bool parameters.
| Haskell | bsd-3-clause | vaibhavsagar/duffer.hs,vaibhavsagar/duffer | haskell | ## Code Before:
module Duffer.Unified where
import Data.Bool (bool)
import Duffer.Loose
import Duffer.Loose.Objects (Ref, GitObject)
import Duffer.Pack
import Duffer.WithRepo
readObject :: Ref -> WithRepo (Maybe GitObject)
readObject ref = hasLooseObject ref >>= bool
(readPackObject ref)
(readLooseObject ref)
writeObject :: GitObject -> WithRepo Ref
writeObject = writeLooseObject
resolveRef :: FilePath -> WithRepo (Maybe GitObject)
resolveRef refPath = hasLooseRef refPath >>= bool
(resolveLooseRef refPath)
(resolvePackRef refPath)
## Instruction:
Correct order of bool parameters.
## Code After:
module Duffer.Unified where
import Data.Bool (bool)
import Duffer.Loose
import Duffer.Loose.Objects (Ref, GitObject)
import Duffer.Pack
import Duffer.WithRepo
readObject :: Ref -> WithRepo (Maybe GitObject)
readObject ref = hasLooseObject ref >>= bool
(readPackObject ref)
(readLooseObject ref)
writeObject :: GitObject -> WithRepo Ref
writeObject = writeLooseObject
resolveRef :: FilePath -> WithRepo (Maybe GitObject)
resolveRef refPath = hasLooseRef refPath >>= bool
(resolvePackRef refPath)
(resolveLooseRef refPath)
| module Duffer.Unified where
import Data.Bool (bool)
import Duffer.Loose
import Duffer.Loose.Objects (Ref, GitObject)
import Duffer.Pack
import Duffer.WithRepo
readObject :: Ref -> WithRepo (Maybe GitObject)
readObject ref = hasLooseObject ref >>= bool
(readPackObject ref)
(readLooseObject ref)
writeObject :: GitObject -> WithRepo Ref
writeObject = writeLooseObject
resolveRef :: FilePath -> WithRepo (Maybe GitObject)
resolveRef refPath = hasLooseRef refPath >>= bool
+ (resolvePackRef refPath)
(resolveLooseRef refPath)
- (resolvePackRef refPath) | 2 | 0.095238 | 1 | 1 |
0b570f4a0ce68be3d961b0f71da5bc2305be59e7 | client/lib/components/DataTable/component.js | client/lib/components/DataTable/component.js | import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
'table-hover',
'DataTable',
className
])
return (
<div className="table-responsive">
<table className={tableClassName}>
<thead>
<tr>
{cols.map(({ classes, title }, index) => (
<th
key={index}
className={classes}
scope="col"
>
{title}
</th>
))}
</tr>
</thead>
<tbody>
{records.map((row, index) => (
<tr
key={index}
onClick={() => click && click(row, index)}
className="DataTable__row"
>
{cols.map(({ classes, value }, colIndex) => (
<td key={colIndex} className={classes}>{value(row)}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
)
}
DataTable.propTypes = {
className: PropTypes.string,
click: PropTypes.func,
cols: PropTypes.arrayOf(PropTypes.object),
records: PropTypes.arrayOf(PropTypes.object)
}
DataTable.defaultProps = {
className: undefined,
click: undefined,
cols: [],
records: []
}
export default DataTable
| import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
{
'table-hover': !!click
},
'DataTable',
className
])
return (
<div className="table-responsive">
<table className={tableClassName}>
<thead>
<tr>
{cols.map(({ classes, title }, index) => (
<th
key={index}
className={classes}
scope="col"
>
{title}
</th>
))}
</tr>
</thead>
<tbody>
{records.map((row, index) => (
<tr
key={index}
onClick={() => click && click(row, index)}
className="DataTable__row"
>
{cols.map(({ classes, value }, colIndex) => (
<td key={colIndex} className={classes}>{value(row)}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
)
}
DataTable.propTypes = {
className: PropTypes.string,
click: PropTypes.func,
cols: PropTypes.arrayOf(PropTypes.object),
records: PropTypes.arrayOf(PropTypes.object)
}
DataTable.defaultProps = {
className: undefined,
click: undefined,
cols: [],
records: []
}
export default DataTable
| Enable hover table styling only if row click handler is defined | Enable hover table styling only if row click handler is defined
| JavaScript | mit | dreikanter/feeder,dreikanter/feeder,dreikanter/feeder | javascript | ## Code Before:
import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
'table-hover',
'DataTable',
className
])
return (
<div className="table-responsive">
<table className={tableClassName}>
<thead>
<tr>
{cols.map(({ classes, title }, index) => (
<th
key={index}
className={classes}
scope="col"
>
{title}
</th>
))}
</tr>
</thead>
<tbody>
{records.map((row, index) => (
<tr
key={index}
onClick={() => click && click(row, index)}
className="DataTable__row"
>
{cols.map(({ classes, value }, colIndex) => (
<td key={colIndex} className={classes}>{value(row)}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
)
}
DataTable.propTypes = {
className: PropTypes.string,
click: PropTypes.func,
cols: PropTypes.arrayOf(PropTypes.object),
records: PropTypes.arrayOf(PropTypes.object)
}
DataTable.defaultProps = {
className: undefined,
click: undefined,
cols: [],
records: []
}
export default DataTable
## Instruction:
Enable hover table styling only if row click handler is defined
## Code After:
import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
{
'table-hover': !!click
},
'DataTable',
className
])
return (
<div className="table-responsive">
<table className={tableClassName}>
<thead>
<tr>
{cols.map(({ classes, title }, index) => (
<th
key={index}
className={classes}
scope="col"
>
{title}
</th>
))}
</tr>
</thead>
<tbody>
{records.map((row, index) => (
<tr
key={index}
onClick={() => click && click(row, index)}
className="DataTable__row"
>
{cols.map(({ classes, value }, colIndex) => (
<td key={colIndex} className={classes}>{value(row)}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
)
}
DataTable.propTypes = {
className: PropTypes.string,
click: PropTypes.func,
cols: PropTypes.arrayOf(PropTypes.object),
records: PropTypes.arrayOf(PropTypes.object)
}
DataTable.defaultProps = {
className: undefined,
click: undefined,
cols: [],
records: []
}
export default DataTable
| import cc from 'classcat'
import React from 'react'
import PropTypes from 'prop-types'
import './style.scss'
function DataTable ({
className,
click,
cols,
records
}) {
if (!cols.length) {
return null
}
const tableClassName = cc([
'table',
'table-bordered',
- 'table-hover',
+ {
+ 'table-hover': !!click
+ },
'DataTable',
className
])
return (
<div className="table-responsive">
<table className={tableClassName}>
<thead>
<tr>
{cols.map(({ classes, title }, index) => (
<th
key={index}
className={classes}
scope="col"
>
{title}
</th>
))}
</tr>
</thead>
<tbody>
{records.map((row, index) => (
<tr
key={index}
onClick={() => click && click(row, index)}
className="DataTable__row"
>
{cols.map(({ classes, value }, colIndex) => (
<td key={colIndex} className={classes}>{value(row)}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
)
}
DataTable.propTypes = {
className: PropTypes.string,
click: PropTypes.func,
cols: PropTypes.arrayOf(PropTypes.object),
records: PropTypes.arrayOf(PropTypes.object)
}
DataTable.defaultProps = {
className: undefined,
click: undefined,
cols: [],
records: []
}
export default DataTable | 4 | 0.055556 | 3 | 1 |
3460f6b42ab3b23cfde070335c03e02ff8817db6 | css/components/_newsletter.scss | css/components/_newsletter.scss | .alert .close {
display: none;
}
// jNews footer
.footer[align="center"] > .footer {
display: none;
}
// table with links to additional functionality
[action*="jnews"][name="mosForm"] {
display: none;
}
| .alert .close {
display: none;
}
| Fix newsletter via config rather than styling | Fix newsletter via config rather than styling
| SCSS | agpl-3.0 | xi/kub-template,kub-berlin/kub-template,xi/kub-template,kub-berlin/kub-template,xi/kub-template,kub-berlin/kub-template | scss | ## Code Before:
.alert .close {
display: none;
}
// jNews footer
.footer[align="center"] > .footer {
display: none;
}
// table with links to additional functionality
[action*="jnews"][name="mosForm"] {
display: none;
}
## Instruction:
Fix newsletter via config rather than styling
## Code After:
.alert .close {
display: none;
}
| .alert .close {
display: none;
}
-
- // jNews footer
- .footer[align="center"] > .footer {
- display: none;
- }
-
- // table with links to additional functionality
- [action*="jnews"][name="mosForm"] {
- display: none;
- } | 10 | 0.769231 | 0 | 10 |
e4f5bff5311ba8258eaa3306399acdfe8380f2b1 | README.md | README.md | A small library for getting the name of the OS.
__NOTE__: the library used to give information about CPUs, as well. However, it wasn't reliable enough.
If you need such functionality, I'd recommend trying [hlibcpuid](https://github.com/dtaskoff/hlibcpuid).
|
[](https://hackage.haskell.org/package/system-info)
A small library for getting the name of the OS.
__NOTE__: the library used to give information about CPUs, as well. However, it wasn't reliable enough.
If you need such functionality, I'd recommend trying [hlibcpuid](https://github.com/dtaskoff/hlibcpuid).
| Add a link to hackage in the readme | Add a link to hackage in the readme | Markdown | mit | ChaosGroup/system-info | markdown | ## Code Before:
A small library for getting the name of the OS.
__NOTE__: the library used to give information about CPUs, as well. However, it wasn't reliable enough.
If you need such functionality, I'd recommend trying [hlibcpuid](https://github.com/dtaskoff/hlibcpuid).
## Instruction:
Add a link to hackage in the readme
## Code After:
[](https://hackage.haskell.org/package/system-info)
A small library for getting the name of the OS.
__NOTE__: the library used to give information about CPUs, as well. However, it wasn't reliable enough.
If you need such functionality, I'd recommend trying [hlibcpuid](https://github.com/dtaskoff/hlibcpuid).
| +
+ [](https://hackage.haskell.org/package/system-info)
+
A small library for getting the name of the OS.
__NOTE__: the library used to give information about CPUs, as well. However, it wasn't reliable enough.
If you need such functionality, I'd recommend trying [hlibcpuid](https://github.com/dtaskoff/hlibcpuid). | 3 | 0.75 | 3 | 0 |
192623eb807ff5e56d464516b4ada6170e9c91b3 | scripts/performActualInstallAndFixLinks.sh | scripts/performActualInstallAndFixLinks.sh |
set -e
./performDownload.sh
./performBuild.sh
./fixupSymlinks.sh
|
set -e
./scripts/performDownload.sh
./scripts/performBuild.sh
./scripts/fixupSymlinks.sh
| Fix master - use correct directories for scripts | Fix master - use correct directories for scripts
| Shell | mit | reasonml/reason-cli | shell | ## Code Before:
set -e
./performDownload.sh
./performBuild.sh
./fixupSymlinks.sh
## Instruction:
Fix master - use correct directories for scripts
## Code After:
set -e
./scripts/performDownload.sh
./scripts/performBuild.sh
./scripts/fixupSymlinks.sh
|
set -e
- ./performDownload.sh
+ ./scripts/performDownload.sh
? ++++++++
- ./performBuild.sh
+ ./scripts/performBuild.sh
? ++++++++
- ./fixupSymlinks.sh
+ ./scripts/fixupSymlinks.sh
? ++++++++
| 6 | 1 | 3 | 3 |
9ad752239a8e07f50e4b4ef5f3df726897d833be | files/deploy-hook.sh | files/deploy-hook.sh | set -x
# Construct PFX file for new cert if needed
if [ "$PFX_EXPORT" = "true" ]; then
openssl pkcs12 -export \
-out $RENEWED_LINEAGE/cert.pfx \
-inkey $RENEWED_LINEAGE/privkey.pem \
-in $RENEWED_LINEAGE/cert.pem \
-certfile $RENEWED_LINEAGE/chain.pem \
-password pass:$PFX_EXPORT_PASSPHRASE
fi
# Synchronize mode and user/group for new certificate files
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive}
| if [ "$PFX_EXPORT" = "true" ]; then
openssl pkcs12 -export \
-out $RENEWED_LINEAGE/cert.pfx \
-inkey $RENEWED_LINEAGE/privkey.pem \
-in $RENEWED_LINEAGE/cert.pem \
-certfile $RENEWED_LINEAGE/chain.pem \
-password pass:$PFX_EXPORT_PASSPHRASE
fi
# Synchronize mode and user/group for new certificate files
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive}
| Change space, not well interprated by sh | Change space, not well interprated by sh
| Shell | mit | adferrand/docker-letsencrypt-dns | shell | ## Code Before:
set -x
# Construct PFX file for new cert if needed
if [ "$PFX_EXPORT" = "true" ]; then
openssl pkcs12 -export \
-out $RENEWED_LINEAGE/cert.pfx \
-inkey $RENEWED_LINEAGE/privkey.pem \
-in $RENEWED_LINEAGE/cert.pem \
-certfile $RENEWED_LINEAGE/chain.pem \
-password pass:$PFX_EXPORT_PASSPHRASE
fi
# Synchronize mode and user/group for new certificate files
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive}
## Instruction:
Change space, not well interprated by sh
## Code After:
if [ "$PFX_EXPORT" = "true" ]; then
openssl pkcs12 -export \
-out $RENEWED_LINEAGE/cert.pfx \
-inkey $RENEWED_LINEAGE/privkey.pem \
-in $RENEWED_LINEAGE/cert.pem \
-certfile $RENEWED_LINEAGE/chain.pem \
-password pass:$PFX_EXPORT_PASSPHRASE
fi
# Synchronize mode and user/group for new certificate files
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive}
| - set -x
-
- # Construct PFX file for new cert if needed
if [ "$PFX_EXPORT" = "true" ]; then
openssl pkcs12 -export \
-out $RENEWED_LINEAGE/cert.pfx \
-inkey $RENEWED_LINEAGE/privkey.pem \
-in $RENEWED_LINEAGE/cert.pem \
-certfile $RENEWED_LINEAGE/chain.pem \
-password pass:$PFX_EXPORT_PASSPHRASE
fi
# Synchronize mode and user/group for new certificate files
- find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
? ^
+ find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d -exec chmod "$CERTS_DIRS_MODE" {} +
? ^
- find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
? ^
+ find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f -exec chmod "$CERTS_FILES_MODE" {} +
? ^
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} | 7 | 0.4375 | 2 | 5 |
d38652586fde7f7b5a443c36829e2ee739024425 | .travis.yml | .travis.yml | ---
language: python
python: "2.7"
matrix:
include:
- env: COMMAND=test-ansible1
- env: COMMAND=test-latest
- env: COMMAND=test-devel
script:
- make $COMMAND
| ---
language: python
matrix:
include:
- python: "2.7"
env: COMMAND=test-ansible1
- python: "2.7"
env: COMMAND=test-latest
- python: "2.7"
env: COMMAND=test-devel
script:
- make $COMMAND
| Move python version to matrix | Move python version to matrix
| YAML | mit | nsg/ansible-inventory,nsg/ansible-inventory | yaml | ## Code Before:
---
language: python
python: "2.7"
matrix:
include:
- env: COMMAND=test-ansible1
- env: COMMAND=test-latest
- env: COMMAND=test-devel
script:
- make $COMMAND
## Instruction:
Move python version to matrix
## Code After:
---
language: python
matrix:
include:
- python: "2.7"
env: COMMAND=test-ansible1
- python: "2.7"
env: COMMAND=test-latest
- python: "2.7"
env: COMMAND=test-devel
script:
- make $COMMAND
| ---
language: python
- python: "2.7"
matrix:
include:
+ - python: "2.7"
- - env: COMMAND=test-ansible1
? ^
+ env: COMMAND=test-ansible1
? ^
+ - python: "2.7"
- - env: COMMAND=test-latest
? ^
+ env: COMMAND=test-latest
? ^
+ - python: "2.7"
- - env: COMMAND=test-devel
? ^
+ env: COMMAND=test-devel
? ^
script:
- make $COMMAND | 10 | 0.769231 | 6 | 4 |
4c7f36e6a5f277b1c84d665edb279476a9e15063 | src/pyop/exceptions.py | src/pyop/exceptions.py | from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier(ValueError):
pass
class InvalidScope(ValueError):
pass
class InvalidClientAuthentication(ValueError):
pass
class InvalidAuthenticationRequest(ValueError):
def __init__(self, message, parsed_request, oauth_error=None):
super().__init__(message)
self.request = parsed_request
self.oauth_error = oauth_error
def to_error_url(self):
redirect_uri = self.request.get('redirect_uri')
if redirect_uri and self.oauth_error:
error_resp = ErrorResponse(error=self.oauth_error, error_message=str(self))
return error_resp.request(redirect_uri, should_fragment_encode(self.request))
return None
class AuthorizationError(Exception):
pass
class InvalidTokenRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidUserinfoRequest(ValueError):
pass
class InvalidClientRegistrationRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
| import json
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier(ValueError):
pass
class InvalidScope(ValueError):
pass
class InvalidClientAuthentication(ValueError):
pass
class InvalidAuthenticationRequest(ValueError):
def __init__(self, message, parsed_request, oauth_error=None):
super().__init__(message)
self.request = parsed_request
self.oauth_error = oauth_error
def to_error_url(self):
redirect_uri = self.request.get('redirect_uri')
if redirect_uri and self.oauth_error:
error_resp = ErrorResponse(error=self.oauth_error, error_message=str(self))
return error_resp.request(redirect_uri, should_fragment_encode(self.request))
return None
class AuthorizationError(Exception):
pass
class InvalidTokenRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidUserinfoRequest(ValueError):
pass
class InvalidClientRegistrationRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
def to_json(self):
error = {'error': self.oauth_error, 'error_description': str(self)}
return json.dumps(error)
| Add JSON convenience to InvalidRegistrationRequest. | Add JSON convenience to InvalidRegistrationRequest.
| Python | apache-2.0 | its-dirg/pyop | python | ## Code Before:
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier(ValueError):
pass
class InvalidScope(ValueError):
pass
class InvalidClientAuthentication(ValueError):
pass
class InvalidAuthenticationRequest(ValueError):
def __init__(self, message, parsed_request, oauth_error=None):
super().__init__(message)
self.request = parsed_request
self.oauth_error = oauth_error
def to_error_url(self):
redirect_uri = self.request.get('redirect_uri')
if redirect_uri and self.oauth_error:
error_resp = ErrorResponse(error=self.oauth_error, error_message=str(self))
return error_resp.request(redirect_uri, should_fragment_encode(self.request))
return None
class AuthorizationError(Exception):
pass
class InvalidTokenRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidUserinfoRequest(ValueError):
pass
class InvalidClientRegistrationRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
## Instruction:
Add JSON convenience to InvalidRegistrationRequest.
## Code After:
import json
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier(ValueError):
pass
class InvalidScope(ValueError):
pass
class InvalidClientAuthentication(ValueError):
pass
class InvalidAuthenticationRequest(ValueError):
def __init__(self, message, parsed_request, oauth_error=None):
super().__init__(message)
self.request = parsed_request
self.oauth_error = oauth_error
def to_error_url(self):
redirect_uri = self.request.get('redirect_uri')
if redirect_uri and self.oauth_error:
error_resp = ErrorResponse(error=self.oauth_error, error_message=str(self))
return error_resp.request(redirect_uri, should_fragment_encode(self.request))
return None
class AuthorizationError(Exception):
pass
class InvalidTokenRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidUserinfoRequest(ValueError):
pass
class InvalidClientRegistrationRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
def to_json(self):
error = {'error': self.oauth_error, 'error_description': str(self)}
return json.dumps(error)
| + import json
+
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier(ValueError):
pass
class InvalidScope(ValueError):
pass
class InvalidClientAuthentication(ValueError):
pass
class InvalidAuthenticationRequest(ValueError):
def __init__(self, message, parsed_request, oauth_error=None):
super().__init__(message)
self.request = parsed_request
self.oauth_error = oauth_error
def to_error_url(self):
redirect_uri = self.request.get('redirect_uri')
if redirect_uri and self.oauth_error:
error_resp = ErrorResponse(error=self.oauth_error, error_message=str(self))
return error_resp.request(redirect_uri, should_fragment_encode(self.request))
return None
class AuthorizationError(Exception):
pass
class InvalidTokenRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
class InvalidUserinfoRequest(ValueError):
pass
class InvalidClientRegistrationRequest(ValueError):
def __init__(self, message, oauth_error='invalid_request'):
super().__init__(message)
self.oauth_error = oauth_error
+
+ def to_json(self):
+ error = {'error': self.oauth_error, 'error_description': str(self)}
+ return json.dumps(error) | 6 | 0.090909 | 6 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.