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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0265f778d0f907e488a7e9457a1a5d11fa33abcc | setup.cfg | setup.cfg | [nosetests]
where = celery/tests
cover3-branch = 1
cover3-html = 1
cover3-package = celery
cover3-exclude = celery
celery.conf
celery.tests.*
celery.bin.celeryev
celery.task
celery.platform
celery.utils.patch
celery.utils.compat
celery.utils.mail
celery.utils.functional
celery.utils.dispatch*
celery.db.a805d4bd
celery.contrib*
celery.concurrency.threads
celery.concurrency.processes.pool
celery.backends.mongodb
celery.backends.tyrant
celery.backends.pyredis
celery.backends.amqp
[build_sphinx]
source-dir = docs/
build-dir = docs/.build
all_files = 1
[upload_sphinx]
upload-dir = docs/.build/html
[bdist_rpm]
requires = python-uuid
python-importlib
python-multiprocessing==2.6.2.1
python-dateutil
python-anyjson
python-carrot>=0.10.4
| [nosetests]
where = celery/tests
cover3-branch = 1
cover3-html = 1
cover3-package = celery
cover3-exclude = celery
celery.conf
celery.tests.*
celery.bin.celeryev
celery.task
celery.platform
celery.utils.patch
celery.utils.compat
celery.utils.mail
celery.utils.functional
celery.utils.dispatch*
celery.db.a805d4bd
celery.contrib*
celery.concurrency.threads
celery.concurrency.processes.pool
celery.backends.mongodb
celery.backends.tyrant
celery.backends.pyredis
celery.backends.amqp
[build_sphinx]
source-dir = docs/
build-dir = docs/.build
all_files = 1
[upload_sphinx]
upload-dir = docs/.build/html
[bdist_rpm]
requires = uuid
importlib
multiprocessing == 2.6.2.1
python-dateutil
anyjson
carrot >= 0.10.5
mailer
SQLAlchemy
pyparsing
| Update dependencies for building RPM's. | Update dependencies for building RPM's.
| INI | bsd-3-clause | frac/celery,ask/celery,WoLpH/celery,WoLpH/celery,cbrepo/celery,frac/celery,cbrepo/celery,ask/celery | ini | ## Code Before:
[nosetests]
where = celery/tests
cover3-branch = 1
cover3-html = 1
cover3-package = celery
cover3-exclude = celery
celery.conf
celery.tests.*
celery.bin.celeryev
celery.task
celery.platform
celery.utils.patch
celery.utils.compat
celery.utils.mail
celery.utils.functional
celery.utils.dispatch*
celery.db.a805d4bd
celery.contrib*
celery.concurrency.threads
celery.concurrency.processes.pool
celery.backends.mongodb
celery.backends.tyrant
celery.backends.pyredis
celery.backends.amqp
[build_sphinx]
source-dir = docs/
build-dir = docs/.build
all_files = 1
[upload_sphinx]
upload-dir = docs/.build/html
[bdist_rpm]
requires = python-uuid
python-importlib
python-multiprocessing==2.6.2.1
python-dateutil
python-anyjson
python-carrot>=0.10.4
## Instruction:
Update dependencies for building RPM's.
## Code After:
[nosetests]
where = celery/tests
cover3-branch = 1
cover3-html = 1
cover3-package = celery
cover3-exclude = celery
celery.conf
celery.tests.*
celery.bin.celeryev
celery.task
celery.platform
celery.utils.patch
celery.utils.compat
celery.utils.mail
celery.utils.functional
celery.utils.dispatch*
celery.db.a805d4bd
celery.contrib*
celery.concurrency.threads
celery.concurrency.processes.pool
celery.backends.mongodb
celery.backends.tyrant
celery.backends.pyredis
celery.backends.amqp
[build_sphinx]
source-dir = docs/
build-dir = docs/.build
all_files = 1
[upload_sphinx]
upload-dir = docs/.build/html
[bdist_rpm]
requires = uuid
importlib
multiprocessing == 2.6.2.1
python-dateutil
anyjson
carrot >= 0.10.5
mailer
SQLAlchemy
pyparsing
| [nosetests]
where = celery/tests
cover3-branch = 1
cover3-html = 1
cover3-package = celery
cover3-exclude = celery
celery.conf
celery.tests.*
celery.bin.celeryev
celery.task
celery.platform
celery.utils.patch
celery.utils.compat
celery.utils.mail
celery.utils.functional
celery.utils.dispatch*
celery.db.a805d4bd
celery.contrib*
celery.concurrency.threads
celery.concurrency.processes.pool
celery.backends.mongodb
celery.backends.tyrant
celery.backends.pyredis
celery.backends.amqp
[build_sphinx]
source-dir = docs/
build-dir = docs/.build
all_files = 1
[upload_sphinx]
upload-dir = docs/.build/html
[bdist_rpm]
- requires = python-uuid
? -------
+ requires = uuid
- python-importlib
? -------
+ importlib
- python-multiprocessing==2.6.2.1
? -------
+ multiprocessing == 2.6.2.1
? + +
python-dateutil
- python-anyjson
? -------
+ anyjson
- python-carrot>=0.10.4
? ------- ^
+ carrot >= 0.10.5
? + + ^
+ mailer
+ SQLAlchemy
+ pyparsing | 13 | 0.325 | 8 | 5 |
d2a98b4a22d8ad7d1e28821909192e03ab14c539 | src/jsx/components/navigation/PrimaryNav.jsx | src/jsx/components/navigation/PrimaryNav.jsx | /**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
<NavGroup className="FlatNav-group">
<a href="https://twitter.com/voxeldavid">Twitter</a>
<a href="https://github.com/vocksel">GitHub</a>
</NavGroup>
</nav>
);
}
}
| /**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
</nav>
);
}
}
| Remove off-site links from the navigation | Remove off-site links from the navigation
These have been worked into the introduction and no longer need to be linked in the nav.
| JSX | mit | vocksel/my-website,VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website | jsx | ## Code Before:
/**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
<NavGroup className="FlatNav-group">
<a href="https://twitter.com/voxeldavid">Twitter</a>
<a href="https://github.com/vocksel">GitHub</a>
</NavGroup>
</nav>
);
}
}
## Instruction:
Remove off-site links from the navigation
These have been worked into the introduction and no longer need to be linked in the nav.
## Code After:
/**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
</nav>
);
}
}
| /**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
-
- <NavGroup className="FlatNav-group">
- <a href="https://twitter.com/voxeldavid">Twitter</a>
- <a href="https://github.com/vocksel">GitHub</a>
- </NavGroup>
</nav>
);
}
} | 5 | 0.178571 | 0 | 5 |
3b3e5d81c1c115ac347c2dafb13571d518a5adf8 | breezy_rails/lib/tasks/install.rake | breezy_rails/lib/tasks/install.rake | namespace :breezy do
desc "Verifies if any version of Yarn is installed"
task :verify_yarn do
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
$stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
desc "Verifies webpacker has been installed"
task "verify_webpacker" do
begin
require "webpacker/configuration"
rescue LoadError
$stderr.puts "Breezy's web install requires webpacker!"
$stderr.puts "https://github.com/rails/webpacker#installation"
$stderr.puts "Exiting!" && exit!
end
end
namespace :install do
desc "Install everything needed for breezy web"
task 'web' => ["breezy:verify_webpacker", "webpacker:verify_install"] do
template = File.expand_path("../install/web.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
desc "Install everything needed for breezy mobile"
task 'mobile' => ["breezy:verify_yarn"] do
template = File.expand_path("../install/mobile.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
end
end
| namespace :breezy do
desc "Verifies if any version of Yarn is installed"
task :verify_yarn do
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
$stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
desc "Verifies webpacker has been installed"
task "verify_webpacker" do
begin
require "webpacker/configuration"
rescue LoadError
$stderr.puts "Breezy's web install requires webpacker!"
$stderr.puts "https://github.com/rails/webpacker#installation"
$stderr.puts "Exiting!" && exit!
end
end
namespace :install do
desc "Install everything needed for breezy web"
task 'web' => ["breezy:verify_webpacker", "webpacker:verify_install"] do
template = File.expand_path("../install/web.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
end
end
| Remove old react native task | Remove old react native task
| Ruby | mit | jho406/Relax,jho406/Breezy,jho406/Breezy,jho406/Relax,jho406/Relax,jho406/Breezy | ruby | ## Code Before:
namespace :breezy do
desc "Verifies if any version of Yarn is installed"
task :verify_yarn do
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
$stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
desc "Verifies webpacker has been installed"
task "verify_webpacker" do
begin
require "webpacker/configuration"
rescue LoadError
$stderr.puts "Breezy's web install requires webpacker!"
$stderr.puts "https://github.com/rails/webpacker#installation"
$stderr.puts "Exiting!" && exit!
end
end
namespace :install do
desc "Install everything needed for breezy web"
task 'web' => ["breezy:verify_webpacker", "webpacker:verify_install"] do
template = File.expand_path("../install/web.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
desc "Install everything needed for breezy mobile"
task 'mobile' => ["breezy:verify_yarn"] do
template = File.expand_path("../install/mobile.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
end
end
## Instruction:
Remove old react native task
## Code After:
namespace :breezy do
desc "Verifies if any version of Yarn is installed"
task :verify_yarn do
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
$stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
desc "Verifies webpacker has been installed"
task "verify_webpacker" do
begin
require "webpacker/configuration"
rescue LoadError
$stderr.puts "Breezy's web install requires webpacker!"
$stderr.puts "https://github.com/rails/webpacker#installation"
$stderr.puts "Exiting!" && exit!
end
end
namespace :install do
desc "Install everything needed for breezy web"
task 'web' => ["breezy:verify_webpacker", "webpacker:verify_install"] do
template = File.expand_path("../install/web.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
end
end
| namespace :breezy do
desc "Verifies if any version of Yarn is installed"
task :verify_yarn do
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
$stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
desc "Verifies webpacker has been installed"
task "verify_webpacker" do
begin
require "webpacker/configuration"
rescue LoadError
$stderr.puts "Breezy's web install requires webpacker!"
$stderr.puts "https://github.com/rails/webpacker#installation"
$stderr.puts "Exiting!" && exit!
end
end
namespace :install do
desc "Install everything needed for breezy web"
task 'web' => ["breezy:verify_webpacker", "webpacker:verify_install"] do
template = File.expand_path("../install/web.rb", __dir__)
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
end
-
- desc "Install everything needed for breezy mobile"
- task 'mobile' => ["breezy:verify_yarn"] do
- template = File.expand_path("../install/mobile.rb", __dir__)
- exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{template}"
- end
end
end
| 6 | 0.157895 | 0 | 6 |
94547967344c9ddea6ba47ccc4233cffd59eb9f3 | README.md | README.md |
This program supports two modes: *speaker* and *listener*.
## Setup
Set AWS environment variables:
```
export AWS_REGION=us-west-2
export AWS_ACCESS_KEY_ID=<get from Philip>
export AWS_SECRET_ACCESS_KEY=<get from Philip>
```
Install dependencies: `bundle`
## Run as speaker
```
ruby queue.rb speaker
```
## Run as listener
```
ruby queue.rb listener
```
|
This program supports two modes: *speaker* and *listener*.
## Setup
Set AWS environment variables:
```
export AWS_REGION=us-west-2
export AWS_ACCESS_KEY_ID=<get from Philip>
export AWS_SECRET_ACCESS_KEY=<get from Philip>
```
Install dependencies: `bundle`
## Run as speaker
```
ruby queue.rb speaker
```
## Run as listener
```
ruby queue.rb listener
```
## References
* [AWS SDK for Ruby](https://aws.amazon.com/sdk-for-ruby/)
* [AWS SDK for Ruby - SQS client API](http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS.html
| Add references section to readme | Add references section to readme
| Markdown | mit | philipmw/ada-messaging,brittinator/ada-messaging | markdown | ## Code Before:
This program supports two modes: *speaker* and *listener*.
## Setup
Set AWS environment variables:
```
export AWS_REGION=us-west-2
export AWS_ACCESS_KEY_ID=<get from Philip>
export AWS_SECRET_ACCESS_KEY=<get from Philip>
```
Install dependencies: `bundle`
## Run as speaker
```
ruby queue.rb speaker
```
## Run as listener
```
ruby queue.rb listener
```
## Instruction:
Add references section to readme
## Code After:
This program supports two modes: *speaker* and *listener*.
## Setup
Set AWS environment variables:
```
export AWS_REGION=us-west-2
export AWS_ACCESS_KEY_ID=<get from Philip>
export AWS_SECRET_ACCESS_KEY=<get from Philip>
```
Install dependencies: `bundle`
## Run as speaker
```
ruby queue.rb speaker
```
## Run as listener
```
ruby queue.rb listener
```
## References
* [AWS SDK for Ruby](https://aws.amazon.com/sdk-for-ruby/)
* [AWS SDK for Ruby - SQS client API](http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS.html
|
This program supports two modes: *speaker* and *listener*.
## Setup
Set AWS environment variables:
```
export AWS_REGION=us-west-2
export AWS_ACCESS_KEY_ID=<get from Philip>
export AWS_SECRET_ACCESS_KEY=<get from Philip>
```
Install dependencies: `bundle`
## Run as speaker
```
ruby queue.rb speaker
```
## Run as listener
```
ruby queue.rb listener
```
+
+ ## References
+
+ * [AWS SDK for Ruby](https://aws.amazon.com/sdk-for-ruby/)
+ * [AWS SDK for Ruby - SQS client API](http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS.html
+ | 6 | 0.230769 | 6 | 0 |
df6ca2954be1b24e38d4c3d5962909efa92dbcae | phpunit.xml | phpunit.xml | <phpunit bootstrap="tests/bootstrap.php" colors="true" stderr="true">
<testsuites>
<testsuite name="Collection">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-text" target="php://stdout"/>
</logging>
<filter>
<whitelist >
<file>src/Collection/Collection.php</file>
<file>src/Collection/Util/Helpers.php</file>
<file>src/Collection/Util/Arr.php</file>
<file>src/Collection/Util/Macroable.php</file>
</whitelist>
</filter>
</phpunit>
| <phpunit bootstrap="tests/bootstrap.php" colors="true" stderr="true">
<testsuites>
<testsuite name="Collection">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-text" target="php://stdout"/>
</logging>
<filter>
<whitelist >
<file>src/Collection.php</file>
<file>src/Tools/Helpers.php</file>
<file>src/Tools/Arr.php</file>
<file>src/Tools/Macroable.php</file>
</whitelist>
</filter>
</phpunit>
| Fix files for code coverage | Fix files for code coverage
| XML | mit | webmailcontatos/Collection-PHP | xml | ## Code Before:
<phpunit bootstrap="tests/bootstrap.php" colors="true" stderr="true">
<testsuites>
<testsuite name="Collection">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-text" target="php://stdout"/>
</logging>
<filter>
<whitelist >
<file>src/Collection/Collection.php</file>
<file>src/Collection/Util/Helpers.php</file>
<file>src/Collection/Util/Arr.php</file>
<file>src/Collection/Util/Macroable.php</file>
</whitelist>
</filter>
</phpunit>
## Instruction:
Fix files for code coverage
## Code After:
<phpunit bootstrap="tests/bootstrap.php" colors="true" stderr="true">
<testsuites>
<testsuite name="Collection">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-text" target="php://stdout"/>
</logging>
<filter>
<whitelist >
<file>src/Collection.php</file>
<file>src/Tools/Helpers.php</file>
<file>src/Tools/Arr.php</file>
<file>src/Tools/Macroable.php</file>
</whitelist>
</filter>
</phpunit>
| <phpunit bootstrap="tests/bootstrap.php" colors="true" stderr="true">
<testsuites>
<testsuite name="Collection">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-text" target="php://stdout"/>
</logging>
<filter>
<whitelist >
- <file>src/Collection/Collection.php</file>
- <file>src/Collection/Util/Helpers.php</file>
- <file>src/Collection/Util/Arr.php</file>
? ---------
+ <file>src/Collection.php</file>
+ <file>src/Tools/Helpers.php</file>
+ <file>src/Tools/Arr.php</file>
- <file>src/Collection/Util/Macroable.php</file>
? ^ ^^^^^^^^^^^^
+ <file>src/Tools/Macroable.php</file>
? ^^ ^
</whitelist>
</filter>
</phpunit> | 8 | 0.4 | 4 | 4 |
bdd86613a5c949c59ae7348150e21b793ef7d832 | test/resource.js | test/resource.js | 'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should initialize a known Resource', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
assert.ok(test);
} catch (E) {
console.error(E);
}
await store.close();
});
});
| 'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should initialize a known Resource', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
assert.ok(test);
} catch (E) {
console.error(E);
}
await store.close();
});
it('should call query() smoothly', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
let results = await resource.query();
assert.ok(test);
assert.ok(results);
assert.equal(results.length, 1);
} catch (E) {
console.error(E);
}
await store.close();
});
});
| Add query() test for Resource | Add query() test for Resource
| JavaScript | mit | martindale/fabric,martindale/fabric,martindale/fabric | javascript | ## Code Before:
'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should initialize a known Resource', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
assert.ok(test);
} catch (E) {
console.error(E);
}
await store.close();
});
});
## Instruction:
Add query() test for Resource
## Code After:
'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should initialize a known Resource', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
assert.ok(test);
} catch (E) {
console.error(E);
}
await store.close();
});
it('should call query() smoothly', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
let results = await resource.query();
assert.ok(test);
assert.ok(results);
assert.equal(results.length, 1);
} catch (E) {
console.error(E);
}
await store.close();
});
});
| 'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should initialize a known Resource', async function () {
let resource = new Fabric.Resource(widget);
let store = new Fabric.Store();
await store.open();
try {
resource.trust(store);
let test = await resource.create({
name: 'Wobbler'
});
assert.ok(test);
} catch (E) {
console.error(E);
}
await store.close();
});
+
+ it('should call query() smoothly', async function () {
+ let resource = new Fabric.Resource(widget);
+ let store = new Fabric.Store();
+
+ await store.open();
+
+ try {
+ resource.trust(store);
+ let test = await resource.create({
+ name: 'Wobbler'
+ });
+
+ let results = await resource.query();
+
+ assert.ok(test);
+ assert.ok(results);
+
+ assert.equal(results.length, 1);
+ } catch (E) {
+ console.error(E);
+ }
+
+ await store.close();
+ });
}); | 25 | 0.735294 | 25 | 0 |
0d7946cb48d1f619b055d44eb178e54396cdabf4 | src/AppBundle/Resources/assets/scss/digideps/_autosave.scss | src/AppBundle/Resources/assets/scss/digideps/_autosave.scss | @include bold-27();
@include inline-block();
color: $turquoise;
padding-right: 20px;
padding-left: 40px;
text-align: left;
width: 130px;
&[data-status="saved"] {
background: top left url("images/icons/savetick.png") no-repeat;
@include device-pixel-ratio() {
background: top left url("images/icons/savetick_2x.png") no-repeat;
background-size: 35px 29px;
}
}
&[data-status="saving"] {
background: top left url("images/icons/savespin.png") no-repeat;
@include device-pixel-ratio() {
background: top left url("images/icons/savespin_2x.png") no-repeat;
background-size: 24px 26px;
}
}
&[data-status="notsaved"] {
background: top left url("images/icons/icon-notification-yellow-24.png") no-repeat;
color: $yellow;
}
}
| @include bold-27();
@include inline-block();
color: $turquoise;
padding-right: 20px;
padding-left: 40px;
text-align: left;
width: 130px;
min-height: 29px;
&[data-status="saved"] {
background: top left url("images/icons/savetick.png") no-repeat;
background-size: 35px 29px;
@include media(mobile) {
background-size: 26.5px 22px;
}
@include device-pixel-ratio() {
background: top left url("images/icons/savetick_2x.png") no-repeat;
}
}
&[data-status="saving"] {
background: top left url("images/icons/savespin.png") no-repeat;
background-size: 24px 26px;
@include media(mobile) {
background-size: 20px 22px;
}
@include device-pixel-ratio() {
background: top left url("images/icons/savespin_2x.png") no-repeat;
}
}
&[data-status="notsaved"] {
background: top left url("images/icons/icon-notification-yellow-24.png") no-repeat;
color: $yellow;
}
}
| Fix icons for autosave on small devices | Fix icons for autosave on small devices
| SCSS | mit | ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client | scss | ## Code Before:
@include bold-27();
@include inline-block();
color: $turquoise;
padding-right: 20px;
padding-left: 40px;
text-align: left;
width: 130px;
&[data-status="saved"] {
background: top left url("images/icons/savetick.png") no-repeat;
@include device-pixel-ratio() {
background: top left url("images/icons/savetick_2x.png") no-repeat;
background-size: 35px 29px;
}
}
&[data-status="saving"] {
background: top left url("images/icons/savespin.png") no-repeat;
@include device-pixel-ratio() {
background: top left url("images/icons/savespin_2x.png") no-repeat;
background-size: 24px 26px;
}
}
&[data-status="notsaved"] {
background: top left url("images/icons/icon-notification-yellow-24.png") no-repeat;
color: $yellow;
}
}
## Instruction:
Fix icons for autosave on small devices
## Code After:
@include bold-27();
@include inline-block();
color: $turquoise;
padding-right: 20px;
padding-left: 40px;
text-align: left;
width: 130px;
min-height: 29px;
&[data-status="saved"] {
background: top left url("images/icons/savetick.png") no-repeat;
background-size: 35px 29px;
@include media(mobile) {
background-size: 26.5px 22px;
}
@include device-pixel-ratio() {
background: top left url("images/icons/savetick_2x.png") no-repeat;
}
}
&[data-status="saving"] {
background: top left url("images/icons/savespin.png") no-repeat;
background-size: 24px 26px;
@include media(mobile) {
background-size: 20px 22px;
}
@include device-pixel-ratio() {
background: top left url("images/icons/savespin_2x.png") no-repeat;
}
}
&[data-status="notsaved"] {
background: top left url("images/icons/icon-notification-yellow-24.png") no-repeat;
color: $yellow;
}
}
| @include bold-27();
@include inline-block();
color: $turquoise;
padding-right: 20px;
padding-left: 40px;
text-align: left;
width: 130px;
+ min-height: 29px;
&[data-status="saved"] {
background: top left url("images/icons/savetick.png") no-repeat;
+ background-size: 35px 29px;
+
+ @include media(mobile) {
+ background-size: 26.5px 22px;
+ }
@include device-pixel-ratio() {
background: top left url("images/icons/savetick_2x.png") no-repeat;
- background-size: 35px 29px;
}
}
&[data-status="saving"] {
background: top left url("images/icons/savespin.png") no-repeat;
+ background-size: 24px 26px;
+
+ @include media(mobile) {
+ background-size: 20px 22px;
+ }
@include device-pixel-ratio() {
background: top left url("images/icons/savespin_2x.png") no-repeat;
- background-size: 24px 26px;
}
}
&[data-status="notsaved"] {
background: top left url("images/icons/icon-notification-yellow-24.png") no-repeat;
color: $yellow;
}
} | 13 | 0.393939 | 11 | 2 |
dc2c9cbc3f7105c6f491490aca584760b256f642 | README.md | README.md |
Landing page for JSS. Build with webpack, react, jss and some other cool things :)
[Current link](https://typical000.github.io/jss-landing/)
#### TODO:
- Change links url like `href="./performance.md"` to absolute path in all repos, connected with this landing page.
- Fix internal links in docs. For e.g. https://raw.githubusercontent.com/cssinjs/jss/master/docs/js-api.md - first 3 links are not working.
- We need to do something with examples section. It looks like something horrible. Maybe just add styles, similar to current JSS landing site.
- Walk throught all pages and change headings to right ones (e.g. on some pages there are a lot of H2)
- Remove from plugin pages JSS logo. Is inutile widget. We know that is JSS :) |
Landing page for JSS. Build with webpack, react, jss and some other cool things :)
[Current link](https://typical000.github.io/jss-landing/)
| Remove unused text in readme | Remove unused text in readme
| Markdown | mit | cssinjs/cssinjs | markdown | ## Code Before:
Landing page for JSS. Build with webpack, react, jss and some other cool things :)
[Current link](https://typical000.github.io/jss-landing/)
#### TODO:
- Change links url like `href="./performance.md"` to absolute path in all repos, connected with this landing page.
- Fix internal links in docs. For e.g. https://raw.githubusercontent.com/cssinjs/jss/master/docs/js-api.md - first 3 links are not working.
- We need to do something with examples section. It looks like something horrible. Maybe just add styles, similar to current JSS landing site.
- Walk throught all pages and change headings to right ones (e.g. on some pages there are a lot of H2)
- Remove from plugin pages JSS logo. Is inutile widget. We know that is JSS :)
## Instruction:
Remove unused text in readme
## Code After:
Landing page for JSS. Build with webpack, react, jss and some other cool things :)
[Current link](https://typical000.github.io/jss-landing/)
|
Landing page for JSS. Build with webpack, react, jss and some other cool things :)
[Current link](https://typical000.github.io/jss-landing/)
-
- #### TODO:
-
- - Change links url like `href="./performance.md"` to absolute path in all repos, connected with this landing page.
- - Fix internal links in docs. For e.g. https://raw.githubusercontent.com/cssinjs/jss/master/docs/js-api.md - first 3 links are not working.
- - We need to do something with examples section. It looks like something horrible. Maybe just add styles, similar to current JSS landing site.
- - Walk throught all pages and change headings to right ones (e.g. on some pages there are a lot of H2)
- - Remove from plugin pages JSS logo. Is inutile widget. We know that is JSS :) | 8 | 0.666667 | 0 | 8 |
5255580cee0cd641038e04062c908081c626606d | application/views/scripts/index/index.phtml | application/views/scripts/index/index.phtml | <style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div> | <h2>Index Index</h2>
| Remove placeholder text in Index Index. | Remove placeholder text in Index Index.
| HTML+PHP | bsd-3-clause | bradley-holt/postr | html+php | ## Code Before:
<style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div>
## Instruction:
Remove placeholder text in Index Index.
## Code After:
<h2>Index Index</h2>
| + <h2>Index Index</h2>
- <style>
- a:link,
- a:visited
- {
- color: #0398CA;
- }
-
- span#zf-name
- {
- color: #91BE3F;
- }
-
- div#welcome
- {
- color: #FFFFFF;
- background-image: url(http://framework.zend.com/images/bkg_header.jpg);
- width: 600px;
- height: 400px;
- border: 2px solid #444444;
- overflow: hidden;
- text-align: center;
- }
-
- div#more-information
- {
- background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
- height: 100%;
- }
- </style>
- <div id="welcome">
- <h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
-
- <h3>This is your project's main page</h3>
-
- <div id="more-information">
- <p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
- <p>
- Helpful Links: <br />
- <a href="http://framework.zend.com/">Zend Framework Website</a> |
- <a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
- </p>
- </div>
- </div> | 44 | 1.023256 | 1 | 43 |
c402419a1bc44d106d19f5fba1f6d33967607064 | app/controllers/layout.js | app/controllers/layout.js | angular.module('mainApp').controller('mainCtrl', function ($scope, $http) {
if ($scope.loggedIn) {
$scope.organizations = $scope.me.organizations.map(function (organization) {
organization.status = 'not-set';
$http.get('/api/organizations/' + organization._id).success(function (data) {
_.assign(organization, data);
});
return organization;
});
if ($scope.organizations.length === 1) {
$scope.selectCurrentOrganization($scope.organizations[0]);
}
}
});
| angular.module('mainApp').controller('mainCtrl', function ($scope, $http) {
if ($scope.loggedIn) {
$scope.organizations = $scope.me.organizations.map(function (organization) {
organization.status = 'not-set';
$http.get('/api/organizations/' + organization._id).success(function (data) {
_.assign(organization, data);
});
return organization;
});
}
});
| Fix home when user is member of one organization | Fix home when user is member of one organization
| JavaScript | agpl-3.0 | jdesboeufs/geogw-datagouvfr,jdesboeufs/geogw-datagouvfr | javascript | ## Code Before:
angular.module('mainApp').controller('mainCtrl', function ($scope, $http) {
if ($scope.loggedIn) {
$scope.organizations = $scope.me.organizations.map(function (organization) {
organization.status = 'not-set';
$http.get('/api/organizations/' + organization._id).success(function (data) {
_.assign(organization, data);
});
return organization;
});
if ($scope.organizations.length === 1) {
$scope.selectCurrentOrganization($scope.organizations[0]);
}
}
});
## Instruction:
Fix home when user is member of one organization
## Code After:
angular.module('mainApp').controller('mainCtrl', function ($scope, $http) {
if ($scope.loggedIn) {
$scope.organizations = $scope.me.organizations.map(function (organization) {
organization.status = 'not-set';
$http.get('/api/organizations/' + organization._id).success(function (data) {
_.assign(organization, data);
});
return organization;
});
}
});
| angular.module('mainApp').controller('mainCtrl', function ($scope, $http) {
if ($scope.loggedIn) {
$scope.organizations = $scope.me.organizations.map(function (organization) {
organization.status = 'not-set';
$http.get('/api/organizations/' + organization._id).success(function (data) {
_.assign(organization, data);
});
return organization;
});
-
- if ($scope.organizations.length === 1) {
- $scope.selectCurrentOrganization($scope.organizations[0]);
- }
}
}); | 4 | 0.235294 | 0 | 4 |
3060f9cb889acf7ff6ba8de35d20a04d0a8f02ec | src/Menu.js | src/Menu.js | var React = require('react');
var MenuItem = React.createClass({
propTypes: {
active: React.PropTypes.bool,
href: React.PropTypes.string,
className: React.PropTypes.string
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var inner;
if (this.props.href) {
inner = <a href={this.props.href}>{this.props.children}</a>;
} else {
inner = <span>{this.props.children}</span>;
}
return (
<li className={this.props.className}>{inner}</li>
);
}
});
var Menu = React.createClass({
render: function() {
return (
<ul className="menu">
{this.props.children}
</ul>
);
}
});
module.exports = Menu;
module.exports.Item = MenuItem;
| var React = require('react');
var classNames = require('classnames');
var MenuItem = React.createClass({
propTypes: {
active: React.PropTypes.bool,
href: React.PropTypes.string,
className: React.PropTypes.string
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var inner;
var className = classNames(this.props.className || '', {
'active': this.props.active
});
if (this.props.href) {
inner = <a href={this.props.href}>{this.props.children}</a>;
} else {
inner = <span>{this.props.children}</span>;
}
return (
<li className={className}>{inner}</li>
);
}
});
var Menu = React.createClass({
propTypes: {
right: React.PropTypes.bool,
left: React.PropTypes.bool
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var className = classNames('menu', {
'pull-right': this.props.right,
'pull-left': this.props.left
});
return (
<ul className={className}>
{this.props.children}
</ul>
);
}
});
module.exports = Menu;
module.exports.Item = MenuItem;
| Fix menu component with new props | Fix menu component with new props
| JavaScript | apache-2.0 | rlugojr/styleguide,rlugojr/styleguide,GitbookIO/styleguide,GitbookIO/styleguide | javascript | ## Code Before:
var React = require('react');
var MenuItem = React.createClass({
propTypes: {
active: React.PropTypes.bool,
href: React.PropTypes.string,
className: React.PropTypes.string
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var inner;
if (this.props.href) {
inner = <a href={this.props.href}>{this.props.children}</a>;
} else {
inner = <span>{this.props.children}</span>;
}
return (
<li className={this.props.className}>{inner}</li>
);
}
});
var Menu = React.createClass({
render: function() {
return (
<ul className="menu">
{this.props.children}
</ul>
);
}
});
module.exports = Menu;
module.exports.Item = MenuItem;
## Instruction:
Fix menu component with new props
## Code After:
var React = require('react');
var classNames = require('classnames');
var MenuItem = React.createClass({
propTypes: {
active: React.PropTypes.bool,
href: React.PropTypes.string,
className: React.PropTypes.string
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var inner;
var className = classNames(this.props.className || '', {
'active': this.props.active
});
if (this.props.href) {
inner = <a href={this.props.href}>{this.props.children}</a>;
} else {
inner = <span>{this.props.children}</span>;
}
return (
<li className={className}>{inner}</li>
);
}
});
var Menu = React.createClass({
propTypes: {
right: React.PropTypes.bool,
left: React.PropTypes.bool
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var className = classNames('menu', {
'pull-right': this.props.right,
'pull-left': this.props.left
});
return (
<ul className={className}>
{this.props.children}
</ul>
);
}
});
module.exports = Menu;
module.exports.Item = MenuItem;
| var React = require('react');
+ var classNames = require('classnames');
var MenuItem = React.createClass({
propTypes: {
active: React.PropTypes.bool,
href: React.PropTypes.string,
className: React.PropTypes.string
},
getDefaultProps: function() {
return {
active: false,
href: null
};
},
render: function() {
var inner;
+ var className = classNames(this.props.className || '', {
+ 'active': this.props.active
+ });
if (this.props.href) {
inner = <a href={this.props.href}>{this.props.children}</a>;
} else {
inner = <span>{this.props.children}</span>;
}
return (
- <li className={this.props.className}>{inner}</li>
? -----------
+ <li className={className}>{inner}</li>
);
}
});
var Menu = React.createClass({
+ propTypes: {
+ right: React.PropTypes.bool,
+ left: React.PropTypes.bool
+ },
+
+ getDefaultProps: function() {
+ return {
+ active: false,
+ href: null
+ };
+ },
+
render: function() {
+ var className = classNames('menu', {
+ 'pull-right': this.props.right,
+ 'pull-left': this.props.left
+ });
+
return (
- <ul className="menu">
? ^ ^^^
+ <ul className={className}>
? ^^^^^^^^ ^
{this.props.children}
</ul>
);
}
});
module.exports = Menu;
module.exports.Item = MenuItem; | 25 | 0.568182 | 23 | 2 |
68273262368b637b0ac35e1e3dd53c721a4ff069 | lib/tmuxinator.rb | lib/tmuxinator.rb | require 'yaml'
require 'ostruct'
require 'erb'
require 'tmuxinator/helper'
require 'tmuxinator/cli'
require 'tmuxinator/config_writer'
TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/assets/tmux_config.tmux"
module Tmuxinator
end
| require 'yaml'
require 'ostruct'
require 'erb'
require 'tmuxinator/helper'
require 'tmuxinator/cli'
require 'tmuxinator/config_writer'
TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/tmuxinator/assets/tmux_config.tmux"
module Tmuxinator
end
| Fix for improperly set template constant | Fix for improperly set template constant
| Ruby | mit | jasonchaffee/tmuxinator,cinaeco/tmuxinator,marwensaid/tmuxinator,tmuxinator/tmuxinator,cinaeco/tmuxinator,aMoniker/tmuxinator,sachin21/tmuxinator,sideci-sample/sideci-sample-tmuxinator,klaxalk/tmux,marwensaid/tmuxinator,sjfloat/tmuxinator,podung/tmuxinator,podung/tmuxinator,ethagnawl/tmuxinator,magicalbanana/tmuxinator,sideci-sample/sideci-sample-tmuxinator,marwensaid/tmuxinator,guyhughes/tmuxinator,tmuxinator/tmuxinator,sachin21/tmuxinator,marcinmagier/tmuxinator,adamstrickland/tmuxinator,andyw8/tmuxinator,azat/tmuxinator,andyw8/tmuxinator,jasonchaffee/tmuxinator,ethagnawl/tmuxinator,marcinmagier/tmuxinator,guyhughes/tmuxinator,danimad/tmuxinator,jlipps/tmuxinator,pczarn/tmuxinator,guyhughes/tmuxinator,pczarn/tmuxinator,magicalbanana/tmuxinator,magicalbanana/tmuxinator,benizi/tmuxinator,jlipps/tmuxinator,J3RN/tmuxinator,benizi/tmuxinator,pczarn/tmuxinator,azat/tmuxinator,azat/tmuxinator,jasonchaffee/tmuxinator,J3RN/tmuxinator,sjfloat/tmuxinator,cinaeco/tmuxinator,tmuxinator/tmuxinator,sjfloat/tmuxinator,adamstrickland/tmuxinator,aMoniker/tmuxinator,danimad/tmuxinator,klaxalk/tmux,klaxalk/tmux,danimad/tmuxinator,benizi/tmuxinator,J3RN/tmuxinator,adamstrickland/tmuxinator,klaxalk/tmux,podung/tmuxinator,klaxalk/tmux,sachin21/tmuxinator,jlipps/tmuxinator,ethagnawl/tmuxinator,dkastner/tmuxinator,aMoniker/tmuxinator,marcinmagier/tmuxinator | ruby | ## Code Before:
require 'yaml'
require 'ostruct'
require 'erb'
require 'tmuxinator/helper'
require 'tmuxinator/cli'
require 'tmuxinator/config_writer'
TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/assets/tmux_config.tmux"
module Tmuxinator
end
## Instruction:
Fix for improperly set template constant
## Code After:
require 'yaml'
require 'ostruct'
require 'erb'
require 'tmuxinator/helper'
require 'tmuxinator/cli'
require 'tmuxinator/config_writer'
TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/tmuxinator/assets/tmux_config.tmux"
module Tmuxinator
end
| require 'yaml'
require 'ostruct'
require 'erb'
require 'tmuxinator/helper'
require 'tmuxinator/cli'
require 'tmuxinator/config_writer'
- TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/assets/tmux_config.tmux"
+ TMUX_TEMPLATE = "#{File.dirname(__FILE__)}/tmuxinator/assets/tmux_config.tmux"
? +++++++++++
module Tmuxinator
end | 2 | 0.181818 | 1 | 1 |
5363e0c518cd439304f3be38afed2f8e68790483 | recipes/slang/build.sh | recipes/slang/build.sh | export CFLAGS="${CFLAGS} ${CPPFLAGS}"
./configure \
--prefix=$PREFIX \
--with-readline=gnu \
--without-ncurses \
--with-pcre \
--with-onig \
--with-png \
--with-z \
--with-iconv=$PREFIX
make
make check
make install
| export CFLAGS="${CFLAGS} ${CPPFLAGS}"
./configure \
--prefix=$PREFIX \
--with-readline=gnu \
--with-pcre \
--with-onig \
--with-png \
--with-z \
--with-iconv=$PREFIX
make
make check
make install
| Remove --without-ncurses, it is unnecessary. | Remove --without-ncurses, it is unnecessary. | Shell | bsd-3-clause | basnijholt/staged-recipes,chrisburr/staged-recipes,ocefpaf/staged-recipes,mcs07/staged-recipes,conda-forge/staged-recipes,dschreij/staged-recipes,igortg/staged-recipes,mcs07/staged-recipes,jakirkham/staged-recipes,ReimarBauer/staged-recipes,basnijholt/staged-recipes,isuruf/staged-recipes,ReimarBauer/staged-recipes,scopatz/staged-recipes,cpaulik/staged-recipes,synapticarbors/staged-recipes,ocefpaf/staged-recipes,sodre/staged-recipes,kwilcox/staged-recipes,goanpeca/staged-recipes,petrushy/staged-recipes,hadim/staged-recipes,stuertz/staged-recipes,asmeurer/staged-recipes,cpaulik/staged-recipes,patricksnape/staged-recipes,jochym/staged-recipes,mariusvniekerk/staged-recipes,SylvainCorlay/staged-recipes,johanneskoester/staged-recipes,SylvainCorlay/staged-recipes,conda-forge/staged-recipes,ceholden/staged-recipes,ceholden/staged-recipes,synapticarbors/staged-recipes,dschreij/staged-recipes,jakirkham/staged-recipes,scopatz/staged-recipes,rmcgibbo/staged-recipes,patricksnape/staged-recipes,rmcgibbo/staged-recipes,asmeurer/staged-recipes,chrisburr/staged-recipes,isuruf/staged-recipes,jjhelmus/staged-recipes,Juanlu001/staged-recipes,mariusvniekerk/staged-recipes,johanneskoester/staged-recipes,Juanlu001/staged-recipes,sodre/staged-recipes,jochym/staged-recipes,birdsarah/staged-recipes,goanpeca/staged-recipes,birdsarah/staged-recipes,igortg/staged-recipes,sodre/staged-recipes,hadim/staged-recipes,petrushy/staged-recipes,kwilcox/staged-recipes,jjhelmus/staged-recipes,stuertz/staged-recipes | shell | ## Code Before:
export CFLAGS="${CFLAGS} ${CPPFLAGS}"
./configure \
--prefix=$PREFIX \
--with-readline=gnu \
--without-ncurses \
--with-pcre \
--with-onig \
--with-png \
--with-z \
--with-iconv=$PREFIX
make
make check
make install
## Instruction:
Remove --without-ncurses, it is unnecessary.
## Code After:
export CFLAGS="${CFLAGS} ${CPPFLAGS}"
./configure \
--prefix=$PREFIX \
--with-readline=gnu \
--with-pcre \
--with-onig \
--with-png \
--with-z \
--with-iconv=$PREFIX
make
make check
make install
| export CFLAGS="${CFLAGS} ${CPPFLAGS}"
./configure \
--prefix=$PREFIX \
--with-readline=gnu \
- --without-ncurses \
--with-pcre \
--with-onig \
--with-png \
--with-z \
--with-iconv=$PREFIX
make
make check
make install | 1 | 0.066667 | 0 | 1 |
67687ee3dc5c55ca2cd8c14261cdf17fc6237420 | operations/list.go | operations/list.go | package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined blow instead and supply List
// struct as the first field.
//
// See the Pagination and Lists documentation at https://www.omise.co/api-pagination for
// more information.
type List struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
From time.Time `json:"-"`
To time.Time `json:"-"`
Order omise.Ordering `json:"order,omitempty"`
NullableFrom *time.Time `json:"from,omitempty"`
NullableTo *time.Time `json:"to,omitempty"`
}
type optionalFieldList List
// MarshalJSON List type
func (l List) MarshalJSON() ([]byte, error) {
l.SetOptionalField()
return json.Marshal(optionalFieldList(l))
}
func (l *List) SetOptionalField() {
if !l.From.IsZero() {
l.NullableFrom = &l.From
}
if !l.To.IsZero() {
l.NullableTo = &l.To
}
}
| package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined blow instead and supply List
// struct as the first field.
//
// See the Pagination and Lists documentation at https://www.omise.co/api-pagination for
// more information.
type List struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
From time.Time `json:"-"`
To time.Time `json:"-"`
Order omise.Ordering `json:"order,omitempty"`
}
// MarshalJSON List type
func (l List) MarshalJSON() ([]byte, error) {
type Alias List
params := struct {
Alias
PFrom *time.Time `json:"from,omitempty"`
PTo *time.Time `json:"to,omitempty"`
}{
Alias: Alias(l),
}
if !l.From.IsZero() {
params.PFrom = &l.From
}
if !l.To.IsZero() {
params.PTo = &l.To
}
return json.Marshal(params)
}
| Move custom struct for marshal json to MarshalJSON method | Move custom struct for marshal json to MarshalJSON method
| Go | mit | omise/omise-go,omise/omise-go | go | ## Code Before:
package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined blow instead and supply List
// struct as the first field.
//
// See the Pagination and Lists documentation at https://www.omise.co/api-pagination for
// more information.
type List struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
From time.Time `json:"-"`
To time.Time `json:"-"`
Order omise.Ordering `json:"order,omitempty"`
NullableFrom *time.Time `json:"from,omitempty"`
NullableTo *time.Time `json:"to,omitempty"`
}
type optionalFieldList List
// MarshalJSON List type
func (l List) MarshalJSON() ([]byte, error) {
l.SetOptionalField()
return json.Marshal(optionalFieldList(l))
}
func (l *List) SetOptionalField() {
if !l.From.IsZero() {
l.NullableFrom = &l.From
}
if !l.To.IsZero() {
l.NullableTo = &l.To
}
}
## Instruction:
Move custom struct for marshal json to MarshalJSON method
## Code After:
package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined blow instead and supply List
// struct as the first field.
//
// See the Pagination and Lists documentation at https://www.omise.co/api-pagination for
// more information.
type List struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
From time.Time `json:"-"`
To time.Time `json:"-"`
Order omise.Ordering `json:"order,omitempty"`
}
// MarshalJSON List type
func (l List) MarshalJSON() ([]byte, error) {
type Alias List
params := struct {
Alias
PFrom *time.Time `json:"from,omitempty"`
PTo *time.Time `json:"to,omitempty"`
}{
Alias: Alias(l),
}
if !l.From.IsZero() {
params.PFrom = &l.From
}
if !l.To.IsZero() {
params.PTo = &l.To
}
return json.Marshal(params)
}
| package operations
import (
"encoding/json"
"time"
"github.com/omise/omise-go"
)
// List contains fields that represent parameters common to most list operations. List
// struct is not an operation in and of itself and cannot be used with client.Do directly.
// Use one of the predefined XXXList operations defined blow instead and supply List
// struct as the first field.
//
// See the Pagination and Lists documentation at https://www.omise.co/api-pagination for
// more information.
type List struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
From time.Time `json:"-"`
To time.Time `json:"-"`
Order omise.Ordering `json:"order,omitempty"`
-
- NullableFrom *time.Time `json:"from,omitempty"`
- NullableTo *time.Time `json:"to,omitempty"`
}
-
- type optionalFieldList List
// MarshalJSON List type
func (l List) MarshalJSON() ([]byte, error) {
- l.SetOptionalField()
- return json.Marshal(optionalFieldList(l))
- }
-
- func (l *List) SetOptionalField() {
+ type Alias List
+ params := struct {
+ Alias
+ PFrom *time.Time `json:"from,omitempty"`
+ PTo *time.Time `json:"to,omitempty"`
+ }{
+ Alias: Alias(l),
+ }
if !l.From.IsZero() {
- l.NullableFrom = &l.From
+ params.PFrom = &l.From
}
if !l.To.IsZero() {
- l.NullableTo = &l.To
+ params.PTo = &l.To
}
+ return json.Marshal(params)
} | 23 | 0.534884 | 11 | 12 |
b37f05d837a1b57cae56955dabd21088e8817c88 | tests/test_vflip.lua | tests/test_vflip.lua | require 'totem'
require 'image'
myTests = {}
local tester = totem.Tester()
-- List of all possible tests
local all_tests = {}
function all_tests.test_transformation_largeByteImage(flip)
local x_real = image.fabio():double():mul(255)
local x_byte = x_real:clone():byte()
assert(x_byte:size(1) > 256 and x_byte:size(2) > 256, 'Tricky case only occurs for images larger than 256 px, pick another example')
local f_real, f_byte
f_real = image[flip](x_real)
f_byte = image[flip](x_byte)
tester:assertTensorEq(f_real:byte():double(), f_byte:double(), 1e-16, flip .. ': result for double and byte images do not match')
end
-- Apply all tests to both vflip and hflip
for _, flip in pairs{'vflip', 'hflip'} do
for name, test in pairs(all_tests) do
myTests[name .. '_' .. flip] = function() return test(flip) end
end
end
tester:add(myTests)
return tester:run(myTests)
| require 'totem'
require 'image'
myTests = {}
local tester = totem.Tester()
-- List of all possible tests
local all_tests = {}
function all_tests.test_transformation_largeByteImage(flip)
local x_real = image.fabio():double():mul(255)
local x_byte = x_real:clone():byte()
assert(x_byte:size(1) > 256 and x_byte:size(2) > 256, 'Tricky case only occurs for images larger than 256 px, pick another example')
local f_real, f_byte
f_real = image[flip](x_real)
f_byte = image[flip](x_byte)
tester:assertTensorEq(f_real:byte():double(), f_byte:double(), 1e-16, flip .. ': result for double and byte images do not match')
end
function all_tests.test_inplace(flip)
local im = image.lena()
local not_inplace = image.hflip(im)
local in_place = im:clone()
image[flip](in_place, in_place)
tester:assertTensorEq(in_place, not_inplace, 1e-16, flip .. ': result in-place does not match result not in-place')
end
-- Apply all tests to both vflip and hflip
for _, flip in pairs{'vflip', 'hflip'} do
for name, test in pairs(all_tests) do
myTests[name .. '_' .. flip] = function() return test(flip) end
end
end
tester:add(myTests)
return tester:run(myTests)
| Add failing test case for in-place vflip | Add failing test case for in-place vflip
Thanks to @jonathantompson for spotting the bug, see issue #27
| Lua | bsd-3-clause | jagapiou/image,torch/image,colesbury/image,Moodstocks/image,jonathantompson/image | lua | ## Code Before:
require 'totem'
require 'image'
myTests = {}
local tester = totem.Tester()
-- List of all possible tests
local all_tests = {}
function all_tests.test_transformation_largeByteImage(flip)
local x_real = image.fabio():double():mul(255)
local x_byte = x_real:clone():byte()
assert(x_byte:size(1) > 256 and x_byte:size(2) > 256, 'Tricky case only occurs for images larger than 256 px, pick another example')
local f_real, f_byte
f_real = image[flip](x_real)
f_byte = image[flip](x_byte)
tester:assertTensorEq(f_real:byte():double(), f_byte:double(), 1e-16, flip .. ': result for double and byte images do not match')
end
-- Apply all tests to both vflip and hflip
for _, flip in pairs{'vflip', 'hflip'} do
for name, test in pairs(all_tests) do
myTests[name .. '_' .. flip] = function() return test(flip) end
end
end
tester:add(myTests)
return tester:run(myTests)
## Instruction:
Add failing test case for in-place vflip
Thanks to @jonathantompson for spotting the bug, see issue #27
## Code After:
require 'totem'
require 'image'
myTests = {}
local tester = totem.Tester()
-- List of all possible tests
local all_tests = {}
function all_tests.test_transformation_largeByteImage(flip)
local x_real = image.fabio():double():mul(255)
local x_byte = x_real:clone():byte()
assert(x_byte:size(1) > 256 and x_byte:size(2) > 256, 'Tricky case only occurs for images larger than 256 px, pick another example')
local f_real, f_byte
f_real = image[flip](x_real)
f_byte = image[flip](x_byte)
tester:assertTensorEq(f_real:byte():double(), f_byte:double(), 1e-16, flip .. ': result for double and byte images do not match')
end
function all_tests.test_inplace(flip)
local im = image.lena()
local not_inplace = image.hflip(im)
local in_place = im:clone()
image[flip](in_place, in_place)
tester:assertTensorEq(in_place, not_inplace, 1e-16, flip .. ': result in-place does not match result not in-place')
end
-- Apply all tests to both vflip and hflip
for _, flip in pairs{'vflip', 'hflip'} do
for name, test in pairs(all_tests) do
myTests[name .. '_' .. flip] = function() return test(flip) end
end
end
tester:add(myTests)
return tester:run(myTests)
| require 'totem'
require 'image'
myTests = {}
local tester = totem.Tester()
-- List of all possible tests
local all_tests = {}
function all_tests.test_transformation_largeByteImage(flip)
local x_real = image.fabio():double():mul(255)
local x_byte = x_real:clone():byte()
assert(x_byte:size(1) > 256 and x_byte:size(2) > 256, 'Tricky case only occurs for images larger than 256 px, pick another example')
local f_real, f_byte
f_real = image[flip](x_real)
f_byte = image[flip](x_byte)
tester:assertTensorEq(f_real:byte():double(), f_byte:double(), 1e-16, flip .. ': result for double and byte images do not match')
end
+ function all_tests.test_inplace(flip)
+ local im = image.lena()
+ local not_inplace = image.hflip(im)
+ local in_place = im:clone()
+ image[flip](in_place, in_place)
+ tester:assertTensorEq(in_place, not_inplace, 1e-16, flip .. ': result in-place does not match result not in-place')
+ end
+
-- Apply all tests to both vflip and hflip
for _, flip in pairs{'vflip', 'hflip'} do
for name, test in pairs(all_tests) do
myTests[name .. '_' .. flip] = function() return test(flip) end
end
end
tester:add(myTests)
return tester:run(myTests) | 8 | 0.258065 | 8 | 0 |
9c4a12384d6b77a64d055a455bbdb39ae1138cec | server/test/test_case.rb | server/test/test_case.rb | require "rack/test"
require "test/unit"
ENV["RACK_ENV"] = "test"
class HikeAppTestCase < Test::Unit::TestCase
include Rack::Test::Methods
def app
HikeApp
end
def run(*args, &block)
result = nil
Sequel::Model.db.transaction(:rollback => :always){ result = super }
result
end
def set_admin_cookie
set_cookie "user_id=#{Digest::SHA1.hexdigest(User.first.id)}"
end
def get_put_json
get "/api/v1/hikes/empty"
json = JSON.parse(last_response.body)
json["name"] = "New Name"
json["locality"] = "New Locality"
json["distance"] = 123
json["elevation_gain"] = 1234
json["elevation_max"] = 1234
json["location"] = { "latitude" => 12, "longitude" => 12 }
json
end
def get_post_json
{
"name" => "New Name",
"locality" => "New Locality",
"distance" => 123,
"elevation_gain" => 1234,
"elevation_max" => 1234,
"location" => {
"latitude" => 12,
"longitude" => 12
}
}
end
end | require "rack/test"
require "test/unit"
ENV["RACK_ENV"] = "test"
class HikeAppTestCase < Test::Unit::TestCase
include Rack::Test::Methods
def app
HikeApp
end
def run(*args, &block)
result = nil
$cache = Cache.new
Sequel::Model.db.transaction(:rollback => :always){ result = super }
result
end
def set_admin_cookie
set_cookie "user_id=#{Digest::SHA1.hexdigest(User.first.id)}"
end
def get_put_json
get "/api/v1/hikes/empty"
json = JSON.parse(last_response.body)
json["name"] = "New Name"
json["locality"] = "New Locality"
json["distance"] = 123
json["elevation_gain"] = 1234
json["elevation_max"] = 1234
json["location"] = { "latitude" => 12, "longitude" => 12 }
json
end
def get_post_json
{
"name" => "New Name",
"locality" => "New Locality",
"distance" => 123,
"elevation_gain" => 1234,
"elevation_max" => 1234,
"location" => {
"latitude" => 12,
"longitude" => 12
}
}
end
end | Create new cache on each test case. | Create new cache on each test case.
| Ruby | mit | zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io | ruby | ## Code Before:
require "rack/test"
require "test/unit"
ENV["RACK_ENV"] = "test"
class HikeAppTestCase < Test::Unit::TestCase
include Rack::Test::Methods
def app
HikeApp
end
def run(*args, &block)
result = nil
Sequel::Model.db.transaction(:rollback => :always){ result = super }
result
end
def set_admin_cookie
set_cookie "user_id=#{Digest::SHA1.hexdigest(User.first.id)}"
end
def get_put_json
get "/api/v1/hikes/empty"
json = JSON.parse(last_response.body)
json["name"] = "New Name"
json["locality"] = "New Locality"
json["distance"] = 123
json["elevation_gain"] = 1234
json["elevation_max"] = 1234
json["location"] = { "latitude" => 12, "longitude" => 12 }
json
end
def get_post_json
{
"name" => "New Name",
"locality" => "New Locality",
"distance" => 123,
"elevation_gain" => 1234,
"elevation_max" => 1234,
"location" => {
"latitude" => 12,
"longitude" => 12
}
}
end
end
## Instruction:
Create new cache on each test case.
## Code After:
require "rack/test"
require "test/unit"
ENV["RACK_ENV"] = "test"
class HikeAppTestCase < Test::Unit::TestCase
include Rack::Test::Methods
def app
HikeApp
end
def run(*args, &block)
result = nil
$cache = Cache.new
Sequel::Model.db.transaction(:rollback => :always){ result = super }
result
end
def set_admin_cookie
set_cookie "user_id=#{Digest::SHA1.hexdigest(User.first.id)}"
end
def get_put_json
get "/api/v1/hikes/empty"
json = JSON.parse(last_response.body)
json["name"] = "New Name"
json["locality"] = "New Locality"
json["distance"] = 123
json["elevation_gain"] = 1234
json["elevation_max"] = 1234
json["location"] = { "latitude" => 12, "longitude" => 12 }
json
end
def get_post_json
{
"name" => "New Name",
"locality" => "New Locality",
"distance" => 123,
"elevation_gain" => 1234,
"elevation_max" => 1234,
"location" => {
"latitude" => 12,
"longitude" => 12
}
}
end
end | require "rack/test"
require "test/unit"
ENV["RACK_ENV"] = "test"
class HikeAppTestCase < Test::Unit::TestCase
include Rack::Test::Methods
def app
HikeApp
end
def run(*args, &block)
result = nil
+ $cache = Cache.new
Sequel::Model.db.transaction(:rollback => :always){ result = super }
result
end
def set_admin_cookie
set_cookie "user_id=#{Digest::SHA1.hexdigest(User.first.id)}"
end
def get_put_json
get "/api/v1/hikes/empty"
json = JSON.parse(last_response.body)
json["name"] = "New Name"
json["locality"] = "New Locality"
json["distance"] = 123
json["elevation_gain"] = 1234
json["elevation_max"] = 1234
json["location"] = { "latitude" => 12, "longitude" => 12 }
json
end
def get_post_json
{
"name" => "New Name",
"locality" => "New Locality",
"distance" => 123,
"elevation_gain" => 1234,
"elevation_max" => 1234,
"location" => {
"latitude" => 12,
"longitude" => 12
}
}
end
end | 1 | 0.020833 | 1 | 0 |
29c8e572c1de13580160aaeb42495ad97a0284aa | aliases/available/clipboard.aliases.bash | aliases/available/clipboard.aliases.bash | cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
;;
darwin*)
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!
| cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!
| Remove darwin from the case | Remove darwin from the case | Shell | mit | prajnak/bash_it | shell | ## Code Before:
cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
;;
darwin*)
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!
## Instruction:
Remove darwin from the case
## Code After:
cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun!
| cite 'about-alias'
about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
- ;;
- darwin*)
;;
esac
# to use it just install xclip on your distribution and it would work like:
# $ echo "hello" | pbcopy
# $ pbpaste
# hello
# very useful for things like:
# cat ~/.ssh/id_rsa.pub | pbcopy
# have fun! | 2 | 0.1 | 0 | 2 |
82438da8a722149206ae23afbbd01f6b706130f0 | website/source/docs/hyperv/limitations.html.md | website/source/docs/hyperv/limitations.html.md | ---
layout: "docs"
page_title: "Limitations - Hyper-V Provider"
sidebar_current: "providers-hyperv-limitations"
description: |-
The Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
---
# Limitations
The Vagrant Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
## Limited Networking
Vagrant does not yet know how to create and configure new networks for
Hyper-V. When launching a machine with Hyper-V, Vagrant will prompt you
asking what virtual switch you want to connect the virtual machine to.
A result of this is that networking configurations in the Vagrantfile
are completely ignored with Hyper-V. Vagrant cannot enforce a static IP
or automatically configure a NAT.
However, the IP address of the machine will be reported as part of
the `vagrant up`, and you can use that IP address as if it were
a host only network.
## Packaging
Vagrant does not implement the `vagrant package` command for Hyper-V
yet, though this should be fairly straightforward to add in a Vagrant
release in the near future.
| ---
layout: "docs"
page_title: "Limitations - Hyper-V Provider"
sidebar_current: "providers-hyperv-limitations"
description: |-
The Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
---
# Limitations
The Vagrant Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
## Limited Networking
Vagrant does not yet know how to create and configure new networks for
Hyper-V. When launching a machine with Hyper-V, Vagrant will prompt you
asking what virtual switch you want to connect the virtual machine to.
A result of this is that networking configurations in the Vagrantfile
are completely ignored with Hyper-V. Vagrant cannot enforce a static IP
or automatically configure a NAT.
However, the IP address of the machine will be reported as part of
the `vagrant up`, and you can use that IP address as if it were
a host only network.
## Packaging
Vagrant does not implement the `vagrant package` command for Hyper-V
yet, though this should be fairly straightforward to add in a Vagrant
release in the near future.
## Snapshots
Restoring snapshot VMs using `vagrant snapshot pop` or
`vagrant snapshot restore` will sometimes raise errors when mounting
SMB shared folders, however these mounts will still work inside the guest.
| Add docs detailing the rollback limitations. | Add docs detailing the rollback limitations.
| Markdown | mit | bdwyertech/vagrant,lonniev/vagrant,crashlytics/vagrant,bshurts/vagrant,jtopper/vagrant,lukebakken/vagrant,bryson/vagrant,tomfanning/vagrant,lonniev/vagrant,vamegh/vagrant,sni/vagrant,vamegh/vagrant,bdwyertech/vagrant,bshurts/vagrant,chrisroberts/vagrant,benh57/vagrant,PatrickLang/vagrant,benizi/vagrant,kamazee/vagrant,justincampbell/vagrant,bryson/vagrant,benizi/vagrant,mitchellh/vagrant,justincampbell/vagrant,sax/vagrant,jtopper/vagrant,krig/vagrant,sax/vagrant,signed8bit/vagrant,crashlytics/vagrant,carlosefr/vagrant,jtopper/vagrant,kamazee/vagrant,lukebakken/vagrant,gitebra/vagrant,mitchellh/vagrant,benh57/vagrant,lonniev/vagrant,taliesins/vagrant,sax/vagrant,sni/vagrant,kamazee/vagrant,lukebakken/vagrant,kamazee/vagrant,mwrock/vagrant,PatrickLang/vagrant,mwrock/vagrant,krig/vagrant,marxarelli/vagrant,justincampbell/vagrant,chrisroberts/vagrant,bdwyertech/vagrant,jtopper/vagrant,carlosefr/vagrant,PatrickLang/vagrant,benh57/vagrant,chrisroberts/vagrant,carlosefr/vagrant,marxarelli/vagrant,gitebra/vagrant,mwrock/vagrant,krig/vagrant,tomfanning/vagrant,benizi/vagrant,mitchellh/vagrant,sni/vagrant,benizi/vagrant,benh57/vagrant,taliesins/vagrant,carlosefr/vagrant,chrisroberts/vagrant,signed8bit/vagrant,bryson/vagrant,taliesins/vagrant,signed8bit/vagrant,mitchellh/vagrant,crashlytics/vagrant,marxarelli/vagrant,PatrickLang/vagrant,gitebra/vagrant,bshurts/vagrant,signed8bit/vagrant,gitebra/vagrant,sax/vagrant,bdwyertech/vagrant,lukebakken/vagrant,crashlytics/vagrant,bryson/vagrant,vamegh/vagrant,marxarelli/vagrant,krig/vagrant,justincampbell/vagrant,mwrock/vagrant,vamegh/vagrant,lonniev/vagrant,tomfanning/vagrant,taliesins/vagrant,sni/vagrant,tomfanning/vagrant,bshurts/vagrant | markdown | ## Code Before:
---
layout: "docs"
page_title: "Limitations - Hyper-V Provider"
sidebar_current: "providers-hyperv-limitations"
description: |-
The Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
---
# Limitations
The Vagrant Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
## Limited Networking
Vagrant does not yet know how to create and configure new networks for
Hyper-V. When launching a machine with Hyper-V, Vagrant will prompt you
asking what virtual switch you want to connect the virtual machine to.
A result of this is that networking configurations in the Vagrantfile
are completely ignored with Hyper-V. Vagrant cannot enforce a static IP
or automatically configure a NAT.
However, the IP address of the machine will be reported as part of
the `vagrant up`, and you can use that IP address as if it were
a host only network.
## Packaging
Vagrant does not implement the `vagrant package` command for Hyper-V
yet, though this should be fairly straightforward to add in a Vagrant
release in the near future.
## Instruction:
Add docs detailing the rollback limitations.
## Code After:
---
layout: "docs"
page_title: "Limitations - Hyper-V Provider"
sidebar_current: "providers-hyperv-limitations"
description: |-
The Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
---
# Limitations
The Vagrant Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
## Limited Networking
Vagrant does not yet know how to create and configure new networks for
Hyper-V. When launching a machine with Hyper-V, Vagrant will prompt you
asking what virtual switch you want to connect the virtual machine to.
A result of this is that networking configurations in the Vagrantfile
are completely ignored with Hyper-V. Vagrant cannot enforce a static IP
or automatically configure a NAT.
However, the IP address of the machine will be reported as part of
the `vagrant up`, and you can use that IP address as if it were
a host only network.
## Packaging
Vagrant does not implement the `vagrant package` command for Hyper-V
yet, though this should be fairly straightforward to add in a Vagrant
release in the near future.
## Snapshots
Restoring snapshot VMs using `vagrant snapshot pop` or
`vagrant snapshot restore` will sometimes raise errors when mounting
SMB shared folders, however these mounts will still work inside the guest.
| ---
layout: "docs"
page_title: "Limitations - Hyper-V Provider"
sidebar_current: "providers-hyperv-limitations"
description: |-
The Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
---
# Limitations
The Vagrant Hyper-V provider works in almost every way like the VirtualBox
or VMware provider would, but has some limitations that are inherent to
Hyper-V itself.
## Limited Networking
Vagrant does not yet know how to create and configure new networks for
Hyper-V. When launching a machine with Hyper-V, Vagrant will prompt you
asking what virtual switch you want to connect the virtual machine to.
A result of this is that networking configurations in the Vagrantfile
are completely ignored with Hyper-V. Vagrant cannot enforce a static IP
or automatically configure a NAT.
However, the IP address of the machine will be reported as part of
the `vagrant up`, and you can use that IP address as if it were
a host only network.
## Packaging
Vagrant does not implement the `vagrant package` command for Hyper-V
yet, though this should be fairly straightforward to add in a Vagrant
release in the near future.
+
+ ## Snapshots
+
+ Restoring snapshot VMs using `vagrant snapshot pop` or
+ `vagrant snapshot restore` will sometimes raise errors when mounting
+ SMB shared folders, however these mounts will still work inside the guest.
+
+ | 8 | 0.228571 | 8 | 0 |
9693f287d5eaed0cc4b54d19032c3f94149e6861 | argumentative.rb | argumentative.rb | module Argumentative
def argumentative(args)
@@checker = Argumentative.new(*args)
yield
raise ArgumentError.new("No matches found for #{@@checker.args.inspect}") unless @@checker.found_match?
return_value = @@checker.return_value
@@checker = nil
return_value
end
def when_type(*types)
@@checker.check_match(types) do
yield(*@@checker.args)
end
end
module ParameterMatchers
class Base
def match?(types)
raise 'Called abstract method match?'
end
end
class Star < Base
def initialize(klass)
@klass = klass
end
def match?(types)
true
end
end
end
private
class Argumentative
attr_reader :args
def initialize(*args)
@args = args
@@handlers = []
@found_match = false
end
def check_match(types)
if match?(types)
@return_value = yield
@found_match = true
end
end
def found_match?
@found_match
end
def return_value
@return_value
end
private
def match?(types)
types.count == @args.count && @args.zip(types).all? { |arg, type| arg.is_a?(type) }
end
end
end
class Class
def *
Argumentative::ParameterMatchers::Star.new(self)
end
end
| module Argumentative
def argumentative(args)
@@checker = Argumentative.new(*args)
yield
raise ArgumentError.new("No matches found for #{@@checker.args.inspect}") unless @@checker.found_match?
return_value = @@checker.return_value
@@checker = nil
return_value
end
def when_type(*types)
@@checker.check_match(types) do
yield(*@@checker.args)
end
end
module ParameterMatchers
class Base
def match?(types)
raise 'Called abstract method match?'
end
end
class Star < Base
def initialize(klass)
@klass = klass
end
def match?(types)
true
end
end
end
private
class Argumentative
attr_reader :args
def initialize(*args)
@args = args
@@handlers = []
@found_match = false
end
def check_match(types)
if match?(types)
@return_value = yield
@found_match = true
end
end
def found_match?
@found_match
end
def return_value
@return_value
end
private
def contain_matchers?(types)
types.any? { |type| type.is_a?(ParameterMatchers::Base) }
end
def fuzzy_match?(types)
true
end
def match?(types)
if contain_matchers?(types)
fuzzy_match?(types)
elsif types.count == @args.count
@args.zip(types).all? { |arg, type| arg.is_a?(type) }
end
end
end
end
class Class
def *
Argumentative::ParameterMatchers::Star.new(self)
end
end
| Make fuzzy matcher test pass with stub | Make fuzzy matcher test pass with stub
| Ruby | mit | dillonkearns/argumentative | ruby | ## Code Before:
module Argumentative
def argumentative(args)
@@checker = Argumentative.new(*args)
yield
raise ArgumentError.new("No matches found for #{@@checker.args.inspect}") unless @@checker.found_match?
return_value = @@checker.return_value
@@checker = nil
return_value
end
def when_type(*types)
@@checker.check_match(types) do
yield(*@@checker.args)
end
end
module ParameterMatchers
class Base
def match?(types)
raise 'Called abstract method match?'
end
end
class Star < Base
def initialize(klass)
@klass = klass
end
def match?(types)
true
end
end
end
private
class Argumentative
attr_reader :args
def initialize(*args)
@args = args
@@handlers = []
@found_match = false
end
def check_match(types)
if match?(types)
@return_value = yield
@found_match = true
end
end
def found_match?
@found_match
end
def return_value
@return_value
end
private
def match?(types)
types.count == @args.count && @args.zip(types).all? { |arg, type| arg.is_a?(type) }
end
end
end
class Class
def *
Argumentative::ParameterMatchers::Star.new(self)
end
end
## Instruction:
Make fuzzy matcher test pass with stub
## Code After:
module Argumentative
def argumentative(args)
@@checker = Argumentative.new(*args)
yield
raise ArgumentError.new("No matches found for #{@@checker.args.inspect}") unless @@checker.found_match?
return_value = @@checker.return_value
@@checker = nil
return_value
end
def when_type(*types)
@@checker.check_match(types) do
yield(*@@checker.args)
end
end
module ParameterMatchers
class Base
def match?(types)
raise 'Called abstract method match?'
end
end
class Star < Base
def initialize(klass)
@klass = klass
end
def match?(types)
true
end
end
end
private
class Argumentative
attr_reader :args
def initialize(*args)
@args = args
@@handlers = []
@found_match = false
end
def check_match(types)
if match?(types)
@return_value = yield
@found_match = true
end
end
def found_match?
@found_match
end
def return_value
@return_value
end
private
def contain_matchers?(types)
types.any? { |type| type.is_a?(ParameterMatchers::Base) }
end
def fuzzy_match?(types)
true
end
def match?(types)
if contain_matchers?(types)
fuzzy_match?(types)
elsif types.count == @args.count
@args.zip(types).all? { |arg, type| arg.is_a?(type) }
end
end
end
end
class Class
def *
Argumentative::ParameterMatchers::Star.new(self)
end
end
| module Argumentative
def argumentative(args)
@@checker = Argumentative.new(*args)
yield
raise ArgumentError.new("No matches found for #{@@checker.args.inspect}") unless @@checker.found_match?
return_value = @@checker.return_value
@@checker = nil
return_value
end
def when_type(*types)
@@checker.check_match(types) do
yield(*@@checker.args)
end
end
module ParameterMatchers
class Base
def match?(types)
raise 'Called abstract method match?'
end
end
class Star < Base
def initialize(klass)
@klass = klass
end
def match?(types)
true
end
end
end
private
class Argumentative
attr_reader :args
def initialize(*args)
@args = args
@@handlers = []
@found_match = false
end
def check_match(types)
if match?(types)
@return_value = yield
@found_match = true
end
end
def found_match?
@found_match
end
def return_value
@return_value
end
private
+ def contain_matchers?(types)
+ types.any? { |type| type.is_a?(ParameterMatchers::Base) }
+ end
+
+ def fuzzy_match?(types)
+ true
+ end
+
def match?(types)
+ if contain_matchers?(types)
+ fuzzy_match?(types)
+ elsif types.count == @args.count
- types.count == @args.count && @args.zip(types).all? { |arg, type| arg.is_a?(type) }
? ----------- -----------------
+ @args.zip(types).all? { |arg, type| arg.is_a?(type) }
+ end
end
end
end
class Class
def *
Argumentative::ParameterMatchers::Star.new(self)
end
end | 14 | 0.197183 | 13 | 1 |
77caf4f14363c6f53631050d008bc852df465f5e | tests/repl_tests.py | tests/repl_tests.py |
from tests.util.pipe import Pipe
from threading import Thread
from pycell.repl import repl
from tests.util.system_test import system_test
from tests.util.all_examples import all_sessions
def _validate_session(f):
strin = Pipe()
strout = Pipe()
strerr = Pipe()
replthread = Thread(target=repl, args=(strin, strout, strerr))
replthread.start()
for exp_line in f:
expprompt = exp_line[:4]
if expprompt in (">>> ", "... "):
prompt = strout.read(4)
if prompt != exp_line[:4]:
raise Exception(
"Prompt was '%s' but we expected '%s'." % (
prompt, exp_line[:4]))
strin.write(exp_line[4:])
else:
output = strout.readline()
if output != exp_line:
raise Exception("Output was '%s' but we expected '%s'" % (
output, exp_line))
strerr.close()
strout.close()
strin.close()
replthread.join()
@system_test
def All_example_repl_sessions_are_correct():
from pycell.chars_in_file import chars_in_file
for example in all_sessions():
with open(example, encoding="ascii") as f:
_validate_session(f)
|
from tests.util.pipe import Pipe
from threading import Thread
from pycell.repl import repl
from tests.util.system_test import system_test
from tests.util.all_examples import all_sessions
def _validate_line(exp_line, strin, strout):
expprompt = exp_line[:4]
if expprompt in (">>> ", "... "):
prompt = strout.read(4)
if prompt != exp_line[:4]:
raise Exception(
"Prompt was '%s' but we expected '%s'." % (
prompt, exp_line[:4])
)
strin.write(exp_line[4:])
else:
output = strout.readline()
if output != exp_line:
raise Exception("Output was '%s' but we expected '%s'" % (
output, exp_line)
)
def _validate_session(f):
with Pipe() as strin, Pipe() as strout, Pipe() as strerr:
replthread = Thread(target=repl, args=(strin, strout, strerr))
replthread.start()
for exp_line in f:
_validate_line(exp_line, strin, strout)
replthread.join()
@system_test
def All_example_repl_sessions_are_correct():
for example in all_sessions():
with open(example, encoding="ascii") as f:
_validate_session(f)
| Stop the repl test on an error, making sure all Pipes are closed | Stop the repl test on an error, making sure all Pipes are closed
| Python | mit | andybalaam/cell | python | ## Code Before:
from tests.util.pipe import Pipe
from threading import Thread
from pycell.repl import repl
from tests.util.system_test import system_test
from tests.util.all_examples import all_sessions
def _validate_session(f):
strin = Pipe()
strout = Pipe()
strerr = Pipe()
replthread = Thread(target=repl, args=(strin, strout, strerr))
replthread.start()
for exp_line in f:
expprompt = exp_line[:4]
if expprompt in (">>> ", "... "):
prompt = strout.read(4)
if prompt != exp_line[:4]:
raise Exception(
"Prompt was '%s' but we expected '%s'." % (
prompt, exp_line[:4]))
strin.write(exp_line[4:])
else:
output = strout.readline()
if output != exp_line:
raise Exception("Output was '%s' but we expected '%s'" % (
output, exp_line))
strerr.close()
strout.close()
strin.close()
replthread.join()
@system_test
def All_example_repl_sessions_are_correct():
from pycell.chars_in_file import chars_in_file
for example in all_sessions():
with open(example, encoding="ascii") as f:
_validate_session(f)
## Instruction:
Stop the repl test on an error, making sure all Pipes are closed
## Code After:
from tests.util.pipe import Pipe
from threading import Thread
from pycell.repl import repl
from tests.util.system_test import system_test
from tests.util.all_examples import all_sessions
def _validate_line(exp_line, strin, strout):
expprompt = exp_line[:4]
if expprompt in (">>> ", "... "):
prompt = strout.read(4)
if prompt != exp_line[:4]:
raise Exception(
"Prompt was '%s' but we expected '%s'." % (
prompt, exp_line[:4])
)
strin.write(exp_line[4:])
else:
output = strout.readline()
if output != exp_line:
raise Exception("Output was '%s' but we expected '%s'" % (
output, exp_line)
)
def _validate_session(f):
with Pipe() as strin, Pipe() as strout, Pipe() as strerr:
replthread = Thread(target=repl, args=(strin, strout, strerr))
replthread.start()
for exp_line in f:
_validate_line(exp_line, strin, strout)
replthread.join()
@system_test
def All_example_repl_sessions_are_correct():
for example in all_sessions():
with open(example, encoding="ascii") as f:
_validate_session(f)
|
from tests.util.pipe import Pipe
from threading import Thread
from pycell.repl import repl
from tests.util.system_test import system_test
from tests.util.all_examples import all_sessions
+
+ def _validate_line(exp_line, strin, strout):
+ expprompt = exp_line[:4]
+ if expprompt in (">>> ", "... "):
+ prompt = strout.read(4)
+ if prompt != exp_line[:4]:
+ raise Exception(
+ "Prompt was '%s' but we expected '%s'." % (
+ prompt, exp_line[:4])
+ )
+ strin.write(exp_line[4:])
+ else:
+ output = strout.readline()
+ if output != exp_line:
+ raise Exception("Output was '%s' but we expected '%s'" % (
+ output, exp_line)
+ )
+
+
def _validate_session(f):
+ with Pipe() as strin, Pipe() as strout, Pipe() as strerr:
- strin = Pipe()
- strout = Pipe()
- strerr = Pipe()
- replthread = Thread(target=repl, args=(strin, strout, strerr))
+ replthread = Thread(target=repl, args=(strin, strout, strerr))
? ++++
- replthread.start()
+ replthread.start()
? ++++
- for exp_line in f:
+ for exp_line in f:
? ++++
+ _validate_line(exp_line, strin, strout)
- expprompt = exp_line[:4]
- if expprompt in (">>> ", "... "):
- prompt = strout.read(4)
- if prompt != exp_line[:4]:
- raise Exception(
- "Prompt was '%s' but we expected '%s'." % (
- prompt, exp_line[:4]))
- strin.write(exp_line[4:])
- else:
- output = strout.readline()
- if output != exp_line:
- raise Exception("Output was '%s' but we expected '%s'" % (
- output, exp_line))
-
- strerr.close()
- strout.close()
- strin.close()
replthread.join()
@system_test
def All_example_repl_sessions_are_correct():
- from pycell.chars_in_file import chars_in_file
for example in all_sessions():
with open(example, encoding="ascii") as f:
_validate_session(f) | 48 | 1.142857 | 24 | 24 |
b02fe2df1ac123c7d6483b9c42d4c9afac2bb5c1 | themes/robbyrussell/fish_prompt.fish | themes/robbyrussell/fish_prompt.fish | function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt
set -l last_status $status
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l normal (set_color normal)
if test $last_status = 0
set arrow "$green➜ "
else
set arrow "$red➜ "
end
set -l cwd $cyan(basename (prompt_pwd))
if [ (_git_branch_name) ]
set -l git_branch $red(_git_branch_name)
set git_info "$blue git:($git_branch$blue)"
if [ (_is_git_dirty) ]
set -l dirty "$yellow ✗"
set git_info "$git_info$dirty"
end
end
echo -n -s $arrow ' ' $cwd $git_info $normal ' '
end
|
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
if [ "$theme_disable_untracked_files_dirty" = 'yes' ]
echo (command git status -s --ignore-submodules=dirty --untracked-files=no ^/dev/null)
else
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
end
function fish_prompt
set -l last_status $status
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l normal (set_color normal)
if test $last_status = 0
set arrow "$green➜ "
else
set arrow "$red➜ "
end
set -l cwd $cyan(basename (prompt_pwd))
if [ (_git_branch_name) ]
set -l git_branch $red(_git_branch_name)
set git_info "$blue git:($git_branch$blue)"
if [ (_is_git_dirty) ]
set -l dirty "$yellow ✗"
set git_info "$git_info$dirty"
end
end
echo -n -s $arrow ' ' $cwd $git_info $normal ' '
end
| Add option to not show untracked files as dirty in git status | Add option to not show untracked files as dirty in git status
| fish | mit | ovstetun/oh-my-fish | fish | ## Code Before:
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt
set -l last_status $status
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l normal (set_color normal)
if test $last_status = 0
set arrow "$green➜ "
else
set arrow "$red➜ "
end
set -l cwd $cyan(basename (prompt_pwd))
if [ (_git_branch_name) ]
set -l git_branch $red(_git_branch_name)
set git_info "$blue git:($git_branch$blue)"
if [ (_is_git_dirty) ]
set -l dirty "$yellow ✗"
set git_info "$git_info$dirty"
end
end
echo -n -s $arrow ' ' $cwd $git_info $normal ' '
end
## Instruction:
Add option to not show untracked files as dirty in git status
## Code After:
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
if [ "$theme_disable_untracked_files_dirty" = 'yes' ]
echo (command git status -s --ignore-submodules=dirty --untracked-files=no ^/dev/null)
else
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
end
function fish_prompt
set -l last_status $status
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l normal (set_color normal)
if test $last_status = 0
set arrow "$green➜ "
else
set arrow "$red➜ "
end
set -l cwd $cyan(basename (prompt_pwd))
if [ (_git_branch_name) ]
set -l git_branch $red(_git_branch_name)
set git_info "$blue git:($git_branch$blue)"
if [ (_is_git_dirty) ]
set -l dirty "$yellow ✗"
set git_info "$git_info$dirty"
end
end
echo -n -s $arrow ' ' $cwd $git_info $normal ' '
end
| +
function _git_branch_name
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
+ if [ "$theme_disable_untracked_files_dirty" = 'yes' ]
+ echo (command git status -s --ignore-submodules=dirty --untracked-files=no ^/dev/null)
+ else
- echo (command git status -s --ignore-submodules=dirty ^/dev/null)
+ echo (command git status -s --ignore-submodules=dirty ^/dev/null)
? ++
+ end
end
function fish_prompt
set -l last_status $status
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l normal (set_color normal)
if test $last_status = 0
set arrow "$green➜ "
else
set arrow "$red➜ "
end
set -l cwd $cyan(basename (prompt_pwd))
if [ (_git_branch_name) ]
set -l git_branch $red(_git_branch_name)
set git_info "$blue git:($git_branch$blue)"
if [ (_is_git_dirty) ]
set -l dirty "$yellow ✗"
set git_info "$git_info$dirty"
end
end
echo -n -s $arrow ' ' $cwd $git_info $normal ' '
end
| 7 | 0.189189 | 6 | 1 |
cfafb9a86244a210c7436e5f1127b488c741e428 | .travis.yml | .travis.yml | language: php
php:
- 5.4
- 5.5
before_script:
- composer install
notifications:
email: false
| language: php
php:
- 5.4
- 5.5
sudo: false
before_script:
- composer install
notifications:
email: false
| Set sudo to false so Travis runs on new infra | Set sudo to false so Travis runs on new infra
| YAML | mit | cakephp/upgrade,cakephp/upgrade,tanuck/upgrade,tanuck/upgrade | yaml | ## Code Before:
language: php
php:
- 5.4
- 5.5
before_script:
- composer install
notifications:
email: false
## Instruction:
Set sudo to false so Travis runs on new infra
## Code After:
language: php
php:
- 5.4
- 5.5
sudo: false
before_script:
- composer install
notifications:
email: false
| language: php
php:
- 5.4
- 5.5
+ sudo: false
+
before_script:
- composer install
notifications:
email: false | 2 | 0.181818 | 2 | 0 |
b5786ff093569491ba8f4073fea5734cb5ee3923 | lib/spork/run_strategy/forking.rb | lib/spork/run_strategy/forking.rb | class Spork::RunStrategy::Forking < Spork::RunStrategy
def self.available?
Kernel.respond_to?(:fork)
end
def run(argv, stderr, stdout)
abort if running?
@child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr
load test_framework.helper_file
Spork.exec_each_run
test_framework.run_tests(argv, stderr, stdout)
end
@child.result
end
def abort
@child && @child.abort
end
def preload
require test_framework.entry_point
test_framework.preload
end
def running?
@child && @child.running?
end
end | class Spork::RunStrategy::Forking < Spork::RunStrategy
def self.available?
Kernel.respond_to?(:fork)
end
def run(argv, stderr, stdout)
abort if running?
@child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr
load test_framework.helper_file
Spork.exec_each_run
test_framework.run_tests(argv, stderr, stdout)
end
@child.result
end
def abort
@child && @child.abort
end
def preload
test_framework.preload
end
def running?
@child && @child.running?
end
end | Revert "fixes regression where entry point was not being loaded" | Revert "fixes regression where entry point was not being loaded"
This reverts commit 28f6da0e4e89d35411b19d5a5977a9d9f305f5f9.
| Ruby | mit | chrismdp/spork,Eric-Guo/spork,jarmo/spork,sporkrb/spork,selenetelenav/spork,selenetelenav/spork,Eric-Guo/spork,paypronl/spork,sporkrb/spork,jarmo/spork,paypronl/spork | ruby | ## Code Before:
class Spork::RunStrategy::Forking < Spork::RunStrategy
def self.available?
Kernel.respond_to?(:fork)
end
def run(argv, stderr, stdout)
abort if running?
@child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr
load test_framework.helper_file
Spork.exec_each_run
test_framework.run_tests(argv, stderr, stdout)
end
@child.result
end
def abort
@child && @child.abort
end
def preload
require test_framework.entry_point
test_framework.preload
end
def running?
@child && @child.running?
end
end
## Instruction:
Revert "fixes regression where entry point was not being loaded"
This reverts commit 28f6da0e4e89d35411b19d5a5977a9d9f305f5f9.
## Code After:
class Spork::RunStrategy::Forking < Spork::RunStrategy
def self.available?
Kernel.respond_to?(:fork)
end
def run(argv, stderr, stdout)
abort if running?
@child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr
load test_framework.helper_file
Spork.exec_each_run
test_framework.run_tests(argv, stderr, stdout)
end
@child.result
end
def abort
@child && @child.abort
end
def preload
test_framework.preload
end
def running?
@child && @child.running?
end
end | class Spork::RunStrategy::Forking < Spork::RunStrategy
def self.available?
Kernel.respond_to?(:fork)
end
def run(argv, stderr, stdout)
abort if running?
@child = ::Spork::Forker.new do
$stdout, $stderr = stdout, stderr
load test_framework.helper_file
Spork.exec_each_run
test_framework.run_tests(argv, stderr, stdout)
end
@child.result
end
def abort
@child && @child.abort
end
def preload
- require test_framework.entry_point
test_framework.preload
end
def running?
@child && @child.running?
end
end | 1 | 0.032258 | 0 | 1 |
2f1a5b273b481b5a0c58e4f8e3693850ed30dd30 | project.properties | project.properties |
android.library=true
# Project target.
target=android-17
android.library.reference.1=../../dashboard/openxc-android/openxc
|
android.library=true
# Project target.
target=android-17
android.library.reference.1=../openxc-android/openxc
| Use more standard path for openxc-android library dependency. | Use more standard path for openxc-android library dependency.
| INI | bsd-3-clause | openxc/nonstandard-android-measurements,openxc/nonstandard-android-measurements | ini | ## Code Before:
android.library=true
# Project target.
target=android-17
android.library.reference.1=../../dashboard/openxc-android/openxc
## Instruction:
Use more standard path for openxc-android library dependency.
## Code After:
android.library=true
# Project target.
target=android-17
android.library.reference.1=../openxc-android/openxc
|
android.library=true
# Project target.
target=android-17
- android.library.reference.1=../../dashboard/openxc-android/openxc
? -------------
+ android.library.reference.1=../openxc-android/openxc | 2 | 0.4 | 1 | 1 |
487b956870448ab913b436afaec49872406cb94c | app/models/locality.rb | app/models/locality.rb | class Locality < ActiveRecord::Base
has_many :users
has_many :lodgings
belongs_to :contact, class_name: 'User', foreign_key: 'contact_id'
belongs_to :lodging_contact, class_name: 'User', foreign_key: 'lodging_contact_id'
# has_and_belongs_to_many :lodgings
validates :city, presence: true
validates :state_abbrv, presence: true
def display_contact
if contact_id.nil?
'--'
else
User.find(contact_id).name
end
end
def display_contact_with_contact_info
if contact_id.nil?
'--'
else
contact = User.find(contact_id)
"#{contact.name} (#{contact.email})"
end
end
def hospitalities(event)
Hospitality.where(event: event, locality: self)
end
def hospitality_lodgings(event)
Lodging.joins(:hospitalities).where(locality: self, event: event)
end
def registrations(event)
Registration.where(event: event, locality: self)
end
end
| class Locality < ActiveRecord::Base
has_many :users
has_many :lodgings
belongs_to :contact, class_name: 'User', foreign_key: 'contact_id'
belongs_to :lodging_contact, class_name: 'User', foreign_key: 'lodging_contact_id'
# has_and_belongs_to_many :lodgings
validates :city, presence: true
validates :state_abbrv, presence: true
def display_contact
if contact_id.nil?
'--'
else
contact.name
end
end
def display_contact_with_contact_info
if contact_id.nil?
'--'
else
contact = User.find(contact_id)
"#{contact.name} (#{contact.email})"
end
end
def hospitalities(event)
Hospitality.where(event: event, locality: self)
end
def hospitality_lodgings(event)
Lodging.joins(:hospitalities).where(locality: self, event: event)
end
def registrations(event)
Registration.where(event: event, locality: self)
end
end
| Update to follow Rails convention | Update to follow Rails convention
Call send name message to contact instead of searching by contact-id
| Ruby | mit | stephen144/ypreg,stephen144/ypreg,stephen144/ypreg | ruby | ## Code Before:
class Locality < ActiveRecord::Base
has_many :users
has_many :lodgings
belongs_to :contact, class_name: 'User', foreign_key: 'contact_id'
belongs_to :lodging_contact, class_name: 'User', foreign_key: 'lodging_contact_id'
# has_and_belongs_to_many :lodgings
validates :city, presence: true
validates :state_abbrv, presence: true
def display_contact
if contact_id.nil?
'--'
else
User.find(contact_id).name
end
end
def display_contact_with_contact_info
if contact_id.nil?
'--'
else
contact = User.find(contact_id)
"#{contact.name} (#{contact.email})"
end
end
def hospitalities(event)
Hospitality.where(event: event, locality: self)
end
def hospitality_lodgings(event)
Lodging.joins(:hospitalities).where(locality: self, event: event)
end
def registrations(event)
Registration.where(event: event, locality: self)
end
end
## Instruction:
Update to follow Rails convention
Call send name message to contact instead of searching by contact-id
## Code After:
class Locality < ActiveRecord::Base
has_many :users
has_many :lodgings
belongs_to :contact, class_name: 'User', foreign_key: 'contact_id'
belongs_to :lodging_contact, class_name: 'User', foreign_key: 'lodging_contact_id'
# has_and_belongs_to_many :lodgings
validates :city, presence: true
validates :state_abbrv, presence: true
def display_contact
if contact_id.nil?
'--'
else
contact.name
end
end
def display_contact_with_contact_info
if contact_id.nil?
'--'
else
contact = User.find(contact_id)
"#{contact.name} (#{contact.email})"
end
end
def hospitalities(event)
Hospitality.where(event: event, locality: self)
end
def hospitality_lodgings(event)
Lodging.joins(:hospitalities).where(locality: self, event: event)
end
def registrations(event)
Registration.where(event: event, locality: self)
end
end
| class Locality < ActiveRecord::Base
has_many :users
has_many :lodgings
belongs_to :contact, class_name: 'User', foreign_key: 'contact_id'
belongs_to :lodging_contact, class_name: 'User', foreign_key: 'lodging_contact_id'
# has_and_belongs_to_many :lodgings
validates :city, presence: true
validates :state_abbrv, presence: true
def display_contact
if contact_id.nil?
'--'
else
- User.find(contact_id).name
+ contact.name
end
end
def display_contact_with_contact_info
if contact_id.nil?
'--'
else
contact = User.find(contact_id)
"#{contact.name} (#{contact.email})"
end
end
def hospitalities(event)
Hospitality.where(event: event, locality: self)
end
def hospitality_lodgings(event)
Lodging.joins(:hospitalities).where(locality: self, event: event)
end
def registrations(event)
Registration.where(event: event, locality: self)
end
end | 2 | 0.051282 | 1 | 1 |
e32d470ba47973f3827a5f85e701826bbb08b621 | setup.py | setup.py | from distutils.core import setup
setup(
name='lcinvestor',
version=open('lcinvestor/VERSION').read(),
author='Jeremy Gillick',
author_email='none@none.com',
packages=['lcinvestor', 'lcinvestor.tests', 'lcinvestor.settings'],
package_data={
'lcinvestor': ['VERSION'],
'lcinvestor.settings': ['settings.yaml']
},
scripts=['bin/lcinvestor'],
url='https://github.com/jgillick/LendingClubAutoInvestor',
license=open('LICENSE.txt').read(),
description='A simple tool that will watch your LendingClub account and automatically invest cash as it becomes available.',
long_description=open('README.rst').read(),
install_requires=[
"lendingclub >= 0.1.2",
# "python-daemon >= 1.6",
"argparse >= 1.2.1",
"pybars >= 0.0.4",
"pyyaml >= 3.09",
"pause >= 0.1.2"
],
platforms='osx, posix, linux, windows',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Topic :: Office/Business :: Financial'
],
keywords='lendingclub investing daemon'
)
| from distutils.core import setup
setup(
name='lcinvestor',
version=open('lcinvestor/VERSION').read(),
author='Jeremy Gillick',
author_email='none@none.com',
packages=['lcinvestor', 'lcinvestor.tests', 'lcinvestor.settings'],
package_data={
'lcinvestor': ['VERSION'],
'lcinvestor.settings': ['settings.yaml']
},
scripts=['bin/lcinvestor', 'bin/lcinvestor.bat'],
url='https://github.com/jgillick/LendingClubAutoInvestor',
license=open('LICENSE.txt').read(),
description='A simple tool that will watch your LendingClub account and automatically invest cash as it becomes available.',
long_description=open('README.rst').read(),
install_requires=[
"lendingclub >= 0.1.3",
# "python-daemon >= 1.6",
"argparse >= 1.2.1",
"pyyaml >= 3.09",
"pause >= 0.1.2"
],
platforms='osx, posix, linux, windows',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Topic :: Office/Business :: Financial'
],
keywords='lendingclub investing daemon'
)
| Update requirements. Add bat file | Update requirements. Add bat file
| Python | mit | jgillick/LendingClubAutoInvestor,ilyakatz/LendingClubAutoInvestor,ilyakatz/LendingClubAutoInvestor | python | ## Code Before:
from distutils.core import setup
setup(
name='lcinvestor',
version=open('lcinvestor/VERSION').read(),
author='Jeremy Gillick',
author_email='none@none.com',
packages=['lcinvestor', 'lcinvestor.tests', 'lcinvestor.settings'],
package_data={
'lcinvestor': ['VERSION'],
'lcinvestor.settings': ['settings.yaml']
},
scripts=['bin/lcinvestor'],
url='https://github.com/jgillick/LendingClubAutoInvestor',
license=open('LICENSE.txt').read(),
description='A simple tool that will watch your LendingClub account and automatically invest cash as it becomes available.',
long_description=open('README.rst').read(),
install_requires=[
"lendingclub >= 0.1.2",
# "python-daemon >= 1.6",
"argparse >= 1.2.1",
"pybars >= 0.0.4",
"pyyaml >= 3.09",
"pause >= 0.1.2"
],
platforms='osx, posix, linux, windows',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Topic :: Office/Business :: Financial'
],
keywords='lendingclub investing daemon'
)
## Instruction:
Update requirements. Add bat file
## Code After:
from distutils.core import setup
setup(
name='lcinvestor',
version=open('lcinvestor/VERSION').read(),
author='Jeremy Gillick',
author_email='none@none.com',
packages=['lcinvestor', 'lcinvestor.tests', 'lcinvestor.settings'],
package_data={
'lcinvestor': ['VERSION'],
'lcinvestor.settings': ['settings.yaml']
},
scripts=['bin/lcinvestor', 'bin/lcinvestor.bat'],
url='https://github.com/jgillick/LendingClubAutoInvestor',
license=open('LICENSE.txt').read(),
description='A simple tool that will watch your LendingClub account and automatically invest cash as it becomes available.',
long_description=open('README.rst').read(),
install_requires=[
"lendingclub >= 0.1.3",
# "python-daemon >= 1.6",
"argparse >= 1.2.1",
"pyyaml >= 3.09",
"pause >= 0.1.2"
],
platforms='osx, posix, linux, windows',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Topic :: Office/Business :: Financial'
],
keywords='lendingclub investing daemon'
)
| from distutils.core import setup
setup(
name='lcinvestor',
version=open('lcinvestor/VERSION').read(),
author='Jeremy Gillick',
author_email='none@none.com',
packages=['lcinvestor', 'lcinvestor.tests', 'lcinvestor.settings'],
package_data={
'lcinvestor': ['VERSION'],
'lcinvestor.settings': ['settings.yaml']
},
- scripts=['bin/lcinvestor'],
+ scripts=['bin/lcinvestor', 'bin/lcinvestor.bat'],
url='https://github.com/jgillick/LendingClubAutoInvestor',
license=open('LICENSE.txt').read(),
description='A simple tool that will watch your LendingClub account and automatically invest cash as it becomes available.',
long_description=open('README.rst').read(),
install_requires=[
- "lendingclub >= 0.1.2",
? ^
+ "lendingclub >= 0.1.3",
? ^
# "python-daemon >= 1.6",
"argparse >= 1.2.1",
- "pybars >= 0.0.4",
"pyyaml >= 3.09",
"pause >= 0.1.2"
],
platforms='osx, posix, linux, windows',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Topic :: Office/Business :: Financial'
],
keywords='lendingclub investing daemon'
) | 5 | 0.125 | 2 | 3 |
f640a59b35dbd3a39136dece908ad9b8015d1fca | server/socket.js | server/socket.js | module.exports = {
setUpListeners: function(socket) {
socket.on('get:subscriptions', function() {
socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
});
}
}; | module.exports = {
setUpListeners: setUpListeners
};
function setUpListeners(socket) {
socket.on('get:subscriptions', function() {
socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
});
} | Move function out of module.exports to leave space | Move function out of module.exports to leave space
| JavaScript | mit | cobalamin/dripdownode | javascript | ## Code Before:
module.exports = {
setUpListeners: function(socket) {
socket.on('get:subscriptions', function() {
socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
});
}
};
## Instruction:
Move function out of module.exports to leave space
## Code After:
module.exports = {
setUpListeners: setUpListeners
};
function setUpListeners(socket) {
socket.on('get:subscriptions', function() {
socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
});
} | module.exports = {
+ setUpListeners: setUpListeners
- setUpListeners: function(socket) {
- socket.on('get:subscriptions', function() {
- socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
- });
- }
};
+
+ function setUpListeners(socket) {
+ socket.on('get:subscriptions', function() {
+ socket.emit('got:subscriptions', ['OWSLA', 'Dirtybird']);
+ });
+ } | 12 | 1.714286 | 7 | 5 |
82e04fe08a9bde7d44747adba9c3f6c8ef26afc7 | js/components/developer/developer-screen/index.js | js/components/developer/developer-screen/index.js | import React from 'react';
import { View, Button } from 'react-native';
/*
Developer screen.
Provides access to components during development.
*/
export default class DeveloperScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Developer',
},
title: 'Developer',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Button onPress={() => navigate('SampleScreen')} title="Go to the sample screen" />
<Button onPress={() => navigate('MakePaymentScreen')} title="Pay your order" />
</View>
);
}
}
| import React from 'react';
import { View, Button } from 'react-native';
/*
Developer screen.
Provides access to components during development.
*/
export default class DeveloperScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Developer',
},
title: 'Developer',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Button onPress={() => navigate('SampleScreen')} title="Go to the sample screen" />
<Button onPress={() => navigate('MakePaymentScreen')} title="Pay your order" />
<Button onPress={() => navigate('ChooseJobTypeScreen')} title="Go to choose job type screen" />
</View>
);
}
}
| Add navigation to choose job type screen from developer screen | Add navigation to choose job type screen from developer screen
| JavaScript | mit | justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client | javascript | ## Code Before:
import React from 'react';
import { View, Button } from 'react-native';
/*
Developer screen.
Provides access to components during development.
*/
export default class DeveloperScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Developer',
},
title: 'Developer',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Button onPress={() => navigate('SampleScreen')} title="Go to the sample screen" />
<Button onPress={() => navigate('MakePaymentScreen')} title="Pay your order" />
</View>
);
}
}
## Instruction:
Add navigation to choose job type screen from developer screen
## Code After:
import React from 'react';
import { View, Button } from 'react-native';
/*
Developer screen.
Provides access to components during development.
*/
export default class DeveloperScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Developer',
},
title: 'Developer',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Button onPress={() => navigate('SampleScreen')} title="Go to the sample screen" />
<Button onPress={() => navigate('MakePaymentScreen')} title="Pay your order" />
<Button onPress={() => navigate('ChooseJobTypeScreen')} title="Go to choose job type screen" />
</View>
);
}
}
| import React from 'react';
import { View, Button } from 'react-native';
/*
Developer screen.
Provides access to components during development.
*/
export default class DeveloperScreen extends React.Component {
static navigationOptions = {
tabBar: {
label: 'Developer',
},
title: 'Developer',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Button onPress={() => navigate('SampleScreen')} title="Go to the sample screen" />
<Button onPress={() => navigate('MakePaymentScreen')} title="Pay your order" />
+ <Button onPress={() => navigate('ChooseJobTypeScreen')} title="Go to choose job type screen" />
</View>
);
}
} | 1 | 0.04 | 1 | 0 |
91ee07eacc199d4c4ab5a648e037d6b215d2e63c | .travis.yml | .travis.yml | sudo: false
language: c
os: linux
install:
- git clone https://github.com/nim-lang/nim
- cd nim
- ./bootstrap.sh
- cd ..
before_script:
- set -e
- export PATH=$(pwd)/nim/bin:$(pwd):$PATH
script:
- nim c c2nim.nim
- nim c -r testsuite/tester.nim
| sudo: false
language: c
os: linux
install:
- git clone https://github.com/nim-lang/nim
- cd nim
- ./bootstrap.sh
- export PATH=$(pwd)/bin:$PATH
- nim e install_nimble.nims
- cd ..
before_script:
- set -e
- export PATH=$(pwd)/nim/bin:$(pwd):$PATH
- nimble update
- nimble install compiler
script:
- nim c c2nim.nim
- nim c -r testsuite/tester.nim
| Revert "no need for nimble with nim@devel" | Revert "no need for nimble with nim@devel"
This reverts commit c8e49093672c0df1842556a0b35d4842385d4a78.
| YAML | mit | nim-lang/c2nim,BigEpsilon/c2nim,BigEpsilon/c2nim,nim-lang/c2nim | yaml | ## Code Before:
sudo: false
language: c
os: linux
install:
- git clone https://github.com/nim-lang/nim
- cd nim
- ./bootstrap.sh
- cd ..
before_script:
- set -e
- export PATH=$(pwd)/nim/bin:$(pwd):$PATH
script:
- nim c c2nim.nim
- nim c -r testsuite/tester.nim
## Instruction:
Revert "no need for nimble with nim@devel"
This reverts commit c8e49093672c0df1842556a0b35d4842385d4a78.
## Code After:
sudo: false
language: c
os: linux
install:
- git clone https://github.com/nim-lang/nim
- cd nim
- ./bootstrap.sh
- export PATH=$(pwd)/bin:$PATH
- nim e install_nimble.nims
- cd ..
before_script:
- set -e
- export PATH=$(pwd)/nim/bin:$(pwd):$PATH
- nimble update
- nimble install compiler
script:
- nim c c2nim.nim
- nim c -r testsuite/tester.nim
| sudo: false
language: c
os: linux
install:
- git clone https://github.com/nim-lang/nim
- cd nim
- ./bootstrap.sh
+ - export PATH=$(pwd)/bin:$PATH
+ - nim e install_nimble.nims
- cd ..
before_script:
- set -e
- export PATH=$(pwd)/nim/bin:$(pwd):$PATH
+ - nimble update
+ - nimble install compiler
script:
- nim c c2nim.nim
- nim c -r testsuite/tester.nim | 4 | 0.285714 | 4 | 0 |
2af0f72ec8494b24fe0fefb2460fbff64fbb716e | test/lib/srtshifter/options_test.rb | test/lib/srtshifter/options_test.rb | require "test_helper"
describe SrtShifter do
describe "Options" do
describe "validate_args" do
before(:each) do
@args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
end
after(:each) do
end
it "raise error when get none operation option" do
args = ""
opts = SrtShifter::Options.new args
lambda { opts.validate_args }.must_output("Operation option is missing. Please use -h or --help for usage.\n", nil)
end
it "raise error when operation is unknown" do
opts = SrtShifter::Options.new ""
opts.options[:operation] = "bla"
lambda { opts.validate_args }.must_output("Unknown operation: bla. Please use -h or --help for usage.\n", nil)
end
it "must accept lowercase existing operations" do
opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
@args[:operation] = "add"
opts.options = @args
lambda { opts.validate_args }.must_be_silent
end
it "raise error when get none time option"
it "raise error when get none time value"
it "raise error when get none input file path"
it "raise error when get none output file path"
end
end
end | require "test_helper"
describe SrtShifter do
describe "Options" do
describe "validate_args" do
before(:each) do
@args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
end
after(:each) do
@args = nil
end
it "raise error when get none operation option" do
args = ""
opts = SrtShifter::Options.new args
lambda { opts.validate_args }.must_output("Operation option is missing. Please use -h or --help for usage.\n", nil)
end
it "raise error when operation is unknown" do
opts = SrtShifter::Options.new ""
opts.options[:operation] = "bla"
lambda { opts.validate_args }.must_output("Unknown operation: bla. Please use -h or --help for usage.\n", nil)
end
it "must accept lowercase existing operations" do
opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
@args[:operation] = "add"
opts.options = @args
lambda { opts.validate_args }.must_be_silent
end
it "raise error when get none time option"
it "raise error when get none time value"
it "raise error when get none input file path"
it "raise error when get none output file path"
end
end
end | Add after(:each) block in Options test file | Add after(:each) block in Options test file
| Ruby | mit | thiagokimo/srt-shifter | ruby | ## Code Before:
require "test_helper"
describe SrtShifter do
describe "Options" do
describe "validate_args" do
before(:each) do
@args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
end
after(:each) do
end
it "raise error when get none operation option" do
args = ""
opts = SrtShifter::Options.new args
lambda { opts.validate_args }.must_output("Operation option is missing. Please use -h or --help for usage.\n", nil)
end
it "raise error when operation is unknown" do
opts = SrtShifter::Options.new ""
opts.options[:operation] = "bla"
lambda { opts.validate_args }.must_output("Unknown operation: bla. Please use -h or --help for usage.\n", nil)
end
it "must accept lowercase existing operations" do
opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
@args[:operation] = "add"
opts.options = @args
lambda { opts.validate_args }.must_be_silent
end
it "raise error when get none time option"
it "raise error when get none time value"
it "raise error when get none input file path"
it "raise error when get none output file path"
end
end
end
## Instruction:
Add after(:each) block in Options test file
## Code After:
require "test_helper"
describe SrtShifter do
describe "Options" do
describe "validate_args" do
before(:each) do
@args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
end
after(:each) do
@args = nil
end
it "raise error when get none operation option" do
args = ""
opts = SrtShifter::Options.new args
lambda { opts.validate_args }.must_output("Operation option is missing. Please use -h or --help for usage.\n", nil)
end
it "raise error when operation is unknown" do
opts = SrtShifter::Options.new ""
opts.options[:operation] = "bla"
lambda { opts.validate_args }.must_output("Unknown operation: bla. Please use -h or --help for usage.\n", nil)
end
it "must accept lowercase existing operations" do
opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
@args[:operation] = "add"
opts.options = @args
lambda { opts.validate_args }.must_be_silent
end
it "raise error when get none time option"
it "raise error when get none time value"
it "raise error when get none input file path"
it "raise error when get none output file path"
end
end
end | require "test_helper"
describe SrtShifter do
describe "Options" do
describe "validate_args" do
before(:each) do
@args = {:operation => "add", :time => 10.0, :input => "test/samples/test_srt.srt", :output => "test_output.srt"}
end
after(:each) do
-
+ @args = nil
end
it "raise error when get none operation option" do
args = ""
opts = SrtShifter::Options.new args
lambda { opts.validate_args }.must_output("Operation option is missing. Please use -h or --help for usage.\n", nil)
end
it "raise error when operation is unknown" do
opts = SrtShifter::Options.new ""
opts.options[:operation] = "bla"
lambda { opts.validate_args }.must_output("Unknown operation: bla. Please use -h or --help for usage.\n", nil)
end
it "must accept lowercase existing operations" do
opts = SrtShifter::Options.new "test/samples/test_srt.srt test_output.srt"
@args[:operation] = "add"
opts.options = @args
lambda { opts.validate_args }.must_be_silent
end
it "raise error when get none time option"
it "raise error when get none time value"
it "raise error when get none input file path"
it "raise error when get none output file path"
end
end
end | 2 | 0.036364 | 1 | 1 |
5c4012432e7f400af7976866347bc8d47998b726 | setup.cfg | setup.cfg | [flake8]
exclude = gimel/vendor/* | [flake8]
ignore = E128
max-line-length = 100
exclude = gimel/vendor/* | Set max line length to 100 | Set max line length to 100
| INI | mit | Alephbet/gimel | ini | ## Code Before:
[flake8]
exclude = gimel/vendor/*
## Instruction:
Set max line length to 100
## Code After:
[flake8]
ignore = E128
max-line-length = 100
exclude = gimel/vendor/* | [flake8]
+ ignore = E128
+ max-line-length = 100
exclude = gimel/vendor/* | 2 | 1 | 2 | 0 |
c8a66e76734dc2f6066b113aba3085c20f34f00b | Settings/Controls/ProgressBar.h | Settings/Controls/ProgressBar.h |
class ProgressBar : public Control, public StatusCallback {
public:
ProgressBar(int id, Dialog &parent, bool translate = true) :
Control(id, parent, translate) {
}
protected:
virtual IFACEMETHODIMP OnProgress(
unsigned long ulProgress,
unsigned long ulProgressMax,
unsigned long ulStatusCode,
LPCWSTR szStatusText
);
}; |
class ProgressBar : public Control, public StatusCallback {
public:
ProgressBar(int id, Dialog &parent, bool translate = true) :
Control(id, parent, translate) {
}
void Range(int min, int max) {
SendMessage(_hWnd, PBM_SETRANGE32, min, max);
}
void Position(int pos) {
SendMessage(_hWnd, PBM_SETPOS, pos, 0);
}
void Marquee(bool enabled, int refresh = 30) {
SendMessage(_hWnd, PBM_SETMARQUEE, enabled, refresh);
}
protected:
virtual IFACEMETHODIMP OnProgress(
unsigned long ulProgress,
unsigned long ulProgressMax,
unsigned long ulStatusCode,
LPCWSTR szStatusText
);
}; | Add basic implementation of progress bar methods | Add basic implementation of progress bar methods
| C | bsd-2-clause | malensek/3RVX,malensek/3RVX,malensek/3RVX | c | ## Code Before:
class ProgressBar : public Control, public StatusCallback {
public:
ProgressBar(int id, Dialog &parent, bool translate = true) :
Control(id, parent, translate) {
}
protected:
virtual IFACEMETHODIMP OnProgress(
unsigned long ulProgress,
unsigned long ulProgressMax,
unsigned long ulStatusCode,
LPCWSTR szStatusText
);
};
## Instruction:
Add basic implementation of progress bar methods
## Code After:
class ProgressBar : public Control, public StatusCallback {
public:
ProgressBar(int id, Dialog &parent, bool translate = true) :
Control(id, parent, translate) {
}
void Range(int min, int max) {
SendMessage(_hWnd, PBM_SETRANGE32, min, max);
}
void Position(int pos) {
SendMessage(_hWnd, PBM_SETPOS, pos, 0);
}
void Marquee(bool enabled, int refresh = 30) {
SendMessage(_hWnd, PBM_SETMARQUEE, enabled, refresh);
}
protected:
virtual IFACEMETHODIMP OnProgress(
unsigned long ulProgress,
unsigned long ulProgressMax,
unsigned long ulStatusCode,
LPCWSTR szStatusText
);
}; |
class ProgressBar : public Control, public StatusCallback {
public:
ProgressBar(int id, Dialog &parent, bool translate = true) :
Control(id, parent, translate) {
+ }
+
+ void Range(int min, int max) {
+ SendMessage(_hWnd, PBM_SETRANGE32, min, max);
+ }
+
+ void Position(int pos) {
+ SendMessage(_hWnd, PBM_SETPOS, pos, 0);
+ }
+
+ void Marquee(bool enabled, int refresh = 30) {
+ SendMessage(_hWnd, PBM_SETMARQUEE, enabled, refresh);
}
protected:
virtual IFACEMETHODIMP OnProgress(
unsigned long ulProgress,
unsigned long ulProgressMax,
unsigned long ulStatusCode,
LPCWSTR szStatusText
);
}; | 12 | 0.75 | 12 | 0 |
7d9426317e01ffd9aaa172a4eff67ea82a0d1bdf | _config.yml | _config.yml | title: "Jawa : Java, JVM et plus si affinité..."
email: bgiraudou@gmail.com
description: "Blog personnel sur Java, la JVM, Scala, Groovy, Clojure, les outils de construction comme Gradle ou Maven, le mouvement DevOps et bien plus encore."
markdown: kramdown
twitter: {
username: joowgir
}
gems:
- jemoji
| title: "Jawa : Java, JVM et plus si affinité..."
email: bgiraudou@gmail.com
description: "Blog personnel sur Java, la JVM, Scala, Groovy, Clojure, les outils de construction comme Gradle ou Maven, le mouvement DevOps et bien plus encore."
twitter: {
username: joowgir
}
| Remove redundant default configuration settings after update to latest github-pages gem | Remove redundant default configuration settings after update to latest github-pages gem
| YAML | bsd-2-clause | joow/joow.github.io,joow/joow.github.io | yaml | ## Code Before:
title: "Jawa : Java, JVM et plus si affinité..."
email: bgiraudou@gmail.com
description: "Blog personnel sur Java, la JVM, Scala, Groovy, Clojure, les outils de construction comme Gradle ou Maven, le mouvement DevOps et bien plus encore."
markdown: kramdown
twitter: {
username: joowgir
}
gems:
- jemoji
## Instruction:
Remove redundant default configuration settings after update to latest github-pages gem
## Code After:
title: "Jawa : Java, JVM et plus si affinité..."
email: bgiraudou@gmail.com
description: "Blog personnel sur Java, la JVM, Scala, Groovy, Clojure, les outils de construction comme Gradle ou Maven, le mouvement DevOps et bien plus encore."
twitter: {
username: joowgir
}
| title: "Jawa : Java, JVM et plus si affinité..."
email: bgiraudou@gmail.com
description: "Blog personnel sur Java, la JVM, Scala, Groovy, Clojure, les outils de construction comme Gradle ou Maven, le mouvement DevOps et bien plus encore."
- markdown: kramdown
-
twitter: {
username: joowgir
}
-
- gems:
- - jemoji | 5 | 0.416667 | 0 | 5 |
2f94dd026d25f2458034f704d07147597b6d6502 | README.md | README.md |
An implementation of the Enactivist Cognitive Architecture in Python. |
An implementation of the Enactivist Cognitive Architecture in Python.
Documentation can be found [here](http://enactiveagents.readthedocs.io/en/latest/index.html).
| Add link to documentation to the readme. | Add link to documentation to the readme.
| Markdown | mit | Beskhue/enactive-agents,Beskhue/enactive-agents,Beskhue/enactive-agents | markdown | ## Code Before:
An implementation of the Enactivist Cognitive Architecture in Python.
## Instruction:
Add link to documentation to the readme.
## Code After:
An implementation of the Enactivist Cognitive Architecture in Python.
Documentation can be found [here](http://enactiveagents.readthedocs.io/en/latest/index.html).
|
An implementation of the Enactivist Cognitive Architecture in Python.
+
+ Documentation can be found [here](http://enactiveagents.readthedocs.io/en/latest/index.html). | 2 | 1 | 2 | 0 |
59ff810f8344830ebd5d1ddb0a0212baf4bccd23 | pkgs/applications/graphics/ImageMagick/default.nix | pkgs/applications/graphics/ImageMagick/default.nix | args: with args;
(stdenv.mkDerivation ({
name = "ImageMagick-6.3.7-9";
src = fetchurl {
url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-9.tar.bz2;
sha256 = "1s38s78xvzm20ib22zypsb9vvzva0kbqjf0pf4c1q89jzg205pk0";
};
configureFlags = " --with-dots --with-gs-font-dir="+ ghostscript +
"/share/ghostscript/fonts --with-gslib " +(
if args ? tetex then " --with-frozenpaths " else ""
);
buildInputs = [bzip2 freetype ghostscript graphviz libjpeg libpng
libtiff libX11 libxml2 zlib libtool] ++ (if args ? tetex then [args.tetex] else [])
++ (if args ? librsvg then [args.librsvg] else []);
meta = {
homepage = http://www.imagemagick.org;
};
} // (if args ? tetex then {
preConfigure = "
export DVIDecodeDelegate=${args.tetex}/bin/dvips
";
} else {})))
| args: with args;
(stdenv.mkDerivation ({
name = "ImageMagick-6.3.7-10";
src = fetchurl {
# Warning: Source tarballs seem to vanish very quickly from this site!
url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-10.tar.bz2;
sha256 = "c00fb0d21baa292a55bb0e30ca30ffe2571e0d3df9e692da441aa81ff1cdde10";
};
configureFlags = " --with-dots --with-gs-font-dir="+ ghostscript +
"/share/ghostscript/fonts --with-gslib " +(
if args ? tetex then " --with-frozenpaths " else ""
);
buildInputs = [bzip2 freetype ghostscript graphviz libjpeg libpng
libtiff libX11 libxml2 zlib libtool] ++ (if args ? tetex then [args.tetex] else [])
++ (if args ? librsvg then [args.librsvg] else []);
meta = {
description = ''ImageMagick(R) is a software suite to create, edit, and compose bitmap
images. It can read, convert and write images in a variety of
formats (over 100).'';
homepage = http://www.imagemagick.org;
};
} // (if args ? tetex then {
preConfigure = "
export DVIDecodeDelegate=${args.tetex}/bin/dvips
";
} else {})))
| Update ImageMagick since the previous source tarball is no longer available (!). | Update ImageMagick since the previous source tarball is no longer available (!).
svn path=/nixpkgs/trunk/; revision=10646
| Nix | mit | SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,triton/triton,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,triton/triton,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,triton/triton,triton/triton,NixOS/nixpkgs,triton/triton,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs | nix | ## Code Before:
args: with args;
(stdenv.mkDerivation ({
name = "ImageMagick-6.3.7-9";
src = fetchurl {
url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-9.tar.bz2;
sha256 = "1s38s78xvzm20ib22zypsb9vvzva0kbqjf0pf4c1q89jzg205pk0";
};
configureFlags = " --with-dots --with-gs-font-dir="+ ghostscript +
"/share/ghostscript/fonts --with-gslib " +(
if args ? tetex then " --with-frozenpaths " else ""
);
buildInputs = [bzip2 freetype ghostscript graphviz libjpeg libpng
libtiff libX11 libxml2 zlib libtool] ++ (if args ? tetex then [args.tetex] else [])
++ (if args ? librsvg then [args.librsvg] else []);
meta = {
homepage = http://www.imagemagick.org;
};
} // (if args ? tetex then {
preConfigure = "
export DVIDecodeDelegate=${args.tetex}/bin/dvips
";
} else {})))
## Instruction:
Update ImageMagick since the previous source tarball is no longer available (!).
svn path=/nixpkgs/trunk/; revision=10646
## Code After:
args: with args;
(stdenv.mkDerivation ({
name = "ImageMagick-6.3.7-10";
src = fetchurl {
# Warning: Source tarballs seem to vanish very quickly from this site!
url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-10.tar.bz2;
sha256 = "c00fb0d21baa292a55bb0e30ca30ffe2571e0d3df9e692da441aa81ff1cdde10";
};
configureFlags = " --with-dots --with-gs-font-dir="+ ghostscript +
"/share/ghostscript/fonts --with-gslib " +(
if args ? tetex then " --with-frozenpaths " else ""
);
buildInputs = [bzip2 freetype ghostscript graphviz libjpeg libpng
libtiff libX11 libxml2 zlib libtool] ++ (if args ? tetex then [args.tetex] else [])
++ (if args ? librsvg then [args.librsvg] else []);
meta = {
description = ''ImageMagick(R) is a software suite to create, edit, and compose bitmap
images. It can read, convert and write images in a variety of
formats (over 100).'';
homepage = http://www.imagemagick.org;
};
} // (if args ? tetex then {
preConfigure = "
export DVIDecodeDelegate=${args.tetex}/bin/dvips
";
} else {})))
| args: with args;
(stdenv.mkDerivation ({
- name = "ImageMagick-6.3.7-9";
? ^
+ name = "ImageMagick-6.3.7-10";
? ^^
src = fetchurl {
+ # Warning: Source tarballs seem to vanish very quickly from this site!
- url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-9.tar.bz2;
? ^
+ url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-10.tar.bz2;
? ^^
- sha256 = "1s38s78xvzm20ib22zypsb9vvzva0kbqjf0pf4c1q89jzg205pk0";
+ sha256 = "c00fb0d21baa292a55bb0e30ca30ffe2571e0d3df9e692da441aa81ff1cdde10";
};
configureFlags = " --with-dots --with-gs-font-dir="+ ghostscript +
"/share/ghostscript/fonts --with-gslib " +(
if args ? tetex then " --with-frozenpaths " else ""
);
buildInputs = [bzip2 freetype ghostscript graphviz libjpeg libpng
libtiff libX11 libxml2 zlib libtool] ++ (if args ? tetex then [args.tetex] else [])
++ (if args ? librsvg then [args.librsvg] else []);
meta = {
+ description = ''ImageMagick(R) is a software suite to create, edit, and compose bitmap
+ images. It can read, convert and write images in a variety of
+ formats (over 100).'';
homepage = http://www.imagemagick.org;
};
} // (if args ? tetex then {
preConfigure = "
export DVIDecodeDelegate=${args.tetex}/bin/dvips
";
} else {}))) | 10 | 0.384615 | 7 | 3 |
f068faa36ca07111984bc4a1b868f696cfd15134 | CHANGELOG.md | CHANGELOG.md | - Add support for using external vagrant box and archives as source for deploy
# v.0.1.1.1
- Add support for Terraform v0.9.5
# v0.1.1
- Add new optional field "user_data" in schema, accepts arbitary string, your VM specific configuration can be stored here.
Some 3rdparty tool expects certain content be set in this field.
For example, [CiscoCloud/terraform.py](https://github.com/ccll/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
```
{
"role": "foobar",
...
}
```
It uses the 'role' field to group hosts.
| - Add support for using external vagrant box and archives as source for deploy
# v.0.1.1.1
- Add support for Terraform v0.9.5
# v0.1.1
- Add new optional field "user_data" in schema, accepts arbitary string, your VM specific configuration can be stored here.
Some 3rdparty tool expects certain content be set in this field.
For example, [mantl/terraform.py](https://github.com/mantl/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
```
{
"role": "foobar",
...
}
```
It uses the 'role' field to group hosts.
| Fix link to Github project | Fix link to Github project
| Markdown | mit | ccll/terraform-provider-virtualbox | markdown | ## Code Before:
- Add support for using external vagrant box and archives as source for deploy
# v.0.1.1.1
- Add support for Terraform v0.9.5
# v0.1.1
- Add new optional field "user_data" in schema, accepts arbitary string, your VM specific configuration can be stored here.
Some 3rdparty tool expects certain content be set in this field.
For example, [CiscoCloud/terraform.py](https://github.com/ccll/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
```
{
"role": "foobar",
...
}
```
It uses the 'role' field to group hosts.
## Instruction:
Fix link to Github project
## Code After:
- Add support for using external vagrant box and archives as source for deploy
# v.0.1.1.1
- Add support for Terraform v0.9.5
# v0.1.1
- Add new optional field "user_data" in schema, accepts arbitary string, your VM specific configuration can be stored here.
Some 3rdparty tool expects certain content be set in this field.
For example, [mantl/terraform.py](https://github.com/mantl/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
```
{
"role": "foobar",
...
}
```
It uses the 'role' field to group hosts.
| - Add support for using external vagrant box and archives as source for deploy
# v.0.1.1.1
- Add support for Terraform v0.9.5
# v0.1.1
- Add new optional field "user_data" in schema, accepts arbitary string, your VM specific configuration can be stored here.
Some 3rdparty tool expects certain content be set in this field.
- For example, [CiscoCloud/terraform.py](https://github.com/ccll/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
? ^^^^^^ --- ^^^
+ For example, [mantl/terraform.py](https://github.com/mantl/terraform.py) (a terraform-ansible bridging tool) interprete 'user_data' as a JSON string:
? ^^^^ ^^^^
```
{
"role": "foobar",
...
}
```
It uses the 'role' field to group hosts. | 2 | 0.111111 | 1 | 1 |
b74f602043949edc1be1049b4d9daab3d70d1cdc | ansible/playbook.yml | ansible/playbook.yml | - hosts: 127.0.0.1
roles:
- desktop
- awesome
- phpfarm
- postgresql
- rabbitmq
tasks:
- shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
args:
creates: /usr/local/bin/composer
- file: name=/var/www/html/adminer state=directory
- get_url: url=http://www.adminer.org/latest.php dest=/var/www/html/adminer/index.php
- yum: name=community-mysql-server state=present
| - hosts: 127.0.0.1
roles:
- desktop
- awesome
- phpfarm
- postgresql
- rabbitmq
tasks:
# - shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
# args:
# creates: /usr/local/bin/composer
- file: name=/var/www/html/adminer state=directory
- get_url: url=http://www.adminer.org/latest.php dest=/var/www/html/adminer/index.php
- yum: name=community-mysql-server state=present
| Disable composer as it causing errors because of disabled phpfarm | Disable composer as it causing errors because of disabled phpfarm
| YAML | mit | nenadalm/fedora-livecd | yaml | ## Code Before:
- hosts: 127.0.0.1
roles:
- desktop
- awesome
- phpfarm
- postgresql
- rabbitmq
tasks:
- shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
args:
creates: /usr/local/bin/composer
- file: name=/var/www/html/adminer state=directory
- get_url: url=http://www.adminer.org/latest.php dest=/var/www/html/adminer/index.php
- yum: name=community-mysql-server state=present
## Instruction:
Disable composer as it causing errors because of disabled phpfarm
## Code After:
- hosts: 127.0.0.1
roles:
- desktop
- awesome
- phpfarm
- postgresql
- rabbitmq
tasks:
# - shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
# args:
# creates: /usr/local/bin/composer
- file: name=/var/www/html/adminer state=directory
- get_url: url=http://www.adminer.org/latest.php dest=/var/www/html/adminer/index.php
- yum: name=community-mysql-server state=present
| - hosts: 127.0.0.1
roles:
- desktop
- awesome
- phpfarm
- postgresql
- rabbitmq
tasks:
- - shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
+ # - shell: curl -sS https://getcomposer.org/installer | /opt/phpfarm/inst/current/bin/php -- --install-dir=/usr/local/bin --filename=composer
? ++++++++
- args:
+ # args:
- creates: /usr/local/bin/composer
+ # creates: /usr/local/bin/composer
? ++++++++
- file: name=/var/www/html/adminer state=directory
- get_url: url=http://www.adminer.org/latest.php dest=/var/www/html/adminer/index.php
- yum: name=community-mysql-server state=present
| 6 | 0.333333 | 3 | 3 |
acc7dedd84974c908e6a5e0d5a9da70d48f191c8 | corelib/basic_object.rb | corelib/basic_object.rb | class BasicObject
def initialize(*args)
# nothing ...
end
def ==(other)
`self === other`
end
def __send__(symbol, *args, &block)
`
var meth = self[mid_to_jsid(symbol)];
if (meth) {
return meth.apply(self, args);
}
else {
throw new Error("method missing yielder for " + symbol + " in __send__");
}
`
end
alias_method :send, :__send__
alias_method :eql?, :==
alias_method :equal?, :==
def instance_eval(string = nil, &block)
raise ArgumentError, 'block not supplied' unless block_given?
`return block.call(self);`
end
def instance_exec(*args, &block)
raise ArgumentError, 'block not supplied' unless block_given?
`
return block.apply(self, args);
`
end
def method_missing(symbol, *args)
raise NoMethodError, "undefined method `#{symbol}` for #{self.inspect}"
end
def singleton_method_added(symbol)
# nothing ...
end
def singleton_method_removed(symbol)
# nothing ...
end
def singleton_method_undefined(symbol)
# nothing ...
end
end
| class BasicObject
def initialize(*args)
nil
end
def ==(other)
`self === other`
end
def __send__(symbol, *args, &block)
`
var meth = self[mid_to_jsid(symbol)];
if (meth) {
args.unshift(null);
return meth.apply(self, args);
}
else {
throw new Error("method missing yielder for " + symbol + " in __send__");
}
`
end
alias_method :send, :__send__
alias_method :eql?, :==
alias_method :equal?, :==
def instance_eval(string = nil, &block)
`
if (block === nil) rb_raise(RubyArgError, 'block not supplied');
return block.call(self, null);
`
end
def instance_exec(*args, &block)
`
if (block === nil) rb_raise(RubyArgError, 'block not supplied');
args.unshift(null);
return block.apply(self, args);
`
end
def method_missing(symbol, *args)
raise NoMethodError, "undefined method `#{symbol}` for #{self.inspect}"
end
def singleton_method_added(symbol)
nil
end
def singleton_method_removed(symbol)
nil
end
def singleton_method_undefined(symbol)
nil
end
end
| Clean up basic object and reflect new method sending (inc block) | Clean up basic object and reflect new method sending (inc block)
| Ruby | mit | c42engineering/opal,domgetter/opal,Mogztter/opal,kachick/opal,castwide/opal,Ajedi32/opal,charliesome/opal,opal/opal,opal/opal,bbatsov/opal,wied03/opal,c42engineering/opal,Flikofbluelight747/opal,Flikofbluelight747/opal,gabrielrios/opal,Flikofbluelight747/opal,gausie/opal,kachick/opal,jgaskins/opal,iliabylich/opal,opal/opal,Mogztter/opal,wied03/opal,gabrielrios/opal,Mogztter/opal,jannishuebl/opal,bbatsov/opal,Mogztter/opal,domgetter/opal,merongivian/opal,Ajedi32/opal,kachick/opal,catprintlabs/opal,suyesh/opal,charliesome/opal,jgaskins/opal,opal/opal,catprintlabs/opal,gausie/opal,catprintlabs/opal,iliabylich/opal,jannishuebl/opal,jgaskins/opal,c42engineering/opal,merongivian/opal,fazibear/opal,bbatsov/opal,fazibear/opal,fazibear/opal,gabrielrios/opal,kachick/opal,gausie/opal,suyesh/opal,wied03/opal,castwide/opal,castwide/opal,suyesh/opal,Ajedi32/opal,jannishuebl/opal,merongivian/opal,iliabylich/opal | ruby | ## Code Before:
class BasicObject
def initialize(*args)
# nothing ...
end
def ==(other)
`self === other`
end
def __send__(symbol, *args, &block)
`
var meth = self[mid_to_jsid(symbol)];
if (meth) {
return meth.apply(self, args);
}
else {
throw new Error("method missing yielder for " + symbol + " in __send__");
}
`
end
alias_method :send, :__send__
alias_method :eql?, :==
alias_method :equal?, :==
def instance_eval(string = nil, &block)
raise ArgumentError, 'block not supplied' unless block_given?
`return block.call(self);`
end
def instance_exec(*args, &block)
raise ArgumentError, 'block not supplied' unless block_given?
`
return block.apply(self, args);
`
end
def method_missing(symbol, *args)
raise NoMethodError, "undefined method `#{symbol}` for #{self.inspect}"
end
def singleton_method_added(symbol)
# nothing ...
end
def singleton_method_removed(symbol)
# nothing ...
end
def singleton_method_undefined(symbol)
# nothing ...
end
end
## Instruction:
Clean up basic object and reflect new method sending (inc block)
## Code After:
class BasicObject
def initialize(*args)
nil
end
def ==(other)
`self === other`
end
def __send__(symbol, *args, &block)
`
var meth = self[mid_to_jsid(symbol)];
if (meth) {
args.unshift(null);
return meth.apply(self, args);
}
else {
throw new Error("method missing yielder for " + symbol + " in __send__");
}
`
end
alias_method :send, :__send__
alias_method :eql?, :==
alias_method :equal?, :==
def instance_eval(string = nil, &block)
`
if (block === nil) rb_raise(RubyArgError, 'block not supplied');
return block.call(self, null);
`
end
def instance_exec(*args, &block)
`
if (block === nil) rb_raise(RubyArgError, 'block not supplied');
args.unshift(null);
return block.apply(self, args);
`
end
def method_missing(symbol, *args)
raise NoMethodError, "undefined method `#{symbol}` for #{self.inspect}"
end
def singleton_method_added(symbol)
nil
end
def singleton_method_removed(symbol)
nil
end
def singleton_method_undefined(symbol)
nil
end
end
| class BasicObject
def initialize(*args)
- # nothing ...
+ nil
end
def ==(other)
`self === other`
end
def __send__(symbol, *args, &block)
`
var meth = self[mid_to_jsid(symbol)];
if (meth) {
+ args.unshift(null);
return meth.apply(self, args);
}
else {
throw new Error("method missing yielder for " + symbol + " in __send__");
}
`
end
alias_method :send, :__send__
alias_method :eql?, :==
alias_method :equal?, :==
def instance_eval(string = nil, &block)
- raise ArgumentError, 'block not supplied' unless block_given?
-
+ `
+ if (block === nil) rb_raise(RubyArgError, 'block not supplied');
- `return block.call(self);`
? ^ -
+ return block.call(self, null);
? ^^ ++++++
+ `
end
def instance_exec(*args, &block)
- raise ArgumentError, 'block not supplied' unless block_given?
-
`
+ if (block === nil) rb_raise(RubyArgError, 'block not supplied');
+ args.unshift(null);
return block.apply(self, args);
`
end
def method_missing(symbol, *args)
raise NoMethodError, "undefined method `#{symbol}` for #{self.inspect}"
end
def singleton_method_added(symbol)
- # nothing ...
+ nil
end
def singleton_method_removed(symbol)
- # nothing ...
+ nil
end
def singleton_method_undefined(symbol)
- # nothing ...
+ nil
end
end | 20 | 0.350877 | 11 | 9 |
6e4128069d35d8436b5e6e4b29cf986d05c58f0f | apps/settings/components/private_connections_counter/index.styl | apps/settings/components/private_connections_counter/index.styl | private-connection-count-colors-exceeded = colors-state-alert
.PrivateConnectionCount
&__count
float right
&__warning
text-align right
color private-connection-count-colors-exceeded
&[data-state='exceeded']
.PrivateConnectionCount
&__count
> span
color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
&__fill
background-color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
height 2em
border 1px solid colors-gray-border
overflow hidden
&__fill
height 100%
background-color colors-gray-text
| private-connection-count-colors-exceeded = colors-state-alert
.PrivateConnectionCount
&__count
float right
&__warning
text-align right
font-size font-size-xs
&[data-state='exceeded']
.PrivateConnectionCount
&__count
> span
color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
&__fill
background-color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
height 2em
border 1px solid colors-gray-border
overflow hidden
&__fill
height 100%
background-color colors-gray-text
| Tweak according to new comps | Tweak according to new comps
| Stylus | mit | aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell | stylus | ## Code Before:
private-connection-count-colors-exceeded = colors-state-alert
.PrivateConnectionCount
&__count
float right
&__warning
text-align right
color private-connection-count-colors-exceeded
&[data-state='exceeded']
.PrivateConnectionCount
&__count
> span
color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
&__fill
background-color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
height 2em
border 1px solid colors-gray-border
overflow hidden
&__fill
height 100%
background-color colors-gray-text
## Instruction:
Tweak according to new comps
## Code After:
private-connection-count-colors-exceeded = colors-state-alert
.PrivateConnectionCount
&__count
float right
&__warning
text-align right
font-size font-size-xs
&[data-state='exceeded']
.PrivateConnectionCount
&__count
> span
color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
&__fill
background-color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
height 2em
border 1px solid colors-gray-border
overflow hidden
&__fill
height 100%
background-color colors-gray-text
| private-connection-count-colors-exceeded = colors-state-alert
.PrivateConnectionCount
&__count
float right
&__warning
text-align right
- color private-connection-count-colors-exceeded
+ font-size font-size-xs
&[data-state='exceeded']
.PrivateConnectionCount
&__count
> span
color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
&__fill
background-color private-connection-count-colors-exceeded
.PrivateConnectionsMeter
height 2em
border 1px solid colors-gray-border
overflow hidden
&__fill
height 100%
background-color colors-gray-text | 2 | 0.071429 | 1 | 1 |
4e994dea6d9b7df857001fc817a5e9c774a3f71b | requirements.txt | requirements.txt | celery==3.1.18
croniter==0.3.5
django-bootstrap3==5.4.0
django-celery==3.1.16
django-flat-theme==0.9.3
Django==1.8.1
djangorestframework==3.1.2
django-allauth==0.19.1
nose==1.3.6
pytz==2015.4
redis==2.10.3
requests==2.7.0
twilio==4.3.0
| celery==3.1.18
croniter==0.3.5
django-bootstrap3==5.4.0
django-celery==3.1.16
django-flat-theme==0.9.3
Django==1.8.1
djangorestframework==3.1.2
django-allauth==0.19.1
pytz==2015.4
redis==2.10.3
requests==2.7.0
twilio==4.3.0
| Drop nose; we have Django tests. | Drop nose; we have Django tests.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>
| Text | mit | takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web | text | ## Code Before:
celery==3.1.18
croniter==0.3.5
django-bootstrap3==5.4.0
django-celery==3.1.16
django-flat-theme==0.9.3
Django==1.8.1
djangorestframework==3.1.2
django-allauth==0.19.1
nose==1.3.6
pytz==2015.4
redis==2.10.3
requests==2.7.0
twilio==4.3.0
## Instruction:
Drop nose; we have Django tests.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>
## Code After:
celery==3.1.18
croniter==0.3.5
django-bootstrap3==5.4.0
django-celery==3.1.16
django-flat-theme==0.9.3
Django==1.8.1
djangorestframework==3.1.2
django-allauth==0.19.1
pytz==2015.4
redis==2.10.3
requests==2.7.0
twilio==4.3.0
| celery==3.1.18
croniter==0.3.5
django-bootstrap3==5.4.0
django-celery==3.1.16
django-flat-theme==0.9.3
Django==1.8.1
djangorestframework==3.1.2
django-allauth==0.19.1
- nose==1.3.6
pytz==2015.4
redis==2.10.3
requests==2.7.0
twilio==4.3.0 | 1 | 0.076923 | 0 | 1 |
f5d025e4a30b5f0dc1a4df85135e0ee507847342 | test/CodeGen/unreachable-ret.c | test/CodeGen/unreachable-ret.c | // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
extern void abort() __attribute__((noreturn));
void f1() {
abort();
}
// CHECK-LABEL: define void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
void *f2() {
abort();
return 0;
}
// CHECK-LABEL: define i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
| // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
extern void abort() __attribute__((noreturn));
void f1() {
abort();
}
// CHECK-LABEL: define {{.*}}void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
void *f2() {
abort();
return 0;
}
// CHECK-LABEL: define {{.*}}i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
| Fix for different build configurations. | Fix for different build configurations.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@358125 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang | c | ## Code Before:
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
extern void abort() __attribute__((noreturn));
void f1() {
abort();
}
// CHECK-LABEL: define void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
void *f2() {
abort();
return 0;
}
// CHECK-LABEL: define i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
## Instruction:
Fix for different build configurations.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@358125 91177308-0d34-0410-b5e6-96231b3b80d8
## Code After:
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
extern void abort() __attribute__((noreturn));
void f1() {
abort();
}
// CHECK-LABEL: define {{.*}}void @f1()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
void *f2() {
abort();
return 0;
}
// CHECK-LABEL: define {{.*}}i8* @f2()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
| // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
extern void abort() __attribute__((noreturn));
void f1() {
abort();
}
- // CHECK-LABEL: define void @f1()
+ // CHECK-LABEL: define {{.*}}void @f1()
? ++++++
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
void *f2() {
abort();
return 0;
}
- // CHECK-LABEL: define i8* @f2()
+ // CHECK-LABEL: define {{.*}}i8* @f2()
? ++++++
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @abort()
// CHECK-NEXT: unreachable
// CHECK-NEXT: }
| 4 | 0.173913 | 2 | 2 |
827805fcbbf96e40ff1b3b771d06972803c63e5f | concourse/scripts/smoke_tests_email.sh | concourse/scripts/smoke_tests_email.sh |
set -eu
DEPLOY_ENV=$1
SYSTEM_DNS_ZONE_NAME=$2
ALERT_EMAIL_ADDRESS=$3
TO="${ALERT_EMAIL_ADDRESS}"
FROM="${ALERT_EMAIL_ADDRESS}"
# SMOKE_TEST_LOG=./smoke-tests-log/smoke-tests.log
# LAST_COMMIT_LOG=./smoke-tests-log/last-commit.log
write_message_json() {
cat <<EOF > message.json
{
"Subject": {
"Data": "Smoke tests failed in ${DEPLOY_ENV}"
},
"Body": {
"Html": {
"Data": "The smoke tests have failed in environment <b>${DEPLOY_ENV}</b>. See \
<a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
for details<br/>"
}
}
}
EOF
}
write_message_json
aws ses send-email --to "${TO}" --message file://message.json --from "${FROM}"
|
set -eu
DEPLOY_ENV=$1
SYSTEM_DNS_ZONE_NAME=$2
ALERT_EMAIL_ADDRESS=$3
TO="${ALERT_EMAIL_ADDRESS}"
FROM="${ALERT_EMAIL_ADDRESS}"
# SMOKE_TEST_LOG=./smoke-tests-log/smoke-tests.log
# LAST_COMMIT_LOG=./smoke-tests-log/last-commit.log
write_message_json() {
cat <<EOF > message.json
{
"Subject": {
"Data": "Smoke tests failed in ${DEPLOY_ENV}"
},
"Body": {
"Html": {
"Data": "The smoke tests have failed in environment <b>${DEPLOY_ENV}</b>. See \
<a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/teams/main/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
for details<br/>"
}
}
}
EOF
}
write_message_json
aws ses send-email --to "${TO}" --message file://message.json --from "${FROM}"
| Fix the concourse link in smoke test emails | Fix the concourse link in smoke test emails
This was broken when the concourse upgrade added teams.
| Shell | mit | alphagov/paas-cf,jimconner/paas-cf,alphagov/paas-cf,alphagov/paas-cf,alphagov/paas-cf,jimconner/paas-cf,jimconner/paas-cf,jimconner/paas-cf,alphagov/paas-cf,jimconner/paas-cf,alphagov/paas-cf,jimconner/paas-cf,jimconner/paas-cf,alphagov/paas-cf,alphagov/paas-cf | shell | ## Code Before:
set -eu
DEPLOY_ENV=$1
SYSTEM_DNS_ZONE_NAME=$2
ALERT_EMAIL_ADDRESS=$3
TO="${ALERT_EMAIL_ADDRESS}"
FROM="${ALERT_EMAIL_ADDRESS}"
# SMOKE_TEST_LOG=./smoke-tests-log/smoke-tests.log
# LAST_COMMIT_LOG=./smoke-tests-log/last-commit.log
write_message_json() {
cat <<EOF > message.json
{
"Subject": {
"Data": "Smoke tests failed in ${DEPLOY_ENV}"
},
"Body": {
"Html": {
"Data": "The smoke tests have failed in environment <b>${DEPLOY_ENV}</b>. See \
<a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
for details<br/>"
}
}
}
EOF
}
write_message_json
aws ses send-email --to "${TO}" --message file://message.json --from "${FROM}"
## Instruction:
Fix the concourse link in smoke test emails
This was broken when the concourse upgrade added teams.
## Code After:
set -eu
DEPLOY_ENV=$1
SYSTEM_DNS_ZONE_NAME=$2
ALERT_EMAIL_ADDRESS=$3
TO="${ALERT_EMAIL_ADDRESS}"
FROM="${ALERT_EMAIL_ADDRESS}"
# SMOKE_TEST_LOG=./smoke-tests-log/smoke-tests.log
# LAST_COMMIT_LOG=./smoke-tests-log/last-commit.log
write_message_json() {
cat <<EOF > message.json
{
"Subject": {
"Data": "Smoke tests failed in ${DEPLOY_ENV}"
},
"Body": {
"Html": {
"Data": "The smoke tests have failed in environment <b>${DEPLOY_ENV}</b>. See \
<a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/teams/main/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
for details<br/>"
}
}
}
EOF
}
write_message_json
aws ses send-email --to "${TO}" --message file://message.json --from "${FROM}"
|
set -eu
DEPLOY_ENV=$1
SYSTEM_DNS_ZONE_NAME=$2
ALERT_EMAIL_ADDRESS=$3
TO="${ALERT_EMAIL_ADDRESS}"
FROM="${ALERT_EMAIL_ADDRESS}"
# SMOKE_TEST_LOG=./smoke-tests-log/smoke-tests.log
# LAST_COMMIT_LOG=./smoke-tests-log/last-commit.log
write_message_json() {
cat <<EOF > message.json
{
"Subject": {
"Data": "Smoke tests failed in ${DEPLOY_ENV}"
},
"Body": {
"Html": {
"Data": "The smoke tests have failed in environment <b>${DEPLOY_ENV}</b>. See \
- <a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
+ <a href='https://deployer.${SYSTEM_DNS_ZONE_NAME}/teams/main/pipelines/create-bosh-cloudfoundry?groups=health'>Concourse</a> \
? +++++++++++
for details<br/>"
}
}
}
EOF
}
write_message_json
aws ses send-email --to "${TO}" --message file://message.json --from "${FROM}" | 2 | 0.060606 | 1 | 1 |
14b29df0709c23cd1162a002d63be991cbae2c44 | routes/socket.js | routes/socket.js | module.exports = function(socket) {
console.log('user connected!');
socket.emit('init', { message: 'Hello World' });
socket.on('user:joined', function(userName) {
socket.broadcast.emit('user:joined', userName);
console.log('user joined ' + userName);
});
socket.on('message:send', function(data) {
socket.broadcast.emit('message:receive', data);
console.log(data.text, data.author);
});
socket.on('disconnect', function() {
console.log('user disconnected!');
});
};
| module.exports = function(socket) {
console.log('user connected!');
var currentUser = null;
socket.emit('init', { message: 'Hello World' });
socket.on('user:joined', function(userName) {
currentUser = userName;
socket.broadcast.emit('user:joined', userName);
console.log('user joined ' + userName);
});
socket.on('message:send', function(data) {
socket.broadcast.emit('message:receive', data);
console.log(data.text, data.author);
});
socket.on('disconnect', function() {
socket.broadcast.emit('user:left', currentUser);
console.log('user disconnected!', currentUser);
});
};
| Add information about logged out user. | Add information about logged out user.
| JavaScript | mit | mciastek/react-chat-backend | javascript | ## Code Before:
module.exports = function(socket) {
console.log('user connected!');
socket.emit('init', { message: 'Hello World' });
socket.on('user:joined', function(userName) {
socket.broadcast.emit('user:joined', userName);
console.log('user joined ' + userName);
});
socket.on('message:send', function(data) {
socket.broadcast.emit('message:receive', data);
console.log(data.text, data.author);
});
socket.on('disconnect', function() {
console.log('user disconnected!');
});
};
## Instruction:
Add information about logged out user.
## Code After:
module.exports = function(socket) {
console.log('user connected!');
var currentUser = null;
socket.emit('init', { message: 'Hello World' });
socket.on('user:joined', function(userName) {
currentUser = userName;
socket.broadcast.emit('user:joined', userName);
console.log('user joined ' + userName);
});
socket.on('message:send', function(data) {
socket.broadcast.emit('message:receive', data);
console.log(data.text, data.author);
});
socket.on('disconnect', function() {
socket.broadcast.emit('user:left', currentUser);
console.log('user disconnected!', currentUser);
});
};
| module.exports = function(socket) {
console.log('user connected!');
+
+ var currentUser = null;
socket.emit('init', { message: 'Hello World' });
socket.on('user:joined', function(userName) {
+ currentUser = userName;
socket.broadcast.emit('user:joined', userName);
console.log('user joined ' + userName);
});
socket.on('message:send', function(data) {
socket.broadcast.emit('message:receive', data);
console.log(data.text, data.author);
});
socket.on('disconnect', function() {
+ socket.broadcast.emit('user:left', currentUser);
- console.log('user disconnected!');
+ console.log('user disconnected!', currentUser);
? +++++++++++++
});
}; | 6 | 0.315789 | 5 | 1 |
7e9386b56a763b5a606851c633eb7dfb073511c1 | lib/stairs/steps/s3.rb | lib/stairs/steps/s3.rb | require "stairs"
module Stairs
module Steps
class S3 < Stairs::Step
title "S3"
description "Setup AWS and S3 bucket access"
def run
env "AWS_ACCESS_KEY_ID", provide("AWS Access Key ID")
env "AWS_SECRET_ACCESS_KEY", provide("AWS Secret Access Key")
env "AWS_S3_BUCKET", provide("S3 Bucket name")
end
end
end
end
| require "stairs"
module Stairs
module Steps
class S3 < Stairs::Step
title "S3"
description "Setup AWS and S3 bucket access"
def run
env key_id_name, provide("AWS Access Key ID")
env key_secret_name, provide("AWS Secret Access Key")
env bucket_name, provide("S3 Bucket name")
end
private
def key_id_name
options[:key_id] || "AWS_ACCESS_KEY_ID"
end
def key_secret_name
options[:key_secret] || "AWS_SECRET_ACCESS_KEY"
end
def bucket_name
options[:bucket] || "AWS_S3_BUCKET"
end
end
end
end
| Add option to control name of env vars | Add option to control name of env vars
| Ruby | mit | patbenatar/stairs-steps-s3 | ruby | ## Code Before:
require "stairs"
module Stairs
module Steps
class S3 < Stairs::Step
title "S3"
description "Setup AWS and S3 bucket access"
def run
env "AWS_ACCESS_KEY_ID", provide("AWS Access Key ID")
env "AWS_SECRET_ACCESS_KEY", provide("AWS Secret Access Key")
env "AWS_S3_BUCKET", provide("S3 Bucket name")
end
end
end
end
## Instruction:
Add option to control name of env vars
## Code After:
require "stairs"
module Stairs
module Steps
class S3 < Stairs::Step
title "S3"
description "Setup AWS and S3 bucket access"
def run
env key_id_name, provide("AWS Access Key ID")
env key_secret_name, provide("AWS Secret Access Key")
env bucket_name, provide("S3 Bucket name")
end
private
def key_id_name
options[:key_id] || "AWS_ACCESS_KEY_ID"
end
def key_secret_name
options[:key_secret] || "AWS_SECRET_ACCESS_KEY"
end
def bucket_name
options[:bucket] || "AWS_S3_BUCKET"
end
end
end
end
| require "stairs"
module Stairs
module Steps
class S3 < Stairs::Step
title "S3"
description "Setup AWS and S3 bucket access"
def run
- env "AWS_ACCESS_KEY_ID", provide("AWS Access Key ID")
? ^^^^ ^^^^^^ ^^^^^^^
+ env key_id_name, provide("AWS Access Key ID")
? ^^^ ^^ ^^^^
- env "AWS_SECRET_ACCESS_KEY", provide("AWS Secret Access Key")
+ env key_secret_name, provide("AWS Secret Access Key")
- env "AWS_S3_BUCKET", provide("S3 Bucket name")
? ^^^^ ^^^^^^^^^^
+ env bucket_name, provide("S3 Bucket name")
? ^^^^^^ ^^^^
+ end
+
+ private
+
+ def key_id_name
+ options[:key_id] || "AWS_ACCESS_KEY_ID"
+ end
+
+ def key_secret_name
+ options[:key_secret] || "AWS_SECRET_ACCESS_KEY"
+ end
+
+ def bucket_name
+ options[:bucket] || "AWS_S3_BUCKET"
end
end
end
end | 20 | 1.25 | 17 | 3 |
49a3927b8292f52ce546df8b4a83e794a31e0fa1 | modules/grafana/templates/dashboards/deployment_panels/_links.json.erb | modules/grafana/templates/dashboards/deployment_panels/_links.json.erb | {
"content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
"editable": true,
"error": false,
"id": 12,
"isNew": true,
"links": [],
"mode": "html",
"span": 6,
"style": {
"font-size": "20pt"
},
"title": "Useful links",
"type": "text"
}
| {
"content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://sentry.io/govuk/app-<%= @app_name %>/\">Errors for for <%= @app_name %> (Sentry)</a></li>\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
"editable": true,
"error": false,
"id": 12,
"isNew": true,
"links": [],
"mode": "html",
"span": 6,
"style": {
"font-size": "20pt"
},
"title": "Useful links",
"type": "text"
}
| Add Sentry to deploy dashboards | Add Sentry to deploy dashboards
https://trello.com/c/fX3CeVrk
| HTML+ERB | mit | alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet,alphagov/govuk-puppet | html+erb | ## Code Before:
{
"content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
"editable": true,
"error": false,
"id": 12,
"isNew": true,
"links": [],
"mode": "html",
"span": 6,
"style": {
"font-size": "20pt"
},
"title": "Useful links",
"type": "text"
}
## Instruction:
Add Sentry to deploy dashboards
https://trello.com/c/fX3CeVrk
## Code After:
{
"content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://sentry.io/govuk/app-<%= @app_name %>/\">Errors for for <%= @app_name %> (Sentry)</a></li>\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
"editable": true,
"error": false,
"id": 12,
"isNew": true,
"links": [],
"mode": "html",
"span": 6,
"style": {
"font-size": "20pt"
},
"title": "Useful links",
"type": "text"
}
| {
- "content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
+ "content": "<ul style=\"font-size: 20px;\">\n<li><a target=\"_blank\" href=\"https://sentry.io/govuk/app-<%= @app_name %>/\">Errors for for <%= @app_name %> (Sentry)</a></li>\n<li><a target=\"_blank\" href=\"https://errbit.<%= @app_domain %>/\">Errbit</a></li>\n<li><a target=\"_blank\" href=\"https://alert.<%= @app_domain %>/\">Icinga</a></li>\n<li><a target=\"_blank\" href=\"https://docs.publishing.service.gov.uk/apps/<%= @docs_name %>.html\"><%= @app_name %> documentation</a></li>\n<li><a target=\"_blank\" href=\"https://govuk.zendesk.com/agent/filters/135081425\">Dashboard feedback</a></li>\n</ul>\n",
? +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"editable": true,
"error": false,
"id": 12,
"isNew": true,
"links": [],
"mode": "html",
"span": 6,
"style": {
"font-size": "20pt"
},
"title": "Useful links",
"type": "text"
} | 2 | 0.133333 | 1 | 1 |
67ae60e62f27765deab2ae57756d8622a2d1b0e6 | templates/jobs.yml | templates/jobs.yml | meta:
environment: ~
update:
canaries: 1
max_in_flight: 50
canary_watch_time: 1000-30000
update_watch_time: 1000-30000
serial: false
jobs:
- name: just_install_packages
templates:
- name: just_install_packages
release: shell
instances: 1
persistent_disk: 0
resource_pool: small_z1
networks: (( param "please set just_install_package networks" ))
networks: (( param "please set networks" ))
properties: {}
| meta:
environment: ~
update:
canaries: 1
max_in_flight: 50
canary_watch_time: 1000-30000
update_watch_time: 1000-30000
serial: false
jobs:
- name: shell
templates:
- { release: shell, name: shell }
instances: 1
persistent_disk: 0
resource_pool: small_z1
networks: (( param "please set shell networks" ))
networks: (( param "please set networks" ))
properties: {}
| Update templates for shell job | Update templates for shell job
| YAML | apache-2.0 | filefrog/shell-boshrelease,jhunt/shell-boshrelease,jhunt/shell-boshrelease,filefrog/shell-boshrelease,cloudfoundry-community/shell-boshrelease,cloudfoundry-community/shell-boshrelease | yaml | ## Code Before:
meta:
environment: ~
update:
canaries: 1
max_in_flight: 50
canary_watch_time: 1000-30000
update_watch_time: 1000-30000
serial: false
jobs:
- name: just_install_packages
templates:
- name: just_install_packages
release: shell
instances: 1
persistent_disk: 0
resource_pool: small_z1
networks: (( param "please set just_install_package networks" ))
networks: (( param "please set networks" ))
properties: {}
## Instruction:
Update templates for shell job
## Code After:
meta:
environment: ~
update:
canaries: 1
max_in_flight: 50
canary_watch_time: 1000-30000
update_watch_time: 1000-30000
serial: false
jobs:
- name: shell
templates:
- { release: shell, name: shell }
instances: 1
persistent_disk: 0
resource_pool: small_z1
networks: (( param "please set shell networks" ))
networks: (( param "please set networks" ))
properties: {}
| meta:
environment: ~
update:
canaries: 1
max_in_flight: 50
canary_watch_time: 1000-30000
update_watch_time: 1000-30000
serial: false
jobs:
- - name: just_install_packages
+ - name: shell
templates:
+ - { release: shell, name: shell }
- - name: just_install_packages
- release: shell
instances: 1
persistent_disk: 0
resource_pool: small_z1
- networks: (( param "please set just_install_package networks" ))
? -- ^^^^^^^ --------
+ networks: (( param "please set shell networks" ))
? ^^
networks: (( param "please set networks" ))
properties: {} | 7 | 0.304348 | 3 | 4 |
0474387bbe5e081df95fe6a5bb53b5c7b42ad501 | images/bazel/variants.yaml | images/bazel/variants.yaml | variants:
2.2.0-from-0.25.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.25.2
2.2.0-from-0.23.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.23.2
| variants:
2.2.0-from-0.25.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.25.2
2.2.0-from-0.23.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.23.2
test-infra:
NEW_VERSION: 2.2.0
OLD_VERSION: 2.0.0
| Create a test-infra variant of bazel. | Create a test-infra variant of bazel.
This image will install the current and next version of bazel we plan to use in test-infra.
By putting both these versions in the same image, we can configure jobs to use .bazelversion
and safely upgrade from one version to the next via a PR.
| YAML | apache-2.0 | BenTheElder/test-infra,cjwagner/test-infra,michelle192837/test-infra,jessfraz/test-infra,kubernetes/test-infra,brahmaroutu/test-infra,monopole/test-infra,ixdy/kubernetes-test-infra,fejta/test-infra,cblecker/test-infra,cblecker/test-infra,cjwagner/test-infra,pwittrock/test-infra,monopole/test-infra,dims/test-infra,jessfraz/test-infra,brahmaroutu/test-infra,kubernetes/test-infra,BenTheElder/test-infra,cblecker/test-infra,BenTheElder/test-infra,fejta/test-infra,fejta/test-infra,kubernetes/test-infra,cjwagner/test-infra,fejta/test-infra,monopole/test-infra,michelle192837/test-infra,jessfraz/test-infra,ixdy/kubernetes-test-infra,dims/test-infra,cblecker/test-infra,pwittrock/test-infra,michelle192837/test-infra,michelle192837/test-infra,fejta/test-infra,cblecker/test-infra,BenTheElder/test-infra,jessfraz/test-infra,dims/test-infra,jessfraz/test-infra,BenTheElder/test-infra,kubernetes/test-infra,ixdy/kubernetes-test-infra,dims/test-infra,fejta/test-infra,cblecker/test-infra,michelle192837/test-infra,monopole/test-infra,brahmaroutu/test-infra,pwittrock/test-infra,pwittrock/test-infra,cjwagner/test-infra,brahmaroutu/test-infra,dims/test-infra,kubernetes/test-infra,pwittrock/test-infra,kubernetes/test-infra,michelle192837/test-infra,BenTheElder/test-infra,monopole/test-infra,cjwagner/test-infra,dims/test-infra,ixdy/kubernetes-test-infra,jessfraz/test-infra,ixdy/kubernetes-test-infra,monopole/test-infra,brahmaroutu/test-infra,brahmaroutu/test-infra,cjwagner/test-infra | yaml | ## Code Before:
variants:
2.2.0-from-0.25.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.25.2
2.2.0-from-0.23.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.23.2
## Instruction:
Create a test-infra variant of bazel.
This image will install the current and next version of bazel we plan to use in test-infra.
By putting both these versions in the same image, we can configure jobs to use .bazelversion
and safely upgrade from one version to the next via a PR.
## Code After:
variants:
2.2.0-from-0.25.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.25.2
2.2.0-from-0.23.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.23.2
test-infra:
NEW_VERSION: 2.2.0
OLD_VERSION: 2.0.0
| variants:
2.2.0-from-0.25.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.25.2
2.2.0-from-0.23.2:
NEW_VERSION: 2.2.0
OLD_VERSION: 0.23.2
+ test-infra:
+ NEW_VERSION: 2.2.0
+ OLD_VERSION: 2.0.0 | 3 | 0.428571 | 3 | 0 |
fffca3d2198f7c65b2e4fa2b805efa54f4c9fdb9 | tests/zeus/artifacts/test_xunit.py | tests/zeus/artifacts/test_xunit.py | from io import BytesIO
from zeus.artifacts.xunit import XunitHandler
from zeus.constants import Result
from zeus.models import Job
from zeus.utils.testresult import TestResult as ZeusTestResult
def test_result_generation(sample_xunit):
job = Job()
fp = BytesIO(sample_xunit.encode("utf8"))
handler = XunitHandler(job)
results = handler.get_tests(fp)
assert len(results) == 2
r1 = results[0]
assert type(r1) == ZeusTestResult
assert r1.job == job
assert r1.name == "tests.test_report"
assert r1.duration == 0.0
assert r1.result == Result.failed
assert (
r1.message
== """tests/test_report.py:1: in <module>
> import mock
E ImportError: No module named mock"""
)
r2 = results[1]
assert type(r2) == ZeusTestResult
assert r2.job == job
assert r2.name == "tests.test_report.ParseTestResultsTest.test_simple"
assert r2.duration == 1.65796279907
assert r2.result == Result.passed
assert r2.message == ""
| from io import BytesIO
from zeus.artifacts.xunit import XunitHandler
from zeus.constants import Result
from zeus.models import Job
from zeus.utils.testresult import TestResult as ZeusTestResult
def test_result_generation(sample_xunit):
job = Job()
fp = BytesIO(sample_xunit.encode("utf8"))
handler = XunitHandler(job)
results = handler.get_tests(fp)
assert len(results) == 2
r1 = results[0]
assert type(r1) == ZeusTestResult
assert r1.job == job
assert r1.name == "tests.test_report"
assert r1.duration == 0
assert r1.result == Result.failed
assert (
r1.message
== """tests/test_report.py:1: in <module>
> import mock
E ImportError: No module named mock"""
)
r2 = results[1]
assert type(r2) == ZeusTestResult
assert r2.job == job
assert r2.name == "tests.test_report.ParseTestResultsTest.test_simple"
assert r2.duration == 1
assert r2.result == Result.passed
assert r2.message == ""
| Fix test case being integers | test: Fix test case being integers
| Python | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | python | ## Code Before:
from io import BytesIO
from zeus.artifacts.xunit import XunitHandler
from zeus.constants import Result
from zeus.models import Job
from zeus.utils.testresult import TestResult as ZeusTestResult
def test_result_generation(sample_xunit):
job = Job()
fp = BytesIO(sample_xunit.encode("utf8"))
handler = XunitHandler(job)
results = handler.get_tests(fp)
assert len(results) == 2
r1 = results[0]
assert type(r1) == ZeusTestResult
assert r1.job == job
assert r1.name == "tests.test_report"
assert r1.duration == 0.0
assert r1.result == Result.failed
assert (
r1.message
== """tests/test_report.py:1: in <module>
> import mock
E ImportError: No module named mock"""
)
r2 = results[1]
assert type(r2) == ZeusTestResult
assert r2.job == job
assert r2.name == "tests.test_report.ParseTestResultsTest.test_simple"
assert r2.duration == 1.65796279907
assert r2.result == Result.passed
assert r2.message == ""
## Instruction:
test: Fix test case being integers
## Code After:
from io import BytesIO
from zeus.artifacts.xunit import XunitHandler
from zeus.constants import Result
from zeus.models import Job
from zeus.utils.testresult import TestResult as ZeusTestResult
def test_result_generation(sample_xunit):
job = Job()
fp = BytesIO(sample_xunit.encode("utf8"))
handler = XunitHandler(job)
results = handler.get_tests(fp)
assert len(results) == 2
r1 = results[0]
assert type(r1) == ZeusTestResult
assert r1.job == job
assert r1.name == "tests.test_report"
assert r1.duration == 0
assert r1.result == Result.failed
assert (
r1.message
== """tests/test_report.py:1: in <module>
> import mock
E ImportError: No module named mock"""
)
r2 = results[1]
assert type(r2) == ZeusTestResult
assert r2.job == job
assert r2.name == "tests.test_report.ParseTestResultsTest.test_simple"
assert r2.duration == 1
assert r2.result == Result.passed
assert r2.message == ""
| from io import BytesIO
from zeus.artifacts.xunit import XunitHandler
from zeus.constants import Result
from zeus.models import Job
from zeus.utils.testresult import TestResult as ZeusTestResult
def test_result_generation(sample_xunit):
job = Job()
fp = BytesIO(sample_xunit.encode("utf8"))
handler = XunitHandler(job)
results = handler.get_tests(fp)
assert len(results) == 2
r1 = results[0]
assert type(r1) == ZeusTestResult
assert r1.job == job
assert r1.name == "tests.test_report"
- assert r1.duration == 0.0
? --
+ assert r1.duration == 0
assert r1.result == Result.failed
assert (
r1.message
== """tests/test_report.py:1: in <module>
> import mock
E ImportError: No module named mock"""
)
r2 = results[1]
assert type(r2) == ZeusTestResult
assert r2.job == job
assert r2.name == "tests.test_report.ParseTestResultsTest.test_simple"
- assert r2.duration == 1.65796279907
? ------------
+ assert r2.duration == 1
assert r2.result == Result.passed
assert r2.message == "" | 4 | 0.108108 | 2 | 2 |
892d2c5ddadb75a08a88ff040f14a764f3c95be3 | app/views/items/index.html.erb | app/views/items/index.html.erb | <% provide(:title, item_type.name_plural) %>
<table class="table table-bordered">
<thead>
<tr>
<% item_type.list_view_fields.each do |field| %>
<th><%= field.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @items.each do |item| %>
<tr>
<% item_type.list_view_fields.each do |field| %>
<td><%= field_value(item, field) %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
| <% provide(:title, item_type.name_plural) %>
<table class="table table-bordered">
<thead>
<tr>
<% item_type.list_view_fields.each do |field| %>
<th><%= field.name %></th>
<% end %>
<th></th>
</tr>
</thead>
<tbody>
<% @items.each do |item| %>
<tr>
<% item_type.list_view_fields.each do |field| %>
<td><%= field_value(item, field) %></td>
<% end %>
<td><%= link_to("View", :action => :show, :id => item) %></td>
</tr>
<% end %>
</tbody>
</table>
| Add detail link to index view | Add detail link to index view
| HTML+ERB | apache-2.0 | catima/catima,catima/catima,catima/catima,catima/catima | html+erb | ## Code Before:
<% provide(:title, item_type.name_plural) %>
<table class="table table-bordered">
<thead>
<tr>
<% item_type.list_view_fields.each do |field| %>
<th><%= field.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @items.each do |item| %>
<tr>
<% item_type.list_view_fields.each do |field| %>
<td><%= field_value(item, field) %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
## Instruction:
Add detail link to index view
## Code After:
<% provide(:title, item_type.name_plural) %>
<table class="table table-bordered">
<thead>
<tr>
<% item_type.list_view_fields.each do |field| %>
<th><%= field.name %></th>
<% end %>
<th></th>
</tr>
</thead>
<tbody>
<% @items.each do |item| %>
<tr>
<% item_type.list_view_fields.each do |field| %>
<td><%= field_value(item, field) %></td>
<% end %>
<td><%= link_to("View", :action => :show, :id => item) %></td>
</tr>
<% end %>
</tbody>
</table>
| <% provide(:title, item_type.name_plural) %>
<table class="table table-bordered">
<thead>
<tr>
<% item_type.list_view_fields.each do |field| %>
<th><%= field.name %></th>
<% end %>
+ <th></th>
</tr>
</thead>
<tbody>
<% @items.each do |item| %>
<tr>
<% item_type.list_view_fields.each do |field| %>
<td><%= field_value(item, field) %></td>
<% end %>
+ <td><%= link_to("View", :action => :show, :id => item) %></td>
</tr>
<% end %>
</tbody>
</table> | 2 | 0.1 | 2 | 0 |
6fc6cc1a9d2d67b485c1d9ba492cc02ca864d45f | nipype/interfaces/brainsuite/__init__.py | nipype/interfaces/brainsuite/__init__.py | from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,
Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit)
| from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,
Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit,
SVReg, BDP)
| Add SVReg and BDP to import | Add SVReg and BDP to import
| Python | bsd-3-clause | mick-d/nipype,carolFrohlich/nipype,mick-d/nipype,mick-d/nipype,mick-d/nipype,carolFrohlich/nipype,carolFrohlich/nipype,carolFrohlich/nipype | python | ## Code Before:
from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,
Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit)
## Instruction:
Add SVReg and BDP to import
## Code After:
from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,
Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit,
SVReg, BDP)
| from .brainsuite import (Bse, Bfc, Pvc, Cerebro, Cortex, Scrubmask, Tca,
- Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit)
? ^
+ Dewisp, Dfs, Pialmesh, Skullfinder, Hemisplit,
? ^
+ SVReg, BDP) | 3 | 1.5 | 2 | 1 |
4b17d2b3cb09f6e9e415015f3649d4aeb0c4e856 | metadata/com.simplemobiletools.flashlight.txt | metadata/com.simplemobiletools.flashlight.txt | Categories:System
License:Apache2
Web Site:
Source Code:https://github.com/SimpleMobileTools/Simple-Flashlight
Issue Tracker:https://github.com/SimpleMobileTools/Simple-Flashlight/issues
Changelog:https://github.com/SimpleMobileTools/Simple-Flashlight/blob/HEAD/CHANGELOG.md
Auto Name:Simple Flashlight
Summary:A simple flashlight with a widget
Description:
A flashlight app with black background, so it doesn't knock you out when
launched in the dark. If it's turned on via the app, it will prevent the device
from falling asleep, so it can be used for longer operations too. It also
contains a simple 1x1 widget you can place on your homescreen.
.
Repo Type:git
Repo:https://github.com/SimpleMobileTools/Simple-Flashlight
Build:1.8,8
commit=3562a37fd0e968f547e3d87388a4bd624a8c7370
subdir=app
gradle=yes
Build:1.9,9
commit=1.9
subdir=app
gradle=yes
Auto Update Mode:Version %v
Update Check Mode:Tags
Current Version:1.9
Current Version Code:9
| Categories:System
License:Apache2
Web Site:
Source Code:https://github.com/SimpleMobileTools/Simple-Flashlight
Issue Tracker:https://github.com/SimpleMobileTools/Simple-Flashlight/issues
Changelog:https://github.com/SimpleMobileTools/Simple-Flashlight/blob/HEAD/CHANGELOG.md
Auto Name:Simple Flashlight
Summary:A simple flashlight with a widget
Description:
A flashlight app with black background, so it doesn't knock you out when
launched in the dark. If it's turned on via the app, it will prevent the device
from falling asleep, so it can be used for longer operations too. It also
contains a simple 1x1 widget you can place on your homescreen.
.
Repo Type:git
Repo:https://github.com/SimpleMobileTools/Simple-Flashlight
Build:1.8,8
commit=3562a37fd0e968f547e3d87388a4bd624a8c7370
subdir=app
gradle=yes
Build:1.9,9
commit=1.9
subdir=app
gradle=yes
Build:1.11,11
commit=1.11
subdir=app
gradle=yes
Auto Update Mode:Version %v
Update Check Mode:Tags
Current Version:1.11
Current Version Code:11
| Update Simple Flashlight to 1.11 (11) | Update Simple Flashlight to 1.11 (11)
| Text | agpl-3.0 | f-droid/fdroiddata,f-droid/fdroid-data,f-droid/fdroiddata | text | ## Code Before:
Categories:System
License:Apache2
Web Site:
Source Code:https://github.com/SimpleMobileTools/Simple-Flashlight
Issue Tracker:https://github.com/SimpleMobileTools/Simple-Flashlight/issues
Changelog:https://github.com/SimpleMobileTools/Simple-Flashlight/blob/HEAD/CHANGELOG.md
Auto Name:Simple Flashlight
Summary:A simple flashlight with a widget
Description:
A flashlight app with black background, so it doesn't knock you out when
launched in the dark. If it's turned on via the app, it will prevent the device
from falling asleep, so it can be used for longer operations too. It also
contains a simple 1x1 widget you can place on your homescreen.
.
Repo Type:git
Repo:https://github.com/SimpleMobileTools/Simple-Flashlight
Build:1.8,8
commit=3562a37fd0e968f547e3d87388a4bd624a8c7370
subdir=app
gradle=yes
Build:1.9,9
commit=1.9
subdir=app
gradle=yes
Auto Update Mode:Version %v
Update Check Mode:Tags
Current Version:1.9
Current Version Code:9
## Instruction:
Update Simple Flashlight to 1.11 (11)
## Code After:
Categories:System
License:Apache2
Web Site:
Source Code:https://github.com/SimpleMobileTools/Simple-Flashlight
Issue Tracker:https://github.com/SimpleMobileTools/Simple-Flashlight/issues
Changelog:https://github.com/SimpleMobileTools/Simple-Flashlight/blob/HEAD/CHANGELOG.md
Auto Name:Simple Flashlight
Summary:A simple flashlight with a widget
Description:
A flashlight app with black background, so it doesn't knock you out when
launched in the dark. If it's turned on via the app, it will prevent the device
from falling asleep, so it can be used for longer operations too. It also
contains a simple 1x1 widget you can place on your homescreen.
.
Repo Type:git
Repo:https://github.com/SimpleMobileTools/Simple-Flashlight
Build:1.8,8
commit=3562a37fd0e968f547e3d87388a4bd624a8c7370
subdir=app
gradle=yes
Build:1.9,9
commit=1.9
subdir=app
gradle=yes
Build:1.11,11
commit=1.11
subdir=app
gradle=yes
Auto Update Mode:Version %v
Update Check Mode:Tags
Current Version:1.11
Current Version Code:11
| Categories:System
License:Apache2
Web Site:
Source Code:https://github.com/SimpleMobileTools/Simple-Flashlight
Issue Tracker:https://github.com/SimpleMobileTools/Simple-Flashlight/issues
Changelog:https://github.com/SimpleMobileTools/Simple-Flashlight/blob/HEAD/CHANGELOG.md
Auto Name:Simple Flashlight
Summary:A simple flashlight with a widget
Description:
A flashlight app with black background, so it doesn't knock you out when
launched in the dark. If it's turned on via the app, it will prevent the device
from falling asleep, so it can be used for longer operations too. It also
contains a simple 1x1 widget you can place on your homescreen.
.
Repo Type:git
Repo:https://github.com/SimpleMobileTools/Simple-Flashlight
Build:1.8,8
commit=3562a37fd0e968f547e3d87388a4bd624a8c7370
subdir=app
gradle=yes
Build:1.9,9
commit=1.9
subdir=app
gradle=yes
+ Build:1.11,11
+ commit=1.11
+ subdir=app
+ gradle=yes
+
Auto Update Mode:Version %v
Update Check Mode:Tags
- Current Version:1.9
? ^
+ Current Version:1.11
? ^^
- Current Version Code:9
? ^
+ Current Version Code:11
? ^^
| 9 | 0.272727 | 7 | 2 |
36af02c9dccf19a2fdc0e7d841d9cd8d084bb92e | plugins/org.yakindu.sct.commons/src/org/yakindu/sct/commons/EMFHelper.java | plugins/org.yakindu.sct.commons/src/org/yakindu/sct/commons/EMFHelper.java | package org.yakindu.sct.commons;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
public class EMFHelper {
public static List<EClass> getAllSuperClasses(EClass eClass) {
List<List<EClass>> superClasses = new ArrayList<>();
getSuperClassTree(superClasses, eClass, 0);
List<EClass> result = new ArrayList<>();
for (List<EClass> list : superClasses) {
result.addAll(list);
}
return result;
}
protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
if (superClasses.size() <= depth) {
superClasses.add(depth, new ArrayList<>());
}
List<EClass> superTypes = eClass.getESuperTypes();
superClasses.get(depth).add(eClass);
for (EClass superType : superTypes) {
getSuperClassTree(superClasses, superType, depth + 1);
}
}
}
| /**
* Copyright (c) 2018 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.commons;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
public class EMFHelper {
public static List<EClass> getAllSuperClasses(EClass eClass) {
List<List<EClass>> superClasses = new ArrayList<>();
getSuperClassTree(superClasses, eClass, 0);
List<EClass> result = new ArrayList<>();
for (List<EClass> list : superClasses) {
result.addAll(list);
}
return result;
}
protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
if (superClasses.size() <= depth) {
superClasses.add(depth, new ArrayList<>());
}
List<EClass> superTypes = eClass.getESuperTypes();
superClasses.get(depth).add(eClass);
for (EClass superType : superTypes) {
getSuperClassTree(superClasses, superType, depth + 1);
}
}
public static IFile getIFileFromEMFUri(URI uri) {
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
}
}
| Add copyright header and URI helper func | Add copyright header and URI helper func
| Java | epl-1.0 | Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts | java | ## Code Before:
package org.yakindu.sct.commons;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
public class EMFHelper {
public static List<EClass> getAllSuperClasses(EClass eClass) {
List<List<EClass>> superClasses = new ArrayList<>();
getSuperClassTree(superClasses, eClass, 0);
List<EClass> result = new ArrayList<>();
for (List<EClass> list : superClasses) {
result.addAll(list);
}
return result;
}
protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
if (superClasses.size() <= depth) {
superClasses.add(depth, new ArrayList<>());
}
List<EClass> superTypes = eClass.getESuperTypes();
superClasses.get(depth).add(eClass);
for (EClass superType : superTypes) {
getSuperClassTree(superClasses, superType, depth + 1);
}
}
}
## Instruction:
Add copyright header and URI helper func
## Code After:
/**
* Copyright (c) 2018 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.commons;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
public class EMFHelper {
public static List<EClass> getAllSuperClasses(EClass eClass) {
List<List<EClass>> superClasses = new ArrayList<>();
getSuperClassTree(superClasses, eClass, 0);
List<EClass> result = new ArrayList<>();
for (List<EClass> list : superClasses) {
result.addAll(list);
}
return result;
}
protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
if (superClasses.size() <= depth) {
superClasses.add(depth, new ArrayList<>());
}
List<EClass> superTypes = eClass.getESuperTypes();
superClasses.get(depth).add(eClass);
for (EClass superType : superTypes) {
getSuperClassTree(superClasses, superType, depth + 1);
}
}
public static IFile getIFileFromEMFUri(URI uri) {
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
}
}
| + /**
+ * Copyright (c) 2018 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * committers of YAKINDU - initial API and implementation
+ *
+ */
package org.yakindu.sct.commons;
+
import java.util.ArrayList;
import java.util.List;
+ import org.eclipse.core.resources.IFile;
+ import org.eclipse.core.resources.ResourcesPlugin;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
public class EMFHelper {
public static List<EClass> getAllSuperClasses(EClass eClass) {
List<List<EClass>> superClasses = new ArrayList<>();
getSuperClassTree(superClasses, eClass, 0);
List<EClass> result = new ArrayList<>();
for (List<EClass> list : superClasses) {
result.addAll(list);
}
return result;
}
protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
if (superClasses.size() <= depth) {
superClasses.add(depth, new ArrayList<>());
}
List<EClass> superTypes = eClass.getESuperTypes();
superClasses.get(depth).add(eClass);
for (EClass superType : superTypes) {
getSuperClassTree(superClasses, superType, depth + 1);
}
}
+
+ public static IFile getIFileFromEMFUri(URI uri) {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
+ }
} | 19 | 0.542857 | 19 | 0 |
895fcef0fd8466617ccbcf34967bec350c007339 | lib/connect/controller_additions.rb | lib/connect/controller_additions.rb | module Connect
module ControllerAdditions
extend ActiveSupport::Concern
included do
include Connect::ControllerAdditions::Helper
helper Connect::ControllerAdditions::Helper
end
module Helper
def current_access_token
@current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
def current_scopes
token = current_access_token && token.scopes || []
end
def has_scope? scope
current_scopes.detect{|s| s.name == scope}
end
end
def require_user_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless current_access_token.account
end
def require_client_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'Client token is required') if current_access_token.account
end
def require_access_token
if current_access_token.nil?
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
end
if !current_access_token.accessible? required_scopes
raise Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(:insufficient_scope)
end
end
def required_scopes
nil # as default
end
end
end | module Connect
module ControllerAdditions
extend ActiveSupport::Concern
included do
include Connect::ControllerAdditions::Helper
helper Connect::ControllerAdditions::Helper
end
module Helper
def current_access_token
@current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
def current_oauth_scopes
token = current_access_token && token.scopes || []
end
def has_oauth_scope? scope
current_oauth_scopes.detect{|s| s.name == scope}
end
end
def require_user_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless current_access_token.account
end
def require_client_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'Client token is required') if current_access_token.account
end
def require_access_token
if current_access_token.nil?
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
end
if !current_access_token.accessible? required_scopes
raise Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(:insufficient_scope)
end
end
def required_scopes
nil # as default
end
end
end | Rename current_scopes to current_oauth_scopes to avoid conflicts with has_scope gem | Rename current_scopes to current_oauth_scopes to avoid conflicts with has_scope gem | Ruby | mit | jlaxson/openid-connect-engine | ruby | ## Code Before:
module Connect
module ControllerAdditions
extend ActiveSupport::Concern
included do
include Connect::ControllerAdditions::Helper
helper Connect::ControllerAdditions::Helper
end
module Helper
def current_access_token
@current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
def current_scopes
token = current_access_token && token.scopes || []
end
def has_scope? scope
current_scopes.detect{|s| s.name == scope}
end
end
def require_user_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless current_access_token.account
end
def require_client_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'Client token is required') if current_access_token.account
end
def require_access_token
if current_access_token.nil?
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
end
if !current_access_token.accessible? required_scopes
raise Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(:insufficient_scope)
end
end
def required_scopes
nil # as default
end
end
end
## Instruction:
Rename current_scopes to current_oauth_scopes to avoid conflicts with has_scope gem
## Code After:
module Connect
module ControllerAdditions
extend ActiveSupport::Concern
included do
include Connect::ControllerAdditions::Helper
helper Connect::ControllerAdditions::Helper
end
module Helper
def current_access_token
@current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
def current_oauth_scopes
token = current_access_token && token.scopes || []
end
def has_oauth_scope? scope
current_oauth_scopes.detect{|s| s.name == scope}
end
end
def require_user_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless current_access_token.account
end
def require_client_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'Client token is required') if current_access_token.account
end
def require_access_token
if current_access_token.nil?
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
end
if !current_access_token.accessible? required_scopes
raise Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(:insufficient_scope)
end
end
def required_scopes
nil # as default
end
end
end | module Connect
module ControllerAdditions
extend ActiveSupport::Concern
included do
include Connect::ControllerAdditions::Helper
helper Connect::ControllerAdditions::Helper
end
module Helper
def current_access_token
@current_token ||= request.env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN]
end
- def current_scopes
+ def current_oauth_scopes
? ++++++
token = current_access_token && token.scopes || []
end
- def has_scope? scope
+ def has_oauth_scope? scope
? ++++++
- current_scopes.detect{|s| s.name == scope}
+ current_oauth_scopes.detect{|s| s.name == scope}
? ++++++
end
end
def require_user_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless current_access_token.account
end
def require_client_access_token
require_access_token
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'Client token is required') if current_access_token.account
end
def require_access_token
if current_access_token.nil?
raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
end
if !current_access_token.accessible? required_scopes
raise Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(:insufficient_scope)
end
end
def required_scopes
nil # as default
end
end
end | 6 | 0.122449 | 3 | 3 |
9d4f40a3ebe3c988a66db7aa041616445fd14c5b | docs/_posts/2016-03-17-forms.md | docs/_posts/2016-03-17-forms.md | ---
layout: post
title: "Forms"
categories: components
permalink: /forms/
---
Form elements are designed to fall out for free, without having to add any additional classes.
### Basic Input
<div class="pattern">
<input type="email" placeholder="Email address">
</div>
``` html
<input type="email" placeholder="Email address">
```
### Select
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```html
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```
However extra classes are provided to bind for certain events, such as form errors.
<div class="pattern">
<input type="email" placeholder="Email address" class="error">
</div>
``` html
<input type="email" placeholder="Email address" class="error">
``` | ---
layout: post
title: "Forms"
categories: components
permalink: /forms/
---
Form elements are designed to fall out for free, without having to add any additional classes.
### Basic Input
<div class="pattern">
<input type="email" placeholder="Email address">
</div>
``` html
<input type="email" placeholder="Email address">
```
### Select
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```html
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
```
However extra classes are provided to bind for certain events, such as form errors.
<div class="pattern">
<input type="email" placeholder="Email address" class="error">
</div>
``` html
<input type="email" placeholder="Email address" class="error">
``` | Remove pattern from form docs | Remove pattern from form docs
| Markdown | mit | pusher/chameleon,pusher/chameleon | markdown | ## Code Before:
---
layout: post
title: "Forms"
categories: components
permalink: /forms/
---
Form elements are designed to fall out for free, without having to add any additional classes.
### Basic Input
<div class="pattern">
<input type="email" placeholder="Email address">
</div>
``` html
<input type="email" placeholder="Email address">
```
### Select
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```html
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```
However extra classes are provided to bind for certain events, such as form errors.
<div class="pattern">
<input type="email" placeholder="Email address" class="error">
</div>
``` html
<input type="email" placeholder="Email address" class="error">
```
## Instruction:
Remove pattern from form docs
## Code After:
---
layout: post
title: "Forms"
categories: components
permalink: /forms/
---
Form elements are designed to fall out for free, without having to add any additional classes.
### Basic Input
<div class="pattern">
<input type="email" placeholder="Email address">
</div>
``` html
<input type="email" placeholder="Email address">
```
### Select
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```html
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
```
However extra classes are provided to bind for certain events, such as form errors.
<div class="pattern">
<input type="email" placeholder="Email address" class="error">
</div>
``` html
<input type="email" placeholder="Email address" class="error">
``` | ---
layout: post
title: "Forms"
categories: components
permalink: /forms/
---
Form elements are designed to fall out for free, without having to add any additional classes.
### Basic Input
<div class="pattern">
<input type="email" placeholder="Email address">
</div>
``` html
<input type="email" placeholder="Email address">
```
### Select
<div class="pattern">
<select>
<option selected disabled>Select a cluster</option>
<option>mt1 (us-east-1)</option>
<option>eu (eu-west-1)</option>
<option>ap1 (ap-southeast-1)</option>
</select>
</div>
```html
- <div class="pattern">
- <select>
? --
+ <select>
- <option selected disabled>Select a cluster</option>
? --
+ <option selected disabled>Select a cluster</option>
- <option>mt1 (us-east-1)</option>
? --
+ <option>mt1 (us-east-1)</option>
- <option>eu (eu-west-1)</option>
? --
+ <option>eu (eu-west-1)</option>
- <option>ap1 (ap-southeast-1)</option>
? --
+ <option>ap1 (ap-southeast-1)</option>
- </select>
? --
+ </select>
- </div>
```
However extra classes are provided to bind for certain events, such as form errors.
<div class="pattern">
<input type="email" placeholder="Email address" class="error">
</div>
``` html
<input type="email" placeholder="Email address" class="error">
``` | 14 | 0.285714 | 6 | 8 |
636a78d0fd7944014e1898c7370cb8f3ac489024 | .fixtures.yml | .fixtures.yml | fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
ref: 'origin/0.x'
"nova": "git://github.com/stackforge/puppet-nova.git"
"vswitch": "git://github.com/bodepd/puppet-vswitch"
symlinks:
"neutron": "#{source_dir}"
| fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
ref: 'origin/0.x'
"nova": "git://github.com/stackforge/puppet-nova.git"
"vswitch": "git://github.com/stackforge/puppet-vswitch"
symlinks:
"neutron": "#{source_dir}"
| Update remote url for puppet-vswitch | Update remote url for puppet-vswitch
Change-Id: Ieffc717df0c796dbd90ab5c8bc38426ed0d9bc17
| YAML | apache-2.0 | aldavud/puppet-neutron,hkumarmk/puppet-neutron,openstack/puppet-neutron,IPnett/puppet-neutron,JioCloud/puppet-neutron,NeCTAR-RC/puppet-neutron,fuel-infra/puppet-neutron,larsks/puppet-neutron,varunarya10/puppet-neutron,redhat-cip/puppet-neutron,aldavud/puppet-neutron,DarkHorseComics/puppet-neutron,larsks/puppet-neutron,trihoangvo/puppet-neutron,cloudbuy/puppet-neutron,fuel-infra/puppet-neutron,aldavud/puppet-neutron,markvoelker/puppet-neutron,arnaudmorinol/puppet-neutron,IPnett/puppet-neutron,rdo-puppet-modules/puppet-neutron,CiscoSystems/puppet-neutron,JioCloud/puppet-neutron,openstack/puppet-neutron,fuel-infra/puppet-neutron,varunarya10/puppet-neutron,arnaudmorinol/puppet-neutron,NeCTAR-RC/puppet-neutron,redhat-cip/puppet-neutron,cloudbuy/puppet-neutron,hkumarmk/puppet-neutron,CiscoSystems/puppet-neutron,rdo-puppet-modules/puppet-neutron,IPnett/puppet-neutron,hkumarmk/puppet-neutron,JioCloud/puppet-neutron,trihoangvo/puppet-neutron,redhat-cip/puppet-neutron,DarkHorseComics/puppet-neutron,markvoelker/puppet-neutron,NeCTAR-RC/puppet-neutron,cloudbuy/puppet-neutron,CiscoSystems/puppet-neutron,plumgrid/puppet-neutron,plumgrid/puppet-neutron | yaml | ## Code Before:
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
ref: 'origin/0.x'
"nova": "git://github.com/stackforge/puppet-nova.git"
"vswitch": "git://github.com/bodepd/puppet-vswitch"
symlinks:
"neutron": "#{source_dir}"
## Instruction:
Update remote url for puppet-vswitch
Change-Id: Ieffc717df0c796dbd90ab5c8bc38426ed0d9bc17
## Code After:
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
ref: 'origin/0.x'
"nova": "git://github.com/stackforge/puppet-nova.git"
"vswitch": "git://github.com/stackforge/puppet-vswitch"
symlinks:
"neutron": "#{source_dir}"
| fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"inifile": "git://github.com/puppetlabs/puppetlabs-inifile"
"keystone": "git://github.com/stackforge/puppet-keystone.git"
"mysql":
repo: "git://github.com/puppetlabs/puppetlabs-mysql.git"
ref: 'origin/0.x'
"nova": "git://github.com/stackforge/puppet-nova.git"
- "vswitch": "git://github.com/bodepd/puppet-vswitch"
? ^ ^ --
+ "vswitch": "git://github.com/stackforge/puppet-vswitch"
? ^^^^^^ ^^
symlinks:
"neutron": "#{source_dir}" | 2 | 0.166667 | 1 | 1 |
b82f1e38c65d51261fe8b5c7b2acfec8b6fd9384 | hack/stubs/eventLogger.ml | hack/stubs/eventLogger.ml | (**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*)
let init _ _ = ()
let log_if_initialized _ = ()
let master_exception _ = ()
let worker_exception _ = ()
let sharedmem_gc_ran _ _ _ _ = ()
let sharedmem_init_done _ = ()
let sharedmem_failed_anonymous_memfd_init _ = ()
let sharedmem_failed_to_use_shm_dir ~shm_dir:_ ~reason:_ = ()
let sharedmem_less_than_minimum_available
~shm_dir:_
~shm_min_avail:_
~avail:_ = ()
let find_done ~time_taken:_ ~name:_ = ()
let log_gc_stats () = ()
let flush _ = ()
let watchman_error _ = ()
let watchman_warning _ = ()
let watchman_timeout _ = ()
let dfind_ready _ _ = ()
| (**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*)
let init ?init_id:_ _ _ = ()
let log_if_initialized _ = ()
let master_exception _ = ()
let worker_exception _ = ()
let sharedmem_gc_ran _ _ _ _ = ()
let sharedmem_init_done _ = ()
let sharedmem_failed_anonymous_memfd_init _ = ()
let sharedmem_failed_to_use_shm_dir ~shm_dir:_ ~reason:_ = ()
let sharedmem_less_than_minimum_available
~shm_dir:_
~shm_min_avail:_
~avail:_ = ()
let find_done ~time_taken:_ ~name:_ = ()
let log_gc_stats () = ()
let flush _ = ()
let watchman_error _ = ()
let watchman_warning _ = ()
let watchman_timeout _ = ()
let dfind_ready _ _ = ()
| Reduce duplicated system info logged to Scuba | Reduce duplicated system info logged to Scuba
Summary: Duplicates less data to logs.
Reviewed By: oulgen
Differential Revision: D3880530
fbshipit-source-id: 6f2db0a3571d6e65aaf85ea073f9824ff090d22d
| OCaml | mit | jgrund/flow,fletcherw/flow,gabelevi/flow,jamesgpearce/flow,jamesgpearce/flow,AgentME/flow,AprilArcus/flow,claudiopro/flow,nmote/flow,TiddoLangerak/flow,jgrund/flow,ForbesLindesay/flow,nmote/flow,chenglou/flow,jamesgpearce/flow,ForbesLindesay/flow,MichaelDeBoey/flow,nmote/flow,gabro/flow,AgentME/flow,facebook/flow,JonathanUsername/flow,mroch/flow,claudiopro/flow,jamesgpearce/flow,mroch/flow,popham/flow,ForbesLindesay/flow,gabelevi/flow,mroch/flow,TiddoLangerak/flow,nmote/flow,gabro/flow,nmote/flow,facebook/flow,ForbesLindesay/flow,gabelevi/flow,MichaelDeBoey/flow,fletcherw/flow,mroch/flow,mroch/flow,AprilArcus/flow,gabro/flow,jgrund/flow,fletcherw/flow,JonathanUsername/flow,JonathanUsername/flow,ylu1317/flow,gabelevi/flow,samwgoldman/flow,gabro/flow,ForbesLindesay/flow,jamesgpearce/flow,facebook/flow,jgrund/flow,fletcherw/flow,TiddoLangerak/flow,chenglou/flow,popham/flow,samwgoldman/flow,MichaelDeBoey/flow,popham/flow,gabro/flow,ylu1317/flow,TiddoLangerak/flow,gabelevi/flow,AgentME/flow,AprilArcus/flow,mroch/flow,samwgoldman/flow,TiddoLangerak/flow,AgentME/flow,claudiopro/flow,AprilArcus/flow,JonathanUsername/flow,gabelevi/flow,popham/flow,MichaelDeBoey/flow,facebook/flow,jgrund/flow,JonathanUsername/flow,ylu1317/flow,JonathanUsername/flow,chenglou/flow,popham/flow,jgrund/flow,nmote/flow,chenglou/flow,gabro/flow,facebook/flow,popham/flow,claudiopro/flow,jamesgpearce/flow,ylu1317/flow,fletcherw/flow,samwgoldman/flow,ForbesLindesay/flow,AprilArcus/flow,samwgoldman/flow,gabelevi/flow,MichaelDeBoey/flow,facebook/flow,ylu1317/flow,samwgoldman/flow,AgentME/flow,AprilArcus/flow,facebook/flow,chenglou/flow,nmote/flow,JonathanUsername/flow,mroch/flow,claudiopro/flow,fletcherw/flow,jamesgpearce/flow,popham/flow,samwgoldman/flow,chenglou/flow | ocaml | ## Code Before:
(**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*)
let init _ _ = ()
let log_if_initialized _ = ()
let master_exception _ = ()
let worker_exception _ = ()
let sharedmem_gc_ran _ _ _ _ = ()
let sharedmem_init_done _ = ()
let sharedmem_failed_anonymous_memfd_init _ = ()
let sharedmem_failed_to_use_shm_dir ~shm_dir:_ ~reason:_ = ()
let sharedmem_less_than_minimum_available
~shm_dir:_
~shm_min_avail:_
~avail:_ = ()
let find_done ~time_taken:_ ~name:_ = ()
let log_gc_stats () = ()
let flush _ = ()
let watchman_error _ = ()
let watchman_warning _ = ()
let watchman_timeout _ = ()
let dfind_ready _ _ = ()
## Instruction:
Reduce duplicated system info logged to Scuba
Summary: Duplicates less data to logs.
Reviewed By: oulgen
Differential Revision: D3880530
fbshipit-source-id: 6f2db0a3571d6e65aaf85ea073f9824ff090d22d
## Code After:
(**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*)
let init ?init_id:_ _ _ = ()
let log_if_initialized _ = ()
let master_exception _ = ()
let worker_exception _ = ()
let sharedmem_gc_ran _ _ _ _ = ()
let sharedmem_init_done _ = ()
let sharedmem_failed_anonymous_memfd_init _ = ()
let sharedmem_failed_to_use_shm_dir ~shm_dir:_ ~reason:_ = ()
let sharedmem_less_than_minimum_available
~shm_dir:_
~shm_min_avail:_
~avail:_ = ()
let find_done ~time_taken:_ ~name:_ = ()
let log_gc_stats () = ()
let flush _ = ()
let watchman_error _ = ()
let watchman_warning _ = ()
let watchman_timeout _ = ()
let dfind_ready _ _ = ()
| (**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*)
- let init _ _ = ()
+ let init ?init_id:_ _ _ = ()
? +++++++++++
let log_if_initialized _ = ()
let master_exception _ = ()
let worker_exception _ = ()
let sharedmem_gc_ran _ _ _ _ = ()
let sharedmem_init_done _ = ()
let sharedmem_failed_anonymous_memfd_init _ = ()
let sharedmem_failed_to_use_shm_dir ~shm_dir:_ ~reason:_ = ()
let sharedmem_less_than_minimum_available
~shm_dir:_
~shm_min_avail:_
~avail:_ = ()
let find_done ~time_taken:_ ~name:_ = ()
let log_gc_stats () = ()
let flush _ = ()
let watchman_error _ = ()
let watchman_warning _ = ()
let watchman_timeout _ = ()
let dfind_ready _ _ = () | 2 | 0.068966 | 1 | 1 |
ec6184af6d2aed1001ab69e1ec3d33be763518a5 | proguard-project.txt | proguard-project.txt | -keepattributes SourceFile,LineNumberTable
| -keepattributes SourceFile,LineNumberTable
# For Google Play Services (GCM), per http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@ccom.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# End Google Play Services | Add Google Play Services proguard rules | Add Google Play Services proguard rules
| Text | apache-2.0 | prati0100/zulip-android,abhaymaniyar/zulip-android,abhaymaniyar/zulip-android,saketkumar95/zulip-android,Sam1301/zulip-android,vishwesh3/zulip-android,zulip/zulip-android,saketkumar95/zulip-android,prati0100/zulip-android,Sam1301/zulip-android | text | ## Code Before:
-keepattributes SourceFile,LineNumberTable
## Instruction:
Add Google Play Services proguard rules
## Code After:
-keepattributes SourceFile,LineNumberTable
# For Google Play Services (GCM), per http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@ccom.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# End Google Play Services | -keepattributes SourceFile,LineNumberTable
+
+
+ # For Google Play Services (GCM), per http://developer.android.com/google/play-services/setup.html
+ -keep class * extends java.util.ListResourceBundle {
+ protected Object[][] getContents();
+ }
+
+ -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
+ public static final *** NULL;
+ }
+
+ -keepnames @com.google.android.gms.common.annotation.KeepName class *
+ -keepclassmembernames class * {
+ @ccom.google.android.gms.common.annotation.KeepName *;
+ }
+
+ -keepnames class * implements android.os.Parcelable {
+ public static final ** CREATOR;
+ }
+ # End Google Play Services | 20 | 20 | 20 | 0 |
c3d949cd936e899d7cb186d577ea0323a7a32a7f | source/php/Module/Text/Text.php | source/php/Module/Text/Text.php | <?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
if (!$this->data['hide_box_frame']) {
return 'box.blade.php';
}
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
}
| <?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
if (isset($this->data['hide_box_frame']) && !$this->data['hide_box_frame']) {
return 'box.blade.php';
}
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
}
| Check before use array item. | Check before use array item.
| PHP | mit | helsingborg-stad/Modularity,helsingborg-stad/Modularity | php | ## Code Before:
<?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
if (!$this->data['hide_box_frame']) {
return 'box.blade.php';
}
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
}
## Instruction:
Check before use array item.
## Code After:
<?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
if (isset($this->data['hide_box_frame']) && !$this->data['hide_box_frame']) {
return 'box.blade.php';
}
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
}
| <?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
- if (!$this->data['hide_box_frame']) {
+ if (isset($this->data['hide_box_frame']) && !$this->data['hide_box_frame']) {
return 'box.blade.php';
}
-
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
} | 3 | 0.071429 | 1 | 2 |
708d8f0806e16a5de0c6ca334af8bb053d1c16f1 | config/initializers/assets.rb | config/initializers/assets.rb | Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( evaluations.js app_admin_web_pack_bundle.js app_web_pack_bundle.js styles_web_pack_bundle.js)
Rails.application.config.assets.precompile += %w( app_admin_web_pack_bundle.css admin.css ) | Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.initialize_on_precompile = false
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( evaluations.js app_admin_web_pack_bundle.js app_web_pack_bundle.js styles_web_pack_bundle.js)
Rails.application.config.assets.precompile += %w( app_admin_web_pack_bundle.css admin.css ) | Disable connecting to a database on precompile | Disable connecting to a database on precompile
| Ruby | mit | atomicjolt/lti_starter_app,atomicjolt/react_starter_app,atomicjolt/react_rails_starter_app,atomicjolt/adhesion,atomicjolt/adhesion,atomicjolt/react_starter_app,atomicjolt/lti_starter_app,atomicjolt/react_starter_app,atomicjolt/react_starter_app,atomicjolt/react_rails_starter_app,atomicjolt/lti_starter_app,atomicjolt/adhesion,atomicjolt/react_rails_starter_app,atomicjolt/adhesion,atomicjolt/lti_starter_app,atomicjolt/react_rails_starter_app | ruby | ## Code Before:
Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( evaluations.js app_admin_web_pack_bundle.js app_web_pack_bundle.js styles_web_pack_bundle.js)
Rails.application.config.assets.precompile += %w( app_admin_web_pack_bundle.css admin.css )
## Instruction:
Disable connecting to a database on precompile
## Code After:
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.initialize_on_precompile = false
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( evaluations.js app_admin_web_pack_bundle.js app_web_pack_bundle.js styles_web_pack_bundle.js)
Rails.application.config.assets.precompile += %w( app_admin_web_pack_bundle.css admin.css ) | Rails.application.config.assets.version = '1.0'
+
+ Rails.application.config.assets.initialize_on_precompile = false
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( evaluations.js app_admin_web_pack_bundle.js app_web_pack_bundle.js styles_web_pack_bundle.js)
Rails.application.config.assets.precompile += %w( app_admin_web_pack_bundle.css admin.css ) | 2 | 0.25 | 2 | 0 |
3dbe6ccdeda092f3c32cb0c81bbe8c5a1af4cccb | fml/src/main/java/cpw/mods/fml/relauncher/FMLSecurityManager.java | fml/src/main/java/cpw/mods/fml/relauncher/FMLSecurityManager.java | package cpw.mods.fml.relauncher;
import java.security.Permission;
/**
* A custom security manager stopping certain events from happening
* unexpectedly.
*
* @author cpw
*
*/
public class FMLSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm)
{
String permName = perm.getName() != null ? perm.getName() : "missing";
if (permName.startsWith("exitVM"))
{
String callingClass = getClassContext()[4].getName();
// FML is allowed to call system exit
if (!callingClass.startsWith("cpw.mods.fml."))
{
throw new ExitTrappedException();
}
}
else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
return;
}
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1L;
}
}
| package cpw.mods.fml.relauncher;
import java.security.Permission;
/**
* A custom security manager stopping certain events from happening
* unexpectedly.
*
* @author cpw
*
*/
public class FMLSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm)
{
String permName = perm.getName() != null ? perm.getName() : "missing";
if (permName.startsWith("exitVM"))
{
Class<?>[] classContexts = getClassContext();
String callingClass = classContexts.length > 3 ? classContexts[4].getName() : "none";
String callingParent = classContexts.length > 4 ? classContexts[5].getName() : "none";
// FML is allowed to call system exit and the Minecraft applet (from the quit button)
if (!(callingClass.startsWith("cpw.mods.fml.") || ( "net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) || ("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent))))
{
throw new ExitTrappedException();
}
}
else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
return;
}
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1L;
}
}
| Fix up other exit points. Should stop process hangs for clean exits. | Fix up other exit points. Should stop process hangs for clean exits.
| Java | lgpl-2.1 | Ghostlyr/MinecraftForge,bonii-xx/MinecraftForge,dmf444/MinecraftForge,brubo1/MinecraftForge,simon816/MinecraftForge,karlthepagan/MinecraftForge,shadekiller666/MinecraftForge,mickkay/MinecraftForge,jdpadrnos/MinecraftForge,Mathe172/MinecraftForge,CrafterKina/MinecraftForge,blay09/MinecraftForge,fcjailybo/MinecraftForge,Theerapak/MinecraftForge,RainWarrior/MinecraftForge,Zaggy1024/MinecraftForge,Vorquel/MinecraftForge,ThiagoGarciaAlves/MinecraftForge,luacs1998/MinecraftForge | java | ## Code Before:
package cpw.mods.fml.relauncher;
import java.security.Permission;
/**
* A custom security manager stopping certain events from happening
* unexpectedly.
*
* @author cpw
*
*/
public class FMLSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm)
{
String permName = perm.getName() != null ? perm.getName() : "missing";
if (permName.startsWith("exitVM"))
{
String callingClass = getClassContext()[4].getName();
// FML is allowed to call system exit
if (!callingClass.startsWith("cpw.mods.fml."))
{
throw new ExitTrappedException();
}
}
else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
return;
}
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1L;
}
}
## Instruction:
Fix up other exit points. Should stop process hangs for clean exits.
## Code After:
package cpw.mods.fml.relauncher;
import java.security.Permission;
/**
* A custom security manager stopping certain events from happening
* unexpectedly.
*
* @author cpw
*
*/
public class FMLSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm)
{
String permName = perm.getName() != null ? perm.getName() : "missing";
if (permName.startsWith("exitVM"))
{
Class<?>[] classContexts = getClassContext();
String callingClass = classContexts.length > 3 ? classContexts[4].getName() : "none";
String callingParent = classContexts.length > 4 ? classContexts[5].getName() : "none";
// FML is allowed to call system exit and the Minecraft applet (from the quit button)
if (!(callingClass.startsWith("cpw.mods.fml.") || ( "net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) || ("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent))))
{
throw new ExitTrappedException();
}
}
else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
return;
}
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1L;
}
}
| package cpw.mods.fml.relauncher;
import java.security.Permission;
/**
* A custom security manager stopping certain events from happening
* unexpectedly.
*
* @author cpw
*
*/
public class FMLSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm)
{
String permName = perm.getName() != null ? perm.getName() : "missing";
if (permName.startsWith("exitVM"))
{
- String callingClass = getClassContext()[4].getName();
- // FML is allowed to call system exit
- if (!callingClass.startsWith("cpw.mods.fml."))
+ Class<?>[] classContexts = getClassContext();
+ String callingClass = classContexts.length > 3 ? classContexts[4].getName() : "none";
+ String callingParent = classContexts.length > 4 ? classContexts[5].getName() : "none";
+ // FML is allowed to call system exit and the Minecraft applet (from the quit button)
+ if (!(callingClass.startsWith("cpw.mods.fml.") || ( "net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) || ("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent))))
{
throw new ExitTrappedException();
}
}
else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
return;
}
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1L;
}
} | 8 | 0.222222 | 5 | 3 |
90b17c87c26bcfceae79a6d8c0890035bbb57d16 | .travis.yml | .travis.yml | language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
before_install: echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
install: composer install
| language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
before_script:
- pecl -q install mongo && echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- composer install
| Use pecl to install MongoDB | Use pecl to install MongoDB
| YAML | mit | awurth/silex-user,awurth/silex-user | yaml | ## Code Before:
language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
before_install: echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
install: composer install
## Instruction:
Use pecl to install MongoDB
## Code After:
language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
before_script:
- pecl -q install mongo && echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- composer install
| language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
- before_install: echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
-
+ before_script:
+ - pecl -q install mongo && echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- install: composer install
? ^^^^^^^^
+ - composer install
? ^^^
| 6 | 0.545455 | 3 | 3 |
8882230d88839d5f4bd253c78350b6b8621a5f3a | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='knitty-gritty',
version='0.0.1',
description='Pattern uploader/downloader for Brother knitting machines',
url='https://github.com/mhallin/knitty-gritty',
author='Magnus Hallin',
author_email='mhallin@gmail.com',
license='BSD',
packages=find_packages(),
install_requires=[
'click>=2.4,<2.5',
'Pillow>=2.5,<2.6',
'pyserial>=2.7,<2.8',
],
extras_require={
'dev': [
'flake8>=2.2,<2.3',
'mccabe>=0.2,<0.3',
'pep8>=1.5,<1.6',
'pip-tools>=0.3,<0.4',
'pyflakes>=0.8.1,<0.9',
],
},
entry_points={
'console_scripts': [
'knitty-gritty = knittygritty.main:cli'
],
},
)
| from setuptools import setup, find_packages
with open('README.rst') as f:
description = f.read()
setup(
name='knitty-gritty',
version='0.0.1',
description=description,
url='https://github.com/mhallin/knitty-gritty',
author='Magnus Hallin',
author_email='mhallin@gmail.com',
license='BSD',
packages=find_packages(),
install_requires=[
'click>=2.4,<2.5',
'Pillow>=2.5,<2.6',
'pyserial>=2.7,<2.8',
],
extras_require={
'dev': [
'flake8>=2.2,<2.3',
'mccabe>=0.2,<0.3',
'pep8>=1.5,<1.6',
'pip-tools>=0.3,<0.4',
'pyflakes>=0.8.1,<0.9',
'wheel>=0.24,<0.25',
],
},
entry_points={
'console_scripts': [
'knitty-gritty = knittygritty.main:cli'
],
},
)
| Add wheel dependency, read PyPI description from readme file | Add wheel dependency, read PyPI description from readme file
| Python | bsd-3-clause | mhallin/knitty-gritty | python | ## Code Before:
from setuptools import setup, find_packages
setup(
name='knitty-gritty',
version='0.0.1',
description='Pattern uploader/downloader for Brother knitting machines',
url='https://github.com/mhallin/knitty-gritty',
author='Magnus Hallin',
author_email='mhallin@gmail.com',
license='BSD',
packages=find_packages(),
install_requires=[
'click>=2.4,<2.5',
'Pillow>=2.5,<2.6',
'pyserial>=2.7,<2.8',
],
extras_require={
'dev': [
'flake8>=2.2,<2.3',
'mccabe>=0.2,<0.3',
'pep8>=1.5,<1.6',
'pip-tools>=0.3,<0.4',
'pyflakes>=0.8.1,<0.9',
],
},
entry_points={
'console_scripts': [
'knitty-gritty = knittygritty.main:cli'
],
},
)
## Instruction:
Add wheel dependency, read PyPI description from readme file
## Code After:
from setuptools import setup, find_packages
with open('README.rst') as f:
description = f.read()
setup(
name='knitty-gritty',
version='0.0.1',
description=description,
url='https://github.com/mhallin/knitty-gritty',
author='Magnus Hallin',
author_email='mhallin@gmail.com',
license='BSD',
packages=find_packages(),
install_requires=[
'click>=2.4,<2.5',
'Pillow>=2.5,<2.6',
'pyserial>=2.7,<2.8',
],
extras_require={
'dev': [
'flake8>=2.2,<2.3',
'mccabe>=0.2,<0.3',
'pep8>=1.5,<1.6',
'pip-tools>=0.3,<0.4',
'pyflakes>=0.8.1,<0.9',
'wheel>=0.24,<0.25',
],
},
entry_points={
'console_scripts': [
'knitty-gritty = knittygritty.main:cli'
],
},
)
| from setuptools import setup, find_packages
+
+ with open('README.rst') as f:
+ description = f.read()
setup(
name='knitty-gritty',
version='0.0.1',
- description='Pattern uploader/downloader for Brother knitting machines',
+ description=description,
url='https://github.com/mhallin/knitty-gritty',
author='Magnus Hallin',
author_email='mhallin@gmail.com',
license='BSD',
packages=find_packages(),
install_requires=[
'click>=2.4,<2.5',
'Pillow>=2.5,<2.6',
'pyserial>=2.7,<2.8',
],
extras_require={
'dev': [
'flake8>=2.2,<2.3',
'mccabe>=0.2,<0.3',
'pep8>=1.5,<1.6',
'pip-tools>=0.3,<0.4',
'pyflakes>=0.8.1,<0.9',
+ 'wheel>=0.24,<0.25',
],
},
entry_points={
'console_scripts': [
'knitty-gritty = knittygritty.main:cli'
],
},
) | 6 | 0.162162 | 5 | 1 |
e782ae25a70883780b5c00827aca1925157469e7 | test/framework/streaming/stream_module.js | test/framework/streaming/stream_module.js | 'use strict';
var stream = require('stream');
function hello(restbase, req) {
var body = new stream.PassThrough();
body.end('hello');
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function buffer(restbase, req) {
var body = new stream.PassThrough();
body.end(new Buffer('hello'));
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function chunks(restbase, req) {
var body = new stream.PassThrough();
for (var i = 0; i < 100; i++) {
body.write(i.toString());
}
body.end();
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
module.exports = function(options) {
return {
spec: {
paths: {
'/hello': {
get: {
operationId: 'hello'
}
},
'/buffer': {
get: {
operationId: 'buffer'
}
},
'/chunks': {
get: {
operationId: 'chunks'
}
}
}
},
operations: {
hello: hello,
buffer: buffer,
chunks: chunks,
}
};
};
| 'use strict';
var stream = require('stream');
function hello(restbase, req) {
var body = new stream.PassThrough();
body.end('hello');
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function buffer(restbase, req) {
var body = new stream.PassThrough();
body.write(new Buffer('hel'));
// Delay the final write to test async production.
setTimeout(function() {
body.end(new Buffer('lo'));
}, 500);
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function chunks(restbase, req) {
var body = new stream.PassThrough();
for (var i = 0; i < 100; i++) {
body.write(i.toString());
}
body.end();
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
module.exports = function(options) {
return {
spec: {
paths: {
'/hello': {
get: {
operationId: 'hello'
}
},
'/buffer': {
get: {
operationId: 'buffer'
}
},
'/chunks': {
get: {
operationId: 'chunks'
}
}
}
},
operations: {
hello: hello,
buffer: buffer,
chunks: chunks,
}
};
};
| Make the buffer test stream write async | Make the buffer test stream write async
As suggested by @pchelolo, asynchronously finish the stream.
| JavaScript | apache-2.0 | d00rman/restbase,gwicke/restbase,wikimedia/hyperswitch,eevans/restbase,milimetric/restbase,wikimedia/restbase,wikimedia/mediawiki-services-restbase,inverno/restbase,wikimedia/restbase,eevans/restbase,cscott/restbase,gwicke/restbase,d00rman/restbase,inverno/restbase,milimetric/restbase,Pchelolo/restbase,wikimedia/mediawiki-services-restbase,Pchelolo/restbase,cscott/restbase | javascript | ## Code Before:
'use strict';
var stream = require('stream');
function hello(restbase, req) {
var body = new stream.PassThrough();
body.end('hello');
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function buffer(restbase, req) {
var body = new stream.PassThrough();
body.end(new Buffer('hello'));
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function chunks(restbase, req) {
var body = new stream.PassThrough();
for (var i = 0; i < 100; i++) {
body.write(i.toString());
}
body.end();
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
module.exports = function(options) {
return {
spec: {
paths: {
'/hello': {
get: {
operationId: 'hello'
}
},
'/buffer': {
get: {
operationId: 'buffer'
}
},
'/chunks': {
get: {
operationId: 'chunks'
}
}
}
},
operations: {
hello: hello,
buffer: buffer,
chunks: chunks,
}
};
};
## Instruction:
Make the buffer test stream write async
As suggested by @pchelolo, asynchronously finish the stream.
## Code After:
'use strict';
var stream = require('stream');
function hello(restbase, req) {
var body = new stream.PassThrough();
body.end('hello');
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function buffer(restbase, req) {
var body = new stream.PassThrough();
body.write(new Buffer('hel'));
// Delay the final write to test async production.
setTimeout(function() {
body.end(new Buffer('lo'));
}, 500);
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function chunks(restbase, req) {
var body = new stream.PassThrough();
for (var i = 0; i < 100; i++) {
body.write(i.toString());
}
body.end();
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
module.exports = function(options) {
return {
spec: {
paths: {
'/hello': {
get: {
operationId: 'hello'
}
},
'/buffer': {
get: {
operationId: 'buffer'
}
},
'/chunks': {
get: {
operationId: 'chunks'
}
}
}
},
operations: {
hello: hello,
buffer: buffer,
chunks: chunks,
}
};
};
| 'use strict';
var stream = require('stream');
function hello(restbase, req) {
var body = new stream.PassThrough();
body.end('hello');
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function buffer(restbase, req) {
var body = new stream.PassThrough();
+ body.write(new Buffer('hel'));
+ // Delay the final write to test async production.
+ setTimeout(function() {
- body.end(new Buffer('hello'));
? ---
+ body.end(new Buffer('lo'));
? ++++
+ }, 500);
+
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
function chunks(restbase, req) {
var body = new stream.PassThrough();
for (var i = 0; i < 100; i++) {
body.write(i.toString());
}
body.end();
return {
status: 200,
headers: {
'content-type': 'text/html',
},
body: body
};
}
module.exports = function(options) {
return {
spec: {
paths: {
'/hello': {
get: {
operationId: 'hello'
}
},
'/buffer': {
get: {
operationId: 'buffer'
}
},
'/chunks': {
get: {
operationId: 'chunks'
}
}
}
},
operations: {
hello: hello,
buffer: buffer,
chunks: chunks,
}
};
}; | 7 | 0.098592 | 6 | 1 |
85dbf2a750aab34103800b32756fc3c6a45c417a | .travis.yml | .travis.yml | language: csharp
dist: trusty
services:
- docker
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
sudo: required
mono: 5.8.0
dotnet: 2.1.301
os: linux
before_script:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.4
- chmod a+x ./build.sh
script:
- ./build.sh
| language: csharp
dist: trusty
services:
- docker
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
sudo: required
mono: 5.8.0
dotnet:
- 2.1.301
- 2.1.4
os: linux
before_script:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.4
- chmod a+x ./build.sh
script:
- ./build.sh
| Add multiple Travis built-in dotnet sdk | Add multiple Travis built-in dotnet sdk
| YAML | mit | lecaillon/Evolve | yaml | ## Code Before:
language: csharp
dist: trusty
services:
- docker
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
sudo: required
mono: 5.8.0
dotnet: 2.1.301
os: linux
before_script:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.4
- chmod a+x ./build.sh
script:
- ./build.sh
## Instruction:
Add multiple Travis built-in dotnet sdk
## Code After:
language: csharp
dist: trusty
services:
- docker
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
sudo: required
mono: 5.8.0
dotnet:
- 2.1.301
- 2.1.4
os: linux
before_script:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.4
- chmod a+x ./build.sh
script:
- ./build.sh
| language: csharp
dist: trusty
services:
- docker
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
sudo: required
mono: 5.8.0
- dotnet: 2.1.301
+ dotnet:
+ - 2.1.301
+ - 2.1.4
os: linux
before_script:
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.4
- chmod a+x ./build.sh
script:
- ./build.sh | 4 | 0.2 | 3 | 1 |
8a851ab453bb619104b5277f941bec3e98bec390 | lib/mini_readline/raw_term/windows/win_32_api.rb | lib/mini_readline/raw_term/windows/win_32_api.rb | module MiniReadline
require 'fiddle'
#The classic \Win32API gem is deprecated, so we emulate it with fiddle.
class Win32API
#Use standard calling conventions
STDCALL = 1
#A hash of DLL files used for one or more API entry points.
DLL = {}
#Type mappings.
TYPES = {"0" => Fiddle::TYPE_VOID,
"S" => Fiddle::TYPE_VOIDP,
"I" => Fiddle::TYPE_LONG}
#Set up an API entry point.
def initialize(dllname, func, import)
@proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
handle = DLL[dllname] ||= Fiddle.dlopen(dllname)
@func = Fiddle::Function.new(handle[func], TYPES.values_at(*@proto), STDCALL)
end
#Call the Win 32 API entry point with appropriate arguments.
#<br>Endemic Code Smells
#* :reek:FeatureEnvy
def call(*args)
args.each_with_index do |arg, index|
case @proto[index]
when "S"
args[index], = [arg == 0 ? nil : arg].pack("p").unpack("l!*")
when "I"
args[index], = [arg].pack("I").unpack("i")
end
end
@func.call(*args).to_i || 0
end
end
end
| module MiniReadline
require 'dl'
#The classic \Win32API gem is deprecated, so we emulate it with DL.
class Win32API
#Use standard calling conventions
STDCALL = 1
#A hash of DLL files used for one or more API entry points.
DLL = {}
#Type mappings.
TYPES = {"0" => Fiddle::TYPE_VOID,
"S" => Fiddle::TYPE_VOIDP,
"I" => Fiddle::TYPE_LONG}
#Set up an API entry point.
def initialize(dllname, func, import)
@proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
handle = DLL[dllname] ||= DL.dlopen(dllname)
@func = Fiddle::Function.new(handle[func], TYPES.values_at(*@proto), STDCALL)
end
#Call the Win 32 API entry point with appropriate arguments.
#<br>Endemic Code Smells
#* :reek:FeatureEnvy
def call(*args)
args.each_with_index do |arg, index|
case @proto[index]
when "S"
args[index], = [arg == 0 ? nil : arg].pack("p").unpack("l!*")
when "I"
args[index], = [arg].pack("I").unpack("i")
end
end
@func.call(*args).to_i || 0
end
end
end
| Replace fiddle with DL to avoid compatibility issues with older rubies. | Replace fiddle with DL to avoid compatibility issues with older rubies.
| Ruby | mit | PeterCamilleri/mini_readline | ruby | ## Code Before:
module MiniReadline
require 'fiddle'
#The classic \Win32API gem is deprecated, so we emulate it with fiddle.
class Win32API
#Use standard calling conventions
STDCALL = 1
#A hash of DLL files used for one or more API entry points.
DLL = {}
#Type mappings.
TYPES = {"0" => Fiddle::TYPE_VOID,
"S" => Fiddle::TYPE_VOIDP,
"I" => Fiddle::TYPE_LONG}
#Set up an API entry point.
def initialize(dllname, func, import)
@proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
handle = DLL[dllname] ||= Fiddle.dlopen(dllname)
@func = Fiddle::Function.new(handle[func], TYPES.values_at(*@proto), STDCALL)
end
#Call the Win 32 API entry point with appropriate arguments.
#<br>Endemic Code Smells
#* :reek:FeatureEnvy
def call(*args)
args.each_with_index do |arg, index|
case @proto[index]
when "S"
args[index], = [arg == 0 ? nil : arg].pack("p").unpack("l!*")
when "I"
args[index], = [arg].pack("I").unpack("i")
end
end
@func.call(*args).to_i || 0
end
end
end
## Instruction:
Replace fiddle with DL to avoid compatibility issues with older rubies.
## Code After:
module MiniReadline
require 'dl'
#The classic \Win32API gem is deprecated, so we emulate it with DL.
class Win32API
#Use standard calling conventions
STDCALL = 1
#A hash of DLL files used for one or more API entry points.
DLL = {}
#Type mappings.
TYPES = {"0" => Fiddle::TYPE_VOID,
"S" => Fiddle::TYPE_VOIDP,
"I" => Fiddle::TYPE_LONG}
#Set up an API entry point.
def initialize(dllname, func, import)
@proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
handle = DLL[dllname] ||= DL.dlopen(dllname)
@func = Fiddle::Function.new(handle[func], TYPES.values_at(*@proto), STDCALL)
end
#Call the Win 32 API entry point with appropriate arguments.
#<br>Endemic Code Smells
#* :reek:FeatureEnvy
def call(*args)
args.each_with_index do |arg, index|
case @proto[index]
when "S"
args[index], = [arg == 0 ? nil : arg].pack("p").unpack("l!*")
when "I"
args[index], = [arg].pack("I").unpack("i")
end
end
@func.call(*args).to_i || 0
end
end
end
| module MiniReadline
- require 'fiddle'
? --- -
+ require 'dl'
- #The classic \Win32API gem is deprecated, so we emulate it with fiddle.
? ^^^^^^
+ #The classic \Win32API gem is deprecated, so we emulate it with DL.
? ^^
class Win32API
#Use standard calling conventions
STDCALL = 1
#A hash of DLL files used for one or more API entry points.
DLL = {}
#Type mappings.
TYPES = {"0" => Fiddle::TYPE_VOID,
"S" => Fiddle::TYPE_VOIDP,
"I" => Fiddle::TYPE_LONG}
#Set up an API entry point.
def initialize(dllname, func, import)
@proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
- handle = DLL[dllname] ||= Fiddle.dlopen(dllname)
? ^^^^^^
+ handle = DLL[dllname] ||= DL.dlopen(dllname)
? ^^
@func = Fiddle::Function.new(handle[func], TYPES.values_at(*@proto), STDCALL)
end
#Call the Win 32 API entry point with appropriate arguments.
#<br>Endemic Code Smells
#* :reek:FeatureEnvy
def call(*args)
args.each_with_index do |arg, index|
case @proto[index]
when "S"
args[index], = [arg == 0 ? nil : arg].pack("p").unpack("l!*")
when "I"
args[index], = [arg].pack("I").unpack("i")
end
end
@func.call(*args).to_i || 0
end
end
end | 6 | 0.136364 | 3 | 3 |
6d56f5f27936e362e85c140190d87d675b98bea1 | templates/opt/splunk/etc/passwd.erb | templates/opt/splunk/etc/passwd.erb | <%= @splunkadmin %>
<% if @type == 'search' and @localusers != :undef then -%>
<% localusers.each do |user| -%>
<%= user %>
<% end -%>
<% end -%>
| <%= @splunkadmin %>
<% if @type == 'search' and @localusers then -%>
<% @localusers.each do |user| -%>
<%= user %>
<% end -%>
<% end -%>
| Fix comparison of @localusers to undef for puppet3.7/ruby1.8 | Fix comparison of @localusers to undef for puppet3.7/ruby1.8
Catalog compilation fails with puppet 3.7 on ruby 1.8 (centos6) with
error calling .each on undef, due to failing comparison of @localusers
to :undef. Replace witha simple truthyness test of @localusers.
| HTML+ERB | mit | huit/puppet-splunk,huit/puppet-splunk,tfhartmann/puppet-splunk,tfhartmann/puppet-splunk,huit/puppet-splunk,tfhartmann/puppet-splunk,huit/puppet-splunk,huit/puppet-splunk,tfhartmann/puppet-splunk,tfhartmann/puppet-splunk | html+erb | ## Code Before:
<%= @splunkadmin %>
<% if @type == 'search' and @localusers != :undef then -%>
<% localusers.each do |user| -%>
<%= user %>
<% end -%>
<% end -%>
## Instruction:
Fix comparison of @localusers to undef for puppet3.7/ruby1.8
Catalog compilation fails with puppet 3.7 on ruby 1.8 (centos6) with
error calling .each on undef, due to failing comparison of @localusers
to :undef. Replace witha simple truthyness test of @localusers.
## Code After:
<%= @splunkadmin %>
<% if @type == 'search' and @localusers then -%>
<% @localusers.each do |user| -%>
<%= user %>
<% end -%>
<% end -%>
| <%= @splunkadmin %>
- <% if @type == 'search' and @localusers != :undef then -%>
? ----------
+ <% if @type == 'search' and @localusers then -%>
- <% localusers.each do |user| -%>
+ <% @localusers.each do |user| -%>
? +
<%= user %>
<% end -%>
<% end -%> | 4 | 0.666667 | 2 | 2 |
46755a7bfec1a35ff7967cf92ed8da3d911d32f0 | app/views/projects/issues/_issues.html.haml | app/views/projects/issues/_issues.html.haml | .append-bottom-10
.check-all-holder
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
= render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), method: :post do
= select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status")
= project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]
= button_tag "Update issues", class: "btn update_selected_issues btn-save"
.panel.panel-default
%ul.well-list.issues-list
= render @issues
- if @issues.blank?
%li
.nothing-here-block No issues to show
- if @issues.present?
.pull-right
%span.issue_counter #{@issues.total_count}
issues for this filter
= paginate @issues, theme: "gitlab"
| .append-bottom-10
.check-all-holder
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left", disabled: !can?(current_user, :modify_issue, @project)
= render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), method: :post do
= select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status")
= project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]
= button_tag "Update issues", class: "btn update_selected_issues btn-save"
.panel.panel-default
%ul.well-list.issues-list
= render @issues
- if @issues.blank?
%li
.nothing-here-block No issues to show
- if @issues.present?
.pull-right
%span.issue_counter #{@issues.total_count}
issues for this filter
= paginate @issues, theme: "gitlab"
| Disable 'check all issues' checkbox for unprivileged users. | Disable 'check all issues' checkbox for unprivileged users.
| Haml | mit | t-zuehlsdorff/gitlabhq,cncodog/gitlab,LUMC/gitlabhq,theodi/gitlabhq,julianengel/gitlabhq,DanielZhangQingLong/gitlabhq,jrjang/gitlabhq,Exeia/gitlabhq,bigsurge/gitlabhq,shinexiao/gitlabhq,yatish27/gitlabhq,manfer/gitlabhq,revaret/gitlabhq,liyakun/gitlabhq,gopeter/gitlabhq,julianengel/gitlabhq,jirutka/gitlabhq,allysonbarros/gitlabhq,Burick/gitlabhq,tim-hoff/gitlabhq,johnmyqin/gitlabhq,axilleas/gitlabhq,salipro4ever/gitlabhq,youprofit/gitlabhq,ksoichiro/gitlabhq,lvfeng1130/gitlabhq,ayufan/gitlabhq,flashbuckets/gitlabhq,ibiart/gitlabhq,screenpages/gitlabhq,joalmeid/gitlabhq,hq804116393/gitlabhq,mente/gitlabhq,martijnvermaat/gitlabhq,copystudy/gitlabhq,fantasywind/gitlabhq,dplarson/gitlabhq,mrb/gitlabhq,per-garden/gitlabhq,screenpages/gitlabhq,ngpestelos/gitlabhq,Soullivaneuh/gitlabhq,bigsurge/gitlabhq,sue445/gitlabhq,kemenaran/gitlabhq,louahola/gitlabhq,mathstuf/gitlabhq,michaKFromParis/sparkslab,fantasywind/gitlabhq,bigsurge/gitlabhq,dwrensha/gitlabhq,larryli/gitlabhq,ngpestelos/gitlabhq,martijnvermaat/gitlabhq,cui-liqiang/gitlab-ce,dvrylc/gitlabhq,liyakun/gitlabhq,H3Chief/gitlabhq,yfaizal/gitlabhq,stoplightio/gitlabhq,ordiychen/gitlabhq,zBMNForks/gitlabhq,t-zuehlsdorff/gitlabhq,OtkurBiz/gitlabhq,vjustov/gitlabhq,screenpages/gitlabhq,youprofit/gitlabhq,stanhu/gitlabhq,ksoichiro/gitlabhq,sakishum/gitlabhq,pjknkda/gitlabhq,ferdinandrosario/gitlabhq,kemenaran/gitlabhq,Burick/gitlabhq,fgbreel/gitlabhq,hzy001/gitlabhq,dplarson/gitlabhq,ferdinandrosario/gitlabhq,mmkassem/gitlabhq,Telekom-PD/gitlabhq,fscherwi/gitlabhq,ngpestelos/gitlabhq,fpgentil/gitlabhq,manfer/gitlabhq,ayufan/gitlabhq,chenrui2014/gitlabhq,zrbsprite/gitlabhq,sue445/gitlabhq,zrbsprite/gitlabhq,michaKFromParis/gitlabhq,gopeter/gitlabhq,dreampet/gitlab,ayufan/gitlabhq,8thcolor/testing-public-gitlabhq,vjustov/gitlabhq,fgbreel/gitlabhq,OtkurBiz/gitlabhq,bbodenmiller/gitlabhq,rebecamendez/gitlabhq,yfaizal/gitlabhq,NKMR6194/gitlabhq,yuyue2013/ss,Datacom/gitlabhq,joalmeid/gitlabhq,mrb/gitlabhq,OtkurBiz/gitlabhq,nguyen-tien-mulodo/gitlabhq,Burick/gitlabhq,jirutka/gitlabhq,nguyen-tien-mulodo/gitlabhq,kitech/gitlabhq,NARKOZ/gitlabhq,DanielZhangQingLong/gitlabhq,kitech/gitlabhq,NKMR6194/gitlabhq,ikappas/gitlabhq,darkrasid/gitlabhq,sonalkr132/gitlabhq,koreamic/gitlabhq,NARKOZ/gitlabhq,flashbuckets/gitlabhq,icedwater/gitlabhq,revaret/gitlabhq,fendoudeqingchunhh/gitlabhq,fendoudeqingchunhh/gitlabhq,fantasywind/gitlabhq,OlegGirko/gitlab-ce,wangcan2014/gitlabhq,salipro4ever/gitlabhq,koreamic/gitlabhq,mathstuf/gitlabhq,nmav/gitlabhq,SkyWei/gitlabhq,Razer6/gitlabhq,flashbuckets/gitlabhq,htve/GitlabForChinese,bozaro/gitlabhq,ibiart/gitlabhq,H3Chief/gitlabhq,delkyd/gitlabhq,fearenales/gitlabhq,iiet/iiet-git,dvrylc/gitlabhq,delkyd/gitlabhq,rebecamendez/gitlabhq,salipro4ever/gitlabhq,yonglehou/gitlabhq,allistera/gitlabhq,jrjang/gitlabhq,yfaizal/gitlabhq,htve/GitlabForChinese,LytayTOUCH/gitlabhq,whluwit/gitlabhq,OlegGirko/gitlab-ce,MauriceMohlek/gitlabhq,ttasanen/gitlabhq,rhels/gitlabhq,jvanbaarsen/gitlabhq,ksoichiro/gitlabhq,martinma4/gitlabhq,pulkit21/gitlabhq,larryli/gitlabhq,martinma4/gitlabhq,pulkit21/gitlabhq,htve/GitlabForChinese,SVArago/gitlabhq,darkrasid/gitlabhq,Telekom-PD/gitlabhq,chadyred/gitlabhq,pjknkda/gitlabhq,axilleas/gitlabhq,cinderblock/gitlabhq,NARKOZ/gitlabhq,tk23/gitlabhq,Datacom/gitlabhq,hq804116393/gitlabhq,mr-dxdy/gitlabhq,nguyen-tien-mulodo/gitlabhq,hacsoc/gitlabhq,cncodog/gitlab,koreamic/gitlabhq,zBMNForks/gitlabhq,icedwater/gitlabhq,dplarson/gitlabhq,lvfeng1130/gitlabhq,dplarson/gitlabhq,dwrensha/gitlabhq,k4zzk/gitlabhq,yama07/gitlabhq,ferdinandrosario/gitlabhq,luzhongyang/gitlabhq,Tyrael/gitlabhq,koreamic/gitlabhq,mente/gitlabhq,jrjang/gitlab-ce,pjknkda/gitlabhq,Burick/gitlabhq,daiyu/gitlab-zh,theonlydoo/gitlabhq,julianengel/gitlabhq,allysonbarros/gitlabhq,flashbuckets/gitlabhq,daiyu/gitlab-zh,openwide-java/gitlabhq,sekcheong/gitlabhq,allysonbarros/gitlabhq,michaKFromParis/sparkslab,fearenales/gitlabhq,hq804116393/gitlabhq,eliasp/gitlabhq,k4zzk/gitlabhq,martinma4/gitlabhq,szechyjs/gitlabhq,initiummedia/gitlabhq,jrjang/gitlab-ce,it33/gitlabhq,michaKFromParis/sparkslab,cui-liqiang/gitlab-ce,ksoichiro/gitlabhq,mavimo/gitlabhq,yonglehou/gitlabhq,TheWatcher/gitlabhq,ibiart/gitlabhq,chadyred/gitlabhq,stanhu/gitlabhq,whluwit/gitlabhq,eliasp/gitlabhq,gopeter/gitlabhq,jrjang/gitlab-ce,Telekom-PD/gitlabhq,childbamboo/gitlabhq,Devin001/gitlabhq,childbamboo/gitlabhq,theonlydoo/gitlabhq,axilleas/gitlabhq,theodi/gitlabhq,duduribeiro/gitlabhq,Devin001/gitlabhq,ikappas/gitlabhq,Razer6/gitlabhq,yfaizal/gitlabhq,kemenaran/gitlabhq,aaronsnyder/gitlabhq,Exeia/gitlabhq,williamherry/gitlabhq,yonglehou/gitlabhq,chadyred/gitlabhq,adaiguoguo/gitlab_globalserarch,initiummedia/gitlabhq,iiet/iiet-git,fendoudeqingchunhh/gitlabhq,axilleas/gitlabhq,SVArago/gitlabhq,cinderblock/gitlabhq,NKMR6194/gitlabhq,martijnvermaat/gitlabhq,bozaro/gitlabhq,yuyue2013/ss,eliasp/gitlabhq,H3Chief/gitlabhq,since2014/gitlabhq,mente/gitlabhq,fscherwi/gitlabhq,mrb/gitlabhq,daiyu/gitlab-zh,jaepyoung/gitlabhq,joalmeid/gitlabhq,bbodenmiller/gitlabhq,jaepyoung/gitlabhq,copystudy/gitlabhq,liyakun/gitlabhq,yuyue2013/ss,chadyred/gitlabhq,liyakun/gitlabhq,allistera/gitlabhq,chenrui2014/gitlabhq,zrbsprite/gitlabhq,bigsurge/gitlabhq,mavimo/gitlabhq,TheWatcher/gitlabhq,johnmyqin/gitlabhq,fgbreel/gitlabhq,tim-hoff/gitlabhq,it33/gitlabhq,gorgee/gitlabhq,johnmyqin/gitlabhq,rumpelsepp/gitlabhq,mmkassem/gitlabhq,duduribeiro/gitlabhq,martijnvermaat/gitlabhq,dwrensha/gitlabhq,yatish27/gitlabhq,it33/gitlabhq,mr-dxdy/gitlabhq,Tyrael/gitlabhq,ttasanen/gitlabhq,larryli/gitlabhq,OlegGirko/gitlab-ce,chenrui2014/gitlabhq,bbodenmiller/gitlabhq,sakishum/gitlabhq,sideci-sample/sideci-sample-gitlabhq,sideci-sample/sideci-sample-gitlabhq,cncodog/gitlab,hzy001/gitlabhq,yatish27/gitlabhq,theodi/gitlabhq,per-garden/gitlabhq,childbamboo/gitlabhq,mmkassem/gitlabhq,hacsoc/gitlabhq,louahola/gitlabhq,luzhongyang/gitlabhq,jirutka/gitlabhq,dreampet/gitlab,dukex/gitlabhq,sakishum/gitlabhq,since2014/gitlabhq,tempbottle/gitlabhq,michaKFromParis/gitlabhq,tempbottle/gitlabhq,folpindo/gitlabhq,sue445/gitlabhq,LytayTOUCH/gitlabhq,jaepyoung/gitlabhq,dukex/gitlabhq,folpindo/gitlabhq,yonglehou/gitlabhq,theodi/gitlabhq,jaepyoung/gitlabhq,michaKFromParis/sparkslab,wangcan2014/gitlabhq,mathstuf/gitlabhq,theonlydoo/gitlabhq,sekcheong/gitlabhq,ayufan/gitlabhq,fscherwi/gitlabhq,szechyjs/gitlabhq,manfer/gitlabhq,hq804116393/gitlabhq,openwide-java/gitlabhq,openwide-java/gitlabhq,williamherry/gitlabhq,lvfeng1130/gitlabhq,jrjang/gitlabhq,Soullivaneuh/gitlabhq,stoplightio/gitlabhq,WSDC-NITWarangal/gitlabhq,mrb/gitlabhq,since2014/gitlabhq,8thcolor/testing-public-gitlabhq,WSDC-NITWarangal/gitlabhq,screenpages/gitlabhq,tim-hoff/gitlabhq,shinexiao/gitlabhq,SkyWei/gitlabhq,dreampet/gitlab,dvrylc/gitlabhq,kitech/gitlabhq,fpgentil/gitlabhq,darkrasid/gitlabhq,youprofit/gitlabhq,iiet/iiet-git,rebecamendez/gitlabhq,gopeter/gitlabhq,dreampet/gitlab,zBMNForks/gitlabhq,jirutka/gitlabhq,fpgentil/gitlabhq,adaiguoguo/gitlab_globalserarch,TheWatcher/gitlabhq,adaiguoguo/gitlab_globalserarch,yama07/gitlabhq,stoplightio/gitlabhq,luzhongyang/gitlabhq,daiyu/gitlab-zh,eliasp/gitlabhq,williamherry/gitlabhq,LytayTOUCH/gitlabhq,sideci-sample/sideci-sample-gitlabhq,ngpestelos/gitlabhq,zrbsprite/gitlabhq,ttasanen/gitlabhq,shinexiao/gitlabhq,yatish27/gitlabhq,ordiychen/gitlabhq,jrjang/gitlabhq,mr-dxdy/gitlabhq,TheWatcher/gitlabhq,ikappas/gitlabhq,chenrui2014/gitlabhq,initiummedia/gitlabhq,Tyrael/gitlabhq,louahola/gitlabhq,Razer6/gitlabhq,yama07/gitlabhq,szechyjs/gitlabhq,hacsoc/gitlabhq,MauriceMohlek/gitlabhq,cui-liqiang/gitlab-ce,sonalkr132/gitlabhq,Devin001/gitlabhq,gorgee/gitlabhq,sekcheong/gitlabhq,Soullivaneuh/gitlabhq,8thcolor/testing-public-gitlabhq,NARKOZ/gitlabhq,revaret/gitlabhq,duduribeiro/gitlabhq,tempbottle/gitlabhq,rumpelsepp/gitlabhq,hzy001/gitlabhq,tk23/gitlabhq,allistera/gitlabhq,H3Chief/gitlabhq,julianengel/gitlabhq,dwrensha/gitlabhq,k4zzk/gitlabhq,SVArago/gitlabhq,mmkassem/gitlabhq,ttasanen/gitlabhq,fantasywind/gitlabhq,bbodenmiller/gitlabhq,kitech/gitlabhq,rebecamendez/gitlabhq,pjknkda/gitlabhq,folpindo/gitlabhq,darkrasid/gitlabhq,delkyd/gitlabhq,dvrylc/gitlabhq,WSDC-NITWarangal/gitlabhq,it33/gitlabhq,luzhongyang/gitlabhq,OlegGirko/gitlab-ce,NKMR6194/gitlabhq,aaronsnyder/gitlabhq,Datacom/gitlabhq,bozaro/gitlabhq,tk23/gitlabhq,Devin001/gitlabhq,iiet/iiet-git,ikappas/gitlabhq,LUMC/gitlabhq,stoplightio/gitlabhq,pulkit21/gitlabhq,vjustov/gitlabhq,nmav/gitlabhq,cncodog/gitlab,Exeia/gitlabhq,jvanbaarsen/gitlabhq,nguyen-tien-mulodo/gitlabhq,rhels/gitlabhq,per-garden/gitlabhq,yuyue2013/ss,rumpelsepp/gitlabhq,michaKFromParis/gitlabhqold,per-garden/gitlabhq,mavimo/gitlabhq,michaKFromParis/gitlabhqold,salipro4ever/gitlabhq,whluwit/gitlabhq,sonalkr132/gitlabhq,Datacom/gitlabhq,jvanbaarsen/gitlabhq,sakishum/gitlabhq,theonlydoo/gitlabhq,mavimo/gitlabhq,wangcan2014/gitlabhq,copystudy/gitlabhq,Soullivaneuh/gitlabhq,tempbottle/gitlabhq,fearenales/gitlabhq,duduribeiro/gitlabhq,larryli/gitlabhq,SkyWei/gitlabhq,fearenales/gitlabhq,johnmyqin/gitlabhq,nmav/gitlabhq,jrjang/gitlab-ce,rhels/gitlabhq,szechyjs/gitlabhq,rumpelsepp/gitlabhq,childbamboo/gitlabhq,ordiychen/gitlabhq,LUMC/gitlabhq,initiummedia/gitlabhq,stanhu/gitlabhq,mr-dxdy/gitlabhq,dukex/gitlabhq,Razer6/gitlabhq,fpgentil/gitlabhq,Exeia/gitlabhq,LytayTOUCH/gitlabhq,openwide-java/gitlabhq,whluwit/gitlabhq,ordiychen/gitlabhq,cinderblock/gitlabhq,yama07/gitlabhq,adaiguoguo/gitlab_globalserarch,michaKFromParis/gitlabhq,htve/GitlabForChinese,icedwater/gitlabhq,t-zuehlsdorff/gitlabhq,SkyWei/gitlabhq,martinma4/gitlabhq,lvfeng1130/gitlabhq,manfer/gitlabhq,k4zzk/gitlabhq,aaronsnyder/gitlabhq,OtkurBiz/gitlabhq,ferdinandrosario/gitlabhq,Tyrael/gitlabhq,zBMNForks/gitlabhq,cui-liqiang/gitlab-ce,mathstuf/gitlabhq,vjustov/gitlabhq,t-zuehlsdorff/gitlabhq,gorgee/gitlabhq,hzy001/gitlabhq,icedwater/gitlabhq,sonalkr132/gitlabhq,mente/gitlabhq,fscherwi/gitlabhq,louahola/gitlabhq,cinderblock/gitlabhq,since2014/gitlabhq,sue445/gitlabhq,SVArago/gitlabhq,revaret/gitlabhq,jvanbaarsen/gitlabhq,bozaro/gitlabhq,wangcan2014/gitlabhq,michaKFromParis/gitlabhqold,shinexiao/gitlabhq,stanhu/gitlabhq,fgbreel/gitlabhq,folpindo/gitlabhq,gorgee/gitlabhq,tk23/gitlabhq,youprofit/gitlabhq,aaronsnyder/gitlabhq,MauriceMohlek/gitlabhq,hacsoc/gitlabhq,Telekom-PD/gitlabhq,allistera/gitlabhq,fendoudeqingchunhh/gitlabhq,kemenaran/gitlabhq,pulkit21/gitlabhq,dukex/gitlabhq,copystudy/gitlabhq,michaKFromParis/gitlabhqold,WSDC-NITWarangal/gitlabhq,LUMC/gitlabhq,MauriceMohlek/gitlabhq,rhels/gitlabhq,joalmeid/gitlabhq,sekcheong/gitlabhq,DanielZhangQingLong/gitlabhq,tim-hoff/gitlabhq,nmav/gitlabhq,michaKFromParis/gitlabhq,DanielZhangQingLong/gitlabhq,williamherry/gitlabhq,delkyd/gitlabhq,allysonbarros/gitlabhq | haml | ## Code Before:
.append-bottom-10
.check-all-holder
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
= render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), method: :post do
= select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status")
= project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]
= button_tag "Update issues", class: "btn update_selected_issues btn-save"
.panel.panel-default
%ul.well-list.issues-list
= render @issues
- if @issues.blank?
%li
.nothing-here-block No issues to show
- if @issues.present?
.pull-right
%span.issue_counter #{@issues.total_count}
issues for this filter
= paginate @issues, theme: "gitlab"
## Instruction:
Disable 'check all issues' checkbox for unprivileged users.
## Code After:
.append-bottom-10
.check-all-holder
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left", disabled: !can?(current_user, :modify_issue, @project)
= render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), method: :post do
= select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status")
= project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]
= button_tag "Update issues", class: "btn update_selected_issues btn-save"
.panel.panel-default
%ul.well-list.issues-list
= render @issues
- if @issues.blank?
%li
.nothing-here-block No issues to show
- if @issues.present?
.pull-right
%span.issue_counter #{@issues.total_count}
issues for this filter
= paginate @issues, theme: "gitlab"
| .append-bottom-10
.check-all-holder
- = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
+ = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left", disabled: !can?(current_user, :modify_issue, @project)
= render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), method: :post do
= select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status")
= project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]
= button_tag "Update issues", class: "btn update_selected_issues btn-save"
.panel.panel-default
%ul.well-list.issues-list
= render @issues
- if @issues.blank?
%li
.nothing-here-block No issues to show
- if @issues.present?
.pull-right
%span.issue_counter #{@issues.total_count}
issues for this filter
= paginate @issues, theme: "gitlab" | 2 | 0.071429 | 1 | 1 |
1bc389679f191b53037121edba867eeecbeacba5 | examples/collection.coffee | examples/collection.coffee | Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView 'comment', '''
li
p body
p
a[click=highlight href="#"] "Highlight"
'''
class Post extends Monkey.Model
@property 'title'
@property 'body'
@property 'commentCount', dependsOn: 'comments', get: -> @comments.length
@collection 'comments'
class Comment extends Monkey.Model
@property 'body'
class PostController
postComment: (event) ->
@model.comments.push(@newComment)
event.preventDefault()
commentEdited: (event) ->
@newComment = { body: event.target.value }
class CommentController
highlight: ->
@view.style.backgroundColor = 'red'
Monkey.registerController 'post', PostController
Monkey.registerController 'comment', CommentController
window.aPost = new Post()
aPost.comments = [{body: 'test'}, {body: 'another'}]
window.onload = ->
view = Monkey.render('post', aPost)
sandbox = document.body.appendChild(view)
| Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView 'comment', '''
li
p body
p
a[click=highlight href="#"] "Highlight"
'''
class Post extends Monkey.Model
@property 'title'
@property 'body'
@property 'commentCount', dependsOn: 'comments', get: -> @comments.length
@collection 'comments'
class Comment extends Monkey.Model
@property 'body'
class PostController
postComment: (event) ->
@model.comments.push(@newComment)
event.preventDefault()
commentEdited: (event) ->
@newComment = { body: event.target.value }
class CommentController
highlight: ->
@view.style.backgroundColor = 'red'
Monkey.registerController 'post', PostController
Monkey.registerController 'comment', CommentController
window.aPost = new Post()
aPost.set
title: 'Monkey.js released!'
body: 'New contender in the JS framework wars!'
comments: [{body: 'This is cool'}, {body: 'I hate it'}]
window.onload = ->
document.body.appendChild Monkey.render('post', aPost)
| Use multi property set in example | Use multi property set in example | CoffeeScript | mit | elabs/serenade.js | coffeescript | ## Code Before:
Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView 'comment', '''
li
p body
p
a[click=highlight href="#"] "Highlight"
'''
class Post extends Monkey.Model
@property 'title'
@property 'body'
@property 'commentCount', dependsOn: 'comments', get: -> @comments.length
@collection 'comments'
class Comment extends Monkey.Model
@property 'body'
class PostController
postComment: (event) ->
@model.comments.push(@newComment)
event.preventDefault()
commentEdited: (event) ->
@newComment = { body: event.target.value }
class CommentController
highlight: ->
@view.style.backgroundColor = 'red'
Monkey.registerController 'post', PostController
Monkey.registerController 'comment', CommentController
window.aPost = new Post()
aPost.comments = [{body: 'test'}, {body: 'another'}]
window.onload = ->
view = Monkey.render('post', aPost)
sandbox = document.body.appendChild(view)
## Instruction:
Use multi property set in example
## Code After:
Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView 'comment', '''
li
p body
p
a[click=highlight href="#"] "Highlight"
'''
class Post extends Monkey.Model
@property 'title'
@property 'body'
@property 'commentCount', dependsOn: 'comments', get: -> @comments.length
@collection 'comments'
class Comment extends Monkey.Model
@property 'body'
class PostController
postComment: (event) ->
@model.comments.push(@newComment)
event.preventDefault()
commentEdited: (event) ->
@newComment = { body: event.target.value }
class CommentController
highlight: ->
@view.style.backgroundColor = 'red'
Monkey.registerController 'post', PostController
Monkey.registerController 'comment', CommentController
window.aPost = new Post()
aPost.set
title: 'Monkey.js released!'
body: 'New contender in the JS framework wars!'
comments: [{body: 'This is cool'}, {body: 'I hate it'}]
window.onload = ->
document.body.appendChild Monkey.render('post', aPost)
| Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView 'comment', '''
li
p body
p
a[click=highlight href="#"] "Highlight"
'''
class Post extends Monkey.Model
@property 'title'
@property 'body'
@property 'commentCount', dependsOn: 'comments', get: -> @comments.length
@collection 'comments'
class Comment extends Monkey.Model
@property 'body'
class PostController
postComment: (event) ->
@model.comments.push(@newComment)
event.preventDefault()
commentEdited: (event) ->
@newComment = { body: event.target.value }
class CommentController
highlight: ->
@view.style.backgroundColor = 'red'
Monkey.registerController 'post', PostController
Monkey.registerController 'comment', CommentController
window.aPost = new Post()
- aPost.comments = [{body: 'test'}, {body: 'another'}]
+ aPost.set
+ title: 'Monkey.js released!'
+ body: 'New contender in the JS framework wars!'
+ comments: [{body: 'This is cool'}, {body: 'I hate it'}]
window.onload = ->
+ document.body.appendChild Monkey.render('post', aPost)
- view = Monkey.render('post', aPost)
- sandbox = document.body.appendChild(view) | 8 | 0.150943 | 5 | 3 |
c649a6919604d1077e78c1fe61631cb707347c7e | src/Page.php | src/Page.php | <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace WordPlate\Acf;
use InvalidArgumentException;
/**
* This is the page class.
*
* @author Vincent Klaiber <hello@vinkla.com>
*/
class Page
{
/**
* Create a new page instance.
*
* @param array $settings
*
* @return void
*/
public function __construct(array $settings)
{
$keys = ['page_title', 'menu_title', 'menu_slug'];
foreach ($keys as $key) {
if (!array_key_exists($key, $settings)) {
throw new InvalidArgumentException("Missing page setting key [$key].");
}
}
$this->settings = $settings;
}
/**
* Return the page as array.
*
* @return array
*/
public function toArray(): array
{
return $this->settings;
}
}
| <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace WordPlate\Acf;
use InvalidArgumentException;
/**
* This is the page class.
*
* @author Vincent Klaiber <hello@vinkla.com>
*/
class Page
{
/**
* Create a new page instance.
*
* @param array $settings
*
* @return void
*/
public function __construct(array $settings)
{
$keys = ['page_title', 'menu_slug'];
foreach ($keys as $key) {
if (!array_key_exists($key, $settings)) {
throw new InvalidArgumentException("Missing page setting key [$key].");
}
}
$this->settings = $settings;
}
/**
* Return the page as array.
*
* @return array
*/
public function toArray(): array
{
return $this->settings;
}
}
| Remove required page key menu_title | Remove required page key menu_title
| PHP | mit | wordplate/acf | php | ## Code Before:
<?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace WordPlate\Acf;
use InvalidArgumentException;
/**
* This is the page class.
*
* @author Vincent Klaiber <hello@vinkla.com>
*/
class Page
{
/**
* Create a new page instance.
*
* @param array $settings
*
* @return void
*/
public function __construct(array $settings)
{
$keys = ['page_title', 'menu_title', 'menu_slug'];
foreach ($keys as $key) {
if (!array_key_exists($key, $settings)) {
throw new InvalidArgumentException("Missing page setting key [$key].");
}
}
$this->settings = $settings;
}
/**
* Return the page as array.
*
* @return array
*/
public function toArray(): array
{
return $this->settings;
}
}
## Instruction:
Remove required page key menu_title
## Code After:
<?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace WordPlate\Acf;
use InvalidArgumentException;
/**
* This is the page class.
*
* @author Vincent Klaiber <hello@vinkla.com>
*/
class Page
{
/**
* Create a new page instance.
*
* @param array $settings
*
* @return void
*/
public function __construct(array $settings)
{
$keys = ['page_title', 'menu_slug'];
foreach ($keys as $key) {
if (!array_key_exists($key, $settings)) {
throw new InvalidArgumentException("Missing page setting key [$key].");
}
}
$this->settings = $settings;
}
/**
* Return the page as array.
*
* @return array
*/
public function toArray(): array
{
return $this->settings;
}
}
| <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace WordPlate\Acf;
use InvalidArgumentException;
/**
* This is the page class.
*
* @author Vincent Klaiber <hello@vinkla.com>
*/
class Page
{
/**
* Create a new page instance.
*
* @param array $settings
*
* @return void
*/
public function __construct(array $settings)
{
- $keys = ['page_title', 'menu_title', 'menu_slug'];
? --------------
+ $keys = ['page_title', 'menu_slug'];
foreach ($keys as $key) {
if (!array_key_exists($key, $settings)) {
throw new InvalidArgumentException("Missing page setting key [$key].");
}
}
$this->settings = $settings;
}
/**
* Return the page as array.
*
* @return array
*/
public function toArray(): array
{
return $this->settings;
}
} | 2 | 0.037037 | 1 | 1 |
29aae66080fcdff0fe62486d445c6a3a9aeff406 | app/assets/javascripts/forest/admin/partials/forest_tables.js | app/assets/javascripts/forest/admin/partials/forest_tables.js | // Forest tables
$(document).on('mouseenter', '.forest-table tbody tr', function() {
var $row = $(this);
$row.addClass('active');
$(document).one('turbolinks:before-cache.forestTables', function() {
$row.removeClass('active');
});
});
$(document).on('mouseleave', '.forest-table tbody tr', function() {
var $row = $(this);
$row.removeClass('active');
});
$(document).on('click', '.forest-table tbody tr', function(e) {
var $row = $(this);
if ( !$(e.target).closest('a').length ) {
var $button = $row.find('a.forest-table__link:first');
if ( !$button.length ) {
$button = $row.find('a.btn-primary:first');
}
var url = $button.attr('href');
if ( url ) {
Turbolinks.visit(url);
}
}
});
| // Forest tables
$(document).on('mouseenter', '.forest-table tbody tr', function() {
var $row = $(this);
$row.addClass('active');
$(document).one('turbolinks:before-cache.forestTables', function() {
$row.removeClass('active');
});
});
$(document).on('mouseleave', '.forest-table tbody tr', function() {
var $row = $(this);
$row.removeClass('active');
});
$(document).on('click', '.forest-table tbody tr', function(e) {
var $row = $(this);
if ( !$(e.target).closest('a').length ) {
var $button = $row.find('a.forest-table__link:first');
if ( !$button.length ) {
$button = $row.find('a.btn-primary:first');
}
var url = $button.attr('href');
if ( url ) {
if ( e.metaKey || e.ctrlKey ) {
window.open( url, '_blank' );
} else if ( e.shiftKey ) {
window.open( url, '_blank' );
window.focus();
} else {
Turbolinks.visit(url);
}
}
}
});
| Allow modifier key press when opening table rows | Allow modifier key press when opening table rows
| JavaScript | mit | dylanfisher/forest,dylanfisher/forest,dylanfisher/forest | javascript | ## Code Before:
// Forest tables
$(document).on('mouseenter', '.forest-table tbody tr', function() {
var $row = $(this);
$row.addClass('active');
$(document).one('turbolinks:before-cache.forestTables', function() {
$row.removeClass('active');
});
});
$(document).on('mouseleave', '.forest-table tbody tr', function() {
var $row = $(this);
$row.removeClass('active');
});
$(document).on('click', '.forest-table tbody tr', function(e) {
var $row = $(this);
if ( !$(e.target).closest('a').length ) {
var $button = $row.find('a.forest-table__link:first');
if ( !$button.length ) {
$button = $row.find('a.btn-primary:first');
}
var url = $button.attr('href');
if ( url ) {
Turbolinks.visit(url);
}
}
});
## Instruction:
Allow modifier key press when opening table rows
## Code After:
// Forest tables
$(document).on('mouseenter', '.forest-table tbody tr', function() {
var $row = $(this);
$row.addClass('active');
$(document).one('turbolinks:before-cache.forestTables', function() {
$row.removeClass('active');
});
});
$(document).on('mouseleave', '.forest-table tbody tr', function() {
var $row = $(this);
$row.removeClass('active');
});
$(document).on('click', '.forest-table tbody tr', function(e) {
var $row = $(this);
if ( !$(e.target).closest('a').length ) {
var $button = $row.find('a.forest-table__link:first');
if ( !$button.length ) {
$button = $row.find('a.btn-primary:first');
}
var url = $button.attr('href');
if ( url ) {
if ( e.metaKey || e.ctrlKey ) {
window.open( url, '_blank' );
} else if ( e.shiftKey ) {
window.open( url, '_blank' );
window.focus();
} else {
Turbolinks.visit(url);
}
}
}
});
| // Forest tables
$(document).on('mouseenter', '.forest-table tbody tr', function() {
var $row = $(this);
$row.addClass('active');
$(document).one('turbolinks:before-cache.forestTables', function() {
$row.removeClass('active');
});
});
$(document).on('mouseleave', '.forest-table tbody tr', function() {
var $row = $(this);
$row.removeClass('active');
});
$(document).on('click', '.forest-table tbody tr', function(e) {
var $row = $(this);
if ( !$(e.target).closest('a').length ) {
var $button = $row.find('a.forest-table__link:first');
if ( !$button.length ) {
$button = $row.find('a.btn-primary:first');
}
var url = $button.attr('href');
if ( url ) {
+ if ( e.metaKey || e.ctrlKey ) {
+ window.open( url, '_blank' );
+ } else if ( e.shiftKey ) {
+ window.open( url, '_blank' );
+ window.focus();
+ } else {
- Turbolinks.visit(url);
+ Turbolinks.visit(url);
? ++
+ }
}
}
}); | 9 | 0.257143 | 8 | 1 |
cb0586390232ccc3c4ef1dd9aa6034d765fbac92 | newsletters.xml | newsletters.xml | ---
layout: null
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Browser Architecture</title>
<description>Browser Architecture Newsletters</description>
<link>{{ site.url }}</link>
{% for post in site.categories.newsletter %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.description }}</description>
<link>{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
<pubDate>{{ post.date }}</pubDate>
</item>
{% endfor %}
</channel>
</rss>
| ---
layout: null
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Mozilla Browser Architecture Newsletters</title>
<description>The published newsletters from the Mozilla Browser Architecture team.</description>
<link>{{ site.url }}</link>
{% for post in site.categories.newsletter %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.description }}</description>
<link>{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
<pubDate>{{ post.date }}</pubDate>
</item>
{% endfor %}
</channel>
</rss>
| Add a better title and description to the feed. | Add a better title and description to the feed.
| XML | mpl-2.0 | joewalker/firefox-browser-architecture,joewalker/firefox-browser-architecture,Mossop/firefox-browser-architecture,Mossop/firefox-browser-architecture | xml | ## Code Before:
---
layout: null
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Browser Architecture</title>
<description>Browser Architecture Newsletters</description>
<link>{{ site.url }}</link>
{% for post in site.categories.newsletter %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.description }}</description>
<link>{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
<pubDate>{{ post.date }}</pubDate>
</item>
{% endfor %}
</channel>
</rss>
## Instruction:
Add a better title and description to the feed.
## Code After:
---
layout: null
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Mozilla Browser Architecture Newsletters</title>
<description>The published newsletters from the Mozilla Browser Architecture team.</description>
<link>{{ site.url }}</link>
{% for post in site.categories.newsletter %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.description }}</description>
<link>{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
<pubDate>{{ post.date }}</pubDate>
</item>
{% endfor %}
</channel>
</rss>
| ---
layout: null
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
- <title>Browser Architecture</title>
+ <title>Mozilla Browser Architecture Newsletters</title>
? ++++++++ ++++++++++++
- <description>Browser Architecture Newsletters</description>
+ <description>The published newsletters from the Mozilla Browser Architecture team.</description>
<link>{{ site.url }}</link>
{% for post in site.categories.newsletter %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.description }}</description>
<link>{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
<pubDate>{{ post.date }}</pubDate>
</item>
{% endfor %}
</channel>
</rss> | 4 | 0.2 | 2 | 2 |
197147f23509e64be5c115e4319b93fbae9a3fa5 | src/App/Input/View.elm | src/App/Input/View.elm | module App.Input.View exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Utility.OnEnter exposing (onEnter)
import App.Types as App
import App.Input.Types as Input
import App.List.Types as List
view : Input.Model -> Html App.Msg
view model =
div []
[ input
[ type_ "text"
, placeholder "Type and enter stuff"
--, onInput App.MsgForInput <| UpdateInput model.text
, onEnter App.NoOp <| App.MsgForList <| List.AddEntry (List.Entry 0 "New Entry" False)
]
[]
] | module App.Input.View exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Utility.OnEnter exposing (onEnter)
import App.Types as App
import App.Input.Types as Input
import App.List.Types as List
view : Input.Model -> Html App.Msg
view model =
div []
[ input
[ type_ "text"
, placeholder "Type and enter stuff"
--, onInput App.MsgForInput <| UpdateInput model.text
, onEnter App.NoOp (createAddEntryMsg model)
]
[]
]
createAddEntryMsg : Input.Model -> App.Msg
createAddEntryMsg model =
List.Entry 0 model.text False
|> List.AddEntry
|> App.MsgForList | Refactor add new entries into createAddEntryMsg function | Refactor add new entries into createAddEntryMsg function
| Elm | mit | jackrzhang/lister-elm,jackrzhang/lister-elm | elm | ## Code Before:
module App.Input.View exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Utility.OnEnter exposing (onEnter)
import App.Types as App
import App.Input.Types as Input
import App.List.Types as List
view : Input.Model -> Html App.Msg
view model =
div []
[ input
[ type_ "text"
, placeholder "Type and enter stuff"
--, onInput App.MsgForInput <| UpdateInput model.text
, onEnter App.NoOp <| App.MsgForList <| List.AddEntry (List.Entry 0 "New Entry" False)
]
[]
]
## Instruction:
Refactor add new entries into createAddEntryMsg function
## Code After:
module App.Input.View exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Utility.OnEnter exposing (onEnter)
import App.Types as App
import App.Input.Types as Input
import App.List.Types as List
view : Input.Model -> Html App.Msg
view model =
div []
[ input
[ type_ "text"
, placeholder "Type and enter stuff"
--, onInput App.MsgForInput <| UpdateInput model.text
, onEnter App.NoOp (createAddEntryMsg model)
]
[]
]
createAddEntryMsg : Input.Model -> App.Msg
createAddEntryMsg model =
List.Entry 0 model.text False
|> List.AddEntry
|> App.MsgForList | module App.Input.View exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Utility.OnEnter exposing (onEnter)
import App.Types as App
import App.Input.Types as Input
import App.List.Types as List
view : Input.Model -> Html App.Msg
view model =
div []
[ input
[ type_ "text"
, placeholder "Type and enter stuff"
--, onInput App.MsgForInput <| UpdateInput model.text
- , onEnter App.NoOp <| App.MsgForList <| List.AddEntry (List.Entry 0 "New Entry" False)
+ , onEnter App.NoOp (createAddEntryMsg model)
]
[]
]
+
+
+ createAddEntryMsg : Input.Model -> App.Msg
+ createAddEntryMsg model =
+ List.Entry 0 model.text False
+ |> List.AddEntry
+ |> App.MsgForList | 9 | 0.391304 | 8 | 1 |
127c5c51158adce5883f10f5bf222de06eecc282 | css/style.css | css/style.css | @import url(https://fonts.googleapis.com/css?family=Open+Sans);
body{
background: #2ecc71;
padding: 36px;
font-family: 'Open Sans', sans-serif;
}
input[type="text"]:focus {
outline: none;
}
.statusInput input[type="text"] {
font-size: 36px;
background: transparent;
border: none !important;
width: 100%;
color: white;
box-shadow: none !important;
height: 4rem !important;
}
.statusInput input[type="text"]:focus,
.statusInput input[type="text"].focus {
border-bottom: solid 2px ##ecf0f1;
}
::-webkit-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
::-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-ms-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
.statusInput h2{
color: white;
} | @import url(https://fonts.googleapis.com/css?family=Open+Sans);
body{
background: #2ecc71;
padding: 36px;
font-family: 'Open Sans', sans-serif;
}
input[type="text"]:focus {
outline: none;
}
.statusInput input[type="text"] {
font-size: 36px;
background: transparent;
border: none !important;
width: 100%;
color: white;
box-shadow: none !important;
height: 4rem !important;
}
.statusInput input[type="text"]:focus,
.statusInput input[type="text"].focus {
border-bottom: solid 2px ##ecf0f1;
}
::-webkit-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
::-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-ms-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
.statusInput h2{
color: white;
}
.card-image{
height: 400px;
overflow: hidden !important;
} | Update css to make images uniform | Update css to make images uniform
| CSS | mit | yashshah/status-reporting-react,yashshah/status-reporting-react | css | ## Code Before:
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
body{
background: #2ecc71;
padding: 36px;
font-family: 'Open Sans', sans-serif;
}
input[type="text"]:focus {
outline: none;
}
.statusInput input[type="text"] {
font-size: 36px;
background: transparent;
border: none !important;
width: 100%;
color: white;
box-shadow: none !important;
height: 4rem !important;
}
.statusInput input[type="text"]:focus,
.statusInput input[type="text"].focus {
border-bottom: solid 2px ##ecf0f1;
}
::-webkit-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
::-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-ms-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
.statusInput h2{
color: white;
}
## Instruction:
Update css to make images uniform
## Code After:
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
body{
background: #2ecc71;
padding: 36px;
font-family: 'Open Sans', sans-serif;
}
input[type="text"]:focus {
outline: none;
}
.statusInput input[type="text"] {
font-size: 36px;
background: transparent;
border: none !important;
width: 100%;
color: white;
box-shadow: none !important;
height: 4rem !important;
}
.statusInput input[type="text"]:focus,
.statusInput input[type="text"].focus {
border-bottom: solid 2px ##ecf0f1;
}
::-webkit-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
::-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-ms-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
.statusInput h2{
color: white;
}
.card-image{
height: 400px;
overflow: hidden !important;
} | @import url(https://fonts.googleapis.com/css?family=Open+Sans);
body{
background: #2ecc71;
padding: 36px;
font-family: 'Open Sans', sans-serif;
}
input[type="text"]:focus {
outline: none;
}
.statusInput input[type="text"] {
font-size: 36px;
background: transparent;
border: none !important;
width: 100%;
color: white;
box-shadow: none !important;
height: 4rem !important;
}
.statusInput input[type="text"]:focus,
.statusInput input[type="text"].focus {
border-bottom: solid 2px ##ecf0f1;
}
::-webkit-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
::-moz-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
:-ms-input-placeholder {
color: #ecf0f1 ;
opacity: 0.6;
}
.statusInput h2{
color: white;
}
+ .card-image{
+ height: 400px;
+ overflow: hidden !important;
+ } | 4 | 0.090909 | 4 | 0 |
4dc03847abf8c1bad48d8d1ee5ab02043b8412b5 | LOCALHOSTR/index.php | LOCALHOSTR/index.php | <?php
function getLanIpAddr() {
$lanIpAddr = null;
exec("ifconfig en1 inet", $output);
foreach ($output as $value) {
if (strpos($value, 'inet') !== false) {
preg_match('/[(0-9.)]+/', $value, $matches);
$lanIpAddr = count($matches) ? $matches[0] : null;
}
}
return $lanIpAddr;
}
define('ROOT_DIR', __DIR__);
define('IP_ADDR', getLanIpAddr());
if (is_dir(ROOT_DIR . '/LOCALHOSTR')) {
define('APP_FOLDER', 'LOCALHOSTR');
} else {
define('APP_FOLDER', '.');
}
define('LOCALHOSTR', realpath(ROOT_DIR . '/' . APP_FOLDER));
require LOCALHOSTR . '/core/HostR.php';
require LOCALHOSTR . '/core/HostRAPI.php';
$hostR = new HostR(LOCALHOSTR . '/config.json');
if ($hostR->isService('phpinfos')) {
phpinfo();
} else if ($hostR->isService()) {
$hostRAPI = new HostRAPI($hostR);
return $hostRAPI->getResponse();
} else {
$hostR->render(LOCALHOSTR . '/templates/index.phtml');
}
exit;
| <?php
function getLanIpAddr() {
$lanIpAddr = null;
exec("arp -a", $output);
if (is_array($output)) {
preg_match('/\((.*)\)/', $output[0], $ipInfos);
$lanIpAddr = $ipInfos[1];
// var_dump($lanIpAddr);
// exit;
}
return $lanIpAddr;
}
define('ROOT_DIR', __DIR__);
define('IP_ADDR', getLanIpAddr());
if (is_dir(ROOT_DIR . '/LOCALHOSTR')) {
define('APP_FOLDER', 'LOCALHOSTR');
} else {
define('APP_FOLDER', '.');
}
define('LOCALHOSTR', realpath(ROOT_DIR . '/' . APP_FOLDER));
require LOCALHOSTR . '/core/HostR.php';
require LOCALHOSTR . '/core/HostRAPI.php';
$hostR = new HostR(LOCALHOSTR . '/config.json');
if ($hostR->isService('phpinfos')) {
phpinfo();
} else if ($hostR->isService()) {
$hostRAPI = new HostRAPI($hostR);
return $hostRAPI->getResponse();
} else {
$hostR->render(LOCALHOSTR . '/templates/index.phtml');
}
exit;
| Change mecanism to retrive LAN IP | Change mecanism to retrive LAN IP | PHP | mit | lycwed/localhostr,lycwed/localhostr,lycwed/localhostr | php | ## Code Before:
<?php
function getLanIpAddr() {
$lanIpAddr = null;
exec("ifconfig en1 inet", $output);
foreach ($output as $value) {
if (strpos($value, 'inet') !== false) {
preg_match('/[(0-9.)]+/', $value, $matches);
$lanIpAddr = count($matches) ? $matches[0] : null;
}
}
return $lanIpAddr;
}
define('ROOT_DIR', __DIR__);
define('IP_ADDR', getLanIpAddr());
if (is_dir(ROOT_DIR . '/LOCALHOSTR')) {
define('APP_FOLDER', 'LOCALHOSTR');
} else {
define('APP_FOLDER', '.');
}
define('LOCALHOSTR', realpath(ROOT_DIR . '/' . APP_FOLDER));
require LOCALHOSTR . '/core/HostR.php';
require LOCALHOSTR . '/core/HostRAPI.php';
$hostR = new HostR(LOCALHOSTR . '/config.json');
if ($hostR->isService('phpinfos')) {
phpinfo();
} else if ($hostR->isService()) {
$hostRAPI = new HostRAPI($hostR);
return $hostRAPI->getResponse();
} else {
$hostR->render(LOCALHOSTR . '/templates/index.phtml');
}
exit;
## Instruction:
Change mecanism to retrive LAN IP
## Code After:
<?php
function getLanIpAddr() {
$lanIpAddr = null;
exec("arp -a", $output);
if (is_array($output)) {
preg_match('/\((.*)\)/', $output[0], $ipInfos);
$lanIpAddr = $ipInfos[1];
// var_dump($lanIpAddr);
// exit;
}
return $lanIpAddr;
}
define('ROOT_DIR', __DIR__);
define('IP_ADDR', getLanIpAddr());
if (is_dir(ROOT_DIR . '/LOCALHOSTR')) {
define('APP_FOLDER', 'LOCALHOSTR');
} else {
define('APP_FOLDER', '.');
}
define('LOCALHOSTR', realpath(ROOT_DIR . '/' . APP_FOLDER));
require LOCALHOSTR . '/core/HostR.php';
require LOCALHOSTR . '/core/HostRAPI.php';
$hostR = new HostR(LOCALHOSTR . '/config.json');
if ($hostR->isService('phpinfos')) {
phpinfo();
} else if ($hostR->isService()) {
$hostRAPI = new HostRAPI($hostR);
return $hostRAPI->getResponse();
} else {
$hostR->render(LOCALHOSTR . '/templates/index.phtml');
}
exit;
| <?php
function getLanIpAddr() {
- $lanIpAddr = null;
+ $lanIpAddr = null;
? ++
- exec("ifconfig en1 inet", $output);
-
- foreach ($output as $value) {
- if (strpos($value, 'inet') !== false) {
- preg_match('/[(0-9.)]+/', $value, $matches);
- $lanIpAddr = count($matches) ? $matches[0] : null;
+ exec("arp -a", $output);
+ if (is_array($output)) {
+ preg_match('/\((.*)\)/', $output[0], $ipInfos);
+ $lanIpAddr = $ipInfos[1];
+ // var_dump($lanIpAddr);
+ // exit;
}
- }
- return $lanIpAddr;
+ return $lanIpAddr;
? ++
}
define('ROOT_DIR', __DIR__);
define('IP_ADDR', getLanIpAddr());
if (is_dir(ROOT_DIR . '/LOCALHOSTR')) {
define('APP_FOLDER', 'LOCALHOSTR');
} else {
define('APP_FOLDER', '.');
}
define('LOCALHOSTR', realpath(ROOT_DIR . '/' . APP_FOLDER));
require LOCALHOSTR . '/core/HostR.php';
require LOCALHOSTR . '/core/HostRAPI.php';
$hostR = new HostR(LOCALHOSTR . '/config.json');
if ($hostR->isService('phpinfos')) {
phpinfo();
} else if ($hostR->isService()) {
$hostRAPI = new HostRAPI($hostR);
return $hostRAPI->getResponse();
} else {
$hostR->render(LOCALHOSTR . '/templates/index.phtml');
}
exit; | 17 | 0.404762 | 8 | 9 |
c5d656cff3e7ac218cc41805dfb8c19f63cd4250 | run_server.py | run_server.py |
from shorter.web import app
if __name__ == "__main__":
app.run()
|
from shorter.database import (
User,
db_session,
)
from shorter.web import app
if __name__ == "__main__":
# makes testing easier
test_user_created = db_session.query(User).filter_by(
username='jimmy').one_or_none()
if not test_user_created:
db_session.add(
User(username='jimmy', password='secret'))
db_session.commit()
app.run()
| Create a testing user on starting the server | Create a testing user on starting the server
| Python | agpl-3.0 | mapleoin/shorter | python | ## Code Before:
from shorter.web import app
if __name__ == "__main__":
app.run()
## Instruction:
Create a testing user on starting the server
## Code After:
from shorter.database import (
User,
db_session,
)
from shorter.web import app
if __name__ == "__main__":
# makes testing easier
test_user_created = db_session.query(User).filter_by(
username='jimmy').one_or_none()
if not test_user_created:
db_session.add(
User(username='jimmy', password='secret'))
db_session.commit()
app.run()
|
+ from shorter.database import (
+ User,
+ db_session,
+ )
from shorter.web import app
if __name__ == "__main__":
+ # makes testing easier
+ test_user_created = db_session.query(User).filter_by(
+ username='jimmy').one_or_none()
+ if not test_user_created:
+ db_session.add(
+ User(username='jimmy', password='secret'))
+ db_session.commit()
+
app.run() | 12 | 2.4 | 12 | 0 |
b95cb383b1b22f2e7a619ffaa4f6bc620b096c8a | README.md | README.md | - nvm
- bower
- gulp (-g)
## rodando o projeto
1. npm install
2. bower install
3. gulp
4. start coding!
|
Clique em cada item para saber como instalar:
- [node](https://github.com/Webschool-io/be-mean-instagram/blob/master/Apostila/module-nodejs/pt-br/installation.md)
- [npm](https://docs.npmjs.com/getting-started/installing-node#updating-npm)
- [bower](https://github.com/bower/bower)
- [gulp (-g)](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md)
## Rodando o projeto
1. npm install
2. bower install
3. gulp
4. start coding!
| Add links to download project dependencies | Add links to download project dependencies | Markdown | cc0-1.0 | FatecSorocaba/semana-da-tecnologia,FatecSorocaba/semana-da-tecnologia | markdown | ## Code Before:
- nvm
- bower
- gulp (-g)
## rodando o projeto
1. npm install
2. bower install
3. gulp
4. start coding!
## Instruction:
Add links to download project dependencies
## Code After:
Clique em cada item para saber como instalar:
- [node](https://github.com/Webschool-io/be-mean-instagram/blob/master/Apostila/module-nodejs/pt-br/installation.md)
- [npm](https://docs.npmjs.com/getting-started/installing-node#updating-npm)
- [bower](https://github.com/bower/bower)
- [gulp (-g)](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md)
## Rodando o projeto
1. npm install
2. bower install
3. gulp
4. start coding!
| - - nvm
- - bower
- - gulp (-g)
+ Clique em cada item para saber como instalar:
+
+ - [node](https://github.com/Webschool-io/be-mean-instagram/blob/master/Apostila/module-nodejs/pt-br/installation.md)
+ - [npm](https://docs.npmjs.com/getting-started/installing-node#updating-npm)
+ - [bower](https://github.com/bower/bower)
+ - [gulp (-g)](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md)
+
- ## rodando o projeto
? ^
+ ## Rodando o projeto
? ^
- 1. npm install
? --
+ 1. npm install
- 2. bower install
? --
+ 2. bower install
- 3. gulp
? --
+ 3. gulp
- 4. start coding!
? --
+ 4. start coding! | 20 | 2.222222 | 12 | 8 |
2811f35744cd3f211324fd7513832d1879903808 | test/cleanup.php | test/cleanup.php | <?php namespace ProcessWire\GraphQL;
$baseDir = realpath(__DIR__ . "/../");
$pwDir = realpath($baseDir . "/vendor/processwire/processwire/");
require_once $baseDir . "/vendor/autoload.php";
use ProcessWire\ProcessWire;
$config = ProcessWire::buildConfig($pwDir, null, [
"siteDir" => "site-default"
]);
require_once realpath(__DIR__ . "/databaseReset.php"); | <?php namespace ProcessWire\GraphQL;
$baseDir = realpath(__DIR__ . "/../");
$pwDir = realpath($baseDir . "/vendor/processwire/processwire/");
require_once $baseDir . "/vendor/autoload.php";
use ProcessWire\ProcessWire;
$config = ProcessWire::buildConfig($pwDir, null, [
"siteDir" => "site-default"
]);
require_once realpath(__DIR__ . "/databaseReset.php");
// reset the test/files directory
$filesDirectory = realpath(__DIR__ . "/files/");
exec("git checkout $filesDirectory");
echo "Reset the 'test/files' directory.\n"; | Reset the test/files directory after tests. | Reset the test/files directory after tests.
| PHP | mit | dadish/ProcessGraphQL,dadish/ProcessGraphQL | php | ## Code Before:
<?php namespace ProcessWire\GraphQL;
$baseDir = realpath(__DIR__ . "/../");
$pwDir = realpath($baseDir . "/vendor/processwire/processwire/");
require_once $baseDir . "/vendor/autoload.php";
use ProcessWire\ProcessWire;
$config = ProcessWire::buildConfig($pwDir, null, [
"siteDir" => "site-default"
]);
require_once realpath(__DIR__ . "/databaseReset.php");
## Instruction:
Reset the test/files directory after tests.
## Code After:
<?php namespace ProcessWire\GraphQL;
$baseDir = realpath(__DIR__ . "/../");
$pwDir = realpath($baseDir . "/vendor/processwire/processwire/");
require_once $baseDir . "/vendor/autoload.php";
use ProcessWire\ProcessWire;
$config = ProcessWire::buildConfig($pwDir, null, [
"siteDir" => "site-default"
]);
require_once realpath(__DIR__ . "/databaseReset.php");
// reset the test/files directory
$filesDirectory = realpath(__DIR__ . "/files/");
exec("git checkout $filesDirectory");
echo "Reset the 'test/files' directory.\n"; | <?php namespace ProcessWire\GraphQL;
$baseDir = realpath(__DIR__ . "/../");
$pwDir = realpath($baseDir . "/vendor/processwire/processwire/");
require_once $baseDir . "/vendor/autoload.php";
use ProcessWire\ProcessWire;
$config = ProcessWire::buildConfig($pwDir, null, [
"siteDir" => "site-default"
]);
require_once realpath(__DIR__ . "/databaseReset.php");
+
+ // reset the test/files directory
+ $filesDirectory = realpath(__DIR__ . "/files/");
+ exec("git checkout $filesDirectory");
+ echo "Reset the 'test/files' directory.\n"; | 5 | 0.333333 | 5 | 0 |
32e492a065a57a14337f3043ab4509257e4755aa | src/app/PageActions.js | src/app/PageActions.js | var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
| var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
| Add messages link to the floating actions bubble | Add messages link to the floating actions bubble
| JavaScript | mit | Sekhmet/busy,busyorg/busy,Sekhmet/busy,busyorg/busy,ryanbaer/busy,ryanbaer/busy | javascript | ## Code Before:
var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
## Instruction:
Add messages link to the floating actions bubble
## Code After:
var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
| var React = require('react'),
- {Link} = require('react-router');
+ {Link} = require('react-router');
? ++
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
- {this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
? ^ ^^^^ ^^ ^ ^
+ {this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
? ^^^^ ^^ ^^^ ^^^^^^^^^^^^^ ^^^^
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
}); | 4 | 0.16 | 2 | 2 |
b9700f0aab23e4c8a7c334151233ac0128a7fb37 | security/irc.md | security/irc.md | [TOC]
# Overview
- [Wikipedia](https://en.wikipedia.org/wiki/Internet_Relay_Chat)
| [TOC]
# Overview
- [Wikipedia](https://en.wikipedia.org/wiki/Internet_Relay_Chat)
- [Demo IRC network](http://pdgn.co/)
- [cjdns](https://github.com/cjdelisle/cjdns)
| Add small IRC network and new encrypted IPv6 network | Add small IRC network and new encrypted IPv6 network
| Markdown | mit | samtron1412/docs | markdown | ## Code Before:
[TOC]
# Overview
- [Wikipedia](https://en.wikipedia.org/wiki/Internet_Relay_Chat)
## Instruction:
Add small IRC network and new encrypted IPv6 network
## Code After:
[TOC]
# Overview
- [Wikipedia](https://en.wikipedia.org/wiki/Internet_Relay_Chat)
- [Demo IRC network](http://pdgn.co/)
- [cjdns](https://github.com/cjdelisle/cjdns)
| [TOC]
# Overview
- [Wikipedia](https://en.wikipedia.org/wiki/Internet_Relay_Chat)
+ - [Demo IRC network](http://pdgn.co/)
+ - [cjdns](https://github.com/cjdelisle/cjdns) | 2 | 0.5 | 2 | 0 |
a43812256ecb3cb7ec3883f3a0e8c34b6bba16d8 | gruntfile.js | gruntfile.js | module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
simplemocha: {
options: {
ui: 'bdd',
reporter: 'dot'
},
unit: {
src: [
'test/mocha-globals.coffee',
'test/*.spec.coffee'
]
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
bump: {
options: {
commitMessage: 'chore: release v%VERSION%',
pushTo: 'upstream'
}
},
eslint: {
target: [
'lib/*.js',
'gruntfile.js',
'karma.conf.js'
]
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('test', ['simplemocha'])
grunt.registerTask('default', ['eslint', 'test'])
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump-only:' + (type || 'patch'),
'changelog',
'bump-commit',
'npm-publish'
])
})
}
| module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
simplemocha: {
options: {
ui: 'bdd',
reporter: 'dot'
},
unit: {
src: [
'test/mocha-globals.coffee',
'test/*.spec.coffee'
]
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
bump: {
options: {
commitMessage: 'chore: release v%VERSION%',
pushTo: 'upstream',
commitFiles: [
'package.json',
'CHANGELOG.md'
]
}
},
eslint: {
target: [
'lib/*.js',
'gruntfile.js',
'karma.conf.js'
]
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('test', ['simplemocha'])
grunt.registerTask('default', ['eslint', 'test'])
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump-only:' + (type || 'patch'),
'changelog',
'bump-commit',
'npm-publish'
])
})
}
| Fix grunt-bump config to include the changelog. | chore: Fix grunt-bump config to include the changelog.
| JavaScript | mit | tswaters/karma-coverage,whitneyit/karma-coverage,karma-runner/karma-coverage,nmalaguti/karma-coverage,yourowndisaster09/karma-coverage,jamestalmage/karma-coverage,Dignifiedquire/karma-coverage | javascript | ## Code Before:
module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
simplemocha: {
options: {
ui: 'bdd',
reporter: 'dot'
},
unit: {
src: [
'test/mocha-globals.coffee',
'test/*.spec.coffee'
]
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
bump: {
options: {
commitMessage: 'chore: release v%VERSION%',
pushTo: 'upstream'
}
},
eslint: {
target: [
'lib/*.js',
'gruntfile.js',
'karma.conf.js'
]
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('test', ['simplemocha'])
grunt.registerTask('default', ['eslint', 'test'])
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump-only:' + (type || 'patch'),
'changelog',
'bump-commit',
'npm-publish'
])
})
}
## Instruction:
chore: Fix grunt-bump config to include the changelog.
## Code After:
module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
simplemocha: {
options: {
ui: 'bdd',
reporter: 'dot'
},
unit: {
src: [
'test/mocha-globals.coffee',
'test/*.spec.coffee'
]
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
bump: {
options: {
commitMessage: 'chore: release v%VERSION%',
pushTo: 'upstream',
commitFiles: [
'package.json',
'CHANGELOG.md'
]
}
},
eslint: {
target: [
'lib/*.js',
'gruntfile.js',
'karma.conf.js'
]
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('test', ['simplemocha'])
grunt.registerTask('default', ['eslint', 'test'])
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump-only:' + (type || 'patch'),
'changelog',
'bump-commit',
'npm-publish'
])
})
}
| module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
simplemocha: {
options: {
ui: 'bdd',
reporter: 'dot'
},
unit: {
src: [
'test/mocha-globals.coffee',
'test/*.spec.coffee'
]
}
},
'npm-contributors': {
options: {
commitMessage: 'chore: update contributors'
}
},
bump: {
options: {
commitMessage: 'chore: release v%VERSION%',
- pushTo: 'upstream'
+ pushTo: 'upstream',
? +
+ commitFiles: [
+ 'package.json',
+ 'CHANGELOG.md'
+ ]
}
},
eslint: {
target: [
'lib/*.js',
'gruntfile.js',
'karma.conf.js'
]
}
})
require('load-grunt-tasks')(grunt)
grunt.registerTask('test', ['simplemocha'])
grunt.registerTask('default', ['eslint', 'test'])
grunt.registerTask('release', 'Bump the version and publish to NPM.', function (type) {
grunt.task.run([
'npm-contributors',
'bump-only:' + (type || 'patch'),
'changelog',
'bump-commit',
'npm-publish'
])
})
} | 6 | 0.12 | 5 | 1 |
da33e9cad605525130ff6886dbd38d3bab91705a | .travis.yml | .travis.yml | before_install: gem install bundler --pre
notifications:
email:
- parndt@gmail.com
env:
- DB=sqlite3
- DB=sqlite3mem
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- jruby
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
- gemfiles/Gemfile.rails-3.1.rb
- gemfiles/Gemfile.rails-3.2.rb | notifications:
email:
- parndt@gmail.com
env:
- DB=sqlite3
- DB=sqlite3mem
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- jruby
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
- gemfiles/Gemfile.rails-3.1.rb
- gemfiles/Gemfile.rails-3.2.rb
| Stop using prerelease bundler on Travis builds. | Stop using prerelease bundler on Travis builds.
| YAML | mit | collectiveidea/awesome_nested_set,manastech/awesome_nested_set,sximba/rational_nested_set,markmercedes/awesome_nested_set,sximba/rational_nested_set,experteer/awesome_nested_set,rbo7nik/awesome_nested_set,petergoldstein/awesome_nested_set,tcjuan/awesome_nested_set,marutosi/awesome_nested_set,oesgalha/awesome_nested_set | yaml | ## Code Before:
before_install: gem install bundler --pre
notifications:
email:
- parndt@gmail.com
env:
- DB=sqlite3
- DB=sqlite3mem
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- jruby
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
- gemfiles/Gemfile.rails-3.1.rb
- gemfiles/Gemfile.rails-3.2.rb
## Instruction:
Stop using prerelease bundler on Travis builds.
## Code After:
notifications:
email:
- parndt@gmail.com
env:
- DB=sqlite3
- DB=sqlite3mem
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- jruby
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
- gemfiles/Gemfile.rails-3.1.rb
- gemfiles/Gemfile.rails-3.2.rb
| - before_install: gem install bundler --pre
notifications:
email:
- parndt@gmail.com
env:
- DB=sqlite3
- DB=sqlite3mem
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- jruby
gemfile:
- gemfiles/Gemfile.rails-3.0.rb
- gemfiles/Gemfile.rails-3.1.rb
- gemfiles/Gemfile.rails-3.2.rb | 1 | 0.058824 | 0 | 1 |
65e410752105b2d7478255ea7d83b907f23ec872 | peerinst/templates/admin/peerinst/question_preview.html | peerinst/templates/admin/peerinst/question_preview.html | {% extends 'peerinst/question_start.html' %}
{% load i18n %}
{% block pretext %}
<p><small>
{% blocktrans %}
This is a preview of how the question looks in the student interface. You can add example
rationales here that will be shown as choices to students. You should at least provide a few
example rationales for the correct choices. It's best if you provide a few rationales for each
choice, even the incorrect ones.
{% endblocktrans %}
</small></p>
<hr>
{% endblock %}
| {% extends 'peerinst/question_start.html' %}
{% load i18n %}
{% block pretext %}
<p><small>
{% blocktrans %}
This is a preview of how the question looks in the student interface. You can add example
rationales here that will be shown as choices to students. You should at least provide a few
example rationales for the correct choices. It's best if you provide a few rationales for each
choice, even the incorrect ones.
{% endblocktrans %}
</small></p>
<hr>
{% endblock %}
{% block submit_button %}{% trans 'Submit example answer' %}{% endblock %}
| Improve submit button label in preview interface. | Improve submit button label in preview interface.
| HTML | agpl-3.0 | open-craft/dalite-ng,open-craft/dalite-ng,open-craft/dalite-ng | html | ## Code Before:
{% extends 'peerinst/question_start.html' %}
{% load i18n %}
{% block pretext %}
<p><small>
{% blocktrans %}
This is a preview of how the question looks in the student interface. You can add example
rationales here that will be shown as choices to students. You should at least provide a few
example rationales for the correct choices. It's best if you provide a few rationales for each
choice, even the incorrect ones.
{% endblocktrans %}
</small></p>
<hr>
{% endblock %}
## Instruction:
Improve submit button label in preview interface.
## Code After:
{% extends 'peerinst/question_start.html' %}
{% load i18n %}
{% block pretext %}
<p><small>
{% blocktrans %}
This is a preview of how the question looks in the student interface. You can add example
rationales here that will be shown as choices to students. You should at least provide a few
example rationales for the correct choices. It's best if you provide a few rationales for each
choice, even the incorrect ones.
{% endblocktrans %}
</small></p>
<hr>
{% endblock %}
{% block submit_button %}{% trans 'Submit example answer' %}{% endblock %}
| {% extends 'peerinst/question_start.html' %}
{% load i18n %}
{% block pretext %}
<p><small>
{% blocktrans %}
This is a preview of how the question looks in the student interface. You can add example
rationales here that will be shown as choices to students. You should at least provide a few
example rationales for the correct choices. It's best if you provide a few rationales for each
choice, even the incorrect ones.
{% endblocktrans %}
</small></p>
<hr>
{% endblock %}
+ {% block submit_button %}{% trans 'Submit example answer' %}{% endblock %} | 1 | 0.071429 | 1 | 0 |
ae424937a7d9341862329cf7f04bd91ccdf345cd | converter.py | converter.py | import json
import csv
def json_to_csv(json_file):
with open(json_file, 'r') as jsonfile, open('output.csv', 'w', newline='') as csvfile:
jsn = json.load(jsonfile)
fieldnames = []
for name in jsn[0]:
fieldnames += [name]
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for elem in jsn:
writer.writerow(elem)
def csv_to_json(csv_file):
with open(csv_file, 'r') as csvfile, open('output.json', 'w') as jsonfile:
reader = csv.DictReader(csvfile)
jsn = []
for row in reader:
jsn += [row]
json.dump(jsn, jsonfile)
filename = input('Enter filename of CSV file: ')
csv_to_json(filename) | import json
import csv
import argparse
def json_to_csv(json_file):
with open(json_file, 'r') as jsonfile, open('output.csv', 'w', newline='') as csvfile:
jsn = json.load(jsonfile)
fieldnames = []
for name in jsn[0]:
fieldnames += [name]
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for elem in jsn:
writer.writerow(elem)
def csv_to_json(csv_file):
with open(csv_file, 'r') as csvfile, open('output.json', 'w') as jsonfile:
reader = csv.DictReader(csvfile)
jsn = []
for row in reader:
jsn += [row]
json.dump(jsn, jsonfile)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('inputtype', help='The type of input', type=str, choices=['csv', 'json'])
parser.add_argument('filename', help='Name of the input file', type=str)
args = parser.parse_args()
if (args.inputtype=='csv'):
csv_to_json(args.filename)
outputtype = 'json'
elif (args.inputtype=='json'):
json_to_csv(args.filename)
outputtype = 'csv'
print('[*] Output saved as output.{}'.format(outputtype))
if __name__=='__main__':
main() | Add command-line arguments and main function | Add command-line arguments and main function
| Python | mit | SkullTech/json-csv-converter | python | ## Code Before:
import json
import csv
def json_to_csv(json_file):
with open(json_file, 'r') as jsonfile, open('output.csv', 'w', newline='') as csvfile:
jsn = json.load(jsonfile)
fieldnames = []
for name in jsn[0]:
fieldnames += [name]
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for elem in jsn:
writer.writerow(elem)
def csv_to_json(csv_file):
with open(csv_file, 'r') as csvfile, open('output.json', 'w') as jsonfile:
reader = csv.DictReader(csvfile)
jsn = []
for row in reader:
jsn += [row]
json.dump(jsn, jsonfile)
filename = input('Enter filename of CSV file: ')
csv_to_json(filename)
## Instruction:
Add command-line arguments and main function
## Code After:
import json
import csv
import argparse
def json_to_csv(json_file):
with open(json_file, 'r') as jsonfile, open('output.csv', 'w', newline='') as csvfile:
jsn = json.load(jsonfile)
fieldnames = []
for name in jsn[0]:
fieldnames += [name]
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for elem in jsn:
writer.writerow(elem)
def csv_to_json(csv_file):
with open(csv_file, 'r') as csvfile, open('output.json', 'w') as jsonfile:
reader = csv.DictReader(csvfile)
jsn = []
for row in reader:
jsn += [row]
json.dump(jsn, jsonfile)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('inputtype', help='The type of input', type=str, choices=['csv', 'json'])
parser.add_argument('filename', help='Name of the input file', type=str)
args = parser.parse_args()
if (args.inputtype=='csv'):
csv_to_json(args.filename)
outputtype = 'json'
elif (args.inputtype=='json'):
json_to_csv(args.filename)
outputtype = 'csv'
print('[*] Output saved as output.{}'.format(outputtype))
if __name__=='__main__':
main() | import json
import csv
+ import argparse
def json_to_csv(json_file):
with open(json_file, 'r') as jsonfile, open('output.csv', 'w', newline='') as csvfile:
jsn = json.load(jsonfile)
fieldnames = []
for name in jsn[0]:
fieldnames += [name]
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for elem in jsn:
writer.writerow(elem)
def csv_to_json(csv_file):
with open(csv_file, 'r') as csvfile, open('output.json', 'w') as jsonfile:
reader = csv.DictReader(csvfile)
jsn = []
for row in reader:
jsn += [row]
json.dump(jsn, jsonfile)
-
- filename = input('Enter filename of CSV file: ')
+
+ def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('inputtype', help='The type of input', type=str, choices=['csv', 'json'])
+ parser.add_argument('filename', help='Name of the input file', type=str)
+ args = parser.parse_args()
+
+ if (args.inputtype=='csv'):
- csv_to_json(filename)
+ csv_to_json(args.filename)
? ++ +++++
+ outputtype = 'json'
+ elif (args.inputtype=='json'):
+ json_to_csv(args.filename)
+ outputtype = 'csv'
+
+ print('[*] Output saved as output.{}'.format(outputtype))
+
+
+ if __name__=='__main__':
+ main() | 23 | 0.884615 | 20 | 3 |
5ac675b36c7c7ba9110b6b16e11a56f554ff8c8e | signbank/video/urls.py | signbank/video/urls.py | from django.conf.urls import *
urlpatterns = patterns('',
(r'^video/(?P<videoid>.*)$', 'signbank.video.views.video'),
(r'^upload/', 'signbank.video.views.addvideo'),
(r'^delete/(?P<videoid>.*)$', 'signbank.video.views.deletevideo'),
(r'^poster/(?P<videoid>.*)$', 'signbank.video.views.poster'),
(r'^iframe/(?P<videoid>.*)$', 'signbank.video.views.iframe'),
)
| from django.conf.urls import *
urlpatterns = patterns('',
(r'^video/(?P<videoid>\d+)$', 'signbank.video.views.video'),
(r'^upload/', 'signbank.video.views.addvideo'),
(r'^delete/(?P<videoid>\d+)$', 'signbank.video.views.deletevideo'),
(r'^poster/(?P<videoid>\d+)$', 'signbank.video.views.poster'),
(r'^iframe/(?P<videoid>\d+)$', 'signbank.video.views.iframe'),
)
| Use more explicit pattern for video id in URL to prevent matching trailing slash. | Use more explicit pattern for video id in URL to prevent matching trailing slash.
| Python | bsd-3-clause | Signbank/Auslan-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank | python | ## Code Before:
from django.conf.urls import *
urlpatterns = patterns('',
(r'^video/(?P<videoid>.*)$', 'signbank.video.views.video'),
(r'^upload/', 'signbank.video.views.addvideo'),
(r'^delete/(?P<videoid>.*)$', 'signbank.video.views.deletevideo'),
(r'^poster/(?P<videoid>.*)$', 'signbank.video.views.poster'),
(r'^iframe/(?P<videoid>.*)$', 'signbank.video.views.iframe'),
)
## Instruction:
Use more explicit pattern for video id in URL to prevent matching trailing slash.
## Code After:
from django.conf.urls import *
urlpatterns = patterns('',
(r'^video/(?P<videoid>\d+)$', 'signbank.video.views.video'),
(r'^upload/', 'signbank.video.views.addvideo'),
(r'^delete/(?P<videoid>\d+)$', 'signbank.video.views.deletevideo'),
(r'^poster/(?P<videoid>\d+)$', 'signbank.video.views.poster'),
(r'^iframe/(?P<videoid>\d+)$', 'signbank.video.views.iframe'),
)
| from django.conf.urls import *
urlpatterns = patterns('',
- (r'^video/(?P<videoid>.*)$', 'signbank.video.views.video'),
? ^^
+ (r'^video/(?P<videoid>\d+)$', 'signbank.video.views.video'),
? ^^^
(r'^upload/', 'signbank.video.views.addvideo'),
- (r'^delete/(?P<videoid>.*)$', 'signbank.video.views.deletevideo'),
? ^^
+ (r'^delete/(?P<videoid>\d+)$', 'signbank.video.views.deletevideo'),
? ^^^
- (r'^poster/(?P<videoid>.*)$', 'signbank.video.views.poster'),
? ^^
+ (r'^poster/(?P<videoid>\d+)$', 'signbank.video.views.poster'),
? ^^^
- (r'^iframe/(?P<videoid>.*)$', 'signbank.video.views.iframe'),
? ^^
+ (r'^iframe/(?P<videoid>\d+)$', 'signbank.video.views.iframe'),
? ^^^
)
| 8 | 0.666667 | 4 | 4 |
8c34050d895b8139c6b0bfe9b9f79d61b0056225 | .scrutinizer.yml | .scrutinizer.yml | inherit: true
tools:
external_code_coverage: false
checks:
php:
code_rating: true
duplication: true
filter:
paths: [code/*, tests/*]
| inherit: true
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]
checks:
php:
code_rating: true
duplication: true
filter:
paths: [src/*, tests/*]
| Update Scrutinizer configuration to use new build engine | Update Scrutinizer configuration to use new build engine
| YAML | bsd-3-clause | open-sausages/silverstripe-asset-admin,open-sausages/silverstripe-asset-admin,open-sausages/silverstripe-assets-gallery,open-sausages/silverstripe-assets-gallery | yaml | ## Code Before:
inherit: true
tools:
external_code_coverage: false
checks:
php:
code_rating: true
duplication: true
filter:
paths: [code/*, tests/*]
## Instruction:
Update Scrutinizer configuration to use new build engine
## Code After:
inherit: true
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]
checks:
php:
code_rating: true
duplication: true
filter:
paths: [src/*, tests/*]
| inherit: true
- tools:
- external_code_coverage: false
+ build:
+ nodes:
+ analysis:
+ tests:
+ override: [php-scrutinizer-run]
checks:
- php:
? --
+ php:
- code_rating: true
? ----
+ code_rating: true
- duplication: true
? ----
+ duplication: true
filter:
- paths: [code/*, tests/*]
? -- ---
+ paths: [src/*, tests/*]
? ++
| 15 | 1.25 | 9 | 6 |
7e3dc48c60674b6256ed2f264150f82cf90fb902 | app/views/layouts/setup.html.haml | app/views/layouts/setup.html.haml | !!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%title
Form a new Organisation - One Click Orgs
%link{:href=>"/favicon.ico", :rel=>"shortcut icon"}
= stylesheet_link_tag "application"
= stylesheet_link_tag "themes/#{Setting[:theme] ? Setting[:theme] : 'one_click_orgs'}"
/[if lt IE 9]
= stylesheet_link_tag 'ie'
= javascript_include_tag :defaults
= javascript_tag '$.fx.off = true;' if Rails.env.test?
= yield(:head)
= csrf_meta_tag
= google_analytics_code
%body.setup
%div#container
%div#doc
%div#hd
%h1.header
= image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
One Click Orgs
- if flash[:notice]
%div#notice
= flash[:notice]
- if flash[:error]
%div#error
= simple_format(flash[:error])
%div#bd
= yield
#lightbox_screen{:style => 'display: none;'}
#lightbox{:style => 'display: none;'}
= yield(:lightbox)
%div.footer
= render(:partial => 'shared/footer')
= get_satisfaction_widget
| !!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%title
Form a new Organisation - One Click Orgs
%link{:href=>"/favicon.ico", :rel=>"shortcut icon"}
= stylesheet_link_tag "application"
= stylesheet_link_tag "themes/#{Setting[:theme] ? Setting[:theme] : 'one_click_orgs'}"
/[if lt IE 9]
= stylesheet_link_tag 'ie'
= javascript_include_tag :defaults
= javascript_tag '$.fx.off = true;' if Rails.env.test?
= yield(:head)
= csrf_meta_tag
= google_analytics_code
%body.setup
%div#container
%div#doc
%div#hd
%h1.header
- if Setting[:theme] == 'cooperatives_uk'
Digital IPS
- else
= image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
One Click Orgs
- if flash[:notice]
%div#notice
= flash[:notice]
- if flash[:error]
%div#error
= simple_format(flash[:error])
%div#bd
= yield
#lightbox_screen{:style => 'display: none;'}
#lightbox{:style => 'display: none;'}
= yield(:lightbox)
%div.footer
= render(:partial => 'shared/footer')
= get_satisfaction_widget
| Remove large OCO header from setup template for cooperatives_uk theme. | Remove large OCO header from setup template for cooperatives_uk theme.
| Haml | agpl-3.0 | oneclickorgs/one-click-orgs,oneclickorgs/one-click-orgs,oneclickorgs/one-click-orgs,oneclickorgs/one-click-orgs | haml | ## Code Before:
!!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%title
Form a new Organisation - One Click Orgs
%link{:href=>"/favicon.ico", :rel=>"shortcut icon"}
= stylesheet_link_tag "application"
= stylesheet_link_tag "themes/#{Setting[:theme] ? Setting[:theme] : 'one_click_orgs'}"
/[if lt IE 9]
= stylesheet_link_tag 'ie'
= javascript_include_tag :defaults
= javascript_tag '$.fx.off = true;' if Rails.env.test?
= yield(:head)
= csrf_meta_tag
= google_analytics_code
%body.setup
%div#container
%div#doc
%div#hd
%h1.header
= image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
One Click Orgs
- if flash[:notice]
%div#notice
= flash[:notice]
- if flash[:error]
%div#error
= simple_format(flash[:error])
%div#bd
= yield
#lightbox_screen{:style => 'display: none;'}
#lightbox{:style => 'display: none;'}
= yield(:lightbox)
%div.footer
= render(:partial => 'shared/footer')
= get_satisfaction_widget
## Instruction:
Remove large OCO header from setup template for cooperatives_uk theme.
## Code After:
!!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%title
Form a new Organisation - One Click Orgs
%link{:href=>"/favicon.ico", :rel=>"shortcut icon"}
= stylesheet_link_tag "application"
= stylesheet_link_tag "themes/#{Setting[:theme] ? Setting[:theme] : 'one_click_orgs'}"
/[if lt IE 9]
= stylesheet_link_tag 'ie'
= javascript_include_tag :defaults
= javascript_tag '$.fx.off = true;' if Rails.env.test?
= yield(:head)
= csrf_meta_tag
= google_analytics_code
%body.setup
%div#container
%div#doc
%div#hd
%h1.header
- if Setting[:theme] == 'cooperatives_uk'
Digital IPS
- else
= image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
One Click Orgs
- if flash[:notice]
%div#notice
= flash[:notice]
- if flash[:error]
%div#error
= simple_format(flash[:error])
%div#bd
= yield
#lightbox_screen{:style => 'display: none;'}
#lightbox{:style => 'display: none;'}
= yield(:lightbox)
%div.footer
= render(:partial => 'shared/footer')
= get_satisfaction_widget
| !!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%title
Form a new Organisation - One Click Orgs
%link{:href=>"/favicon.ico", :rel=>"shortcut icon"}
= stylesheet_link_tag "application"
= stylesheet_link_tag "themes/#{Setting[:theme] ? Setting[:theme] : 'one_click_orgs'}"
/[if lt IE 9]
= stylesheet_link_tag 'ie'
= javascript_include_tag :defaults
= javascript_tag '$.fx.off = true;' if Rails.env.test?
= yield(:head)
= csrf_meta_tag
= google_analytics_code
%body.setup
%div#container
%div#doc
%div#hd
%h1.header
+ - if Setting[:theme] == 'cooperatives_uk'
+ Digital IPS
+ - else
- = image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
+ = image_tag('oco-logo-48.png', :height => '48', :width => '48', :alt => 'One Click Orgs logo')
? ++
- One Click Orgs
+ One Click Orgs
? ++
- if flash[:notice]
%div#notice
= flash[:notice]
- if flash[:error]
%div#error
= simple_format(flash[:error])
%div#bd
= yield
#lightbox_screen{:style => 'display: none;'}
#lightbox{:style => 'display: none;'}
= yield(:lightbox)
%div.footer
= render(:partial => 'shared/footer')
= get_satisfaction_widget | 7 | 0.179487 | 5 | 2 |
e9b3c1768c3644e1dc64151f180330e26f2c4686 | .travis.yml | .travis.yml | language: python
python:
- "3.4"
- "3.7"
# command to install dependencies for test purposes.
# Pytest is only needed for development so install seperately
# from the requirements.
install:
- "pip3 install nose"
- "pip3 install -r requirements.txt"
script: "nosetests go_test.py"
| language: python
python:
- "3.6"
# command to install dependencies for test purposes.
# Pytest is only needed for development so install seperately
# from the requirements.
install:
- "pip3 install nose"
- "pip3 install -r requirements.txt"
script: "nosetests go_test.py"
| Support latest Python version for CherryPy | Support latest Python version for CherryPy
| YAML | mit | F5Networks/f5go,F5Networks/f5go,F5Networks/f5go | yaml | ## Code Before:
language: python
python:
- "3.4"
- "3.7"
# command to install dependencies for test purposes.
# Pytest is only needed for development so install seperately
# from the requirements.
install:
- "pip3 install nose"
- "pip3 install -r requirements.txt"
script: "nosetests go_test.py"
## Instruction:
Support latest Python version for CherryPy
## Code After:
language: python
python:
- "3.6"
# command to install dependencies for test purposes.
# Pytest is only needed for development so install seperately
# from the requirements.
install:
- "pip3 install nose"
- "pip3 install -r requirements.txt"
script: "nosetests go_test.py"
| language: python
python:
- - "3.4"
? ^
+ - "3.6"
? ^
- - "3.7"
# command to install dependencies for test purposes.
# Pytest is only needed for development so install seperately
# from the requirements.
install:
- "pip3 install nose"
- "pip3 install -r requirements.txt"
script: "nosetests go_test.py" | 3 | 0.272727 | 1 | 2 |
958955a98def5290810b2f2a304f4bf68009bb43 | solace/templates/badges/show_badge.html | solace/templates/badges/show_badge.html | {% extends 'layout.html' %}
{% from '_helpers.html' import render_badge %}
{% from '_helpers.html' import render_user %}
{% set page_navigation_item = 'badges.show_list' %}
{% set page_title = _('%s-Badge') % badge.name %}
{% block body %}
<h1>{{ page_title }}</h1>
<div class="badgedisplay">
<div class="badge">{{ render_badge(badge) }}</div>
<div class="explanation">
{{ badge.description|e }}
{% if not badge.single_awarded %}
<small class="multibadge">{{
_('This badge can be earned multiple times.') }}</small>
{% endif %}
</div>
</div>
{% if user_badges %}
<p>{{ _('This badge was recently awarded to:') }}
<ul class="userlist">
{%- for user_badge in user_badges %}
<li>{{ render_user(user_badge.user, avatar_size=26) }}
<span class="awarded">{{ _('awarded %s') %
user_badge.awarded|datetimeformat }}</span>
{%- endfor %}
</ul>
{% else %}
<p>{{ _('This badge was not yet awarded. Be the first') }}
{% endif %}
{% endblock %}
| {% extends 'layout.html' %}
{% from '_helpers.html' import render_badge %}
{% from '_helpers.html' import render_user %}
{% set page_navigation_item = 'badges.show_list' %}
{% set page_title = _('%s-Badge') % badge.name %}
{% block body %}
<h1>{{ page_title }}</h1>
<div class="badgedisplay">
<div class="badge">{{ render_badge(badge) }}</div>
<div class="explanation">
{{ badge.description|e }}
{% if not badge.single_awarded %}
<small class="multibadge">{{
_('This badge can be earned multiple times.') }}</small>
{% endif %}
</div>
</div>
{% if user_badges %}
<p>{{ _('This badge was recently awarded to:') }}
<ul class="userlist">
{%- for user_badge in user_badges %}
<li>{{ render_user(user_badge.user, avatar_size=26) }}
{% autoescape false %}<span class="awarded">{{ _('awarded %s') %
user_badge.awarded|datetimeformat }}</span>{% endautoescape %}
{%- endfor %}
</ul>
{% else %}
<p>{{ _('This badge was not yet awarded. Be the first') }}
{% endif %}
{% endblock %}
| Fix escaping of 'awarded on...' on the show badge page | Fix escaping of 'awarded on...' on the show badge page
| HTML | bsd-3-clause | mitsuhiko/solace,mitsuhiko/solace | html | ## Code Before:
{% extends 'layout.html' %}
{% from '_helpers.html' import render_badge %}
{% from '_helpers.html' import render_user %}
{% set page_navigation_item = 'badges.show_list' %}
{% set page_title = _('%s-Badge') % badge.name %}
{% block body %}
<h1>{{ page_title }}</h1>
<div class="badgedisplay">
<div class="badge">{{ render_badge(badge) }}</div>
<div class="explanation">
{{ badge.description|e }}
{% if not badge.single_awarded %}
<small class="multibadge">{{
_('This badge can be earned multiple times.') }}</small>
{% endif %}
</div>
</div>
{% if user_badges %}
<p>{{ _('This badge was recently awarded to:') }}
<ul class="userlist">
{%- for user_badge in user_badges %}
<li>{{ render_user(user_badge.user, avatar_size=26) }}
<span class="awarded">{{ _('awarded %s') %
user_badge.awarded|datetimeformat }}</span>
{%- endfor %}
</ul>
{% else %}
<p>{{ _('This badge was not yet awarded. Be the first') }}
{% endif %}
{% endblock %}
## Instruction:
Fix escaping of 'awarded on...' on the show badge page
## Code After:
{% extends 'layout.html' %}
{% from '_helpers.html' import render_badge %}
{% from '_helpers.html' import render_user %}
{% set page_navigation_item = 'badges.show_list' %}
{% set page_title = _('%s-Badge') % badge.name %}
{% block body %}
<h1>{{ page_title }}</h1>
<div class="badgedisplay">
<div class="badge">{{ render_badge(badge) }}</div>
<div class="explanation">
{{ badge.description|e }}
{% if not badge.single_awarded %}
<small class="multibadge">{{
_('This badge can be earned multiple times.') }}</small>
{% endif %}
</div>
</div>
{% if user_badges %}
<p>{{ _('This badge was recently awarded to:') }}
<ul class="userlist">
{%- for user_badge in user_badges %}
<li>{{ render_user(user_badge.user, avatar_size=26) }}
{% autoescape false %}<span class="awarded">{{ _('awarded %s') %
user_badge.awarded|datetimeformat }}</span>{% endautoescape %}
{%- endfor %}
</ul>
{% else %}
<p>{{ _('This badge was not yet awarded. Be the first') }}
{% endif %}
{% endblock %}
| {% extends 'layout.html' %}
{% from '_helpers.html' import render_badge %}
{% from '_helpers.html' import render_user %}
{% set page_navigation_item = 'badges.show_list' %}
{% set page_title = _('%s-Badge') % badge.name %}
{% block body %}
<h1>{{ page_title }}</h1>
<div class="badgedisplay">
<div class="badge">{{ render_badge(badge) }}</div>
<div class="explanation">
{{ badge.description|e }}
{% if not badge.single_awarded %}
<small class="multibadge">{{
_('This badge can be earned multiple times.') }}</small>
{% endif %}
</div>
</div>
{% if user_badges %}
<p>{{ _('This badge was recently awarded to:') }}
<ul class="userlist">
{%- for user_badge in user_badges %}
<li>{{ render_user(user_badge.user, avatar_size=26) }}
- <span class="awarded">{{ _('awarded %s') %
? ^
+ {% autoescape false %}<span class="awarded">{{ _('awarded %s') %
? +++ ++++++++++ +++++ ^^
- user_badge.awarded|datetimeformat }}</span>
? --
+ user_badge.awarded|datetimeformat }}</span>{% endautoescape %}
? +++++++++++++++++++
{%- endfor %}
</ul>
{% else %}
<p>{{ _('This badge was not yet awarded. Be the first') }}
{% endif %}
{% endblock %} | 4 | 0.133333 | 2 | 2 |
fa0a38d90282917ad96c411b7d4cc108a194815e | spec/fixtures/organizations.yml | spec/fixtures/organizations.yml | acme:
name: ACME
foo_inc:
name: Foo Inc.
| acme:
name: ACME
foo_inc:
name: Foo Inc.
no_order_org:
name: No Order Org
| Add an organization with no orders | Add an organization with no orders
| YAML | mit | on-site/StockAid,on-site/StockAid,on-site/StockAid | yaml | ## Code Before:
acme:
name: ACME
foo_inc:
name: Foo Inc.
## Instruction:
Add an organization with no orders
## Code After:
acme:
name: ACME
foo_inc:
name: Foo Inc.
no_order_org:
name: No Order Org
| acme:
name: ACME
foo_inc:
name: Foo Inc.
+
+ no_order_org:
+ name: No Order Org | 3 | 0.6 | 3 | 0 |
5594626257ee3d222c7864490d2b0cc35731a65f | bin/templates/recipe.html | bin/templates/recipe.html | <!DOCTYPE html>
<html lang="en">
<head>
<title>Blue Blazer - Random Cocktails for Everyone.</title>
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/blueblazer.css" rel="stylesheet">
</head>
<body>
<div class="container row-fluid">
<div class="hero-unit span4 offset4">
<blockquote>
{% for ingredient in ingredients %}
<h4>{{ ingredient }}</h4>
{% endfor %}
<small>{{ total }}<br/></small>
</blockquote>
<ul class="unstyled">
{% for line in instructions %}
<li>
{{ line }}
</li>
{% endfor %}
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html lang="en">
<head>
<title>Blue Blazer - Random Cocktails for Everyone.</title>
<link href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='blueblazer.css') }}" rel="stylesheet">
</head>
<body>
<div class="container row-fluid">
<div class="hero-unit span4 offset4">
<blockquote>
{% for ingredient in ingredients %}
<h4>{{ ingredient }}</h4>
{% endfor %}
<small>{{ total }}<br/></small>
</blockquote>
<ul class="unstyled">
{% for line in instructions %}
<li>
{{ line }}
</li>
{% endfor %}
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
| Use a static url generator instead of hardcoded static resources. | Use a static url generator instead of hardcoded static resources.
| HTML | agpl-3.0 | cnelsonsic/blueblazer,cnelsonsic/blueblazer,cnelsonsic/blueblazer | html | ## Code Before:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Blue Blazer - Random Cocktails for Everyone.</title>
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/blueblazer.css" rel="stylesheet">
</head>
<body>
<div class="container row-fluid">
<div class="hero-unit span4 offset4">
<blockquote>
{% for ingredient in ingredients %}
<h4>{{ ingredient }}</h4>
{% endfor %}
<small>{{ total }}<br/></small>
</blockquote>
<ul class="unstyled">
{% for line in instructions %}
<li>
{{ line }}
</li>
{% endfor %}
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
## Instruction:
Use a static url generator instead of hardcoded static resources.
## Code After:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Blue Blazer - Random Cocktails for Everyone.</title>
<link href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='blueblazer.css') }}" rel="stylesheet">
</head>
<body>
<div class="container row-fluid">
<div class="hero-unit span4 offset4">
<blockquote>
{% for ingredient in ingredients %}
<h4>{{ ingredient }}</h4>
{% endfor %}
<small>{{ total }}<br/></small>
</blockquote>
<ul class="unstyled">
{% for line in instructions %}
<li>
{{ line }}
</li>
{% endfor %}
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html lang="en">
<head>
<title>Blue Blazer - Random Cocktails for Everyone.</title>
- <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
? ^ ^
+ <link href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
? ^^^^^^^^^^^^ ^^^^^^^^^^^^^ +++++
- <link href="/static/blueblazer.css" rel="stylesheet">
? ^ ^
+ <link href="{{ url_for('static', filename='blueblazer.css') }}" rel="stylesheet">
? ^^^^^^^^^^^^ ^^^^^^^^^^^^^ +++++
</head>
<body>
<div class="container row-fluid">
<div class="hero-unit span4 offset4">
<blockquote>
{% for ingredient in ingredients %}
<h4>{{ ingredient }}</h4>
{% endfor %}
<small>{{ total }}<br/></small>
</blockquote>
<ul class="unstyled">
{% for line in instructions %}
<li>
{{ line }}
</li>
{% endfor %}
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
</body>
</html> | 4 | 0.125 | 2 | 2 |
3465139d6d1347f23983db50d9a1d6ba171e08b5 | src/ruby/project/sketch_app/public/index.html | src/ruby/project/sketch_app/public/index.html | <!DOCTYPE html>
<html>
<head>
</head>
<body>
<meta charset=utf-8>
<title>Handwritten Digits Recognition</title>
<div class="tools">
<a href="#simple_sketch" data-tool="marker">Marker</a>
<a href="#simple_sketch" data-tool="eraser">Eraser</a>
<a href="#simple_sketch" data-download="png">Download</a>
</div>
<canvas id='simple_sketch' width='400' height='400' style='border: 2px solid black'></canvas>
<script src="/js/jquery-latest.js"></script>
<script src='/js/sketch.js'></script>
<script type='text/javascript'>
$(function() {
$('#simple_sketch').sketch();
});
</script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
</head>
<body>
<meta charset=utf-8>
<title>Handwritten Digits Recognition</title>
<div class="tools">
<a href="#simple_sketch" data-tool="marker">Marker</a>
<a href="#simple_sketch" data-tool="eraser">Eraser</a>
<a href="#simple_sketch" data-download="png">Download</a>
<a id="predict-link" href="#simple_sketch">Predict</a>
</div>
<canvas id='simple_sketch' width='400' height='400' style='border: 2px solid black'></canvas>
<div id="prediction"></div>
<script src="/js/jquery-latest.js"></script>
<script src='/js/sketch.js'></script>
<script type='text/javascript'>
$(function() {
$('#simple_sketch').sketch();
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
}
$("#predict-link").on("click", function() {
var dataUrl = $("#simple_sketch")[0].toDataURL();
var formData = new FormData();
formData.append('files', dataURLtoBlob(dataUrl));
$.ajax({
type: "POST",
url: "http://cf-predict.local.pcfdev.io/prediction",
contentType: false,
cache: false,
processData: false,
dataType: 'json',
data: formData
}).done(function(data) {
$("#prediction").text(data);
console.log("success");
}).fail(function() {
console.log("fail");
});
});
});
</script>
</body>
</html>
| Add prediction button to app. | Add prediction button to app.
| HTML | mit | datitran/cf-demo,datitran/cf-demo,datitran/cf-demo,datitran/cf-demo,datitran/cf-demo | html | ## Code Before:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<meta charset=utf-8>
<title>Handwritten Digits Recognition</title>
<div class="tools">
<a href="#simple_sketch" data-tool="marker">Marker</a>
<a href="#simple_sketch" data-tool="eraser">Eraser</a>
<a href="#simple_sketch" data-download="png">Download</a>
</div>
<canvas id='simple_sketch' width='400' height='400' style='border: 2px solid black'></canvas>
<script src="/js/jquery-latest.js"></script>
<script src='/js/sketch.js'></script>
<script type='text/javascript'>
$(function() {
$('#simple_sketch').sketch();
});
</script>
</body>
</html>
## Instruction:
Add prediction button to app.
## Code After:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<meta charset=utf-8>
<title>Handwritten Digits Recognition</title>
<div class="tools">
<a href="#simple_sketch" data-tool="marker">Marker</a>
<a href="#simple_sketch" data-tool="eraser">Eraser</a>
<a href="#simple_sketch" data-download="png">Download</a>
<a id="predict-link" href="#simple_sketch">Predict</a>
</div>
<canvas id='simple_sketch' width='400' height='400' style='border: 2px solid black'></canvas>
<div id="prediction"></div>
<script src="/js/jquery-latest.js"></script>
<script src='/js/sketch.js'></script>
<script type='text/javascript'>
$(function() {
$('#simple_sketch').sketch();
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
}
$("#predict-link").on("click", function() {
var dataUrl = $("#simple_sketch")[0].toDataURL();
var formData = new FormData();
formData.append('files', dataURLtoBlob(dataUrl));
$.ajax({
type: "POST",
url: "http://cf-predict.local.pcfdev.io/prediction",
contentType: false,
cache: false,
processData: false,
dataType: 'json',
data: formData
}).done(function(data) {
$("#prediction").text(data);
console.log("success");
}).fail(function() {
console.log("fail");
});
});
});
</script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
</head>
<body>
<meta charset=utf-8>
<title>Handwritten Digits Recognition</title>
<div class="tools">
<a href="#simple_sketch" data-tool="marker">Marker</a>
<a href="#simple_sketch" data-tool="eraser">Eraser</a>
<a href="#simple_sketch" data-download="png">Download</a>
+ <a id="predict-link" href="#simple_sketch">Predict</a>
</div>
<canvas id='simple_sketch' width='400' height='400' style='border: 2px solid black'></canvas>
-
+ <div id="prediction"></div>
<script src="/js/jquery-latest.js"></script>
<script src='/js/sketch.js'></script>
<script type='text/javascript'>
$(function() {
$('#simple_sketch').sketch();
+
+ function dataURLtoBlob(dataurl) {
+ var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
+ bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
+ while(n--){
+ u8arr[n] = bstr.charCodeAt(n);
+ }
+ return new Blob([u8arr], {type:mime});
+ }
+
+ $("#predict-link").on("click", function() {
+ var dataUrl = $("#simple_sketch")[0].toDataURL();
+
+ var formData = new FormData();
+ formData.append('files', dataURLtoBlob(dataUrl));
+
+ $.ajax({
+ type: "POST",
+ url: "http://cf-predict.local.pcfdev.io/prediction",
+ contentType: false,
+ cache: false,
+ processData: false,
+ dataType: 'json',
+ data: formData
+ }).done(function(data) {
+ $("#prediction").text(data);
+ console.log("success");
+ }).fail(function() {
+ console.log("fail");
+ });
+ });
});
</script>
</body>
</html> | 34 | 1.36 | 33 | 1 |
145d1d2ef55ac62417539d7e7d8adebe90b37808 | testsuite/testing-tools/algorithm.h | testsuite/testing-tools/algorithm.h | /*
* Copyright (c) 2015-2018 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <iterator>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace helpers
{
template<
typename Iterator,
typename Compare = std::less<>,
typename Projection = cppsort::utility::identity
>
auto is_sorted(Iterator first, Iterator last,
Compare compare={}, Projection projection={})
-> bool
{
auto&& comp = cppsort::utility::as_function(compare);
auto&& proj = cppsort::utility::as_function(projection);
for (auto it = std::next(first) ; it != last ; ++it) {
if (comp(proj(*it), proj(*first))) {
return false;
}
}
return true;
}
template<
typename ForwardIterator,
typename T,
typename Projection = cppsort::utility::identity
>
auto iota(ForwardIterator first, ForwardIterator last,
T value, Projection projection={})
-> void
{
auto&& proj = cppsort::utility::as_function(projection);
while (first != last)
{
proj(*first++) = value;
++value;
}
}
}
#endif // CPPSORT_TESTSUITE_ALGORITHM_H_
| /*
* Copyright (c) 2015-2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace helpers
{
template<
typename Iterator,
typename Compare = std::less<>,
typename Projection = cppsort::utility::identity
>
constexpr auto is_sorted(Iterator first, Iterator last,
Compare compare={}, Projection projection={})
-> bool
{
auto&& comp = cppsort::utility::as_function(compare);
auto&& proj = cppsort::utility::as_function(projection);
if (first == last) {
return true;
}
auto next = first;
while (++next != last) {
if (comp(proj(*next), proj(*first))) {
return false;
}
++first;
}
return true;
}
template<
typename ForwardIterator,
typename T,
typename Projection = cppsort::utility::identity
>
auto iota(ForwardIterator first, ForwardIterator last,
T value, Projection projection={})
-> void
{
auto&& proj = cppsort::utility::as_function(projection);
while (first != last)
{
proj(*first++) = value;
++value;
}
}
}
#endif // CPPSORT_TESTSUITE_ALGORITHM_H_
| Fix incorrect is_sorted implementation in the test suite | Fix incorrect is_sorted implementation in the test suite
I'm not sure how this managed to slip under my radar since 2015, that's
a bit embarrassing.
| C | mit | Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort,Morwenn/cpp-sort | c | ## Code Before:
/*
* Copyright (c) 2015-2018 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <iterator>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace helpers
{
template<
typename Iterator,
typename Compare = std::less<>,
typename Projection = cppsort::utility::identity
>
auto is_sorted(Iterator first, Iterator last,
Compare compare={}, Projection projection={})
-> bool
{
auto&& comp = cppsort::utility::as_function(compare);
auto&& proj = cppsort::utility::as_function(projection);
for (auto it = std::next(first) ; it != last ; ++it) {
if (comp(proj(*it), proj(*first))) {
return false;
}
}
return true;
}
template<
typename ForwardIterator,
typename T,
typename Projection = cppsort::utility::identity
>
auto iota(ForwardIterator first, ForwardIterator last,
T value, Projection projection={})
-> void
{
auto&& proj = cppsort::utility::as_function(projection);
while (first != last)
{
proj(*first++) = value;
++value;
}
}
}
#endif // CPPSORT_TESTSUITE_ALGORITHM_H_
## Instruction:
Fix incorrect is_sorted implementation in the test suite
I'm not sure how this managed to slip under my radar since 2015, that's
a bit embarrassing.
## Code After:
/*
* Copyright (c) 2015-2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace helpers
{
template<
typename Iterator,
typename Compare = std::less<>,
typename Projection = cppsort::utility::identity
>
constexpr auto is_sorted(Iterator first, Iterator last,
Compare compare={}, Projection projection={})
-> bool
{
auto&& comp = cppsort::utility::as_function(compare);
auto&& proj = cppsort::utility::as_function(projection);
if (first == last) {
return true;
}
auto next = first;
while (++next != last) {
if (comp(proj(*next), proj(*first))) {
return false;
}
++first;
}
return true;
}
template<
typename ForwardIterator,
typename T,
typename Projection = cppsort::utility::identity
>
auto iota(ForwardIterator first, ForwardIterator last,
T value, Projection projection={})
-> void
{
auto&& proj = cppsort::utility::as_function(projection);
while (first != last)
{
proj(*first++) = value;
++value;
}
}
}
#endif // CPPSORT_TESTSUITE_ALGORITHM_H_
| /*
- * Copyright (c) 2015-2018 Morwenn
? -
+ * Copyright (c) 2015-2021 Morwenn
? +
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
- #include <iterator>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace helpers
{
template<
typename Iterator,
typename Compare = std::less<>,
typename Projection = cppsort::utility::identity
>
- auto is_sorted(Iterator first, Iterator last,
+ constexpr auto is_sorted(Iterator first, Iterator last,
? ++++++++++
- Compare compare={}, Projection projection={})
+ Compare compare={}, Projection projection={})
? ++++++++++
-> bool
{
auto&& comp = cppsort::utility::as_function(compare);
auto&& proj = cppsort::utility::as_function(projection);
- for (auto it = std::next(first) ; it != last ; ++it) {
+ if (first == last) {
+ return true;
+ }
+
+ auto next = first;
+ while (++next != last) {
- if (comp(proj(*it), proj(*first))) {
? ^
+ if (comp(proj(*next), proj(*first))) {
? ^^^
return false;
}
+ ++first;
}
return true;
}
template<
typename ForwardIterator,
typename T,
typename Projection = cppsort::utility::identity
>
auto iota(ForwardIterator first, ForwardIterator last,
T value, Projection projection={})
-> void
{
auto&& proj = cppsort::utility::as_function(projection);
while (first != last)
{
proj(*first++) = value;
++value;
}
}
}
#endif // CPPSORT_TESTSUITE_ALGORITHM_H_ | 17 | 0.298246 | 11 | 6 |
76195d43ec31cbd9d0f81e38ac0db529d0dd3e1b | classes/utils.php | classes/utils.php | <?php
class utils {
function json_decode_file($file) {
return json_decode(file_get_contents("{$file}"));
}
function toObject($array) {
$obj = new stdClass();
foreach ($array as $key => $val)
$obj->$key = is_array($val) ? self::toObject($val) : $val;
return $obj;
}
function toArray($d) {
if(is_object($d))
$d = get_object_vars($d);
if(is_array($d))
return array_map(__FUNCTION__, $d);
else
return $d;
}
} | <?php
class utils {
function is_json($json) {
if(substr($json, 0, 1) != "{" && substr($json, 0, 1) != "[" && substr($json, -1) != "}" && substr($json, -1) != "]")
return false;
$json = json_decode($json);
return json_last_error() == JSON_ERROR_NONE;
}
function json_decode_file($file) {
return json_decode(file_get_contents("{$file}"));
}
function usenslargs() {
ini_set('arg_separator.output',';');
}
function json_encode_file($file, $contents) {
if(!$this->is_json($contents))
return file_put_contents($file, json_encode($contents));
return file_put_contents($file, $contents);
}
function toObject($array) {
$obj = new stdClass();
foreach ($array as $key => $val)
$obj->$key = is_array($val) ? self::toObject($val) : $val;
return $obj;
}
function toArray($d) {
if(is_object($d))
$d = get_object_vars($d);
if(is_array($d))
return array_map(__FUNCTION__, $d);
else
return $d;
}
} | Add json_encode_file() and is_json() for simplifing the json management. Add usenslargs() function to set-up url args separated with ; instend of & | Add json_encode_file() and is_json() for simplifing the json management. Add usenslargs() function to set-up url args separated with ; instend of &
| PHP | mit | NslWebsiteEngine/Nsl-Website-Engine | php | ## Code Before:
<?php
class utils {
function json_decode_file($file) {
return json_decode(file_get_contents("{$file}"));
}
function toObject($array) {
$obj = new stdClass();
foreach ($array as $key => $val)
$obj->$key = is_array($val) ? self::toObject($val) : $val;
return $obj;
}
function toArray($d) {
if(is_object($d))
$d = get_object_vars($d);
if(is_array($d))
return array_map(__FUNCTION__, $d);
else
return $d;
}
}
## Instruction:
Add json_encode_file() and is_json() for simplifing the json management. Add usenslargs() function to set-up url args separated with ; instend of &
## Code After:
<?php
class utils {
function is_json($json) {
if(substr($json, 0, 1) != "{" && substr($json, 0, 1) != "[" && substr($json, -1) != "}" && substr($json, -1) != "]")
return false;
$json = json_decode($json);
return json_last_error() == JSON_ERROR_NONE;
}
function json_decode_file($file) {
return json_decode(file_get_contents("{$file}"));
}
function usenslargs() {
ini_set('arg_separator.output',';');
}
function json_encode_file($file, $contents) {
if(!$this->is_json($contents))
return file_put_contents($file, json_encode($contents));
return file_put_contents($file, $contents);
}
function toObject($array) {
$obj = new stdClass();
foreach ($array as $key => $val)
$obj->$key = is_array($val) ? self::toObject($val) : $val;
return $obj;
}
function toArray($d) {
if(is_object($d))
$d = get_object_vars($d);
if(is_array($d))
return array_map(__FUNCTION__, $d);
else
return $d;
}
} | <?php
class utils {
+ function is_json($json) {
+ if(substr($json, 0, 1) != "{" && substr($json, 0, 1) != "[" && substr($json, -1) != "}" && substr($json, -1) != "]")
+ return false;
+ $json = json_decode($json);
+ return json_last_error() == JSON_ERROR_NONE;
+ }
function json_decode_file($file) {
return json_decode(file_get_contents("{$file}"));
}
+ function usenslargs() {
+ ini_set('arg_separator.output',';');
+ }
+ function json_encode_file($file, $contents) {
+ if(!$this->is_json($contents))
+ return file_put_contents($file, json_encode($contents));
+ return file_put_contents($file, $contents);
+ }
- function toObject($array) {
? ^^^^
+ function toObject($array) {
? ^
- $obj = new stdClass();
? ^^^^
+ $obj = new stdClass();
? ^
foreach ($array as $key => $val)
$obj->$key = is_array($val) ? self::toObject($val) : $val;
return $obj;
}
function toArray($d) {
if(is_object($d))
$d = get_object_vars($d);
if(is_array($d))
return array_map(__FUNCTION__, $d);
else
return $d;
}
} | 18 | 0.9 | 16 | 2 |
787f5c81e3b1b47368600836ec477fad78f592c3 | packages/st/streaming-binary.yaml | packages/st/streaming-binary.yaml | homepage: https://github.com/mboes/streaming-binary#readme
changelog-type: ''
hash: 10098d35f289040d010ffcfb44267573d7544a3f119ca9f750d17394ff1750d3
test-bench-deps:
streaming: -any
bytestring: ! '>=0.10'
base: -any
hspec: ! '>=2.4'
streaming-binary: -any
binary: -any
streaming-bytestring: -any
maintainer: m@tweag.io
synopsis: Streaming interface to binary.
changelog: ''
basic-deps:
streaming: ! '>=0.1.4'
base: ! '>=4.7 && <5'
binary: ! '>=0.8'
streaming-bytestring: ! '>=0.1.4'
all-versions:
- '0.1.0.0'
author: Mathieu Boespflug
latest: '0.1.0.0'
description-type: markdown
description: ! '# streaming-binary
This library offers incremental serialization and deserialization of
Haskell values using the `binary` package. Under the hood, we wrap the
incremental decoders from `binary`''s Incremental API as first-class
streams as defined in `streaming`.
'
license-name: BSD3
| homepage: https://github.com/mboes/streaming-binary#readme
changelog-type: ''
hash: 93d0c1e63d4d5673cd3f4809651de69c9231ce010da18ca1a98e240bb3983156
test-bench-deps:
streaming: -any
bytestring: ! '>=0.10'
base: -any
hspec: ! '>=2.4'
streaming-binary: -any
binary: -any
streaming-bytestring: -any
maintainer: m@tweag.io
synopsis: Streaming interface to binary.
changelog: ''
basic-deps:
streaming: ! '>=0.1.4'
base: ! '>=4.7 && <5'
binary: ! '>=0.8'
streaming-bytestring: ! '>=0.1.4'
all-versions:
- '0.1.0.0'
- '0.2.0.0'
author: Mathieu Boespflug
latest: '0.2.0.0'
description-type: markdown
description: ! '# streaming-binary
This library offers incremental serialization and deserialization of
Haskell values using the `binary` package. Under the hood, we wrap the
incremental decoders from `binary`''s Incremental API as first-class
streams as defined in `streaming`.
'
license-name: BSD3
| Update from Hackage at 2017-05-28T18:45:12Z | Update from Hackage at 2017-05-28T18:45:12Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: https://github.com/mboes/streaming-binary#readme
changelog-type: ''
hash: 10098d35f289040d010ffcfb44267573d7544a3f119ca9f750d17394ff1750d3
test-bench-deps:
streaming: -any
bytestring: ! '>=0.10'
base: -any
hspec: ! '>=2.4'
streaming-binary: -any
binary: -any
streaming-bytestring: -any
maintainer: m@tweag.io
synopsis: Streaming interface to binary.
changelog: ''
basic-deps:
streaming: ! '>=0.1.4'
base: ! '>=4.7 && <5'
binary: ! '>=0.8'
streaming-bytestring: ! '>=0.1.4'
all-versions:
- '0.1.0.0'
author: Mathieu Boespflug
latest: '0.1.0.0'
description-type: markdown
description: ! '# streaming-binary
This library offers incremental serialization and deserialization of
Haskell values using the `binary` package. Under the hood, we wrap the
incremental decoders from `binary`''s Incremental API as first-class
streams as defined in `streaming`.
'
license-name: BSD3
## Instruction:
Update from Hackage at 2017-05-28T18:45:12Z
## Code After:
homepage: https://github.com/mboes/streaming-binary#readme
changelog-type: ''
hash: 93d0c1e63d4d5673cd3f4809651de69c9231ce010da18ca1a98e240bb3983156
test-bench-deps:
streaming: -any
bytestring: ! '>=0.10'
base: -any
hspec: ! '>=2.4'
streaming-binary: -any
binary: -any
streaming-bytestring: -any
maintainer: m@tweag.io
synopsis: Streaming interface to binary.
changelog: ''
basic-deps:
streaming: ! '>=0.1.4'
base: ! '>=4.7 && <5'
binary: ! '>=0.8'
streaming-bytestring: ! '>=0.1.4'
all-versions:
- '0.1.0.0'
- '0.2.0.0'
author: Mathieu Boespflug
latest: '0.2.0.0'
description-type: markdown
description: ! '# streaming-binary
This library offers incremental serialization and deserialization of
Haskell values using the `binary` package. Under the hood, we wrap the
incremental decoders from `binary`''s Incremental API as first-class
streams as defined in `streaming`.
'
license-name: BSD3
| homepage: https://github.com/mboes/streaming-binary#readme
changelog-type: ''
- hash: 10098d35f289040d010ffcfb44267573d7544a3f119ca9f750d17394ff1750d3
+ hash: 93d0c1e63d4d5673cd3f4809651de69c9231ce010da18ca1a98e240bb3983156
test-bench-deps:
streaming: -any
bytestring: ! '>=0.10'
base: -any
hspec: ! '>=2.4'
streaming-binary: -any
binary: -any
streaming-bytestring: -any
maintainer: m@tweag.io
synopsis: Streaming interface to binary.
changelog: ''
basic-deps:
streaming: ! '>=0.1.4'
base: ! '>=4.7 && <5'
binary: ! '>=0.8'
streaming-bytestring: ! '>=0.1.4'
all-versions:
- '0.1.0.0'
+ - '0.2.0.0'
author: Mathieu Boespflug
- latest: '0.1.0.0'
? ^
+ latest: '0.2.0.0'
? ^
description-type: markdown
description: ! '# streaming-binary
This library offers incremental serialization and deserialization of
Haskell values using the `binary` package. Under the hood, we wrap the
incremental decoders from `binary`''s Incremental API as first-class
streams as defined in `streaming`.
'
license-name: BSD3 | 5 | 0.135135 | 3 | 2 |
479668a343c2b576311260ef0f1e801ab6204b5d | appveyor.yml | appveyor.yml | version: '{build}'
platform:
- x64
services:
- postgresql
shallow_clone: true
cache:
- node_modules
environment:
MERKEL_DB: postgres://postgres:Password12!@localhost:5432/merkel_test
PGPASSWORD: Password12!
install:
- ps: Install-Product node $env:NODE_VERSION x64
- npm install
- node_modules\.bin\typings install
build_script:
- npm run build
before_test:
- echo Password12! | psql -c 'CREATE DATABASE merkel_test;' -U postgres
test_script:
- npm test
| version: '{build}'
platform:
- x64
services:
- postgresql
shallow_clone: true
cache:
- node_modules
environment:
MERKEL_DB: postgres://postgres:Password12!@localhost:5432/merkel_test
PGPASSWORD: Password12!
install:
- ps: Install-Product node $env:NODE_VERSION x64
- npm install
- node_modules\.bin\typings install
build_script:
- npm run build
before_test:
- "C:\Program Files\PostgreSQL\9.3\bin\psql -c 'CREATE DATABASE merkel_test;' -U postgres"
test_script:
- npm test
| Fix database setup in AppVeyor | Fix database setup in AppVeyor
| YAML | isc | felixfbecker/merkel,felixfbecker/merkel | yaml | ## Code Before:
version: '{build}'
platform:
- x64
services:
- postgresql
shallow_clone: true
cache:
- node_modules
environment:
MERKEL_DB: postgres://postgres:Password12!@localhost:5432/merkel_test
PGPASSWORD: Password12!
install:
- ps: Install-Product node $env:NODE_VERSION x64
- npm install
- node_modules\.bin\typings install
build_script:
- npm run build
before_test:
- echo Password12! | psql -c 'CREATE DATABASE merkel_test;' -U postgres
test_script:
- npm test
## Instruction:
Fix database setup in AppVeyor
## Code After:
version: '{build}'
platform:
- x64
services:
- postgresql
shallow_clone: true
cache:
- node_modules
environment:
MERKEL_DB: postgres://postgres:Password12!@localhost:5432/merkel_test
PGPASSWORD: Password12!
install:
- ps: Install-Product node $env:NODE_VERSION x64
- npm install
- node_modules\.bin\typings install
build_script:
- npm run build
before_test:
- "C:\Program Files\PostgreSQL\9.3\bin\psql -c 'CREATE DATABASE merkel_test;' -U postgres"
test_script:
- npm test
| version: '{build}'
platform:
- x64
services:
- postgresql
shallow_clone: true
cache:
- node_modules
environment:
MERKEL_DB: postgres://postgres:Password12!@localhost:5432/merkel_test
PGPASSWORD: Password12!
install:
- ps: Install-Product node $env:NODE_VERSION x64
- npm install
- node_modules\.bin\typings install
build_script:
- npm run build
before_test:
- - echo Password12! | psql -c 'CREATE DATABASE merkel_test;' -U postgres
+ - "C:\Program Files\PostgreSQL\9.3\bin\psql -c 'CREATE DATABASE merkel_test;' -U postgres"
test_script:
- npm test | 2 | 0.066667 | 1 | 1 |
fba9f98c129be8cf79d465bd3d7fae8a8c79c8c4 | contrib/push-all.sh.tpl | contrib/push-all.sh.tpl |
set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
}
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
PIDS=()
function async() {
# Launch the command asynchronously and track its process id.
PYTHON_RUNFILES=${RUNFILES} "$@" &
PIDS+=($!)
}
%{push_statements}
# Wait for all of the subprocesses, failing the script if any of them failed.
# See https://github.com/bazelbuild/rules_docker/issues/511 on why we do
# the verbose expansion for the PIDS instead of just PIDS[@]
for pid in ${PIDS[@]+"${PIDS[@]}"}; do
wait ${pid}
done
|
set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
}
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
PIDS=()
function async() {
# Launch the command asynchronously and track its process id.
PYTHON_RUNFILES=${RUNFILES} "$@" &
PIDS+=($!)
}
%{push_statements}
# Wait for all of the subprocesses, failing the script if any of them failed.
if [ "${#PIDS[@]}" != 0 ]; then
for pid in ${PIDS[@]}; do
wait ${pid}
done
fi
| Check for array length before dereferencing it | Check for array length before dereferencing it
| Smarty | apache-2.0 | bazelbuild/rules_docker,bazelbuild/rules_docker,bazelbuild/rules_docker,bazelbuild/rules_docker | smarty | ## Code Before:
set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
}
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
PIDS=()
function async() {
# Launch the command asynchronously and track its process id.
PYTHON_RUNFILES=${RUNFILES} "$@" &
PIDS+=($!)
}
%{push_statements}
# Wait for all of the subprocesses, failing the script if any of them failed.
# See https://github.com/bazelbuild/rules_docker/issues/511 on why we do
# the verbose expansion for the PIDS instead of just PIDS[@]
for pid in ${PIDS[@]+"${PIDS[@]}"}; do
wait ${pid}
done
## Instruction:
Check for array length before dereferencing it
## Code After:
set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
}
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
PIDS=()
function async() {
# Launch the command asynchronously and track its process id.
PYTHON_RUNFILES=${RUNFILES} "$@" &
PIDS+=($!)
}
%{push_statements}
# Wait for all of the subprocesses, failing the script if any of them failed.
if [ "${#PIDS[@]}" != 0 ]; then
for pid in ${PIDS[@]}; do
wait ${pid}
done
fi
|
set -eu
function guess_runfiles() {
pushd ${BASH_SOURCE[0]}.runfiles > /dev/null 2>&1
pwd
popd > /dev/null 2>&1
}
RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
PIDS=()
function async() {
# Launch the command asynchronously and track its process id.
PYTHON_RUNFILES=${RUNFILES} "$@" &
PIDS+=($!)
}
%{push_statements}
# Wait for all of the subprocesses, failing the script if any of them failed.
+ if [ "${#PIDS[@]}" != 0 ]; then
+ for pid in ${PIDS[@]}; do
- # See https://github.com/bazelbuild/rules_docker/issues/511 on why we do
- # the verbose expansion for the PIDS instead of just PIDS[@]
- for pid in ${PIDS[@]+"${PIDS[@]}"}; do
- wait ${pid}
+ wait ${pid}
? ++++
- done
+ done
+ fi | 10 | 0.4 | 5 | 5 |
781a59f0ae255040bebd4d3ea54de70b812c049f | express/models/rule_parser.js | express/models/rule_parser.js | // L-System Rule Parser
function RuleParser(str) {
this.str = str;
this.rules = {};
this.parse = function() {
var c, d;
var env = 0;
var rule_str;
var variable;
for (var i = 0; i < this.str.length; i++) {
c = this.str[i];
if (i > 0) {
d = this.str[i-1];
} else {
d = null;
}
if (c == '(') {
env = 1;
rule_str = "";
} else if (c.search(/[A-Z]/) == 0 && env == 1) {
variable = c;
} else if (c == '>' && d == '-') {
env = 2;
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
&& env == 2) {
rule_str += c;
} else if (c == ')') {
this.rules[variable] = rule_str;
env = 0;
}
}
return this.rules;
}
}
module.exports = RuleParser;
| // L-System Rule Parser
function RuleParser(str) {
this.str = str;
this.rules = {};
this.parse = function() {
var c, d;
var env = 0;
var rule_str;
var variable;
for (var i = 0; i < this.str.length; i++) {
c = this.str[i];
if (i > 0) {
d = this.str[i-1];
} else {
d = null;
}
if (c == '(') {
env = 1;
rule_str = "";
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+\-\[\]]/) == 0)
&& env == 1) {
variable = c;
} else if (c == '>' && d == '-') {
env = 2;
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
&& env == 2) {
rule_str += c;
} else if (c == ')') {
this.rules[variable] = rule_str;
env = 0;
}
}
return this.rules;
}
}
module.exports = RuleParser;
| Allow control char as rule "variable" | Allow control char as rule "variable"
| JavaScript | bsd-3-clause | dwjackson/html_fractals | javascript | ## Code Before:
// L-System Rule Parser
function RuleParser(str) {
this.str = str;
this.rules = {};
this.parse = function() {
var c, d;
var env = 0;
var rule_str;
var variable;
for (var i = 0; i < this.str.length; i++) {
c = this.str[i];
if (i > 0) {
d = this.str[i-1];
} else {
d = null;
}
if (c == '(') {
env = 1;
rule_str = "";
} else if (c.search(/[A-Z]/) == 0 && env == 1) {
variable = c;
} else if (c == '>' && d == '-') {
env = 2;
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
&& env == 2) {
rule_str += c;
} else if (c == ')') {
this.rules[variable] = rule_str;
env = 0;
}
}
return this.rules;
}
}
module.exports = RuleParser;
## Instruction:
Allow control char as rule "variable"
## Code After:
// L-System Rule Parser
function RuleParser(str) {
this.str = str;
this.rules = {};
this.parse = function() {
var c, d;
var env = 0;
var rule_str;
var variable;
for (var i = 0; i < this.str.length; i++) {
c = this.str[i];
if (i > 0) {
d = this.str[i-1];
} else {
d = null;
}
if (c == '(') {
env = 1;
rule_str = "";
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+\-\[\]]/) == 0)
&& env == 1) {
variable = c;
} else if (c == '>' && d == '-') {
env = 2;
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
&& env == 2) {
rule_str += c;
} else if (c == ')') {
this.rules[variable] = rule_str;
env = 0;
}
}
return this.rules;
}
}
module.exports = RuleParser;
| // L-System Rule Parser
function RuleParser(str) {
this.str = str;
this.rules = {};
this.parse = function() {
var c, d;
var env = 0;
var rule_str;
var variable;
for (var i = 0; i < this.str.length; i++) {
c = this.str[i];
if (i > 0) {
d = this.str[i-1];
} else {
d = null;
}
if (c == '(') {
env = 1;
rule_str = "";
- } else if (c.search(/[A-Z]/) == 0 && env == 1) {
+ } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+\-\[\]]/) == 0)
+ && env == 1) {
variable = c;
} else if (c == '>' && d == '-') {
env = 2;
} else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0)
&& env == 2) {
rule_str += c;
} else if (c == ')') {
this.rules[variable] = rule_str;
env = 0;
}
}
return this.rules;
}
}
module.exports = RuleParser; | 3 | 0.075 | 2 | 1 |
23e514b523e5b3aa48f1ffc465efae40746a8784 | c/env.zsh | c/env.zsh | export PATH=$PATH:/opt/microchip/xc8/v1.20/bin
| export PATH=$PATH:/opt/microchip/xc8/v1.20/bin
export PATH=$PATH:/opt/microchip/mplabx/mplab_ipe
| Add Microchip command line programmer to path. | Add Microchip command line programmer to path.
| Shell | mit | peplin/dotfiles,peplin/dotfiles,peplin/dotfiles,peplin/dotfiles | shell | ## Code Before:
export PATH=$PATH:/opt/microchip/xc8/v1.20/bin
## Instruction:
Add Microchip command line programmer to path.
## Code After:
export PATH=$PATH:/opt/microchip/xc8/v1.20/bin
export PATH=$PATH:/opt/microchip/mplabx/mplab_ipe
| export PATH=$PATH:/opt/microchip/xc8/v1.20/bin
+ export PATH=$PATH:/opt/microchip/mplabx/mplab_ipe | 1 | 1 | 1 | 0 |
86688f571ed92d8ca84789d5ffd5c6a53b1292ba | server/README.md | server/README.md |
```sh
cd server
php -S 127.0.0.1:8080
```
## requirements
- `php5` (5.3 for normal use, but 5.4 is required to use PHP built-in server as is shown in the get started)
- `php5-sqlite`
## tips
Please don't use `php -S` for production, the built-in server must be used for developments / tests only ([php-doc-webserver](https://php.net/manual/features.commandline.webserver.php)).
Use apache, nginx or any other web servers.
It is strongly reccomended that you add a Basic Authentication on the bush root directory.
The client supports this and it is the only option if you don't want to share all your files publicly.
|
```sh
cd server
php -S 127.0.0.1:8080
```
## requirements
- `php5` (5.3 for normal use, but 5.4 is required to use PHP built-in server as is shown in the get started)
- `php5-sqlite`
## authentication & tips
#### By default all files are public.
Please don't use `php -S` for production, the built-in server must be used for developments / tests only ([php-doc-webserver](https://php.net/manual/features.commandline.webserver.php)).
Use apache, nginx or any other web servers.
It is __strongly reccomended__ that you add a Basic Authentication on the bush root directory.
The client supports this and it is the only option if you don't want to share all your files publicly.
| Add more emphasis on authentication in the readme. | Add more emphasis on authentication in the readme. | Markdown | mit | BestPig/bush,BestPig/bush,BestPig/bush | markdown | ## Code Before:
```sh
cd server
php -S 127.0.0.1:8080
```
## requirements
- `php5` (5.3 for normal use, but 5.4 is required to use PHP built-in server as is shown in the get started)
- `php5-sqlite`
## tips
Please don't use `php -S` for production, the built-in server must be used for developments / tests only ([php-doc-webserver](https://php.net/manual/features.commandline.webserver.php)).
Use apache, nginx or any other web servers.
It is strongly reccomended that you add a Basic Authentication on the bush root directory.
The client supports this and it is the only option if you don't want to share all your files publicly.
## Instruction:
Add more emphasis on authentication in the readme.
## Code After:
```sh
cd server
php -S 127.0.0.1:8080
```
## requirements
- `php5` (5.3 for normal use, but 5.4 is required to use PHP built-in server as is shown in the get started)
- `php5-sqlite`
## authentication & tips
#### By default all files are public.
Please don't use `php -S` for production, the built-in server must be used for developments / tests only ([php-doc-webserver](https://php.net/manual/features.commandline.webserver.php)).
Use apache, nginx or any other web servers.
It is __strongly reccomended__ that you add a Basic Authentication on the bush root directory.
The client supports this and it is the only option if you don't want to share all your files publicly.
|
```sh
cd server
php -S 127.0.0.1:8080
```
## requirements
- `php5` (5.3 for normal use, but 5.4 is required to use PHP built-in server as is shown in the get started)
- `php5-sqlite`
- ## tips
+ ## authentication & tips
+
+ #### By default all files are public.
Please don't use `php -S` for production, the built-in server must be used for developments / tests only ([php-doc-webserver](https://php.net/manual/features.commandline.webserver.php)).
Use apache, nginx or any other web servers.
- It is strongly reccomended that you add a Basic Authentication on the bush root directory.
+ It is __strongly reccomended__ that you add a Basic Authentication on the bush root directory.
? ++ ++
The client supports this and it is the only option if you don't want to share all your files publicly. | 6 | 0.315789 | 4 | 2 |
22651f5d3a8c823215e611c8cc6c3bbc68476ce8 | src/Input/NumericInput.tsx | src/Input/NumericInput.tsx | import * as React from "react";
import {FormGroupContext, FormGroupContextTypes} from "../FormGroup/FormGroupContext";
import {InputContext, InputContextTypes} from "./InputContext";
import {BaseInput} from "./BaseInput";
export class NumericInput extends BaseInput<HTMLInputElement> {
public render() {
const childProps = {
...this.childProps,
...{
onInput: this.handleInputChange,
onChange: () => undefined,
type: "number"
}
};
return <input {...childProps} />;
}
protected handleInputChange = async (event: any) => {
this.props.onChange && this.props.onChange(event);
if (!event.defaultPrevented) {
const cleanValue = parseInt(event.currentTarget.value, 10) || "";
event.currentTarget.value = "";
event.currentTarget.value = cleanValue;
await this.context.onChange(cleanValue);
}
};
}
| import * as React from "react";
import {FormGroupContext, FormGroupContextTypes} from "../FormGroup/FormGroupContext";
import {InputContext, InputContextTypes} from "./InputContext";
import {BaseInput} from "./BaseInput";
export class NumericInput extends BaseInput<HTMLInputElement> {
protected cleanValue: number | string = "";
public render() {
const childProps = {
...this.childProps,
...{
onInput: this.handleInputChange,
onChange: () => undefined,
type: "number"
}
};
return <input {...childProps} />;
}
protected handleInputChange = async (event: any) => {
this.props.onChange && this.props.onChange(event);
if (!event.defaultPrevented) {
const parsedValue = parseInt(event.currentTarget.value, 10);
this.cleanValue = event.currentTarget.value
? parsedValue
: (this.cleanValue.toString().length > 1 ? this.cleanValue : "");
event.currentTarget.value = "";
event.currentTarget.value = this.cleanValue;
await this.context.onChange(this.cleanValue);
}
};
}
| Fix cleaned value on non digit input | Fix cleaned value on non digit input
| TypeScript | mit | Horat1us/react-context-form,Horat1us/react-context-form | typescript | ## Code Before:
import * as React from "react";
import {FormGroupContext, FormGroupContextTypes} from "../FormGroup/FormGroupContext";
import {InputContext, InputContextTypes} from "./InputContext";
import {BaseInput} from "./BaseInput";
export class NumericInput extends BaseInput<HTMLInputElement> {
public render() {
const childProps = {
...this.childProps,
...{
onInput: this.handleInputChange,
onChange: () => undefined,
type: "number"
}
};
return <input {...childProps} />;
}
protected handleInputChange = async (event: any) => {
this.props.onChange && this.props.onChange(event);
if (!event.defaultPrevented) {
const cleanValue = parseInt(event.currentTarget.value, 10) || "";
event.currentTarget.value = "";
event.currentTarget.value = cleanValue;
await this.context.onChange(cleanValue);
}
};
}
## Instruction:
Fix cleaned value on non digit input
## Code After:
import * as React from "react";
import {FormGroupContext, FormGroupContextTypes} from "../FormGroup/FormGroupContext";
import {InputContext, InputContextTypes} from "./InputContext";
import {BaseInput} from "./BaseInput";
export class NumericInput extends BaseInput<HTMLInputElement> {
protected cleanValue: number | string = "";
public render() {
const childProps = {
...this.childProps,
...{
onInput: this.handleInputChange,
onChange: () => undefined,
type: "number"
}
};
return <input {...childProps} />;
}
protected handleInputChange = async (event: any) => {
this.props.onChange && this.props.onChange(event);
if (!event.defaultPrevented) {
const parsedValue = parseInt(event.currentTarget.value, 10);
this.cleanValue = event.currentTarget.value
? parsedValue
: (this.cleanValue.toString().length > 1 ? this.cleanValue : "");
event.currentTarget.value = "";
event.currentTarget.value = this.cleanValue;
await this.context.onChange(this.cleanValue);
}
};
}
| import * as React from "react";
import {FormGroupContext, FormGroupContextTypes} from "../FormGroup/FormGroupContext";
import {InputContext, InputContextTypes} from "./InputContext";
import {BaseInput} from "./BaseInput";
export class NumericInput extends BaseInput<HTMLInputElement> {
+
+ protected cleanValue: number | string = "";
public render() {
const childProps = {
...this.childProps,
...{
onInput: this.handleInputChange,
onChange: () => undefined,
type: "number"
}
};
return <input {...childProps} />;
}
protected handleInputChange = async (event: any) => {
this.props.onChange && this.props.onChange(event);
if (!event.defaultPrevented) {
- const cleanValue = parseInt(event.currentTarget.value, 10) || "";
? ^^ ^^ ------
+ const parsedValue = parseInt(event.currentTarget.value, 10);
? ^^^^ ^
+
+ this.cleanValue = event.currentTarget.value
+ ? parsedValue
+ : (this.cleanValue.toString().length > 1 ? this.cleanValue : "");
+
event.currentTarget.value = "";
- event.currentTarget.value = cleanValue;
+ event.currentTarget.value = this.cleanValue;
? +++++
- await this.context.onChange(cleanValue);
+ await this.context.onChange(this.cleanValue);
? +++++
}
};
} | 13 | 0.40625 | 10 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.