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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f4dffd8870322b8aa7c394f88dd1a6c3b9a76091 | .travis.yml | .travis.yml | language: node_js
node_js:
- "4.0"
- "4"
- "5"
after_script: "npm run coveralls"
| language: node_js
node_js:
- "4"
- "6"
after_script: "npm run coveralls"
| Test against node v6, match hapi ecosystem | Test against node v6, match hapi ecosystem
| YAML | mit | devinivy/loveboat | yaml | ## Code Before:
language: node_js
node_js:
- "4.0"
- "4"
- "5"
after_script: "npm run coveralls"
## Instruction:
Test against node v6, match hapi ecosystem
## Code After:
language: node_js
node_js:
- "4"
- "6"
after_script: "npm run coveralls"
| language: node_js
node_js:
- - "4.0"
- "4"
- - "5"
? ^
+ - "6"
? ^
after_script: "npm run coveralls" | 3 | 0.375 | 1 | 2 |
1266b1fcb30e1ebeae03024add8ceea5a9a770dd | c++/src/problem_44.cpp | c++/src/problem_44.cpp | // Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 44
// Coded triangle numbers
namespace problem_44 {
long nth_pentagonal_number(const long n) {
return n * (3 * n - 1) / 2;
}
bool is_pentagonal(const long n) {
const long limit = n / 2 + 1;
const long two_n = n * 2;
for (long i = 0; i <= limit; ++i) {
if (i * (3 * i - 1) == two_n) {
return true;
}
}
return false;
}
long solve() {
return 1;
}
} // namespace problem_44
| // Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 44
// Coded triangle numbers
#include <cstdio>
#include <cmath>
namespace problem_44 {
long nth_pentagonal_number(const long n) {
return n * (3 * n - 1) / 2;
}
bool is_pentagonal(const long n) {
const long limit = n / 2 + 1;
const long two_n = n * 2;
for (long i = 0; i <= limit; ++i) {
if (i * (3 * i - 1) == two_n) {
return true;
}
}
return false;
}
long solve() {
for (long i = 1; true; ++i) {
const long n = nth_pentagonal_number(i);
printf("trying %ld\n", n);
const long limit_j = (n-1)/3;
for (long j = 1; j <= limit_j; ++j) {
const long first = nth_pentagonal_number(j);
for (long k = (long)(1 + sqrt(1+24*(n+first)))/6+1; true; ++k) {
const long second = nth_pentagonal_number(k);
const long diff = second - first;
// printf("%ld - %ld = %ld\n", second, first, diff);
if (diff == n) {
if (is_pentagonal(first + second)) {
return n;
}
break;
}
if (diff > n) {
break;
}
}
}
}
}
} // namespace problem_44
| Work on Problem 44 some more | Work on Problem 44 some more
| C++ | mit | mk12/euler,mk12/euler | c++ | ## Code Before:
// Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 44
// Coded triangle numbers
namespace problem_44 {
long nth_pentagonal_number(const long n) {
return n * (3 * n - 1) / 2;
}
bool is_pentagonal(const long n) {
const long limit = n / 2 + 1;
const long two_n = n * 2;
for (long i = 0; i <= limit; ++i) {
if (i * (3 * i - 1) == two_n) {
return true;
}
}
return false;
}
long solve() {
return 1;
}
} // namespace problem_44
## Instruction:
Work on Problem 44 some more
## Code After:
// Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 44
// Coded triangle numbers
#include <cstdio>
#include <cmath>
namespace problem_44 {
long nth_pentagonal_number(const long n) {
return n * (3 * n - 1) / 2;
}
bool is_pentagonal(const long n) {
const long limit = n / 2 + 1;
const long two_n = n * 2;
for (long i = 0; i <= limit; ++i) {
if (i * (3 * i - 1) == two_n) {
return true;
}
}
return false;
}
long solve() {
for (long i = 1; true; ++i) {
const long n = nth_pentagonal_number(i);
printf("trying %ld\n", n);
const long limit_j = (n-1)/3;
for (long j = 1; j <= limit_j; ++j) {
const long first = nth_pentagonal_number(j);
for (long k = (long)(1 + sqrt(1+24*(n+first)))/6+1; true; ++k) {
const long second = nth_pentagonal_number(k);
const long diff = second - first;
// printf("%ld - %ld = %ld\n", second, first, diff);
if (diff == n) {
if (is_pentagonal(first + second)) {
return n;
}
break;
}
if (diff > n) {
break;
}
}
}
}
}
} // namespace problem_44
| // Copyright 2016 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 44
// Coded triangle numbers
+
+ #include <cstdio>
+ #include <cmath>
namespace problem_44 {
long nth_pentagonal_number(const long n) {
return n * (3 * n - 1) / 2;
}
bool is_pentagonal(const long n) {
const long limit = n / 2 + 1;
const long two_n = n * 2;
for (long i = 0; i <= limit; ++i) {
if (i * (3 * i - 1) == two_n) {
return true;
}
}
return false;
}
long solve() {
- return 1;
+ for (long i = 1; true; ++i) {
+ const long n = nth_pentagonal_number(i);
+ printf("trying %ld\n", n);
+
+ const long limit_j = (n-1)/3;
+ for (long j = 1; j <= limit_j; ++j) {
+ const long first = nth_pentagonal_number(j);
+ for (long k = (long)(1 + sqrt(1+24*(n+first)))/6+1; true; ++k) {
+ const long second = nth_pentagonal_number(k);
+ const long diff = second - first;
+ // printf("%ld - %ld = %ld\n", second, first, diff);
+ if (diff == n) {
+ if (is_pentagonal(first + second)) {
+ return n;
+ }
+ break;
+ }
+ if (diff > n) {
+ break;
+ }
+ }
+ }
+ }
}
} // namespace problem_44 | 27 | 1.038462 | 26 | 1 |
56c798c98761c11e98875240d7df2bd46c9afdfe | circle.yml | circle.yml | machine:
node:
version: 4.4.5
dependencies:
cache_directories:
- /home/ubuntu/nvm/versions/node/v4.4.5/bin
- /home/ubuntu/nvm/versions/node/v4.4.5/lib/node_modules
- node_modules
- bower_components
override:
- npm install -g bower
- npm install --cache-min Infinity
- bower install
- npm rebuild node-sass
deployment:
production:
branch: master
commands:
- 'node_modules/.bin/ember deploy production --activate'
staging:
branch: develop
commands:
- 'node_modules/.bin/ember deploy staging --activate'
| machine:
node:
version: 4.4.5
dependencies:
cache_directories:
- /home/ubuntu/nvm/versions/node/v4.4.5/bin
- /home/ubuntu/nvm/versions/node/v4.4.5/lib/node_modules
- node_modules
- bower_components
override:
- npm install -g bower
- npm install
- bower install
- npm rebuild node-sass
deployment:
production:
branch: master
commands:
- 'node_modules/.bin/ember deploy production --activate'
staging:
branch: develop
commands:
- 'node_modules/.bin/ember deploy staging --activate'
| Revert "Circle CI script changes for faster build times" | Revert "Circle CI script changes for faster build times"
| YAML | mit | jderr-mx/code-corps-ember,code-corps/code-corps-ember,jderr-mx/code-corps-ember,code-corps/code-corps-ember | yaml | ## Code Before:
machine:
node:
version: 4.4.5
dependencies:
cache_directories:
- /home/ubuntu/nvm/versions/node/v4.4.5/bin
- /home/ubuntu/nvm/versions/node/v4.4.5/lib/node_modules
- node_modules
- bower_components
override:
- npm install -g bower
- npm install --cache-min Infinity
- bower install
- npm rebuild node-sass
deployment:
production:
branch: master
commands:
- 'node_modules/.bin/ember deploy production --activate'
staging:
branch: develop
commands:
- 'node_modules/.bin/ember deploy staging --activate'
## Instruction:
Revert "Circle CI script changes for faster build times"
## Code After:
machine:
node:
version: 4.4.5
dependencies:
cache_directories:
- /home/ubuntu/nvm/versions/node/v4.4.5/bin
- /home/ubuntu/nvm/versions/node/v4.4.5/lib/node_modules
- node_modules
- bower_components
override:
- npm install -g bower
- npm install
- bower install
- npm rebuild node-sass
deployment:
production:
branch: master
commands:
- 'node_modules/.bin/ember deploy production --activate'
staging:
branch: develop
commands:
- 'node_modules/.bin/ember deploy staging --activate'
| machine:
node:
version: 4.4.5
dependencies:
cache_directories:
- /home/ubuntu/nvm/versions/node/v4.4.5/bin
- /home/ubuntu/nvm/versions/node/v4.4.5/lib/node_modules
- node_modules
- bower_components
override:
- npm install -g bower
- - npm install --cache-min Infinity
+ - npm install
- bower install
- npm rebuild node-sass
deployment:
production:
branch: master
commands:
- 'node_modules/.bin/ember deploy production --activate'
staging:
branch: develop
commands:
- 'node_modules/.bin/ember deploy staging --activate' | 2 | 0.086957 | 1 | 1 |
3cdaafba7a31bcd6d3bf1f3902796c628529b57c | client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java | client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java | package com.opentable.jaxrs;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
import com.opentable.spring.SpecializedConfigFactory;
@Configuration
public class JaxRsClientConfiguration {
@Bean
SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
}
@Bean
JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
return new JaxRsClientFactory(config);
}
@Bean
JaxRsFeatureBinding dataUriHandler() {
return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
}
}
| package com.opentable.jaxrs;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
import com.opentable.spring.SpecializedConfigFactory;
@Configuration
public class JaxRsClientConfiguration {
@Bean
SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
}
@Bean
JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
return new JaxRsClientFactory(config);
}
@Bean
JaxRsFeatureBinding dataUriHandler() {
return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
}
@Bean
JaxRsFeatureBinding jsonFeature(ObjectMapper mapper) {
return JaxRsFeatureBinding.bindToAllGroups(JsonClientFeature.forMapper(mapper));
}
}
| Enable Jackson on jaxrs clients | Enable Jackson on jaxrs clients
| Java | apache-2.0 | sannessa/otj-jaxrs,opentable/otj-jaxrs | java | ## Code Before:
package com.opentable.jaxrs;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
import com.opentable.spring.SpecializedConfigFactory;
@Configuration
public class JaxRsClientConfiguration {
@Bean
SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
}
@Bean
JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
return new JaxRsClientFactory(config);
}
@Bean
JaxRsFeatureBinding dataUriHandler() {
return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
}
}
## Instruction:
Enable Jackson on jaxrs clients
## Code After:
package com.opentable.jaxrs;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
import com.opentable.spring.SpecializedConfigFactory;
@Configuration
public class JaxRsClientConfiguration {
@Bean
SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
}
@Bean
JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
return new JaxRsClientFactory(config);
}
@Bean
JaxRsFeatureBinding dataUriHandler() {
return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
}
@Bean
JaxRsFeatureBinding jsonFeature(ObjectMapper mapper) {
return JaxRsFeatureBinding.bindToAllGroups(JsonClientFeature.forMapper(mapper));
}
}
| package com.opentable.jaxrs;
+
+ import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
import com.opentable.spring.SpecializedConfigFactory;
@Configuration
public class JaxRsClientConfiguration {
@Bean
SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
}
@Bean
JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
return new JaxRsClientFactory(config);
}
@Bean
JaxRsFeatureBinding dataUriHandler() {
return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
}
+
+ @Bean
+ JaxRsFeatureBinding jsonFeature(ObjectMapper mapper) {
+ return JaxRsFeatureBinding.bindToAllGroups(JsonClientFeature.forMapper(mapper));
+ }
} | 7 | 0.269231 | 7 | 0 |
f84b9c55d0b8a74436f089c2d6867d9ff5dc6e98 | packages/po/posix-pty.yaml | packages/po/posix-pty.yaml | homepage: https://bitbucket.org/merijnv/posix-pty
changelog-type: ''
hash: e63386021ec29d44457a6c6324808870ebdc4cf875d9131a4e592b5213863c05
test-bench-deps: {}
maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
synopsis: Pseudo terminal interaction with subprocesses.
changelog: ''
basic-deps:
bytestring: ! '>=0.10'
unix: ! '>=2.6'
base: ! '>=4 && <5'
process: ! '>=1.2'
all-versions:
- '0.2.1'
author: Merijn Verstraaten
latest: '0.2.1'
description-type: haddock
description: ! 'This package simplifies the creation of subprocesses that interact
with
their parent via a pseudo terminal (see @man pty@).'
license-name: BSD3
| homepage: https://bitbucket.org/merijnv/posix-pty
changelog-type: ''
hash: c814bcbe882faca6e0ff7651c88001021c62fff960300dc35ac612835626a51c
test-bench-deps:
bytestring: -any
base: -any
process: -any
posix-pty: -any
maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
synopsis: Pseudo terminal interaction with subprocesses.
changelog: ''
basic-deps:
bytestring: ! '>=0.10'
unix: ! '>=2.6'
base: ! '>=4 && <5'
process: ! '>=1.2'
all-versions:
- '0.2.1'
- '0.2.1.1'
author: Merijn Verstraaten
latest: '0.2.1.1'
description-type: haddock
description: ! 'This package simplifies the creation of subprocesses that interact
with
their parent via a pseudo terminal (see @man pty@).'
license-name: BSD3
| Update from Hackage at 2017-04-21T10:08:26Z | Update from Hackage at 2017-04-21T10:08:26Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: https://bitbucket.org/merijnv/posix-pty
changelog-type: ''
hash: e63386021ec29d44457a6c6324808870ebdc4cf875d9131a4e592b5213863c05
test-bench-deps: {}
maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
synopsis: Pseudo terminal interaction with subprocesses.
changelog: ''
basic-deps:
bytestring: ! '>=0.10'
unix: ! '>=2.6'
base: ! '>=4 && <5'
process: ! '>=1.2'
all-versions:
- '0.2.1'
author: Merijn Verstraaten
latest: '0.2.1'
description-type: haddock
description: ! 'This package simplifies the creation of subprocesses that interact
with
their parent via a pseudo terminal (see @man pty@).'
license-name: BSD3
## Instruction:
Update from Hackage at 2017-04-21T10:08:26Z
## Code After:
homepage: https://bitbucket.org/merijnv/posix-pty
changelog-type: ''
hash: c814bcbe882faca6e0ff7651c88001021c62fff960300dc35ac612835626a51c
test-bench-deps:
bytestring: -any
base: -any
process: -any
posix-pty: -any
maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
synopsis: Pseudo terminal interaction with subprocesses.
changelog: ''
basic-deps:
bytestring: ! '>=0.10'
unix: ! '>=2.6'
base: ! '>=4 && <5'
process: ! '>=1.2'
all-versions:
- '0.2.1'
- '0.2.1.1'
author: Merijn Verstraaten
latest: '0.2.1.1'
description-type: haddock
description: ! 'This package simplifies the creation of subprocesses that interact
with
their parent via a pseudo terminal (see @man pty@).'
license-name: BSD3
| homepage: https://bitbucket.org/merijnv/posix-pty
changelog-type: ''
- hash: e63386021ec29d44457a6c6324808870ebdc4cf875d9131a4e592b5213863c05
+ hash: c814bcbe882faca6e0ff7651c88001021c62fff960300dc35ac612835626a51c
- test-bench-deps: {}
? ---
+ test-bench-deps:
+ bytestring: -any
+ base: -any
+ process: -any
+ posix-pty: -any
maintainer: Merijn Verstraaten <merijn@inconsistent.nl>
synopsis: Pseudo terminal interaction with subprocesses.
changelog: ''
basic-deps:
bytestring: ! '>=0.10'
unix: ! '>=2.6'
base: ! '>=4 && <5'
process: ! '>=1.2'
all-versions:
- '0.2.1'
+ - '0.2.1.1'
author: Merijn Verstraaten
- latest: '0.2.1'
+ latest: '0.2.1.1'
? ++
description-type: haddock
description: ! 'This package simplifies the creation of subprocesses that interact
with
their parent via a pseudo terminal (see @man pty@).'
license-name: BSD3 | 11 | 0.5 | 8 | 3 |
4f851278f843c040e1fd83901a36140c13181a56 | README.md | README.md |
<img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
Dotenv-expand adds variable expansion on top of
[dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
expand environment variables already existing on your machine, then
dotenv-expand is your tool.
[](https://travis-ci.org/motdotla/dotenv-expand)
[](https://www.npmjs.com/package/dotenv-expand)
[](https://github.com/feross/standard)
## Install
```bash
npm install dotenv --save
npm install dotenv-expand --save
```
## Usage
As early as possible in your application, require dotenv and dotenv-expand, and
wrap dotenv-expand around dotenv.
```js
var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand(myEnv)
```
See [test/.env](./test/.env) for examples of variable expansion in your `.env`
file.
|
<img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
Dotenv-expand adds variable expansion on top of
[dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
expand environment variables already existing on your machine, then
dotenv-expand is your tool.
[](https://travis-ci.org/motdotla/dotenv-expand)
[](https://www.npmjs.com/package/dotenv-expand)
[](https://github.com/feross/standard)
## Install
```bash
npm install dotenv --save
npm install dotenv-expand --save
```
## Usage
As early as possible in your application, require dotenv and dotenv-expand, and
wrap dotenv-expand around dotenv.
```js
var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand(myEnv)
```
See [test/.env](https://github.com/motdotla/dotenv-expand/blob/master/test/.env) for examples of variable expansion in your `.env`
file.
| Fix broken link to example env file | Fix broken link to example env file
| Markdown | bsd-2-clause | motdotla/dotenv-expand,motdotla/dotenv-expand,motdotla/dotenv-expand | markdown | ## Code Before:
<img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
Dotenv-expand adds variable expansion on top of
[dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
expand environment variables already existing on your machine, then
dotenv-expand is your tool.
[](https://travis-ci.org/motdotla/dotenv-expand)
[](https://www.npmjs.com/package/dotenv-expand)
[](https://github.com/feross/standard)
## Install
```bash
npm install dotenv --save
npm install dotenv-expand --save
```
## Usage
As early as possible in your application, require dotenv and dotenv-expand, and
wrap dotenv-expand around dotenv.
```js
var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand(myEnv)
```
See [test/.env](./test/.env) for examples of variable expansion in your `.env`
file.
## Instruction:
Fix broken link to example env file
## Code After:
<img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
Dotenv-expand adds variable expansion on top of
[dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
expand environment variables already existing on your machine, then
dotenv-expand is your tool.
[](https://travis-ci.org/motdotla/dotenv-expand)
[](https://www.npmjs.com/package/dotenv-expand)
[](https://github.com/feross/standard)
## Install
```bash
npm install dotenv --save
npm install dotenv-expand --save
```
## Usage
As early as possible in your application, require dotenv and dotenv-expand, and
wrap dotenv-expand around dotenv.
```js
var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand(myEnv)
```
See [test/.env](https://github.com/motdotla/dotenv-expand/blob/master/test/.env) for examples of variable expansion in your `.env`
file.
|
<img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
Dotenv-expand adds variable expansion on top of
[dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
expand environment variables already existing on your machine, then
dotenv-expand is your tool.
[](https://travis-ci.org/motdotla/dotenv-expand)
[](https://www.npmjs.com/package/dotenv-expand)
[](https://github.com/feross/standard)
## Install
```bash
npm install dotenv --save
npm install dotenv-expand --save
```
## Usage
As early as possible in your application, require dotenv and dotenv-expand, and
wrap dotenv-expand around dotenv.
```js
var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand(myEnv)
```
- See [test/.env](./test/.env) for examples of variable expansion in your `.env`
+ See [test/.env](https://github.com/motdotla/dotenv-expand/blob/master/test/.env) for examples of variable expansion in your `.env`
? ++++++++++++++ ++++++++++++++++++++++++++++++++++++++
- file.
? -
+ file.
| 4 | 0.114286 | 2 | 2 |
6b4e79044189e696611ee4bf5377e9c5707ebe9e | lib/index.js | lib/index.js | "use strict";
var Bluebird = require("bluebird");
var randWord = require("./cryptoRand");
module.exports = function (numAdjectives) {
if (!numAdjectives) {
numAdjectives = 2; // default
}
var promises = [];
for (var i = 0; i < numAdjectives; i += 1) {
promises.push(randWord.randomAdjective());
}
promises.push(randWord.randomAnimal());
return Bluebird.all(promises)
.then(function (parts) {
return parts.join("-");
});
}; | "use strict";
var Bluebird = require("bluebird");
var randWord = require("./cryptoRand");
var capitalize = function(word) {
return word.charAt(0).toUpperCase() + word.slice(1);
};
module.exports = function (numAdjectives) {
if (!numAdjectives) {
numAdjectives = 2; // default
}
var promises = [];
for (var i = 0; i < numAdjectives; i += 1) {
promises.push(randWord.randomAdjective());
}
promises.push(randWord.randomAnimal());
return Bluebird.all(promises)
.then(function (parts) {
return parts.map(function(part){return capitalize(part)}).join("");
});
}; | Change word joining format to match gfycat (PascalCase) | Change word joining format to match gfycat (PascalCase)
| JavaScript | mit | gswalden/adjective-adjective-animal,a-type/adjective-adjective-animal,a-type/adjective-adjective-animal | javascript | ## Code Before:
"use strict";
var Bluebird = require("bluebird");
var randWord = require("./cryptoRand");
module.exports = function (numAdjectives) {
if (!numAdjectives) {
numAdjectives = 2; // default
}
var promises = [];
for (var i = 0; i < numAdjectives; i += 1) {
promises.push(randWord.randomAdjective());
}
promises.push(randWord.randomAnimal());
return Bluebird.all(promises)
.then(function (parts) {
return parts.join("-");
});
};
## Instruction:
Change word joining format to match gfycat (PascalCase)
## Code After:
"use strict";
var Bluebird = require("bluebird");
var randWord = require("./cryptoRand");
var capitalize = function(word) {
return word.charAt(0).toUpperCase() + word.slice(1);
};
module.exports = function (numAdjectives) {
if (!numAdjectives) {
numAdjectives = 2; // default
}
var promises = [];
for (var i = 0; i < numAdjectives; i += 1) {
promises.push(randWord.randomAdjective());
}
promises.push(randWord.randomAnimal());
return Bluebird.all(promises)
.then(function (parts) {
return parts.map(function(part){return capitalize(part)}).join("");
});
}; | "use strict";
var Bluebird = require("bluebird");
var randWord = require("./cryptoRand");
+
+ var capitalize = function(word) {
+ return word.charAt(0).toUpperCase() + word.slice(1);
+ };
module.exports = function (numAdjectives) {
if (!numAdjectives) {
numAdjectives = 2; // default
}
var promises = [];
for (var i = 0; i < numAdjectives; i += 1) {
promises.push(randWord.randomAdjective());
}
promises.push(randWord.randomAnimal());
return Bluebird.all(promises)
.then(function (parts) {
- return parts.join("-");
+ return parts.map(function(part){return capitalize(part)}).join("");
});
}; | 6 | 0.285714 | 5 | 1 |
3653c16972497f778eb2d93fa277ce7979bc9063 | PLAYER/BACK/profile_picture_home.php | PLAYER/BACK/profile_picture_home.php | <?php
/**
* Created by PhpStorm.
* User: Catalin
* Date: 03-Jun-17
* Time: 13:59
*/
include ("../../BACK/conectare_db.php");
$username = $_SESSION["username"];
$stid = oci_parse($connection, 'SELECT LINK FROM player WHERE username = :username');
oci_bind_by_name($stid, ':username', $username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
$link = $row[0];
oci_free_statement($stid);
if (strcmp($link,'k') == 0)
echo '<img src="../../../IMG/OTHER/user_icon.jpg" style="max-width:75%; max-height:75%;" alt="alt">';
else
echo '<img src="../'. $link . '" style="max-width:75%; max-height:75%;" alt="alt">';
| <?php
/**
* Created by PhpStorm.
* User: Catalin
* Date: 03-Jun-17
* Time: 13:59
*/
include ("../../BACK/conectare_db.php");
$username = $_SESSION["username"];
$stid = oci_parse($connection, 'SELECT LINK FROM player WHERE username = :username');
oci_bind_by_name($stid, ':username', $username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
$link = $row[0];
oci_free_statement($stid);
if (strcmp($link,'k') == 0)
echo '<img src="../../../IMG/OTHER/user_icon.jpg' . filemtime($link) .'" style="max-width:75%; max-height:75%;" alt="alt">';
else
echo '<img src="../'. $link . '" style="max-width:75%; max-height:75%;" alt="alt">';
| Update avatar when is changed | Update avatar when is changed | PHP | mit | stefan-platon/Proiect-TW,stefan-platon/Proiect-TW,stefan-platon/Proiect-TW | php | ## Code Before:
<?php
/**
* Created by PhpStorm.
* User: Catalin
* Date: 03-Jun-17
* Time: 13:59
*/
include ("../../BACK/conectare_db.php");
$username = $_SESSION["username"];
$stid = oci_parse($connection, 'SELECT LINK FROM player WHERE username = :username');
oci_bind_by_name($stid, ':username', $username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
$link = $row[0];
oci_free_statement($stid);
if (strcmp($link,'k') == 0)
echo '<img src="../../../IMG/OTHER/user_icon.jpg" style="max-width:75%; max-height:75%;" alt="alt">';
else
echo '<img src="../'. $link . '" style="max-width:75%; max-height:75%;" alt="alt">';
## Instruction:
Update avatar when is changed
## Code After:
<?php
/**
* Created by PhpStorm.
* User: Catalin
* Date: 03-Jun-17
* Time: 13:59
*/
include ("../../BACK/conectare_db.php");
$username = $_SESSION["username"];
$stid = oci_parse($connection, 'SELECT LINK FROM player WHERE username = :username');
oci_bind_by_name($stid, ':username', $username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
$link = $row[0];
oci_free_statement($stid);
if (strcmp($link,'k') == 0)
echo '<img src="../../../IMG/OTHER/user_icon.jpg' . filemtime($link) .'" style="max-width:75%; max-height:75%;" alt="alt">';
else
echo '<img src="../'. $link . '" style="max-width:75%; max-height:75%;" alt="alt">';
| <?php
/**
* Created by PhpStorm.
* User: Catalin
* Date: 03-Jun-17
* Time: 13:59
*/
include ("../../BACK/conectare_db.php");
$username = $_SESSION["username"];
$stid = oci_parse($connection, 'SELECT LINK FROM player WHERE username = :username');
oci_bind_by_name($stid, ':username', $username);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
$link = $row[0];
oci_free_statement($stid);
if (strcmp($link,'k') == 0)
- echo '<img src="../../../IMG/OTHER/user_icon.jpg" style="max-width:75%; max-height:75%;" alt="alt">';
+ echo '<img src="../../../IMG/OTHER/user_icon.jpg' . filemtime($link) .'" style="max-width:75%; max-height:75%;" alt="alt">';
? +++++++++++++++++++++++
else
echo '<img src="../'. $link . '" style="max-width:75%; max-height:75%;" alt="alt">';
| 2 | 0.086957 | 1 | 1 |
6d83b3f84ddb9ec142c8094836ec836e1c99e3d9 | src/scenescroller.js | src/scenescroller.js | /* global window */
/**
* @module SceneScroller
*/
'use strict';
/**
* @namespace SceneScroller
*/
var SceneScroller = {}
/**
* @property {String} version The version of this SceneScroller distribution.
*/
SceneScroller.version = require('../package.json').version
/**
* @property {Class} EventEmitter
* @see [EventEmitter](./eventemitter.md)
*/
SceneScroller.EventEmitter = require('./eventemitter')
/**
* @property {Class} Node
* @see [Node](./node.md)
*/
SceneScroller.Node = require('./node')
/**
* @property {Class} Entity
* @see [Entity](./entity.md)
*/
SceneScroller.Entity = require('./entity')
/**
* @property {Object} symbols
* @see [symbols](./symbols.md)
*/
SceneScroller.symbols = require('./symbols')
/**
* @property {Object} util
* @see [util](./util.md)
*/
SceneScroller.util = require('./util')
module.exports = SceneScroller
if(window) {
window.SceneScroller = SceneScroller
}
| /* global window */
/**
* @module SceneScroller
*/
'use strict';
/**
* @namespace SceneScroller
*/
var SceneScroller = {}
/**
* @property {String} version The version of this SceneScroller distribution.
*/
SceneScroller.version = require('../package.json').version
/**
* @property {Class} EventEmitter
* @see [EventEmitter](./eventemitter.md)
*/
SceneScroller.EventEmitter = require('./eventemitter')
/**
* @property {Class} Node
* @see [Node](./node.md)
*/
SceneScroller.Node = require('./node')
/**
* @property {Class} Entity
* @see [Entity](./entity.md)
*/
SceneScroller.Entity = require('./entity')
/**
* @property {Class} Scene
* @see [Scene](./scene.md)
*/
SceneScroller.Scene= require('./scene')
/**
* @property {Object} symbols
* @see [symbols](./symbols.md)
*/
SceneScroller.symbols = require('./symbols')
/**
* @property {Object} util
* @see [util](./util.md)
*/
SceneScroller.util = require('./util')
module.exports = SceneScroller
if(window) {
window.SceneScroller = SceneScroller
}
| Add Scene class to SceneScroller object | Add Scene class to SceneScroller object
| JavaScript | mit | leftees/scene-scroller,leftees/scene-scroller | javascript | ## Code Before:
/* global window */
/**
* @module SceneScroller
*/
'use strict';
/**
* @namespace SceneScroller
*/
var SceneScroller = {}
/**
* @property {String} version The version of this SceneScroller distribution.
*/
SceneScroller.version = require('../package.json').version
/**
* @property {Class} EventEmitter
* @see [EventEmitter](./eventemitter.md)
*/
SceneScroller.EventEmitter = require('./eventemitter')
/**
* @property {Class} Node
* @see [Node](./node.md)
*/
SceneScroller.Node = require('./node')
/**
* @property {Class} Entity
* @see [Entity](./entity.md)
*/
SceneScroller.Entity = require('./entity')
/**
* @property {Object} symbols
* @see [symbols](./symbols.md)
*/
SceneScroller.symbols = require('./symbols')
/**
* @property {Object} util
* @see [util](./util.md)
*/
SceneScroller.util = require('./util')
module.exports = SceneScroller
if(window) {
window.SceneScroller = SceneScroller
}
## Instruction:
Add Scene class to SceneScroller object
## Code After:
/* global window */
/**
* @module SceneScroller
*/
'use strict';
/**
* @namespace SceneScroller
*/
var SceneScroller = {}
/**
* @property {String} version The version of this SceneScroller distribution.
*/
SceneScroller.version = require('../package.json').version
/**
* @property {Class} EventEmitter
* @see [EventEmitter](./eventemitter.md)
*/
SceneScroller.EventEmitter = require('./eventemitter')
/**
* @property {Class} Node
* @see [Node](./node.md)
*/
SceneScroller.Node = require('./node')
/**
* @property {Class} Entity
* @see [Entity](./entity.md)
*/
SceneScroller.Entity = require('./entity')
/**
* @property {Class} Scene
* @see [Scene](./scene.md)
*/
SceneScroller.Scene= require('./scene')
/**
* @property {Object} symbols
* @see [symbols](./symbols.md)
*/
SceneScroller.symbols = require('./symbols')
/**
* @property {Object} util
* @see [util](./util.md)
*/
SceneScroller.util = require('./util')
module.exports = SceneScroller
if(window) {
window.SceneScroller = SceneScroller
}
| /* global window */
/**
* @module SceneScroller
*/
'use strict';
/**
* @namespace SceneScroller
*/
var SceneScroller = {}
/**
* @property {String} version The version of this SceneScroller distribution.
*/
SceneScroller.version = require('../package.json').version
/**
* @property {Class} EventEmitter
* @see [EventEmitter](./eventemitter.md)
*/
SceneScroller.EventEmitter = require('./eventemitter')
/**
* @property {Class} Node
* @see [Node](./node.md)
*/
SceneScroller.Node = require('./node')
/**
* @property {Class} Entity
* @see [Entity](./entity.md)
*/
SceneScroller.Entity = require('./entity')
/**
+ * @property {Class} Scene
+ * @see [Scene](./scene.md)
+ */
+ SceneScroller.Scene= require('./scene')
+
+ /**
* @property {Object} symbols
* @see [symbols](./symbols.md)
*/
SceneScroller.symbols = require('./symbols')
/**
* @property {Object} util
* @see [util](./util.md)
*/
SceneScroller.util = require('./util')
module.exports = SceneScroller
if(window) {
window.SceneScroller = SceneScroller
} | 6 | 0.113208 | 6 | 0 |
a869d330bc2fb7220ee83fd157e2aa234026d778 | src/Backend/Modules/Search/Js/Search.js | src/Backend/Modules/Search/Js/Search.js | /**
* All methods related to the search
*/
jsBackend.search =
{
// init, something like a constructor
init: function()
{
$synonymBox = $('input.synonymBox');
// synonyms box
if($synonymBox.length > 0)
{
$synonymBox.multipleTextbox(
{
emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
});
}
// settings enable/disable
$('#searchModules input[type=checkbox]').on('change', function()
{
$this = $(this);
if($this.is(':checked')) { $('#' + $this.attr('id') + 'Weight').removeAttr('disabled').removeClass('disabled'); }
else { $('#' + $this.attr('id') + 'Weight').prop('disabled', true).addClass('disabled'); }
});
}
};
$(jsBackend.search.init);
| /**
* All methods related to the search
*/
jsBackend.search = {
init: function() {
var $synonymBox = $('input.synonymBox');
// synonyms box
if ($synonymBox.length > 0) {
$synonymBox.multipleTextbox({
emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
});
}
// settings enable/disable
$('#searchModules').find('input[type=checkbox]').on('change', function() {
var $this = $(this);
var $weightElement = $('#' + $this.attr('id') + 'Weight');
if ($this.is(':checked')) {
$weightElement.removeAttr('disabled').removeClass('disabled');
return;
}
$weightElement.prop('disabled', true).addClass('disabled');
});
}
};
$(jsBackend.search.init);
| Clean up backen search js | Clean up backen search js
| JavaScript | mit | Katrienvh/forkcms,carakas/forkcms,sumocoders/forkcms,jonasdekeukelaere/forkcms,carakas/forkcms,jessedobbelaere/forkcms,bartdc/forkcms,DegradationOfMankind/forkcms,sumocoders/forkcms,jacob-v-dam/forkcms,bartdc/forkcms,tommyvdv/forkcms,riadvice/forkcms,jonasdekeukelaere/forkcms,jonasdekeukelaere/forkcms,jeroendesloovere/forkcms,Katrienvh/forkcms,jeroendesloovere/forkcms,forkcms/forkcms,carakas/forkcms,tommyvdv/forkcms,jessedobbelaere/forkcms,justcarakas/forkcms,Katrienvh/forkcms,sumocoders/forkcms,DegradationOfMankind/forkcms,DegradationOfMankind/forkcms,DegradationOfMankind/forkcms,forkcms/forkcms,Katrienvh/forkcms,riadvice/forkcms,jessedobbelaere/forkcms,jeroendesloovere/forkcms,jessedobbelaere/forkcms,bartdc/forkcms,jacob-v-dam/forkcms,mathiashelin/forkcms,carakas/forkcms,mathiashelin/forkcms,sumocoders/forkcms,mathiashelin/forkcms,jacob-v-dam/forkcms,justcarakas/forkcms,tommyvdv/forkcms,tommyvdv/forkcms,mathiashelin/forkcms,jacob-v-dam/forkcms,sumocoders/forkcms,justcarakas/forkcms,riadvice/forkcms,carakas/forkcms,jonasdekeukelaere/forkcms,forkcms/forkcms,riadvice/forkcms,jonasdekeukelaere/forkcms,forkcms/forkcms,jeroendesloovere/forkcms | javascript | ## Code Before:
/**
* All methods related to the search
*/
jsBackend.search =
{
// init, something like a constructor
init: function()
{
$synonymBox = $('input.synonymBox');
// synonyms box
if($synonymBox.length > 0)
{
$synonymBox.multipleTextbox(
{
emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
});
}
// settings enable/disable
$('#searchModules input[type=checkbox]').on('change', function()
{
$this = $(this);
if($this.is(':checked')) { $('#' + $this.attr('id') + 'Weight').removeAttr('disabled').removeClass('disabled'); }
else { $('#' + $this.attr('id') + 'Weight').prop('disabled', true).addClass('disabled'); }
});
}
};
$(jsBackend.search.init);
## Instruction:
Clean up backen search js
## Code After:
/**
* All methods related to the search
*/
jsBackend.search = {
init: function() {
var $synonymBox = $('input.synonymBox');
// synonyms box
if ($synonymBox.length > 0) {
$synonymBox.multipleTextbox({
emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
});
}
// settings enable/disable
$('#searchModules').find('input[type=checkbox]').on('change', function() {
var $this = $(this);
var $weightElement = $('#' + $this.attr('id') + 'Weight');
if ($this.is(':checked')) {
$weightElement.removeAttr('disabled').removeClass('disabled');
return;
}
$weightElement.prop('disabled', true).addClass('disabled');
});
}
};
$(jsBackend.search.init);
| /**
* All methods related to the search
*/
- jsBackend.search =
+ jsBackend.search = {
? ++
- {
- // init, something like a constructor
- init: function()
? --
+ init: function() {
? ++
- {
- $synonymBox = $('input.synonymBox');
? ^^^
+ var $synonymBox = $('input.synonymBox');
? ^^^
- // synonyms box
? ----
+ // synonyms box
- if($synonymBox.length > 0)
? ----
+ if ($synonymBox.length > 0) {
? + ++
- {
- $synonymBox.multipleTextbox(
? ------
+ $synonymBox.multipleTextbox({
? +
- {
- emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
? --------
+ emptyMessage: jsBackend.locale.msg('NoSynonymsBox'),
- addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
? --------
+ addLabel: utils.string.ucfirst(jsBackend.locale.lbl('Add')),
- removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
? --------
+ removeLabel: utils.string.ucfirst(jsBackend.locale.lbl('DeleteSynonym'))
- });
- }
? --
+ });
? ++
+ }
- // settings enable/disable
? ----
+ // settings enable/disable
- $('#searchModules input[type=checkbox]').on('change', function()
? ---- ^
+ $('#searchModules').find('input[type=checkbox]').on('change', function() {
? ^^^^^^^^^ ++
- {
- $this = $(this);
? ^^^^^
+ var $this = $(this);
? ^^^
+ var $weightElement = $('#' + $this.attr('id') + 'Weight');
- if($this.is(':checked')) { $('#' + $this.attr('id') + 'Weight').removeAttr('disabled').removeClass('disabled'); }
- else { $('#' + $this.attr('id') + 'Weight').prop('disabled', true).addClass('disabled'); }
- });
+ if ($this.is(':checked')) {
+ $weightElement.removeAttr('disabled').removeClass('disabled');
+
+ return;
- }
+ }
? ++
+
+ $weightElement.prop('disabled', true).addClass('disabled');
+ });
+ }
};
$(jsBackend.search.init); | 48 | 1.454545 | 24 | 24 |
6f8e01bb185a3d9bf9bda12c2f6675e1e6bc3cbc | dev-server.js | dev-server.js | 'use strict';
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./config/webpack.config');
var port = 4000;
var ip = '0.0.0.0';
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
}).listen(port, ip, function (err) {
if(err) {
return console.log(err);
}
console.log('Listening at ' + ip + ':' + port);
});
| 'use strict';
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./config/webpack.config');
var port = 4000;
var ip = '0.0.0.0';
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
}).listen(port, ip, function (err) {
if(err) {
return console.log(err);
}
console.log('Listening at ' + ip + ':' + port);
});
| Allow development server to be accessed from any url | Allow development server to be accessed from any url
Just needed to set `historyApiFallback` as `true`.
| JavaScript | mit | koodilehto/koodilehto-crm-frontend,bebraw/react-crm-frontend,koodilehto/koodilehto-crm-frontend,bebraw/react-crm-frontend | javascript | ## Code Before:
'use strict';
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./config/webpack.config');
var port = 4000;
var ip = '0.0.0.0';
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
}).listen(port, ip, function (err) {
if(err) {
return console.log(err);
}
console.log('Listening at ' + ip + ':' + port);
});
## Instruction:
Allow development server to be accessed from any url
Just needed to set `historyApiFallback` as `true`.
## Code After:
'use strict';
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./config/webpack.config');
var port = 4000;
var ip = '0.0.0.0';
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
}).listen(port, ip, function (err) {
if(err) {
return console.log(err);
}
console.log('Listening at ' + ip + ':' + port);
});
| 'use strict';
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./config/webpack.config');
var port = 4000;
var ip = '0.0.0.0';
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
+ historyApiFallback: true,
}).listen(port, ip, function (err) {
if(err) {
return console.log(err);
}
console.log('Listening at ' + ip + ':' + port);
}); | 1 | 0.052632 | 1 | 0 |
8839a3f7b5b6b86b4986068ca603dca1ba1bdb82 | shell/zsh/gcloud.zsh | shell/zsh/gcloud.zsh | export GOOGLE_CLOUD_SDK_HOME="${GOOGLE_CLOUD_SDK_HOME:/opt/google-cloud-sdk}"
if [[ -a $GOOGLE_CLOUD_SDK_HOME ]]
then
[ -f ${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc ] && . "${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc"
fi
| [ -d /opt/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/opt/google-cloud-sdk"
[ -d /usr/share/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/usr/share/google-cloud-sdk"
if [[ -d $GOOGLE_CLOUD_SDK_HOME ]]
then
[ -f ${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc ] && . "${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc"
fi
| Support google cloud SDK on Ubuntu | Support google cloud SDK on Ubuntu
| Shell | mit | steakunderscore/dotfiles,steakunderscore/dotfiles,steakunderscore/dotfiles | shell | ## Code Before:
export GOOGLE_CLOUD_SDK_HOME="${GOOGLE_CLOUD_SDK_HOME:/opt/google-cloud-sdk}"
if [[ -a $GOOGLE_CLOUD_SDK_HOME ]]
then
[ -f ${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc ] && . "${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc"
fi
## Instruction:
Support google cloud SDK on Ubuntu
## Code After:
[ -d /opt/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/opt/google-cloud-sdk"
[ -d /usr/share/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/usr/share/google-cloud-sdk"
if [[ -d $GOOGLE_CLOUD_SDK_HOME ]]
then
[ -f ${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc ] && . "${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc"
fi
| - export GOOGLE_CLOUD_SDK_HOME="${GOOGLE_CLOUD_SDK_HOME:/opt/google-cloud-sdk}"
+ [ -d /opt/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/opt/google-cloud-sdk"
+ [ -d /usr/share/google-cloud-sdk ] && export GOOGLE_CLOUD_SDK_HOME="/usr/share/google-cloud-sdk"
+
- if [[ -a $GOOGLE_CLOUD_SDK_HOME ]]
? ^
+ if [[ -d $GOOGLE_CLOUD_SDK_HOME ]]
? ^
then
[ -f ${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc ] && . "${GOOGLE_CLOUD_SDK_HOME}/completion.zsh.inc"
fi | 6 | 1.2 | 4 | 2 |
6fe495c4f0dd3be4c3e5892e49ae5d2b35e809f6 | README.md | README.md | ===============================
A patient matching test harness to support PCOR
Environment
-----------
This project currently uses Go 1.5 and is built using the Go toolchain.
To install Go, follow the instructions found at the [Go Website](http://golang.org/doc/install).
Following standard Go practices, you should clone this project to:
$GOPATH/src/github.com/ ... TBD
To get all of the dependencies for this project, run:
go get
and, to retrieve test dependencies,
go get -t
in this directory.
To run all of the tests for this project, run:
go test ./...
in this directory.
This project also requires MongoDB 3.0.* or higher. To install MongoDB, refer to the
[MongoDB installation guide](http://docs.mongodb.org/manual/installation/).
To start the application, simply run server.go:
go run main.go
| ===============================
A patient matching test harness to support PCOR
Environment
-----------
This project currently uses Go 1.5 and is built using the Go toolchain.
To install Go, follow the instructions found at the [Go Website](http://golang.org/doc/install).
Following standard Go practices, you should clone this project to:
$GOPATH/src/github.com/mitre/ptmatch
Assuming your working directory is $GOPATH/src/github.com/mitre, the git command will look like:
git clone https://github.com/mitre/ptmatch.git
To get all of the dependencies for this project, run:
go get
and, to retrieve test dependencies,
go get -t
in this directory.
To run all of the tests for this project, run:
go test ./...
in this directory.
This project also requires MongoDB 3.0.* or higher. To install MongoDB, refer to the
[MongoDB installation guide](http://docs.mongodb.org/manual/installation/).
To start the application, simply run main.go:
go run main.go
| Add minor detail to readme | Add minor detail to readme
| Markdown | apache-2.0 | mitre/ptmatch,mitre/ptmatch,mitre/ptmatch | markdown | ## Code Before:
===============================
A patient matching test harness to support PCOR
Environment
-----------
This project currently uses Go 1.5 and is built using the Go toolchain.
To install Go, follow the instructions found at the [Go Website](http://golang.org/doc/install).
Following standard Go practices, you should clone this project to:
$GOPATH/src/github.com/ ... TBD
To get all of the dependencies for this project, run:
go get
and, to retrieve test dependencies,
go get -t
in this directory.
To run all of the tests for this project, run:
go test ./...
in this directory.
This project also requires MongoDB 3.0.* or higher. To install MongoDB, refer to the
[MongoDB installation guide](http://docs.mongodb.org/manual/installation/).
To start the application, simply run server.go:
go run main.go
## Instruction:
Add minor detail to readme
## Code After:
===============================
A patient matching test harness to support PCOR
Environment
-----------
This project currently uses Go 1.5 and is built using the Go toolchain.
To install Go, follow the instructions found at the [Go Website](http://golang.org/doc/install).
Following standard Go practices, you should clone this project to:
$GOPATH/src/github.com/mitre/ptmatch
Assuming your working directory is $GOPATH/src/github.com/mitre, the git command will look like:
git clone https://github.com/mitre/ptmatch.git
To get all of the dependencies for this project, run:
go get
and, to retrieve test dependencies,
go get -t
in this directory.
To run all of the tests for this project, run:
go test ./...
in this directory.
This project also requires MongoDB 3.0.* or higher. To install MongoDB, refer to the
[MongoDB installation guide](http://docs.mongodb.org/manual/installation/).
To start the application, simply run main.go:
go run main.go
| ===============================
A patient matching test harness to support PCOR
Environment
-----------
This project currently uses Go 1.5 and is built using the Go toolchain.
To install Go, follow the instructions found at the [Go Website](http://golang.org/doc/install).
Following standard Go practices, you should clone this project to:
- $GOPATH/src/github.com/ ... TBD
+ $GOPATH/src/github.com/mitre/ptmatch
+
+ Assuming your working directory is $GOPATH/src/github.com/mitre, the git command will look like:
+
+ git clone https://github.com/mitre/ptmatch.git
To get all of the dependencies for this project, run:
go get
and, to retrieve test dependencies,
go get -t
in this directory.
To run all of the tests for this project, run:
go test ./...
in this directory.
This project also requires MongoDB 3.0.* or higher. To install MongoDB, refer to the
[MongoDB installation guide](http://docs.mongodb.org/manual/installation/).
- To start the application, simply run server.go:
? ^^^^^^
+ To start the application, simply run main.go:
? ^^^^
go run main.go | 8 | 0.222222 | 6 | 2 |
38d4233dcea2257aa2ec1b39fddb730f60257f63 | app/assets/config/manifest.js | app/assets/config/manifest.js | //= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
| //= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link administrate/application.css
//= link administrate/application.js
| Add assets of administrate gem | Add assets of administrate gem
| JavaScript | mit | kenchan/tdnm,kenchan/tdnm,kenchan/tdnm,kenchan/tdnm | javascript | ## Code Before:
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
## Instruction:
Add assets of administrate gem
## Code After:
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link administrate/application.css
//= link administrate/application.js
| //= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
+
+ //= link administrate/application.css
+ //= link administrate/application.js | 3 | 1 | 3 | 0 |
ab3f7fcdae3189fff02c14ec2d66323ec10378c8 | README.md | README.md | Sudoku solver
=============
Implemented in C++. Uses the STL set templates.
Build
=====
The makefile is in the src directory.
cd src
make
Execute program
===============
Current directory src
./sudoku ../puzzles/Data01.sdk
Under construction.
| Sudoku solver
=============
Implemented in C++.
Implemented a Sudoku grid and rows, columns and blocks in STL sets.
Goal: solve Sudoku puzzle using set operations.
Build
=====
The makefile is in the src directory.
cd src
make
Execute program
===============
Current directory src
./sudoku ../puzzles/Data01.sdk
Under construction.
| Add more info about STL sets | Add more info about STL sets
| Markdown | mit | josokw/SudokuSolver,josokw/SudokuSolver | markdown | ## Code Before:
Sudoku solver
=============
Implemented in C++. Uses the STL set templates.
Build
=====
The makefile is in the src directory.
cd src
make
Execute program
===============
Current directory src
./sudoku ../puzzles/Data01.sdk
Under construction.
## Instruction:
Add more info about STL sets
## Code After:
Sudoku solver
=============
Implemented in C++.
Implemented a Sudoku grid and rows, columns and blocks in STL sets.
Goal: solve Sudoku puzzle using set operations.
Build
=====
The makefile is in the src directory.
cd src
make
Execute program
===============
Current directory src
./sudoku ../puzzles/Data01.sdk
Under construction.
| Sudoku solver
=============
- Implemented in C++. Uses the STL set templates.
+ Implemented in C++.
+ Implemented a Sudoku grid and rows, columns and blocks in STL sets.
+ Goal: solve Sudoku puzzle using set operations.
Build
=====
The makefile is in the src directory.
cd src
make
Execute program
===============
Current directory src
./sudoku ../puzzles/Data01.sdk
Under construction. | 4 | 0.181818 | 3 | 1 |
8e1778e49d63177804a577c98388c6934dd4ce21 | lib/tasks/grant_group_self_access.rb | lib/tasks/grant_group_self_access.rb |
namespace :cg do
desc "Gives groups self access; for use once in upgrading data to core."
task(:grant_group_self_access => :environment) do
Group.all.each do |group|
group.grant! group, :all
# if group is a council, only that council-group, not the parent-group,
# should have admin access over the parent-group
if group.council?
group.parent.grant! group, :all
group.parent.revoke! group.parent, :admin
end
#saving not necessary, right?
end
end
end
|
namespace :cg do
desc "Gives groups self access; for use once in upgrading data to core."
task(:grant_group_self_access => :environment) do
Group.all.each do |group|
group.grant! group, :all
# if group is a council, only that council-group, not the parent-group,
# should have admin access over the parent-group
if group.council? && group.parent #seem to be come cases where a council doesn't have a parent group.
group.parent.grant! group, :all
group.parent.revoke! group.parent, :admin
end
#saving not necessary, right?
end
end
end
| Tweak to task as there seem to be councils that don't have parent groups. | Tweak to task as there seem to be councils that don't have parent groups.
| Ruby | agpl-3.0 | elijh/crabgrass-core,elijh/crabgrass-core,elijh/crabgrass-core | ruby | ## Code Before:
namespace :cg do
desc "Gives groups self access; for use once in upgrading data to core."
task(:grant_group_self_access => :environment) do
Group.all.each do |group|
group.grant! group, :all
# if group is a council, only that council-group, not the parent-group,
# should have admin access over the parent-group
if group.council?
group.parent.grant! group, :all
group.parent.revoke! group.parent, :admin
end
#saving not necessary, right?
end
end
end
## Instruction:
Tweak to task as there seem to be councils that don't have parent groups.
## Code After:
namespace :cg do
desc "Gives groups self access; for use once in upgrading data to core."
task(:grant_group_self_access => :environment) do
Group.all.each do |group|
group.grant! group, :all
# if group is a council, only that council-group, not the parent-group,
# should have admin access over the parent-group
if group.council? && group.parent #seem to be come cases where a council doesn't have a parent group.
group.parent.grant! group, :all
group.parent.revoke! group.parent, :admin
end
#saving not necessary, right?
end
end
end
|
namespace :cg do
desc "Gives groups self access; for use once in upgrading data to core."
task(:grant_group_self_access => :environment) do
Group.all.each do |group|
group.grant! group, :all
# if group is a council, only that council-group, not the parent-group,
# should have admin access over the parent-group
- if group.council?
+ if group.council? && group.parent #seem to be come cases where a council doesn't have a parent group.
group.parent.grant! group, :all
group.parent.revoke! group.parent, :admin
end
#saving not necessary, right?
end
end
end
| 2 | 0.086957 | 1 | 1 |
2eaf7498391f87eed662f7ab35e9163d162d5c7a | ansible/roles/openshift_master_resource_quota/README.md | ansible/roles/openshift_master_resource_quota/README.md | openshift_master_resource_quota
=========
A role that deploys quotas for Openshift cluster resources
Requirements
------------
None
Role Variables
--------------
osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
osmrq_cluster_pv_quota: Cluster wide storage quota
osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
Dependencies
------------
lib_openshift
lib_yaml_editor
Example Playbook
----------------
- role: tools_roles/openshift_master_resource_quota
osmrq_enable_pv_quotas: True
osmrq_cluster_pv_quota: 100Gi
osmrq_exclude_pv_quota_label: exclude_pv_quota
osmrq_pv_projects_to_exclude:
- default
- openshift-infra
License
-------
Apache
Author Information
------------------
Openshift Operations
| openshift_master_resource_quota
=========
A role that deploys quotas for Openshift cluster resources
Requirements
------------
None
Role Variables
--------------
* osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
* osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
* osmrq_cluster_pv_quota: Cluster wide storage quota
* osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
* osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
* osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
* osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
* osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
Dependencies
------------
* lib_openshift
* lib_yaml_editor
Example Playbook
----------------
```yaml
- role: tools_roles/openshift_master_resource_quota
osmrq_enable_pv_quotas: True
osmrq_cluster_pv_quota: 100Gi
osmrq_exclude_pv_quota_label: exclude_pv_quota
osmrq_pv_projects_to_exclude:
- default
- openshift-infra
```
License
-------
Apache
Author Information
------------------
Openshift Operations
| Improve readability by using Markdown formatting | Improve readability by using Markdown formatting | Markdown | apache-2.0 | drewandersonnz/openshift-tools,blrm/openshift-tools,openshift/openshift-tools,blrm/openshift-tools,drewandersonnz/openshift-tools,blrm/openshift-tools,drewandersonnz/openshift-tools,openshift/openshift-tools,blrm/openshift-tools,openshift/openshift-tools,openshift/openshift-tools,drewandersonnz/openshift-tools,drewandersonnz/openshift-tools,openshift/openshift-tools,blrm/openshift-tools,drewandersonnz/openshift-tools,blrm/openshift-tools,openshift/openshift-tools | markdown | ## Code Before:
openshift_master_resource_quota
=========
A role that deploys quotas for Openshift cluster resources
Requirements
------------
None
Role Variables
--------------
osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
osmrq_cluster_pv_quota: Cluster wide storage quota
osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
Dependencies
------------
lib_openshift
lib_yaml_editor
Example Playbook
----------------
- role: tools_roles/openshift_master_resource_quota
osmrq_enable_pv_quotas: True
osmrq_cluster_pv_quota: 100Gi
osmrq_exclude_pv_quota_label: exclude_pv_quota
osmrq_pv_projects_to_exclude:
- default
- openshift-infra
License
-------
Apache
Author Information
------------------
Openshift Operations
## Instruction:
Improve readability by using Markdown formatting
## Code After:
openshift_master_resource_quota
=========
A role that deploys quotas for Openshift cluster resources
Requirements
------------
None
Role Variables
--------------
* osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
* osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
* osmrq_cluster_pv_quota: Cluster wide storage quota
* osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
* osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
* osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
* osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
* osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
Dependencies
------------
* lib_openshift
* lib_yaml_editor
Example Playbook
----------------
```yaml
- role: tools_roles/openshift_master_resource_quota
osmrq_enable_pv_quotas: True
osmrq_cluster_pv_quota: 100Gi
osmrq_exclude_pv_quota_label: exclude_pv_quota
osmrq_pv_projects_to_exclude:
- default
- openshift-infra
```
License
-------
Apache
Author Information
------------------
Openshift Operations
| openshift_master_resource_quota
=========
A role that deploys quotas for Openshift cluster resources
Requirements
------------
None
Role Variables
--------------
- osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
+ * osmrq_enable_pv_quotas: BOOL. Should pv quotas be enabled.
? ++
- osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
+ * osmrq_enable_service_lb_quotas: BOOL. Should service loadbalancer quotas be enabled.
? ++
- osmrq_cluster_pv_quota: Cluster wide storage quota
+ * osmrq_cluster_pv_quota: Cluster wide storage quota
? ++
- osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
+ * osmrq_cluster_service_lb_quota: Cluster wide service loadbalancer quota
? ++
- osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
+ * osmrq_exclude_pv_quota_label: label that will indicate project is excluded from PV quota
? ++
- osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
+ * osmrq_exclude_service_lb_quota_label: label that will indicate project is excluded from service loadbalancer quota
? ++
- osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
+ * osmrq_pv_projects_to_exclude: list of projects to exclude from the cluster pv quota
? ++
- osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
+ * osmrq_service_lb_projects_to_exclude: list of projects to exclude from the cluster service loadbalancer quota
? ++
Dependencies
------------
- lib_openshift
+ * lib_openshift
? ++
- lib_yaml_editor
+ * lib_yaml_editor
? ++
Example Playbook
----------------
+ ```yaml
- role: tools_roles/openshift_master_resource_quota
osmrq_enable_pv_quotas: True
osmrq_cluster_pv_quota: 100Gi
osmrq_exclude_pv_quota_label: exclude_pv_quota
osmrq_pv_projects_to_exclude:
- default
- openshift-infra
-
+ ```
License
-------
Apache
Author Information
------------------
Openshift Operations | 23 | 0.469388 | 12 | 11 |
da16e7386042b77c942924fcab6114116bc52ec8 | src/index.js | src/index.js | import {Configure} from './configure';
export function configure(aurelia, configCallback) {
var instance = aurelia.container.get(Configure);
// Do we have a callback function?
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(instance);
}
return new Promise((resolve, reject) => {
instance.loadConfig().then(data => {
instance.setAll(data);
resolve();
});
}).catch(() => {
reject(new Error('Configuration file could not be loaded'));
});
}
export {Configure};
| import {Configure} from './configure';
export function configure(aurelia, configCallback) {
var instance = aurelia.container.get(Configure);
// Do we have a callback function?
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(instance);
}
return new Promise((resolve, reject) => {
instance.loadConfig().then(data => {
instance.setAll(data);
// Gets the current pathName to determine dynamic environments (if defined)
instance.check();
resolve();
});
}).catch(() => {
reject(new Error('Configuration file could not be loaded'));
});
}
export {Configure};
| Call the check function during configuration phase | Call the check function during configuration phase
| JavaScript | mit | Vheissu/Aurelia-Configuration,JeroenVinke/Aurelia-Configuration,JoshMcCullough/Aurelia-Configuration,Vheissu/Aurelia-Configuration | javascript | ## Code Before:
import {Configure} from './configure';
export function configure(aurelia, configCallback) {
var instance = aurelia.container.get(Configure);
// Do we have a callback function?
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(instance);
}
return new Promise((resolve, reject) => {
instance.loadConfig().then(data => {
instance.setAll(data);
resolve();
});
}).catch(() => {
reject(new Error('Configuration file could not be loaded'));
});
}
export {Configure};
## Instruction:
Call the check function during configuration phase
## Code After:
import {Configure} from './configure';
export function configure(aurelia, configCallback) {
var instance = aurelia.container.get(Configure);
// Do we have a callback function?
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(instance);
}
return new Promise((resolve, reject) => {
instance.loadConfig().then(data => {
instance.setAll(data);
// Gets the current pathName to determine dynamic environments (if defined)
instance.check();
resolve();
});
}).catch(() => {
reject(new Error('Configuration file could not be loaded'));
});
}
export {Configure};
| import {Configure} from './configure';
export function configure(aurelia, configCallback) {
var instance = aurelia.container.get(Configure);
// Do we have a callback function?
if (configCallback !== undefined && typeof(configCallback) === 'function') {
configCallback(instance);
}
return new Promise((resolve, reject) => {
instance.loadConfig().then(data => {
instance.setAll(data);
+
+ // Gets the current pathName to determine dynamic environments (if defined)
+ instance.check();
resolve();
});
}).catch(() => {
reject(new Error('Configuration file could not be loaded'));
});
}
export {Configure}; | 3 | 0.142857 | 3 | 0 |
65a7d7ca02550d3a861f01d6c9b676e354ec5705 | Block/BlockEventListener.php | Block/BlockEventListener.php | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\UiBundle\Block;
use Sonata\BlockBundle\Event\BlockEvent;
use Sonata\BlockBundle\Model\Block;
final class BlockEventListener
{
/** @var string */
private $template;
public function __construct(string $template)
{
@trigger_error(
sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7. Use "sylius_ui" configuration instead.', self::class),
\E_USER_DEPRECATED
);
$this->template = $template;
}
public function onBlockEvent(BlockEvent $event): void
{
$block = new Block();
$block->setId(uniqid('', true));
$block->setSettings(array_replace($event->getSettings(), [
'template' => $this->template,
]));
$block->setType('sonata.block.service.template');
$event->addBlock($block);
}
}
| <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\UiBundle\Block;
use Sonata\BlockBundle\Event\BlockEvent;
use Sonata\BlockBundle\Model\Block;
final class BlockEventListener
{
/** @var string */
private $template;
public function __construct(string $template)
{
@trigger_error(
sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7 and will be removed in Sylius 2.0. Use "sylius_ui" configuration instead.', self::class),
\E_USER_DEPRECATED
);
$this->template = $template;
}
public function onBlockEvent(BlockEvent $event): void
{
$block = new Block();
$block->setId(uniqid('', true));
$block->setSettings(array_replace($event->getSettings(), [
'template' => $this->template,
]));
$block->setType('sonata.block.service.template');
$event->addBlock($block);
}
}
| Improve deprecation notices for new template events system | Improve deprecation notices for new template events system
| PHP | mit | Sylius/SyliusUiBundle,Sylius/SyliusUiBundle | php | ## Code Before:
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\UiBundle\Block;
use Sonata\BlockBundle\Event\BlockEvent;
use Sonata\BlockBundle\Model\Block;
final class BlockEventListener
{
/** @var string */
private $template;
public function __construct(string $template)
{
@trigger_error(
sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7. Use "sylius_ui" configuration instead.', self::class),
\E_USER_DEPRECATED
);
$this->template = $template;
}
public function onBlockEvent(BlockEvent $event): void
{
$block = new Block();
$block->setId(uniqid('', true));
$block->setSettings(array_replace($event->getSettings(), [
'template' => $this->template,
]));
$block->setType('sonata.block.service.template');
$event->addBlock($block);
}
}
## Instruction:
Improve deprecation notices for new template events system
## Code After:
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\UiBundle\Block;
use Sonata\BlockBundle\Event\BlockEvent;
use Sonata\BlockBundle\Model\Block;
final class BlockEventListener
{
/** @var string */
private $template;
public function __construct(string $template)
{
@trigger_error(
sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7 and will be removed in Sylius 2.0. Use "sylius_ui" configuration instead.', self::class),
\E_USER_DEPRECATED
);
$this->template = $template;
}
public function onBlockEvent(BlockEvent $event): void
{
$block = new Block();
$block->setId(uniqid('', true));
$block->setSettings(array_replace($event->getSettings(), [
'template' => $this->template,
]));
$block->setType('sonata.block.service.template');
$event->addBlock($block);
}
}
| <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\UiBundle\Block;
use Sonata\BlockBundle\Event\BlockEvent;
use Sonata\BlockBundle\Model\Block;
final class BlockEventListener
{
/** @var string */
private $template;
public function __construct(string $template)
{
@trigger_error(
- sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7. Use "sylius_ui" configuration instead.', self::class),
+ sprintf('Using "%s" to add blocks to the templates is deprecated since Sylius 1.7 and will be removed in Sylius 2.0. Use "sylius_ui" configuration instead.', self::class),
? ++++++++++++++++++++++++++++++++++
\E_USER_DEPRECATED
);
$this->template = $template;
}
public function onBlockEvent(BlockEvent $event): void
{
$block = new Block();
$block->setId(uniqid('', true));
$block->setSettings(array_replace($event->getSettings(), [
'template' => $this->template,
]));
$block->setType('sonata.block.service.template');
$event->addBlock($block);
}
} | 2 | 0.044444 | 1 | 1 |
0e995ab70af85b28980c3dced0fad3f7dbb68bcf | app/models/item.rb | app/models/item.rb | class Item < ApplicationRecord
attr_accessor :category_id
validates :name, presence: { message: "Name field can't be left blank"}, length: { in: 3..64, message: "Name must be between 3 and 64 characters in length" }
validates :description, presence: { message: "Description field can't be left blank" }, length: { in: 3..3000, message: "Description must be between 3 and 3,000 characters" }
validates :quantity, presence: { message: "Quantity field can't be left blank" }, numericality: { greater_than: 0, message: "Must be an integer greater than 0" }
# Price validation needs it to be in legit $10.99 value format
validates :price, presence: { message: "Price field can't be left blank"}
has_and_belongs_to_many :categories
serialize :category_id, Array
end
| class Item < ApplicationRecord
validates :name, presence: { message: "Name field can't be left blank"}, length: { in: 3..64, message: "Name must be between 3 and 64 characters in length" }
validates :description, presence: { message: "Description field can't be left blank" }, length: { in: 3..3000, message: "Description must be between 3 and 3,000 characters" }
validates :quantity, presence: { message: "Quantity field can't be left blank" }, numericality: { greater_than: 0, message: "Must be an integer greater than 0" }
# Price validation needs it to be in legit $10.99 value format
validates :price, presence: { message: "Price field can't be left blank"}
has_and_belongs_to_many :categories
serialize :category_id, Array
end
| Remove the attr_accessor, which was preventing me from updating changes when saving the database | Remove the attr_accessor, which was preventing me from updating changes when saving the database
| Ruby | mit | benjaminhyw/rails-online-shop,benjaminhyw/rails-online-shop,benjaminhyw/rails-online-shop | ruby | ## Code Before:
class Item < ApplicationRecord
attr_accessor :category_id
validates :name, presence: { message: "Name field can't be left blank"}, length: { in: 3..64, message: "Name must be between 3 and 64 characters in length" }
validates :description, presence: { message: "Description field can't be left blank" }, length: { in: 3..3000, message: "Description must be between 3 and 3,000 characters" }
validates :quantity, presence: { message: "Quantity field can't be left blank" }, numericality: { greater_than: 0, message: "Must be an integer greater than 0" }
# Price validation needs it to be in legit $10.99 value format
validates :price, presence: { message: "Price field can't be left blank"}
has_and_belongs_to_many :categories
serialize :category_id, Array
end
## Instruction:
Remove the attr_accessor, which was preventing me from updating changes when saving the database
## Code After:
class Item < ApplicationRecord
validates :name, presence: { message: "Name field can't be left blank"}, length: { in: 3..64, message: "Name must be between 3 and 64 characters in length" }
validates :description, presence: { message: "Description field can't be left blank" }, length: { in: 3..3000, message: "Description must be between 3 and 3,000 characters" }
validates :quantity, presence: { message: "Quantity field can't be left blank" }, numericality: { greater_than: 0, message: "Must be an integer greater than 0" }
# Price validation needs it to be in legit $10.99 value format
validates :price, presence: { message: "Price field can't be left blank"}
has_and_belongs_to_many :categories
serialize :category_id, Array
end
| class Item < ApplicationRecord
- attr_accessor :category_id
validates :name, presence: { message: "Name field can't be left blank"}, length: { in: 3..64, message: "Name must be between 3 and 64 characters in length" }
validates :description, presence: { message: "Description field can't be left blank" }, length: { in: 3..3000, message: "Description must be between 3 and 3,000 characters" }
validates :quantity, presence: { message: "Quantity field can't be left blank" }, numericality: { greater_than: 0, message: "Must be an integer greater than 0" }
# Price validation needs it to be in legit $10.99 value format
validates :price, presence: { message: "Price field can't be left blank"}
has_and_belongs_to_many :categories
serialize :category_id, Array
end | 1 | 0.083333 | 0 | 1 |
658b03990880ad5e3bf31ff0db1157eac5a4ced6 | .travis.yml | .travis.yml | language: python
python:
- 2.7
- 3.3
- 3.4
- 3.5
sudo: false
addons:
apt:
packages:
- python-numpy
install:
- pip install -r requirements_dev.txt
script:
- make tests
- if ! [ $TRAVIS_PYTHON_VERSION == "3.3" ]; then
make test-docs;
fi
after_success:
- bash <(curl -s https://codecov.io/bash)
- openssl aes-256-cbc -K $encrypted_de81f81dc49e_key -iv $encrypted_de81f81dc49e_iv -in .pypirc.enc -out ~/.pypirc -d
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
make publish;
fi
- if [ "$TRAVIS_BRANCH" = "beta" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$')" ]; then
make publish;
fi
notifications:
email: false
| language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
sudo: false
addons:
apt:
packages:
- python-numpy
install:
- pip install -r requirements_dev.txt
script:
- make tests
- make test-docs
after_success:
- bash <(curl -s https://codecov.io/bash)
- openssl aes-256-cbc -K $encrypted_de81f81dc49e_key -iv $encrypted_de81f81dc49e_iv -in .pypirc.enc -out ~/.pypirc -d
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
make publish;
fi
- if [ "$TRAVIS_BRANCH" = "beta" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$')" ]; then
make publish;
fi
notifications:
email: false
| Stop testing python 3.3, start testing 3.6 | Stop testing python 3.3, start testing 3.6
| YAML | mit | aranzgeo/omf,GMSGDataExchange/omf | yaml | ## Code Before:
language: python
python:
- 2.7
- 3.3
- 3.4
- 3.5
sudo: false
addons:
apt:
packages:
- python-numpy
install:
- pip install -r requirements_dev.txt
script:
- make tests
- if ! [ $TRAVIS_PYTHON_VERSION == "3.3" ]; then
make test-docs;
fi
after_success:
- bash <(curl -s https://codecov.io/bash)
- openssl aes-256-cbc -K $encrypted_de81f81dc49e_key -iv $encrypted_de81f81dc49e_iv -in .pypirc.enc -out ~/.pypirc -d
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
make publish;
fi
- if [ "$TRAVIS_BRANCH" = "beta" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$')" ]; then
make publish;
fi
notifications:
email: false
## Instruction:
Stop testing python 3.3, start testing 3.6
## Code After:
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
sudo: false
addons:
apt:
packages:
- python-numpy
install:
- pip install -r requirements_dev.txt
script:
- make tests
- make test-docs
after_success:
- bash <(curl -s https://codecov.io/bash)
- openssl aes-256-cbc -K $encrypted_de81f81dc49e_key -iv $encrypted_de81f81dc49e_iv -in .pypirc.enc -out ~/.pypirc -d
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
make publish;
fi
- if [ "$TRAVIS_BRANCH" = "beta" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$')" ]; then
make publish;
fi
notifications:
email: false
| language: python
python:
- 2.7
- - 3.3
- 3.4
- 3.5
+ - 3.6
sudo: false
addons:
apt:
packages:
- python-numpy
install:
- pip install -r requirements_dev.txt
script:
- make tests
- - if ! [ $TRAVIS_PYTHON_VERSION == "3.3" ]; then
- make test-docs;
? ^^^ -
+ - make test-docs
? ^
- fi
after_success:
- bash <(curl -s https://codecov.io/bash)
- openssl aes-256-cbc -K $encrypted_de81f81dc49e_key -iv $encrypted_de81f81dc49e_iv -in .pypirc.enc -out ~/.pypirc -d
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$')" ]; then
make publish;
fi
- if [ "$TRAVIS_BRANCH" = "beta" -a "$TRAVIS_PULL_REQUEST" = "false" -a $TRAVIS_PYTHON_VERSION == "2.7" -a -n "$(grep version setup.py | cut -d \' -f 2 | grep -E '^[0-9]+\.[0-9]+\.[0-9]+b[0-9]+$')" ]; then
make publish;
fi
notifications:
email: false | 6 | 0.171429 | 2 | 4 |
32efd4f956cc2e8202f9d0650517eb6486882443 | docs/_posts/2017-09-06-intro-f16.md | docs/_posts/2017-09-06-intro-f16.md | ---
layout: post
title: First Meeting -- What do we want to learn and teach?
comments: true
category: upcoming
tags: meeting
---
We usually have a "what to learn and teach" session the first week of the semester. This is a nice time for us to get together, do a round of introductions, see what we want to learn and teach, and then try to set as much of the schedule for the semester as we can. I'll also be sharing results from the topics survey, which are [here in this Jupyter notebook](https://github.com/thehackerwithin/berkeley/blob/master/code_examples/survey_f17/survey.ipynb).
| ---
layout: post
title: First Meeting -- What do we want to learn and teach?
comments: true
category: upcoming
tags: meeting
---
We usually have a "what to learn and teach" session the first week of the semester. This is a nice time for us to get together, do a round of introductions, see what we want to learn and teach, and then try to set as much of the schedule for the semester as we can. I'll also be sharing results from the topics survey, which are [here in this Jupyter notebook](https://github.com/thehackerwithin/berkeley/blob/master/code_examples/survey_f17/survey.ipynb).
Google doc for taking notes [here](https://docs.google.com/document/d/1OrRQOFhoBZy8BCmCuPU2wLV2lmuGFcU0ojS8dQ86HJQ/edit)
| ADD link to google doc | ADD link to google doc | Markdown | bsd-3-clause | thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley | markdown | ## Code Before:
---
layout: post
title: First Meeting -- What do we want to learn and teach?
comments: true
category: upcoming
tags: meeting
---
We usually have a "what to learn and teach" session the first week of the semester. This is a nice time for us to get together, do a round of introductions, see what we want to learn and teach, and then try to set as much of the schedule for the semester as we can. I'll also be sharing results from the topics survey, which are [here in this Jupyter notebook](https://github.com/thehackerwithin/berkeley/blob/master/code_examples/survey_f17/survey.ipynb).
## Instruction:
ADD link to google doc
## Code After:
---
layout: post
title: First Meeting -- What do we want to learn and teach?
comments: true
category: upcoming
tags: meeting
---
We usually have a "what to learn and teach" session the first week of the semester. This is a nice time for us to get together, do a round of introductions, see what we want to learn and teach, and then try to set as much of the schedule for the semester as we can. I'll also be sharing results from the topics survey, which are [here in this Jupyter notebook](https://github.com/thehackerwithin/berkeley/blob/master/code_examples/survey_f17/survey.ipynb).
Google doc for taking notes [here](https://docs.google.com/document/d/1OrRQOFhoBZy8BCmCuPU2wLV2lmuGFcU0ojS8dQ86HJQ/edit)
| ---
layout: post
title: First Meeting -- What do we want to learn and teach?
comments: true
category: upcoming
tags: meeting
---
We usually have a "what to learn and teach" session the first week of the semester. This is a nice time for us to get together, do a round of introductions, see what we want to learn and teach, and then try to set as much of the schedule for the semester as we can. I'll also be sharing results from the topics survey, which are [here in this Jupyter notebook](https://github.com/thehackerwithin/berkeley/blob/master/code_examples/survey_f17/survey.ipynb).
+
+ Google doc for taking notes [here](https://docs.google.com/document/d/1OrRQOFhoBZy8BCmCuPU2wLV2lmuGFcU0ojS8dQ86HJQ/edit) | 2 | 0.222222 | 2 | 0 |
2217944d2339b4474b3f895ed7cfa2f63528f607 | ckanext/mapactiontheme/templates/group/read.html | ckanext/mapactiontheme/templates/group/read.html | {% ckan_extends %}
{% block primary %}
<div id="product-details">
{{ super() }}
</div>
{% endblock %}
{% block secondary %}
{% endblock %}
| {% ckan_extends %}
{% block primary %}
<div id="product-details">
{{ super() }}
</div>
{% endblock %}
| Include side bar on group (event) index pages | Include side bar on group (event) index pages
for consistency and to show the event description text.
| HTML | agpl-3.0 | aptivate/ckanext-mapactiontheme,aptivate/ckanext-mapactiontheme,aptivate/ckanext-mapactiontheme,aptivate/ckanext-mapactiontheme,aptivate/ckanext-mapactiontheme | html | ## Code Before:
{% ckan_extends %}
{% block primary %}
<div id="product-details">
{{ super() }}
</div>
{% endblock %}
{% block secondary %}
{% endblock %}
## Instruction:
Include side bar on group (event) index pages
for consistency and to show the event description text.
## Code After:
{% ckan_extends %}
{% block primary %}
<div id="product-details">
{{ super() }}
</div>
{% endblock %}
| {% ckan_extends %}
{% block primary %}
<div id="product-details">
{{ super() }}
</div>
{% endblock %}
-
- {% block secondary %}
- {% endblock %}
-
- | 5 | 0.416667 | 0 | 5 |
f71c89b71e74bc942fb2eadb0351ac2c13120ed4 | src/components/file-upload/index.js | src/components/file-upload/index.js | import { h, Component } from 'preact';
import Dropzone from 'react-dropzone';
import style from './style';
export default class FileUpload extends Component {
constructor(props) {
super(props);
this.state = {
isFileSelected: false,
file: false,
};
this.handleFileDrop = this.handleFileDrop.bind(this);
}
handleFileDrop(acceptedFiles, rejectedFiles) {
this.setState({
...this.state,
isFileSelected: true,
file: acceptedFiles[0],
});
this.props.confirmChooseFile(this.state.file);
}
render(props, state) {
return (
<div class={`${style['file-upload']} container`}>
<div class="offset-by-three one column">
<Dropzone
onDrop={this.handleFileDrop}
multiple={false}
class={style['file']}
className={style['file']}
accept=".stl"
>
<div class={style['file__text']}>Přidejte model ve formátu STL přetáhnutím souboru nebo kliknutím</div>
</Dropzone>
</div>
{/*<div class={`one column offset-by-two ${style['button']}`}>*/}
{/*<button class="button-primary disabled" disabled={!state.isFileSelected} onClick={this.handleAnalyzeButtonClick} type="button">Go to details</button>*/}
{/*</div>*/}
</div>
);
}
}
| import { h, Component } from 'preact';
import Dropzone from 'react-dropzone';
import style from './style';
export default class FileUpload extends Component {
constructor(props) {
super(props);
this.dropzoneRef = null;
this.state = {
isFileSelected: false,
file: false,
};
this.handleFileDrop = this.handleFileDrop.bind(this);
}
handleFileDrop(acceptedFiles, rejectedFiles) {
this.setState({
...this.state,
isFileSelected: true,
file: acceptedFiles[0],
});
this.props.confirmChooseFile(this.state.file);
}
render(props, state) {
return (
<div class={`${style['file-upload']} container`}>
<div class="offset-by-three one column">
<Dropzone
onDrop={this.handleFileDrop}
multiple={false}
class={style['file']}
className={style['file']}
accept=".stl"
ref={(node) => { this.dropzoneRef = node; }}
>
<div class={style['file__text']}>Přidejte model ve formátu STL přetáhnutím souboru nebo kliknutím</div>
</Dropzone>
</div>
{/*<div class={`one column offset-by-two ${style['button']}`}>*/}
{/*<button class="button-primary disabled" disabled={!state.isFileSelected} onClick={this.handleAnalyzeButtonClick} type="button">Go to details</button>*/}
{/*</div>*/}
</div>
);
}
}
| Add ref for file upload dropZone | Add ref for file upload dropZone
| JavaScript | agpl-3.0 | MakersLab/custom-print | javascript | ## Code Before:
import { h, Component } from 'preact';
import Dropzone from 'react-dropzone';
import style from './style';
export default class FileUpload extends Component {
constructor(props) {
super(props);
this.state = {
isFileSelected: false,
file: false,
};
this.handleFileDrop = this.handleFileDrop.bind(this);
}
handleFileDrop(acceptedFiles, rejectedFiles) {
this.setState({
...this.state,
isFileSelected: true,
file: acceptedFiles[0],
});
this.props.confirmChooseFile(this.state.file);
}
render(props, state) {
return (
<div class={`${style['file-upload']} container`}>
<div class="offset-by-three one column">
<Dropzone
onDrop={this.handleFileDrop}
multiple={false}
class={style['file']}
className={style['file']}
accept=".stl"
>
<div class={style['file__text']}>Přidejte model ve formátu STL přetáhnutím souboru nebo kliknutím</div>
</Dropzone>
</div>
{/*<div class={`one column offset-by-two ${style['button']}`}>*/}
{/*<button class="button-primary disabled" disabled={!state.isFileSelected} onClick={this.handleAnalyzeButtonClick} type="button">Go to details</button>*/}
{/*</div>*/}
</div>
);
}
}
## Instruction:
Add ref for file upload dropZone
## Code After:
import { h, Component } from 'preact';
import Dropzone from 'react-dropzone';
import style from './style';
export default class FileUpload extends Component {
constructor(props) {
super(props);
this.dropzoneRef = null;
this.state = {
isFileSelected: false,
file: false,
};
this.handleFileDrop = this.handleFileDrop.bind(this);
}
handleFileDrop(acceptedFiles, rejectedFiles) {
this.setState({
...this.state,
isFileSelected: true,
file: acceptedFiles[0],
});
this.props.confirmChooseFile(this.state.file);
}
render(props, state) {
return (
<div class={`${style['file-upload']} container`}>
<div class="offset-by-three one column">
<Dropzone
onDrop={this.handleFileDrop}
multiple={false}
class={style['file']}
className={style['file']}
accept=".stl"
ref={(node) => { this.dropzoneRef = node; }}
>
<div class={style['file__text']}>Přidejte model ve formátu STL přetáhnutím souboru nebo kliknutím</div>
</Dropzone>
</div>
{/*<div class={`one column offset-by-two ${style['button']}`}>*/}
{/*<button class="button-primary disabled" disabled={!state.isFileSelected} onClick={this.handleAnalyzeButtonClick} type="button">Go to details</button>*/}
{/*</div>*/}
</div>
);
}
}
| import { h, Component } from 'preact';
import Dropzone from 'react-dropzone';
import style from './style';
export default class FileUpload extends Component {
constructor(props) {
super(props);
+ this.dropzoneRef = null;
this.state = {
isFileSelected: false,
file: false,
};
this.handleFileDrop = this.handleFileDrop.bind(this);
}
handleFileDrop(acceptedFiles, rejectedFiles) {
this.setState({
...this.state,
isFileSelected: true,
file: acceptedFiles[0],
});
this.props.confirmChooseFile(this.state.file);
}
render(props, state) {
return (
<div class={`${style['file-upload']} container`}>
<div class="offset-by-three one column">
<Dropzone
onDrop={this.handleFileDrop}
multiple={false}
class={style['file']}
className={style['file']}
accept=".stl"
+ ref={(node) => { this.dropzoneRef = node; }}
>
<div class={style['file__text']}>Přidejte model ve formátu STL přetáhnutím souboru nebo kliknutím</div>
</Dropzone>
</div>
{/*<div class={`one column offset-by-two ${style['button']}`}>*/}
{/*<button class="button-primary disabled" disabled={!state.isFileSelected} onClick={this.handleAnalyzeButtonClick} type="button">Go to details</button>*/}
{/*</div>*/}
</div>
);
}
} | 2 | 0.043478 | 2 | 0 |
0f7a0d3547e85bb273f463d68f180b37344328b0 | cookbooks/rax-rails-app/recipes/ruby_chruby.rb | cookbooks/rax-rails-app/recipes/ruby_chruby.rb |
node.set['chruby']['rubies'] = {
'1.9.3-p392' => false,
node['railsstack']['ruby_version'] => true }
node.set['chruby']['default'] = node['railsstack']['ruby_version']
include_recipe 'chruby::system'
node.set['railsstack']['ruby_bin_dir'] =
File.join('/opt', 'rubies', node['railsstack']['ruby_version'], 'bin')
gem_package 'bundler' do
action :install
gem_binary File.join(node['railsstack']['ruby_bin_dir'], 'gem')
end
if platform_family?('rhel')
node.override['unicorn-ng']['service']['wrapper'] = "/usr/local/bin/chruby-exec #{node['chruby']['default']}"
end
node.set['railsstack']['ruby_wrapper'] = "/usr/local/bin/chruby-exec #{node['railsstack']['ruby_version']}"
node.set['railsstack']['bundle_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'bundle')
node.set['railsstack']['ruby_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'ruby')
node.set['railsstack']['gem_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'gem')
| package libffi-dev
node.set['chruby']['rubies'] = {
'1.9.3-p392' => false,
node['railsstack']['ruby_version'] => true }
node.set['chruby']['default'] = node['railsstack']['ruby_version']
include_recipe 'chruby::system'
node.set['railsstack']['ruby_bin_dir'] =
File.join('/opt', 'rubies', node['railsstack']['ruby_version'], 'bin')
gem_package 'bundler' do
action :install
gem_binary File.join(node['railsstack']['ruby_bin_dir'], 'gem')
end
if platform_family?('rhel')
node.override['unicorn-ng']['service']['wrapper'] = "/usr/local/bin/chruby-exec #{node['chruby']['default']}"
end
node.set['railsstack']['ruby_wrapper'] = "/usr/local/bin/chruby-exec #{node['railsstack']['ruby_version']}"
node.set['railsstack']['bundle_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'bundle')
node.set['railsstack']['ruby_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'ruby')
node.set['railsstack']['gem_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'gem')
| Install 'libffi-dev' as prerequisite for certain Ruby verisons | Install 'libffi-dev' as prerequisite for certain Ruby verisons
| Ruby | apache-2.0 | chrishultin/rails-app-single,chrishultin/rails-app-single,chrishultin/rails-app-single,chrishultin/rails-app-single,chrishultin/rails-app-single | ruby | ## Code Before:
node.set['chruby']['rubies'] = {
'1.9.3-p392' => false,
node['railsstack']['ruby_version'] => true }
node.set['chruby']['default'] = node['railsstack']['ruby_version']
include_recipe 'chruby::system'
node.set['railsstack']['ruby_bin_dir'] =
File.join('/opt', 'rubies', node['railsstack']['ruby_version'], 'bin')
gem_package 'bundler' do
action :install
gem_binary File.join(node['railsstack']['ruby_bin_dir'], 'gem')
end
if platform_family?('rhel')
node.override['unicorn-ng']['service']['wrapper'] = "/usr/local/bin/chruby-exec #{node['chruby']['default']}"
end
node.set['railsstack']['ruby_wrapper'] = "/usr/local/bin/chruby-exec #{node['railsstack']['ruby_version']}"
node.set['railsstack']['bundle_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'bundle')
node.set['railsstack']['ruby_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'ruby')
node.set['railsstack']['gem_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'gem')
## Instruction:
Install 'libffi-dev' as prerequisite for certain Ruby verisons
## Code After:
package libffi-dev
node.set['chruby']['rubies'] = {
'1.9.3-p392' => false,
node['railsstack']['ruby_version'] => true }
node.set['chruby']['default'] = node['railsstack']['ruby_version']
include_recipe 'chruby::system'
node.set['railsstack']['ruby_bin_dir'] =
File.join('/opt', 'rubies', node['railsstack']['ruby_version'], 'bin')
gem_package 'bundler' do
action :install
gem_binary File.join(node['railsstack']['ruby_bin_dir'], 'gem')
end
if platform_family?('rhel')
node.override['unicorn-ng']['service']['wrapper'] = "/usr/local/bin/chruby-exec #{node['chruby']['default']}"
end
node.set['railsstack']['ruby_wrapper'] = "/usr/local/bin/chruby-exec #{node['railsstack']['ruby_version']}"
node.set['railsstack']['bundle_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'bundle')
node.set['railsstack']['ruby_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'ruby')
node.set['railsstack']['gem_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'gem')
| + package libffi-dev
node.set['chruby']['rubies'] = {
'1.9.3-p392' => false,
node['railsstack']['ruby_version'] => true }
node.set['chruby']['default'] = node['railsstack']['ruby_version']
include_recipe 'chruby::system'
node.set['railsstack']['ruby_bin_dir'] =
File.join('/opt', 'rubies', node['railsstack']['ruby_version'], 'bin')
gem_package 'bundler' do
action :install
gem_binary File.join(node['railsstack']['ruby_bin_dir'], 'gem')
end
if platform_family?('rhel')
node.override['unicorn-ng']['service']['wrapper'] = "/usr/local/bin/chruby-exec #{node['chruby']['default']}"
end
node.set['railsstack']['ruby_wrapper'] = "/usr/local/bin/chruby-exec #{node['railsstack']['ruby_version']}"
node.set['railsstack']['bundle_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'bundle')
node.set['railsstack']['ruby_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'ruby')
node.set['railsstack']['gem_path'] = File.join(node['railsstack']['ruby_bin_dir'], 'gem') | 1 | 0.04 | 1 | 0 |
91122afafa9fb5872f905dde391ce5b587d5d70a | frappe/patches/v8_0/install_new_build_system_requirements.py | frappe/patches/v8_0/install_new_build_system_requirements.py | import subprocess
def execute():
subprocess.call([
'npm', 'install',
'babel-core',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
]) | from subprocess import Popen, call, PIPE
def execute():
# update nodejs version if brew exists
p = Popen(['which', 'brew'], stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
if output:
subprocess.call(['brew', 'upgrade', 'node'])
else:
print 'Please update your NodeJS version'
subprocess.call([
'npm', 'install',
'babel-core',
'less',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
]) | Update build system requirements patch | Update build system requirements patch
| Python | mit | mhbu50/frappe,ESS-LLP/frappe,tmimori/frappe,frappe/frappe,mhbu50/frappe,ESS-LLP/frappe,mbauskar/frappe,bcornwellmott/frappe,bohlian/frappe,adityahase/frappe,tmimori/frappe,paurosello/frappe,almeidapaulopt/frappe,RicardoJohann/frappe,paurosello/frappe,ESS-LLP/frappe,mhbu50/frappe,bohlian/frappe,chdecultot/frappe,frappe/frappe,almeidapaulopt/frappe,StrellaGroup/frappe,saurabh6790/frappe,bcornwellmott/frappe,mbauskar/frappe,paurosello/frappe,RicardoJohann/frappe,chdecultot/frappe,maxtorete/frappe,rmehta/frappe,neilLasrado/frappe,maxtorete/frappe,tmimori/frappe,maxtorete/frappe,ESS-LLP/frappe,rmehta/frappe,saurabh6790/frappe,adityahase/frappe,mbauskar/frappe,mhbu50/frappe,bohlian/frappe,tundebabzy/frappe,saurabh6790/frappe,neilLasrado/frappe,tundebabzy/frappe,paurosello/frappe,almeidapaulopt/frappe,maxtorete/frappe,chdecultot/frappe,manassolanki/frappe,vjFaLk/frappe,tundebabzy/frappe,adityahase/frappe,adityahase/frappe,bohlian/frappe,neilLasrado/frappe,rmehta/frappe,bcornwellmott/frappe,bcornwellmott/frappe,StrellaGroup/frappe,rmehta/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,yashodhank/frappe,almeidapaulopt/frappe,manassolanki/frappe,tmimori/frappe,StrellaGroup/frappe,vjFaLk/frappe,RicardoJohann/frappe,yashodhank/frappe,mbauskar/frappe,tundebabzy/frappe,chdecultot/frappe,manassolanki/frappe,manassolanki/frappe,vjFaLk/frappe,neilLasrado/frappe,vjFaLk/frappe,RicardoJohann/frappe,saurabh6790/frappe | python | ## Code Before:
import subprocess
def execute():
subprocess.call([
'npm', 'install',
'babel-core',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
])
## Instruction:
Update build system requirements patch
## Code After:
from subprocess import Popen, call, PIPE
def execute():
# update nodejs version if brew exists
p = Popen(['which', 'brew'], stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
if output:
subprocess.call(['brew', 'upgrade', 'node'])
else:
print 'Please update your NodeJS version'
subprocess.call([
'npm', 'install',
'babel-core',
'less',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
]) | - import subprocess
+ from subprocess import Popen, call, PIPE
def execute():
+ # update nodejs version if brew exists
+ p = Popen(['which', 'brew'], stdout=PIPE, stderr=PIPE)
+ output, err = p.communicate()
+ if output:
+ subprocess.call(['brew', 'upgrade', 'node'])
+ else:
+ print 'Please update your NodeJS version'
+
subprocess.call([
'npm', 'install',
'babel-core',
+ 'less',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
]) | 11 | 0.916667 | 10 | 1 |
e6eec5a029e130d93803196c2edc0b55a220c8f7 | src/marketplace-checklist/sidebar-extension.ts | src/marketplace-checklist/sidebar-extension.ts | import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService';
import { getMenuForProject, getMenuForSupport } from './utils';
export default function registerSidebarExtension() {
SidebarExtensionService.register('project', getMenuForProject);
SidebarExtensionService.register('support', getMenuForSupport);
}
| import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService';
import { getMenuForProject, getMenuForSupport } from './utils';
SidebarExtensionService.register('project', getMenuForProject);
SidebarExtensionService.register('support', getMenuForSupport);
| Fix marketplace checklist sidebar extension registration. | Fix marketplace checklist sidebar extension registration.
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | typescript | ## Code Before:
import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService';
import { getMenuForProject, getMenuForSupport } from './utils';
export default function registerSidebarExtension() {
SidebarExtensionService.register('project', getMenuForProject);
SidebarExtensionService.register('support', getMenuForSupport);
}
## Instruction:
Fix marketplace checklist sidebar extension registration.
## Code After:
import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService';
import { getMenuForProject, getMenuForSupport } from './utils';
SidebarExtensionService.register('project', getMenuForProject);
SidebarExtensionService.register('support', getMenuForSupport);
| import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService';
import { getMenuForProject, getMenuForSupport } from './utils';
- export default function registerSidebarExtension() {
- SidebarExtensionService.register('project', getMenuForProject);
? --
+ SidebarExtensionService.register('project', getMenuForProject);
- SidebarExtensionService.register('support', getMenuForSupport);
? --
+ SidebarExtensionService.register('support', getMenuForSupport);
- } | 6 | 0.75 | 2 | 4 |
370354dfc409d4304b9a3b1428f9b1664d458064 | composer.json | composer.json | {
"name": "floriansemm/solr-bundle",
"type": "symfony-bundle",
"description": "Symfony2 Solr integration bundle",
"keywords": [
"search",
"index",
"symfony",
"solr"
],
"homepage": "https://github.com/floriansemm/SolrBundle",
"license": "MIT",
"require": {
"php": ">=5.4.5",
"solarium/solarium": "^3.5",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"symfony/config": "^2.3",
"symfony/doctrine-bridge": "^2.3",
"doctrine/mongodb": "*",
"doctrine/mongodb-odm": "*",
"doctrine/orm": "^2.3"
},
"require-dev": {
"behat/behat": "^3.0"
},
"minimum-stability": "beta",
"autoload": {
"psr-0": {
"FS\\SolrBundle": ""
}
},
"config": {
"bin-dir": "bin"
},
"suggest": {
"doctrine/mongodb": "Required if you want to use the MongoDB ODM features",
"doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM features"
},
"target-dir": "FS/SolrBundle"
}
| {
"name": "floriansemm/solr-bundle",
"type": "symfony-bundle",
"description": "Symfony2 Solr integration bundle",
"keywords": [
"search",
"index",
"symfony",
"solr"
],
"homepage": "https://github.com/floriansemm/SolrBundle",
"license": "MIT",
"require": {
"php": ">=5.4.5",
"solarium/solarium": "^3.5",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"symfony/config": "^2.3",
"symfony/doctrine-bridge": "^2.3"
},
"require-dev": {
"behat/behat": "^3.0",
"doctrine/mongodb": "*",
"doctrine/mongodb-odm": "*",
"doctrine/orm": "^2.3"
},
"minimum-stability": "beta",
"autoload": {
"psr-0": {
"FS\\SolrBundle": ""
}
},
"config": {
"bin-dir": "bin"
},
"suggest": {
"doctrine/orm": "Required if you want to use the Doctrine ORM",
"doctrine/mongodb": "Required if you want to use the MongoDB ODM",
"doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM"
},
"target-dir": "FS/SolrBundle"
}
| Allow a choice between Doctrine ORM or ODM | Allow a choice between Doctrine ORM or ODM
| JSON | mit | floriansemm/SolrBundle,clarity-project/SolrBundle,clarity-project/SolrBundle,drdk/SolrBundle,drdk/SolrBundle,zquintana/SunSearchBundle,floriansemm/SolrBundle,zquintana/SunSearchBundle | json | ## Code Before:
{
"name": "floriansemm/solr-bundle",
"type": "symfony-bundle",
"description": "Symfony2 Solr integration bundle",
"keywords": [
"search",
"index",
"symfony",
"solr"
],
"homepage": "https://github.com/floriansemm/SolrBundle",
"license": "MIT",
"require": {
"php": ">=5.4.5",
"solarium/solarium": "^3.5",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"symfony/config": "^2.3",
"symfony/doctrine-bridge": "^2.3",
"doctrine/mongodb": "*",
"doctrine/mongodb-odm": "*",
"doctrine/orm": "^2.3"
},
"require-dev": {
"behat/behat": "^3.0"
},
"minimum-stability": "beta",
"autoload": {
"psr-0": {
"FS\\SolrBundle": ""
}
},
"config": {
"bin-dir": "bin"
},
"suggest": {
"doctrine/mongodb": "Required if you want to use the MongoDB ODM features",
"doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM features"
},
"target-dir": "FS/SolrBundle"
}
## Instruction:
Allow a choice between Doctrine ORM or ODM
## Code After:
{
"name": "floriansemm/solr-bundle",
"type": "symfony-bundle",
"description": "Symfony2 Solr integration bundle",
"keywords": [
"search",
"index",
"symfony",
"solr"
],
"homepage": "https://github.com/floriansemm/SolrBundle",
"license": "MIT",
"require": {
"php": ">=5.4.5",
"solarium/solarium": "^3.5",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"symfony/config": "^2.3",
"symfony/doctrine-bridge": "^2.3"
},
"require-dev": {
"behat/behat": "^3.0",
"doctrine/mongodb": "*",
"doctrine/mongodb-odm": "*",
"doctrine/orm": "^2.3"
},
"minimum-stability": "beta",
"autoload": {
"psr-0": {
"FS\\SolrBundle": ""
}
},
"config": {
"bin-dir": "bin"
},
"suggest": {
"doctrine/orm": "Required if you want to use the Doctrine ORM",
"doctrine/mongodb": "Required if you want to use the MongoDB ODM",
"doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM"
},
"target-dir": "FS/SolrBundle"
}
| {
"name": "floriansemm/solr-bundle",
"type": "symfony-bundle",
"description": "Symfony2 Solr integration bundle",
"keywords": [
"search",
"index",
"symfony",
"solr"
],
"homepage": "https://github.com/floriansemm/SolrBundle",
"license": "MIT",
"require": {
"php": ">=5.4.5",
"solarium/solarium": "^3.5",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"symfony/config": "^2.3",
- "symfony/doctrine-bridge": "^2.3",
? -
+ "symfony/doctrine-bridge": "^2.3"
+ },
+ "require-dev": {
+ "behat/behat": "^3.0",
"doctrine/mongodb": "*",
"doctrine/mongodb-odm": "*",
"doctrine/orm": "^2.3"
- },
- "require-dev": {
- "behat/behat": "^3.0"
},
"minimum-stability": "beta",
"autoload": {
"psr-0": {
"FS\\SolrBundle": ""
}
},
"config": {
"bin-dir": "bin"
},
"suggest": {
+ "doctrine/orm": "Required if you want to use the Doctrine ORM",
- "doctrine/mongodb": "Required if you want to use the MongoDB ODM features",
? ---------
+ "doctrine/mongodb": "Required if you want to use the MongoDB ODM",
- "doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM features"
? ---------
+ "doctrine/mongodb-odm": "Required if you want to use the MongoDB ODM"
},
"target-dir": "FS/SolrBundle"
} | 13 | 0.317073 | 7 | 6 |
55e7615c18cf5d35f2ad0c2435a573a6f6d03696 | lib/geolix/server/worker.ex | lib/geolix/server/worker.ex | defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case opts[:where] do
nil -> {:reply, lookup_all(ip, opts), state}
_where -> {:reply, lookup_single(ip, opts), state}
end
end
defp lookup_all(ip, opts) do
lookup_all(ip, opts, Loader.loaded_databases())
end
defp lookup_all(_, _, []), do: %{}
defp lookup_all(ip, opts, databases) do
# credo:disable-for-lines:7 Credo.Check.Refactor.MapInto
databases
|> Enum.map(fn database ->
task_opts = Keyword.put(opts, :where, database)
{database, Task.async(fn -> lookup_single(ip, task_opts) end)}
end)
|> Enum.into(%{}, fn {database, task} -> {database, Task.await(task)} end)
end
defp lookup_single(ip, opts) do
case Loader.get_database(opts[:where]) do
nil -> nil
%{adapter: adapter} -> adapter.lookup(ip, opts)
end
end
end
| defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case opts[:where] do
nil -> {:reply, lookup_all(ip, opts), state}
_where -> {:reply, lookup_single(ip, opts), state}
end
end
defp lookup_all(ip, opts) do
lookup_all(ip, opts, Loader.loaded_databases())
end
defp lookup_all(_, _, []), do: %{}
defp lookup_all(ip, opts, databases) do
databases
|> Task.async_stream(
fn database ->
{database, lookup_single(ip, [{:where, database} | opts])}
end,
ordered: false
)
|> Enum.into(%{})
end
defp lookup_single(ip, opts) do
case Loader.get_database(opts[:where]) do
nil -> nil
%{adapter: adapter} -> adapter.lookup(ip, opts)
end
end
end
| Use Task.async_stream/3 for parallel lookups | Use Task.async_stream/3 for parallel lookups
| Elixir | apache-2.0 | mneudert/geolix,mneudert/geolix | elixir | ## Code Before:
defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case opts[:where] do
nil -> {:reply, lookup_all(ip, opts), state}
_where -> {:reply, lookup_single(ip, opts), state}
end
end
defp lookup_all(ip, opts) do
lookup_all(ip, opts, Loader.loaded_databases())
end
defp lookup_all(_, _, []), do: %{}
defp lookup_all(ip, opts, databases) do
# credo:disable-for-lines:7 Credo.Check.Refactor.MapInto
databases
|> Enum.map(fn database ->
task_opts = Keyword.put(opts, :where, database)
{database, Task.async(fn -> lookup_single(ip, task_opts) end)}
end)
|> Enum.into(%{}, fn {database, task} -> {database, Task.await(task)} end)
end
defp lookup_single(ip, opts) do
case Loader.get_database(opts[:where]) do
nil -> nil
%{adapter: adapter} -> adapter.lookup(ip, opts)
end
end
end
## Instruction:
Use Task.async_stream/3 for parallel lookups
## Code After:
defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case opts[:where] do
nil -> {:reply, lookup_all(ip, opts), state}
_where -> {:reply, lookup_single(ip, opts), state}
end
end
defp lookup_all(ip, opts) do
lookup_all(ip, opts, Loader.loaded_databases())
end
defp lookup_all(_, _, []), do: %{}
defp lookup_all(ip, opts, databases) do
databases
|> Task.async_stream(
fn database ->
{database, lookup_single(ip, [{:where, database} | opts])}
end,
ordered: false
)
|> Enum.into(%{})
end
defp lookup_single(ip, opts) do
case Loader.get_database(opts[:where]) do
nil -> nil
%{adapter: adapter} -> adapter.lookup(ip, opts)
end
end
end
| defmodule Geolix.Server.Worker do
@moduledoc false
alias Geolix.Database.Loader
use GenServer
@behaviour :poolboy_worker
def start_link(default \\ %{}) do
GenServer.start_link(__MODULE__, default)
end
def init(state), do: {:ok, state}
def handle_call({:lookup, ip, opts}, _, state) do
case opts[:where] do
nil -> {:reply, lookup_all(ip, opts), state}
_where -> {:reply, lookup_single(ip, opts), state}
end
end
defp lookup_all(ip, opts) do
lookup_all(ip, opts, Loader.loaded_databases())
end
defp lookup_all(_, _, []), do: %{}
defp lookup_all(ip, opts, databases) do
- # credo:disable-for-lines:7 Credo.Check.Refactor.MapInto
databases
+ |> Task.async_stream(
- |> Enum.map(fn database ->
? -- ^^^^^^^^^
+ fn database ->
? ^
+ {database, lookup_single(ip, [{:where, database} | opts])}
- task_opts = Keyword.put(opts, :where, database)
-
- {database, Task.async(fn -> lookup_single(ip, task_opts) end)}
- end)
? ^
+ end,
? ++ ^
- |> Enum.into(%{}, fn {database, task} -> {database, Task.await(task)} end)
+ ordered: false
+ )
+ |> Enum.into(%{})
end
defp lookup_single(ip, opts) do
case Loader.get_database(opts[:where]) do
nil -> nil
%{adapter: adapter} -> adapter.lookup(ip, opts)
end
end
end | 14 | 0.304348 | 7 | 7 |
2e681c8edea643cf4617b08e07f79927d32a71a1 | addon/models/session-type.js | addon/models/session-type.js | import Ember from 'ember';
import DS from 'ember-data';
const { String:EmberString, computed } = Ember;
const { Model, attr, belongsTo, hasMany } = DS;
const { htmlSafe } = EmberString;
export default Model.extend({
title: attr('string'),
calendarColor: attr('string'),
assessment: attr('boolean'),
assessmentOption: belongsTo('assessment-option', {async: true}),
school: belongsTo('school', {async: true}),
aamcMethods: hasMany('aamc-method', {async: true}),
sessions: hasMany('session', {async: true}),
safeCalendarColor: computed('calendarColor', function(){
const calendarColor = this.get('calendarColor');
const pattern = new RegExp("^#[a-fA-F0-9]{6}$");
if (pattern.test(calendarColor)) {
return htmlSafe(calendarColor);
}
return '';
}),
sessionCount: computed('sessions.[]', function(){
const sessons = this.hasMany('sessions');
return sessons.ids().length;
})
});
| import Ember from 'ember';
import DS from 'ember-data';
const { String:EmberString, computed } = Ember;
const { Model, attr, belongsTo, hasMany } = DS;
const { htmlSafe } = EmberString;
export default Model.extend({
title: attr('string'),
calendarColor: attr('string'),
active: attr('boolean'),
assessment: attr('boolean'),
assessmentOption: belongsTo('assessment-option', {async: true}),
school: belongsTo('school', {async: true}),
aamcMethods: hasMany('aamc-method', {async: true}),
sessions: hasMany('session', {async: true}),
safeCalendarColor: computed('calendarColor', function(){
const calendarColor = this.get('calendarColor');
const pattern = new RegExp("^#[a-fA-F0-9]{6}$");
if (pattern.test(calendarColor)) {
return htmlSafe(calendarColor);
}
return '';
}),
sessionCount: computed('sessions.[]', function(){
const sessons = this.hasMany('sessions');
return sessons.ids().length;
})
});
| Add active to session type model | Add active to session type model
| JavaScript | mit | ilios/common,ilios/common | javascript | ## Code Before:
import Ember from 'ember';
import DS from 'ember-data';
const { String:EmberString, computed } = Ember;
const { Model, attr, belongsTo, hasMany } = DS;
const { htmlSafe } = EmberString;
export default Model.extend({
title: attr('string'),
calendarColor: attr('string'),
assessment: attr('boolean'),
assessmentOption: belongsTo('assessment-option', {async: true}),
school: belongsTo('school', {async: true}),
aamcMethods: hasMany('aamc-method', {async: true}),
sessions: hasMany('session', {async: true}),
safeCalendarColor: computed('calendarColor', function(){
const calendarColor = this.get('calendarColor');
const pattern = new RegExp("^#[a-fA-F0-9]{6}$");
if (pattern.test(calendarColor)) {
return htmlSafe(calendarColor);
}
return '';
}),
sessionCount: computed('sessions.[]', function(){
const sessons = this.hasMany('sessions');
return sessons.ids().length;
})
});
## Instruction:
Add active to session type model
## Code After:
import Ember from 'ember';
import DS from 'ember-data';
const { String:EmberString, computed } = Ember;
const { Model, attr, belongsTo, hasMany } = DS;
const { htmlSafe } = EmberString;
export default Model.extend({
title: attr('string'),
calendarColor: attr('string'),
active: attr('boolean'),
assessment: attr('boolean'),
assessmentOption: belongsTo('assessment-option', {async: true}),
school: belongsTo('school', {async: true}),
aamcMethods: hasMany('aamc-method', {async: true}),
sessions: hasMany('session', {async: true}),
safeCalendarColor: computed('calendarColor', function(){
const calendarColor = this.get('calendarColor');
const pattern = new RegExp("^#[a-fA-F0-9]{6}$");
if (pattern.test(calendarColor)) {
return htmlSafe(calendarColor);
}
return '';
}),
sessionCount: computed('sessions.[]', function(){
const sessons = this.hasMany('sessions');
return sessons.ids().length;
})
});
| import Ember from 'ember';
import DS from 'ember-data';
const { String:EmberString, computed } = Ember;
const { Model, attr, belongsTo, hasMany } = DS;
const { htmlSafe } = EmberString;
export default Model.extend({
title: attr('string'),
calendarColor: attr('string'),
+ active: attr('boolean'),
assessment: attr('boolean'),
assessmentOption: belongsTo('assessment-option', {async: true}),
school: belongsTo('school', {async: true}),
aamcMethods: hasMany('aamc-method', {async: true}),
sessions: hasMany('session', {async: true}),
safeCalendarColor: computed('calendarColor', function(){
const calendarColor = this.get('calendarColor');
const pattern = new RegExp("^#[a-fA-F0-9]{6}$");
if (pattern.test(calendarColor)) {
return htmlSafe(calendarColor);
}
return '';
}),
sessionCount: computed('sessions.[]', function(){
const sessons = this.hasMany('sessions');
-
+
return sessons.ids().length;
})
}); | 3 | 0.096774 | 2 | 1 |
7446a11dbe5a03fe87960e68eedd12052966a77a | README.md | README.md | google-auto-example
===================
Trying out Google's Auto library https://github.com/google/auto
| google-auto-example
===================
Trying out Google's Auto library https://github.com/google/auto
The goal of this project is to test and show how AutoValue would be used in a real project. That includes:
1 Compiling and testing from the command line, with:
1.1 Maven
1.2 Gradle
2 Editing and working on code in popular IDEs, including:
2.1 Eclipse
2.2 IntelliJ IDEA
3 Working on the projects with most popular JDK versions:
3.1 1.6
3.2 1.7
3.3 1.8
4 Depending on an AutoValue-based project, via:
4.1 JAR dependency
4.2 multi-module build in various build tools (?)
| Clarify what this project is to do. | Clarify what this project is to do.
| Markdown | apache-2.0 | Grundlefleck/autovalue-example | markdown | ## Code Before:
google-auto-example
===================
Trying out Google's Auto library https://github.com/google/auto
## Instruction:
Clarify what this project is to do.
## Code After:
google-auto-example
===================
Trying out Google's Auto library https://github.com/google/auto
The goal of this project is to test and show how AutoValue would be used in a real project. That includes:
1 Compiling and testing from the command line, with:
1.1 Maven
1.2 Gradle
2 Editing and working on code in popular IDEs, including:
2.1 Eclipse
2.2 IntelliJ IDEA
3 Working on the projects with most popular JDK versions:
3.1 1.6
3.2 1.7
3.3 1.8
4 Depending on an AutoValue-based project, via:
4.1 JAR dependency
4.2 multi-module build in various build tools (?)
| google-auto-example
===================
Trying out Google's Auto library https://github.com/google/auto
+
+ The goal of this project is to test and show how AutoValue would be used in a real project. That includes:
+
+ 1 Compiling and testing from the command line, with:
+ 1.1 Maven
+ 1.2 Gradle
+ 2 Editing and working on code in popular IDEs, including:
+ 2.1 Eclipse
+ 2.2 IntelliJ IDEA
+ 3 Working on the projects with most popular JDK versions:
+ 3.1 1.6
+ 3.2 1.7
+ 3.3 1.8
+ 4 Depending on an AutoValue-based project, via:
+ 4.1 JAR dependency
+ 4.2 multi-module build in various build tools (?)
+ | 17 | 4.25 | 17 | 0 |
6d1fadb35ca85abdcdf5d03b39d2f816e787db41 | app/models/contentful_client.rb | app/models/contentful_client.rb | require 'singleton'
class ContentfulClient
include Singleton
def initialize
@client = Contentful::Client.new(
access_token: 'adb4d1c686cd197d56d0dc7b677a79f0f36ab77b82fbcc16c7fe115bafaa7c4d',
space: 'surtvltn1tm7',
dynamic_entries: :auto
)
end
def carousel_items
@client.entries('content_type' => '5AYS9ZskFiUiYCc8owESc', 'order' => 'sys.createdAt')
end
end | require 'singleton'
class ContentfulClient
include Singleton
def initialize
@client = Contentful::Client.new(
access_token: 'adb4d1c686cd197d56d0dc7b677a79f0f36ab77b82fbcc16c7fe115bafaa7c4d',
space: 'surtvltn1tm7',
dynamic_entries: :auto
)
end
def carousel_items
@client.entries(content_type: '5AYS9ZskFiUiYCc8owESc', order: 'sys.createdAt')
end
end | Use proper hash syntax for carousel items | Use proper hash syntax for carousel items
| Ruby | mit | sethfri/VPAC,sethfri/VPAC | ruby | ## Code Before:
require 'singleton'
class ContentfulClient
include Singleton
def initialize
@client = Contentful::Client.new(
access_token: 'adb4d1c686cd197d56d0dc7b677a79f0f36ab77b82fbcc16c7fe115bafaa7c4d',
space: 'surtvltn1tm7',
dynamic_entries: :auto
)
end
def carousel_items
@client.entries('content_type' => '5AYS9ZskFiUiYCc8owESc', 'order' => 'sys.createdAt')
end
end
## Instruction:
Use proper hash syntax for carousel items
## Code After:
require 'singleton'
class ContentfulClient
include Singleton
def initialize
@client = Contentful::Client.new(
access_token: 'adb4d1c686cd197d56d0dc7b677a79f0f36ab77b82fbcc16c7fe115bafaa7c4d',
space: 'surtvltn1tm7',
dynamic_entries: :auto
)
end
def carousel_items
@client.entries(content_type: '5AYS9ZskFiUiYCc8owESc', order: 'sys.createdAt')
end
end | require 'singleton'
class ContentfulClient
include Singleton
def initialize
@client = Contentful::Client.new(
access_token: 'adb4d1c686cd197d56d0dc7b677a79f0f36ab77b82fbcc16c7fe115bafaa7c4d',
space: 'surtvltn1tm7',
dynamic_entries: :auto
)
end
def carousel_items
- @client.entries('content_type' => '5AYS9ZskFiUiYCc8owESc', 'order' => 'sys.createdAt')
? - ^^^^ - ^^^^
+ @client.entries(content_type: '5AYS9ZskFiUiYCc8owESc', order: 'sys.createdAt')
? ^ ^
end
end | 2 | 0.117647 | 1 | 1 |
52235f06c691630c01b6649739cf8c47666633fd | server/controllers/books.js | server/controllers/books.js | // import Admin class
import Admin from '../module/Admin';
module.exports = {
// Add a new book to database
createBook(req, res) {
new Admin().addBook(
req.body.title,
req.body.author,
req.body.description,
req.body.imageURL,
req.body.subject,
req.body.quantity,
)
.then(result => res.status(201).send(result))
.catch(error => res.status(400).send(error));
},
};
| // import Admin class
import Admin from '../module/Admin';
module.exports = {
// Add a new book to database
createBook(req, res) {
// Check the role of user from decoded token
// If 'User' return error else add book
if (req.decoded.role !== 'Admin') return res.status(401).send({ msg: 'Unauthorized user' });
new Admin().addBook(
req.body.title,
req.body.author,
req.body.description,
req.body.imageURL,
req.body.subject,
req.body.quantity,
)
.then(result => res.status(201).send(result))
.catch(error => res.status(500).send(error));
},
};
| Allow only authenticated admin to add a book | Allow only authenticated admin to add a book
| JavaScript | mit | amarachukwu-agbo/hello-books,amarachukwu-agbo/hello-books | javascript | ## Code Before:
// import Admin class
import Admin from '../module/Admin';
module.exports = {
// Add a new book to database
createBook(req, res) {
new Admin().addBook(
req.body.title,
req.body.author,
req.body.description,
req.body.imageURL,
req.body.subject,
req.body.quantity,
)
.then(result => res.status(201).send(result))
.catch(error => res.status(400).send(error));
},
};
## Instruction:
Allow only authenticated admin to add a book
## Code After:
// import Admin class
import Admin from '../module/Admin';
module.exports = {
// Add a new book to database
createBook(req, res) {
// Check the role of user from decoded token
// If 'User' return error else add book
if (req.decoded.role !== 'Admin') return res.status(401).send({ msg: 'Unauthorized user' });
new Admin().addBook(
req.body.title,
req.body.author,
req.body.description,
req.body.imageURL,
req.body.subject,
req.body.quantity,
)
.then(result => res.status(201).send(result))
.catch(error => res.status(500).send(error));
},
};
| // import Admin class
import Admin from '../module/Admin';
module.exports = {
// Add a new book to database
createBook(req, res) {
+ // Check the role of user from decoded token
+ // If 'User' return error else add book
+ if (req.decoded.role !== 'Admin') return res.status(401).send({ msg: 'Unauthorized user' });
new Admin().addBook(
req.body.title,
req.body.author,
req.body.description,
req.body.imageURL,
req.body.subject,
req.body.quantity,
)
.then(result => res.status(201).send(result))
- .catch(error => res.status(400).send(error));
? ^
+ .catch(error => res.status(500).send(error));
? ^
},
}; | 5 | 0.277778 | 4 | 1 |
0ecdb283eaec8bdfd52d6de39b04bf560ba2dc87 | README.md | README.md |
Manage your dependencies with homebrew like you manage your gems with
bundler.
## Getting Started
1. Install the gem
```bash
gem install velcro
```
2. Open up a project and install dependencies
```bash
velcro install
```
If this is the first time you are installing the project a `Brewfile`
and `Brewfile.lock` will be generated.
3. Update a dependency to the most recent version
```bash
velcro update redis
```
This will update the version in the `Brewfile.lock`.
## Give Back
1. Fork it:
https://help.github.com/articles/fork-a-repo
2. Create your feature branch:
```bash
git checkout -b fixes_horrible_spelling_errors
```
3. Commit your changes:
```bash
git commit -am 'Really? You spelled application as "applickachon"?'
```
4. Push the branch:
```bash
git push origin fixes_horrible_spelling_errors
```
5. Create a pull request:
https://help.github.com/articles/using-pull-requests
|

Manage your dependencies with homebrew like you manage your gems with
bundler.
## Getting Started
1. Install the gem
```bash
gem install velcro
```
2. Open up a project and install dependencies
```bash
velcro install
```
If this is the first time you are installing the project a `Brewfile`
and `Brewfile.lock` will be generated.
3. Update a dependency to the most recent version
```bash
velcro update redis
```
This will update the version in the `Brewfile.lock`.
## Give Back
1. Fork it:
https://help.github.com/articles/fork-a-repo
2. Create your feature branch:
```bash
git checkout -b fixes_horrible_spelling_errors
```
3. Commit your changes:
```bash
git commit -am 'Really? You spelled application as "applickachon"?'
```
4. Push the branch:
```bash
git push origin fixes_horrible_spelling_errors
```
5. Create a pull request:
https://help.github.com/articles/using-pull-requests
| Update readme to include build status | Update readme to include build status | Markdown | mit | vanstee/velcro | markdown | ## Code Before:
Manage your dependencies with homebrew like you manage your gems with
bundler.
## Getting Started
1. Install the gem
```bash
gem install velcro
```
2. Open up a project and install dependencies
```bash
velcro install
```
If this is the first time you are installing the project a `Brewfile`
and `Brewfile.lock` will be generated.
3. Update a dependency to the most recent version
```bash
velcro update redis
```
This will update the version in the `Brewfile.lock`.
## Give Back
1. Fork it:
https://help.github.com/articles/fork-a-repo
2. Create your feature branch:
```bash
git checkout -b fixes_horrible_spelling_errors
```
3. Commit your changes:
```bash
git commit -am 'Really? You spelled application as "applickachon"?'
```
4. Push the branch:
```bash
git push origin fixes_horrible_spelling_errors
```
5. Create a pull request:
https://help.github.com/articles/using-pull-requests
## Instruction:
Update readme to include build status
## Code After:

Manage your dependencies with homebrew like you manage your gems with
bundler.
## Getting Started
1. Install the gem
```bash
gem install velcro
```
2. Open up a project and install dependencies
```bash
velcro install
```
If this is the first time you are installing the project a `Brewfile`
and `Brewfile.lock` will be generated.
3. Update a dependency to the most recent version
```bash
velcro update redis
```
This will update the version in the `Brewfile.lock`.
## Give Back
1. Fork it:
https://help.github.com/articles/fork-a-repo
2. Create your feature branch:
```bash
git checkout -b fixes_horrible_spelling_errors
```
3. Commit your changes:
```bash
git commit -am 'Really? You spelled application as "applickachon"?'
```
4. Push the branch:
```bash
git push origin fixes_horrible_spelling_errors
```
5. Create a pull request:
https://help.github.com/articles/using-pull-requests
| +
+ 
Manage your dependencies with homebrew like you manage your gems with
bundler.
## Getting Started
1. Install the gem
```bash
gem install velcro
```
2. Open up a project and install dependencies
```bash
velcro install
```
If this is the first time you are installing the project a `Brewfile`
and `Brewfile.lock` will be generated.
3. Update a dependency to the most recent version
```bash
velcro update redis
```
This will update the version in the `Brewfile.lock`.
## Give Back
1. Fork it:
https://help.github.com/articles/fork-a-repo
2. Create your feature branch:
```bash
git checkout -b fixes_horrible_spelling_errors
```
3. Commit your changes:
```bash
git commit -am 'Really? You spelled application as "applickachon"?'
```
4. Push the branch:
```bash
git push origin fixes_horrible_spelling_errors
```
5. Create a pull request:
https://help.github.com/articles/using-pull-requests | 2 | 0.035714 | 2 | 0 |
86e18caf5f3b7d3e3ad7c035c6ff56778794160c | lib/vagrant/smartos/zones/commands/multi_command.rb | lib/vagrant/smartos/zones/commands/multi_command.rb | module Vagrant
module Smartos
module Zones
module Command
# Requires
#
# Define a COMMANDS constant, which is an array of method names:
#
# COMMANDS = %w(subcommand other_subcommand)
#
# Define an OPTION_PARSER constant, which is an instance of an
# OptionParser
#
module MultiCommand
# Automatically called by Vagrant when running a command
def execute
process_subcommand
end
# Sends parsed argv to an instance method that maps to the
# subcommand name. If flags are passed to the option parser,
# they will be included in argv as a trailing hash.
def process_subcommand
@options = {}
args = parse_options(option_parser)
exit unless args
command = args.shift
command_method = subcommands.find { |c| c == command }
unless command_method
ui.warn option_parser.to_s, prefix: false
exit 1
end
args << @options unless @options.empty?
send command, *args
end
def fail_options!
ui.warn option_parser.to_s, prefix: false
exit 1
end
def option_parser
@option_parser ||= self.class.const_get('OPTION_PARSER')
end
def subcommands
self.class.const_get('COMMANDS')
end
end
end
end
end
end
| module Vagrant
module Smartos
module Zones
module Command
# Requires
#
# Define a COMMANDS constant, which is an array of method names:
#
# COMMANDS = %w(subcommand other_subcommand)
#
# Define an OPTION_PARSER constant, which is an instance of an
# OptionParser
#
module MultiCommand
# Automatically called by Vagrant when running a command
def execute
process_subcommand
end
# Sends parsed argv to an instance method that maps to the
# subcommand name. If flags are passed to the option parser,
# they will be included in argv as a trailing hash.
def process_subcommand
@options = {}
args = parse_options(option_parser)
exit unless args
command = args.shift
command_method = subcommands.find { |c| c == command }
unless command_method
@env.ui.warn option_parser.to_s, prefix: false
exit 1
end
args << @options unless @options.empty?
send command, *args
end
def fail_options!
@env.ui.warn option_parser.to_s, prefix: false
exit 1
end
def option_parser
@option_parser ||= self.class.const_get('OPTION_PARSER')
end
def subcommands
self.class.const_get('COMMANDS')
end
end
end
end
end
end
| Fix issue with undefined local variable or method `ui' | Fix issue with undefined local variable or method `ui'
| Ruby | mit | vagrant-smartos/vagrant-smartos-zones,vagrant-smartos/vagrant-smartos-zones,vagrant-smartos/vagrant-smartos-zones | ruby | ## Code Before:
module Vagrant
module Smartos
module Zones
module Command
# Requires
#
# Define a COMMANDS constant, which is an array of method names:
#
# COMMANDS = %w(subcommand other_subcommand)
#
# Define an OPTION_PARSER constant, which is an instance of an
# OptionParser
#
module MultiCommand
# Automatically called by Vagrant when running a command
def execute
process_subcommand
end
# Sends parsed argv to an instance method that maps to the
# subcommand name. If flags are passed to the option parser,
# they will be included in argv as a trailing hash.
def process_subcommand
@options = {}
args = parse_options(option_parser)
exit unless args
command = args.shift
command_method = subcommands.find { |c| c == command }
unless command_method
ui.warn option_parser.to_s, prefix: false
exit 1
end
args << @options unless @options.empty?
send command, *args
end
def fail_options!
ui.warn option_parser.to_s, prefix: false
exit 1
end
def option_parser
@option_parser ||= self.class.const_get('OPTION_PARSER')
end
def subcommands
self.class.const_get('COMMANDS')
end
end
end
end
end
end
## Instruction:
Fix issue with undefined local variable or method `ui'
## Code After:
module Vagrant
module Smartos
module Zones
module Command
# Requires
#
# Define a COMMANDS constant, which is an array of method names:
#
# COMMANDS = %w(subcommand other_subcommand)
#
# Define an OPTION_PARSER constant, which is an instance of an
# OptionParser
#
module MultiCommand
# Automatically called by Vagrant when running a command
def execute
process_subcommand
end
# Sends parsed argv to an instance method that maps to the
# subcommand name. If flags are passed to the option parser,
# they will be included in argv as a trailing hash.
def process_subcommand
@options = {}
args = parse_options(option_parser)
exit unless args
command = args.shift
command_method = subcommands.find { |c| c == command }
unless command_method
@env.ui.warn option_parser.to_s, prefix: false
exit 1
end
args << @options unless @options.empty?
send command, *args
end
def fail_options!
@env.ui.warn option_parser.to_s, prefix: false
exit 1
end
def option_parser
@option_parser ||= self.class.const_get('OPTION_PARSER')
end
def subcommands
self.class.const_get('COMMANDS')
end
end
end
end
end
end
| module Vagrant
module Smartos
module Zones
module Command
# Requires
#
# Define a COMMANDS constant, which is an array of method names:
#
# COMMANDS = %w(subcommand other_subcommand)
#
# Define an OPTION_PARSER constant, which is an instance of an
# OptionParser
#
module MultiCommand
# Automatically called by Vagrant when running a command
def execute
process_subcommand
end
# Sends parsed argv to an instance method that maps to the
# subcommand name. If flags are passed to the option parser,
# they will be included in argv as a trailing hash.
def process_subcommand
@options = {}
args = parse_options(option_parser)
exit unless args
command = args.shift
command_method = subcommands.find { |c| c == command }
unless command_method
- ui.warn option_parser.to_s, prefix: false
+ @env.ui.warn option_parser.to_s, prefix: false
? +++++
exit 1
end
args << @options unless @options.empty?
send command, *args
end
def fail_options!
- ui.warn option_parser.to_s, prefix: false
+ @env.ui.warn option_parser.to_s, prefix: false
? +++++
exit 1
end
def option_parser
@option_parser ||= self.class.const_get('OPTION_PARSER')
end
def subcommands
self.class.const_get('COMMANDS')
end
end
end
end
end
end | 4 | 0.071429 | 2 | 2 |
b85cc841d6d165f2e880aec36d02ff34d6e63fb2 | app/assets/javascripts/templates/overlays/new_task.hbs | app/assets/javascripts/templates/overlays/new_task.hbs | <div class="choose-card-type-overlay">
<div id="choose-card-type">
<h2>
Would you like to post a task or a message?
</h2>
<div id="choose-card-type-buttons">
<button class="primary-button task">
New Task Card
</button>
<button class="primary-button message">
New Message Card
</button>
<a href="#" class="cancel">Cancel</a>
</div>
</div>
</div>
| <div class="choose-card-type-overlay">
<div id="choose-card-type">
<h2>
Would you like to post a task or a message?
</h2>
<div id="choose-card-type-buttons">
<button class="primary-button task">
New Task Card
</button>
<button class="primary-button message">
New Message Card
</button>
<a class="cancel" {{action 'closeOverlay'}}>cancel</a>
</div>
</div>
</div>
| Add close overlay to new card overlay | Add close overlay to new card overlay
| Handlebars | mit | johan--/tahi,johan--/tahi,johan--/tahi,johan--/tahi | handlebars | ## Code Before:
<div class="choose-card-type-overlay">
<div id="choose-card-type">
<h2>
Would you like to post a task or a message?
</h2>
<div id="choose-card-type-buttons">
<button class="primary-button task">
New Task Card
</button>
<button class="primary-button message">
New Message Card
</button>
<a href="#" class="cancel">Cancel</a>
</div>
</div>
</div>
## Instruction:
Add close overlay to new card overlay
## Code After:
<div class="choose-card-type-overlay">
<div id="choose-card-type">
<h2>
Would you like to post a task or a message?
</h2>
<div id="choose-card-type-buttons">
<button class="primary-button task">
New Task Card
</button>
<button class="primary-button message">
New Message Card
</button>
<a class="cancel" {{action 'closeOverlay'}}>cancel</a>
</div>
</div>
</div>
| <div class="choose-card-type-overlay">
<div id="choose-card-type">
<h2>
Would you like to post a task or a message?
</h2>
<div id="choose-card-type-buttons">
<button class="primary-button task">
New Task Card
</button>
<button class="primary-button message">
New Message Card
</button>
- <a href="#" class="cancel">Cancel</a>
+ <a class="cancel" {{action 'closeOverlay'}}>cancel</a>
</div>
</div>
</div> | 2 | 0.111111 | 1 | 1 |
ea91b71b70c6c8cf851f598d5f2198b3c867a480 | CHANGELOG.md | CHANGELOG.md | OverrideAudit ChangeLog
=======================
Next Version (????-??-??)
-------------------------
* Fix a problem with overrides starting with a period not being
correctly recognized as an override (#24).
* Implement the ability to show the diff header even if a diff is
empty (#18)
* Implement the ability to "freshen" a single expired override or
all within a package (#15)
Version 1.0.1 (2017-04-10)
--------------------------
* Fix mixed path separators in diff output, delete confirmations and
diff tab headers so they are always forward slashes (unix-style)
to visually conform with how Sublime represents package path
fragments internally (#14).
* The Package Report, Override Report and and Bulk Diff Reports now
have word wrap turned off by default.
* Enhanced the checks performed at file load and save so to more
correctly determine if a file is actually an override or not when
enabling integration with OverrideAudit Edit/Diff functionality.
* Rename the "Swap Diff/Override View" command to "Swap Diff/Edit
View" in the command palette and change the associated text used
in Diff tab titles.
* Add a configuration option `save_on_diff` (defaults to false) to
control if the contents of an edited override should be persisted
to disk before performing a diff on it.
Version 1.0.0 (2017-04-03)
--------------------------
* Initial release | OverrideAudit ChangeLog
=======================
Next Version (????-??-??)
-------------------------
* Fix a problem with overrides starting with a period not being
correctly recognized as an override (#24).
* Implement the ability to show the diff header even if a diff is
empty (#18)
* Implement the ability to "freshen" a single expired override or
all within a package (#15)
* Fix a file case issue on Windows/MacOS where opening an override
from a package folder with an incorrect case would not enable
the commands to edit or diff the override.
* Performance enhancements for some package operations for users
with a large number of installed packages.
Version 1.0.1 (2017-04-10)
--------------------------
* Fix mixed path separators in diff output, delete confirmations and
diff tab headers so they are always forward slashes (unix-style)
to visually conform with how Sublime represents package path
fragments internally (#14).
* The Package Report, Override Report and and Bulk Diff Reports now
have word wrap turned off by default.
* Enhanced the checks performed at file load and save so to more
correctly determine if a file is actually an override or not when
enabling integration with OverrideAudit Edit/Diff functionality.
* Rename the "Swap Diff/Override View" command to "Swap Diff/Edit
View" in the command palette and change the associated text used
in Diff tab titles.
* Add a configuration option `save_on_diff` (defaults to false) to
control if the contents of an edited override should be persisted
to disk before performing a diff on it.
Version 1.0.0 (2017-04-03)
--------------------------
* Initial release | Update Changelog for recent changes | Update Changelog for recent changes
These cover the enhancements made as a part of the recent PackageInfo
and PackageList class refactoring.
| Markdown | mit | OdatNurd/OverrideAudit | markdown | ## Code Before:
OverrideAudit ChangeLog
=======================
Next Version (????-??-??)
-------------------------
* Fix a problem with overrides starting with a period not being
correctly recognized as an override (#24).
* Implement the ability to show the diff header even if a diff is
empty (#18)
* Implement the ability to "freshen" a single expired override or
all within a package (#15)
Version 1.0.1 (2017-04-10)
--------------------------
* Fix mixed path separators in diff output, delete confirmations and
diff tab headers so they are always forward slashes (unix-style)
to visually conform with how Sublime represents package path
fragments internally (#14).
* The Package Report, Override Report and and Bulk Diff Reports now
have word wrap turned off by default.
* Enhanced the checks performed at file load and save so to more
correctly determine if a file is actually an override or not when
enabling integration with OverrideAudit Edit/Diff functionality.
* Rename the "Swap Diff/Override View" command to "Swap Diff/Edit
View" in the command palette and change the associated text used
in Diff tab titles.
* Add a configuration option `save_on_diff` (defaults to false) to
control if the contents of an edited override should be persisted
to disk before performing a diff on it.
Version 1.0.0 (2017-04-03)
--------------------------
* Initial release
## Instruction:
Update Changelog for recent changes
These cover the enhancements made as a part of the recent PackageInfo
and PackageList class refactoring.
## Code After:
OverrideAudit ChangeLog
=======================
Next Version (????-??-??)
-------------------------
* Fix a problem with overrides starting with a period not being
correctly recognized as an override (#24).
* Implement the ability to show the diff header even if a diff is
empty (#18)
* Implement the ability to "freshen" a single expired override or
all within a package (#15)
* Fix a file case issue on Windows/MacOS where opening an override
from a package folder with an incorrect case would not enable
the commands to edit or diff the override.
* Performance enhancements for some package operations for users
with a large number of installed packages.
Version 1.0.1 (2017-04-10)
--------------------------
* Fix mixed path separators in diff output, delete confirmations and
diff tab headers so they are always forward slashes (unix-style)
to visually conform with how Sublime represents package path
fragments internally (#14).
* The Package Report, Override Report and and Bulk Diff Reports now
have word wrap turned off by default.
* Enhanced the checks performed at file load and save so to more
correctly determine if a file is actually an override or not when
enabling integration with OverrideAudit Edit/Diff functionality.
* Rename the "Swap Diff/Override View" command to "Swap Diff/Edit
View" in the command palette and change the associated text used
in Diff tab titles.
* Add a configuration option `save_on_diff` (defaults to false) to
control if the contents of an edited override should be persisted
to disk before performing a diff on it.
Version 1.0.0 (2017-04-03)
--------------------------
* Initial release | OverrideAudit ChangeLog
=======================
Next Version (????-??-??)
-------------------------
* Fix a problem with overrides starting with a period not being
correctly recognized as an override (#24).
* Implement the ability to show the diff header even if a diff is
empty (#18)
* Implement the ability to "freshen" a single expired override or
all within a package (#15)
+ * Fix a file case issue on Windows/MacOS where opening an override
+ from a package folder with an incorrect case would not enable
+ the commands to edit or diff the override.
+ * Performance enhancements for some package operations for users
+ with a large number of installed packages.
Version 1.0.1 (2017-04-10)
--------------------------
* Fix mixed path separators in diff output, delete confirmations and
diff tab headers so they are always forward slashes (unix-style)
to visually conform with how Sublime represents package path
fragments internally (#14).
* The Package Report, Override Report and and Bulk Diff Reports now
have word wrap turned off by default.
* Enhanced the checks performed at file load and save so to more
correctly determine if a file is actually an override or not when
enabling integration with OverrideAudit Edit/Diff functionality.
* Rename the "Swap Diff/Override View" command to "Swap Diff/Edit
View" in the command palette and change the associated text used
in Diff tab titles.
* Add a configuration option `save_on_diff` (defaults to false) to
control if the contents of an edited override should be persisted
to disk before performing a diff on it.
Version 1.0.0 (2017-04-03)
--------------------------
* Initial release | 5 | 0.125 | 5 | 0 |
f646020b051184b76e9420a28394fad54690bb4e | playbooks/publish/releasenotes.yaml | playbooks/publish/releasenotes.yaml | - hosts: localhost
roles:
- prepare-docs-for-afs
- role: fetch-tox-output
tox_envlist: releasenotes
- role: fetch-sphinx-output
sphinx_output_src: "{{ zuul.project.src_dir }}/doc/build/html/"
zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts"
- create-afs-token
- role: upload-afs
afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}"
- destroy-afs-token
| - hosts: localhost
roles:
- prepare-docs-for-afs
- role: fetch-tox-output
tox_envlist: releasenotes
- role: fetch-sphinx-output
sphinx_output_src: "{{ zuul.project.src_dir }}/releasenotes/build/html/"
zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts"
- create-afs-token
- role: upload-afs
afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}"
- destroy-afs-token
| Switch release note publish jobs to use the correct path | Switch release note publish jobs to use the correct path
This path that the release note jobs publishes things to is
different than the one in the refactored job.
Depends-On: If6ee519c33320db91f8a9553ed4abc099c284eec
Change-Id: I0074d375be9350b51bde526e69c77e9d2b29c63b
| YAML | apache-2.0 | openstack-infra/project-config,openstack-infra/project-config | yaml | ## Code Before:
- hosts: localhost
roles:
- prepare-docs-for-afs
- role: fetch-tox-output
tox_envlist: releasenotes
- role: fetch-sphinx-output
sphinx_output_src: "{{ zuul.project.src_dir }}/doc/build/html/"
zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts"
- create-afs-token
- role: upload-afs
afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}"
- destroy-afs-token
## Instruction:
Switch release note publish jobs to use the correct path
This path that the release note jobs publishes things to is
different than the one in the refactored job.
Depends-On: If6ee519c33320db91f8a9553ed4abc099c284eec
Change-Id: I0074d375be9350b51bde526e69c77e9d2b29c63b
## Code After:
- hosts: localhost
roles:
- prepare-docs-for-afs
- role: fetch-tox-output
tox_envlist: releasenotes
- role: fetch-sphinx-output
sphinx_output_src: "{{ zuul.project.src_dir }}/releasenotes/build/html/"
zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts"
- create-afs-token
- role: upload-afs
afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}"
- destroy-afs-token
| - hosts: localhost
roles:
- prepare-docs-for-afs
- role: fetch-tox-output
tox_envlist: releasenotes
- role: fetch-sphinx-output
- sphinx_output_src: "{{ zuul.project.src_dir }}/doc/build/html/"
? ^ ^
+ sphinx_output_src: "{{ zuul.project.src_dir }}/releasenotes/build/html/"
? ^^^^^^^^ ^^^
zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts"
- create-afs-token
- role: upload-afs
afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}"
- destroy-afs-token | 2 | 0.166667 | 1 | 1 |
df69db74717005172d15f9160aca0e6acef7c716 | .config/fish/functions/📱__xcode.fish | .config/fish/functions/📱__xcode.fish | function 📱__xcode
echo "📱 Xcode"
echo
if test -z $XCODE_INSTALL_USER; and test -n (user.email)
set --export --universal XCODE_INSTALL_USER (user.email)
end
# Update the list of available versions to install
xcversion update
# Install the CLI tools, if necessary
if not test -e /Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib
xcversion install-cli-tools
end
echo "Available:"
xcversion list
set -l installed (xcversion list)
set -l newest_version $installed[-1]
if not string match "*(installed)" $newest_version
xcversion install $newest_version
end
echo
echo "Installed:"
xclist
end
| function 📱__xcode
echo "📱 Xcode"
echo
if test -z $XCODE_INSTALL_USER; and test -n (user.email)
set --export --universal XCODE_INSTALL_USER (user.email)
end
# Currently selected version
xcode-select --print-path
# Update the list of available versions to install
xcversion update
# Install the CLI tools, if necessary
if not test -e /Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib
# Manual way
# xcode-select --install
xcversion install-cli-tools
end
echo "Available:"
xcversion list
set -l installed (xcversion list)
set -l newest_version $installed[-1]
if not string match "*(installed)" $newest_version
xcversion install $newest_version
end
echo
echo "Installed:"
xclist
end
| Print current Xcode version before doing anything else | [upstall] Print current Xcode version before doing anything else
| fish | mit | phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles | fish | ## Code Before:
function 📱__xcode
echo "📱 Xcode"
echo
if test -z $XCODE_INSTALL_USER; and test -n (user.email)
set --export --universal XCODE_INSTALL_USER (user.email)
end
# Update the list of available versions to install
xcversion update
# Install the CLI tools, if necessary
if not test -e /Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib
xcversion install-cli-tools
end
echo "Available:"
xcversion list
set -l installed (xcversion list)
set -l newest_version $installed[-1]
if not string match "*(installed)" $newest_version
xcversion install $newest_version
end
echo
echo "Installed:"
xclist
end
## Instruction:
[upstall] Print current Xcode version before doing anything else
## Code After:
function 📱__xcode
echo "📱 Xcode"
echo
if test -z $XCODE_INSTALL_USER; and test -n (user.email)
set --export --universal XCODE_INSTALL_USER (user.email)
end
# Currently selected version
xcode-select --print-path
# Update the list of available versions to install
xcversion update
# Install the CLI tools, if necessary
if not test -e /Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib
# Manual way
# xcode-select --install
xcversion install-cli-tools
end
echo "Available:"
xcversion list
set -l installed (xcversion list)
set -l newest_version $installed[-1]
if not string match "*(installed)" $newest_version
xcversion install $newest_version
end
echo
echo "Installed:"
xclist
end
| function 📱__xcode
echo "📱 Xcode"
echo
if test -z $XCODE_INSTALL_USER; and test -n (user.email)
set --export --universal XCODE_INSTALL_USER (user.email)
end
+ # Currently selected version
+ xcode-select --print-path
+
# Update the list of available versions to install
xcversion update
# Install the CLI tools, if necessary
if not test -e /Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib
+ # Manual way
+ # xcode-select --install
xcversion install-cli-tools
end
echo "Available:"
xcversion list
set -l installed (xcversion list)
set -l newest_version $installed[-1]
if not string match "*(installed)" $newest_version
xcversion install $newest_version
end
echo
echo "Installed:"
xclist
end | 5 | 0.178571 | 5 | 0 |
5558afe688580ae87125c2bda713d61cc755b519 | README.md | README.md | go-mediainfo
============
Go wrapper of the mediainfo library.
`cmd/howtouse/howtouse.go` shows a brief example of most of the functions. The MediaInfo library is a bit unconventional
in its design and somewhat poorly documented.
Unlike the official wrappers there are a few liberties with naming taken to make the library more idiomatic Go.
TODO
====
Implement internal handling of DLL loading and support Windows by using ANSI versions always.
| go-mediainfo
============
Go wrapper of the mediainfo library.
`cmd/howtouse/howtouse.go` shows a brief example of most of the functions. The MediaInfo library is a bit unconventional
in its design and somewhat poorly documented.
Unlike the official wrappers there are a few liberties with naming taken to make the library more idiomatic Go.
| Remove TODO, since windows works | Remove TODO, since windows works
| Markdown | mit | jkl1337/go-mediainfo,jkl1337/go-mediainfo,jkl1337/go-mediainfo | markdown | ## Code Before:
go-mediainfo
============
Go wrapper of the mediainfo library.
`cmd/howtouse/howtouse.go` shows a brief example of most of the functions. The MediaInfo library is a bit unconventional
in its design and somewhat poorly documented.
Unlike the official wrappers there are a few liberties with naming taken to make the library more idiomatic Go.
TODO
====
Implement internal handling of DLL loading and support Windows by using ANSI versions always.
## Instruction:
Remove TODO, since windows works
## Code After:
go-mediainfo
============
Go wrapper of the mediainfo library.
`cmd/howtouse/howtouse.go` shows a brief example of most of the functions. The MediaInfo library is a bit unconventional
in its design and somewhat poorly documented.
Unlike the official wrappers there are a few liberties with naming taken to make the library more idiomatic Go.
| go-mediainfo
============
Go wrapper of the mediainfo library.
`cmd/howtouse/howtouse.go` shows a brief example of most of the functions. The MediaInfo library is a bit unconventional
in its design and somewhat poorly documented.
Unlike the official wrappers there are a few liberties with naming taken to make the library more idiomatic Go.
-
- TODO
- ====
-
- Implement internal handling of DLL loading and support Windows by using ANSI versions always. | 5 | 0.384615 | 0 | 5 |
eda18f9410c120e132555bf318a086d7b62e83cf | code-sample-java/code-sample-java-10/src/main/java/codesample/java10/NewStuffJavaTen.java | code-sample-java/code-sample-java-10/src/main/java/codesample/java10/NewStuffJavaTen.java | package codesample.java10;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class NewStuffJavaTen {
public static void main(String[] args) {
/* Type-inference (Note: does not work for non-local variables, array initializers,
lambdas (when you create lambda. Returning result into var is OK) */
var message = "Hello, world!";
System.out.println(message);
// Note: This will be array list of Objects
var empList = new ArrayList<>();
/* copyOf for collections */
var list = List.of(1,2,3);
var copy = List.copyOf(list);
/* unmodifiable collections on collectors*/
var set = copy.stream()
.map(value -> value * 3)
.collect(Collectors.toUnmodifiableSet());
/* orElseThrow without arguments throws NoSuchElementException */
var oneElementList = List.of(5);
var onlyElement = oneElementList.stream()
.filter(value -> value > 3)
.findFirst()
.orElseThrow();
}
}
| package codesample.java10;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class NewStuffJavaTen {
public static void main(String[] args) {
/* Type-inference (Note: does not work for non-local variables, array initializers,
lambdas (when you create lambda. Returning result into var is OK) */
var message = "Hello, world!";
var кукареку = new Кукареку<Кукарек>();
System.out.println(message);
// Note: This will be array list of Objects
var empList = new ArrayList<>();
/* copyOf for collections */
var list = List.of(1,2,3);
var copy = List.copyOf(list);
/* unmodifiable collections on collectors*/
var set = copy.stream()
.map(value -> value * 3)
.collect(Collectors.toUnmodifiableSet());
/* orElseThrow without arguments throws NoSuchElementException */
var oneElementList = List.of(5);
var onlyElement = oneElementList.stream()
.filter(value -> value > 3)
.findFirst()
.orElseThrow();
var var = Var.var();
var.var().var().var().var();
var listOfInt = new ArrayList<Integer>(List.of(1,2,3));
var copyy = Collections.unmodifiableList(listOfInt);
System.out.println(copyy);
listOfInt.add(4);
System.out.println(copyy);
}
public interface Animal {}
public interface Cat extends Animal { void meow(); }
public interface Dog extends Animal { void woof(); }
void makeSound(Animal animal) {
var catDog = (Cat & Dog) animal;
catDog.meow();
catDog.woof();
}
static class Кукареку<T> {
}
static class Кукарек {
}
public static class Var {
public static Var var() {
return new Var();
}
}
}
| Add new java 10 code | Add new java 10 code
| Java | mit | aquatir/remember_java_api,aquatir/remember_java_api,aquatir/remember_java_api,aquatir/remember_java_api | java | ## Code Before:
package codesample.java10;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class NewStuffJavaTen {
public static void main(String[] args) {
/* Type-inference (Note: does not work for non-local variables, array initializers,
lambdas (when you create lambda. Returning result into var is OK) */
var message = "Hello, world!";
System.out.println(message);
// Note: This will be array list of Objects
var empList = new ArrayList<>();
/* copyOf for collections */
var list = List.of(1,2,3);
var copy = List.copyOf(list);
/* unmodifiable collections on collectors*/
var set = copy.stream()
.map(value -> value * 3)
.collect(Collectors.toUnmodifiableSet());
/* orElseThrow without arguments throws NoSuchElementException */
var oneElementList = List.of(5);
var onlyElement = oneElementList.stream()
.filter(value -> value > 3)
.findFirst()
.orElseThrow();
}
}
## Instruction:
Add new java 10 code
## Code After:
package codesample.java10;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class NewStuffJavaTen {
public static void main(String[] args) {
/* Type-inference (Note: does not work for non-local variables, array initializers,
lambdas (when you create lambda. Returning result into var is OK) */
var message = "Hello, world!";
var кукареку = new Кукареку<Кукарек>();
System.out.println(message);
// Note: This will be array list of Objects
var empList = new ArrayList<>();
/* copyOf for collections */
var list = List.of(1,2,3);
var copy = List.copyOf(list);
/* unmodifiable collections on collectors*/
var set = copy.stream()
.map(value -> value * 3)
.collect(Collectors.toUnmodifiableSet());
/* orElseThrow without arguments throws NoSuchElementException */
var oneElementList = List.of(5);
var onlyElement = oneElementList.stream()
.filter(value -> value > 3)
.findFirst()
.orElseThrow();
var var = Var.var();
var.var().var().var().var();
var listOfInt = new ArrayList<Integer>(List.of(1,2,3));
var copyy = Collections.unmodifiableList(listOfInt);
System.out.println(copyy);
listOfInt.add(4);
System.out.println(copyy);
}
public interface Animal {}
public interface Cat extends Animal { void meow(); }
public interface Dog extends Animal { void woof(); }
void makeSound(Animal animal) {
var catDog = (Cat & Dog) animal;
catDog.meow();
catDog.woof();
}
static class Кукареку<T> {
}
static class Кукарек {
}
public static class Var {
public static Var var() {
return new Var();
}
}
}
| package codesample.java10;
import java.util.ArrayList;
+ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
+ import java.util.stream.Stream;
public class NewStuffJavaTen {
public static void main(String[] args) {
/* Type-inference (Note: does not work for non-local variables, array initializers,
lambdas (when you create lambda. Returning result into var is OK) */
var message = "Hello, world!";
+
+
+ var кукареку = new Кукареку<Кукарек>();
+
System.out.println(message);
// Note: This will be array list of Objects
var empList = new ArrayList<>();
/* copyOf for collections */
var list = List.of(1,2,3);
var copy = List.copyOf(list);
/* unmodifiable collections on collectors*/
var set = copy.stream()
.map(value -> value * 3)
.collect(Collectors.toUnmodifiableSet());
/* orElseThrow without arguments throws NoSuchElementException */
var oneElementList = List.of(5);
var onlyElement = oneElementList.stream()
.filter(value -> value > 3)
.findFirst()
.orElseThrow();
+
+ var var = Var.var();
+ var.var().var().var().var();
+
+ var listOfInt = new ArrayList<Integer>(List.of(1,2,3));
+ var copyy = Collections.unmodifiableList(listOfInt);
+ System.out.println(copyy);
+ listOfInt.add(4);
+ System.out.println(copyy);
+ }
+
+
+ public interface Animal {}
+ public interface Cat extends Animal { void meow(); }
+ public interface Dog extends Animal { void woof(); }
+
+ void makeSound(Animal animal) {
+ var catDog = (Cat & Dog) animal;
+ catDog.meow();
+ catDog.woof();
+ }
+
+ static class Кукареку<T> {
+
+ }
+
+ static class Кукарек {
+
+ }
+
+ public static class Var {
+ public static Var var() {
+ return new Var();
+ }
}
} | 40 | 1.176471 | 40 | 0 |
9c3cacdb22e2697bb4f8d249f18c823930c37a16 | README.md | README.md |
A micro web framework for [go](http://golang.org).
## Installation
go get github.com/calebbrown/uweb
## Documentation
Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb) or simply run `godoc -http=":6060"` after installation.
|
A micro web framework for [Go](http://golang.org).
## Overview
µweb is a small library designed to simplify the creation of web apps in Go.
It is heavily inspired by the Python library [BottlePy](http://bottlepy.org/).
**Note:** µweb is currently pre-alpha. The existing API is fairly stable but
may change.
## Example: Hello World
package main
import (
"github.com/calebbrown/uweb"
"fmt"
)
func main() {
uweb.Route("^hello/(.*)$", func(name string) string {
return fmt.Sprintf("<b>Hello, %s!</b>!", name)
})
uweb.Run("localhost:8080")
}
Copy and paste this code into an editor, save the file as `hello.go`, in a shell run
`go run hello.go`, then point your browser to
[localhost:8080/hello/world](http://localhost:8080/hello/world).
## Installation
go get github.com/calebbrown/uweb
## Documentation
Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb)
or simply run `godoc -http=":6060"` after installation and visit [localhost:6060/pkg/github.com/calebbrown/uweb](http://localhost:6060/pkg/github.com/calebbrown/uweb).
| Update the readme to make it better. | Update the readme to make it better.
| Markdown | bsd-3-clause | calebbrown/uweb | markdown | ## Code Before:
A micro web framework for [go](http://golang.org).
## Installation
go get github.com/calebbrown/uweb
## Documentation
Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb) or simply run `godoc -http=":6060"` after installation.
## Instruction:
Update the readme to make it better.
## Code After:
A micro web framework for [Go](http://golang.org).
## Overview
µweb is a small library designed to simplify the creation of web apps in Go.
It is heavily inspired by the Python library [BottlePy](http://bottlepy.org/).
**Note:** µweb is currently pre-alpha. The existing API is fairly stable but
may change.
## Example: Hello World
package main
import (
"github.com/calebbrown/uweb"
"fmt"
)
func main() {
uweb.Route("^hello/(.*)$", func(name string) string {
return fmt.Sprintf("<b>Hello, %s!</b>!", name)
})
uweb.Run("localhost:8080")
}
Copy and paste this code into an editor, save the file as `hello.go`, in a shell run
`go run hello.go`, then point your browser to
[localhost:8080/hello/world](http://localhost:8080/hello/world).
## Installation
go get github.com/calebbrown/uweb
## Documentation
Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb)
or simply run `godoc -http=":6060"` after installation and visit [localhost:6060/pkg/github.com/calebbrown/uweb](http://localhost:6060/pkg/github.com/calebbrown/uweb).
|
- A micro web framework for [go](http://golang.org).
? ^
+ A micro web framework for [Go](http://golang.org).
? ^
+
+
+ ## Overview
+
+ µweb is a small library designed to simplify the creation of web apps in Go.
+
+ It is heavily inspired by the Python library [BottlePy](http://bottlepy.org/).
+
+ **Note:** µweb is currently pre-alpha. The existing API is fairly stable but
+ may change.
+
+ ## Example: Hello World
+
+ package main
+
+ import (
+ "github.com/calebbrown/uweb"
+ "fmt"
+ )
+
+ func main() {
+ uweb.Route("^hello/(.*)$", func(name string) string {
+ return fmt.Sprintf("<b>Hello, %s!</b>!", name)
+ })
+ uweb.Run("localhost:8080")
+ }
+
+ Copy and paste this code into an editor, save the file as `hello.go`, in a shell run
+ `go run hello.go`, then point your browser to
+ [localhost:8080/hello/world](http://localhost:8080/hello/world).
+
## Installation
go get github.com/calebbrown/uweb
-
## Documentation
- Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb) or simply run `godoc -http=":6060"` after installation.
? --------------------------------------------------------
+ Visit [http://godoc.org/github.com/calebbrown/uweb](http://godoc.org/github.com/calebbrown/uweb)
+ or simply run `godoc -http=":6060"` after installation and visit [localhost:6060/pkg/github.com/calebbrown/uweb](http://localhost:6060/pkg/github.com/calebbrown/uweb).
| 37 | 2.846154 | 34 | 3 |
3e395f5bb914afdbf84ca2add2562b4f058d5c66 | build.js | build.js | var fs = require('fs');
var exec = require('child_process').exec;
function Err(msg, err){
var err_str = 'build error\n'
+ (msg ? msg + '\n' : '')
+ (err ? err.message + '\n' : '');
throw new Error(err_str);
}
function build(dir){
var commands = 'cd ' + dir + ' && npm install && node-gyp configure && node-gyp build';
exec(commands, function (err, stdout, stderr) {
if(err)
console.log('--- exec error ---\n' + err + '--- end exec error ---');
console.log('--- stdout ---\n' + stdout + '--- end stdout ---');
console.log('--- stderr ---\n' + stderr + '--- end stderr ---');
});
}
var lib_dir = __dirname + '/lib';
fs.readdir(lib_dir, function (err, dirs){
if(err) return Err('Could not read ' + lib_dir, err);
dirs.forEach(function (dir){
var module_dir = lib_dir + '/' + dir
fs.readdir(module_dir, function (err, dirs){
if(err) return Err('Could not read ', err);
dirs.forEach(function (dir){
if(dir == 'cpp')
build(module_dir + '/' + dir);
});
});
});
}); | var fs = require('fs');
var exec = require('child_process').exec;
function Err(msg, err){
var err_str = 'build error\n'
+ (msg ? msg + '\n' : '')
+ (err ? err.message + '\n' : '');
throw new Error(err_str);
}
function build(dir){
var commands = 'cd ' + dir + ' && npm install && node-gyp configure && node-gyp build';
console.log(commands);
exec(commands, function (err, stdout, stderr) {
if(err)
console.log('--- exec error ---\n' + err + '--- end exec error ---');
console.log('--- stdout ---\n' + stdout + '--- end stdout ---');
console.log('--- stderr ---\n' + stderr + '--- end stderr ---');
});
}
var lib_dir = __dirname + '/lib';
fs.readdir(lib_dir, function (err, dirs){
if(err) return Err('Could not read ' + lib_dir, err);
dirs.forEach(function (dir){
var module_dir = lib_dir + '/' + dir
fs.readdir(module_dir, function (err, dirs){
if(err) return Err('Could not read ', err);
dirs.forEach(function (dir){
if(dir == 'cpp')
build(module_dir + '/' + dir);
});
});
});
}); | Test child process command logging | Test child process command logging
| JavaScript | mit | opensoars/base,opensoars/base,opensoars/base,opensoars/base,opensoars/base | javascript | ## Code Before:
var fs = require('fs');
var exec = require('child_process').exec;
function Err(msg, err){
var err_str = 'build error\n'
+ (msg ? msg + '\n' : '')
+ (err ? err.message + '\n' : '');
throw new Error(err_str);
}
function build(dir){
var commands = 'cd ' + dir + ' && npm install && node-gyp configure && node-gyp build';
exec(commands, function (err, stdout, stderr) {
if(err)
console.log('--- exec error ---\n' + err + '--- end exec error ---');
console.log('--- stdout ---\n' + stdout + '--- end stdout ---');
console.log('--- stderr ---\n' + stderr + '--- end stderr ---');
});
}
var lib_dir = __dirname + '/lib';
fs.readdir(lib_dir, function (err, dirs){
if(err) return Err('Could not read ' + lib_dir, err);
dirs.forEach(function (dir){
var module_dir = lib_dir + '/' + dir
fs.readdir(module_dir, function (err, dirs){
if(err) return Err('Could not read ', err);
dirs.forEach(function (dir){
if(dir == 'cpp')
build(module_dir + '/' + dir);
});
});
});
});
## Instruction:
Test child process command logging
## Code After:
var fs = require('fs');
var exec = require('child_process').exec;
function Err(msg, err){
var err_str = 'build error\n'
+ (msg ? msg + '\n' : '')
+ (err ? err.message + '\n' : '');
throw new Error(err_str);
}
function build(dir){
var commands = 'cd ' + dir + ' && npm install && node-gyp configure && node-gyp build';
console.log(commands);
exec(commands, function (err, stdout, stderr) {
if(err)
console.log('--- exec error ---\n' + err + '--- end exec error ---');
console.log('--- stdout ---\n' + stdout + '--- end stdout ---');
console.log('--- stderr ---\n' + stderr + '--- end stderr ---');
});
}
var lib_dir = __dirname + '/lib';
fs.readdir(lib_dir, function (err, dirs){
if(err) return Err('Could not read ' + lib_dir, err);
dirs.forEach(function (dir){
var module_dir = lib_dir + '/' + dir
fs.readdir(module_dir, function (err, dirs){
if(err) return Err('Could not read ', err);
dirs.forEach(function (dir){
if(dir == 'cpp')
build(module_dir + '/' + dir);
});
});
});
}); | var fs = require('fs');
var exec = require('child_process').exec;
function Err(msg, err){
var err_str = 'build error\n'
+ (msg ? msg + '\n' : '')
+ (err ? err.message + '\n' : '');
throw new Error(err_str);
}
function build(dir){
var commands = 'cd ' + dir + ' && npm install && node-gyp configure && node-gyp build';
+ console.log(commands);
+
exec(commands, function (err, stdout, stderr) {
if(err)
console.log('--- exec error ---\n' + err + '--- end exec error ---');
console.log('--- stdout ---\n' + stdout + '--- end stdout ---');
console.log('--- stderr ---\n' + stderr + '--- end stderr ---');
});
}
var lib_dir = __dirname + '/lib';
fs.readdir(lib_dir, function (err, dirs){
if(err) return Err('Could not read ' + lib_dir, err);
dirs.forEach(function (dir){
var module_dir = lib_dir + '/' + dir
fs.readdir(module_dir, function (err, dirs){
if(err) return Err('Could not read ', err);
dirs.forEach(function (dir){
if(dir == 'cpp')
build(module_dir + '/' + dir);
});
});
});
}); | 2 | 0.045455 | 2 | 0 |
620d1907b1e089a38d9e27236e87024908dbe598 | Magic/src/main/resources/examples/sandbox/wands.yml | Magic/src/main/resources/examples/sandbox/wands.yml | base_bound:
hidden: true
bound: true
keep: true
invulnerable: true
immortal: true
track: true
undroppable: true
indestructible: true
base_wand:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: cast
right_click: toggle
swap: cycle_hotbar
quiet: 1
effect_bubbles: false
item_attributes:
GENERIC_ATTACK_SPEED: 10
item_attribute_slot: mainhand
base_sword:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: none
right_click: toggle
swap: cycle_hotbar
quick_cast: true
quiet: 1
base_bow:
hidden: true
inherit: base_bound
mode: inventory
drop: toggle
left_click: none
right_click: none
swap: cycle_hotbar
quiet: 1
sandbox:
inherit: base_wand
name: Sandbox Wand
icon: wood_hoe:6
description: Contains all of the spells you have created
mana: 1000
mana_regeneration: 10
fill: true | base_bound:
hidden: true
bound: true
keep: true
invulnerable: true
immortal: true
track: true
undroppable: true
indestructible: true
base_wand:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: cast
right_click: toggle
swap: cycle_hotbar
quiet: 1
effect_bubbles: false
item_attributes:
GENERIC_ATTACK_SPEED: 10
item_attribute_slot: mainhand
base_sword:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: none
right_click: toggle
swap: cycle_hotbar
quick_cast: true
quiet: 1
base_bow:
hidden: true
inherit: base_bound
mode: inventory
drop: toggle
left_click: none
right_click: none
swap: cycle_hotbar
quiet: 1
sandbox:
inherit: base_wand
name: Sandbox Wand
icon: wood_hoe:6
description: Contains all of the spells you have created
mana: 1000
mana_max: 1000
mana_regeneration: 10
fill: true | Fix sandbox wand having no mana max | Fix sandbox wand having no mana max
| YAML | mit | elBukkit/MagicPlugin,elBukkit/MagicPlugin,elBukkit/MagicPlugin | yaml | ## Code Before:
base_bound:
hidden: true
bound: true
keep: true
invulnerable: true
immortal: true
track: true
undroppable: true
indestructible: true
base_wand:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: cast
right_click: toggle
swap: cycle_hotbar
quiet: 1
effect_bubbles: false
item_attributes:
GENERIC_ATTACK_SPEED: 10
item_attribute_slot: mainhand
base_sword:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: none
right_click: toggle
swap: cycle_hotbar
quick_cast: true
quiet: 1
base_bow:
hidden: true
inherit: base_bound
mode: inventory
drop: toggle
left_click: none
right_click: none
swap: cycle_hotbar
quiet: 1
sandbox:
inherit: base_wand
name: Sandbox Wand
icon: wood_hoe:6
description: Contains all of the spells you have created
mana: 1000
mana_regeneration: 10
fill: true
## Instruction:
Fix sandbox wand having no mana max
## Code After:
base_bound:
hidden: true
bound: true
keep: true
invulnerable: true
immortal: true
track: true
undroppable: true
indestructible: true
base_wand:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: cast
right_click: toggle
swap: cycle_hotbar
quiet: 1
effect_bubbles: false
item_attributes:
GENERIC_ATTACK_SPEED: 10
item_attribute_slot: mainhand
base_sword:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: none
right_click: toggle
swap: cycle_hotbar
quick_cast: true
quiet: 1
base_bow:
hidden: true
inherit: base_bound
mode: inventory
drop: toggle
left_click: none
right_click: none
swap: cycle_hotbar
quiet: 1
sandbox:
inherit: base_wand
name: Sandbox Wand
icon: wood_hoe:6
description: Contains all of the spells you have created
mana: 1000
mana_max: 1000
mana_regeneration: 10
fill: true | base_bound:
hidden: true
bound: true
keep: true
invulnerable: true
immortal: true
track: true
undroppable: true
indestructible: true
base_wand:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: cast
right_click: toggle
swap: cycle_hotbar
quiet: 1
effect_bubbles: false
item_attributes:
GENERIC_ATTACK_SPEED: 10
item_attribute_slot: mainhand
base_sword:
hidden: true
inherit: base_bound
mode: inventory
drop: cycle_hotbar
left_click: none
right_click: toggle
swap: cycle_hotbar
quick_cast: true
quiet: 1
base_bow:
hidden: true
inherit: base_bound
mode: inventory
drop: toggle
left_click: none
right_click: none
swap: cycle_hotbar
quiet: 1
sandbox:
inherit: base_wand
name: Sandbox Wand
icon: wood_hoe:6
description: Contains all of the spells you have created
mana: 1000
+ mana_max: 1000
mana_regeneration: 10
fill: true | 1 | 0.018868 | 1 | 0 |
cd363f9867a1734ee52ed92f65feab3921bedab8 | src/response/respond.lisp | src/response/respond.lisp | (in-package #:eloquent.mvc.response)
(defun respond (body
&key
(encoder #'identity)
(headers '())
(status 200))
(make-instance '<response>
:body (funcall encoder body)
:status status
:headers headers))
(defun respond-json (body
&key
(headers '())
(status 200))
"Encoding body into JSON and send response with at least the header Content-Type equals \"application/json\""
(setf headers
(override-header headers :content-type "application/json"))
(respond
(cl-json:encode-json-to-string body)
:headers headers
:status status))
| (in-package #:eloquent.mvc.response)
(defun respond (body
&key
(encoder #'identity)
(headers '())
(status 200))
(when (keywordp encoder)
(setf encoder (make-encoder encoder)))
(make-instance '<response>
:body (funcall encoder body)
:status status
:headers headers))
(defun respond-json (body
&key
(headers '())
(status 200))
"Encoding body into JSON and send response with at least the header Content-Type equals \"application/json\""
(setf headers
(override-header headers :content-type "application/json"))
(respond
(cl-json:encode-json-to-string body)
:headers headers
:status status))
| Support passing keyword as encoder to RESPOND | Support passing keyword as encoder to RESPOND
In the function RESPOND, it will call MAKE-ENCODER if the encoder is a
keyword symbol
| Common Lisp | mit | Liutos/eloquent-mvc,Liutos/eloquent-mvc | common-lisp | ## Code Before:
(in-package #:eloquent.mvc.response)
(defun respond (body
&key
(encoder #'identity)
(headers '())
(status 200))
(make-instance '<response>
:body (funcall encoder body)
:status status
:headers headers))
(defun respond-json (body
&key
(headers '())
(status 200))
"Encoding body into JSON and send response with at least the header Content-Type equals \"application/json\""
(setf headers
(override-header headers :content-type "application/json"))
(respond
(cl-json:encode-json-to-string body)
:headers headers
:status status))
## Instruction:
Support passing keyword as encoder to RESPOND
In the function RESPOND, it will call MAKE-ENCODER if the encoder is a
keyword symbol
## Code After:
(in-package #:eloquent.mvc.response)
(defun respond (body
&key
(encoder #'identity)
(headers '())
(status 200))
(when (keywordp encoder)
(setf encoder (make-encoder encoder)))
(make-instance '<response>
:body (funcall encoder body)
:status status
:headers headers))
(defun respond-json (body
&key
(headers '())
(status 200))
"Encoding body into JSON and send response with at least the header Content-Type equals \"application/json\""
(setf headers
(override-header headers :content-type "application/json"))
(respond
(cl-json:encode-json-to-string body)
:headers headers
:status status))
| (in-package #:eloquent.mvc.response)
(defun respond (body
&key
(encoder #'identity)
(headers '())
(status 200))
+ (when (keywordp encoder)
+ (setf encoder (make-encoder encoder)))
(make-instance '<response>
:body (funcall encoder body)
:status status
:headers headers))
(defun respond-json (body
&key
(headers '())
(status 200))
"Encoding body into JSON and send response with at least the header Content-Type equals \"application/json\""
(setf headers
(override-header headers :content-type "application/json"))
(respond
(cl-json:encode-json-to-string body)
:headers headers
:status status)) | 2 | 0.086957 | 2 | 0 |
c39051e0a06537503ccefcd3d8dc66283fedd947 | examples/example_irule_simple.tcl | examples/example_irule_simple.tcl | package require -exact testcl 0.9
namespace import ::testcl::*
##
# Example demonstrating how to use TesTcl
# This is how you should write your tests
#
# To run example
#
# export TCLLIBPATH=/parent/dir/of/this/file
#
# and run the following command from /parent/dir/of/this/file
#
# jtcl examples/example_irule_simple.tcl
#
##
# Comment out to suppress logging
#log::lvSuppressLE info 0
before {
event HTTP_REQUEST
}
it "should handle request using pool bar" {
on HTTP::uri return "/bar"
endstate pool bar
run irules/simple_irule.tcl simple
}
it "should handle request using pool foo" {
on HTTP::uri return "/foo/admin"
endstate pool foo
run irules/simple_irule.tcl simple
}
stats | package require -exact testcl 0.9
namespace import ::testcl::*
##
# Example demonstrating how to use TesTcl
# This is how you should write your tests
#
# To run example
#
# export TCLLIBPATH=/parent/dir/of/this/file
#
# and run the following command from /parent/dir/of/this/file
#
# jtcl examples/example_irule_simple.tcl
#
##
# Comment out to suppress logging
#log::lvSuppressLE info 0
before {
#in most test cases we are checking request event
event HTTP_REQUEST
}
it "should handle request using pool bar" {
#provide uri value to use in test case
on HTTP::uri return "/bar"
#define statement which will be end state in iRule execution for this test case
endstate pool bar
#execute iRule
run irules/simple_irule.tcl simple
}
it "should handle request using pool foo" {
on HTTP::uri return "/foo/admin"
endstate pool foo
run irules/simple_irule.tcl simple
}
it "should replace existing Vary http response headers with Accept-Encoding value" {
#override event type set in before
event HTTP_RESPONSE
#define verifications
verify "there should be only one Vary header" 1 == {HTTP::header count vary}
verify "there should be Accept-Encoding value in Vary header" "Accept-Encoding" eq {HTTP::header Vary}
#initialize HTTP headers
HTTP::header insert Vary "dummy value"
HTTP::header insert Vary "another dummy value"
#execute iRule
run irules/simple_irule.tcl simple
}
stats | Update of simple example to test HTTP_RESPONSE event | Update of simple example to test HTTP_RESPONSE event
| Tcl | bsd-3-clause | jamespic/TesTcl,landro/TesTcl | tcl | ## Code Before:
package require -exact testcl 0.9
namespace import ::testcl::*
##
# Example demonstrating how to use TesTcl
# This is how you should write your tests
#
# To run example
#
# export TCLLIBPATH=/parent/dir/of/this/file
#
# and run the following command from /parent/dir/of/this/file
#
# jtcl examples/example_irule_simple.tcl
#
##
# Comment out to suppress logging
#log::lvSuppressLE info 0
before {
event HTTP_REQUEST
}
it "should handle request using pool bar" {
on HTTP::uri return "/bar"
endstate pool bar
run irules/simple_irule.tcl simple
}
it "should handle request using pool foo" {
on HTTP::uri return "/foo/admin"
endstate pool foo
run irules/simple_irule.tcl simple
}
stats
## Instruction:
Update of simple example to test HTTP_RESPONSE event
## Code After:
package require -exact testcl 0.9
namespace import ::testcl::*
##
# Example demonstrating how to use TesTcl
# This is how you should write your tests
#
# To run example
#
# export TCLLIBPATH=/parent/dir/of/this/file
#
# and run the following command from /parent/dir/of/this/file
#
# jtcl examples/example_irule_simple.tcl
#
##
# Comment out to suppress logging
#log::lvSuppressLE info 0
before {
#in most test cases we are checking request event
event HTTP_REQUEST
}
it "should handle request using pool bar" {
#provide uri value to use in test case
on HTTP::uri return "/bar"
#define statement which will be end state in iRule execution for this test case
endstate pool bar
#execute iRule
run irules/simple_irule.tcl simple
}
it "should handle request using pool foo" {
on HTTP::uri return "/foo/admin"
endstate pool foo
run irules/simple_irule.tcl simple
}
it "should replace existing Vary http response headers with Accept-Encoding value" {
#override event type set in before
event HTTP_RESPONSE
#define verifications
verify "there should be only one Vary header" 1 == {HTTP::header count vary}
verify "there should be Accept-Encoding value in Vary header" "Accept-Encoding" eq {HTTP::header Vary}
#initialize HTTP headers
HTTP::header insert Vary "dummy value"
HTTP::header insert Vary "another dummy value"
#execute iRule
run irules/simple_irule.tcl simple
}
stats | package require -exact testcl 0.9
namespace import ::testcl::*
##
# Example demonstrating how to use TesTcl
# This is how you should write your tests
#
# To run example
#
# export TCLLIBPATH=/parent/dir/of/this/file
#
# and run the following command from /parent/dir/of/this/file
#
# jtcl examples/example_irule_simple.tcl
#
##
# Comment out to suppress logging
#log::lvSuppressLE info 0
before {
+ #in most test cases we are checking request event
event HTTP_REQUEST
}
it "should handle request using pool bar" {
+ #provide uri value to use in test case
on HTTP::uri return "/bar"
+ #define statement which will be end state in iRule execution for this test case
endstate pool bar
+ #execute iRule
run irules/simple_irule.tcl simple
}
it "should handle request using pool foo" {
on HTTP::uri return "/foo/admin"
endstate pool foo
run irules/simple_irule.tcl simple
}
+ it "should replace existing Vary http response headers with Accept-Encoding value" {
+ #override event type set in before
+ event HTTP_RESPONSE
+ #define verifications
+ verify "there should be only one Vary header" 1 == {HTTP::header count vary}
+ verify "there should be Accept-Encoding value in Vary header" "Accept-Encoding" eq {HTTP::header Vary}
+ #initialize HTTP headers
+ HTTP::header insert Vary "dummy value"
+ HTTP::header insert Vary "another dummy value"
+ #execute iRule
+ run irules/simple_irule.tcl simple
+ }
+
stats | 17 | 0.459459 | 17 | 0 |
8a79503bfd52ca3f9e6e5db25b23824688023814 | application/schema/type/install.sql | application/schema/type/install.sql | @&&run_dir_begin
prompt Creating type QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process.tps
prompt Creating type QUILT_REPORT_TYPE
@@quilt_report_type.tps
prompt Creating type body QUILT_REPORT_PROCESS
@@quilt_report_process.tpb
prompt Creating type QUILT_OBJECT_TYPE
@@quilt_object_type.tps
prompt Creating type QUILT_OBJECT_LIST_TYPE
@@quilt_object_list_type.tps
@&&run_dir_end | @&&run_dir_begin
prompt Creating type QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process_type.tps
prompt Creating type QUILT_REPORT_TYPE
@@quilt_report_type.tps
prompt Creating type body QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process_type.tpb
prompt Creating type QUILT_OBJECT_TYPE
@@quilt_object_type.tps
prompt Creating type QUILT_OBJECT_LIST_TYPE
@@quilt_object_list_type.tps
@&&run_dir_end | Rename typu - oprava SQL skriptu pro nasazeni typu | Rename typu - oprava SQL skriptu pro nasazeni typu
| SQL | mit | s-oravec/quilt,s-oravec/quilt | sql | ## Code Before:
@&&run_dir_begin
prompt Creating type QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process.tps
prompt Creating type QUILT_REPORT_TYPE
@@quilt_report_type.tps
prompt Creating type body QUILT_REPORT_PROCESS
@@quilt_report_process.tpb
prompt Creating type QUILT_OBJECT_TYPE
@@quilt_object_type.tps
prompt Creating type QUILT_OBJECT_LIST_TYPE
@@quilt_object_list_type.tps
@&&run_dir_end
## Instruction:
Rename typu - oprava SQL skriptu pro nasazeni typu
## Code After:
@&&run_dir_begin
prompt Creating type QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process_type.tps
prompt Creating type QUILT_REPORT_TYPE
@@quilt_report_type.tps
prompt Creating type body QUILT_REPORT_PROCESS_TYPE
@@quilt_report_process_type.tpb
prompt Creating type QUILT_OBJECT_TYPE
@@quilt_object_type.tps
prompt Creating type QUILT_OBJECT_LIST_TYPE
@@quilt_object_list_type.tps
@&&run_dir_end | @&&run_dir_begin
prompt Creating type QUILT_REPORT_PROCESS_TYPE
- @@quilt_report_process.tps
+ @@quilt_report_process_type.tps
? +++++
prompt Creating type QUILT_REPORT_TYPE
@@quilt_report_type.tps
- prompt Creating type body QUILT_REPORT_PROCESS
+ prompt Creating type body QUILT_REPORT_PROCESS_TYPE
? +++++
- @@quilt_report_process.tpb
+ @@quilt_report_process_type.tpb
? +++++
prompt Creating type QUILT_OBJECT_TYPE
@@quilt_object_type.tps
prompt Creating type QUILT_OBJECT_LIST_TYPE
@@quilt_object_list_type.tps
@&&run_dir_end | 6 | 0.315789 | 3 | 3 |
da0d19cbd59bf2b341bb65111d5159093a275e15 | lib/active_set.rb | lib/active_set.rb |
require 'active_set/version'
require 'active_set/processors/filter_processor'
require 'active_set/processors/sort_processor'
require 'active_set/processors/paginate_processor'
require 'active_set/processors/transform_processor'
class ActiveSet
include Enumerable
attr_reader :set
def initialize(set)
@set = set
end
def each(&block)
@set.each(&block)
end
def ==(other)
return @set == other unless other.is_a?(ActiveSet)
@set == other.set
end
def method_missing(method_name, *args, &block)
@set.send(method_name, *args, &block) || super
end
def respond_to_missing?(method_name, include_private = false)
@set.respond_to?(method_name) || super
end
def filter(instructions)
filterer = FilterProcessor.new(@set, instructions)
self.class.new(filterer.process)
end
def sort(instructions)
sorter = SortProcessor.new(@set, instructions)
self.class.new(sorter.process)
end
def paginate(instructions)
paginater = PaginateProcessor.new(@set, instructions)
self.class.new(paginater.process)
end
def transform(instructions)
transformer = TransformProcessor.new(@set, instructions)
self.class.new(transformer.process)
end
end
|
require 'active_set/version'
require 'active_set/processors/filter_processor'
require 'active_set/processors/sort_processor'
require 'active_set/processors/paginate_processor'
require 'active_set/processors/transform_processor'
class ActiveSet
include Enumerable
attr_reader :set
def initialize(set)
@set = set
end
def each(&block)
@set.each(&block)
end
def ==(other)
return @set == other unless other.is_a?(ActiveSet)
@set == other.set
end
def method_missing(method_name, *args, &block)
@set.send(method_name, *args, &block) || super
end
def respond_to_missing?(method_name, include_private = false)
@set.respond_to?(method_name) || super
end
def filter(instructions)
filterer = FilterProcessor.new(@set, instructions)
self.class.new(filterer.process)
end
def sort(instructions)
sorter = SortProcessor.new(@set, instructions)
self.class.new(sorter.process)
end
def paginate(instructions)
paginater = PaginateProcessor.new(@set, instructions)
self.class.new(paginater.process)
end
def transform(instructions)
transformer = TransformProcessor.new(@set, instructions)
transformer.process
end
end
| Fix bug where `transform` method tried to return a new instance of ActiveSet | Fix bug where `transform` method tried to return a new instance of ActiveSet
It should simply returned the transformed value
| Ruby | mit | fractaledmind/activeset,fractaledmind/activeset | ruby | ## Code Before:
require 'active_set/version'
require 'active_set/processors/filter_processor'
require 'active_set/processors/sort_processor'
require 'active_set/processors/paginate_processor'
require 'active_set/processors/transform_processor'
class ActiveSet
include Enumerable
attr_reader :set
def initialize(set)
@set = set
end
def each(&block)
@set.each(&block)
end
def ==(other)
return @set == other unless other.is_a?(ActiveSet)
@set == other.set
end
def method_missing(method_name, *args, &block)
@set.send(method_name, *args, &block) || super
end
def respond_to_missing?(method_name, include_private = false)
@set.respond_to?(method_name) || super
end
def filter(instructions)
filterer = FilterProcessor.new(@set, instructions)
self.class.new(filterer.process)
end
def sort(instructions)
sorter = SortProcessor.new(@set, instructions)
self.class.new(sorter.process)
end
def paginate(instructions)
paginater = PaginateProcessor.new(@set, instructions)
self.class.new(paginater.process)
end
def transform(instructions)
transformer = TransformProcessor.new(@set, instructions)
self.class.new(transformer.process)
end
end
## Instruction:
Fix bug where `transform` method tried to return a new instance of ActiveSet
It should simply returned the transformed value
## Code After:
require 'active_set/version'
require 'active_set/processors/filter_processor'
require 'active_set/processors/sort_processor'
require 'active_set/processors/paginate_processor'
require 'active_set/processors/transform_processor'
class ActiveSet
include Enumerable
attr_reader :set
def initialize(set)
@set = set
end
def each(&block)
@set.each(&block)
end
def ==(other)
return @set == other unless other.is_a?(ActiveSet)
@set == other.set
end
def method_missing(method_name, *args, &block)
@set.send(method_name, *args, &block) || super
end
def respond_to_missing?(method_name, include_private = false)
@set.respond_to?(method_name) || super
end
def filter(instructions)
filterer = FilterProcessor.new(@set, instructions)
self.class.new(filterer.process)
end
def sort(instructions)
sorter = SortProcessor.new(@set, instructions)
self.class.new(sorter.process)
end
def paginate(instructions)
paginater = PaginateProcessor.new(@set, instructions)
self.class.new(paginater.process)
end
def transform(instructions)
transformer = TransformProcessor.new(@set, instructions)
transformer.process
end
end
|
require 'active_set/version'
require 'active_set/processors/filter_processor'
require 'active_set/processors/sort_processor'
require 'active_set/processors/paginate_processor'
require 'active_set/processors/transform_processor'
class ActiveSet
include Enumerable
attr_reader :set
def initialize(set)
@set = set
end
def each(&block)
@set.each(&block)
end
def ==(other)
return @set == other unless other.is_a?(ActiveSet)
@set == other.set
end
def method_missing(method_name, *args, &block)
@set.send(method_name, *args, &block) || super
end
def respond_to_missing?(method_name, include_private = false)
@set.respond_to?(method_name) || super
end
def filter(instructions)
filterer = FilterProcessor.new(@set, instructions)
self.class.new(filterer.process)
end
def sort(instructions)
sorter = SortProcessor.new(@set, instructions)
self.class.new(sorter.process)
end
def paginate(instructions)
paginater = PaginateProcessor.new(@set, instructions)
self.class.new(paginater.process)
end
def transform(instructions)
transformer = TransformProcessor.new(@set, instructions)
- self.class.new(transformer.process)
+ transformer.process
end
end | 2 | 0.037037 | 1 | 1 |
22b5c1748f1651e8f141fa4a7310393e0d487b17 | README.md | README.md |
This is a quick hack to help @fluxspir organize his photos during his roadtrip
in Brazil.
Given the following structure:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
- 2014-02-01_vacation_b/
```
And given the following invocation of yog:
```sh
yog /home/jimmy/example
```
The following would be generated:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
+ index.html
+ thumbs/
+ filea.JPG.jpg
+ fileb.jpeg.jpg
+ filec.mov.jpg
+ web/
+ filea.jpg
+ fileb.jpg
+ filec.mov
```
## Metadata
If a `metadata.txt` file is found in a folder, yog will use its content as an
introduction paragraph in the index.html.
If a file is named after a media file with a trailing `.txt` extension, it will
be used for the image title instead of the filename.
## Installation
```sh
sudo cp yog* /usr/bin
```
## Requirements
- /bin/sh
- ImageMagick
- FFMpeg if you have videos in there
|
This is a quick hack to help @fluxspir organize his photos during his roadtrip
in Brazil.
Given the following structure:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
- 2014-02-01_vacation_b/
```
And given the following invocation of yog:
```sh
yog /home/jimmy/example
```
The following would be generated:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
+ index.html
+ thumbs/
+ filea.JPG.jpg
+ fileb.jpeg.jpg
+ filec.mov.jpg
+ web/
+ filea.jpg
+ fileb.jpg
+ filec.mov
```
## Metadata
If a `metadata.txt` file is found in a folder, yog will use its content as an
introduction paragraph in the index.html.
If a file is named after a media file with a trailing `.txt` extension, it will
be used for the image title instead of the filename.
## Installation
```sh
sudo cp yog* /usr/bin
```
## Requirements
- /bin/sh
- ImageMagick
- FFMpeg if you have videos in there
| Replace tabs in readme 'cause it looks fucked up in github. | Replace tabs in readme 'cause it looks fucked up in github.
| Markdown | isc | debsquad/yog,debsquad/yog | markdown | ## Code Before:
This is a quick hack to help @fluxspir organize his photos during his roadtrip
in Brazil.
Given the following structure:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
- 2014-02-01_vacation_b/
```
And given the following invocation of yog:
```sh
yog /home/jimmy/example
```
The following would be generated:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
+ index.html
+ thumbs/
+ filea.JPG.jpg
+ fileb.jpeg.jpg
+ filec.mov.jpg
+ web/
+ filea.jpg
+ fileb.jpg
+ filec.mov
```
## Metadata
If a `metadata.txt` file is found in a folder, yog will use its content as an
introduction paragraph in the index.html.
If a file is named after a media file with a trailing `.txt` extension, it will
be used for the image title instead of the filename.
## Installation
```sh
sudo cp yog* /usr/bin
```
## Requirements
- /bin/sh
- ImageMagick
- FFMpeg if you have videos in there
## Instruction:
Replace tabs in readme 'cause it looks fucked up in github.
## Code After:
This is a quick hack to help @fluxspir organize his photos during his roadtrip
in Brazil.
Given the following structure:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
- 2014-02-01_vacation_b/
```
And given the following invocation of yog:
```sh
yog /home/jimmy/example
```
The following would be generated:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- filec.mov
+ index.html
+ thumbs/
+ filea.JPG.jpg
+ fileb.jpeg.jpg
+ filec.mov.jpg
+ web/
+ filea.jpg
+ fileb.jpg
+ filec.mov
```
## Metadata
If a `metadata.txt` file is found in a folder, yog will use its content as an
introduction paragraph in the index.html.
If a file is named after a media file with a trailing `.txt` extension, it will
be used for the image title instead of the filename.
## Installation
```sh
sudo cp yog* /usr/bin
```
## Requirements
- /bin/sh
- ImageMagick
- FFMpeg if you have videos in there
|
This is a quick hack to help @fluxspir organize his photos during his roadtrip
in Brazil.
Given the following structure:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- - filec.mov
+ - filec.mov
- 2014-02-01_vacation_b/
```
And given the following invocation of yog:
```sh
yog /home/jimmy/example
```
The following would be generated:
```
- /home/jimmy
- example/
- 2014-01-01_vacation_a/
- filea.JPG
- fileb.jpeg
- - filec.mov
+ - filec.mov
+ index.html
+ thumbs/
+ filea.JPG.jpg
+ fileb.jpeg.jpg
- + filec.mov.jpg
? ^
+ + filec.mov.jpg
? ^^^^^^^^
+ web/
+ filea.jpg
+ fileb.jpg
- + filec.mov
? ^
+ + filec.mov
? ^^^^^^^^
```
## Metadata
If a `metadata.txt` file is found in a folder, yog will use its content as an
introduction paragraph in the index.html.
If a file is named after a media file with a trailing `.txt` extension, it will
be used for the image title instead of the filename.
## Installation
```sh
sudo cp yog* /usr/bin
```
## Requirements
- /bin/sh
- ImageMagick
- FFMpeg if you have videos in there | 8 | 0.135593 | 4 | 4 |
44adda30a7f72903c2a389eac1715c51662e5af4 | hadoop_ocl_link_test/src/hadoop/MaxTemperatureMapper.java | hadoop_ocl_link_test/src/hadoop/MaxTemperatureMapper.java | package hadoop;
import gsod.DataSet;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MaxTemperatureMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
@Override
public void map(LongWritable key, Text value,
MaxTemperatureMapper.Context context) throws IOException,
InterruptedException {
String line = value.toString();
if (line.startsWith("STN---"))
return;
String year = DataSet.getYear(line);
int airTemperature = DataSet.getMax(line);
if (airTemperature != DataSet.MISSING) {
context.write(new Text(year), new IntWritable(airTemperature));
}
}
}
| package hadoop;
import gsod.DataSet;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MaxTemperatureMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
private String line;
private String year;
private int airTemperature;
@Override
public void map(LongWritable key, Text value,
MaxTemperatureMapper.Context context) throws IOException,
InterruptedException {
line = value.toString();
if (line.startsWith("STN---"))
return;
year = DataSet.getYear(line);
airTemperature = DataSet.getMax(line);
if (airTemperature != DataSet.MISSING) {
context.write(new Text(year), new IntWritable(airTemperature));
}
}
}
| Change yeat and temp to private class vars. | Change yeat and temp to private class vars.
| Java | apache-2.0 | cpieloth/GPGPU-on-Hadoop,cpieloth/GPGPU-on-Hadoop,cpieloth/GPGPU-on-Hadoop,cpieloth/GPGPU-on-Hadoop,cpieloth/GPGPU-on-Hadoop | java | ## Code Before:
package hadoop;
import gsod.DataSet;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MaxTemperatureMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
@Override
public void map(LongWritable key, Text value,
MaxTemperatureMapper.Context context) throws IOException,
InterruptedException {
String line = value.toString();
if (line.startsWith("STN---"))
return;
String year = DataSet.getYear(line);
int airTemperature = DataSet.getMax(line);
if (airTemperature != DataSet.MISSING) {
context.write(new Text(year), new IntWritable(airTemperature));
}
}
}
## Instruction:
Change yeat and temp to private class vars.
## Code After:
package hadoop;
import gsod.DataSet;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MaxTemperatureMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
private String line;
private String year;
private int airTemperature;
@Override
public void map(LongWritable key, Text value,
MaxTemperatureMapper.Context context) throws IOException,
InterruptedException {
line = value.toString();
if (line.startsWith("STN---"))
return;
year = DataSet.getYear(line);
airTemperature = DataSet.getMax(line);
if (airTemperature != DataSet.MISSING) {
context.write(new Text(year), new IntWritable(airTemperature));
}
}
}
| package hadoop;
import gsod.DataSet;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MaxTemperatureMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
+ private String line;
+ private String year;
+ private int airTemperature;
+
@Override
public void map(LongWritable key, Text value,
MaxTemperatureMapper.Context context) throws IOException,
InterruptedException {
- String line = value.toString();
? -------
+ line = value.toString();
if (line.startsWith("STN---"))
return;
- String year = DataSet.getYear(line);
? -------
+ year = DataSet.getYear(line);
- int airTemperature = DataSet.getMax(line);
? ----
+ airTemperature = DataSet.getMax(line);
if (airTemperature != DataSet.MISSING) {
context.write(new Text(year), new IntWritable(airTemperature));
}
}
} | 10 | 0.3125 | 7 | 3 |
2824a21d0477fb99e8442afed8f039b8d82e222f | Examples/Test/Basic1.hs | Examples/Test/Basic1.hs |
module Examples.Test.Basic1(main) where
import Development.Shake
import Examples.Util
main = shaken test $ \obj -> do
want [obj "AB.txt"]
obj "AB.txt" *> \out -> do
need [obj "A.txt", obj "B.txt"]
text1 <- readFile' $ obj "A.txt"
text2 <- readFile' $ obj "B.txt"
writeFile' out $ text1 ++ text2
test build obj = do
writeFile (obj "A.txt") "AAA"
writeFile (obj "B.txt") "BBB"
build []
assertContents (obj "AB.txt") "AAABBB"
sleep 1
appendFile (obj "A.txt") "aaa"
build []
assertContents (obj "AB.txt") "AAAaaaBBB"
|
module Examples.Test.Basic1(main) where
import Development.Shake
import Examples.Util
main = shaken test $ \obj -> do
want [obj "AB.txt"]
obj "AB.txt" *> \out -> do
need [obj "A.txt", obj "B.txt"]
text1 <- readFile' $ obj "A.txt"
text2 <- readFile' $ obj "B.txt"
writeFile' out $ text1 ++ text2
test build obj = do
let f b pat file = assert (b == (pat ?== file)) $ show pat ++ " ?== " ++ show file ++ "\nEXPECTED: " ++ show b
f True "//*.c" "foo/bar/baz.c"
f True "*.c" "baz.c"
f True "//*.c" "baz.c"
f True "test.c" "test.c"
f False "*.c" "foor/bar.c"
f False "*/*.c" "foo/bar/baz.c"
writeFile (obj "A.txt") "AAA"
writeFile (obj "B.txt") "BBB"
build []
assertContents (obj "AB.txt") "AAABBB"
sleep 1
appendFile (obj "A.txt") "aaa"
build []
assertContents (obj "AB.txt") "AAAaaaBBB"
| Add some assertions about file pattern matches | Add some assertions about file pattern matches
| Haskell | bsd-3-clause | nh2/shake,nh2/shake,ndmitchell/shake,ndmitchell/shake,nh2/shake,ndmitchell/shake,ndmitchell/shake,nh2/shake,ndmitchell/shake,ndmitchell/shake,nh2/shake | haskell | ## Code Before:
module Examples.Test.Basic1(main) where
import Development.Shake
import Examples.Util
main = shaken test $ \obj -> do
want [obj "AB.txt"]
obj "AB.txt" *> \out -> do
need [obj "A.txt", obj "B.txt"]
text1 <- readFile' $ obj "A.txt"
text2 <- readFile' $ obj "B.txt"
writeFile' out $ text1 ++ text2
test build obj = do
writeFile (obj "A.txt") "AAA"
writeFile (obj "B.txt") "BBB"
build []
assertContents (obj "AB.txt") "AAABBB"
sleep 1
appendFile (obj "A.txt") "aaa"
build []
assertContents (obj "AB.txt") "AAAaaaBBB"
## Instruction:
Add some assertions about file pattern matches
## Code After:
module Examples.Test.Basic1(main) where
import Development.Shake
import Examples.Util
main = shaken test $ \obj -> do
want [obj "AB.txt"]
obj "AB.txt" *> \out -> do
need [obj "A.txt", obj "B.txt"]
text1 <- readFile' $ obj "A.txt"
text2 <- readFile' $ obj "B.txt"
writeFile' out $ text1 ++ text2
test build obj = do
let f b pat file = assert (b == (pat ?== file)) $ show pat ++ " ?== " ++ show file ++ "\nEXPECTED: " ++ show b
f True "//*.c" "foo/bar/baz.c"
f True "*.c" "baz.c"
f True "//*.c" "baz.c"
f True "test.c" "test.c"
f False "*.c" "foor/bar.c"
f False "*/*.c" "foo/bar/baz.c"
writeFile (obj "A.txt") "AAA"
writeFile (obj "B.txt") "BBB"
build []
assertContents (obj "AB.txt") "AAABBB"
sleep 1
appendFile (obj "A.txt") "aaa"
build []
assertContents (obj "AB.txt") "AAAaaaBBB"
|
module Examples.Test.Basic1(main) where
import Development.Shake
import Examples.Util
main = shaken test $ \obj -> do
want [obj "AB.txt"]
obj "AB.txt" *> \out -> do
need [obj "A.txt", obj "B.txt"]
text1 <- readFile' $ obj "A.txt"
text2 <- readFile' $ obj "B.txt"
writeFile' out $ text1 ++ text2
test build obj = do
+ let f b pat file = assert (b == (pat ?== file)) $ show pat ++ " ?== " ++ show file ++ "\nEXPECTED: " ++ show b
+ f True "//*.c" "foo/bar/baz.c"
+ f True "*.c" "baz.c"
+ f True "//*.c" "baz.c"
+ f True "test.c" "test.c"
+ f False "*.c" "foor/bar.c"
+ f False "*/*.c" "foo/bar/baz.c"
+
writeFile (obj "A.txt") "AAA"
writeFile (obj "B.txt") "BBB"
build []
assertContents (obj "AB.txt") "AAABBB"
sleep 1
appendFile (obj "A.txt") "aaa"
build []
assertContents (obj "AB.txt") "AAAaaaBBB" | 8 | 0.333333 | 8 | 0 |
91ac833ee9569b112ae5582aaf9f496ec3ab1ac3 | readme.md | readme.md | > get thumbnail images for youtube videos
## Install
```sh
$ npm install --save youtube-thumbnail
```
## Usage
```js
var youtubeThumbnail = require('youtube-thumbnail');
youtubeThumbnail()
```
## CLI
```sh
$ npm install --global youtube-thumbnail
```
```sh
$ youtube-thumbnail --help
Example
youtube-thumbnail
```
## License
MIT © [Matias Singers](http://mts.io)
| > get thumbnail images for youtube videos
## Install
```sh
$ npm install --save youtube-thumbnail
```
## Usage
```js
var youtubeThumbnail = require('youtube-thumbnail');
var thumbnail = youtubeThumbnail('https://www.youtube.com/watch?v=9bZkp7q19f0');
console.log(thumbnail);
// => { default: { url: 'http://img.youtube.com/vi/9bZkp7q19f0/default.jpg', ...
```
## CLI
```sh
$ npm install --global youtube-thumbnail
```
```sh
$ youtube-thumbnail --help
Example
youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0
=> http://img.youtube.com/vi/9bZkp7q19f0/default.jpg
youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0 --high --open
=> http://img.youtube.com/vi/9bZkp7q19f0/hqdefault.jpg
Options
--open
opens the thumbnail image in your browser
--medium
returns the medium resolution thumbnail
--high
returns the high resolution thumbnail
```
## License
MIT © [Matias Singers](http://mts.io)
| Update README with usage examples | Update README with usage examples
| Markdown | mit | matiassingers/youtube-thumbnail | markdown | ## Code Before:
> get thumbnail images for youtube videos
## Install
```sh
$ npm install --save youtube-thumbnail
```
## Usage
```js
var youtubeThumbnail = require('youtube-thumbnail');
youtubeThumbnail()
```
## CLI
```sh
$ npm install --global youtube-thumbnail
```
```sh
$ youtube-thumbnail --help
Example
youtube-thumbnail
```
## License
MIT © [Matias Singers](http://mts.io)
## Instruction:
Update README with usage examples
## Code After:
> get thumbnail images for youtube videos
## Install
```sh
$ npm install --save youtube-thumbnail
```
## Usage
```js
var youtubeThumbnail = require('youtube-thumbnail');
var thumbnail = youtubeThumbnail('https://www.youtube.com/watch?v=9bZkp7q19f0');
console.log(thumbnail);
// => { default: { url: 'http://img.youtube.com/vi/9bZkp7q19f0/default.jpg', ...
```
## CLI
```sh
$ npm install --global youtube-thumbnail
```
```sh
$ youtube-thumbnail --help
Example
youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0
=> http://img.youtube.com/vi/9bZkp7q19f0/default.jpg
youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0 --high --open
=> http://img.youtube.com/vi/9bZkp7q19f0/hqdefault.jpg
Options
--open
opens the thumbnail image in your browser
--medium
returns the medium resolution thumbnail
--high
returns the high resolution thumbnail
```
## License
MIT © [Matias Singers](http://mts.io)
| > get thumbnail images for youtube videos
## Install
```sh
$ npm install --save youtube-thumbnail
```
## Usage
```js
var youtubeThumbnail = require('youtube-thumbnail');
- youtubeThumbnail()
+ var thumbnail = youtubeThumbnail('https://www.youtube.com/watch?v=9bZkp7q19f0');
+ console.log(thumbnail);
+ // => { default: { url: 'http://img.youtube.com/vi/9bZkp7q19f0/default.jpg', ...
```
## CLI
```sh
$ npm install --global youtube-thumbnail
```
```sh
$ youtube-thumbnail --help
Example
- youtube-thumbnail
-
+ youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0
+ => http://img.youtube.com/vi/9bZkp7q19f0/default.jpg
+
+ youtube-thumbnail https://www.youtube.com/watch?v=9bZkp7q19f0 --high --open
+ => http://img.youtube.com/vi/9bZkp7q19f0/hqdefault.jpg
+
+ Options
+ --open
+ opens the thumbnail image in your browser
+
+ --medium
+ returns the medium resolution thumbnail
+
+ --high
+ returns the high resolution thumbnail
```
## License
MIT © [Matias Singers](http://mts.io) | 21 | 0.567568 | 18 | 3 |
f69c8cd62d72edc9ea94fd9ba71a3b6d5f1a7cc3 | src/languages/cpp.js | src/languages/cpp.js | define(function() {
// Export
return function(Prism) {
Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
});
};
});
| define(function() {
return function(Prism) {
Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
});
};
});
| Fix indentation of the C++ grammar | Fix indentation of the C++ grammar
| JavaScript | mit | apiaryio/prism | javascript | ## Code Before:
define(function() {
// Export
return function(Prism) {
Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
});
};
});
## Instruction:
Fix indentation of the C++ grammar
## Code After:
define(function() {
return function(Prism) {
Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
});
};
});
| define(function() {
-
- // Export
return function(Prism) {
-
Prism.languages.cpp = Prism.languages.extend('c', {
- 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
? ^
+ 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
? ^^
- 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
? ^
+ 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
? ^^
});
-
};
-
}); | 9 | 0.692308 | 2 | 7 |
e5a4324c7f43463713acb398f457fd2b23e38a39 | lib/slacken/node_type.rb | lib/slacken/node_type.rb | module Slacken
class NodeType
def self.create(name)
name.is_a?(NodeType) ? name : new(name)
end
attr_reader :name
def initialize(name)
@name = name.to_sym
end
def member_of?(*names)
names.flatten.include?(name)
end
def text_types
%i(text emoji checkbox)
end
def block?
member_of?(%i(document div iframe p img ul ol dl dd li hr indent
p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html))
end
def inline?
!block?
end
def text_type?
member_of?(text_types)
end
def allowed_in_list?
member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types))
end
def allowed_as_list_item?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_headline?
member_of?(%i(i em wrapper span).concat(text_types))
end
def allowed_in_table?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_link?
member_of?(%i(b strong i em wrapper span).concat(text_types))
end
end
end
| module Slacken
class NodeType
def self.create(name)
name.is_a?(NodeType) ? name : new(name)
end
attr_reader :name
def initialize(name)
@name = name.to_sym
end
def member_of?(*names)
names.flatten.include?(name)
end
def text_types
%i(text emoji checkbox)
end
def block?
member_of?(%i(document div iframe p img ul ol dl dd li hr indent
p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html))
end
def inline?
!block?
end
def text_type?
member_of?(text_types)
end
def allowed_in_list?
member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types))
end
def allowed_as_list_item?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_headline?
member_of?(%i(i em wrapper span).concat(text_types))
end
def allowed_in_table?
member_of?(%i(code b strong i em wrapper span thead tbody tr th td).concat(text_types))
end
def allowed_in_link?
member_of?(%i(b strong i em wrapper span).concat(text_types))
end
end
end
| Allow table parts tags in table | Allow table parts tags in table
| Ruby | mit | increments/slacken | ruby | ## Code Before:
module Slacken
class NodeType
def self.create(name)
name.is_a?(NodeType) ? name : new(name)
end
attr_reader :name
def initialize(name)
@name = name.to_sym
end
def member_of?(*names)
names.flatten.include?(name)
end
def text_types
%i(text emoji checkbox)
end
def block?
member_of?(%i(document div iframe p img ul ol dl dd li hr indent
p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html))
end
def inline?
!block?
end
def text_type?
member_of?(text_types)
end
def allowed_in_list?
member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types))
end
def allowed_as_list_item?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_headline?
member_of?(%i(i em wrapper span).concat(text_types))
end
def allowed_in_table?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_link?
member_of?(%i(b strong i em wrapper span).concat(text_types))
end
end
end
## Instruction:
Allow table parts tags in table
## Code After:
module Slacken
class NodeType
def self.create(name)
name.is_a?(NodeType) ? name : new(name)
end
attr_reader :name
def initialize(name)
@name = name.to_sym
end
def member_of?(*names)
names.flatten.include?(name)
end
def text_types
%i(text emoji checkbox)
end
def block?
member_of?(%i(document div iframe p img ul ol dl dd li hr indent
p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html))
end
def inline?
!block?
end
def text_type?
member_of?(text_types)
end
def allowed_in_list?
member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types))
end
def allowed_as_list_item?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_headline?
member_of?(%i(i em wrapper span).concat(text_types))
end
def allowed_in_table?
member_of?(%i(code b strong i em wrapper span thead tbody tr th td).concat(text_types))
end
def allowed_in_link?
member_of?(%i(b strong i em wrapper span).concat(text_types))
end
end
end
| module Slacken
class NodeType
def self.create(name)
name.is_a?(NodeType) ? name : new(name)
end
attr_reader :name
def initialize(name)
@name = name.to_sym
end
def member_of?(*names)
names.flatten.include?(name)
end
def text_types
%i(text emoji checkbox)
end
def block?
member_of?(%i(document div iframe p img ul ol dl dd li hr indent
p h1 h2 h3 h4 h5 h6 h7 h8 pre blockquote body html))
end
def inline?
!block?
end
def text_type?
member_of?(text_types)
end
def allowed_in_list?
member_of?(%i(code b strong i em wrapper div indent span ol ul dl li dd dt).concat(text_types))
end
def allowed_as_list_item?
member_of?(%i(code b strong i em wrapper span).concat(text_types))
end
def allowed_in_headline?
member_of?(%i(i em wrapper span).concat(text_types))
end
def allowed_in_table?
- member_of?(%i(code b strong i em wrapper span).concat(text_types))
+ member_of?(%i(code b strong i em wrapper span thead tbody tr th td).concat(text_types))
? +++++++++++++++++++++
end
def allowed_in_link?
member_of?(%i(b strong i em wrapper span).concat(text_types))
end
end
end | 2 | 0.037736 | 1 | 1 |
d86d4db813a975391c6fa4d4041ede9c50c0aaa9 | examples/popup.css | examples/popup.css | .ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
| .ol-popup {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
| Use boxe-shadow css instead of filter | Use boxe-shadow css instead of filter
| CSS | bsd-2-clause | bjornharrtell/ol3,stweil/openlayers,oterral/ol3,ahocevar/openlayers,geekdenz/ol3,openlayers/openlayers,ahocevar/openlayers,stweil/ol3,openlayers/openlayers,oterral/ol3,adube/ol3,oterral/ol3,bjornharrtell/ol3,stweil/ol3,geekdenz/ol3,geekdenz/ol3,ahocevar/ol3,geekdenz/openlayers,geekdenz/openlayers,stweil/openlayers,adube/ol3,stweil/ol3,bjornharrtell/ol3,openlayers/openlayers,stweil/openlayers,geekdenz/ol3,stweil/ol3,geekdenz/openlayers,ahocevar/openlayers,ahocevar/ol3,ahocevar/ol3,adube/ol3,ahocevar/ol3 | css | ## Code Before:
.ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
## Instruction:
Use boxe-shadow css instead of filter
## Code After:
.ol-popup {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
| .ol-popup {
position: absolute;
background-color: white;
- -webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
- filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
? ^^^^^^^^^^ ^ ^ -
+ box-shadow: 0 1px 4px rgba(0,0,0,0.2);
? ^ ^ ^^
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
} | 3 | 0.071429 | 1 | 2 |
3075b204e4dd114a017ae5b08e4fb14b254135a0 | wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php | wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php | <?php
namespace wcf\action;
use wcf\system\background\BackgroundQueueHandler;
/**
* Performs background queue jobs.
*
* @author Tim Duesterhus
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Action
* @since 3.0
*/
class BackgroundQueuePerformAction extends AbstractAction {
/**
* number of jobs that will be processed per invocation
* @var integer
*/
public static $jobsPerRun = 5;
/**
* @inheritDoc
*/
public function execute() {
parent::execute();
header('Content-type: application/json');
for ($i = 0; $i < self::$jobsPerRun; $i++) {
if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
// there were no more jobs
break;
}
}
echo BackgroundQueueHandler::getInstance()->getRunnableCount();
exit;
}
}
| <?php
namespace wcf\action;
use wcf\system\background\BackgroundQueueHandler;
use wcf\system\WCF;
/**
* Performs background queue jobs.
*
* @author Tim Duesterhus
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Action
* @since 3.0
*/
class BackgroundQueuePerformAction extends AbstractAction {
/**
* number of jobs that will be processed per invocation
* @var integer
*/
public static $jobsPerRun = 5;
/**
* @inheritDoc
*/
public function execute() {
parent::execute();
header('Content-type: application/json');
for ($i = 0; $i < self::$jobsPerRun; $i++) {
if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
// there were no more jobs
break;
}
}
echo BackgroundQueueHandler::getInstance()->getRunnableCount();
if (WCF::getSession()->isFirstVisit() && !WCF::getUser()->userID) {
WCF::getSession()->delete();
}
exit;
}
}
| Delete firstVisit = true, userID = 0 sessions after processing background queue | Delete firstVisit = true, userID = 0 sessions after processing background queue
These sessions most likely stem from a script / cronjob that is set-up
to regularly request the background queue to ensure it does not fill up
in periods of low user activity. They “fill up” the session table, skew
the user online statistics and are not going to be re-used.
| PHP | lgpl-2.1 | MenesesEvandro/WCF,Cyperghost/WCF,SoftCreatR/WCF,WoltLab/WCF,SoftCreatR/WCF,Cyperghost/WCF,Cyperghost/WCF,WoltLab/WCF,WoltLab/WCF,Cyperghost/WCF,WoltLab/WCF,SoftCreatR/WCF,MenesesEvandro/WCF,SoftCreatR/WCF,Cyperghost/WCF | php | ## Code Before:
<?php
namespace wcf\action;
use wcf\system\background\BackgroundQueueHandler;
/**
* Performs background queue jobs.
*
* @author Tim Duesterhus
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Action
* @since 3.0
*/
class BackgroundQueuePerformAction extends AbstractAction {
/**
* number of jobs that will be processed per invocation
* @var integer
*/
public static $jobsPerRun = 5;
/**
* @inheritDoc
*/
public function execute() {
parent::execute();
header('Content-type: application/json');
for ($i = 0; $i < self::$jobsPerRun; $i++) {
if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
// there were no more jobs
break;
}
}
echo BackgroundQueueHandler::getInstance()->getRunnableCount();
exit;
}
}
## Instruction:
Delete firstVisit = true, userID = 0 sessions after processing background queue
These sessions most likely stem from a script / cronjob that is set-up
to regularly request the background queue to ensure it does not fill up
in periods of low user activity. They “fill up” the session table, skew
the user online statistics and are not going to be re-used.
## Code After:
<?php
namespace wcf\action;
use wcf\system\background\BackgroundQueueHandler;
use wcf\system\WCF;
/**
* Performs background queue jobs.
*
* @author Tim Duesterhus
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Action
* @since 3.0
*/
class BackgroundQueuePerformAction extends AbstractAction {
/**
* number of jobs that will be processed per invocation
* @var integer
*/
public static $jobsPerRun = 5;
/**
* @inheritDoc
*/
public function execute() {
parent::execute();
header('Content-type: application/json');
for ($i = 0; $i < self::$jobsPerRun; $i++) {
if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
// there were no more jobs
break;
}
}
echo BackgroundQueueHandler::getInstance()->getRunnableCount();
if (WCF::getSession()->isFirstVisit() && !WCF::getUser()->userID) {
WCF::getSession()->delete();
}
exit;
}
}
| <?php
namespace wcf\action;
use wcf\system\background\BackgroundQueueHandler;
+ use wcf\system\WCF;
/**
* Performs background queue jobs.
*
* @author Tim Duesterhus
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Action
* @since 3.0
*/
class BackgroundQueuePerformAction extends AbstractAction {
/**
* number of jobs that will be processed per invocation
* @var integer
*/
public static $jobsPerRun = 5;
/**
* @inheritDoc
*/
public function execute() {
parent::execute();
header('Content-type: application/json');
for ($i = 0; $i < self::$jobsPerRun; $i++) {
if (BackgroundQueueHandler::getInstance()->performNextJob() === false) {
// there were no more jobs
break;
}
}
echo BackgroundQueueHandler::getInstance()->getRunnableCount();
+ if (WCF::getSession()->isFirstVisit() && !WCF::getUser()->userID) {
+ WCF::getSession()->delete();
+ }
exit;
}
} | 4 | 0.108108 | 4 | 0 |
99f59c4efe6221ee848e3c194eea4e88030b6ab7 | templates/Symbiote/GridFieldExtensions/GridFieldAddNewInlineButton.ss | templates/Symbiote/GridFieldExtensions/GridFieldAddNewInlineButton.ss | <button href="$Link" class="ss-gridfield-add-new-inline ss-ui-action-constructive ss-ui-button" data-icon="add">
$Title
</button>
| <button href="$Link" class="ss-gridfield-add-new-inline btn btn-primary" data-icon="add">
$Title
</button>
| FIX Upgrade button to use bootstrap classes | FIX Upgrade button to use bootstrap classes
| Scheme | bsd-3-clause | dhensby/silverstripe-gridfieldextensions,dhensby/silverstripe-gridfieldextensions,symbiote/silverstripe-gridfieldextensions,symbiote/silverstripe-gridfieldextensions,silverstripe-australia/silverstripe-gridfieldextensions,kinglozzer/silverstripe-gridfieldextensions,silverstripe-australia/silverstripe-gridfieldextensions,kinglozzer/silverstripe-gridfieldextensions | scheme | ## Code Before:
<button href="$Link" class="ss-gridfield-add-new-inline ss-ui-action-constructive ss-ui-button" data-icon="add">
$Title
</button>
## Instruction:
FIX Upgrade button to use bootstrap classes
## Code After:
<button href="$Link" class="ss-gridfield-add-new-inline btn btn-primary" data-icon="add">
$Title
</button>
| - <button href="$Link" class="ss-gridfield-add-new-inline ss-ui-action-constructive ss-ui-button" data-icon="add">
? ^^^^^^^^ ^^ ^^^^^ --- ^^^^^^^^^^^^^^^
+ <button href="$Link" class="ss-gridfield-add-new-inline btn btn-primary" data-icon="add">
? ^ ^^^^ ^ ^^^^
$Title
</button> | 2 | 0.666667 | 1 | 1 |
19b2e81de275d14636cb918ce6e3977a7adae692 | build-racket.sh | build-racket.sh | set -uex
cd /tmp
git clone --depth=0 https://github.com/plt/racket.git
cd racket/src
./configure --prefix=/app/vendor
make -sj30
make install
| set -uex
cd /tmp
curl -O https://github.com/plt/racket/archive/master.tar.gz
tar -zxf master.tar.gz
cd racket-master/src
./configure --prefix=/app/vendor
make -sj30
make -sj30 install
| Switch to github generated tarball version for speed | Switch to github generated tarball version for speed
Signed-off-by: Daniel Farina <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@heroku.com>
| Shell | bsd-2-clause | fdr/heroku-racket-builder | shell | ## Code Before:
set -uex
cd /tmp
git clone --depth=0 https://github.com/plt/racket.git
cd racket/src
./configure --prefix=/app/vendor
make -sj30
make install
## Instruction:
Switch to github generated tarball version for speed
Signed-off-by: Daniel Farina <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@heroku.com>
## Code After:
set -uex
cd /tmp
curl -O https://github.com/plt/racket/archive/master.tar.gz
tar -zxf master.tar.gz
cd racket-master/src
./configure --prefix=/app/vendor
make -sj30
make -sj30 install
| set -uex
cd /tmp
- git clone --depth=0 https://github.com/plt/racket.git
+ curl -O https://github.com/plt/racket/archive/master.tar.gz
+ tar -zxf master.tar.gz
- cd racket/src
+ cd racket-master/src
? +++++++
./configure --prefix=/app/vendor
make -sj30
- make install
+ make -sj30 install
? ++++++
| 7 | 0.875 | 4 | 3 |
27225afb895e0c201810f8a78709ddabf5948ea5 | app/Http/Middleware/VerifyUserAlways.php | app/Http/Middleware/VerifyUserAlways.php | <?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
namespace App\Http\Middleware;
class VerifyUserAlways extends VerifyUser
{
public static function isRequired($user)
{
return $user !== null && ($user->isPrivileged() || $user->isInactive());
}
public function requiresVerification($request)
{
if ($this->user === null) {
return false;
}
$method = $request->getMethod();
$isPostAction = config('osu.user.post_action_verification')
? !in_array($method, ['GET', 'HEAD', 'OPTIONS'], true)
: false;
$isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification');
return $isRequired;
}
}
| <?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
namespace App\Http\Middleware;
class VerifyUserAlways extends VerifyUser
{
const GET_ACTION_METHODS = [
'GET' => true,
'HEAD' => true,
'OPTIONS' => true,
];
public static function isRequired($user)
{
return $user !== null && ($user->isPrivileged() || $user->isInactive());
}
public function requiresVerification($request)
{
if ($this->user === null) {
return false;
}
$method = $request->getMethod();
$isPostAction = config('osu.user.post_action_verification')
? !isset(static::GET_ACTION_METHODS[$method])
: false;
$isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification');
return $isRequired;
}
}
| Use array key lookup to check action method | Use array key lookup to check action method
| PHP | agpl-3.0 | ppy/osu-web,ppy/osu-web,notbakaneko/osu-web,notbakaneko/osu-web,notbakaneko/osu-web,notbakaneko/osu-web,ppy/osu-web,ppy/osu-web,notbakaneko/osu-web,ppy/osu-web | php | ## Code Before:
<?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
namespace App\Http\Middleware;
class VerifyUserAlways extends VerifyUser
{
public static function isRequired($user)
{
return $user !== null && ($user->isPrivileged() || $user->isInactive());
}
public function requiresVerification($request)
{
if ($this->user === null) {
return false;
}
$method = $request->getMethod();
$isPostAction = config('osu.user.post_action_verification')
? !in_array($method, ['GET', 'HEAD', 'OPTIONS'], true)
: false;
$isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification');
return $isRequired;
}
}
## Instruction:
Use array key lookup to check action method
## Code After:
<?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
namespace App\Http\Middleware;
class VerifyUserAlways extends VerifyUser
{
const GET_ACTION_METHODS = [
'GET' => true,
'HEAD' => true,
'OPTIONS' => true,
];
public static function isRequired($user)
{
return $user !== null && ($user->isPrivileged() || $user->isInactive());
}
public function requiresVerification($request)
{
if ($this->user === null) {
return false;
}
$method = $request->getMethod();
$isPostAction = config('osu.user.post_action_verification')
? !isset(static::GET_ACTION_METHODS[$method])
: false;
$isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification');
return $isRequired;
}
}
| <?php
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
namespace App\Http\Middleware;
class VerifyUserAlways extends VerifyUser
{
+ const GET_ACTION_METHODS = [
+ 'GET' => true,
+ 'HEAD' => true,
+ 'OPTIONS' => true,
+ ];
+
public static function isRequired($user)
{
return $user !== null && ($user->isPrivileged() || $user->isInactive());
}
public function requiresVerification($request)
{
if ($this->user === null) {
return false;
}
$method = $request->getMethod();
$isPostAction = config('osu.user.post_action_verification')
- ? !in_array($method, ['GET', 'HEAD', 'OPTIONS'], true)
+ ? !isset(static::GET_ACTION_METHODS[$method])
: false;
$isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification');
return $isRequired;
}
} | 8 | 0.266667 | 7 | 1 |
23663f5e177e8f7bb8b04d2da1349038bac7e381 | CONTRIBUTING.md | CONTRIBUTING.md | jpmobile-ipaddressesとjpmobile-terminfoのgemをインストールしていない場合。
- `git clone git@github.com:jpmobile/jpmobile.git`
- `bundle install`
- `cd vendor`
- `git clone git@github.com:jpmobile/jpmobile-ipaddresses.git`
- `git clone git@github.com:jpmobile/jpmobile-terminfo.git`
## テストに必要なgemパッケージ
テストを実行するためには以下のgemパッケージが必要です。
* rails (include rack)
* sqlite3
* nokogiri
* rspec
* rspec-rails
* rspec-fixture
* rack-test
* mocha
* geokit
| jpmobile-ipaddressesとjpmobile-terminfoのgemをインストールしていない場合。
- `git clone git@github.com:jpmobile/jpmobile.git`
- `bundle install`
- `cd vendor`
- `git clone git@github.com:jpmobile/jpmobile-ipaddresses.git`
- `git clone git@github.com:jpmobile/jpmobile-terminfo.git`
## テスト
テストにはSMTP通信を行うものも含まれるため、
[koseki-mocksmtpd](https://github.com/koseki/mocksmtpd)などの、
smtpdのmockを利用する必要があります。
### 必要なgemパッケージ
テストを実行するためには以下のgemパッケージが必要です。
* rails (include rack)
* sqlite3
* nokogiri
* rspec
* rspec-rails
* rspec-fixture
* rack-test
* mocha
* geokit
| Add description about smtpd mock in test | Add description about smtpd mock in test
| Markdown | mit | jpmobile/jpmobile,matsu911/jpmobile,asonas/jpmobile,jpmobile/jpmobile,asonas/jpmobile,sunny4381/jpmobile,matsu911/jpmobile,yui-knk/jpmobile,sunny4381/jpmobile,xibbar/jpmobile,yui-knk/jpmobile,xibbar/jpmobile | markdown | ## Code Before:
jpmobile-ipaddressesとjpmobile-terminfoのgemをインストールしていない場合。
- `git clone git@github.com:jpmobile/jpmobile.git`
- `bundle install`
- `cd vendor`
- `git clone git@github.com:jpmobile/jpmobile-ipaddresses.git`
- `git clone git@github.com:jpmobile/jpmobile-terminfo.git`
## テストに必要なgemパッケージ
テストを実行するためには以下のgemパッケージが必要です。
* rails (include rack)
* sqlite3
* nokogiri
* rspec
* rspec-rails
* rspec-fixture
* rack-test
* mocha
* geokit
## Instruction:
Add description about smtpd mock in test
## Code After:
jpmobile-ipaddressesとjpmobile-terminfoのgemをインストールしていない場合。
- `git clone git@github.com:jpmobile/jpmobile.git`
- `bundle install`
- `cd vendor`
- `git clone git@github.com:jpmobile/jpmobile-ipaddresses.git`
- `git clone git@github.com:jpmobile/jpmobile-terminfo.git`
## テスト
テストにはSMTP通信を行うものも含まれるため、
[koseki-mocksmtpd](https://github.com/koseki/mocksmtpd)などの、
smtpdのmockを利用する必要があります。
### 必要なgemパッケージ
テストを実行するためには以下のgemパッケージが必要です。
* rails (include rack)
* sqlite3
* nokogiri
* rspec
* rspec-rails
* rspec-fixture
* rack-test
* mocha
* geokit
| jpmobile-ipaddressesとjpmobile-terminfoのgemをインストールしていない場合。
- `git clone git@github.com:jpmobile/jpmobile.git`
- `bundle install`
- `cd vendor`
- `git clone git@github.com:jpmobile/jpmobile-ipaddresses.git`
- `git clone git@github.com:jpmobile/jpmobile-terminfo.git`
+ ## テスト
+ テストにはSMTP通信を行うものも含まれるため、
+ [koseki-mocksmtpd](https://github.com/koseki/mocksmtpd)などの、
+ smtpdのmockを利用する必要があります。
+
- ## テストに必要なgemパッケージ
? ----
+ ### 必要なgemパッケージ
? +
テストを実行するためには以下のgemパッケージが必要です。
* rails (include rack)
* sqlite3
* nokogiri
* rspec
* rspec-rails
* rspec-fixture
* rack-test
* mocha
* geokit | 7 | 0.368421 | 6 | 1 |
44f6f67463f1e9728b7573be5e98c71cff0e51d1 | provisioning/roles/kcov/tasks/main.yml | provisioning/roles/kcov/tasks/main.yml | ---
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
with_items:
become: yes
- name: Download kcov
unarchive:
src: "{{ kcov_download_url }}"
dest: /tmp
copy: no
- name: Create the build directory
file:
path: "{{ kcov_build_dir }}"
state: directory
- name: Generate the kcov makedir
command: cmake .. -DCMAKE_INSTALL_PREFIX={{ kcov_install_prefix }}
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/Makefile"
- name: Compile kcov
command: make
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/src/kcov"
- name: Install kcov
become: yes
command: make install
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_install_prefix }}/bin/kcov"
| ---
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
with_items: "{{ required_packages }}"
become: yes
- name: Download kcov
unarchive:
src: "{{ kcov_download_url }}"
dest: /tmp
copy: no
- name: Create the build directory
file:
path: "{{ kcov_build_dir }}"
state: directory
- name: Generate the kcov makedir
command: cmake .. -DCMAKE_INSTALL_PREFIX={{ kcov_install_prefix }}
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/Makefile"
- name: Compile kcov
command: make
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/src/kcov"
- name: Install kcov
become: yes
command: make install
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_install_prefix }}/bin/kcov"
| Fix lack of packages for kcov | Fix lack of packages for kcov
[ci skip]
| YAML | apache-2.0 | mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-cfitsio,mindriot101/rust-cfitsio,mindriot101/rust-fitsio,mindriot101/rust-fitsio | yaml | ## Code Before:
---
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
with_items:
become: yes
- name: Download kcov
unarchive:
src: "{{ kcov_download_url }}"
dest: /tmp
copy: no
- name: Create the build directory
file:
path: "{{ kcov_build_dir }}"
state: directory
- name: Generate the kcov makedir
command: cmake .. -DCMAKE_INSTALL_PREFIX={{ kcov_install_prefix }}
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/Makefile"
- name: Compile kcov
command: make
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/src/kcov"
- name: Install kcov
become: yes
command: make install
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_install_prefix }}/bin/kcov"
## Instruction:
Fix lack of packages for kcov
[ci skip]
## Code After:
---
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
with_items: "{{ required_packages }}"
become: yes
- name: Download kcov
unarchive:
src: "{{ kcov_download_url }}"
dest: /tmp
copy: no
- name: Create the build directory
file:
path: "{{ kcov_build_dir }}"
state: directory
- name: Generate the kcov makedir
command: cmake .. -DCMAKE_INSTALL_PREFIX={{ kcov_install_prefix }}
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/Makefile"
- name: Compile kcov
command: make
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/src/kcov"
- name: Install kcov
become: yes
command: make install
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_install_prefix }}/bin/kcov"
| ---
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
- with_items:
+ with_items: "{{ required_packages }}"
become: yes
- name: Download kcov
unarchive:
src: "{{ kcov_download_url }}"
dest: /tmp
copy: no
- name: Create the build directory
file:
path: "{{ kcov_build_dir }}"
state: directory
- name: Generate the kcov makedir
command: cmake .. -DCMAKE_INSTALL_PREFIX={{ kcov_install_prefix }}
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/Makefile"
- name: Compile kcov
command: make
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_build_dir }}/src/kcov"
- name: Install kcov
become: yes
command: make install
args:
chdir: "{{ kcov_build_dir }}"
creates: "{{ kcov_install_prefix }}/bin/kcov" | 2 | 0.052632 | 1 | 1 |
065cbfe9157b821945c89f9507e17ec30df4af08 | roles/neutron-common/defaults/main.yml | roles/neutron-common/defaults/main.yml | ---
neutron:
rev: b059dc0606568a5982aea4c2861ac21cf380792d
api_workers: 3
dhcp_dns_servers:
- 8.8.8.8
- 8.8.4.4
| ---
neutron:
rev: b5c4152ac9958e
api_workers: 3
dhcp_dns_servers:
- 8.8.8.8
- 8.8.4.4
| Revert "neutron: Update to stable/havana" | Revert "neutron: Update to stable/havana"
This reverts commit d7a3f2ad9ab687aea276af95bc75477a97700ddd.
| YAML | mit | twaldrop/ursula,panxia6679/ursula,EricCrosson/ursula,ddaskal/ursula,andrewrothstein/ursula,wupeiran/ursula,jwaibel/ursula,masteinhauser/ursula,aldevigi/ursula,pbannister/ursula,fancyhe/ursula,knandya/ursula,paulczar/ursula,narengan/ursula,edtubillara/ursula,ddaskal/ursula,panxia6679/ursula,MaheshIBM/ursula,paulczar/ursula,blueboxgroup/ursula,dlundquist/ursula,wupeiran/ursula,davidcusatis/ursula,greghaynes/ursula,twaldrop/ursula,nirajdp76/ursula,channus/ursula,aldevigi/ursula,pbannister/ursula,edtubillara/ursula,knandya/ursula,andrewrothstein/ursula,pgraziano/ursula,zrs233/ursula,MaheshIBM/ursula,fancyhe/ursula,zrs233/ursula,rongzhus/ursula,j2sol/ursula,rongzhus/ursula,ryshah/ursula,zrs233/ursula,jwaibel/ursula,nirajdp76/ursula,nirajdp76/ursula,lihkin213/ursula,dlundquist/ursula,ddaskal/ursula,twaldrop/ursula,sivakom/ursula,twaldrop/ursula,kennjason/ursula,rongzhus/ursula,zrs233/ursula,lihkin213/ursula,edtubillara/ursula,EricCrosson/ursula,ryshah/ursula,ryshah/ursula,davidcusatis/ursula,masteinhauser/ursula,knandya/ursula,jwaibel/ursula,allomov/ursula,aldevigi/ursula,EricCrosson/ursula,masteinhauser/ursula,knandya/ursula,persistent-ursula/ursula,mjbrewer/ursula,blueboxgroup/ursula,channus/ursula,kennjason/ursula,paulczar/ursula,msambol/ursula,channus/ursula,edtubillara/ursula,rongzhus/ursula,kennjason/ursula,wupeiran/ursula,channus/ursula,greghaynes/ursula,greghaynes/ursula,wupeiran/ursula,MaheshIBM/ursula,j2sol/ursula,blueboxgroup/ursula,narengan/ursula,j2sol/ursula,narengan/ursula,persistent-ursula/ursula,pgraziano/ursula,dlundquist/ursula,mjbrewer/ursula,persistent-ursula/ursula,panxia6679/ursula,masteinhauser/ursula,msambol/ursula,blueboxgroup/ursula,persistent-ursula/ursula,andrewrothstein/ursula,nirajdp76/ursula,lihkin213/ursula,sivakom/ursula,j2sol/ursula,allomov/ursula,lihkin213/ursula,panxia6679/ursula,mjbrewer/ursula,ryshah/ursula,fancyhe/ursula,pgraziano/ursula,allomov/ursula,sivakom/ursula,fancyhe/ursula,ddaskal/ursula,pbannister/ursula,davidcusatis/ursula,msambol/ursula,narengan/ursula,pgraziano/ursula | yaml | ## Code Before:
---
neutron:
rev: b059dc0606568a5982aea4c2861ac21cf380792d
api_workers: 3
dhcp_dns_servers:
- 8.8.8.8
- 8.8.4.4
## Instruction:
Revert "neutron: Update to stable/havana"
This reverts commit d7a3f2ad9ab687aea276af95bc75477a97700ddd.
## Code After:
---
neutron:
rev: b5c4152ac9958e
api_workers: 3
dhcp_dns_servers:
- 8.8.8.8
- 8.8.4.4
| ---
neutron:
- rev: b059dc0606568a5982aea4c2861ac21cf380792d
+ rev: b5c4152ac9958e
api_workers: 3
dhcp_dns_servers:
- 8.8.8.8
- 8.8.4.4 | 2 | 0.285714 | 1 | 1 |
405a8ae6373dc2ab7c03f291ffc448b2b628d5be | yang/actor-system-provider-service.yang | yang/actor-system-provider-service.yang | module actor-system-provider-service {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
prefix "actor-system";
import config { prefix config; revision-date 2013-04-05; }
description "Akka actor system provider service definition";
revision "2015-10-05" {
description "Initial revision";
}
identity actor-system-provider-service {
base "config:service-type";
config:java-class "org.opendaylight.controller.cluster.ActorSystemProvider";
}
} | module actor-system-provider-service {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
prefix "actor-system";
import config { prefix config; revision-date 2013-04-05; }
description "Akka actor system provider service definition";
revision "2015-10-05" {
description "Initial revision";
}
identity actor-system-provider-service {
base "config:service-type";
config:java-class "org.opendaylight.controller.cluster.ActorSystemProvider";
config:disable-osgi-service-registration;
}
} | Modify config Module impls to co-exist with blueprint | Modify config Module impls to co-exist with blueprint
Modified various config system Module implementation classes which
have corresponding instances created and advertised via blueprint to
obtain the instance in createInstance from the OSGi registry. The
instance may not be available yet so it will wait. I added a
WaitingServiceTracker class to encapsulate this logic using a ServiceTracker.
For those modules that don't advertise services, createInstance simply
returns a noop AutoCloseable since the components are created via
blueprint.
I also added the new disable-osgi-service-registration flag to the
corresponding service yang identities to prevent the CSS from
duplicating the service registrations.
This patch also adds the blueprint bundle to the mdsal features and
"turns on" blueprint.
Change-Id: I60099c82a2a248fc233ad930c4808d6ab19ea881
Signed-off-by: Tom Pantelis <8fc992100aff336363d341c5498f75ab4da389ae@brocade.com>
| YANG | epl-1.0 | opendaylight/yangtools,opendaylight/yangtools | yang | ## Code Before:
module actor-system-provider-service {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
prefix "actor-system";
import config { prefix config; revision-date 2013-04-05; }
description "Akka actor system provider service definition";
revision "2015-10-05" {
description "Initial revision";
}
identity actor-system-provider-service {
base "config:service-type";
config:java-class "org.opendaylight.controller.cluster.ActorSystemProvider";
}
}
## Instruction:
Modify config Module impls to co-exist with blueprint
Modified various config system Module implementation classes which
have corresponding instances created and advertised via blueprint to
obtain the instance in createInstance from the OSGi registry. The
instance may not be available yet so it will wait. I added a
WaitingServiceTracker class to encapsulate this logic using a ServiceTracker.
For those modules that don't advertise services, createInstance simply
returns a noop AutoCloseable since the components are created via
blueprint.
I also added the new disable-osgi-service-registration flag to the
corresponding service yang identities to prevent the CSS from
duplicating the service registrations.
This patch also adds the blueprint bundle to the mdsal features and
"turns on" blueprint.
Change-Id: I60099c82a2a248fc233ad930c4808d6ab19ea881
Signed-off-by: Tom Pantelis <8fc992100aff336363d341c5498f75ab4da389ae@brocade.com>
## Code After:
module actor-system-provider-service {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
prefix "actor-system";
import config { prefix config; revision-date 2013-04-05; }
description "Akka actor system provider service definition";
revision "2015-10-05" {
description "Initial revision";
}
identity actor-system-provider-service {
base "config:service-type";
config:java-class "org.opendaylight.controller.cluster.ActorSystemProvider";
config:disable-osgi-service-registration;
}
} | module actor-system-provider-service {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
prefix "actor-system";
import config { prefix config; revision-date 2013-04-05; }
description "Akka actor system provider service definition";
revision "2015-10-05" {
description "Initial revision";
}
identity actor-system-provider-service {
base "config:service-type";
config:java-class "org.opendaylight.controller.cluster.ActorSystemProvider";
+ config:disable-osgi-service-registration;
}
} | 1 | 0.055556 | 1 | 0 |
4732eaa3bd553e01fdb81a61ae8e4d53a5b9ff00 | README.md | README.md | An IPython/Jupyter notebook plugin for visualizing abstract syntax trees.
Example usage
--------------
Examples can be found in [this IPython notebook](https://github.com/hchasestevens/show_ast/blob/master/Example.ipynb).
Installation
-------------
```
easy_install showast
```
showast has the following dependencies:
```
ipython
nltk
pillow
```
Additionally, you will need to have [Ghostscript](http://ghostscript.com/download/gsdnld.html) installed.
Contacts
--------
* Name: [H. Chase Stevens](http://www.chasestevens.com)
* Twitter: [@hchasestevens](https://twitter.com/hchasestevens) | An IPython/Jupyter notebook plugin for visualizing abstract syntax trees.
Example usage
--------------
Examples can be found in [this IPython notebook](https://github.com/hchasestevens/show_ast/blob/master/Example.ipynb).
```python
import showast
```
```python
%%showast
print 1 + 2
```

Installation
-------------
```
easy_install showast
```
showast has the following dependencies:
```
ipython
nltk
pillow
```
Additionally, you will need to have [Ghostscript](http://ghostscript.com/download/gsdnld.html) installed.
Contacts
--------
* Name: [H. Chase Stevens](http://www.chasestevens.com)
* Twitter: [@hchasestevens](https://twitter.com/hchasestevens)
| Add example on front page | Add example on front page | Markdown | mit | hchasestevens/show_ast | markdown | ## Code Before:
An IPython/Jupyter notebook plugin for visualizing abstract syntax trees.
Example usage
--------------
Examples can be found in [this IPython notebook](https://github.com/hchasestevens/show_ast/blob/master/Example.ipynb).
Installation
-------------
```
easy_install showast
```
showast has the following dependencies:
```
ipython
nltk
pillow
```
Additionally, you will need to have [Ghostscript](http://ghostscript.com/download/gsdnld.html) installed.
Contacts
--------
* Name: [H. Chase Stevens](http://www.chasestevens.com)
* Twitter: [@hchasestevens](https://twitter.com/hchasestevens)
## Instruction:
Add example on front page
## Code After:
An IPython/Jupyter notebook plugin for visualizing abstract syntax trees.
Example usage
--------------
Examples can be found in [this IPython notebook](https://github.com/hchasestevens/show_ast/blob/master/Example.ipynb).
```python
import showast
```
```python
%%showast
print 1 + 2
```

Installation
-------------
```
easy_install showast
```
showast has the following dependencies:
```
ipython
nltk
pillow
```
Additionally, you will need to have [Ghostscript](http://ghostscript.com/download/gsdnld.html) installed.
Contacts
--------
* Name: [H. Chase Stevens](http://www.chasestevens.com)
* Twitter: [@hchasestevens](https://twitter.com/hchasestevens)
| An IPython/Jupyter notebook plugin for visualizing abstract syntax trees.
Example usage
--------------
Examples can be found in [this IPython notebook](https://github.com/hchasestevens/show_ast/blob/master/Example.ipynb).
+
+ ```python
+ import showast
+ ```
+
+ ```python
+ %%showast
+ print 1 + 2
+ ```
+ 
Installation
-------------
```
easy_install showast
```
showast has the following dependencies:
```
ipython
nltk
pillow
```
Additionally, you will need to have [Ghostscript](http://ghostscript.com/download/gsdnld.html) installed.
Contacts
--------
* Name: [H. Chase Stevens](http://www.chasestevens.com)
* Twitter: [@hchasestevens](https://twitter.com/hchasestevens) | 10 | 0.384615 | 10 | 0 |
c8c034e68873e40ed55f0b9f04afc5949eb54727 | README.rst | README.rst | skeleton
========
.. image:: https://badge.fury.io/py/skeleton.svg
:target: https://badge.fury.io/py/skeleton
.. image:: https://pypip.in/d/skeleton/badge.png
:target: https://crate.io/packages/skeleton/
.. image:: https://secure.travis-ci.org/jaraco/skeleton.png
:target: http://travis-ci.org/jaraco/skeleton
| skeleton
========
.. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.io/project/skeleton
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
| Use shields.io, as some of these other providers seem to have gone out of business. | Use shields.io, as some of these other providers seem to have gone out of business.
| reStructuredText | mit | yougov/pmxbot,jaraco/jaraco.text,cherrypy/cheroot,yougov/librarypaste,jaraco/irc,jaraco/jaraco.context,yougov/pmxbot,jaraco/hgtools,yougov/mettle,jaraco/jaraco.itertools,python/importlib_metadata,jaraco/jaraco.path,jaraco/backports.functools_lru_cache,yougov/mettle,hugovk/inflect.py,jaraco/jaraco.stream,jaraco/keyring,pytest-dev/pytest-runner,jaraco/jaraco.functools,cherrypy/magicbus,jaraco/tempora,pwdyson/inflect.py,yougov/librarypaste,jaraco/jaraco.classes,jazzband/inflect,jaraco/jaraco.logging,yougov/mettle,yougov/mettle,yougov/pmxbot,jaraco/rwt,jaraco/jaraco.collections,jaraco/portend,jaraco/calendra,jaraco/zipp | restructuredtext | ## Code Before:
skeleton
========
.. image:: https://badge.fury.io/py/skeleton.svg
:target: https://badge.fury.io/py/skeleton
.. image:: https://pypip.in/d/skeleton/badge.png
:target: https://crate.io/packages/skeleton/
.. image:: https://secure.travis-ci.org/jaraco/skeleton.png
:target: http://travis-ci.org/jaraco/skeleton
## Instruction:
Use shields.io, as some of these other providers seem to have gone out of business.
## Code After:
skeleton
========
.. image:: https://img.shields.io/pypi/v/skeleton.svg
:target: https://pypi.io/project/skeleton
.. image:: https://img.shields.io/pypi/dm/skeleton.svg
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: http://travis-ci.org/jaraco/skeleton
| skeleton
========
- .. image:: https://badge.fury.io/py/skeleton.svg
? ^^ ^^^^^^^
+ .. image:: https://img.shields.io/pypi/v/skeleton.svg
? ^^^^^^^^^ ^ ++++
- :target: https://badge.fury.io/py/skeleton
? - ^^^^^^^^^ ^
+ :target: https://pypi.io/project/skeleton
? ^ ++ ^^^^^^
+ .. image:: https://img.shields.io/pypi/dm/skeleton.svg
- .. image:: https://pypip.in/d/skeleton/badge.png
- :target: https://crate.io/packages/skeleton/
- .. image:: https://secure.travis-ci.org/jaraco/skeleton.png
+ .. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
- :target: http://travis-ci.org/jaraco/skeleton
? -
+ :target: http://travis-ci.org/jaraco/skeleton | 11 | 1 | 5 | 6 |
70cc777678d60e69cf5f511737dc9984df88f52b | src/test/integration_test.sh | src/test/integration_test.sh |
testPrintVersion() {
./napalm -v 2> /dev/null
assertEquals 0 $?
}
testPrintHelp() {
./napalm -h 2> /dev/null
assertEquals 10 $?
}
. ./shunit2
|
testPrintVersion() {
./napalm -v 2> /dev/null
assertEquals 0 $?
}
testPrintHelp() {
./napalm -h 2> /dev/null
assertEquals 10 $?
}
testIllegalArgument() {
# -i is not recognized argument
./napalm -i 2> /dev/null
assertEquals 10 $?
}
. ./shunit2
| Add test for illegal argument. | Add test for illegal argument.
| Shell | mit | mbezjak/napalm | shell | ## Code Before:
testPrintVersion() {
./napalm -v 2> /dev/null
assertEquals 0 $?
}
testPrintHelp() {
./napalm -h 2> /dev/null
assertEquals 10 $?
}
. ./shunit2
## Instruction:
Add test for illegal argument.
## Code After:
testPrintVersion() {
./napalm -v 2> /dev/null
assertEquals 0 $?
}
testPrintHelp() {
./napalm -h 2> /dev/null
assertEquals 10 $?
}
testIllegalArgument() {
# -i is not recognized argument
./napalm -i 2> /dev/null
assertEquals 10 $?
}
. ./shunit2
|
testPrintVersion() {
./napalm -v 2> /dev/null
assertEquals 0 $?
}
testPrintHelp() {
./napalm -h 2> /dev/null
assertEquals 10 $?
}
+ testIllegalArgument() {
+ # -i is not recognized argument
+ ./napalm -i 2> /dev/null
+ assertEquals 10 $?
+ }
+
. ./shunit2 | 6 | 0.461538 | 6 | 0 |
29a7683f23e67d503702b8e203fd20bc538fb8ec | README.md | README.md |
Some useful directive of filter for angularjs.
## Usage
1. Install the required tools: `gulp`, `bower`, `tsd`
npm install -g gulp bower tsd@next
1. Install dependency
gulp install
1. Build
gulp
1. Test
gulp test |
Some useful directive of filter for angularjs.
## Usage
1. Install the required tools: `gulp`, `bower`, `tsd`, `typescript`, `karma-cli`
npm install -g gulp bower tsd@next typescript karma-cli
1. Install dependency
npm install
bower install
tsd install
or
tsd install angular
tsd install jquery
1. Build
gulp
1. Test
gulp test | Modify readme, add typescript, karma-cli as required tool | Modify readme, add typescript, karma-cli as required tool
| Markdown | mit | 91mai/NSquared.Ng.Utils,91mai/NSquared.Ng.Utils | markdown | ## Code Before:
Some useful directive of filter for angularjs.
## Usage
1. Install the required tools: `gulp`, `bower`, `tsd`
npm install -g gulp bower tsd@next
1. Install dependency
gulp install
1. Build
gulp
1. Test
gulp test
## Instruction:
Modify readme, add typescript, karma-cli as required tool
## Code After:
Some useful directive of filter for angularjs.
## Usage
1. Install the required tools: `gulp`, `bower`, `tsd`, `typescript`, `karma-cli`
npm install -g gulp bower tsd@next typescript karma-cli
1. Install dependency
npm install
bower install
tsd install
or
tsd install angular
tsd install jquery
1. Build
gulp
1. Test
gulp test |
Some useful directive of filter for angularjs.
## Usage
- 1. Install the required tools: `gulp`, `bower`, `tsd`
? ^^^
+ 1. Install the required tools: `gulp`, `bower`, `tsd`, `typescript`, `karma-cli`
? ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- npm install -g gulp bower tsd@next
? ^^
+ npm install -g gulp bower tsd@next typescript karma-cli
? ^^^^^^^^^^^^^^^^^^^^^
1. Install dependency
- gulp install
? ^^^
+ npm install
? ^ +
+ bower install
+ tsd install
+ or
+
+ tsd install angular
+ tsd install jquery
1. Build
gulp
1. Test
gulp test | 12 | 0.6 | 9 | 3 |
a5bc36df3435258fad9700c150985998e9663ff9 | haas/tests/test_coverage.py | haas/tests/test_coverage.py | from __future__ import absolute_import, unicode_literals
try:
import coverage
except ImportError:
coverage = None
from mock import Mock, patch
from ..coverage import Coverage
from ..testing import unittest
@unittest.skipIf(coverage is None, 'Coverage is not installed')
class TestCoverage(unittest.TestCase):
@patch('coverage.coverage')
def test_coverage(self, coverage_func):
coverage_object = Mock()
coverage_func.return_value = coverage_object
coverage_object.start = Mock()
coverage_object.stop = Mock()
coverage_object.save = Mock()
cov = Coverage()
coverage_func.assert_called_once_with()
cov.setup()
coverage_object.start.assert_called_once_with()
self.assertFalse(coverage_object.stop.called)
self.assertFalse(coverage_object.save.called)
cov.teardown()
coverage_object.stop.assert_called_once_with()
coverage_object.save.assert_called_once_with()
| from __future__ import absolute_import, unicode_literals
try:
import coverage
from ..coverage import Coverage
except ImportError:
coverage = None
Coverage = None
from mock import Mock, patch
from ..testing import unittest
@unittest.skipIf(coverage is None, 'Coverage is not installed')
class TestCoverage(unittest.TestCase):
@patch('coverage.coverage')
def test_coverage(self, coverage_func):
coverage_object = Mock()
coverage_func.return_value = coverage_object
coverage_object.start = Mock()
coverage_object.stop = Mock()
coverage_object.save = Mock()
cov = Coverage()
coverage_func.assert_called_once_with()
cov.setup()
coverage_object.start.assert_called_once_with()
self.assertFalse(coverage_object.stop.called)
self.assertFalse(coverage_object.save.called)
cov.teardown()
coverage_object.stop.assert_called_once_with()
coverage_object.save.assert_called_once_with()
| Fix test error when coverage is not installed | Fix test error when coverage is not installed
| Python | bsd-3-clause | itziakos/haas,scalative/haas,sjagoe/haas,sjagoe/haas,scalative/haas,itziakos/haas | python | ## Code Before:
from __future__ import absolute_import, unicode_literals
try:
import coverage
except ImportError:
coverage = None
from mock import Mock, patch
from ..coverage import Coverage
from ..testing import unittest
@unittest.skipIf(coverage is None, 'Coverage is not installed')
class TestCoverage(unittest.TestCase):
@patch('coverage.coverage')
def test_coverage(self, coverage_func):
coverage_object = Mock()
coverage_func.return_value = coverage_object
coverage_object.start = Mock()
coverage_object.stop = Mock()
coverage_object.save = Mock()
cov = Coverage()
coverage_func.assert_called_once_with()
cov.setup()
coverage_object.start.assert_called_once_with()
self.assertFalse(coverage_object.stop.called)
self.assertFalse(coverage_object.save.called)
cov.teardown()
coverage_object.stop.assert_called_once_with()
coverage_object.save.assert_called_once_with()
## Instruction:
Fix test error when coverage is not installed
## Code After:
from __future__ import absolute_import, unicode_literals
try:
import coverage
from ..coverage import Coverage
except ImportError:
coverage = None
Coverage = None
from mock import Mock, patch
from ..testing import unittest
@unittest.skipIf(coverage is None, 'Coverage is not installed')
class TestCoverage(unittest.TestCase):
@patch('coverage.coverage')
def test_coverage(self, coverage_func):
coverage_object = Mock()
coverage_func.return_value = coverage_object
coverage_object.start = Mock()
coverage_object.stop = Mock()
coverage_object.save = Mock()
cov = Coverage()
coverage_func.assert_called_once_with()
cov.setup()
coverage_object.start.assert_called_once_with()
self.assertFalse(coverage_object.stop.called)
self.assertFalse(coverage_object.save.called)
cov.teardown()
coverage_object.stop.assert_called_once_with()
coverage_object.save.assert_called_once_with()
| from __future__ import absolute_import, unicode_literals
try:
import coverage
+ from ..coverage import Coverage
except ImportError:
coverage = None
+ Coverage = None
from mock import Mock, patch
- from ..coverage import Coverage
from ..testing import unittest
@unittest.skipIf(coverage is None, 'Coverage is not installed')
class TestCoverage(unittest.TestCase):
@patch('coverage.coverage')
def test_coverage(self, coverage_func):
coverage_object = Mock()
coverage_func.return_value = coverage_object
coverage_object.start = Mock()
coverage_object.stop = Mock()
coverage_object.save = Mock()
cov = Coverage()
coverage_func.assert_called_once_with()
cov.setup()
coverage_object.start.assert_called_once_with()
self.assertFalse(coverage_object.stop.called)
self.assertFalse(coverage_object.save.called)
cov.teardown()
coverage_object.stop.assert_called_once_with()
coverage_object.save.assert_called_once_with() | 3 | 0.090909 | 2 | 1 |
a94bccb300641c8f073a160604a8bfad0482d566 | README.md | README.md |
Converts scripts into colour syntax HTML using vim.
Idea was shamelessly stolen from the original Perl 5 Text::VimColor
Pull requests welcome.
|
Converts scripts into colour syntax HTML using vim.
Idea was shamelessly stolen from the original Perl 5 Text::VimColor
Pull requests welcome.
## Installation
To install this module, you'll need `vim` version at least 7.4. You should
also get updated
[Perl 6 vim syntax files](https://github.com/vim-perl/vim-perl)
## Synopsis
```perl6
use Text::VimColour;
Text::VimColour.new(
lang => "perl6",
in => "file-to-highlight.p6",
out => '/tmp/out.html'
);
```
## Methods
### new
```perl6
Text::VimColour.new(
lang => 'perl6',
in => 'file-to-highlight.p6'
code => 'say $foo;',
out => '/tmp/out.html',
);
```
#### in
Specifies the input file with the code to highlight. You **must** specify
either `in` or `code`.
#### code
Specifies the code to highlight. You **must** specify either `in` or `code`.
#### lang
Optional. Specifies the language to use for highlighting. Defaults to `c`
#### out
Optional. Specifies the path to a file to output highlighted HTML into
### html-full-page
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.html-full-page;
```
Takes no arguments. Returns the full HTML page with highlighted code
and styling CSS.
### html
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.html;
```
Same as `html-full-page`, but returns only the highlighted code HTML.
### css
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.css;
```
Same as `html-full-page`, but returns only the styling CSS code.
| Add installation and usage docs | Add installation and usage docs
| Markdown | artistic-2.0 | stmuk/p6-Text-VimColour | markdown | ## Code Before:
Converts scripts into colour syntax HTML using vim.
Idea was shamelessly stolen from the original Perl 5 Text::VimColor
Pull requests welcome.
## Instruction:
Add installation and usage docs
## Code After:
Converts scripts into colour syntax HTML using vim.
Idea was shamelessly stolen from the original Perl 5 Text::VimColor
Pull requests welcome.
## Installation
To install this module, you'll need `vim` version at least 7.4. You should
also get updated
[Perl 6 vim syntax files](https://github.com/vim-perl/vim-perl)
## Synopsis
```perl6
use Text::VimColour;
Text::VimColour.new(
lang => "perl6",
in => "file-to-highlight.p6",
out => '/tmp/out.html'
);
```
## Methods
### new
```perl6
Text::VimColour.new(
lang => 'perl6',
in => 'file-to-highlight.p6'
code => 'say $foo;',
out => '/tmp/out.html',
);
```
#### in
Specifies the input file with the code to highlight. You **must** specify
either `in` or `code`.
#### code
Specifies the code to highlight. You **must** specify either `in` or `code`.
#### lang
Optional. Specifies the language to use for highlighting. Defaults to `c`
#### out
Optional. Specifies the path to a file to output highlighted HTML into
### html-full-page
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.html-full-page;
```
Takes no arguments. Returns the full HTML page with highlighted code
and styling CSS.
### html
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.html;
```
Same as `html-full-page`, but returns only the highlighted code HTML.
### css
```perl6
say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
.css;
```
Same as `html-full-page`, but returns only the styling CSS code.
|
Converts scripts into colour syntax HTML using vim.
Idea was shamelessly stolen from the original Perl 5 Text::VimColor
Pull requests welcome.
+
+ ## Installation
+
+ To install this module, you'll need `vim` version at least 7.4. You should
+ also get updated
+ [Perl 6 vim syntax files](https://github.com/vim-perl/vim-perl)
+
+ ## Synopsis
+
+ ```perl6
+ use Text::VimColour;
+ Text::VimColour.new(
+ lang => "perl6",
+ in => "file-to-highlight.p6",
+ out => '/tmp/out.html'
+ );
+ ```
+
+ ## Methods
+
+ ### new
+
+ ```perl6
+ Text::VimColour.new(
+ lang => 'perl6',
+ in => 'file-to-highlight.p6'
+ code => 'say $foo;',
+ out => '/tmp/out.html',
+ );
+ ```
+
+ #### in
+
+ Specifies the input file with the code to highlight. You **must** specify
+ either `in` or `code`.
+
+ #### code
+
+ Specifies the code to highlight. You **must** specify either `in` or `code`.
+
+ #### lang
+
+ Optional. Specifies the language to use for highlighting. Defaults to `c`
+
+ #### out
+
+ Optional. Specifies the path to a file to output highlighted HTML into
+
+ ### html-full-page
+
+ ```perl6
+ say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
+ .html-full-page;
+ ```
+
+ Takes no arguments. Returns the full HTML page with highlighted code
+ and styling CSS.
+
+ ### html
+
+ ```perl6
+ say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
+ .html;
+ ```
+
+ Same as `html-full-page`, but returns only the highlighted code HTML.
+
+ ### css
+
+ ```perl6
+ say Text::VimColour.new( lang => 'perl6', in => 'file-to-highlight.p6')
+ .css;
+ ```
+
+ Same as `html-full-page`, but returns only the styling CSS code. | 75 | 12.5 | 75 | 0 |
29965f7b80df3a2d3a6406391c865f539d0a2e2d | client/message/__tests__/view-test.js | client/message/__tests__/view-test.js | const React = require('react/addons');
const TestUtils = React.addons.TestUtils;
jest.dontMock('../view.jsx');
const Message = require('../view.jsx');
describe('Message', function() {
it('renders a message', function() {
const message = TestUtils.renderIntoDocument(
<Message username='hilbert'
own='false'
text='Wir müssen wissen — wir werden wissen!' />
);
const li = TestUtils.findRenderedDOMComponentWithTag(
message,
'li'
).getDOMNode();
expect(li.textContent).toContain('hilbert');
});
});
| const React = require('react/addons');
const TestUtils = React.addons.TestUtils;
jest.dontMock('../view.jsx');
const Message = require('../view.jsx');
describe('Message', function() {
function renderAndGetNode(xml, node) {
const reactNode = TestUtils.renderIntoDocument(xml);
const domNode = TestUtils.findRenderedDOMComponentWithTag(
reactNode,
node
).getDOMNode();
return domNode;
}
function renderMessage(username, own, text, typing) {
return renderAndGetNode(
<Message username={username}
own={own}
text={text}
typing={typing} />,
'li'
);
}
it('renders a message', function() {
const li = renderMessage(
'hilbert',
false,
'Wir müssen wissen — wir werden wissen!',
false
);
expect(li.textContent).toContain('hilbert');
expect(React.findDOMNode(li).className).toContain('other');
expect(React.findDOMNode(li).className).not.toContain('typing');
});
it('distinguishes your own messages', function() {
const li = renderMessage(
'hilbert',
true,
'Wir müssen wissen — wir werden wissen!',
false
);
expect(React.findDOMNode(li).className).toContain('self');
});
it('distinguishes messages that are being typed', function() {
const li = renderMessage(
'hilbert',
true,
'Wir müssen wissen — wir werden wissen!',
true
);
expect(React.findDOMNode(li).className).toContain('typing');
});
});
| Add tests for typing and self messages | Add tests for typing and self messages
| JavaScript | mit | dionyziz/ting,sirodoht/ting,dionyziz/ting,VitSalis/ting,sirodoht/ting,gtklocker/ting,VitSalis/ting,gtklocker/ting,VitSalis/ting,dionyziz/ting,dionyziz/ting,sirodoht/ting,mbalamat/ting,VitSalis/ting,mbalamat/ting,gtklocker/ting,mbalamat/ting,gtklocker/ting,mbalamat/ting,sirodoht/ting | javascript | ## Code Before:
const React = require('react/addons');
const TestUtils = React.addons.TestUtils;
jest.dontMock('../view.jsx');
const Message = require('../view.jsx');
describe('Message', function() {
it('renders a message', function() {
const message = TestUtils.renderIntoDocument(
<Message username='hilbert'
own='false'
text='Wir müssen wissen — wir werden wissen!' />
);
const li = TestUtils.findRenderedDOMComponentWithTag(
message,
'li'
).getDOMNode();
expect(li.textContent).toContain('hilbert');
});
});
## Instruction:
Add tests for typing and self messages
## Code After:
const React = require('react/addons');
const TestUtils = React.addons.TestUtils;
jest.dontMock('../view.jsx');
const Message = require('../view.jsx');
describe('Message', function() {
function renderAndGetNode(xml, node) {
const reactNode = TestUtils.renderIntoDocument(xml);
const domNode = TestUtils.findRenderedDOMComponentWithTag(
reactNode,
node
).getDOMNode();
return domNode;
}
function renderMessage(username, own, text, typing) {
return renderAndGetNode(
<Message username={username}
own={own}
text={text}
typing={typing} />,
'li'
);
}
it('renders a message', function() {
const li = renderMessage(
'hilbert',
false,
'Wir müssen wissen — wir werden wissen!',
false
);
expect(li.textContent).toContain('hilbert');
expect(React.findDOMNode(li).className).toContain('other');
expect(React.findDOMNode(li).className).not.toContain('typing');
});
it('distinguishes your own messages', function() {
const li = renderMessage(
'hilbert',
true,
'Wir müssen wissen — wir werden wissen!',
false
);
expect(React.findDOMNode(li).className).toContain('self');
});
it('distinguishes messages that are being typed', function() {
const li = renderMessage(
'hilbert',
true,
'Wir müssen wissen — wir werden wissen!',
true
);
expect(React.findDOMNode(li).className).toContain('typing');
});
});
| const React = require('react/addons');
const TestUtils = React.addons.TestUtils;
jest.dontMock('../view.jsx');
const Message = require('../view.jsx');
describe('Message', function() {
+ function renderAndGetNode(xml, node) {
+ const reactNode = TestUtils.renderIntoDocument(xml);
+ const domNode = TestUtils.findRenderedDOMComponentWithTag(
+ reactNode,
+ node
+ ).getDOMNode();
+
+ return domNode;
+ }
+
+ function renderMessage(username, own, text, typing) {
+ return renderAndGetNode(
+ <Message username={username}
+ own={own}
+ text={text}
+ typing={typing} />,
+ 'li'
+ );
+ }
+
it('renders a message', function() {
- const message = TestUtils.renderIntoDocument(
- <Message username='hilbert'
- own='false'
+ const li = renderMessage(
+ 'hilbert',
+ false,
- text='Wir müssen wissen — wir werden wissen!' />
? -------------- ^^^
+ 'Wir müssen wissen — wir werden wissen!',
? ^
+ false
);
- const li = TestUtils.findRenderedDOMComponentWithTag(
- message,
- 'li'
- ).getDOMNode();
+ expect(li.textContent).toContain('hilbert');
+ expect(React.findDOMNode(li).className).toContain('other');
+ expect(React.findDOMNode(li).className).not.toContain('typing');
+ });
- expect(li.textContent).toContain('hilbert');
+ it('distinguishes your own messages', function() {
+ const li = renderMessage(
+ 'hilbert',
+ true,
+ 'Wir müssen wissen — wir werden wissen!',
+ false
+ );
+
+ expect(React.findDOMNode(li).className).toContain('self');
+ });
+
+ it('distinguishes messages that are being typed', function() {
+ const li = renderMessage(
+ 'hilbert',
+ true,
+ 'Wir müssen wissen — wir werden wissen!',
+ true
+ );
+
+ expect(React.findDOMNode(li).className).toContain('typing');
});
}); | 58 | 2.521739 | 49 | 9 |
d642d98b576701744357c613ec67eb64042328ec | scss/_list.scss | scss/_list.scss | ul > li,
ol > li {
margin-left: $spacing-unit;
}
dl > dt {
font-weight: $font-weight-bold;
}
dd + dt {
margin-top: halve($spacing-unit);
}
%list-reset,
.list-reset {
padding-left: 0;
list-style: none;
> li {
margin-left: 0;
}
}
%list-inline,
.list-inline {
@extend %list-reset;
margin-bottom: 0;
margin-left: quarter($spacing-unit) * -1;
> li {
display: inline-block;
padding-right: quarter($spacing-unit);
padding-left: quarter($spacing-unit);
}
}
%list-menu,
.list-menu {
@extend %list-reset;
margin-top: quarter($spacing-unit) * -1;
> li > a {
@include ui-padding;
display: block;
border-radius: $ui-border-radius;
text-decoration: none;
&:hover {
background: $list-menu-background;
color: $list-menu-color;
}
@if $link-active {
&:active {
top: 0;
}
}
}
}
| ul > li,
ol > li {
margin-left: $spacing-unit;
}
dl > dt {
font-weight: $font-weight-bold;
}
dd + dt {
margin-top: halve($spacing-unit);
}
%list-reset,
.list-reset {
padding-left: 0;
list-style: none;
> li {
margin-left: 0;
}
}
%list-inline,
.list-inline {
@extend %list-reset;
margin-bottom: 0;
margin-left: quarter($spacing-unit) * -1;
font-size: 0;
> li {
@include font-size($font-size-base);
display: inline-block;
padding-right: quarter($spacing-unit);
padding-left: quarter($spacing-unit);
}
}
%list-menu,
.list-menu {
@extend %list-reset;
margin-top: quarter($spacing-unit) * -1;
> li > a {
@include ui-padding;
display: block;
border-radius: $ui-border-radius;
text-decoration: none;
&:hover {
background: $list-menu-background;
color: $list-menu-color;
}
@if $link-active {
&:active {
top: 0;
}
}
}
}
| Remove space between inline list elements | Remove space between inline list elements
| SCSS | mit | bkzl/hocus-pocus | scss | ## Code Before:
ul > li,
ol > li {
margin-left: $spacing-unit;
}
dl > dt {
font-weight: $font-weight-bold;
}
dd + dt {
margin-top: halve($spacing-unit);
}
%list-reset,
.list-reset {
padding-left: 0;
list-style: none;
> li {
margin-left: 0;
}
}
%list-inline,
.list-inline {
@extend %list-reset;
margin-bottom: 0;
margin-left: quarter($spacing-unit) * -1;
> li {
display: inline-block;
padding-right: quarter($spacing-unit);
padding-left: quarter($spacing-unit);
}
}
%list-menu,
.list-menu {
@extend %list-reset;
margin-top: quarter($spacing-unit) * -1;
> li > a {
@include ui-padding;
display: block;
border-radius: $ui-border-radius;
text-decoration: none;
&:hover {
background: $list-menu-background;
color: $list-menu-color;
}
@if $link-active {
&:active {
top: 0;
}
}
}
}
## Instruction:
Remove space between inline list elements
## Code After:
ul > li,
ol > li {
margin-left: $spacing-unit;
}
dl > dt {
font-weight: $font-weight-bold;
}
dd + dt {
margin-top: halve($spacing-unit);
}
%list-reset,
.list-reset {
padding-left: 0;
list-style: none;
> li {
margin-left: 0;
}
}
%list-inline,
.list-inline {
@extend %list-reset;
margin-bottom: 0;
margin-left: quarter($spacing-unit) * -1;
font-size: 0;
> li {
@include font-size($font-size-base);
display: inline-block;
padding-right: quarter($spacing-unit);
padding-left: quarter($spacing-unit);
}
}
%list-menu,
.list-menu {
@extend %list-reset;
margin-top: quarter($spacing-unit) * -1;
> li > a {
@include ui-padding;
display: block;
border-radius: $ui-border-radius;
text-decoration: none;
&:hover {
background: $list-menu-background;
color: $list-menu-color;
}
@if $link-active {
&:active {
top: 0;
}
}
}
}
| ul > li,
ol > li {
margin-left: $spacing-unit;
}
dl > dt {
font-weight: $font-weight-bold;
}
dd + dt {
margin-top: halve($spacing-unit);
}
%list-reset,
.list-reset {
padding-left: 0;
list-style: none;
> li {
margin-left: 0;
}
}
%list-inline,
.list-inline {
@extend %list-reset;
margin-bottom: 0;
margin-left: quarter($spacing-unit) * -1;
+ font-size: 0;
> li {
+ @include font-size($font-size-base);
display: inline-block;
padding-right: quarter($spacing-unit);
padding-left: quarter($spacing-unit);
}
}
%list-menu,
.list-menu {
@extend %list-reset;
margin-top: quarter($spacing-unit) * -1;
> li > a {
@include ui-padding;
display: block;
border-radius: $ui-border-radius;
text-decoration: none;
&:hover {
background: $list-menu-background;
color: $list-menu-color;
}
@if $link-active {
&:active {
top: 0;
}
}
}
} | 2 | 0.033898 | 2 | 0 |
6b5a63996b417853379defb68e94f7f7b97bb959 | Code/Compiler/Extrinsic-environment/import-from-sicl-global-environment.lisp | Code/Compiler/Extrinsic-environment/import-from-sicl-global-environment.lisp | (cl:in-package #:sicl-extrinsic-environment)
;;; Add every global environment function into the environment.
(defun import-from-sicl-global-environment (environment)
(loop for symbol being each external-symbol in '#:sicl-global-environment
when (fboundp symbol)
do (setf (sicl-env:fdefinition symbol environment)
(fdefinition symbol))
when (fboundp `(setf ,symbol))
do (setf (sicl-env:fdefinition `(setf ,symbol) environment)
(fdefinition `(setf ,symbol)))))
| (cl:in-package #:sicl-extrinsic-environment)
;;; Add every global environment function into the environment.
(defun import-from-sicl-global-environment (environment)
(loop for symbol being each external-symbol in '#:sicl-global-environment
when (fboundp symbol)
do (setf (sicl-env:fdefinition symbol environment)
(fdefinition symbol))
when (fboundp `(setf ,symbol))
do (setf (sicl-env:fdefinition `(setf ,symbol) environment)
(fdefinition `(setf ,symbol))))
(setf (sicl-env:special-variable 'sicl-env:*global-environment* environment t)
environment))
| Define variable *GLOBAL-ENVIRONMENT* in the exitrinsic environment. | Define variable *GLOBAL-ENVIRONMENT* in the exitrinsic environment.
| Common Lisp | bsd-2-clause | vtomole/SICL,clasp-developers/SICL,clasp-developers/SICL,clasp-developers/SICL,vtomole/SICL,vtomole/SICL,clasp-developers/SICL,vtomole/SICL | common-lisp | ## Code Before:
(cl:in-package #:sicl-extrinsic-environment)
;;; Add every global environment function into the environment.
(defun import-from-sicl-global-environment (environment)
(loop for symbol being each external-symbol in '#:sicl-global-environment
when (fboundp symbol)
do (setf (sicl-env:fdefinition symbol environment)
(fdefinition symbol))
when (fboundp `(setf ,symbol))
do (setf (sicl-env:fdefinition `(setf ,symbol) environment)
(fdefinition `(setf ,symbol)))))
## Instruction:
Define variable *GLOBAL-ENVIRONMENT* in the exitrinsic environment.
## Code After:
(cl:in-package #:sicl-extrinsic-environment)
;;; Add every global environment function into the environment.
(defun import-from-sicl-global-environment (environment)
(loop for symbol being each external-symbol in '#:sicl-global-environment
when (fboundp symbol)
do (setf (sicl-env:fdefinition symbol environment)
(fdefinition symbol))
when (fboundp `(setf ,symbol))
do (setf (sicl-env:fdefinition `(setf ,symbol) environment)
(fdefinition `(setf ,symbol))))
(setf (sicl-env:special-variable 'sicl-env:*global-environment* environment t)
environment))
| (cl:in-package #:sicl-extrinsic-environment)
;;; Add every global environment function into the environment.
(defun import-from-sicl-global-environment (environment)
(loop for symbol being each external-symbol in '#:sicl-global-environment
when (fboundp symbol)
do (setf (sicl-env:fdefinition symbol environment)
(fdefinition symbol))
when (fboundp `(setf ,symbol))
do (setf (sicl-env:fdefinition `(setf ,symbol) environment)
- (fdefinition `(setf ,symbol)))))
? -
+ (fdefinition `(setf ,symbol))))
+ (setf (sicl-env:special-variable 'sicl-env:*global-environment* environment t)
+ environment)) | 4 | 0.363636 | 3 | 1 |
e9f85d9bc70fd00f7771daa25bed3885ee968818 | .travis.yml | .travis.yml | language: java
jdk:
- openjdk6
- openjdk7
- oraclejdk7
- oraclejdk8
cache:
directories:
- $HOME/.gradle
# workaround for buffer overflow
# see https://github.com/travis-ci/travis-ci/issues/5227
before_install:
- cat /etc/hosts # optionally check the content *before*
- sudo hostname "$(hostname | cut -c1-63)"
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
- cat /etc/hosts # optionally check the content *after*
| language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
cache:
directories:
- $HOME/.gradle
# workaround for buffer overflow
# see https://github.com/travis-ci/travis-ci/issues/5227
before_install:
- cat /etc/hosts # optionally check the content *before*
- sudo hostname "$(hostname | cut -c1-63)"
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
- cat /etc/hosts # optionally check the content *after*
| Remove openjdk6 from Travis CI | Remove openjdk6 from Travis CI
| YAML | apache-2.0 | michel-kraemer/bson4jackson | yaml | ## Code Before:
language: java
jdk:
- openjdk6
- openjdk7
- oraclejdk7
- oraclejdk8
cache:
directories:
- $HOME/.gradle
# workaround for buffer overflow
# see https://github.com/travis-ci/travis-ci/issues/5227
before_install:
- cat /etc/hosts # optionally check the content *before*
- sudo hostname "$(hostname | cut -c1-63)"
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
- cat /etc/hosts # optionally check the content *after*
## Instruction:
Remove openjdk6 from Travis CI
## Code After:
language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
cache:
directories:
- $HOME/.gradle
# workaround for buffer overflow
# see https://github.com/travis-ci/travis-ci/issues/5227
before_install:
- cat /etc/hosts # optionally check the content *before*
- sudo hostname "$(hostname | cut -c1-63)"
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
- cat /etc/hosts # optionally check the content *after*
| language: java
jdk:
- - openjdk6
- openjdk7
- oraclejdk7
- oraclejdk8
cache:
directories:
- $HOME/.gradle
# workaround for buffer overflow
# see https://github.com/travis-ci/travis-ci/issues/5227
before_install:
- cat /etc/hosts # optionally check the content *before*
- sudo hostname "$(hostname | cut -c1-63)"
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
- cat /etc/hosts # optionally check the content *after* | 1 | 0.058824 | 0 | 1 |
577de3bc3a7afa69c5f2ba4e71bf98d9806c2cd5 | recipes-support/graphite2/graphite2_1.3.13.bb | recipes-support/graphite2/graphite2_1.3.13.bb | SUMMARY = "Font rendering capabilities for complex non-Roman writing systems"
HOMEPAGE = "http://sourceforge.net/projects/silgraphite"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=acba2ba259d936c324b90ab679e6b901"
inherit cmake
DEPENDS += "freetype"
SRC_URI = "${SOURCEFORGE_MIRROR}/project/silgraphite/${BPN}/${BPN}-${PV}.tgz"
SRC_URI[md5sum] = "29616d4f9651706036ca25c111508272"
SRC_URI[sha256sum] = "dd63e169b0d3cf954b397c122551ab9343e0696fb2045e1b326db0202d875f06"
EXTRA_OECMAKE += " \
-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
"
BBCLASSEXTEND = "native"
| SUMMARY = "Font rendering capabilities for complex non-Roman writing systems"
HOMEPAGE = "http://sourceforge.net/projects/silgraphite"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=b0452d508cc4eb104de0226a5b0c8786"
inherit cmake
DEPENDS += "freetype"
SRC_URI = "${SOURCEFORGE_MIRROR}/project/silgraphite/${BPN}/${BPN}-${PV}.tgz"
SRC_URI[md5sum] = "29616d4f9651706036ca25c111508272"
SRC_URI[sha256sum] = "dd63e169b0d3cf954b397c122551ab9343e0696fb2045e1b326db0202d875f06"
EXTRA_OECMAKE += " \
-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
"
BBCLASSEXTEND = "native"
| Fix license checksum - copyright year has changed | graphite2: Fix license checksum - copyright year has changed
Signed-off-by: Andreas Müller <d72a15aaaca3a7afa855175c72dc8d2e05931e32@gmail.com>
| BitBake | mit | schnitzeltony/meta-office,schnitzeltony/meta-libreoffice | bitbake | ## Code Before:
SUMMARY = "Font rendering capabilities for complex non-Roman writing systems"
HOMEPAGE = "http://sourceforge.net/projects/silgraphite"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=acba2ba259d936c324b90ab679e6b901"
inherit cmake
DEPENDS += "freetype"
SRC_URI = "${SOURCEFORGE_MIRROR}/project/silgraphite/${BPN}/${BPN}-${PV}.tgz"
SRC_URI[md5sum] = "29616d4f9651706036ca25c111508272"
SRC_URI[sha256sum] = "dd63e169b0d3cf954b397c122551ab9343e0696fb2045e1b326db0202d875f06"
EXTRA_OECMAKE += " \
-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
"
BBCLASSEXTEND = "native"
## Instruction:
graphite2: Fix license checksum - copyright year has changed
Signed-off-by: Andreas Müller <d72a15aaaca3a7afa855175c72dc8d2e05931e32@gmail.com>
## Code After:
SUMMARY = "Font rendering capabilities for complex non-Roman writing systems"
HOMEPAGE = "http://sourceforge.net/projects/silgraphite"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=b0452d508cc4eb104de0226a5b0c8786"
inherit cmake
DEPENDS += "freetype"
SRC_URI = "${SOURCEFORGE_MIRROR}/project/silgraphite/${BPN}/${BPN}-${PV}.tgz"
SRC_URI[md5sum] = "29616d4f9651706036ca25c111508272"
SRC_URI[sha256sum] = "dd63e169b0d3cf954b397c122551ab9343e0696fb2045e1b326db0202d875f06"
EXTRA_OECMAKE += " \
-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
"
BBCLASSEXTEND = "native"
| SUMMARY = "Font rendering capabilities for complex non-Roman writing systems"
HOMEPAGE = "http://sourceforge.net/projects/silgraphite"
LICENSE = "LGPLv2.1"
- LIC_FILES_CHKSUM = "file://COPYING;md5=acba2ba259d936c324b90ab679e6b901"
+ LIC_FILES_CHKSUM = "file://COPYING;md5=b0452d508cc4eb104de0226a5b0c8786"
inherit cmake
DEPENDS += "freetype"
SRC_URI = "${SOURCEFORGE_MIRROR}/project/silgraphite/${BPN}/${BPN}-${PV}.tgz"
SRC_URI[md5sum] = "29616d4f9651706036ca25c111508272"
SRC_URI[sha256sum] = "dd63e169b0d3cf954b397c122551ab9343e0696fb2045e1b326db0202d875f06"
EXTRA_OECMAKE += " \
-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
"
BBCLASSEXTEND = "native" | 2 | 0.111111 | 1 | 1 |
afcd02214d99f74623e6cdffe2f23ae4d172b60d | lib/features/settings/presentation/widgets/registration_exit_dialog.dart | lib/features/settings/presentation/widgets/registration_exit_dialog.dart | import 'package:flutter/material.dart';
class RegistrationExitDialog extends StatelessWidget {
const RegistrationExitDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Are you sure you want to exit?'),
content:
const Text('Any currently entered information will be discarded.'),
actions: [
TextButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: const Text('DISCARD'),
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).errorColor,
),
onPressed: () {
Navigator.of(context).pop(true);
},
),
],
);
}
}
| import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../bloc/registration_headers_bloc.dart';
class RegistrationExitDialog extends StatelessWidget {
const RegistrationExitDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Are you sure you want to exit?'),
content:
const Text('Any currently entered information will be discarded.'),
actions: [
TextButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: const Text('DISCARD'),
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).errorColor,
),
onPressed: () {
context.read<RegistrationHeadersBloc>().add(
RegistrationHeadersClear(),
);
Navigator.of(context).pop(true);
},
),
],
);
}
}
| Clear current custom headers on registration exit. | Clear current custom headers on registration exit.
| Dart | mit | wcomartin/PlexPy-Remote | dart | ## Code Before:
import 'package:flutter/material.dart';
class RegistrationExitDialog extends StatelessWidget {
const RegistrationExitDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Are you sure you want to exit?'),
content:
const Text('Any currently entered information will be discarded.'),
actions: [
TextButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: const Text('DISCARD'),
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).errorColor,
),
onPressed: () {
Navigator.of(context).pop(true);
},
),
],
);
}
}
## Instruction:
Clear current custom headers on registration exit.
## Code After:
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../bloc/registration_headers_bloc.dart';
class RegistrationExitDialog extends StatelessWidget {
const RegistrationExitDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Are you sure you want to exit?'),
content:
const Text('Any currently entered information will be discarded.'),
actions: [
TextButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: const Text('DISCARD'),
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).errorColor,
),
onPressed: () {
context.read<RegistrationHeadersBloc>().add(
RegistrationHeadersClear(),
);
Navigator.of(context).pop(true);
},
),
],
);
}
}
| import 'package:flutter/material.dart';
+ import 'package:flutter_bloc/flutter_bloc.dart';
+
+ import '../bloc/registration_headers_bloc.dart';
class RegistrationExitDialog extends StatelessWidget {
const RegistrationExitDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Are you sure you want to exit?'),
content:
const Text('Any currently entered information will be discarded.'),
actions: [
TextButton(
child: const Text('CANCEL'),
onPressed: () {
Navigator.of(context).pop(false);
},
),
TextButton(
child: const Text('DISCARD'),
style: TextButton.styleFrom(
backgroundColor: Theme.of(context).errorColor,
),
onPressed: () {
+ context.read<RegistrationHeadersBloc>().add(
+ RegistrationHeadersClear(),
+ );
Navigator.of(context).pop(true);
},
),
],
);
}
} | 6 | 0.193548 | 6 | 0 |
d7a4fa26b064aa294b1f52c61b02770feed6903b | pkgs/development/tools/misc/patchelf/setup-hook.sh | pkgs/development/tools/misc/patchelf/setup-hook.sh |
if [ -z "$dontPatchELF" ]; then
addHook fixupOutput 'patchELF "$prefix"'
fi
patchELF() {
header "patching ELF executables and libraries in $prefix"
if [ -e "$prefix" ]; then
find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath '{}' \;
fi
stopNest
}
|
addHook fixupOutput 'if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi'
patchELF() {
header "patching ELF executables and libraries in $prefix"
if [ -e "$prefix" ]; then
find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath '{}' \;
fi
stopNest
}
| Fix dontPatchELF being set after the setup script has been sourced | Fix dontPatchELF being set after the setup script has been sourced
| Shell | mit | SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,triton/triton,triton/triton,NixOS/nixpkgs,triton/triton,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,triton/triton,NixOS/nixpkgs,NixOS/nixpkgs,triton/triton,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,triton/triton,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs | shell | ## Code Before:
if [ -z "$dontPatchELF" ]; then
addHook fixupOutput 'patchELF "$prefix"'
fi
patchELF() {
header "patching ELF executables and libraries in $prefix"
if [ -e "$prefix" ]; then
find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath '{}' \;
fi
stopNest
}
## Instruction:
Fix dontPatchELF being set after the setup script has been sourced
## Code After:
addHook fixupOutput 'if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi'
patchELF() {
header "patching ELF executables and libraries in $prefix"
if [ -e "$prefix" ]; then
find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath '{}' \;
fi
stopNest
}
|
+ addHook fixupOutput 'if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi'
- if [ -z "$dontPatchELF" ]; then
- addHook fixupOutput 'patchELF "$prefix"'
- fi
patchELF() {
header "patching ELF executables and libraries in $prefix"
if [ -e "$prefix" ]; then
find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath '{}' \;
fi
stopNest
} | 4 | 0.266667 | 1 | 3 |
ed1b52faf367fc3867a877f0fb63b3cf7034dcab | README.adoc | README.adoc | = Snoop - A Discovery Service for Java EE
Snoop is an experimental registration and discovery service for Java EE based microservices.
== Getting Started
. Start the link:snoop-service.adoc[Snoop Service]
. link:service-registration.adoc[Service Registration]
. link:service-discovery.adoc[Service Discovery]
== Maven
. Released artifacts are available in link:http://search.maven.org/#search%7Cga%7C1%7Csnoop[Maven Central]
. Snapshots configuration:
<repositories>
<repository>
<id>agilejava-snapshots</id>
<url>http://nexus.agilejava.eu/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
== Examples
- link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
- link:https://github.com/arun-gupta/microservices[https://github.com/arun-gupta/microservices]
== FAQ
- link:FAQ.adoc[Frequently Asked Questions]
| = Snoop - A Discovery Service for Java EE
Snoop is an experimental registration and discovery service for Java EE based microservices.
== Getting Started
. Start the link:snoop-service.adoc[Snoop Service]
. link:service-registration.adoc[Service Registration]
. link:service-discovery.adoc[Service Discovery]
== Maven
. Released artifacts are available in link:http://search.maven.org/#search%7Cga%7C1%7Csnoop[Maven Central]
. Snapshots configuration:
<repositories>
<repository>
<id>agilejava-snapshots</id>
<url>http://nexus.agilejava.eu/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
== Classloader Issue
- link:classloader-issue.adoc[Description and Workaround]
== Examples
- link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
- link:https://github.com/arun-gupta/microservices[https://github.com/arun-gupta/microservices]
== FAQ
- link:FAQ.adoc[Frequently Asked Questions]
| Add reference to classloader issue and workaround | Add reference to classloader issue and workaround
| AsciiDoc | mit | ivargrimstad/snoopee,ivargrimstad/snoopee,ivargrimstad/snoopee,ivargrimstad/snoop,ivargrimstad/snoop,ivargrimstad/snoop | asciidoc | ## Code Before:
= Snoop - A Discovery Service for Java EE
Snoop is an experimental registration and discovery service for Java EE based microservices.
== Getting Started
. Start the link:snoop-service.adoc[Snoop Service]
. link:service-registration.adoc[Service Registration]
. link:service-discovery.adoc[Service Discovery]
== Maven
. Released artifacts are available in link:http://search.maven.org/#search%7Cga%7C1%7Csnoop[Maven Central]
. Snapshots configuration:
<repositories>
<repository>
<id>agilejava-snapshots</id>
<url>http://nexus.agilejava.eu/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
== Examples
- link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
- link:https://github.com/arun-gupta/microservices[https://github.com/arun-gupta/microservices]
== FAQ
- link:FAQ.adoc[Frequently Asked Questions]
## Instruction:
Add reference to classloader issue and workaround
## Code After:
= Snoop - A Discovery Service for Java EE
Snoop is an experimental registration and discovery service for Java EE based microservices.
== Getting Started
. Start the link:snoop-service.adoc[Snoop Service]
. link:service-registration.adoc[Service Registration]
. link:service-discovery.adoc[Service Discovery]
== Maven
. Released artifacts are available in link:http://search.maven.org/#search%7Cga%7C1%7Csnoop[Maven Central]
. Snapshots configuration:
<repositories>
<repository>
<id>agilejava-snapshots</id>
<url>http://nexus.agilejava.eu/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
== Classloader Issue
- link:classloader-issue.adoc[Description and Workaround]
== Examples
- link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
- link:https://github.com/arun-gupta/microservices[https://github.com/arun-gupta/microservices]
== FAQ
- link:FAQ.adoc[Frequently Asked Questions]
| = Snoop - A Discovery Service for Java EE
Snoop is an experimental registration and discovery service for Java EE based microservices.
== Getting Started
. Start the link:snoop-service.adoc[Snoop Service]
. link:service-registration.adoc[Service Registration]
. link:service-discovery.adoc[Service Discovery]
== Maven
. Released artifacts are available in link:http://search.maven.org/#search%7Cga%7C1%7Csnoop[Maven Central]
. Snapshots configuration:
<repositories>
<repository>
<id>agilejava-snapshots</id>
<url>http://nexus.agilejava.eu/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
+ == Classloader Issue
+
+ - link:classloader-issue.adoc[Description and Workaround]
+
== Examples
- - link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
? --
+ - link:https://github.com/ivargrimstad/snoop-samples[snoop-samples@GitHub]
- link:https://github.com/arun-gupta/microservices[https://github.com/arun-gupta/microservices]
== FAQ
- link:FAQ.adoc[Frequently Asked Questions] | 6 | 0.181818 | 5 | 1 |
f186f622ae2895e3abcdad58f55c7951d02bbe9c | awa/plugins/awa-storages/dynamo.xml | awa/plugins/awa-storages/dynamo.xml | <project>
<name>awa-storages</name>
<property name="author_email">Stephane.Carrez@gmail.com</property>
<property name="search_dirs">.;../asf;../ado</property>
<property name="author">Stephane Carrez</property>
</project> | <project>
<name>awa-storages</name>
<property name="author_email">Stephane.Carrez@gmail.com</property>
<property name="search_dirs">.;../asf;../ado</property>
<property name="author">Stephane Carrez</property>
<property name="gnat.project">awa_storages.gpr</property>
</project> | Fix the gnat project name | Fix the gnat project name
| XML | apache-2.0 | tectronics/ada-awa,Letractively/ada-awa,tectronics/ada-awa,tectronics/ada-awa,Letractively/ada-awa,Letractively/ada-awa | xml | ## Code Before:
<project>
<name>awa-storages</name>
<property name="author_email">Stephane.Carrez@gmail.com</property>
<property name="search_dirs">.;../asf;../ado</property>
<property name="author">Stephane Carrez</property>
</project>
## Instruction:
Fix the gnat project name
## Code After:
<project>
<name>awa-storages</name>
<property name="author_email">Stephane.Carrez@gmail.com</property>
<property name="search_dirs">.;../asf;../ado</property>
<property name="author">Stephane Carrez</property>
<property name="gnat.project">awa_storages.gpr</property>
</project> | <project>
<name>awa-storages</name>
<property name="author_email">Stephane.Carrez@gmail.com</property>
<property name="search_dirs">.;../asf;../ado</property>
<property name="author">Stephane Carrez</property>
+ <property name="gnat.project">awa_storages.gpr</property>
</project> | 1 | 0.166667 | 1 | 0 |
f8640410f4271b22a2836d9fe4f5d09b28c7b19c | angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py | angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py | import logging
from typing import Iterable, Tuple, Any
from .. import MemoryMixin
l = logging.getLogger(name=__name__)
class AbstractMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int):
if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
should_reverse = True
elif self.state.arch.memory_endness == 'Iend_LE':
should_reverse = True
else:
should_reverse = False
values = list(values)
merged_val = values[0][0]
if should_reverse: merged_val = merged_val.reversed
for tm, _ in values[1:]:
if should_reverse: tm = tm.reversed
if self._is_uninitialized(tm):
continue
l.info("Merging %s %s...", merged_val, tm)
merged_val = merged_val.union(tm)
l.info("... Merged to %s", merged_val)
if should_reverse:
merged_val = merged_val.reversed
return merged_val
@staticmethod
def _is_uninitialized(a):
return getattr(a._model_vsa, 'uninitialized', False)
| import logging
from typing import Iterable, Tuple, Any
from .. import MemoryMixin
l = logging.getLogger(name=__name__)
class AbstractMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int):
# if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
# should_reverse = True
# elif self.state.arch.memory_endness == 'Iend_LE':
# should_reverse = True
# else:
# should_reverse = False
values = list(values)
merged_val = values[0][0]
# if should_reverse: merged_val = merged_val.reversed
for tm, _ in values[1:]:
# if should_reverse: tm = tm.reversed
if self._is_uninitialized(tm):
continue
l.info("Merging %s %s...", merged_val, tm)
merged_val = merged_val.union(tm)
l.info("... Merged to %s", merged_val)
# if should_reverse:
# merged_val = merged_val.reversed
if not values[0][0].uninitialized and self.state.solver.backends.vsa.identical(merged_val, values[0][0]):
return None
return merged_val
@staticmethod
def _is_uninitialized(a):
return getattr(a._model_vsa, 'uninitialized', False)
| Remove reversing heuristics from merge_values for abstract memory. | Remove reversing heuristics from merge_values for abstract memory.
This is because SimMemoryObject handles endness now.
Also re-introduce the logic for dealing with uninit memory values.
| Python | bsd-2-clause | angr/angr,angr/angr,angr/angr | python | ## Code Before:
import logging
from typing import Iterable, Tuple, Any
from .. import MemoryMixin
l = logging.getLogger(name=__name__)
class AbstractMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int):
if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
should_reverse = True
elif self.state.arch.memory_endness == 'Iend_LE':
should_reverse = True
else:
should_reverse = False
values = list(values)
merged_val = values[0][0]
if should_reverse: merged_val = merged_val.reversed
for tm, _ in values[1:]:
if should_reverse: tm = tm.reversed
if self._is_uninitialized(tm):
continue
l.info("Merging %s %s...", merged_val, tm)
merged_val = merged_val.union(tm)
l.info("... Merged to %s", merged_val)
if should_reverse:
merged_val = merged_val.reversed
return merged_val
@staticmethod
def _is_uninitialized(a):
return getattr(a._model_vsa, 'uninitialized', False)
## Instruction:
Remove reversing heuristics from merge_values for abstract memory.
This is because SimMemoryObject handles endness now.
Also re-introduce the logic for dealing with uninit memory values.
## Code After:
import logging
from typing import Iterable, Tuple, Any
from .. import MemoryMixin
l = logging.getLogger(name=__name__)
class AbstractMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int):
# if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
# should_reverse = True
# elif self.state.arch.memory_endness == 'Iend_LE':
# should_reverse = True
# else:
# should_reverse = False
values = list(values)
merged_val = values[0][0]
# if should_reverse: merged_val = merged_val.reversed
for tm, _ in values[1:]:
# if should_reverse: tm = tm.reversed
if self._is_uninitialized(tm):
continue
l.info("Merging %s %s...", merged_val, tm)
merged_val = merged_val.union(tm)
l.info("... Merged to %s", merged_val)
# if should_reverse:
# merged_val = merged_val.reversed
if not values[0][0].uninitialized and self.state.solver.backends.vsa.identical(merged_val, values[0][0]):
return None
return merged_val
@staticmethod
def _is_uninitialized(a):
return getattr(a._model_vsa, 'uninitialized', False)
| import logging
from typing import Iterable, Tuple, Any
from .. import MemoryMixin
l = logging.getLogger(name=__name__)
class AbstractMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int):
- if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
+ # if self.category == 'reg' and self.state.arch.register_endness == 'Iend_LE':
? ++
- should_reverse = True
+ # should_reverse = True
? ++
- elif self.state.arch.memory_endness == 'Iend_LE':
+ # elif self.state.arch.memory_endness == 'Iend_LE':
? ++
- should_reverse = True
+ # should_reverse = True
? ++
- else:
+ # else:
? ++
- should_reverse = False
+ # should_reverse = False
? ++
values = list(values)
merged_val = values[0][0]
- if should_reverse: merged_val = merged_val.reversed
+ # if should_reverse: merged_val = merged_val.reversed
? ++
for tm, _ in values[1:]:
- if should_reverse: tm = tm.reversed
+ # if should_reverse: tm = tm.reversed
? ++
if self._is_uninitialized(tm):
continue
l.info("Merging %s %s...", merged_val, tm)
merged_val = merged_val.union(tm)
l.info("... Merged to %s", merged_val)
- if should_reverse:
+ # if should_reverse:
? ++
- merged_val = merged_val.reversed
+ # merged_val = merged_val.reversed
? ++
+
+ if not values[0][0].uninitialized and self.state.solver.backends.vsa.identical(merged_val, values[0][0]):
+ return None
return merged_val
@staticmethod
def _is_uninitialized(a):
return getattr(a._model_vsa, 'uninitialized', False) | 23 | 0.560976 | 13 | 10 |
76eaf117273f0741b8b10c31e72fa87edf7954e4 | index.js | index.js | var unicodeToChar = function(unicode) {
String.fromCharCode(unicode);
};
var getGlyphs = function(font) {
if (!font.glyphs || font.glyphs.length === 0) {
console.log('No glyphs found in this font.');
return;
}
var glyphs = font.glyphs.glyphs;
var table = []
, glyph;
for(glyphNo in glyphs) {
glyph = glyphs[glyphNo];
if (!glyph.unicode) {
continue;
}
table.push(glyph.unicode);
}
return table;
};
module.exports.unicodeToChar = unicodeToChar;
module.exports.getGlyphs = getGlyphs;
// List of the characters as text in a string:
// var glyphsList = getGlyphs(font).map(unicodeToChar).join('');
| var getCodepoints = function(font) {
if (!font.glyphs || font.glyphs.length === 0) {
console.log('No glyphs found in this font.');
return;
}
var glyphs = font.glyphs.glyphs;
var table = []
, glyph;
for(glyphNo in glyphs) {
glyph = glyphs[glyphNo];
if (!glyph.unicode) {
continue;
}
table.push(glyph.unicode);
}
return table;
};
module.exports.getCodepoints = getCodepoints;
// List of the characters as text in a string:
// var glyphsList = getCodepoints(font)
// .sort()
// .map(glyphHelper.codepointToChar)
// .join('');
| Move out helper funcitons to unicode helper module. Improve example. | Move out helper funcitons to unicode helper module.
Improve example.
| JavaScript | mit | strarsis/font-chars | javascript | ## Code Before:
var unicodeToChar = function(unicode) {
String.fromCharCode(unicode);
};
var getGlyphs = function(font) {
if (!font.glyphs || font.glyphs.length === 0) {
console.log('No glyphs found in this font.');
return;
}
var glyphs = font.glyphs.glyphs;
var table = []
, glyph;
for(glyphNo in glyphs) {
glyph = glyphs[glyphNo];
if (!glyph.unicode) {
continue;
}
table.push(glyph.unicode);
}
return table;
};
module.exports.unicodeToChar = unicodeToChar;
module.exports.getGlyphs = getGlyphs;
// List of the characters as text in a string:
// var glyphsList = getGlyphs(font).map(unicodeToChar).join('');
## Instruction:
Move out helper funcitons to unicode helper module.
Improve example.
## Code After:
var getCodepoints = function(font) {
if (!font.glyphs || font.glyphs.length === 0) {
console.log('No glyphs found in this font.');
return;
}
var glyphs = font.glyphs.glyphs;
var table = []
, glyph;
for(glyphNo in glyphs) {
glyph = glyphs[glyphNo];
if (!glyph.unicode) {
continue;
}
table.push(glyph.unicode);
}
return table;
};
module.exports.getCodepoints = getCodepoints;
// List of the characters as text in a string:
// var glyphsList = getCodepoints(font)
// .sort()
// .map(glyphHelper.codepointToChar)
// .join('');
| - var unicodeToChar = function(unicode) {
- String.fromCharCode(unicode);
- };
-
- var getGlyphs = function(font) {
? ^^^ ^
+ var getCodepoints = function(font) {
? ^^^^ ^^^^
if (!font.glyphs || font.glyphs.length === 0) {
console.log('No glyphs found in this font.');
return;
}
var glyphs = font.glyphs.glyphs;
var table = []
, glyph;
for(glyphNo in glyphs) {
glyph = glyphs[glyphNo];
if (!glyph.unicode) {
continue;
}
table.push(glyph.unicode);
}
return table;
};
+ module.exports.getCodepoints = getCodepoints;
-
- module.exports.unicodeToChar = unicodeToChar;
- module.exports.getGlyphs = getGlyphs;
// List of the characters as text in a string:
- // var glyphsList = getGlyphs(font).map(unicodeToChar).join('');
+ // var glyphsList = getCodepoints(font)
+ // .sort()
+ // .map(glyphHelper.codepointToChar)
+ // .join(''); | 15 | 0.454545 | 6 | 9 |
c987134ab7513d71df0c5a2ccc565e43f7d786b9 | spec/models/collection_spec.rb | spec/models/collection_spec.rb | require 'spec_helper'
describe Collection, :type => :model do
before do
@user = FactoryGirl.create(:user)
@collection = Collection.new(title: "test collection").tap do |c|
c.apply_depositor_metadata(@user.user_key)
end
end
it "should have open visibility" do
@collection.save
expect(@collection.read_groups).to eq ['public']
end
it "should not allow a collection to be saved without a title" do
@collection.title = nil
expect{ @collection.save! }.to raise_error(ActiveFedora::RecordInvalid)
end
describe "::bytes" do
subject { @collection.bytes }
context "with no items" do
before { @collection.save }
it { is_expected.to eq 0 }
end
context "with two 50 byte files" do
let(:bitstream) { double("content", size: "50")}
let(:file) { mock_model GenericFile, content: bitstream }
before { allow(@collection).to receive(:members).and_return([file, file]) }
it { is_expected.to eq 100 }
end
end
end
| require 'spec_helper'
describe Collection do
let(:user) { create(:user) }
let(:collection) do
Collection.new(title: "test collection") do |c|
c.apply_depositor_metadata(user)
end
end
it "has open visibility" do
collection.save
expect(collection.read_groups).to eq ['public']
end
it "validates title" do
collection.title = nil
expect(collection).not_to be_valid
end
describe "::bytes" do
subject { collection.bytes }
context "with no items" do
before { collection.save }
it { is_expected.to eq 0 }
end
context "with two 50 byte files" do
let(:bitstream) { double("content", size: "50")}
let(:file) { mock_model GenericFile, content: bitstream }
before { allow(collection).to receive(:members).and_return([file, file]) }
it { is_expected.to eq 100 }
end
end
end
| Refactor spec to use let and get rid of tap | Refactor spec to use let and get rid of tap
| Ruby | apache-2.0 | samvera/hyrax,samvera/hyrax,samvera/hyrax,samvera/hyrax | ruby | ## Code Before:
require 'spec_helper'
describe Collection, :type => :model do
before do
@user = FactoryGirl.create(:user)
@collection = Collection.new(title: "test collection").tap do |c|
c.apply_depositor_metadata(@user.user_key)
end
end
it "should have open visibility" do
@collection.save
expect(@collection.read_groups).to eq ['public']
end
it "should not allow a collection to be saved without a title" do
@collection.title = nil
expect{ @collection.save! }.to raise_error(ActiveFedora::RecordInvalid)
end
describe "::bytes" do
subject { @collection.bytes }
context "with no items" do
before { @collection.save }
it { is_expected.to eq 0 }
end
context "with two 50 byte files" do
let(:bitstream) { double("content", size: "50")}
let(:file) { mock_model GenericFile, content: bitstream }
before { allow(@collection).to receive(:members).and_return([file, file]) }
it { is_expected.to eq 100 }
end
end
end
## Instruction:
Refactor spec to use let and get rid of tap
## Code After:
require 'spec_helper'
describe Collection do
let(:user) { create(:user) }
let(:collection) do
Collection.new(title: "test collection") do |c|
c.apply_depositor_metadata(user)
end
end
it "has open visibility" do
collection.save
expect(collection.read_groups).to eq ['public']
end
it "validates title" do
collection.title = nil
expect(collection).not_to be_valid
end
describe "::bytes" do
subject { collection.bytes }
context "with no items" do
before { collection.save }
it { is_expected.to eq 0 }
end
context "with two 50 byte files" do
let(:bitstream) { double("content", size: "50")}
let(:file) { mock_model GenericFile, content: bitstream }
before { allow(collection).to receive(:members).and_return([file, file]) }
it { is_expected.to eq 100 }
end
end
end
| require 'spec_helper'
- describe Collection, :type => :model do
- before do
- @user = FactoryGirl.create(:user)
+ describe Collection do
+ let(:user) { create(:user) }
+ let(:collection) do
- @collection = Collection.new(title: "test collection").tap do |c|
? -------------- ----
+ Collection.new(title: "test collection") do |c|
- c.apply_depositor_metadata(@user.user_key)
? - ---------
+ c.apply_depositor_metadata(user)
end
end
- it "should have open visibility" do
? ------- ^^
+ it "has open visibility" do
? ^
- @collection.save
? -
+ collection.save
- expect(@collection.read_groups).to eq ['public']
? -
+ expect(collection.read_groups).to eq ['public']
end
- it "should not allow a collection to be saved without a title" do
+ it "validates title" do
- @collection.title = nil
? -
+ collection.title = nil
- expect{ @collection.save! }.to raise_error(ActiveFedora::RecordInvalid)
+ expect(collection).not_to be_valid
end
describe "::bytes" do
- subject { @collection.bytes }
? -
+ subject { collection.bytes }
+
context "with no items" do
- before { @collection.save }
? -
+ before { collection.save }
it { is_expected.to eq 0 }
end
context "with two 50 byte files" do
let(:bitstream) { double("content", size: "50")}
let(:file) { mock_model GenericFile, content: bitstream }
+
- before { allow(@collection).to receive(:members).and_return([file, file]) }
? -
+ before { allow(collection).to receive(:members).and_return([file, file]) }
+
it { is_expected.to eq 100 }
end
end
end | 31 | 0.861111 | 17 | 14 |
bd2c870aca44fa22caf38246f94704edae6a4b75 | tests/validation/tests/v3_api/resource/terraform/k3s/master/nginx-ingress.yaml | tests/validation/tests/v3_api/resource/terraform/k3s/master/nginx-ingress.yaml | apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: ingress-nginx
namespace: kube-system
spec:
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: ingress-nginx
version: v3.15.2
set:
valuesContent: |-
fullnameOverride: ingress-nginx
controller:
kind: DaemonSet
admissionWebhooks:
failurePolicy: Ignore
hostNetwork: true
hostPort:
enabled: true
publishService:
enabled: false
service:
enabled: false
metrics:
enabled: true
serviceMonitor:
enabled: true
config:
use-forwarded-headers: "true"
server-tokens: "false"
| apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: ingress-nginx
namespace: kube-system
spec:
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: ingress-nginx
version: v4.0.19
set:
valuesContent: |-
fullnameOverride: ingress-nginx
controller:
kind: DaemonSet
admissionWebhooks:
failurePolicy: Ignore
dnsPolicy: ClusterFirstWithHostNet
watchIngressWithoutClass: true
allowSnippetAnnotations: false
hostNetwork: true
hostPort:
enabled: true
publishService:
enabled: false
service:
enabled: false
metrics:
enabled: true
config:
use-forwarded-headers: "true"
server-tokens: "false"
| Update ingress-nginx chart version and include necessary values for k3s | Update ingress-nginx chart version and include necessary values for k3s
| YAML | apache-2.0 | rancher/rancher,rancher/rancher,rancher/rancher,rancher/rancher | yaml | ## Code Before:
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: ingress-nginx
namespace: kube-system
spec:
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: ingress-nginx
version: v3.15.2
set:
valuesContent: |-
fullnameOverride: ingress-nginx
controller:
kind: DaemonSet
admissionWebhooks:
failurePolicy: Ignore
hostNetwork: true
hostPort:
enabled: true
publishService:
enabled: false
service:
enabled: false
metrics:
enabled: true
serviceMonitor:
enabled: true
config:
use-forwarded-headers: "true"
server-tokens: "false"
## Instruction:
Update ingress-nginx chart version and include necessary values for k3s
## Code After:
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: ingress-nginx
namespace: kube-system
spec:
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: ingress-nginx
version: v4.0.19
set:
valuesContent: |-
fullnameOverride: ingress-nginx
controller:
kind: DaemonSet
admissionWebhooks:
failurePolicy: Ignore
dnsPolicy: ClusterFirstWithHostNet
watchIngressWithoutClass: true
allowSnippetAnnotations: false
hostNetwork: true
hostPort:
enabled: true
publishService:
enabled: false
service:
enabled: false
metrics:
enabled: true
config:
use-forwarded-headers: "true"
server-tokens: "false"
| apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: ingress-nginx
namespace: kube-system
spec:
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: ingress-nginx
- version: v3.15.2
? ^ ^^^
+ version: v4.0.19
? ^^^ ^
set:
valuesContent: |-
fullnameOverride: ingress-nginx
controller:
kind: DaemonSet
admissionWebhooks:
failurePolicy: Ignore
+ dnsPolicy: ClusterFirstWithHostNet
+ watchIngressWithoutClass: true
+ allowSnippetAnnotations: false
hostNetwork: true
hostPort:
enabled: true
publishService:
enabled: false
service:
enabled: false
metrics:
enabled: true
- serviceMonitor:
- enabled: true
config:
use-forwarded-headers: "true"
server-tokens: "false" | 7 | 0.194444 | 4 | 3 |
64df48b4d3bbca6be83fc89b2babb42dc13053ca | app/views/createWebsiteWelcomeEmail.scala.html | app/views/createWebsiteWelcomeEmail.scala.html | @(websiteAddress: String)
@import debiki.HtmlUtils.link
@import play.api.Play.current
<p>Your new Debiki site has been set up at:</p>
<p>@link("http://" + websiteAddress)</p>
<p>You can log in as administrator here:</p>
<p>@link("http://" + websiteAddress + routes.Application.viewAdminPage.url)</p>
<p>You can report problems here:</p>
<p>@link("http://www.debiki.com/forums/hosting/issues/?create-page")</p>
<p>I hope you will enjoy your new site!</p>
<p>Kind regards, Debiki<br>
http://debiki.com/
</p>
| @(websiteAddress: String)
@import debiki.HtmlUtils.link
@import play.api.Play.current
<p>Your new Debiki site has been set up at:</p>
<p>@link("http://" + websiteAddress)</p>
<p>You can log in as administrator here:</p>
<p>@link("http://" + websiteAddress + routes.Application.viewAdminPage.url)</p>
<p>You can report problems here:</p>
<p>@link("http://www.debiki.com/forums/hosting/issues/?create-page")</p>
<p><small>Advanced users: If you want to map a domain name to your website,
please reply to this email and tell me what domain name you
want to use. You will also need to point that domain name to
CNAME <kbd>debiki.net</kbd>. The current address will be redirected to
your new domain name.
</small></p>
<p>I hope you will enjoy your new site!</p>
<p>Kind regards, Debiki<br>
http://debiki.com/
</p>
| Add domain name mapping info to welcome email. | Add domain name mapping info to welcome email.
| HTML | agpl-3.0 | debiki/debiki-server-old,debiki/debiki-server-old,debiki/debiki-server-old,debiki/debiki-server-old | html | ## Code Before:
@(websiteAddress: String)
@import debiki.HtmlUtils.link
@import play.api.Play.current
<p>Your new Debiki site has been set up at:</p>
<p>@link("http://" + websiteAddress)</p>
<p>You can log in as administrator here:</p>
<p>@link("http://" + websiteAddress + routes.Application.viewAdminPage.url)</p>
<p>You can report problems here:</p>
<p>@link("http://www.debiki.com/forums/hosting/issues/?create-page")</p>
<p>I hope you will enjoy your new site!</p>
<p>Kind regards, Debiki<br>
http://debiki.com/
</p>
## Instruction:
Add domain name mapping info to welcome email.
## Code After:
@(websiteAddress: String)
@import debiki.HtmlUtils.link
@import play.api.Play.current
<p>Your new Debiki site has been set up at:</p>
<p>@link("http://" + websiteAddress)</p>
<p>You can log in as administrator here:</p>
<p>@link("http://" + websiteAddress + routes.Application.viewAdminPage.url)</p>
<p>You can report problems here:</p>
<p>@link("http://www.debiki.com/forums/hosting/issues/?create-page")</p>
<p><small>Advanced users: If you want to map a domain name to your website,
please reply to this email and tell me what domain name you
want to use. You will also need to point that domain name to
CNAME <kbd>debiki.net</kbd>. The current address will be redirected to
your new domain name.
</small></p>
<p>I hope you will enjoy your new site!</p>
<p>Kind regards, Debiki<br>
http://debiki.com/
</p>
| @(websiteAddress: String)
@import debiki.HtmlUtils.link
@import play.api.Play.current
<p>Your new Debiki site has been set up at:</p>
<p>@link("http://" + websiteAddress)</p>
<p>You can log in as administrator here:</p>
<p>@link("http://" + websiteAddress + routes.Application.viewAdminPage.url)</p>
<p>You can report problems here:</p>
<p>@link("http://www.debiki.com/forums/hosting/issues/?create-page")</p>
+ <p><small>Advanced users: If you want to map a domain name to your website,
+ please reply to this email and tell me what domain name you
+ want to use. You will also need to point that domain name to
+ CNAME <kbd>debiki.net</kbd>. The current address will be redirected to
+ your new domain name.
+ </small></p>
<p>I hope you will enjoy your new site!</p>
<p>Kind regards, Debiki<br>
http://debiki.com/
</p>
| 6 | 0.222222 | 6 | 0 |
c9bca43991c969e41d1d85fc853fd6f85173029d | src/circle/util/retry.clj | src/circle/util/retry.clj | (ns circle.util.retry
(:use [arohner.utils :only (inspect)])
(:use [circle.util.except :only (throw-if-not)])
(:use [robert.bruce :only (try-try-again)]))
(defn parse-args [args]
(if (map? (first args))
{:options (first args)
:f (second args)
:args (drop 2 args)}
{:f (first args)
:args (rest args)}))
(defn wait-for
"Like robert bruce, but waits for arbitrary results rather than just
exceptions.
Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options:
- success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy"
{:arglists
'([fn] [fn & args] [options fn] [options fn & args])}
[& args]
(let [{:keys [options f args] :as parsed-args} (parse-args args)
success (-> options :success-fn)]
(throw-if-not (-> parsed-args :f fn?) "couldn't find fn")
(let [f (fn []
(let [result (apply f args)]
(if success
(throw-if-not (success result) "(success) did not return truthy in time")
(throw-if-not result "f did not return truthy in time"))))]
(try-try-again options f)))) | (ns circle.util.retry
(:use [circle.util.except :only (throw-if-not)])
(:use [robert.bruce :only (try-try-again)]))
(defn parse-args [args]
(if (map? (first args))
{:options (first args)
:f (second args)
:args (drop 2 args)}
{:f (first args)
:args (rest args)}))
(defn wait-for
"Like robert bruce, but waits for arbitrary results rather than just
exceptions.
Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options:
- success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy"
{:arglists
'([fn] [fn & args] [options fn] [options fn & args])}
[& args]
(let [{:keys [options f args] :as parsed-args} (parse-args args)
success (-> options :success-fn)]
(throw-if-not (-> parsed-args :f fn?) "couldn't find fn")
(let [f (fn []
(let [result (apply f args)]
(if success
(throw-if-not (success result) "(success) did not return truthy in time")
(throw-if-not result "f did not return truthy in time"))
result))]
(try-try-again options f)))) | Return the result after waiting | Return the result after waiting
| Clojure | epl-1.0 | RayRutjes/frontend,circleci/frontend,prathamesh-sonpatki/frontend,circleci/frontend,circleci/frontend,prathamesh-sonpatki/frontend,RayRutjes/frontend | clojure | ## Code Before:
(ns circle.util.retry
(:use [arohner.utils :only (inspect)])
(:use [circle.util.except :only (throw-if-not)])
(:use [robert.bruce :only (try-try-again)]))
(defn parse-args [args]
(if (map? (first args))
{:options (first args)
:f (second args)
:args (drop 2 args)}
{:f (first args)
:args (rest args)}))
(defn wait-for
"Like robert bruce, but waits for arbitrary results rather than just
exceptions.
Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options:
- success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy"
{:arglists
'([fn] [fn & args] [options fn] [options fn & args])}
[& args]
(let [{:keys [options f args] :as parsed-args} (parse-args args)
success (-> options :success-fn)]
(throw-if-not (-> parsed-args :f fn?) "couldn't find fn")
(let [f (fn []
(let [result (apply f args)]
(if success
(throw-if-not (success result) "(success) did not return truthy in time")
(throw-if-not result "f did not return truthy in time"))))]
(try-try-again options f))))
## Instruction:
Return the result after waiting
## Code After:
(ns circle.util.retry
(:use [circle.util.except :only (throw-if-not)])
(:use [robert.bruce :only (try-try-again)]))
(defn parse-args [args]
(if (map? (first args))
{:options (first args)
:f (second args)
:args (drop 2 args)}
{:f (first args)
:args (rest args)}))
(defn wait-for
"Like robert bruce, but waits for arbitrary results rather than just
exceptions.
Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options:
- success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy"
{:arglists
'([fn] [fn & args] [options fn] [options fn & args])}
[& args]
(let [{:keys [options f args] :as parsed-args} (parse-args args)
success (-> options :success-fn)]
(throw-if-not (-> parsed-args :f fn?) "couldn't find fn")
(let [f (fn []
(let [result (apply f args)]
(if success
(throw-if-not (success result) "(success) did not return truthy in time")
(throw-if-not result "f did not return truthy in time"))
result))]
(try-try-again options f)))) | (ns circle.util.retry
- (:use [arohner.utils :only (inspect)])
(:use [circle.util.except :only (throw-if-not)])
(:use [robert.bruce :only (try-try-again)]))
(defn parse-args [args]
(if (map? (first args))
{:options (first args)
:f (second args)
:args (drop 2 args)}
{:f (first args)
:args (rest args)}))
(defn wait-for
"Like robert bruce, but waits for arbitrary results rather than just
exceptions.
Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options:
- success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy"
{:arglists
'([fn] [fn & args] [options fn] [options fn & args])}
[& args]
(let [{:keys [options f args] :as parsed-args} (parse-args args)
success (-> options :success-fn)]
(throw-if-not (-> parsed-args :f fn?) "couldn't find fn")
(let [f (fn []
(let [result (apply f args)]
(if success
(throw-if-not (success result) "(success) did not return truthy in time")
- (throw-if-not result "f did not return truthy in time"))))]
? ---
+ (throw-if-not result "f did not return truthy in time"))
+ result))]
(try-try-again options f)))) | 4 | 0.121212 | 2 | 2 |
d3b78d05d25290dffa002daf7021fa874a84adde | .travis.yml | .travis.yml | language: node_js
node_js:
- stable
- "4"
- "0.10"
script: npm run build
| language: node_js
node_js:
- stable
- "4"
- "0.10"
script: npm run build
notifications:
email:
on_failure: change
| Stop notifications for every failing build | Stop notifications for every failing build
| YAML | mit | absortium/frontend,chaintng/react-boilerplate,blockfs/frontend-react,JonathanMerklin/react-boilerplate,jasoncyu/always-be-bulking,shiftunion/bot-a-tron,codermango/BetCalculator,dbrelovsky/react-boilerplate,Proxiweb/react-boilerplate,bsr203/react-boilerplate,be-oi/beoi-training-client,Demonslyr/Donut.WFE.Customer,perry-ugroop/ugroop-react-dup2,gihrig/react-boilerplate,Dattaya/react-boilerplate-object,react-boilerplate/react-boilerplate,Dmitry-N-Medvedev/motor-collection,gihrig/react-boilerplate-logic,haxorbit/chiron,kossel/react-boilerplate,Jan-Jan/react-hackathon-boilerplate,StrikeForceZero/react-typescript-boilerplate,samit4me/react-boilerplate,s0enke/react-boilerplate,absortium/frontend,StrikeForceZero/react-typescript-boilerplate,Jan-Jan/react-hackathon-boilerplate,KarandikarMihir/react-boilerplate,shiftunion/bot-a-tron,ayozebarrera/react-boilerplate,chaintng/react-boilerplate,chexee/karaoke-night,gihrig/react-boilerplate-logic,kossel/react-boilerplate,haithemT/app-test,ipselon/react-boilerplate-clone,likesalmon/likesalmon-react-boilerplate,AnhHT/react-boilerplate,StrikeForceZero/react-typescript-boilerplate,pauleonardo/demo-trans,rlagman/raphthelagman,mmaedel/react-boilerplate,kaizen7-nz/gold-star-chart,Dattaya/react-boilerplate-object,romanvieito/ball-simpler,s0enke/react-boilerplate,kaizen7-nz/gold-star-chart,TheTopazWombat/levt-2,abasalilov/react-boilerplate,codermango/BetCalculator,blockfs/frontend-react,Dmitry-N-Medvedev/motor-collection,pauleonardo/demo-trans,samit4me/react-boilerplate,gtct/wallet.eine.com,KarandikarMihir/react-boilerplate,be-oi/beoi-training-client,mxstbr/react-boilerplate,jasoncyu/always-be-bulking,AnhHT/react-boilerplate,bsr203/react-boilerplate,gtct/wallet.eine.com,s0enke/react-boilerplate,Proxiweb/react-boilerplate,mxstbr/react-boilerplate,romanvieito/ball-simpler,w01fgang/react-boilerplate,gtct/wallet.eine.com,mikejong0815/Temp,mikejong0815/Temp,perry-ugroop/ugroop-react-dup2,gtct/wallet.eine.com,Dmitry-N-Medvedev/motor-collection,w01fgang/react-boilerplate,mmaedel/react-boilerplate,haxorbit/chiron,abasalilov/react-boilerplate,react-boilerplate/react-boilerplate,Demonslyr/Donut.WFE.Customer,JonathanMerklin/react-boilerplate,haithemT/app-test,Proxiweb/react-boilerplate,SilentCicero/react-boilerplate,gihrig/react-boilerplate,tomazy/react-boilerplate,tomazy/react-boilerplate,SilentCicero/react-boilerplate,Dmitry-N-Medvedev/motor-collection,dbrelovsky/react-boilerplate,TheTopazWombat/levt-2,ayozebarrera/react-boilerplate,rlagman/raphthelagman,likesalmon/likesalmon-react-boilerplate,ipselon/react-boilerplate-clone,chexee/karaoke-night | yaml | ## Code Before:
language: node_js
node_js:
- stable
- "4"
- "0.10"
script: npm run build
## Instruction:
Stop notifications for every failing build
## Code After:
language: node_js
node_js:
- stable
- "4"
- "0.10"
script: npm run build
notifications:
email:
on_failure: change
| language: node_js
node_js:
- stable
- "4"
- "0.10"
script: npm run build
+ notifications:
+ email:
+ on_failure: change | 3 | 0.5 | 3 | 0 |
d6a6ba8659b72f88de0df7649eaaa5eeb3bf0467 | src/index.js | src/index.js | //@flow
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Route } from "react-router";
import { ConnectedRouter as Router } from "react-router-redux";
import store, { history } from "./store";
import App from "./App";
declare var module: {
hot: {
accept(path: Class<React$Component<*, *, *>>, callback: () => void): void
}
};
const render = Component => {
return ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={Component} />
</Router>
</Provider>,
document.getElementById("root")
);
};
render(App);
if (module.hot) {
module.hot.accept(App, () => {
const NextApp = require("./App").default;
render(NextApp);
});
}
| //@flow
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Route } from "react-router";
import { ConnectedRouter } from "react-router-redux";
import store, { history } from "./store";
import App from "./App";
const render = (Component: any) => {
return ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<Route path="/" component={Component} />
</ConnectedRouter>
</Provider>,
document.getElementById("root")
);
};
render(App);
if (module.hot) {
module.hot.accept("./App", () => {
const NextApp = require("./App").default;
render(NextApp);
});
}
| Remove type declaration for module | Remove type declaration for module
| JavaScript | mit | slightly-askew/portfolio-2017,slightly-askew/portfolio-2017 | javascript | ## Code Before:
//@flow
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Route } from "react-router";
import { ConnectedRouter as Router } from "react-router-redux";
import store, { history } from "./store";
import App from "./App";
declare var module: {
hot: {
accept(path: Class<React$Component<*, *, *>>, callback: () => void): void
}
};
const render = Component => {
return ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={Component} />
</Router>
</Provider>,
document.getElementById("root")
);
};
render(App);
if (module.hot) {
module.hot.accept(App, () => {
const NextApp = require("./App").default;
render(NextApp);
});
}
## Instruction:
Remove type declaration for module
## Code After:
//@flow
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Route } from "react-router";
import { ConnectedRouter } from "react-router-redux";
import store, { history } from "./store";
import App from "./App";
const render = (Component: any) => {
return ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<Route path="/" component={Component} />
</ConnectedRouter>
</Provider>,
document.getElementById("root")
);
};
render(App);
if (module.hot) {
module.hot.accept("./App", () => {
const NextApp = require("./App").default;
render(NextApp);
});
}
| //@flow
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Route } from "react-router";
- import { ConnectedRouter as Router } from "react-router-redux";
? ----------
+ import { ConnectedRouter } from "react-router-redux";
-
import store, { history } from "./store";
import App from "./App";
- declare var module: {
- hot: {
- accept(path: Class<React$Component<*, *, *>>, callback: () => void): void
- }
- };
-
- const render = Component => {
+ const render = (Component: any) => {
? + ++++++
return ReactDOM.render(
<Provider store={store}>
- <Router history={history}>
+ <ConnectedRouter history={history}>
? +++++++++
<Route path="/" component={Component} />
- </Router>
+ </ConnectedRouter>
? +++++++++
</Provider>,
document.getElementById("root")
);
};
render(App);
if (module.hot) {
- module.hot.accept(App, () => {
+ module.hot.accept("./App", () => {
? +++ +
const NextApp = require("./App").default;
render(NextApp);
});
} | 17 | 0.459459 | 5 | 12 |
7de63f05cc8ca2a62f63ee71e4bed4f2d1a5576a | importer/src/main/resources/scripts/file-centric/file-centric-snapshot-mdrs-no-version-skew.sql | importer/src/main/resources/scripts/file-centric/file-centric-snapshot-mdrs-no-version-skew.sql | /********************************************************************************
file-centric-snapshot-mdrs-no-version-skew.sql
Assertion:
"Target modules in the MDRS must have the same version"
********************************************************************************/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
where a.active = '1' and b.active = '1'
and a.referencedcomponentid = b.referencedcomponentid and a.sourceeffectivetime = b.sourceeffectivetime
and a.targeteffectivetime != b.targeteffectivetime;
| /********************************************************************************
file-centric-snapshot-mdrs-no-version-skew.sql
Assertion:
"Target modules in the MDRS must have the same version"
********************************************************************************/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
where a.active = '1' and b.active = '1'
and a.referencedcomponentid = b.referencedcomponentid
and a.sourceeffectivetime = b.sourceeffectivetime
and a.targeteffectivetime != b.targeteffectivetime;
| Fix tabs in file as it causes fails in the execution | Fix tabs in file as it causes fails in the execution
| SQL | apache-2.0 | IHTSDO/release-validation-framework,IHTSDO/release-validation-framework,IHTSDO/release-validation-framework | sql | ## Code Before:
/********************************************************************************
file-centric-snapshot-mdrs-no-version-skew.sql
Assertion:
"Target modules in the MDRS must have the same version"
********************************************************************************/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
where a.active = '1' and b.active = '1'
and a.referencedcomponentid = b.referencedcomponentid and a.sourceeffectivetime = b.sourceeffectivetime
and a.targeteffectivetime != b.targeteffectivetime;
## Instruction:
Fix tabs in file as it causes fails in the execution
## Code After:
/********************************************************************************
file-centric-snapshot-mdrs-no-version-skew.sql
Assertion:
"Target modules in the MDRS must have the same version"
********************************************************************************/
insert into qa_result (runid, assertionuuid, concept_id, details)
select
<RUNID>,
'<ASSERTIONUUID>',
a.referencedcomponentid,
concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
where a.active = '1' and b.active = '1'
and a.referencedcomponentid = b.referencedcomponentid
and a.sourceeffectivetime = b.sourceeffectivetime
and a.targeteffectivetime != b.targeteffectivetime;
| /********************************************************************************
file-centric-snapshot-mdrs-no-version-skew.sql
Assertion:
"Target modules in the MDRS must have the same version"
********************************************************************************/
- insert into qa_result (runid, assertionuuid, concept_id, details)
+ insert into qa_result (runid, assertionuuid, concept_id, details)
? +
- select
+ select
? +
- <RUNID>,
? ^^
+ <RUNID>,
? ^^
- '<ASSERTIONUUID>',
? ^^
+ '<ASSERTIONUUID>',
? ^^
- a.referencedcomponentid,
? ^^
+ a.referencedcomponentid,
? ^^
- concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
? ^^
+ concat('Version skew in dependency on module: ', b.referencedcomponentid, ' - ', a.targeteffectivetime, ' and ', b.targeteffectivetime)
? ^^
- from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
+ from curr_moduledependencyrefset_s a, curr_moduledependencyrefset_s b
? +
- where a.active = '1' and b.active = '1'
+ where a.active = '1' and b.active = '1'
? +
- and a.referencedcomponentid = b.referencedcomponentid and a.sourceeffectivetime = b.sourceeffectivetime
+ and a.referencedcomponentid = b.referencedcomponentid
+ and a.sourceeffectivetime = b.sourceeffectivetime
- and a.targeteffectivetime != b.targeteffectivetime;
? ^^
+ and a.targeteffectivetime != b.targeteffectivetime;
? ^^
| 21 | 1.235294 | 11 | 10 |
da958f42db0508822af51ed8549a7849a5c11b16 | .travis.yml | .travis.yml |
dist: xenial
sudo: false
language: python
python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8-dev"
install: pip install 'tox-travis ~= 0.12.0'
script: tox
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
| dist: xenial
sudo: false
language: python
python:
- '3.4'
- '3.5'
- '3.6'
- '3.7'
- 3.8-dev
install: pip install 'tox-travis ~= 0.12.0'
script: tox
deploy:
provider: pypi
user: dmtucker
password:
secure: rvVuJw187OTFkNmJrEPK4U9mUX5nR+mqSPcEgqhIMW3XivIqkKdSvlFPq0imOrAT4TmxLGTvDFVT9TykOlTtp8LURmIyF+IhcvCaDaNC/TwN4vwqFPignlAeXK8R6quFfEzPE+Em1zqLsSWwzATxLKFpY9W8YnvrW5ygG/xOxeKl2O4yB3t4EmXIguT/hDMWkWAdHgGSp8Ves/U6nNhi5hb1yOVr6iORPeBK2BzxvxauIesN7GsQW2Yf5RIIrmk9EoclwpFJSWmmQBP2CozujFvC4zBJmAQ5JUbDQ99CSr8kxgMUvhr+Fx19mvqyps1WijCqV+AevHLU/usCko+YZkMlsz0cZYTRVHwU9JWyuLO9HEI4OlMVyf3qY4HQAoTv6AwofLFnYuZ/7Uf7KmvJ0USOjMJXhEkCGhaECw+e131s4cGQLNzbZCt14ICOrUT3uxwgFqYWvOdd+mMqnzcgIw7dYxSC9+JKINeVTryucmsqGVZ8eX0M6WqEf9iktHblrv2CftkYwOK9T0BVi1gLxW3r88+NwZt4l08fjvNa2RbeqMoWKBMmPywuKBwwFjb4vxz2VbaoQqdDdAXlOPVjZMsG8Z73XCquPu/QDJey/5K/iL48bjMRkOFZWzjTWFhG8DbdrEANfa9R25V/VWmpRLTG0lgK/84CdB0eyORbpbE=
distributions: sdist bdist_wheel
skip_existing: true
on:
repo: dbader/pytest-mypy
tags: true
python: '3.4'
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- "$HOME/.cache/pip"
| Configure automatic deployment to PyPI on tags | Configure automatic deployment to PyPI on tags
| YAML | mit | dbader/pytest-mypy | yaml | ## Code Before:
dist: xenial
sudo: false
language: python
python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8-dev"
install: pip install 'tox-travis ~= 0.12.0'
script: tox
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
## Instruction:
Configure automatic deployment to PyPI on tags
## Code After:
dist: xenial
sudo: false
language: python
python:
- '3.4'
- '3.5'
- '3.6'
- '3.7'
- 3.8-dev
install: pip install 'tox-travis ~= 0.12.0'
script: tox
deploy:
provider: pypi
user: dmtucker
password:
secure: rvVuJw187OTFkNmJrEPK4U9mUX5nR+mqSPcEgqhIMW3XivIqkKdSvlFPq0imOrAT4TmxLGTvDFVT9TykOlTtp8LURmIyF+IhcvCaDaNC/TwN4vwqFPignlAeXK8R6quFfEzPE+Em1zqLsSWwzATxLKFpY9W8YnvrW5ygG/xOxeKl2O4yB3t4EmXIguT/hDMWkWAdHgGSp8Ves/U6nNhi5hb1yOVr6iORPeBK2BzxvxauIesN7GsQW2Yf5RIIrmk9EoclwpFJSWmmQBP2CozujFvC4zBJmAQ5JUbDQ99CSr8kxgMUvhr+Fx19mvqyps1WijCqV+AevHLU/usCko+YZkMlsz0cZYTRVHwU9JWyuLO9HEI4OlMVyf3qY4HQAoTv6AwofLFnYuZ/7Uf7KmvJ0USOjMJXhEkCGhaECw+e131s4cGQLNzbZCt14ICOrUT3uxwgFqYWvOdd+mMqnzcgIw7dYxSC9+JKINeVTryucmsqGVZ8eX0M6WqEf9iktHblrv2CftkYwOK9T0BVi1gLxW3r88+NwZt4l08fjvNa2RbeqMoWKBMmPywuKBwwFjb4vxz2VbaoQqdDdAXlOPVjZMsG8Z73XCquPu/QDJey/5K/iL48bjMRkOFZWzjTWFhG8DbdrEANfa9R25V/VWmpRLTG0lgK/84CdB0eyORbpbE=
distributions: sdist bdist_wheel
skip_existing: true
on:
repo: dbader/pytest-mypy
tags: true
python: '3.4'
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- "$HOME/.cache/pip"
| -
dist: xenial
sudo: false
language: python
python:
- - "3.4"
- - "3.5"
- - "3.6"
- - "3.7"
+ - '3.4'
+ - '3.5'
+ - '3.6'
+ - '3.7'
- - "3.8-dev"
? -- - -
+ - 3.8-dev
-
install: pip install 'tox-travis ~= 0.12.0'
script: tox
-
+ deploy:
+ provider: pypi
+ user: dmtucker
+ password:
+ secure: rvVuJw187OTFkNmJrEPK4U9mUX5nR+mqSPcEgqhIMW3XivIqkKdSvlFPq0imOrAT4TmxLGTvDFVT9TykOlTtp8LURmIyF+IhcvCaDaNC/TwN4vwqFPignlAeXK8R6quFfEzPE+Em1zqLsSWwzATxLKFpY9W8YnvrW5ygG/xOxeKl2O4yB3t4EmXIguT/hDMWkWAdHgGSp8Ves/U6nNhi5hb1yOVr6iORPeBK2BzxvxauIesN7GsQW2Yf5RIIrmk9EoclwpFJSWmmQBP2CozujFvC4zBJmAQ5JUbDQ99CSr8kxgMUvhr+Fx19mvqyps1WijCqV+AevHLU/usCko+YZkMlsz0cZYTRVHwU9JWyuLO9HEI4OlMVyf3qY4HQAoTv6AwofLFnYuZ/7Uf7KmvJ0USOjMJXhEkCGhaECw+e131s4cGQLNzbZCt14ICOrUT3uxwgFqYWvOdd+mMqnzcgIw7dYxSC9+JKINeVTryucmsqGVZ8eX0M6WqEf9iktHblrv2CftkYwOK9T0BVi1gLxW3r88+NwZt4l08fjvNa2RbeqMoWKBMmPywuKBwwFjb4vxz2VbaoQqdDdAXlOPVjZMsG8Z73XCquPu/QDJey/5K/iL48bjMRkOFZWzjTWFhG8DbdrEANfa9R25V/VWmpRLTG0lgK/84CdB0eyORbpbE=
+ distributions: sdist bdist_wheel
+ skip_existing: true
+ on:
+ repo: dbader/pytest-mypy
+ tags: true
+ python: '3.4'
before_cache:
- - rm -rf $HOME/.cache/pip/log
? --
+ - rm -rf $HOME/.cache/pip/log
cache:
directories:
- - $HOME/.cache/pip
? --
+ - "$HOME/.cache/pip"
? + +
| 28 | 1.473684 | 18 | 10 |
9f6f10c0a2973682ba7e1bf3d83eac99346e6250 | lib/sinatra/jsonp.rb | lib/sinatra/jsonp.rb | require 'sinatra/base'
require 'multi_json'
module Sinatra
module Jsonp
def jsonp(*args)
if args.size > 0
data = MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
if args.size > 1
callback = args[1].to_s
else
['callback','jscallback','jsonp','jsoncallback'].each do |x|
callback = params.delete(x) unless callback
end
end
if callback
callback.tr!('^a-zA-Z0-9_$\.', '')
content_type :js
response = "#{callback}(#{data})"
else
response = data
end
response
end
end
alias JSONP jsonp
end
helpers Jsonp
end
| require 'sinatra/base'
require 'multi_json'
module Sinatra
module Jsonp
def jsonp(*args)
if args.size > 0
data = MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
if args.size > 1
callback = args[1].to_s
else
['callback','jscallback','jsonp','jsoncallback'].each do |x|
callback = params.delete(x) unless callback
end
end
if callback
callback.tr!('^a-zA-Z0-9_$\.', '')
content_type :js
response = "#{callback}(#{data})"
else
content_type :json
response = data
end
response
end
end
alias JSONP jsonp
end
helpers Jsonp
end
| Add missing "content_type :json" for pure JSON output | Add missing "content_type :json" for pure JSON output | Ruby | mit | shtirlic/sinatra-jsonp | ruby | ## Code Before:
require 'sinatra/base'
require 'multi_json'
module Sinatra
module Jsonp
def jsonp(*args)
if args.size > 0
data = MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
if args.size > 1
callback = args[1].to_s
else
['callback','jscallback','jsonp','jsoncallback'].each do |x|
callback = params.delete(x) unless callback
end
end
if callback
callback.tr!('^a-zA-Z0-9_$\.', '')
content_type :js
response = "#{callback}(#{data})"
else
response = data
end
response
end
end
alias JSONP jsonp
end
helpers Jsonp
end
## Instruction:
Add missing "content_type :json" for pure JSON output
## Code After:
require 'sinatra/base'
require 'multi_json'
module Sinatra
module Jsonp
def jsonp(*args)
if args.size > 0
data = MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
if args.size > 1
callback = args[1].to_s
else
['callback','jscallback','jsonp','jsoncallback'].each do |x|
callback = params.delete(x) unless callback
end
end
if callback
callback.tr!('^a-zA-Z0-9_$\.', '')
content_type :js
response = "#{callback}(#{data})"
else
content_type :json
response = data
end
response
end
end
alias JSONP jsonp
end
helpers Jsonp
end
| require 'sinatra/base'
require 'multi_json'
module Sinatra
module Jsonp
def jsonp(*args)
if args.size > 0
data = MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
if args.size > 1
callback = args[1].to_s
else
['callback','jscallback','jsonp','jsoncallback'].each do |x|
callback = params.delete(x) unless callback
end
end
if callback
callback.tr!('^a-zA-Z0-9_$\.', '')
content_type :js
response = "#{callback}(#{data})"
else
+ content_type :json
response = data
end
response
end
end
alias JSONP jsonp
end
helpers Jsonp
end | 1 | 0.034483 | 1 | 0 |
decf9d7821e472b0ce32f0bc0801c3d1ec9122b6 | app/views/layouts/_show_environment.erb | app/views/layouts/_show_environment.erb | <% if !Rails.env.production? || Rails.application.secrets.deploy_env != "production" -%>
<div class="aj-env-banner no-print"><%= Rails.application.secrets.deploy_env.present? ? Rails.application.secrets.deploy_env.upcase : Rails.env.upcase %></div>
<% end -%>
| <% env = Rails.application.secrets.deploy_env -%>
<% if env.present? -%>
<div class="aj-env-banner no-print"><%= env.upcase %></div>
<% end -%>
| Update banner to show based on if there is a value from the secrets | Update banner to show based on if there is a value from the secrets | HTML+ERB | mit | atomicjolt/adhesion,atomicjolt/adhesion,atomicjolt/adhesion,atomicjolt/adhesion | html+erb | ## Code Before:
<% if !Rails.env.production? || Rails.application.secrets.deploy_env != "production" -%>
<div class="aj-env-banner no-print"><%= Rails.application.secrets.deploy_env.present? ? Rails.application.secrets.deploy_env.upcase : Rails.env.upcase %></div>
<% end -%>
## Instruction:
Update banner to show based on if there is a value from the secrets
## Code After:
<% env = Rails.application.secrets.deploy_env -%>
<% if env.present? -%>
<div class="aj-env-banner no-print"><%= env.upcase %></div>
<% end -%>
| - <% if !Rails.env.production? || Rails.application.secrets.deploy_env != "production" -%>
- <div class="aj-env-banner no-print"><%= Rails.application.secrets.deploy_env.present? ? Rails.application.secrets.deploy_env.upcase : Rails.env.upcase %></div>
+ <% env = Rails.application.secrets.deploy_env -%>
+ <% if env.present? -%>
+ <div class="aj-env-banner no-print"><%= env.upcase %></div>
<% end -%> | 5 | 1.666667 | 3 | 2 |
f7ee9ea60df1b6244d7c35fa994ee0e0d0fb87a0 | app/assets/stylesheets/vars/_colours.scss | app/assets/stylesheets/vars/_colours.scss | $greyLightest: #f3f3f3;
$greyLighter: #ececec;
$greyLight: #d1d1d1;
$grey: #ccc;
$greyDarker: #999999;
$greyDusk: #676767;
$greyMidnight: #363636;
$greyDarkest: #303030;
$white: #fff;
$blue: #99c7d8;
$green: #7db191;
$orange: #ff9900;
$error: #e26b6b;
$custom-primary: #00cdff;
$custom-secondary: #00669f;
$custom-header: #046494;
| $greyLightest: #f3f3f3;
$greyLighter: #ececec;
$greyLight: #d1d1d1;
$grey: #ccc;
$greyDark: #bcbcbc;
$greyDarker: #999999;
$greyDarkerer: #878787;
$greyDusk: #676767;
$greyMidnight: #363636;
$greyDarkest: #303030;
$white: #fff;
$blue: #99c7d8;
$green: #7db191;
$orange: #cc6600;
$yellow: #ff9900;
$error: #e26b6b;
$custom-primary: #00cdff;
$custom-secondary: #00669f;
$custom-header: #046494;
| Add two more greys and a yellow | Add two more greys and a yellow | SCSS | mit | madetech/ydtd-frontend,madetech/ydtd-frontend | scss | ## Code Before:
$greyLightest: #f3f3f3;
$greyLighter: #ececec;
$greyLight: #d1d1d1;
$grey: #ccc;
$greyDarker: #999999;
$greyDusk: #676767;
$greyMidnight: #363636;
$greyDarkest: #303030;
$white: #fff;
$blue: #99c7d8;
$green: #7db191;
$orange: #ff9900;
$error: #e26b6b;
$custom-primary: #00cdff;
$custom-secondary: #00669f;
$custom-header: #046494;
## Instruction:
Add two more greys and a yellow
## Code After:
$greyLightest: #f3f3f3;
$greyLighter: #ececec;
$greyLight: #d1d1d1;
$grey: #ccc;
$greyDark: #bcbcbc;
$greyDarker: #999999;
$greyDarkerer: #878787;
$greyDusk: #676767;
$greyMidnight: #363636;
$greyDarkest: #303030;
$white: #fff;
$blue: #99c7d8;
$green: #7db191;
$orange: #cc6600;
$yellow: #ff9900;
$error: #e26b6b;
$custom-primary: #00cdff;
$custom-secondary: #00669f;
$custom-header: #046494;
| $greyLightest: #f3f3f3;
$greyLighter: #ececec;
$greyLight: #d1d1d1;
$grey: #ccc;
+ $greyDark: #bcbcbc;
$greyDarker: #999999;
+ $greyDarkerer: #878787;
$greyDusk: #676767;
$greyMidnight: #363636;
$greyDarkest: #303030;
$white: #fff;
$blue: #99c7d8;
$green: #7db191;
- $orange: #ff9900;
? ^^^^
+ $orange: #cc6600;
? ^^^^
+ $yellow: #ff9900;
$error: #e26b6b;
$custom-primary: #00cdff;
$custom-secondary: #00669f;
$custom-header: #046494; | 5 | 0.25 | 4 | 1 |
a9e158428a748a8e0fb9aa98e14c05ba5caa9cad | app/Http/Controllers/SettingController.php | app/Http/Controllers/SettingController.php | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SettingController extends Controller
{
/**
* @return \Illuminate\Http\Response
*/
public function edit()
{
return view('setting.edit');
}
/**
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
'start_at' => 'required|date',
'end_at' => 'required|date',
'target' => 'required|integer|min:0',
]);
\Setting::set('start_at', $request->get('start_at'));
\Setting::set('end_at', $request->get('end_at'));
\Setting::set('target', $request->get('target'));
\Setting::save();
return redirect()->route('setting.edit')->with('global', '設定已更新');
}
}
| <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SettingController extends Controller
{
/**
* @return \Illuminate\Http\Response
*/
public function edit()
{
return view('setting.edit');
}
/**
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
'start_at' => 'required|date|before:end_at',
'end_at' => 'required|date|after:start_at',
'target' => 'required|integer|min:0',
]);
\Setting::set('start_at', $request->get('start_at'));
\Setting::set('end_at', $request->get('end_at'));
\Setting::set('target', $request->get('target'));
\Setting::save();
return redirect()->route('setting.edit')->with('global', '設定已更新');
}
}
| Add missing checking rules of activity time | Add missing checking rules of activity time
| PHP | mit | HackerSir/CheckIn2017,HackerSir/CheckIn2017,HackerSir/CheckIn,HackerSir/CheckIn2017,HackerSir/CheckIn | php | ## Code Before:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SettingController extends Controller
{
/**
* @return \Illuminate\Http\Response
*/
public function edit()
{
return view('setting.edit');
}
/**
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
'start_at' => 'required|date',
'end_at' => 'required|date',
'target' => 'required|integer|min:0',
]);
\Setting::set('start_at', $request->get('start_at'));
\Setting::set('end_at', $request->get('end_at'));
\Setting::set('target', $request->get('target'));
\Setting::save();
return redirect()->route('setting.edit')->with('global', '設定已更新');
}
}
## Instruction:
Add missing checking rules of activity time
## Code After:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SettingController extends Controller
{
/**
* @return \Illuminate\Http\Response
*/
public function edit()
{
return view('setting.edit');
}
/**
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
'start_at' => 'required|date|before:end_at',
'end_at' => 'required|date|after:start_at',
'target' => 'required|integer|min:0',
]);
\Setting::set('start_at', $request->get('start_at'));
\Setting::set('end_at', $request->get('end_at'));
\Setting::set('target', $request->get('target'));
\Setting::save();
return redirect()->route('setting.edit')->with('global', '設定已更新');
}
}
| <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SettingController extends Controller
{
/**
* @return \Illuminate\Http\Response
*/
public function edit()
{
return view('setting.edit');
}
/**
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function update(Request $request)
{
$this->validate($request, [
- 'start_at' => 'required|date',
+ 'start_at' => 'required|date|before:end_at',
? ++++++++++++++
- 'end_at' => 'required|date',
+ 'end_at' => 'required|date|after:start_at',
? +++++++++++++++
'target' => 'required|integer|min:0',
]);
\Setting::set('start_at', $request->get('start_at'));
\Setting::set('end_at', $request->get('end_at'));
\Setting::set('target', $request->get('target'));
\Setting::save();
return redirect()->route('setting.edit')->with('global', '設定已更新');
}
} | 4 | 0.108108 | 2 | 2 |
7e72c4eff34e0798039146f147e1331fd8cef659 | tests/generate_api_output_examples.sh | tests/generate_api_output_examples.sh |
http GET localhost:3000/connector
http -a lucho:verYseCure GET localhost:3000/connector
http -a lucho:verYseCure GET localhost:3000/connector/version
http -a lucho:verYseCure GET localhost:3000/connector/files
http -a lucho:verYseCure GET localhost:3000/connector/files/file1
http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory
http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
|
http --verbose --pretty=format GET localhost:3000/connector
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/version
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/file1
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
echo -e '\n'
| Make httpie output redirectable to a file | Make httpie output redirectable to a file
| Shell | agpl-3.0 | Bluefinch/glarkconnector,Bluefinch/glarkconnector | shell | ## Code Before:
http GET localhost:3000/connector
http -a lucho:verYseCure GET localhost:3000/connector
http -a lucho:verYseCure GET localhost:3000/connector/version
http -a lucho:verYseCure GET localhost:3000/connector/files
http -a lucho:verYseCure GET localhost:3000/connector/files/file1
http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory
http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
## Instruction:
Make httpie output redirectable to a file
## Code After:
http --verbose --pretty=format GET localhost:3000/connector
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/version
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/file1
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory
echo -e '\n'
http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
echo -e '\n'
|
- http GET localhost:3000/connector
+ http --verbose --pretty=format GET localhost:3000/connector
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector/version
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/version
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector/files
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector/files/file1
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/file1
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n'
- http -a lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
+ http --verbose --pretty=format --auth lucho:verYseCure GET localhost:3000/connector/files/subdirectory/file1
? ++++++++++++++++++++++ ++++++++
+ echo -e '\n' | 21 | 2.333333 | 14 | 7 |
be3365d9dfc257a1029bbfab055113ce3c1ae4d6 | appveyor.yml | appveyor.yml | version: "{build}"
environment:
nodejs_version: "4.7.2"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
build_script:
- gulp --require coffee-script/register build
build: on | version: "{build}"
environment:
nodejs_version: "4.7.2"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
- npm install gulp -g
build_script:
- gulp --require coffee-script/register build
build: on | Install Gulp global to Appveyor | Install Gulp global to Appveyor
| YAML | mit | drobyshev/drobyshev.github.io | yaml | ## Code Before:
version: "{build}"
environment:
nodejs_version: "4.7.2"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
build_script:
- gulp --require coffee-script/register build
build: on
## Instruction:
Install Gulp global to Appveyor
## Code After:
version: "{build}"
environment:
nodejs_version: "4.7.2"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
- npm install gulp -g
build_script:
- gulp --require coffee-script/register build
build: on | version: "{build}"
environment:
nodejs_version: "4.7.2"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
+ - npm install gulp -g
build_script:
- gulp --require coffee-script/register build
build: on | 1 | 0.076923 | 1 | 0 |
d2efcbca07c428a6c5706825801e64d9fd96fdaa | content/integrations/ceph.md | content/integrations/ceph.md | ---
title: Datadog-Ceph Integration
integration_title: Ceph
kind: integration
git_integration_title: ceph
newhlevel: true
---
# Overview
Enable the Datadog-Ceph integration to:
* Track disk usage across storage pools
* Receive service checks in case of issues
* Monitor I/O performance metrics
# Installation
The integration is meant to be enabled on each Ceph monitor host.
# Configuration
Adjust the configuration file to match your environment. By default the check will use `/usr/bin/ceph` to retrieve metrics; this can be overriden by using the `ceph_cmd` option. If sudo access is required to run it, please enable the use_sudo flag.
Any extra tags specific to the cluster can be specified under `tags`, as usual.
<%= insert_example_links%>
# Validation
Execute the info command `/etc/init.d/datadog-agent info` and verify that the integration check was successful. The output should contain a section similar to the following:
Checks
======
[...]
ceph
----
- instance #0 [OK]
- Collected 19 metrics, 0 events & 2 service checks
| ---
title: Datadog-Ceph Integration
integration_title: Ceph
kind: integration
git_integration_title: ceph
newhlevel: true
---
# Overview
Enable the Datadog-Ceph integration to:
* Track disk usage across storage pools
* Receive service checks in case of issues
* Monitor I/O performance metrics
# Installation
The integration is meant to be enabled on each Ceph monitor host.
# Configuration
Adjust the configuration file to match your environment. By default the check will use `/usr/bin/ceph` to retrieve metrics; this can be overriden by using the `ceph_cmd` option. If sudo access is required to run it, please enable the use_sudo flag.
Any extra tags specific to the cluster can be specified under `tags`, as usual.
<%= insert_example_links%>
# Validation
Execute the info command `/etc/init.d/datadog-agent info` and verify that the integration check was successful. The output should contain a section similar to the following:
Checks
======
[...]
ceph
----
- instance #0 [OK]
- Collected 19 metrics, 0 events & 2 service checks
# Metrics
<%= get_metrics_from_git() %>
| Update Ceph Documentation page with metrics list | Update Ceph Documentation page with metrics list | Markdown | bsd-3-clause | jhotta/documentation,jhotta/documentation,jhotta/documentation,jhotta/documentation,jhotta/documentation,jhotta/documentation | markdown | ## Code Before:
---
title: Datadog-Ceph Integration
integration_title: Ceph
kind: integration
git_integration_title: ceph
newhlevel: true
---
# Overview
Enable the Datadog-Ceph integration to:
* Track disk usage across storage pools
* Receive service checks in case of issues
* Monitor I/O performance metrics
# Installation
The integration is meant to be enabled on each Ceph monitor host.
# Configuration
Adjust the configuration file to match your environment. By default the check will use `/usr/bin/ceph` to retrieve metrics; this can be overriden by using the `ceph_cmd` option. If sudo access is required to run it, please enable the use_sudo flag.
Any extra tags specific to the cluster can be specified under `tags`, as usual.
<%= insert_example_links%>
# Validation
Execute the info command `/etc/init.d/datadog-agent info` and verify that the integration check was successful. The output should contain a section similar to the following:
Checks
======
[...]
ceph
----
- instance #0 [OK]
- Collected 19 metrics, 0 events & 2 service checks
## Instruction:
Update Ceph Documentation page with metrics list
## Code After:
---
title: Datadog-Ceph Integration
integration_title: Ceph
kind: integration
git_integration_title: ceph
newhlevel: true
---
# Overview
Enable the Datadog-Ceph integration to:
* Track disk usage across storage pools
* Receive service checks in case of issues
* Monitor I/O performance metrics
# Installation
The integration is meant to be enabled on each Ceph monitor host.
# Configuration
Adjust the configuration file to match your environment. By default the check will use `/usr/bin/ceph` to retrieve metrics; this can be overriden by using the `ceph_cmd` option. If sudo access is required to run it, please enable the use_sudo flag.
Any extra tags specific to the cluster can be specified under `tags`, as usual.
<%= insert_example_links%>
# Validation
Execute the info command `/etc/init.d/datadog-agent info` and verify that the integration check was successful. The output should contain a section similar to the following:
Checks
======
[...]
ceph
----
- instance #0 [OK]
- Collected 19 metrics, 0 events & 2 service checks
# Metrics
<%= get_metrics_from_git() %>
| ---
title: Datadog-Ceph Integration
integration_title: Ceph
kind: integration
git_integration_title: ceph
newhlevel: true
---
# Overview
Enable the Datadog-Ceph integration to:
* Track disk usage across storage pools
* Receive service checks in case of issues
* Monitor I/O performance metrics
# Installation
The integration is meant to be enabled on each Ceph monitor host.
# Configuration
Adjust the configuration file to match your environment. By default the check will use `/usr/bin/ceph` to retrieve metrics; this can be overriden by using the `ceph_cmd` option. If sudo access is required to run it, please enable the use_sudo flag.
Any extra tags specific to the cluster can be specified under `tags`, as usual.
<%= insert_example_links%>
# Validation
Execute the info command `/etc/init.d/datadog-agent info` and verify that the integration check was successful. The output should contain a section similar to the following:
Checks
======
[...]
ceph
----
- instance #0 [OK]
- Collected 19 metrics, 0 events & 2 service checks
+ # Metrics
+
+ <%= get_metrics_from_git() %> | 3 | 0.069767 | 3 | 0 |
85c2db0a8baaea99b682f6f741f159b4b39ce681 | README.rst | README.rst | GSO : Googling Stack Overflow
=============================
This app used to exist as a working plugin for sublime text.
That code exists on the `/sublime-text` branch. The library which
was used for googling things was deprecated, and I switched
to using vim. Therefore I am rewriting this as a vim plugin to use
a different plugin.
*This plugin is not currently working, but when it does, it will be*
**awesome**. Help is very welcome.
Checkout the latest development in the `/dev` branch.
Description
-----------
Much of the time you spend coding is Googling things,
and dumping other's code into your editor.
Wouldn't it be great if you could have that process
integrated into your environment? Or even done automatically for you?
This is the goal of GSO.
Original Devpost project at MHacks 6 (Sept, 2015) [link_]
---------------------------------------------------------
.. _link: http://devpost.com/software/stack-of-py
(Didn't win anything, though!)
Similar Projects
----------------
- StackAnswers.vim - https://github.com/james9909/stackanswers.vim
- Almost exactly what I want, but it doesn't paste answers automatically,
and I can't seem to get it working on Mac.
| GSO : Googling Stack Overflow
=============================
This app used to exist as a working plugin for sublime text.
That code exists on the `/sublime-text` branch. The library which
was used for googling things was deprecated, and I switched
to using vim. Therefore I am rewriting this as a vim plugin to use
a different plugin.
*This plugin is not currently working, but when it does, it will be*
**awesome**. I plan to use it quite frequently, so that should
force me to maintain it and make it better.
Help is very welcome.
Checkout the latest development in the `/dev` branch.
Description
-----------
Much of the time you spend coding is Googling things,
and dumping other's code into your editor.
Wouldn't it be great if you could have that process
integrated into your environment? Or even done automatically for you?
This is the goal of GSO.
Original Devpost project at MHacks 6 (Sept, 2015) [link_]
---------------------------------------------------------
.. _link: http://devpost.com/software/stack-of-py
(Didn't win anything, though!)
Similar Projects
----------------
- StackAnswers.vim - https://github.com/james9909/stackanswers.vim
- Almost exactly what I want, but it doesn't paste answers automatically,
and I can't seem to get it working on Mac.
| Add more text to readme | Add more text to readme
| reStructuredText | mit | mdtmc/gso | restructuredtext | ## Code Before:
GSO : Googling Stack Overflow
=============================
This app used to exist as a working plugin for sublime text.
That code exists on the `/sublime-text` branch. The library which
was used for googling things was deprecated, and I switched
to using vim. Therefore I am rewriting this as a vim plugin to use
a different plugin.
*This plugin is not currently working, but when it does, it will be*
**awesome**. Help is very welcome.
Checkout the latest development in the `/dev` branch.
Description
-----------
Much of the time you spend coding is Googling things,
and dumping other's code into your editor.
Wouldn't it be great if you could have that process
integrated into your environment? Or even done automatically for you?
This is the goal of GSO.
Original Devpost project at MHacks 6 (Sept, 2015) [link_]
---------------------------------------------------------
.. _link: http://devpost.com/software/stack-of-py
(Didn't win anything, though!)
Similar Projects
----------------
- StackAnswers.vim - https://github.com/james9909/stackanswers.vim
- Almost exactly what I want, but it doesn't paste answers automatically,
and I can't seem to get it working on Mac.
## Instruction:
Add more text to readme
## Code After:
GSO : Googling Stack Overflow
=============================
This app used to exist as a working plugin for sublime text.
That code exists on the `/sublime-text` branch. The library which
was used for googling things was deprecated, and I switched
to using vim. Therefore I am rewriting this as a vim plugin to use
a different plugin.
*This plugin is not currently working, but when it does, it will be*
**awesome**. I plan to use it quite frequently, so that should
force me to maintain it and make it better.
Help is very welcome.
Checkout the latest development in the `/dev` branch.
Description
-----------
Much of the time you spend coding is Googling things,
and dumping other's code into your editor.
Wouldn't it be great if you could have that process
integrated into your environment? Or even done automatically for you?
This is the goal of GSO.
Original Devpost project at MHacks 6 (Sept, 2015) [link_]
---------------------------------------------------------
.. _link: http://devpost.com/software/stack-of-py
(Didn't win anything, though!)
Similar Projects
----------------
- StackAnswers.vim - https://github.com/james9909/stackanswers.vim
- Almost exactly what I want, but it doesn't paste answers automatically,
and I can't seem to get it working on Mac.
| GSO : Googling Stack Overflow
=============================
This app used to exist as a working plugin for sublime text.
That code exists on the `/sublime-text` branch. The library which
was used for googling things was deprecated, and I switched
to using vim. Therefore I am rewriting this as a vim plugin to use
a different plugin.
*This plugin is not currently working, but when it does, it will be*
+ **awesome**. I plan to use it quite frequently, so that should
+ force me to maintain it and make it better.
- **awesome**. Help is very welcome.
? -------------
+ Help is very welcome.
Checkout the latest development in the `/dev` branch.
Description
-----------
Much of the time you spend coding is Googling things,
and dumping other's code into your editor.
Wouldn't it be great if you could have that process
integrated into your environment? Or even done automatically for you?
This is the goal of GSO.
Original Devpost project at MHacks 6 (Sept, 2015) [link_]
---------------------------------------------------------
.. _link: http://devpost.com/software/stack-of-py
(Didn't win anything, though!)
Similar Projects
----------------
- StackAnswers.vim - https://github.com/james9909/stackanswers.vim
- Almost exactly what I want, but it doesn't paste answers automatically,
and I can't seem to get it working on Mac. | 4 | 0.105263 | 3 | 1 |
10dd7ad3879fe7c88c666a77d355a67d4ceb7a34 | app/views/recipes/_recipes.html.erb | app/views/recipes/_recipes.html.erb | <%= render partial: "recipes/recipe_options" if user_signed_in? %>
<table>
<% recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= image_tag(recipe.photo_path, size: "190x100", alt: "#{recipe.name} photo", title: 'recipe photo' ) %></td>
<td><%= link_to image_tag("delete-icon.png", size:"16", title: "Delete recipe"), recipe_path(recipe), method: :delete, data: {confirm: "Are you sure!"} if policy(recipe).destroy? %></td>
<td><table>
<tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
<tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
</table></td>
<td><%= render partial: "recipes/favorite", locals: {recipe: recipe} %></td>
</tr>
<% end %>
</table>
| <%= render partial: "recipes/recipe_options" if user_signed_in? %>
<table>
<% recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= image_tag(recipe.photo_path, size: "190x100", alt: "#{recipe.name} photo", title: 'recipe photo' ) %></td>
<td><%= link_to image_tag("delete-icon.png", size:"16", title: "Delete recipe"), recipe_path(recipe), method: :delete, data: {confirm: "Are you sure!"} if policy(recipe).destroy? %></td>
<td>
<table>
<tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
<tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
</table>
</td>
</tr>
<% end %>
</table>
| Remove Favorite checkbox from index page. | Remove Favorite checkbox from index page.
| HTML+ERB | mit | jcpny1/recipe-cat,jcpny1/recipe-cat,jcpny1/recipe-cat,jcpny1/recipe-cat | html+erb | ## Code Before:
<%= render partial: "recipes/recipe_options" if user_signed_in? %>
<table>
<% recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= image_tag(recipe.photo_path, size: "190x100", alt: "#{recipe.name} photo", title: 'recipe photo' ) %></td>
<td><%= link_to image_tag("delete-icon.png", size:"16", title: "Delete recipe"), recipe_path(recipe), method: :delete, data: {confirm: "Are you sure!"} if policy(recipe).destroy? %></td>
<td><table>
<tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
<tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
</table></td>
<td><%= render partial: "recipes/favorite", locals: {recipe: recipe} %></td>
</tr>
<% end %>
</table>
## Instruction:
Remove Favorite checkbox from index page.
## Code After:
<%= render partial: "recipes/recipe_options" if user_signed_in? %>
<table>
<% recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= image_tag(recipe.photo_path, size: "190x100", alt: "#{recipe.name} photo", title: 'recipe photo' ) %></td>
<td><%= link_to image_tag("delete-icon.png", size:"16", title: "Delete recipe"), recipe_path(recipe), method: :delete, data: {confirm: "Are you sure!"} if policy(recipe).destroy? %></td>
<td>
<table>
<tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
<tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
</table>
</td>
</tr>
<% end %>
</table>
| <%= render partial: "recipes/recipe_options" if user_signed_in? %>
<table>
<% recipes.each do |recipe| %>
<tr>
<td><%= link_to recipe.name, recipe %></td>
<td><%= image_tag(recipe.photo_path, size: "190x100", alt: "#{recipe.name} photo", title: 'recipe photo' ) %></td>
<td><%= link_to image_tag("delete-icon.png", size:"16", title: "Delete recipe"), recipe_path(recipe), method: :delete, data: {confirm: "Are you sure!"} if policy(recipe).destroy? %></td>
+ <td>
- <td><table>
? ----
+ <table>
? ++
- <tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
+ <tr><td><%= render partial: "recipes/review_stars", locals: {stars: recipe.average_stars, url: recipe_recipe_reviews_path(recipe)} %></td></tr>
? ++
- <tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
+ <tr><td><%= link_to pluralize(recipe.number_of_reviews, 'review'), recipe_recipe_reviews_path(recipe) %></td></tr>
? ++
- </table></td>
? -----
+ </table>
? ++
- <td><%= render partial: "recipes/favorite", locals: {recipe: recipe} %></td>
+ </td>
</tr>
<% end %>
</table> | 11 | 0.6875 | 6 | 5 |
0055c11820fceb9673531ecbd2a869a0149ba904 | modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/MembershipEntityImpl.java | modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/MembershipEntityImpl.java | /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.persistence.entity;
import java.io.Serializable;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class MembershipEntityImpl extends AbstractEntityNoRevision implements MembershipEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
protected String groupId;
public MembershipEntityImpl() {
}
public Object getPersistentState() {
// membership is not updatable
return MembershipEntityImpl.class;
}
public String getId() {
// membership doesn't have an id
return null;
}
public void setId(String id) {
// membership doesn't have an id
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
}
| /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.persistence.entity;
import java.io.Serializable;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class MembershipEntityImpl extends AbstractEntityNoRevision implements MembershipEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
protected String groupId;
public MembershipEntityImpl() {
}
public Object getPersistentState() {
// membership is not updatable
return MembershipEntityImpl.class;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
}
| Fix for create membership issue when used in TaskListener::notify() | Fix for create membership issue when used in TaskListener::notify()
| Java | apache-2.0 | stefan-ziel/Activiti,stefan-ziel/Activiti,Activiti/Activiti,stefan-ziel/Activiti,stefan-ziel/Activiti,Activiti/Activiti | java | ## Code Before:
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.persistence.entity;
import java.io.Serializable;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class MembershipEntityImpl extends AbstractEntityNoRevision implements MembershipEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
protected String groupId;
public MembershipEntityImpl() {
}
public Object getPersistentState() {
// membership is not updatable
return MembershipEntityImpl.class;
}
public String getId() {
// membership doesn't have an id
return null;
}
public void setId(String id) {
// membership doesn't have an id
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
}
## Instruction:
Fix for create membership issue when used in TaskListener::notify()
## Code After:
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.persistence.entity;
import java.io.Serializable;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class MembershipEntityImpl extends AbstractEntityNoRevision implements MembershipEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
protected String groupId;
public MembershipEntityImpl() {
}
public Object getPersistentState() {
// membership is not updatable
return MembershipEntityImpl.class;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
}
| /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl.persistence.entity;
import java.io.Serializable;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class MembershipEntityImpl extends AbstractEntityNoRevision implements MembershipEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String userId;
protected String groupId;
public MembershipEntityImpl() {
}
public Object getPersistentState() {
// membership is not updatable
return MembershipEntityImpl.class;
}
-
- public String getId() {
- // membership doesn't have an id
- return null;
- }
-
- public void setId(String id) {
- // membership doesn't have an id
- }
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
} | 9 | 0.145161 | 0 | 9 |
4109e4719bece40be9f2358544e4b658215b16d9 | website/src/index.js | website/src/index.js | import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './containers/App';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
);
| import React from 'react';
import ReactDOM from 'react-dom/client';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './containers/App';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
| Use the latest version of React. | Use the latest version of React.
| JavaScript | mit | chrisl8/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot | javascript | ## Code Before:
import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './containers/App';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
);
## Instruction:
Use the latest version of React.
## Code After:
import React from 'react';
import ReactDOM from 'react-dom/client';
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './containers/App';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
| import React from 'react';
- import ReactDOM from 'react-dom';
+ import ReactDOM from 'react-dom/client';
? +++++++
import 'bootstrap/dist/css/bootstrap.css';
import './index.css';
import App from './containers/App';
- ReactDOM.render(
+ const root = ReactDOM.createRoot(document.getElementById('root'));
+ root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
- document.getElementById('root'),
); | 6 | 0.5 | 3 | 3 |
508945a7244d8aeeaf01ac00783c2eef9c900aee | hacks/bm.php | hacks/bm.php | <?php
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
for ($i =0; $i < $iterations; $i++) {
$start = microtime(true);
shell_exec($cmd);
$end = microtime(true);
$avg += ($end - $start);
}
echo number_format(($avg/$iterations), 3).' seconds average time over 10 iterations.';
echo PHP_EOL;
| <?php
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
$max = 0;
$min = null;
for ($i =0; $i < $iterations; $i++) {
echo '.';
$start = microtime(true);
shell_exec($cmd);
$end = microtime(true);
$time = ($end - $start);
$avg += $time;
$max = $max < $time ? $time : $max;
$min = $min == null || $min > $time ? $time : $min;
}
echo PHP_EOL;
echo 'Average: '.number_format(($avg/$iterations)*1000, 0).'ms'.PHP_EOL;
echo 'Max: '.number_format($max*1000, 0).'ms'.PHP_EOL;
echo 'Min: '.number_format($min*1000, 0).'ms'.PHP_EOL;
| Add maximum and minimum time. | Add maximum and minimum time.
| PHP | mit | dersam/zotfiles | php | ## Code Before:
<?php
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
for ($i =0; $i < $iterations; $i++) {
$start = microtime(true);
shell_exec($cmd);
$end = microtime(true);
$avg += ($end - $start);
}
echo number_format(($avg/$iterations), 3).' seconds average time over 10 iterations.';
echo PHP_EOL;
## Instruction:
Add maximum and minimum time.
## Code After:
<?php
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
$max = 0;
$min = null;
for ($i =0; $i < $iterations; $i++) {
echo '.';
$start = microtime(true);
shell_exec($cmd);
$end = microtime(true);
$time = ($end - $start);
$avg += $time;
$max = $max < $time ? $time : $max;
$min = $min == null || $min > $time ? $time : $min;
}
echo PHP_EOL;
echo 'Average: '.number_format(($avg/$iterations)*1000, 0).'ms'.PHP_EOL;
echo 'Max: '.number_format($max*1000, 0).'ms'.PHP_EOL;
echo 'Min: '.number_format($min*1000, 0).'ms'.PHP_EOL;
| <?php
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
+ $max = 0;
+ $min = null;
for ($i =0; $i < $iterations; $i++) {
+ echo '.';
$start = microtime(true);
shell_exec($cmd);
$end = microtime(true);
- $avg += ($end - $start);
? ^^^ -
+ $time = ($end - $start);
? ^^^^
+ $avg += $time;
+ $max = $max < $time ? $time : $max;
+ $min = $min == null || $min > $time ? $time : $min;
}
- echo number_format(($avg/$iterations), 3).' seconds average time over 10 iterations.';
echo PHP_EOL;
+ echo 'Average: '.number_format(($avg/$iterations)*1000, 0).'ms'.PHP_EOL;
+ echo 'Max: '.number_format($max*1000, 0).'ms'.PHP_EOL;
+ echo 'Min: '.number_format($min*1000, 0).'ms'.PHP_EOL; | 12 | 0.8 | 10 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.