commit stringlengths 40 40 | old_file stringlengths 4 237 | new_file stringlengths 4 237 | old_contents stringlengths 1 4.24k | new_contents stringlengths 5 4.84k | subject stringlengths 15 778 | message stringlengths 16 6.86k | lang stringlengths 1 30 | license stringclasses 13 values | repos stringlengths 5 116k | config stringlengths 1 30 | content stringlengths 105 8.72k |
|---|---|---|---|---|---|---|---|---|---|---|---|
9406ca3a69d228cb57ac08162b35e1e19dca3b33 | app/styles/modules/search/search-filter.scss | app/styles/modules/search/search-filter.scss | .search-filter {
ul {
border-bottom: 3px solid $gray-light;
display: flex;
padding-bottom: .5rem;
}
li {
margin-right: 1rem;
}
a {
@extend %large;
@extend %title;
opacity: .2;
&:hover {
color: $blackish;
opacity: 1;
transition: opacity .3s linear;
}
}
.active {
color: $blackish;
opacity: 1;
transition : opacity .3s linear;
}
.icon {
margin-right: .4rem;
}
.name {
padding-left: 5px;
}
}
| .search-filter {
ul {
border-bottom: 3px solid $gray-light;
display: flex;
padding-bottom: .5rem;
}
li {
margin-right: 1rem;
}
a {
@extend %large;
@extend %title;
opacity: .2;
&:hover {
color: $gray;
opacity: 1;
transition: opacity .3s linear;
}
}
.active {
color: $gray;
opacity: 1;
transition : opacity .3s linear;
}
.icon {
margin-right: .4rem;
}
.name {
padding-left: 5px;
}
}
| Edit color to keep consistency across taiga | Edit color to keep consistency across taiga
| SCSS | agpl-3.0 | Rademade/taiga-front,taigaio/taiga-front,taigaio/taiga-front,joshisa/taiga-front,artlepool/taiga-front,Comi9/taiga-front,bartuspan/taiga-front,CoolCloud/taiga-front,obimod/taiga-front,pfac/taiga-front,obimod/taiga-front,yufish/taiga-front,trimolesi/taiga-front,CMLL/taiga-front,yufish/taiga-front,pfac/taiga-front,seanchen/taiga-front,topalavlad/taiga-front,allistera/taiga-front,bdang2012/taiga-front-casting,Tigerwhit4/taiga-front,dycodedev/taiga-front,joshisa/taiga-front,dycodedev/taiga-front,joshisa/taiga-front,taigaio/taiga-front,Comi9/taiga-front,trimolesi/taiga-front,Rademade/taiga-front,bartuspan/taiga-front,mikkame/taiga-front,artlepool/taiga-front,CMLL/taiga-front,Rademade/taiga-front,Rademade/taiga-front,topalavlad/taiga-front,mikkame/taiga-front,19kestier/taiga-front,CoolCloud/taiga-front,seanchen/taiga-front,19kestier/taiga-front,pfac/taiga-front,dycodedev/taiga-front,trimolesi/taiga-front,coopsource/taiga-front,yufish/taiga-front,allistera/taiga-front,CMLL/taiga-front,coopsource/taiga-front,artlepool/taiga-front,topalavlad/taiga-front,topalavlad/taiga-front,bartuspan/taiga-front,Tigerwhit4/taiga-front,obimod/taiga-front,coopsource/taiga-front,allistera/taiga-front,Comi9/taiga-front,astagi/taiga-front,mikkame/taiga-front,seanchen/taiga-front,bdang2012/taiga-front-casting,Tigerwhit4/taiga-front,CoolCloud/taiga-front,bdang2012/taiga-front-casting | scss | ## Code Before:
.search-filter {
ul {
border-bottom: 3px solid $gray-light;
display: flex;
padding-bottom: .5rem;
}
li {
margin-right: 1rem;
}
a {
@extend %large;
@extend %title;
opacity: .2;
&:hover {
color: $blackish;
opacity: 1;
transition: opacity .3s linear;
}
}
.active {
color: $blackish;
opacity: 1;
transition : opacity .3s linear;
}
.icon {
margin-right: .4rem;
}
.name {
padding-left: 5px;
}
}
## Instruction:
Edit color to keep consistency across taiga
## Code After:
.search-filter {
ul {
border-bottom: 3px solid $gray-light;
display: flex;
padding-bottom: .5rem;
}
li {
margin-right: 1rem;
}
a {
@extend %large;
@extend %title;
opacity: .2;
&:hover {
color: $gray;
opacity: 1;
transition: opacity .3s linear;
}
}
.active {
color: $gray;
opacity: 1;
transition : opacity .3s linear;
}
.icon {
margin-right: .4rem;
}
.name {
padding-left: 5px;
}
}
|
3b494431cb2c1b7d4fbba16d7df8e9e7dd1d4b81 | package.json | package.json | {
"name": "erb-plus",
"displayName": "erb-plus",
"description": "ERB syntax with tag helper and snippets",
"version": "0.0.1",
"publisher": "vortizhe",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:extension.sayHello"
],
"main": "./extension",
"contributes": {
"commands": [{
"command": "extension.sayHello",
"title": "Hello World"
}]
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"vscode": "^0.11.0"
}
} | {
"name": "erb-plus",
"displayName": "erb-plus",
"description": "ERB syntax with tag helper and snippets",
"version": "0.0.1",
"publisher": "vortizhe",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Languages"
],
"activationEvents": [
"onCommand:extension.sayHello"
],
"main": "./extension",
"contributes": {
"commands": [{
"command": "extension.sayHello",
"title": "Hello World"
}]
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"vscode": "^0.11.0"
},
"repository": {
"type": "git",
"url": "https://github.com/vortizhe/vscode-erb-plus.git"
}
} | Add repo and update plugin category | Add repo and update plugin category
| JSON | mit | vortizhe/vscode-ruby-erb | json | ## Code Before:
{
"name": "erb-plus",
"displayName": "erb-plus",
"description": "ERB syntax with tag helper and snippets",
"version": "0.0.1",
"publisher": "vortizhe",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:extension.sayHello"
],
"main": "./extension",
"contributes": {
"commands": [{
"command": "extension.sayHello",
"title": "Hello World"
}]
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"vscode": "^0.11.0"
}
}
## Instruction:
Add repo and update plugin category
## Code After:
{
"name": "erb-plus",
"displayName": "erb-plus",
"description": "ERB syntax with tag helper and snippets",
"version": "0.0.1",
"publisher": "vortizhe",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Languages"
],
"activationEvents": [
"onCommand:extension.sayHello"
],
"main": "./extension",
"contributes": {
"commands": [{
"command": "extension.sayHello",
"title": "Hello World"
}]
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"vscode": "^0.11.0"
},
"repository": {
"type": "git",
"url": "https://github.com/vortizhe/vscode-erb-plus.git"
}
} |
bd89f90a3d77f3a2694c5b179177cdac914070c5 | src/infer/inferTitle.js | src/infer/inferTitle.js | import axios from 'axios';
import cheerio from 'cheerio';
const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36';
function inferTitle(url) {
const options = {
method: 'get',
url,
headers: {
// fake a user agent because pages like http://messenger.com will throw 404 error
'User-Agent': USER_AGENT,
},
};
return axios(options).then(({ data }) => {
const $ = cheerio.load(data);
return $('title')
.first()
.text()
.replace(/\//g, '');
});
}
export default inferTitle;
| import axios from 'axios';
import cheerio from 'cheerio';
const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36';
function inferTitle(url) {
const options = {
method: 'get',
url,
headers: {
// fake a user agent because pages like http://messenger.com will throw 404 error
'User-Agent': USER_AGENT,
},
};
return axios(options).then(({ data }) => {
const $ = cheerio.load(data);
return $('title')
.first()
.text();
});
}
export default inferTitle;
| Remove workaround for slashes in page title | Remove workaround for slashes in page title
This was reported in #22 and has been fixed upstream in electron-userland/electron-packager#308
| JavaScript | bsd-2-clause | skewedlines/Nativefier,skewedlines/Nativefier,jiahaog/Nativefier,jiahaog/Nativefier,skewedlines/Nativefier,gfpacheco/Nativefier,gfpacheco/Nativefier,jiahaog/Nativefier,gfpacheco/Nativefier | javascript | ## Code Before:
import axios from 'axios';
import cheerio from 'cheerio';
const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36';
function inferTitle(url) {
const options = {
method: 'get',
url,
headers: {
// fake a user agent because pages like http://messenger.com will throw 404 error
'User-Agent': USER_AGENT,
},
};
return axios(options).then(({ data }) => {
const $ = cheerio.load(data);
return $('title')
.first()
.text()
.replace(/\//g, '');
});
}
export default inferTitle;
## Instruction:
Remove workaround for slashes in page title
This was reported in #22 and has been fixed upstream in electron-userland/electron-packager#308
## Code After:
import axios from 'axios';
import cheerio from 'cheerio';
const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36';
function inferTitle(url) {
const options = {
method: 'get',
url,
headers: {
// fake a user agent because pages like http://messenger.com will throw 404 error
'User-Agent': USER_AGENT,
},
};
return axios(options).then(({ data }) => {
const $ = cheerio.load(data);
return $('title')
.first()
.text();
});
}
export default inferTitle;
|
285abec25cba485a463e6dfaa30c1844736e899b | mltsp/tests/frontend/index.js | mltsp/tests/frontend/index.js | casper.test.begin('index loads', 1, function suite(test) {
casper.start('http://localhost:5000', function() {
test.assertTextExists('MLTSP', 'successfully loaded index page');
});
casper.run(function() {
test.done();
});
});
| casper.test.begin('index loads', 1, function suite(test) {
casper.start('http://localhost:5000', function() {
test.assertTextExists('Sign in with your Google Account',
'Authentication displayed on index page');
});
casper.run(function() {
test.done();
});
});
| Add valid test for front page | Add valid test for front page
| JavaScript | bsd-3-clause | bnaul/mltsp,mltsp/mltsp,bnaul/mltsp,mltsp/mltsp,bnaul/mltsp,mltsp/mltsp,acrellin/mltsp,mltsp/mltsp,acrellin/mltsp,acrellin/mltsp,acrellin/mltsp,bnaul/mltsp,acrellin/mltsp,mltsp/mltsp,bnaul/mltsp,acrellin/mltsp,bnaul/mltsp,mltsp/mltsp | javascript | ## Code Before:
casper.test.begin('index loads', 1, function suite(test) {
casper.start('http://localhost:5000', function() {
test.assertTextExists('MLTSP', 'successfully loaded index page');
});
casper.run(function() {
test.done();
});
});
## Instruction:
Add valid test for front page
## Code After:
casper.test.begin('index loads', 1, function suite(test) {
casper.start('http://localhost:5000', function() {
test.assertTextExists('Sign in with your Google Account',
'Authentication displayed on index page');
});
casper.run(function() {
test.done();
});
});
|
67807f2bc32c713805a223574abf645a44545f99 | recipes-containers/runc/runc-opencontainers_git.bb | recipes-containers/runc/runc-opencontainers_git.bb | include runc.inc
SRCREV = "fce58ab2d5c488bc573d02712db476a6daa9a60c"
SRC_URI = " \
git://github.com/opencontainers/runc;branch=master \
file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
"
RUNC_VERSION = "1.0.0-rc93"
CVE_PRODUCT = "runc"
# use BFD when ld-is-gold is used to work around:
# http://errors.yoctoproject.org/Errors/Details/580099/
# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp seccomp netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
# TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
# collect2: error: ld returned 1 exit status
LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
| include runc.inc
SRCREV = "fce58ab2d5c488bc573d02712db476a6daa9a60c"
SRC_URI = " \
git://github.com/opencontainers/runc;branch=master \
file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
"
RUNC_VERSION = "1.0.0-rc93"
CVE_PRODUCT = "runc"
| Revert "runc-opencontainers: use bfd even with ld-is-gold" | Revert "runc-opencontainers: use bfd even with ld-is-gold"
This reverts commit dda5ae36b44c61e61439341ea3153e6be5cb015e.
binutils gold linker was fixed with:
https://git.openembedded.org/openembedded-core/commit/?id=d07d4d739ae17787017f771dd2068fda0e836722
Signed-off-by: Martin Jansa <516df3ff67e1fa5d153800b15fb204c0a1a389dc@gmail.com>
Signed-off-by: Bruce Ashfield <284cc737d174a260eec2a2a6324a304f84b1ae0f@gmail.com>
| BitBake | mit | lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization | bitbake | ## Code Before:
include runc.inc
SRCREV = "fce58ab2d5c488bc573d02712db476a6daa9a60c"
SRC_URI = " \
git://github.com/opencontainers/runc;branch=master \
file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
"
RUNC_VERSION = "1.0.0-rc93"
CVE_PRODUCT = "runc"
# use BFD when ld-is-gold is used to work around:
# http://errors.yoctoproject.org/Errors/Details/580099/
# CGO_ENABLED=1 x86_64-oe-linux-go build -trimpath -tags "seccomp seccomp netgo osusergo" -ldflags "-w -extldflags -static -X main.gitCommit="fce58ab2d5c488bc573d02712db476a6daa9a60c-dirty" -X main.version=1.0.0-rc93+dev " -o runc .
# TOPDIR/tmp-glibc/work/core2-64-oe-linux/runc-opencontainers/1.0.0-rc93+gitAUTOINC+fce58ab2d5-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.0.1/ld: internal error in format_file_lineno, at ../../gold/dwarf_reader.cc:2278
# collect2: error: ld returned 1 exit status
LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
## Instruction:
Revert "runc-opencontainers: use bfd even with ld-is-gold"
This reverts commit dda5ae36b44c61e61439341ea3153e6be5cb015e.
binutils gold linker was fixed with:
https://git.openembedded.org/openembedded-core/commit/?id=d07d4d739ae17787017f771dd2068fda0e836722
Signed-off-by: Martin Jansa <516df3ff67e1fa5d153800b15fb204c0a1a389dc@gmail.com>
Signed-off-by: Bruce Ashfield <284cc737d174a260eec2a2a6324a304f84b1ae0f@gmail.com>
## Code After:
include runc.inc
SRCREV = "fce58ab2d5c488bc573d02712db476a6daa9a60c"
SRC_URI = " \
git://github.com/opencontainers/runc;branch=master \
file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
"
RUNC_VERSION = "1.0.0-rc93"
CVE_PRODUCT = "runc"
|
3319fca3ad42be4d948c04d868dc419441a0e9e6 | bio/sources/fasta/project.properties | bio/sources/fasta/project.properties | compile.dependencies = intermine/objectstore/main, bio/sources/fasta/main
| compile.dependencies = intermine/objectstore/main, bio/sources/fasta/main
have.file.custom = true
| Set have.file.custom in the fasta source. | Set have.file.custom in the fasta source.
| INI | lgpl-2.1 | elsiklab/intermine,JoeCarlson/intermine,JoeCarlson/intermine,JoeCarlson/intermine,elsiklab/intermine,JoeCarlson/intermine,zebrafishmine/intermine,Arabidopsis-Information-Portal/intermine,Arabidopsis-Information-Portal/intermine,zebrafishmine/intermine,Arabidopsis-Information-Portal/intermine,joshkh/intermine,JoeCarlson/intermine,zebrafishmine/intermine,JoeCarlson/intermine,Arabidopsis-Information-Portal/intermine,tomck/intermine,tomck/intermine,joshkh/intermine,drhee/toxoMine,elsiklab/intermine,joshkh/intermine,kimrutherford/intermine,tomck/intermine,elsiklab/intermine,Arabidopsis-Information-Portal/intermine,kimrutherford/intermine,joshkh/intermine,tomck/intermine,justincc/intermine,joshkh/intermine,tomck/intermine,tomck/intermine,justincc/intermine,justincc/intermine,zebrafishmine/intermine,justincc/intermine,joshkh/intermine,drhee/toxoMine,elsiklab/intermine,elsiklab/intermine,Arabidopsis-Information-Portal/intermine,elsiklab/intermine,elsiklab/intermine,justincc/intermine,kimrutherford/intermine,JoeCarlson/intermine,drhee/toxoMine,justincc/intermine,kimrutherford/intermine,justincc/intermine,tomck/intermine,drhee/toxoMine,zebrafishmine/intermine,Arabidopsis-Information-Portal/intermine,joshkh/intermine,justincc/intermine,kimrutherford/intermine,kimrutherford/intermine,JoeCarlson/intermine,zebrafishmine/intermine,JoeCarlson/intermine,zebrafishmine/intermine,drhee/toxoMine,Arabidopsis-Information-Portal/intermine,zebrafishmine/intermine,drhee/toxoMine,kimrutherford/intermine,justincc/intermine,drhee/toxoMine,zebrafishmine/intermine,tomck/intermine,Arabidopsis-Information-Portal/intermine,joshkh/intermine,tomck/intermine,kimrutherford/intermine,drhee/toxoMine,kimrutherford/intermine,drhee/toxoMine,elsiklab/intermine,joshkh/intermine | ini | ## Code Before:
compile.dependencies = intermine/objectstore/main, bio/sources/fasta/main
## Instruction:
Set have.file.custom in the fasta source.
## Code After:
compile.dependencies = intermine/objectstore/main, bio/sources/fasta/main
have.file.custom = true
|
7ed5ed31a4d9372f06214e0f29bdb5d80e34deec | app/src/main/res/values/donottranslate.xml | app/src/main/res/values/donottranslate.xml | <?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Design time placeholders -->
<string name="lorem_ipsum">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata
</string>
</resources>
| <?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Design time placeholders -->
<string name="lorem_ipsum" translatable="false">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata
</string>
</resources>
| Set dummy text as not translatable | Set dummy text as not translatable
just to prevent android studio's translation editor from
marking it as missing - purely cosmetical
| XML | apache-2.0 | canerbasaran/criticalmaps-android,criticalmaps/criticalmaps-android,cbalster/criticalmaps-android,johnjohndoe/criticalmaps-android,stephanlindauer/criticalmaps-android | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Design time placeholders -->
<string name="lorem_ipsum">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata
</string>
</resources>
## Instruction:
Set dummy text as not translatable
just to prevent android studio's translation editor from
marking it as missing - purely cosmetical
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Design time placeholders -->
<string name="lorem_ipsum" translatable="false">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata
</string>
</resources>
|
3a72fc8cd1e5bf3b647b5fa03c45f28266be7e21 | js/post_list.js | js/post_list.js | $(function() {
var api_uri = 'http://amateras.wsd.kutc.kansai-u.ac.jp/~otsuka/michishiki_api_server/select.py?order_by=created_at&order=descend';
$.getJSON(api_uri, function(json) {
for (var i = 0; i < json.length; i++) {
var $li = createListItem(json[i].title, json[i].comment, json[i].posted_by);
$('#post_list').append($li);
}
$('#post_list').listview('refresh');
});
});
function createListItem(title, comment, posted_by) {
var $title = $('<h2>').text(title);
var $comment = $('<p>').text(comment);
var $posted_by = $('<p>').text(posted_by);
var $li = $('<li>').append($title).append($comment).append($posted_by);
return $li;
} | $(document).on('pageshow', '#post-list', function() {
initPostList();
});
function initPostList() {
var api_uri = 'http://amateras.wsd.kutc.kansai-u.ac.jp/~otsuka/michishiki_api_server/select.py?order_by=created_at&order=descend';
$.getJSON(api_uri, function(json) {
for (var i = 0; i < json.length; i++) {
var $li = createListItem(json[i].title, json[i].comment, json[i].posted_by);
$('#post_list').append($li);
}
$('#post_list').listview('refresh');
});
}
function createListItem(title, comment, posted_by) {
var $title = $('<h2>').text(title);
var $comment = $('<p>').text(comment);
var $posted_by = $('<p>').text(posted_by);
var $li = $('<li>').append($title).append($comment).append($posted_by);
return $li;
} | Initialize post list when showing post list page | Initialize post list when showing post list page
| JavaScript | mit | otknoy/michishiki | javascript | ## Code Before:
$(function() {
var api_uri = 'http://amateras.wsd.kutc.kansai-u.ac.jp/~otsuka/michishiki_api_server/select.py?order_by=created_at&order=descend';
$.getJSON(api_uri, function(json) {
for (var i = 0; i < json.length; i++) {
var $li = createListItem(json[i].title, json[i].comment, json[i].posted_by);
$('#post_list').append($li);
}
$('#post_list').listview('refresh');
});
});
function createListItem(title, comment, posted_by) {
var $title = $('<h2>').text(title);
var $comment = $('<p>').text(comment);
var $posted_by = $('<p>').text(posted_by);
var $li = $('<li>').append($title).append($comment).append($posted_by);
return $li;
}
## Instruction:
Initialize post list when showing post list page
## Code After:
$(document).on('pageshow', '#post-list', function() {
initPostList();
});
function initPostList() {
var api_uri = 'http://amateras.wsd.kutc.kansai-u.ac.jp/~otsuka/michishiki_api_server/select.py?order_by=created_at&order=descend';
$.getJSON(api_uri, function(json) {
for (var i = 0; i < json.length; i++) {
var $li = createListItem(json[i].title, json[i].comment, json[i].posted_by);
$('#post_list').append($li);
}
$('#post_list').listview('refresh');
});
}
function createListItem(title, comment, posted_by) {
var $title = $('<h2>').text(title);
var $comment = $('<p>').text(comment);
var $posted_by = $('<p>').text(posted_by);
var $li = $('<li>').append($title).append($comment).append($posted_by);
return $li;
} |
fe0f17f0a87fb710b51ab007a297f07659282a3c | spec/kinetosis_spec.rb | spec/kinetosis_spec.rb | require 'minitest/pride'
require 'minitest/autorun'
require 'minitest/spec'
require File.dirname(__FILE__) + '/../lib/kinetosis'
describe Kinetosis do
before do
@object = Object.new
@object.extend(Kinetosis)
end
describe "when asked for xyz" do
it "should respond with an array with three values" do
@object.xyz.size.must_equal 3
end
end
describe "when asked about x" do
it "should respond with an integer" do
@object.x.class
end
end
describe "when the laptop is standing on a table" do
it "should respond with an x = <5 and y = <0" do
(0..5).must_include @object.x
(-5..0).must_include @object.y
end
end
end
| require 'minitest/pride'
require 'minitest/autorun'
require 'minitest/spec'
require File.dirname(__FILE__) + '/../lib/kinetosis'
describe Kinetosis do
before do
@mbp = Object.new.extend(Kinetosis)
end
describe "when asked for xyz" do
it "should respond with an array consisting of three fixnums" do
@mbp.xyz.size.must_equal 3
@mbp.xyz.map { |v| v.class.must_equal Fixnum }
end
end
describe "when asked about x and y individually" do
it "should respond with integers" do
(-255..255).must_include @mbp.x
(-255..255).must_include @mbp.y
end
end
describe "when the laptop is standing on a table" do
it "should respond with an x = <5 and y = <0" do
(0..5).must_include @mbp.x
(-5..0).must_include @mbp.y
end
end
end
| Check that x and y respond with a signed integer between -255 and 255. Renamed @object -> @mbp | Check that x and y respond with a signed integer between -255 and 255.
Renamed @object -> @mbp | Ruby | mit | peterhellberg/kinetosis,peterhellberg/kinetosis | ruby | ## Code Before:
require 'minitest/pride'
require 'minitest/autorun'
require 'minitest/spec'
require File.dirname(__FILE__) + '/../lib/kinetosis'
describe Kinetosis do
before do
@object = Object.new
@object.extend(Kinetosis)
end
describe "when asked for xyz" do
it "should respond with an array with three values" do
@object.xyz.size.must_equal 3
end
end
describe "when asked about x" do
it "should respond with an integer" do
@object.x.class
end
end
describe "when the laptop is standing on a table" do
it "should respond with an x = <5 and y = <0" do
(0..5).must_include @object.x
(-5..0).must_include @object.y
end
end
end
## Instruction:
Check that x and y respond with a signed integer between -255 and 255.
Renamed @object -> @mbp
## Code After:
require 'minitest/pride'
require 'minitest/autorun'
require 'minitest/spec'
require File.dirname(__FILE__) + '/../lib/kinetosis'
describe Kinetosis do
before do
@mbp = Object.new.extend(Kinetosis)
end
describe "when asked for xyz" do
it "should respond with an array consisting of three fixnums" do
@mbp.xyz.size.must_equal 3
@mbp.xyz.map { |v| v.class.must_equal Fixnum }
end
end
describe "when asked about x and y individually" do
it "should respond with integers" do
(-255..255).must_include @mbp.x
(-255..255).must_include @mbp.y
end
end
describe "when the laptop is standing on a table" do
it "should respond with an x = <5 and y = <0" do
(0..5).must_include @mbp.x
(-5..0).must_include @mbp.y
end
end
end
|
8f6a920eed8a1dc8b086a94fbfa6b38e3df12dfa | lib/findrepos/cli.rb | lib/findrepos/cli.rb | require 'thor'
require 'pathname'
module Findrepos
# The command line interface for the findrepos executable.
class CLI < Thor
desc 'list [DIRECTORY]', 'lists all Git repositories in the given directory'
option :recursive,
desc: 'finds Git repositories in subdirectories recursively',
type: :boolean,
aliases: :'-r'
option :clean,
desc: 'finds clean repositories only',
type: :boolean
option :dirty,
desc: 'finds dirty repositories only',
type: :boolean
def list(directory = '.') # :nodoc:
Findrepos.list(directory, recursive: options[:recursive]).each do |repo|
if Findrepos.clean?(repo)
say_status 'clean', repo, :green if !options[:dirty]
else
say_status 'dirty', repo, :red if !options[:clean]
end
end
end
default_command :list
end
end
| require 'thor'
require 'pathname'
module Findrepos
# The command line interface for the findrepos executable.
class CLI < Thor
desc 'list [DIRECTORY]', 'lists all Git repositories in the given directory'
option :recursive,
desc: 'finds Git repositories in subdirectories recursively',
type: :boolean,
aliases: :'-r'
option :clean,
desc: 'finds clean repositories only',
type: :boolean
option :dirty,
desc: 'finds dirty repositories only',
type: :boolean
def list(directory = '.') # :nodoc:
Findrepos.list(directory, recursive: options[:recursive]).each do |repo|
if Findrepos.clean?(repo)
say_git_status true, repo if !options[:dirty]
else
say_git_status false, repo if !options[:clean]
end
end
end
default_command :list
private
def say_git_status(clean, message)
status = clean ? 'clean' : 'dirty'
color = clean ? :green : :red
status = set_color status, color, true
puts "#{status} #{message}"
end
end
end
| Add and use a say_git_status helper | Add and use a say_git_status helper
| Ruby | mit | nicolasmccurdy/repos,nicolasmccurdy/repos | ruby | ## Code Before:
require 'thor'
require 'pathname'
module Findrepos
# The command line interface for the findrepos executable.
class CLI < Thor
desc 'list [DIRECTORY]', 'lists all Git repositories in the given directory'
option :recursive,
desc: 'finds Git repositories in subdirectories recursively',
type: :boolean,
aliases: :'-r'
option :clean,
desc: 'finds clean repositories only',
type: :boolean
option :dirty,
desc: 'finds dirty repositories only',
type: :boolean
def list(directory = '.') # :nodoc:
Findrepos.list(directory, recursive: options[:recursive]).each do |repo|
if Findrepos.clean?(repo)
say_status 'clean', repo, :green if !options[:dirty]
else
say_status 'dirty', repo, :red if !options[:clean]
end
end
end
default_command :list
end
end
## Instruction:
Add and use a say_git_status helper
## Code After:
require 'thor'
require 'pathname'
module Findrepos
# The command line interface for the findrepos executable.
class CLI < Thor
desc 'list [DIRECTORY]', 'lists all Git repositories in the given directory'
option :recursive,
desc: 'finds Git repositories in subdirectories recursively',
type: :boolean,
aliases: :'-r'
option :clean,
desc: 'finds clean repositories only',
type: :boolean
option :dirty,
desc: 'finds dirty repositories only',
type: :boolean
def list(directory = '.') # :nodoc:
Findrepos.list(directory, recursive: options[:recursive]).each do |repo|
if Findrepos.clean?(repo)
say_git_status true, repo if !options[:dirty]
else
say_git_status false, repo if !options[:clean]
end
end
end
default_command :list
private
def say_git_status(clean, message)
status = clean ? 'clean' : 'dirty'
color = clean ? :green : :red
status = set_color status, color, true
puts "#{status} #{message}"
end
end
end
|
b561ddae1f95775fadb9bbfb9d14e672463e55c2 | manifests/ops-files/misc/local-config-server.yml | manifests/ops-files/misc/local-config-server.yml | - type: remove
path: /variables/name=tls-kubelet/options/organization
- type: remove
path: /variables/name=tls-kubelet-client/options/organization
- type: remove
path: /variables/name=tls-kubernetes/options/organization
| - type: remove
path: /variables/name=tls-kubelet/options/organization
- type: remove
path: /variables/name=tls-kubelet-client/options/organization
- type: remove
path: /variables/name=tls-kubernetes/options/organization
- type: remove
path: /variables/name=tls-kube-controller-manager/options/key_usage
| Remove key_usage for unit tests | Remove key_usage for unit tests
* bosh CLI does not support it
| YAML | apache-2.0 | jaimegag/kubo-deployment,pivotal-cf-experimental/kubo-deployment,jaimegag/kubo-deployment,pivotal-cf-experimental/kubo-deployment | yaml | ## Code Before:
- type: remove
path: /variables/name=tls-kubelet/options/organization
- type: remove
path: /variables/name=tls-kubelet-client/options/organization
- type: remove
path: /variables/name=tls-kubernetes/options/organization
## Instruction:
Remove key_usage for unit tests
* bosh CLI does not support it
## Code After:
- type: remove
path: /variables/name=tls-kubelet/options/organization
- type: remove
path: /variables/name=tls-kubelet-client/options/organization
- type: remove
path: /variables/name=tls-kubernetes/options/organization
- type: remove
path: /variables/name=tls-kube-controller-manager/options/key_usage
|
b149ede14c1f30c370329485938b3e9e5df328f2 | app/views/layouts/comfy/admin/cms/_footer_js.html.haml | app/views/layouts/comfy/admin/cms/_footer_js.html.haml | = javascript_include_tag 'requirejs/require', data: { main: javascript_path('application') }
= yield :footer_js
| = javascript_include_tag 'requirejs/require', data: { main: javascript_path('application') }
= javascript_include_tag 'modernizr/modernizr'
= yield :footer_js
| Add Modernizr to the pages | Add Modernizr to the pages
* This commit fix "Uncaught ReferenceError: Modernizr is not defined"
| Haml | mit | moneyadviceservice/cms,moneyadviceservice/cms,moneyadviceservice/cms,moneyadviceservice/cms | haml | ## Code Before:
= javascript_include_tag 'requirejs/require', data: { main: javascript_path('application') }
= yield :footer_js
## Instruction:
Add Modernizr to the pages
* This commit fix "Uncaught ReferenceError: Modernizr is not defined"
## Code After:
= javascript_include_tag 'requirejs/require', data: { main: javascript_path('application') }
= javascript_include_tag 'modernizr/modernizr'
= yield :footer_js
|
888be10355272948040965d70f2c727575b4b22b | .goreleaser.yaml | .goreleaser.yaml | before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- 386
- amd64
binary: "mdt{{ .Version }}.{{ .Os }}-{{ .Arch }}"
no_unique_dist_dir: true
archives:
- format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
| before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- 386
- amd64
binary: "{{.ProjectName}}{{ .Version }}.{{ .Os }}-{{ .Arch }}"
no_unique_dist_dir: true
archives:
- format_overrides:
- goos: windows
format: zip
name_template: "{{.ProjectName}}{{.Version}}.{{.Os}}-{{.Arch}}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
| Make archive template the same as the build one | Make archive template the same as the build one
| YAML | mit | nstratos/mdt | yaml | ## Code Before:
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- 386
- amd64
binary: "mdt{{ .Version }}.{{ .Os }}-{{ .Arch }}"
no_unique_dist_dir: true
archives:
- format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
## Instruction:
Make archive template the same as the build one
## Code After:
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- 386
- amd64
binary: "{{.ProjectName}}{{ .Version }}.{{ .Os }}-{{ .Arch }}"
no_unique_dist_dir: true
archives:
- format_overrides:
- goos: windows
format: zip
name_template: "{{.ProjectName}}{{.Version}}.{{.Os}}-{{.Arch}}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
|
d9be7a33a8255847f6643efe26fd9d808b348097 | stylesheets/konstructs.css | stylesheets/konstructs.css | html {
position: relative;
min-height: 100%;
}
body {
padding-top: 80px;
padding-bottom: 60px;
}
p {
font-size: 120%;
font-family: 'Arimo', sans-serif;
}
h1 {
font-family: 'Arimo', sans-serif !important;
}
img {
width: 100%;
height: auto;
box-shadow: 2px 2px 10px #aaa;
}
iframe {
box-shadow: 2px 2px 10px #aaa !important;
}
.btn {
box-shadow: 1px 1px 5px #aaa !important;
}
blockquote {
font-size: 97% !important;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
padding: 1em;
}
div.row {
max-width: 1280px;
margin: 0 auto;
}
div.jumbotron {
box-shadow: 2px 2px 10px #aaa;
}
@media (max-width: 992px) {
.sidebar {
padding-top: 2em;
}
}
| html {
position: relative;
min-height: 100%;
}
body {
padding-top: 80px;
padding-bottom: 60px;
}
p {
font-size: 120%;
font-family: 'Arimo', sans-serif;
}
h1 {
font-family: 'Arimo', sans-serif !important;
}
img {
width: 100%;
height: auto;
box-shadow: 2px 2px 10px #aaa;
}
iframe {
box-shadow: 2px 2px 10px #aaa !important;
}
.btn {
box-shadow: 1px 1px 5px #aaa !important;
}
blockquote {
font-size: 97% !important;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
padding: 1em;
}
div.row {
max-width: 1280px;
margin: 0 auto;
}
div.jumbotron {
box-shadow: 2px 2px 10px #aaa;
margin: 20px !important;
}
@media (max-width: 992px) {
.sidebar {
padding-top: 2em;
}
}
| Add a little more margin on jumbotron. | Add a little more margin on jumbotron.
| CSS | apache-2.0 | konstructs/konstructs.github.io,konstructs/konstructs.github.io,konstructs/konstructs.github.io | css | ## Code Before:
html {
position: relative;
min-height: 100%;
}
body {
padding-top: 80px;
padding-bottom: 60px;
}
p {
font-size: 120%;
font-family: 'Arimo', sans-serif;
}
h1 {
font-family: 'Arimo', sans-serif !important;
}
img {
width: 100%;
height: auto;
box-shadow: 2px 2px 10px #aaa;
}
iframe {
box-shadow: 2px 2px 10px #aaa !important;
}
.btn {
box-shadow: 1px 1px 5px #aaa !important;
}
blockquote {
font-size: 97% !important;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
padding: 1em;
}
div.row {
max-width: 1280px;
margin: 0 auto;
}
div.jumbotron {
box-shadow: 2px 2px 10px #aaa;
}
@media (max-width: 992px) {
.sidebar {
padding-top: 2em;
}
}
## Instruction:
Add a little more margin on jumbotron.
## Code After:
html {
position: relative;
min-height: 100%;
}
body {
padding-top: 80px;
padding-bottom: 60px;
}
p {
font-size: 120%;
font-family: 'Arimo', sans-serif;
}
h1 {
font-family: 'Arimo', sans-serif !important;
}
img {
width: 100%;
height: auto;
box-shadow: 2px 2px 10px #aaa;
}
iframe {
box-shadow: 2px 2px 10px #aaa !important;
}
.btn {
box-shadow: 1px 1px 5px #aaa !important;
}
blockquote {
font-size: 97% !important;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
padding: 1em;
}
div.row {
max-width: 1280px;
margin: 0 auto;
}
div.jumbotron {
box-shadow: 2px 2px 10px #aaa;
margin: 20px !important;
}
@media (max-width: 992px) {
.sidebar {
padding-top: 2em;
}
}
|
7cc17062b1d28496f0482eacb6fae151b9385ddd | source/DataFormatters/CMakeLists.txt | source/DataFormatters/CMakeLists.txt | set(LLVM_NO_RTTI 1)
add_lldb_library(lldbDataFormatters
CF.cpp
Cocoa.cpp
CXXFormatterFunctions.cpp
DataVisualization.cpp
FormatCache.cpp
FormatClasses.cpp
FormatManager.cpp
LibCxx.cpp
LibCxxList.cpp
LibCxxMap.cpp
LibCxxUnorderedMap.cpp
LibStdcpp.cpp
NSArray.cpp
NSDictionary.cpp
NSIndexPath.cpp
NSSet.cpp
TypeCategory.cpp
TypeCategoryMap.cpp
TypeFormat.cpp
TypeSummary.cpp
TypeSynthetic.cpp
TypeValidator.cpp
ValueObjectPrinter.cpp
)
| set(LLVM_NO_RTTI 1)
add_lldb_library(lldbDataFormatters
CF.cpp
Cocoa.cpp
CXXFormatterFunctions.cpp
DataVisualization.cpp
FormatCache.cpp
FormatClasses.cpp
FormatManager.cpp
LibCxx.cpp
LibCxxInitializerList.cpp
LibCxxList.cpp
LibCxxMap.cpp
LibCxxUnorderedMap.cpp
LibCxxVector.cpp
LibStdcpp.cpp
NSArray.cpp
NSDictionary.cpp
NSIndexPath.cpp
NSSet.cpp
TypeCategory.cpp
TypeCategoryMap.cpp
TypeFormat.cpp
TypeSummary.cpp
TypeSynthetic.cpp
TypeValidator.cpp
ValueObjectPrinter.cpp
)
| Fix CMake build broken after r220421. | Fix CMake build broken after r220421.
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@220430 91177308-0d34-0410-b5e6-96231b3b80d8
| Text | apache-2.0 | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb | text | ## Code Before:
set(LLVM_NO_RTTI 1)
add_lldb_library(lldbDataFormatters
CF.cpp
Cocoa.cpp
CXXFormatterFunctions.cpp
DataVisualization.cpp
FormatCache.cpp
FormatClasses.cpp
FormatManager.cpp
LibCxx.cpp
LibCxxList.cpp
LibCxxMap.cpp
LibCxxUnorderedMap.cpp
LibStdcpp.cpp
NSArray.cpp
NSDictionary.cpp
NSIndexPath.cpp
NSSet.cpp
TypeCategory.cpp
TypeCategoryMap.cpp
TypeFormat.cpp
TypeSummary.cpp
TypeSynthetic.cpp
TypeValidator.cpp
ValueObjectPrinter.cpp
)
## Instruction:
Fix CMake build broken after r220421.
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@220430 91177308-0d34-0410-b5e6-96231b3b80d8
## Code After:
set(LLVM_NO_RTTI 1)
add_lldb_library(lldbDataFormatters
CF.cpp
Cocoa.cpp
CXXFormatterFunctions.cpp
DataVisualization.cpp
FormatCache.cpp
FormatClasses.cpp
FormatManager.cpp
LibCxx.cpp
LibCxxInitializerList.cpp
LibCxxList.cpp
LibCxxMap.cpp
LibCxxUnorderedMap.cpp
LibCxxVector.cpp
LibStdcpp.cpp
NSArray.cpp
NSDictionary.cpp
NSIndexPath.cpp
NSSet.cpp
TypeCategory.cpp
TypeCategoryMap.cpp
TypeFormat.cpp
TypeSummary.cpp
TypeSynthetic.cpp
TypeValidator.cpp
ValueObjectPrinter.cpp
)
|
9a9dfddb9e9f047ccb615777b737e4aff4ae7359 | interfaces/TranslatableObjectInterface.php | interfaces/TranslatableObjectInterface.php | <?php
/*
* @author Mirel Nicu Mitache <mirel.mitache@gmail.com>
* @package MPF Framework
* @link http://www.mpfframework.com
* @category core package
* @version 1.0
* @since MPF Framework Version 1.0
* @copyright Copyright © 2011 Mirel Mitache
* @license http://www.mpfframework.com/licence
*
* This file is part of MPF Framework.
*
* MPF Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MPF Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MPF Framework. If not, see <http://www.gnu.org/licenses/>.
*/
namespace mpf\interfaces;
interface TranslatableObjectInterface {
/**
* Set a new translator; Must implement \mpf\translators\ITranslator
*/
public function setTranslator($className);
/**
* Get current translator;
*/
public function getTranslator();
/**
* Translate selected text;
*/
public function translate($text);
}
| <?php
/*
* @author Mirel Nicu Mitache <mirel.mitache@gmail.com>
* @package MPF Framework
* @link http://www.mpfframework.com
* @category core package
* @version 1.0
* @since MPF Framework Version 1.0
* @copyright Copyright © 2011 Mirel Mitache
* @license http://www.mpfframework.com/licence
*
* This file is part of MPF Framework.
*
* MPF Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MPF Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MPF Framework. If not, see <http://www.gnu.org/licenses/>.
*/
namespace mpf\interfaces;
interface TranslatableObjectInterface {
/**
* Set a new translator; Must implement \mpf\translators\ITranslator
* @param string|TranslatorInterface $className
*/
public function setTranslator($className);
/**
* Get current translator;
*/
public function getTranslator() : TranslatorInterface;
/**
* Translate selected text;
* @param string $text
* @return string
*/
public function translate(string $text) : string;
}
| Change php version to 7 | Change php version to 7
| PHP | apache-2.0 | mpf-soft/mpf,mpf-soft/mpf,mpf-soft/mpf | php | ## Code Before:
<?php
/*
* @author Mirel Nicu Mitache <mirel.mitache@gmail.com>
* @package MPF Framework
* @link http://www.mpfframework.com
* @category core package
* @version 1.0
* @since MPF Framework Version 1.0
* @copyright Copyright © 2011 Mirel Mitache
* @license http://www.mpfframework.com/licence
*
* This file is part of MPF Framework.
*
* MPF Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MPF Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MPF Framework. If not, see <http://www.gnu.org/licenses/>.
*/
namespace mpf\interfaces;
interface TranslatableObjectInterface {
/**
* Set a new translator; Must implement \mpf\translators\ITranslator
*/
public function setTranslator($className);
/**
* Get current translator;
*/
public function getTranslator();
/**
* Translate selected text;
*/
public function translate($text);
}
## Instruction:
Change php version to 7
## Code After:
<?php
/*
* @author Mirel Nicu Mitache <mirel.mitache@gmail.com>
* @package MPF Framework
* @link http://www.mpfframework.com
* @category core package
* @version 1.0
* @since MPF Framework Version 1.0
* @copyright Copyright © 2011 Mirel Mitache
* @license http://www.mpfframework.com/licence
*
* This file is part of MPF Framework.
*
* MPF Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MPF Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MPF Framework. If not, see <http://www.gnu.org/licenses/>.
*/
namespace mpf\interfaces;
interface TranslatableObjectInterface {
/**
* Set a new translator; Must implement \mpf\translators\ITranslator
* @param string|TranslatorInterface $className
*/
public function setTranslator($className);
/**
* Get current translator;
*/
public function getTranslator() : TranslatorInterface;
/**
* Translate selected text;
* @param string $text
* @return string
*/
public function translate(string $text) : string;
}
|
9c1728416cf6773e510fc8c8843055189e1b03a4 | public/java/test/org/broadinstitute/sting/gatk/walkers/CNV/SymbolicAllelesIntegrationTest.java | public/java/test/org/broadinstitute/sting/gatk/walkers/CNV/SymbolicAllelesIntegrationTest.java | package org.broadinstitute.sting.gatk.walkers.CNV;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;
import java.util.Arrays;
public class SymbolicAllelesIntegrationTest extends WalkerTest {
public static String baseTestString(String reference, String VCF) {
return "-T CombineVariants" +
" -R " + reference +
" --variant:vcf " + validationDataLocation + VCF +
" -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
" -genotypeMergeOptions REQUIRE_UNIQUE" +
" -setKey null" +
" -o %s" +
" -NO_HEADER";
}
@Test
public void test1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
1,
Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
executeTest("Test symbolic alleles", spec);
}
@Test
public void test2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
1,
Arrays.asList("3008d6f5044bc14801e5c58d985dec72"));
executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
}
}
| package org.broadinstitute.sting.gatk.walkers.CNV;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;
import java.util.Arrays;
public class SymbolicAllelesIntegrationTest extends WalkerTest {
public static String baseTestString(String reference, String VCF) {
return "-T CombineVariants" +
" -R " + reference +
" --variant:vcf " + validationDataLocation + VCF +
" -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
" -genotypeMergeOptions REQUIRE_UNIQUE" +
" -setKey null" +
" -o %s" +
" -NO_HEADER";
}
@Test
public void test1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
1,
Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
executeTest("Test symbolic alleles", spec);
}
@Test
public void test2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
1,
Arrays.asList("6645babc8c7d46be0da223477c7b1291"));
executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
}
}
| Revert "Updating md5 for fixed file" because this was fixed properly in unstable (but will break SnpEff if put into Stable). | Revert "Updating md5 for fixed file" because this was fixed properly in unstable (but will break SnpEff if put into Stable).
This reverts commit 6b4182c6ab3e214da4c73bc6f3687ac6d1c0b72c.
| Java | mit | iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable,iontorrent/Torrent-Variant-Caller-stable | java | ## Code Before:
package org.broadinstitute.sting.gatk.walkers.CNV;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;
import java.util.Arrays;
public class SymbolicAllelesIntegrationTest extends WalkerTest {
public static String baseTestString(String reference, String VCF) {
return "-T CombineVariants" +
" -R " + reference +
" --variant:vcf " + validationDataLocation + VCF +
" -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
" -genotypeMergeOptions REQUIRE_UNIQUE" +
" -setKey null" +
" -o %s" +
" -NO_HEADER";
}
@Test
public void test1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
1,
Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
executeTest("Test symbolic alleles", spec);
}
@Test
public void test2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
1,
Arrays.asList("3008d6f5044bc14801e5c58d985dec72"));
executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
}
}
## Instruction:
Revert "Updating md5 for fixed file" because this was fixed properly in unstable (but will break SnpEff if put into Stable).
This reverts commit 6b4182c6ab3e214da4c73bc6f3687ac6d1c0b72c.
## Code After:
package org.broadinstitute.sting.gatk.walkers.CNV;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;
import java.util.Arrays;
public class SymbolicAllelesIntegrationTest extends WalkerTest {
public static String baseTestString(String reference, String VCF) {
return "-T CombineVariants" +
" -R " + reference +
" --variant:vcf " + validationDataLocation + VCF +
" -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
" -genotypeMergeOptions REQUIRE_UNIQUE" +
" -setKey null" +
" -o %s" +
" -NO_HEADER";
}
@Test
public void test1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
1,
Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
executeTest("Test symbolic alleles", spec);
}
@Test
public void test2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
1,
Arrays.asList("6645babc8c7d46be0da223477c7b1291"));
executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
}
}
|
f2169f3fb642b306ba6b5133de1b6b3bb263beff | app/models/trade_code.rb | app/models/trade_code.rb | class TradeCode < Sapi::Base
validates :code, :presence => true, :uniqueness => { :scope => :type }
def self.search(query)
if query.present?
where("UPPER(code) LIKE UPPER(:query)
OR UPPER(name_en) LIKE UPPER(:query)
OR UPPER(name_fr) LIKE UPPER(:query)
OR UPPER(name_es) LIKE UPPER(:query)",
:query => "%#{query}%")
else
scoped
end
end
end
| class TradeCode < Sapi::Base
validates :code, :presence => true, :uniqueness => { :scope => :type }
def self.search(query)
if query.present?
where("UPPER(code) LIKE UPPER(:query)
OR UPPER(name_en) LIKE UPPER(:query)
OR UPPER(name_fr) LIKE UPPER(:query)
OR UPPER(name_es) LIKE UPPER(:query)",
:query => "%#{query}%")
else
scoped
end
end
def name
send("name_#{I18n.locale}")
end
end
| Add name method to fetch name with locale without globalize gem | Add name method to fetch name with locale without globalize gem
| Ruby | mit | unepwcmc/trade_reporting_tool,unepwcmc/trade_reporting_tool,unepwcmc/trade_reporting_tool | ruby | ## Code Before:
class TradeCode < Sapi::Base
validates :code, :presence => true, :uniqueness => { :scope => :type }
def self.search(query)
if query.present?
where("UPPER(code) LIKE UPPER(:query)
OR UPPER(name_en) LIKE UPPER(:query)
OR UPPER(name_fr) LIKE UPPER(:query)
OR UPPER(name_es) LIKE UPPER(:query)",
:query => "%#{query}%")
else
scoped
end
end
end
## Instruction:
Add name method to fetch name with locale without globalize gem
## Code After:
class TradeCode < Sapi::Base
validates :code, :presence => true, :uniqueness => { :scope => :type }
def self.search(query)
if query.present?
where("UPPER(code) LIKE UPPER(:query)
OR UPPER(name_en) LIKE UPPER(:query)
OR UPPER(name_fr) LIKE UPPER(:query)
OR UPPER(name_es) LIKE UPPER(:query)",
:query => "%#{query}%")
else
scoped
end
end
def name
send("name_#{I18n.locale}")
end
end
|
191e62a2547c4d3d013cb4c68fed60f1619fe82c | pyheufybot/modules/say.py | pyheufybot/modules/say.py | from pyheufybot.module_interface import Module, ModulePriority, ModuleType
class ModuleSpawner(Module):
def __init__(self, bot):
self.bot = bot
self.name = "Say"
self.trigger = "say"
self.moduleType = ModuleType.COMMAND
self.modulePriotity = ModulePriority.NORMAL
self.messageTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message> | Makes the bot say the given line."
def execute(self, message):
if len(message.params) == 1:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.replyTo, " ".join(message.params[1:]))
return True
| from pyheufybot.module_interface import Module, ModulePriority, ModuleType
class ModuleSpawner(Module):
def __init__(self, bot):
self.bot = bot
self.name = "Say"
self.trigger = "say|sayremote"
self.moduleType = ModuleType.COMMAND
self.modulePriority = ModulePriority.NORMAL
self.messageTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message>/sayremote <target> <message> | Makes the bot say the given line."
def execute(self, message):
if message.params[0].lower() == "say":
if len(message.params) == 1:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.replyTo, " ".join(message.params[1:]))
elif message.params[0].lower() == "sayremote":
if len(message.params) < 3:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.params[1], " ".join(message.params[2:]))
return True
| Add a remote option to Say | Add a remote option to Say
| Python | mit | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | python | ## Code Before:
from pyheufybot.module_interface import Module, ModulePriority, ModuleType
class ModuleSpawner(Module):
def __init__(self, bot):
self.bot = bot
self.name = "Say"
self.trigger = "say"
self.moduleType = ModuleType.COMMAND
self.modulePriotity = ModulePriority.NORMAL
self.messageTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message> | Makes the bot say the given line."
def execute(self, message):
if len(message.params) == 1:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.replyTo, " ".join(message.params[1:]))
return True
## Instruction:
Add a remote option to Say
## Code After:
from pyheufybot.module_interface import Module, ModulePriority, ModuleType
class ModuleSpawner(Module):
def __init__(self, bot):
self.bot = bot
self.name = "Say"
self.trigger = "say|sayremote"
self.moduleType = ModuleType.COMMAND
self.modulePriority = ModulePriority.NORMAL
self.messageTypes = ["PRIVMSG"]
self.helpText = "Usage: say <message>/sayremote <target> <message> | Makes the bot say the given line."
def execute(self, message):
if message.params[0].lower() == "say":
if len(message.params) == 1:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.replyTo, " ".join(message.params[1:]))
elif message.params[0].lower() == "sayremote":
if len(message.params) < 3:
self.bot.msg(message.replyTo, "Say what?")
else:
self.bot.msg(message.params[1], " ".join(message.params[2:]))
return True
|
b65f1735eaf5a533d30c72f3c88dab4a6caaaaae | spec/dummy/app/controllers/orders_controller.rb | spec/dummy/app/controllers/orders_controller.rb | class OrdersController < ApplicationController
include Rules::FormsHelper
helper_method :rules_for
def show
@order = Order.last || Order.create!
end
def create
end
end
| class OrdersController < ApplicationController
def show
@order = Order.last || Order.create!
end
def create
end
end
| Remove some references to deleted forms helpers | Remove some references to deleted forms helpers
| Ruby | mit | azach/rules,azach/rules,azach/rules | ruby | ## Code Before:
class OrdersController < ApplicationController
include Rules::FormsHelper
helper_method :rules_for
def show
@order = Order.last || Order.create!
end
def create
end
end
## Instruction:
Remove some references to deleted forms helpers
## Code After:
class OrdersController < ApplicationController
def show
@order = Order.last || Order.create!
end
def create
end
end
|
d4dbf1c828dd07ad07936d2e214f55e4839e2bfe | fish/cdf.fish | fish/cdf.fish | function cdf --description="If on OSX, `cd` to the directory the front Finder window is open to."
set --local target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)')
if test -n target
echo "Changing directory to: $target"
cd $target
else
echo "No Finder window found." >&2
return 1
end
end
| function cdf --description="If on OSX, `cd` to the directory the front Finder window is open to."
# first we check if we're on OSX
if not test (uname -s) = "Darwin"
echo "We are not on OSX." >&2
return 3
end
set --local target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)')
if test -n target
echo "Changing directory to: $target"
cd $target
else
echo "No Finder window found." >&2
return 1
end
end
| Add a check for operating system. | Add a check for operating system.
As this function is being added to my dotfiles repository, a check was
added to avoid awkward errors if unintentionally used on another system.
| fish | mit | deoxys314/deoxys314_dotfiles | fish | ## Code Before:
function cdf --description="If on OSX, `cd` to the directory the front Finder window is open to."
set --local target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)')
if test -n target
echo "Changing directory to: $target"
cd $target
else
echo "No Finder window found." >&2
return 1
end
end
## Instruction:
Add a check for operating system.
As this function is being added to my dotfiles repository, a check was
added to avoid awkward errors if unintentionally used on another system.
## Code After:
function cdf --description="If on OSX, `cd` to the directory the front Finder window is open to."
# first we check if we're on OSX
if not test (uname -s) = "Darwin"
echo "We are not on OSX." >&2
return 3
end
set --local target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)')
if test -n target
echo "Changing directory to: $target"
cd $target
else
echo "No Finder window found." >&2
return 1
end
end
|
c4cb42c72a7a661916885b06b9c1146bd9a5a63e | packages/vega2-extension/README.md | packages/vega2-extension/README.md |
A mime-renderer extension for JupyterLab that provides support for rendering Vega and Vega-lite documents and mimebundles.
|
A mime-renderer extension for JupyterLab that provides support for rendering Vega and Vega-lite documents and mimebundles.
Example in Python:
```python
from IPython.display import display
display({
"application/vnd.vegalite.v1+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v1.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
{"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
}
}
}, raw=True)
```
| Add a Python example to vega2 readme | Add a Python example to vega2 readme
| Markdown | bsd-3-clause | jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab | markdown | ## Code Before:
A mime-renderer extension for JupyterLab that provides support for rendering Vega and Vega-lite documents and mimebundles.
## Instruction:
Add a Python example to vega2 readme
## Code After:
A mime-renderer extension for JupyterLab that provides support for rendering Vega and Vega-lite documents and mimebundles.
Example in Python:
```python
from IPython.display import display
display({
"application/vnd.vegalite.v1+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v1.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
{"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
}
}
}, raw=True)
```
|
eb75016461f698c9202c3e5a4da16ef248f7b882 | src/main/java/com/elmakers/mine/bukkit/protection/MultiverseManager.java | src/main/java/com/elmakers/mine/bukkit/protection/MultiverseManager.java | package com.elmakers.mine.bukkit.protection;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class MultiverseManager implements PVPManager {
private boolean enabled = false;
private MultiverseCore mv = null;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled && mv != null;
}
public void initialize(Plugin plugin) {
if (enabled) {
try {
Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
if (mvPlugin instanceof MultiverseCore) {
mv = (MultiverseCore)mvPlugin;
}
} catch (Throwable ex) {
}
if (mv != null) {
plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
}
} else {
mv = null;
}
}
@Override
public boolean isPVPAllowed(Player player, Location location) {
if (!enabled || mv == null || location == null) return true;
World world = location.getWorld();
if (world == null) return true;
return mv.getMVWorldManager().getMVWorld(world).isPVPEnabled();
}
}
| package com.elmakers.mine.bukkit.protection;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class MultiverseManager implements PVPManager {
private boolean enabled = false;
private MultiverseCore mv = null;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled && mv != null;
}
public void initialize(Plugin plugin) {
if (enabled) {
try {
Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
if (mvPlugin instanceof MultiverseCore) {
mv = (MultiverseCore)mvPlugin;
}
} catch (Throwable ex) {
}
if (mv != null) {
plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
}
} else {
mv = null;
}
}
@Override
public boolean isPVPAllowed(Player player, Location location) {
if (!enabled || mv == null || location == null) return true;
World world = location.getWorld();
if (world == null) return true;
MVWorldManager manager = mv.getMVWorldManager();
if (manager == null) return true;
MultiverseWorld mvWorld = manager.getMVWorld(world);
if (mvWorld == null) return true;
; return mvWorld.isPVPEnabled();
}
}
| Add some protection against a failed load of Multiverse | Add some protection against a failed load of Multiverse
| Java | mit | elBukkit/MagicPlugin,elBukkit/MagicPlugin,elBukkit/MagicPlugin | java | ## Code Before:
package com.elmakers.mine.bukkit.protection;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class MultiverseManager implements PVPManager {
private boolean enabled = false;
private MultiverseCore mv = null;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled && mv != null;
}
public void initialize(Plugin plugin) {
if (enabled) {
try {
Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
if (mvPlugin instanceof MultiverseCore) {
mv = (MultiverseCore)mvPlugin;
}
} catch (Throwable ex) {
}
if (mv != null) {
plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
}
} else {
mv = null;
}
}
@Override
public boolean isPVPAllowed(Player player, Location location) {
if (!enabled || mv == null || location == null) return true;
World world = location.getWorld();
if (world == null) return true;
return mv.getMVWorldManager().getMVWorld(world).isPVPEnabled();
}
}
## Instruction:
Add some protection against a failed load of Multiverse
## Code After:
package com.elmakers.mine.bukkit.protection;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class MultiverseManager implements PVPManager {
private boolean enabled = false;
private MultiverseCore mv = null;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled && mv != null;
}
public void initialize(Plugin plugin) {
if (enabled) {
try {
Plugin mvPlugin = plugin.getServer().getPluginManager().getPlugin("Multiverse-Core");
if (mvPlugin instanceof MultiverseCore) {
mv = (MultiverseCore)mvPlugin;
}
} catch (Throwable ex) {
}
if (mv != null) {
plugin.getLogger().info("Multiverse-Core found, will respect PVP settings");
}
} else {
mv = null;
}
}
@Override
public boolean isPVPAllowed(Player player, Location location) {
if (!enabled || mv == null || location == null) return true;
World world = location.getWorld();
if (world == null) return true;
MVWorldManager manager = mv.getMVWorldManager();
if (manager == null) return true;
MultiverseWorld mvWorld = manager.getMVWorld(world);
if (mvWorld == null) return true;
; return mvWorld.isPVPEnabled();
}
}
|
4d61f1cc070766560b3ae089370743d29075ddb8 | public/scripts/Sidebar.html | public/scripts/Sidebar.html | <div class="list-group">
<div class="list-group-item">
{{t('sidebar.count')}}
<span class="badge">{{clicks}}</span>
</div>
<a href="/" class="list-group-item">
<i class="fa fa-fw fa-home"></i>{{t('sidebar.home')}}
</a>
<a href="about" class="list-group-item">
<i class="fa fa-fw fa-info-circle"></i>{{t('sidebar.about')}}
</a>
<a href="markup" class="list-group-item">
<i class="fa fa-fw fa-code"></i>{{t('sidebar.markup')}}
</a>
</div>
| <div class="list-group">
<div class="list-group-item">
[[t('sidebar.count')]]
<span class="badge">{{clicks}}</span>
</div>
<a href="/" class="list-group-item">
<i class="fa fa-fw fa-home"></i>[[t('sidebar.home')]]
</a>
<a href="about" class="list-group-item">
<i class="fa fa-fw fa-info-circle"></i>[[t('sidebar.about')]]
</a>
<a href="markup" class="list-group-item">
<i class="fa fa-fw fa-code"></i>[[t('sidebar.markup')]]
</a>
</div>
| Use static mustache for sidebar i18n text | Use static mustache for sidebar i18n text
| HTML | mit | bestguy/ractive-webpack-boilerplate,bestguy/ractive-webpack-boilerplate | html | ## Code Before:
<div class="list-group">
<div class="list-group-item">
{{t('sidebar.count')}}
<span class="badge">{{clicks}}</span>
</div>
<a href="/" class="list-group-item">
<i class="fa fa-fw fa-home"></i>{{t('sidebar.home')}}
</a>
<a href="about" class="list-group-item">
<i class="fa fa-fw fa-info-circle"></i>{{t('sidebar.about')}}
</a>
<a href="markup" class="list-group-item">
<i class="fa fa-fw fa-code"></i>{{t('sidebar.markup')}}
</a>
</div>
## Instruction:
Use static mustache for sidebar i18n text
## Code After:
<div class="list-group">
<div class="list-group-item">
[[t('sidebar.count')]]
<span class="badge">{{clicks}}</span>
</div>
<a href="/" class="list-group-item">
<i class="fa fa-fw fa-home"></i>[[t('sidebar.home')]]
</a>
<a href="about" class="list-group-item">
<i class="fa fa-fw fa-info-circle"></i>[[t('sidebar.about')]]
</a>
<a href="markup" class="list-group-item">
<i class="fa fa-fw fa-code"></i>[[t('sidebar.markup')]]
</a>
</div>
|
a706fd97c999182eee2569d456775d3ca8cab1e3 | src/ForkCMS/Bundle/CoreBundle/Tests/Validator/UrlValidatorTest.php | src/ForkCMS/Bundle/CoreBundle/Tests/Validator/UrlValidatorTest.php | <?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'http://test.com/index.js' => true,
'https://test.com/index.js' => true,
'/index.js' => false,
'index.js' => false,
'dev/index.js' => false,
'/dev/index.js' => false,
];
foreach ($urls as $url => $isExternal) {
$this->assertEquals($isExternal, $urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
}
| <?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testValidExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'http://test.com/index.js',
'https://test.com/index.js',
];
foreach ($urls as $url) {
$this->assertTrue($urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
public function testInvalidExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'/index.js',
'index.js',
'dev/index.js',
'/dev/index.js',
];
foreach ($urls as $url) {
$this->assertFalse($urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
}
| Split up the external url validation in a valid and an invalid test | Split up the external url validation in a valid and an invalid test
| PHP | mit | carakas/forkcms,carakas/forkcms,carakas/forkcms,jeroendesloovere/forkcms,bartdc/forkcms,riadvice/forkcms,bartdc/forkcms,Katrienvh/forkcms,jonasdekeukelaere/forkcms,sumocoders/forkcms,riadvice/forkcms,mathiashelin/forkcms,forkcms/forkcms,jessedobbelaere/forkcms,tommyvdv/forkcms,jacob-v-dam/forkcms,jessedobbelaere/forkcms,jeroendesloovere/forkcms,jessedobbelaere/forkcms,mathiashelin/forkcms,carakas/forkcms,jacob-v-dam/forkcms,Katrienvh/forkcms,bartdc/forkcms,forkcms/forkcms,forkcms/forkcms,justcarakas/forkcms,jeroendesloovere/forkcms,jonasdekeukelaere/forkcms,jessedobbelaere/forkcms,sumocoders/forkcms,tommyvdv/forkcms,carakas/forkcms,Katrienvh/forkcms,jacob-v-dam/forkcms,justcarakas/forkcms,sumocoders/forkcms,tommyvdv/forkcms,tommyvdv/forkcms,jonasdekeukelaere/forkcms,riadvice/forkcms,jacob-v-dam/forkcms,forkcms/forkcms,Katrienvh/forkcms,jeroendesloovere/forkcms,sumocoders/forkcms,jonasdekeukelaere/forkcms,mathiashelin/forkcms,sumocoders/forkcms,justcarakas/forkcms,mathiashelin/forkcms,jonasdekeukelaere/forkcms,riadvice/forkcms | php | ## Code Before:
<?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'http://test.com/index.js' => true,
'https://test.com/index.js' => true,
'/index.js' => false,
'index.js' => false,
'dev/index.js' => false,
'/dev/index.js' => false,
];
foreach ($urls as $url => $isExternal) {
$this->assertEquals($isExternal, $urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
}
## Instruction:
Split up the external url validation in a valid and an invalid test
## Code After:
<?php
namespace ForkCMS\Bundle\CoreBundle\Tests\Validator;
use ForkCMS\Bundle\CoreBundle\Validator\UrlValidator;
use PHPUnit\Framework\TestCase;
class UrlValidatorTest extends TestCase
{
public function testValidExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'http://test.com/index.js',
'https://test.com/index.js',
];
foreach ($urls as $url) {
$this->assertTrue($urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
public function testInvalidExternalUrlValidation()
{
$urlValidator = new UrlValidator();
$urls = [
'/index.js',
'index.js',
'dev/index.js',
'/dev/index.js',
];
foreach ($urls as $url) {
$this->assertFalse($urlValidator->isExternalUrl($url), $url . ' was not validated correctly');
}
}
}
|
662ea1b76ad467c9576f90ae69b7ea4ba23a051b | src/Command/DrushCommand.php | src/Command/DrushCommand.php | <?php
/**
* @file
* Contains \Drupal\Console\Command\DrushCommand.
*/
namespace Drupal\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class DrushCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('drush')
->setDescription($this->trans('commands.drush.description'))
->addArgument('args', InputArgument::IS_ARRAY, $this->trans('commands.drush.arguments.args'))
->setHelp($this->trans('commands.drush.help'));
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = '';
if ($arguments = $input->getArgument('args')) {
$args .= ' '.implode(' ', $arguments);
$c_args = preg_replace('/[^a-z0-9-= ]/i', '', $args);
}
if (`which drush`) {
system('drush'.$c_args);
} else {
$output->write('<error>'.$this->trans('commands.drush.message.not_found').'</error>');
}
}
}
| <?php
/**
* @file
* Contains \Drupal\Console\Command\DrushCommand.
*/
namespace Drupal\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Command\Command;
class DrushCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('drush')
->setDescription($this->trans('commands.drush.description'))
->addArgument(
'args',
InputArgument::IS_ARRAY,
$this->trans('commands.drush.arguments.args')
)
->setHelp($this->trans('commands.drush.help'));
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = '';
if ($arguments = $input->getArgument('args')) {
$args .= ' '.implode(' ', $arguments);
$c_args = preg_replace('/[^a-z0-9-= ]/i', '', $args);
}
if (`which drush`) {
system('drush'.$c_args);
} else {
$this->getMessageHelper()->addErrorMessage(
$this->trans('commands.drush.message.not_found')
);
}
}
}
| Improve drush command, make stand alone command | [drush] Improve drush command, make stand alone command
| PHP | mit | AniRai/DrupalConsole,Cottser/DrupalConsole,longloop/DrupalConsole,karmazzin/DrupalConsole,revagomes/DrupalConsole,revagomes/DrupalConsole,AniRai/DrupalConsole,alxvallejo/DrupalConsole,frega/DrupalConsole,AniRai/DrupalConsole,reszli/DrupalConsole,frega/DrupalConsole,frega/DrupalConsole,karmazzin/DrupalConsole,longloop/DrupalConsole,dkgndec/DrupalConsole,reszli/DrupalConsole,alxvallejo/DrupalConsole,longloop/DrupalConsole,dkgndec/DrupalConsole,dkgndec/DrupalConsole,Cottser/DrupalConsole,alxvallejo/DrupalConsole,revagomes/DrupalConsole,reszli/DrupalConsole,Cottser/DrupalConsole,karmazzin/DrupalConsole | php | ## Code Before:
<?php
/**
* @file
* Contains \Drupal\Console\Command\DrushCommand.
*/
namespace Drupal\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class DrushCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('drush')
->setDescription($this->trans('commands.drush.description'))
->addArgument('args', InputArgument::IS_ARRAY, $this->trans('commands.drush.arguments.args'))
->setHelp($this->trans('commands.drush.help'));
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = '';
if ($arguments = $input->getArgument('args')) {
$args .= ' '.implode(' ', $arguments);
$c_args = preg_replace('/[^a-z0-9-= ]/i', '', $args);
}
if (`which drush`) {
system('drush'.$c_args);
} else {
$output->write('<error>'.$this->trans('commands.drush.message.not_found').'</error>');
}
}
}
## Instruction:
[drush] Improve drush command, make stand alone command
## Code After:
<?php
/**
* @file
* Contains \Drupal\Console\Command\DrushCommand.
*/
namespace Drupal\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Command\Command;
class DrushCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('drush')
->setDescription($this->trans('commands.drush.description'))
->addArgument(
'args',
InputArgument::IS_ARRAY,
$this->trans('commands.drush.arguments.args')
)
->setHelp($this->trans('commands.drush.help'));
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$args = '';
if ($arguments = $input->getArgument('args')) {
$args .= ' '.implode(' ', $arguments);
$c_args = preg_replace('/[^a-z0-9-= ]/i', '', $args);
}
if (`which drush`) {
system('drush'.$c_args);
} else {
$this->getMessageHelper()->addErrorMessage(
$this->trans('commands.drush.message.not_found')
);
}
}
}
|
7fe874390a2340aaef816626f0e55c75ce23e587 | chronicle-demo/src/main/java/vanilla/java/echo/QueueServerMain.java | chronicle-demo/src/main/java/vanilla/java/echo/QueueServerMain.java | package vanilla.java.echo;
import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;
import java.io.IOException;
public class QueueServerMain {
public static void main(String... args) throws IOException {
String host = args[0];
if (!host.equals("localhost"))
AffinityLock.acquireLock();
Chronicle inbound = ChronicleQueueBuilder
.indexed("/tmp/server-inbound")
.sink().connectAddress(host, 54001)
.build();
ExcerptTailer tailer = inbound.createTailer().toEnd();
Chronicle outbound = ChronicleQueueBuilder
.indexed("/tmp/server-outbound")
.source().bindAddress(54002)
.build();
ExcerptAppender appender = outbound.createAppender();
long count = 0, next = 1000000;
while (true) {
if (tailer.nextIndex()) {
appender.startExcerpt();
appender.write(tailer);
appender.finish();
count++;
/*
System.out.print(".");
if ((count & 127) == 0)
System.out.println();
*/
} else {
if (count >= next)
System.out.println(count);
next += 1000000;
}
}
}
}
| package vanilla.java.echo;
import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;
import java.io.IOException;
public class QueueServerMain {
public static void main(String... args) throws IOException {
String host = args[0];
Chronicle inbound = ChronicleQueueBuilder
.indexed("/tmp/server-inbound")
.sink().connectAddress(host, 54001)
.build();
ExcerptTailer tailer = inbound.createTailer().toEnd();
Chronicle outbound = ChronicleQueueBuilder
.indexed("/tmp/server-outbound")
.source().bindAddress(54002)
.build();
ExcerptAppender appender = outbound.createAppender();
if (!host.equals("localhost"))
AffinityLock.acquireLock();
long count = 0, next = 1000000;
while (true) {
if (tailer.nextIndex()) {
appender.startExcerpt();
appender.write(tailer);
appender.finish();
count++;
/*
System.out.print(".");
if ((count & 127) == 0)
System.out.println();
*/
} else {
if (count >= next)
System.out.println(count);
next += 1000000;
}
}
}
}
| Add test for round tripping via chronicle indexed. | Add test for round tripping via chronicle indexed.
| Java | apache-2.0 | OpenHFT/Chronicle-Queue,fengshao0907/Chronicle-Queue,OpenHFT/Chronicle-Queue | java | ## Code Before:
package vanilla.java.echo;
import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;
import java.io.IOException;
public class QueueServerMain {
public static void main(String... args) throws IOException {
String host = args[0];
if (!host.equals("localhost"))
AffinityLock.acquireLock();
Chronicle inbound = ChronicleQueueBuilder
.indexed("/tmp/server-inbound")
.sink().connectAddress(host, 54001)
.build();
ExcerptTailer tailer = inbound.createTailer().toEnd();
Chronicle outbound = ChronicleQueueBuilder
.indexed("/tmp/server-outbound")
.source().bindAddress(54002)
.build();
ExcerptAppender appender = outbound.createAppender();
long count = 0, next = 1000000;
while (true) {
if (tailer.nextIndex()) {
appender.startExcerpt();
appender.write(tailer);
appender.finish();
count++;
/*
System.out.print(".");
if ((count & 127) == 0)
System.out.println();
*/
} else {
if (count >= next)
System.out.println(count);
next += 1000000;
}
}
}
}
## Instruction:
Add test for round tripping via chronicle indexed.
## Code After:
package vanilla.java.echo;
import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;
import java.io.IOException;
public class QueueServerMain {
public static void main(String... args) throws IOException {
String host = args[0];
Chronicle inbound = ChronicleQueueBuilder
.indexed("/tmp/server-inbound")
.sink().connectAddress(host, 54001)
.build();
ExcerptTailer tailer = inbound.createTailer().toEnd();
Chronicle outbound = ChronicleQueueBuilder
.indexed("/tmp/server-outbound")
.source().bindAddress(54002)
.build();
ExcerptAppender appender = outbound.createAppender();
if (!host.equals("localhost"))
AffinityLock.acquireLock();
long count = 0, next = 1000000;
while (true) {
if (tailer.nextIndex()) {
appender.startExcerpt();
appender.write(tailer);
appender.finish();
count++;
/*
System.out.print(".");
if ((count & 127) == 0)
System.out.println();
*/
} else {
if (count >= next)
System.out.println(count);
next += 1000000;
}
}
}
}
|
a33d7c90968d469d6259ff706b3a10e0344ad251 | imports/ui/main-nav-bar.jsx | imports/ui/main-nav-bar.jsx | import React from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
export default class MainNavBar extends React.Component {
constructor(props, context) {
super(props, context);
this.isActive = this.isActive.bind(this);
}
isActive(view) {
return this.context.router.isActive(view);
}
goTo(location) {
this.context.router.push(location);
}
render() {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand style={{ color: '#DE4646' }}>
<i className="fa fa-fire"></i> DataFurnace
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem
style={{ color: 'white' }}
active={this.isActive('structure-view')}
onClick={() => this.goTo('/structure-view')}
>
Structure View
</NavItem>
<NavItem
style={{ color: 'white' }}
active={this.isActive('measure-view')}
onClick={() => this.goTo('/measure-view')}
>
Measure View
</NavItem>
</Nav>
</Navbar>
);
}
}
MainNavBar.contextTypes = {
router: React.PropTypes.object.isRequired,
};
| import React from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
export default class MainNavBar extends React.Component {
constructor(props, context) {
super(props, context);
this.isActive = this.isActive.bind(this);
}
isActive(view) {
return this.context.router.isActive(view);
}
goTo(location) {
this.context.router.push(location);
}
render() {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand style={{ color: '#DE4646' }}>
<i className="fa fa-fire"></i> DataFurnace
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem
style={{ color: 'white' }}
active={this.isActive('structure-view')}
onClick={() => this.goTo('/structure-view')}
>
Structure View
</NavItem>
<NavItem
style={{ color: 'white' }}
active={this.isActive('measure-view')}
onClick={() => this.goTo('/measure-view')}
>
<i className="fa fa-balance-scale"></i>
Measure View
</NavItem>
</Nav>
</Navbar>
);
}
}
MainNavBar.contextTypes = {
router: React.PropTypes.object.isRequired,
};
| Add scale icon to measure view link in nav bar | Add scale icon to measure view link in nav bar
| JSX | mit | minden/data-furnace,minden/data-furnace | jsx | ## Code Before:
import React from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
export default class MainNavBar extends React.Component {
constructor(props, context) {
super(props, context);
this.isActive = this.isActive.bind(this);
}
isActive(view) {
return this.context.router.isActive(view);
}
goTo(location) {
this.context.router.push(location);
}
render() {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand style={{ color: '#DE4646' }}>
<i className="fa fa-fire"></i> DataFurnace
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem
style={{ color: 'white' }}
active={this.isActive('structure-view')}
onClick={() => this.goTo('/structure-view')}
>
Structure View
</NavItem>
<NavItem
style={{ color: 'white' }}
active={this.isActive('measure-view')}
onClick={() => this.goTo('/measure-view')}
>
Measure View
</NavItem>
</Nav>
</Navbar>
);
}
}
MainNavBar.contextTypes = {
router: React.PropTypes.object.isRequired,
};
## Instruction:
Add scale icon to measure view link in nav bar
## Code After:
import React from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
export default class MainNavBar extends React.Component {
constructor(props, context) {
super(props, context);
this.isActive = this.isActive.bind(this);
}
isActive(view) {
return this.context.router.isActive(view);
}
goTo(location) {
this.context.router.push(location);
}
render() {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand style={{ color: '#DE4646' }}>
<i className="fa fa-fire"></i> DataFurnace
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem
style={{ color: 'white' }}
active={this.isActive('structure-view')}
onClick={() => this.goTo('/structure-view')}
>
Structure View
</NavItem>
<NavItem
style={{ color: 'white' }}
active={this.isActive('measure-view')}
onClick={() => this.goTo('/measure-view')}
>
<i className="fa fa-balance-scale"></i>
Measure View
</NavItem>
</Nav>
</Navbar>
);
}
}
MainNavBar.contextTypes = {
router: React.PropTypes.object.isRequired,
};
|
6d214b9972a22e8b7e2ca574fbb7ce30907a3667 | lib/draper/active_model_support.rb | lib/draper/active_model_support.rb | module Draper::ActiveModelSupport
module Proxies
def self.extended(base)
# These methods (as keys) will be created only if the correspondent
# model descends from a specific class (as value)
proxies = {}
proxies[:to_param] = ActiveModel::Conversion if defined?(ActiveModel::Conversion)
proxies[:errors] = ActiveModel::Validations if defined?(ActiveModel::Validations)
proxies[:id] = ActiveRecord::Base if defined?(ActiveRecord::Base)
proxies.each do |method_name, dependency|
if base.model.kind_of?(dependency) || dependency.nil?
base.singleton_class.class_eval do
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
define_method(method_name) do |*args, &block|
model.send(method_name, *args, &block)
end
end
end
end
end
base.class_eval do
def to_model
self
end
end
end
end
end
| module Draper::ActiveModelSupport
module Proxies
def self.extended(base)
# These methods (as keys) will be created only if the correspondent
# model descends from a specific class (as value)
proxies = {}
proxies[:to_param] = ActiveModel::Conversion if defined?(ActiveModel::Conversion)
proxies[:errors] = ActiveModel::Validations if defined?(ActiveModel::Validations)
proxies[:id] = ActiveRecord::Base if defined?(ActiveRecord::Base)
proxies.each do |method_name, dependency|
if base.model.kind_of?(dependency) || dependency.nil?
base.singleton_class.class_eval do
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
define_method(method_name) do |*args, &block|
model.send(method_name, *args, &block)
end
end
end
end
end
end
end
end
| Remove automatic delegation of to_model. | Remove automatic delegation of to_model.
We don't always want this behavior, so I'm not comfortable with
it by default.
Closes #196, and also affects #180.
| Ruby | mit | baberthal/draper,turingschool/draper,SpencerCDixon/draper,chuck-john/draper,totzyuta/draper,mallikarjunayaddala/draper,yui-knk/draper,totzyuta/draper,liwangbest/draper,estum/draper,drapergem/draper,sideci-sample/sideci-sample-draper,jianyuan/draper,mallikarjunayaddala/draper,outstand/draper,Bastes/draper,jianyuan/draper,chuck-john/draper,donaldpiret/draper,krainboltgreene/draper,outstand/draper,SpencerCDixon/draper,Bastes/draper,baberthal/draper,drapergem/draper,yui-knk/draper,drapergem/draper,estum/draper,turingschool/draper,liwangbest/draper | ruby | ## Code Before:
module Draper::ActiveModelSupport
module Proxies
def self.extended(base)
# These methods (as keys) will be created only if the correspondent
# model descends from a specific class (as value)
proxies = {}
proxies[:to_param] = ActiveModel::Conversion if defined?(ActiveModel::Conversion)
proxies[:errors] = ActiveModel::Validations if defined?(ActiveModel::Validations)
proxies[:id] = ActiveRecord::Base if defined?(ActiveRecord::Base)
proxies.each do |method_name, dependency|
if base.model.kind_of?(dependency) || dependency.nil?
base.singleton_class.class_eval do
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
define_method(method_name) do |*args, &block|
model.send(method_name, *args, &block)
end
end
end
end
end
base.class_eval do
def to_model
self
end
end
end
end
end
## Instruction:
Remove automatic delegation of to_model.
We don't always want this behavior, so I'm not comfortable with
it by default.
Closes #196, and also affects #180.
## Code After:
module Draper::ActiveModelSupport
module Proxies
def self.extended(base)
# These methods (as keys) will be created only if the correspondent
# model descends from a specific class (as value)
proxies = {}
proxies[:to_param] = ActiveModel::Conversion if defined?(ActiveModel::Conversion)
proxies[:errors] = ActiveModel::Validations if defined?(ActiveModel::Validations)
proxies[:id] = ActiveRecord::Base if defined?(ActiveRecord::Base)
proxies.each do |method_name, dependency|
if base.model.kind_of?(dependency) || dependency.nil?
base.singleton_class.class_eval do
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
define_method(method_name) do |*args, &block|
model.send(method_name, *args, &block)
end
end
end
end
end
end
end
end
|
e0245910642500b1f525587b8f6ecd742a3de85e | app/models/project_file.rb | app/models/project_file.rb | class ProjectFile < ActiveRecord::Base
belongs_to :project
belongs_to :uploader, class_name: "User"
after_destroy :delete_s3_file
private
def delete_s3_file
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3DirectUpload.config.access_key_id, aws_secret_access_key: S3DirectUpload.config.secret_access_key)
bucket = s3.directories.get(S3DirectUpload.config.bucket)
file = bucket.files.get(s3_key)
file.destroy
end
def s3_key
CGI.unescape(filepath.gsub(%r(\A/#{S3DirectUpload.config.bucket}/), ''))
end
end
| class ProjectFile < ActiveRecord::Base
belongs_to :project
belongs_to :uploader, class_name: "User"
after_destroy :delete_s3_file
def filepath=(filepath)
write_attribute :filepath, CGI.unescape(filepath)
end
def url=(url)
write_attribute :url, CGI.unescape(url)
end
private
def delete_s3_file
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3DirectUpload.config.access_key_id, aws_secret_access_key: S3DirectUpload.config.secret_access_key)
bucket = s3.directories.get(S3DirectUpload.config.bucket)
file = bucket.files.get(s3_key)
file.destroy
end
def s3_key
filepath.gsub(%r(\A/#{S3DirectUpload.config.bucket}/), '')
end
end
| Fix weird escaping coming from JS plugin | Fix weird escaping coming from JS plugin
| Ruby | mit | nbudin/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library,nbudin/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library | ruby | ## Code Before:
class ProjectFile < ActiveRecord::Base
belongs_to :project
belongs_to :uploader, class_name: "User"
after_destroy :delete_s3_file
private
def delete_s3_file
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3DirectUpload.config.access_key_id, aws_secret_access_key: S3DirectUpload.config.secret_access_key)
bucket = s3.directories.get(S3DirectUpload.config.bucket)
file = bucket.files.get(s3_key)
file.destroy
end
def s3_key
CGI.unescape(filepath.gsub(%r(\A/#{S3DirectUpload.config.bucket}/), ''))
end
end
## Instruction:
Fix weird escaping coming from JS plugin
## Code After:
class ProjectFile < ActiveRecord::Base
belongs_to :project
belongs_to :uploader, class_name: "User"
after_destroy :delete_s3_file
def filepath=(filepath)
write_attribute :filepath, CGI.unescape(filepath)
end
def url=(url)
write_attribute :url, CGI.unescape(url)
end
private
def delete_s3_file
s3 = Fog::Storage.new(provider: "AWS", aws_access_key_id: S3DirectUpload.config.access_key_id, aws_secret_access_key: S3DirectUpload.config.secret_access_key)
bucket = s3.directories.get(S3DirectUpload.config.bucket)
file = bucket.files.get(s3_key)
file.destroy
end
def s3_key
filepath.gsub(%r(\A/#{S3DirectUpload.config.bucket}/), '')
end
end
|
accb0296cf259a6a9764ecc79f76bef28a87d486 | app/controllers/node_types_controller.rb | app/controllers/node_types_controller.rb | class NodeTypesController < ApplicationController
inherit_resources
actions :show
def index
@node_types = NodeType.all
respond_to do |format|
format.json {
render json: {
node_types: @node_types.as_api_response(:ember)
}
}
end
end
def show
show! do |format|
format.json { render json: { node_type: @node_type.as_api_response(:ember) }.to_json }
end
end
protected
def collection
if params[:ids]
@node_types ||= NodeType.where(id: params[:ids])
else
super
end
end
end
| class NodeTypesController < ApplicationController
def index
@node_types = NodeType.all
respond_to do |format|
format.json {
render json: {
node_types: @node_types.as_api_response(:ember)
}
}
end
end
def show
@node_type = NodeType.find(params[:id])
respond_to do |format|
format.json { render json: { node_type: @node_type.as_api_response(:ember) }.to_json }
end
end
protected
def collection
if params[:ids]
@node_types ||= NodeType.where(id: params[:ids])
else
super
end
end
end
| Convert show action to not use inherited_resources | Convert show action to not use inherited_resources
| Ruby | agpl-3.0 | sozialhelden/wheelmap,sozialhelden/wheelmap,sozialhelden/wheelmap,sozialhelden/wheelmap,sozialhelden/wheelmap | ruby | ## Code Before:
class NodeTypesController < ApplicationController
inherit_resources
actions :show
def index
@node_types = NodeType.all
respond_to do |format|
format.json {
render json: {
node_types: @node_types.as_api_response(:ember)
}
}
end
end
def show
show! do |format|
format.json { render json: { node_type: @node_type.as_api_response(:ember) }.to_json }
end
end
protected
def collection
if params[:ids]
@node_types ||= NodeType.where(id: params[:ids])
else
super
end
end
end
## Instruction:
Convert show action to not use inherited_resources
## Code After:
class NodeTypesController < ApplicationController
def index
@node_types = NodeType.all
respond_to do |format|
format.json {
render json: {
node_types: @node_types.as_api_response(:ember)
}
}
end
end
def show
@node_type = NodeType.find(params[:id])
respond_to do |format|
format.json { render json: { node_type: @node_type.as_api_response(:ember) }.to_json }
end
end
protected
def collection
if params[:ids]
@node_types ||= NodeType.where(id: params[:ids])
else
super
end
end
end
|
313aa3a957156452cce4f8940f327450d87c03cd | src/Main.hs | src/Main.hs | import System.Environment (getArgs)
import Control.Monad (forM_)
import Text.ParserCombinators.Parsec (spaces, char, chainl1, runParser)
import Text.ParserCombinators.Parsec.Number (int)
infixOp = do
spaces
char '+'
spaces
return (+)
expr = chainl1 int infixOp
runExpr = runParser expr 0 "<input>"
showResult (Left a) = "Error: " ++ show a
showResult (Right a) = show a
main = do
putStrLn "args:"
args <- System.Environment.getArgs
forM_ args $ putStrLn . (" - " ++) . showResult . runExpr
putStrLn ""
| import System.Environment (getArgs)
import Control.Monad (forM_)
import Text.ParserCombinators.Parsec (spaces, char, chainl1, runParser)
import Text.ParserCombinators.Parsec.Number (int)
infixOp = do
spaces
char '+'
spaces
return (+)
expr = chainl1 int infixOp
runExpr = runParser expr 0 "<input>"
showResult (Left a) = "Error: " ++ show a
showResult (Right a) = show a
parse = (" - " ++) . showResult . runExpr
main = do
putStrLn "args:"
args <- System.Environment.getArgs
mapM_ (putStrLn . parse) args
putStrLn ""
| Split out the IO and non-IO bits. HT @mauke | Split out the IO and non-IO bits. HT @mauke
| Haskell | isc | steshaw/huttons-razor | haskell | ## Code Before:
import System.Environment (getArgs)
import Control.Monad (forM_)
import Text.ParserCombinators.Parsec (spaces, char, chainl1, runParser)
import Text.ParserCombinators.Parsec.Number (int)
infixOp = do
spaces
char '+'
spaces
return (+)
expr = chainl1 int infixOp
runExpr = runParser expr 0 "<input>"
showResult (Left a) = "Error: " ++ show a
showResult (Right a) = show a
main = do
putStrLn "args:"
args <- System.Environment.getArgs
forM_ args $ putStrLn . (" - " ++) . showResult . runExpr
putStrLn ""
## Instruction:
Split out the IO and non-IO bits. HT @mauke
## Code After:
import System.Environment (getArgs)
import Control.Monad (forM_)
import Text.ParserCombinators.Parsec (spaces, char, chainl1, runParser)
import Text.ParserCombinators.Parsec.Number (int)
infixOp = do
spaces
char '+'
spaces
return (+)
expr = chainl1 int infixOp
runExpr = runParser expr 0 "<input>"
showResult (Left a) = "Error: " ++ show a
showResult (Right a) = show a
parse = (" - " ++) . showResult . runExpr
main = do
putStrLn "args:"
args <- System.Environment.getArgs
mapM_ (putStrLn . parse) args
putStrLn ""
|
7f679d4acb33f38edcbc9c31688d90329824cb80 | snippets/layout-relative-position/layout-relative-position.js | snippets/layout-relative-position/layout-relative-position.js | var page = tabris.create("Page", {
title: "Layout - Relative Positioning",
topLevel: true
});
var composite1 = tabris.create("Composite", {
layoutData: {left: 0, top: 0, width: 100, height: 100},
background: "red"
}).appendTo(page);
tabris.create("Composite", {
layoutData: {left: [composite1, 10], top: [composite1, 10], width: 100, height: 100},
background: "blue"
}).appendTo(page);
page.open();
| var page = tabris.create("Page", {
title: "Layout - Relative Positioning",
topLevel: true
}).open();
var redbox = tabris.create("Composite", {
layoutData: {left: 10, top: 10, width: 100, height: 100},
background: "red"
}).appendTo(page);
// you can refer to a sibling widget by reference ...
tabris.create("Composite", {
id: "bluebox",
layoutData: {left: [redbox, 10], top: [redbox, 10], width: 100, height: 100},
background: "blue"
}).appendTo(page);
// ... by id ...
tabris.create("Composite", {
layoutData: {left: ["#bluebox", 10], top: ["#bluebox", 10], width: 100, height: 100},
background: "green"
}).appendTo(page);
// ... or by a symbolic reference to the preceeding sibling
tabris.create("Composite", {
layoutData: {left: ["prev()", 10], top: ["prev()", 10], width: 100, height: 100},
background: "yellow"
}).appendTo(page);
| Add example for "prev()" reference to snippet | Add example for "prev()" reference to snippet
Change-Id: I1b9fb2f97ca0e9aee1ba21e58a71527024d26538
| JavaScript | bsd-3-clause | eclipsesource/tabris-js,pimaxdev/tabris,moham3d/tabris-js,eclipsesource/tabris-js,mkostikov/tabris-js,eclipsesource/tabris-js,moham3d/tabris-js,pimaxdev/tabris,mkostikov/tabris-js | javascript | ## Code Before:
var page = tabris.create("Page", {
title: "Layout - Relative Positioning",
topLevel: true
});
var composite1 = tabris.create("Composite", {
layoutData: {left: 0, top: 0, width: 100, height: 100},
background: "red"
}).appendTo(page);
tabris.create("Composite", {
layoutData: {left: [composite1, 10], top: [composite1, 10], width: 100, height: 100},
background: "blue"
}).appendTo(page);
page.open();
## Instruction:
Add example for "prev()" reference to snippet
Change-Id: I1b9fb2f97ca0e9aee1ba21e58a71527024d26538
## Code After:
var page = tabris.create("Page", {
title: "Layout - Relative Positioning",
topLevel: true
}).open();
var redbox = tabris.create("Composite", {
layoutData: {left: 10, top: 10, width: 100, height: 100},
background: "red"
}).appendTo(page);
// you can refer to a sibling widget by reference ...
tabris.create("Composite", {
id: "bluebox",
layoutData: {left: [redbox, 10], top: [redbox, 10], width: 100, height: 100},
background: "blue"
}).appendTo(page);
// ... by id ...
tabris.create("Composite", {
layoutData: {left: ["#bluebox", 10], top: ["#bluebox", 10], width: 100, height: 100},
background: "green"
}).appendTo(page);
// ... or by a symbolic reference to the preceeding sibling
tabris.create("Composite", {
layoutData: {left: ["prev()", 10], top: ["prev()", 10], width: 100, height: 100},
background: "yellow"
}).appendTo(page);
|
4d7755841b8f73d087696f76784acecf0d22626e | db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb | db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb | class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
def self.up
add_column :pages, :allowed_children_cache, :text, default: ''
Page.reset_column_information
Page.find_each do |page|
page.save # update the allowed_children_cache
end
end
def self.down
remove_column :pages, :allowed_children_cache
end
end | class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
def self.up
add_column :pages, :allowed_children_cache, :text
Page.reset_column_information
Page.find_each do |page|
page.save # update the allowed_children_cache
end
end
def self.down
remove_column :pages, :allowed_children_cache
end
end | Remove default because MYSQL blows up | Remove default because MYSQL blows up
| Ruby | mit | radiant/radiant,radiant/radiant,radiant/radiant,radiant/radiant | ruby | ## Code Before:
class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
def self.up
add_column :pages, :allowed_children_cache, :text, default: ''
Page.reset_column_information
Page.find_each do |page|
page.save # update the allowed_children_cache
end
end
def self.down
remove_column :pages, :allowed_children_cache
end
end
## Instruction:
Remove default because MYSQL blows up
## Code After:
class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
def self.up
add_column :pages, :allowed_children_cache, :text
Page.reset_column_information
Page.find_each do |page|
page.save # update the allowed_children_cache
end
end
def self.down
remove_column :pages, :allowed_children_cache
end
end |
a9a9f75146074b41cf6b73de1ef19037521bee56 | src/bindings/javascript/logger.cpp | src/bindings/javascript/logger.cpp |
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_logger) {
class_<libcellml::Logger>("Logger")
.function("addIssue", &libcellml::Logger::addIssue)
.function("removeAllIssues", &libcellml::Logger::removeAllIssues)
.function("error", &libcellml::Logger::error)
.function("warning", &libcellml::Logger::warning)
.function("hint", &libcellml::Logger::hint)
;
}
|
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_logger) {
class_<libcellml::Logger>("Logger")
.function("addIssue", &libcellml::Logger::addIssue)
.function("removeAllIssues", &libcellml::Logger::removeAllIssues)
.function("error", &libcellml::Logger::error)
.function("warning", &libcellml::Logger::warning)
.function("hint", &libcellml::Logger::hint)
.function("issueCount", &libcellml::Logger::issueCount)
.function("errorCount", &libcellml::Logger::errorCount)
.function("warningCount", &libcellml::Logger::warningCount)
.function("hintCount", &libcellml::Logger::hintCount)
;
}
| Add missing API from Javascript bindings Logger class. | Add missing API from Javascript bindings Logger class.
| C++ | apache-2.0 | hsorby/libcellml,cellml/libcellml,nickerso/libcellml,cellml/libcellml,cellml/libcellml,hsorby/libcellml,nickerso/libcellml,nickerso/libcellml,nickerso/libcellml,hsorby/libcellml,hsorby/libcellml,cellml/libcellml | c++ | ## Code Before:
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_logger) {
class_<libcellml::Logger>("Logger")
.function("addIssue", &libcellml::Logger::addIssue)
.function("removeAllIssues", &libcellml::Logger::removeAllIssues)
.function("error", &libcellml::Logger::error)
.function("warning", &libcellml::Logger::warning)
.function("hint", &libcellml::Logger::hint)
;
}
## Instruction:
Add missing API from Javascript bindings Logger class.
## Code After:
using namespace emscripten;
EMSCRIPTEN_BINDINGS(libcellml_logger) {
class_<libcellml::Logger>("Logger")
.function("addIssue", &libcellml::Logger::addIssue)
.function("removeAllIssues", &libcellml::Logger::removeAllIssues)
.function("error", &libcellml::Logger::error)
.function("warning", &libcellml::Logger::warning)
.function("hint", &libcellml::Logger::hint)
.function("issueCount", &libcellml::Logger::issueCount)
.function("errorCount", &libcellml::Logger::errorCount)
.function("warningCount", &libcellml::Logger::warningCount)
.function("hintCount", &libcellml::Logger::hintCount)
;
}
|
45873300c102fc65fb8bd3b1aac6701bdf19987d | README.md | README.md | Infra
=======
DevOps course, GCP practice 6.
Project has scripts for manual setup:
- install Ruby `install_ruby.sh`
- install MongoDB `install_mongodb.sh`
- deploy application 'reddit' from Artemmkin `deploy.sh`
Project has scripts to make automatic setup at the time startup new instance:
- startup script `startup_script1.sh`
- inner script `startup_script2.sh` with main tasks
Use command to build `reddit-app` instance in Google Compute Engine (GCE):
`gcloud compute instances create --boot-disk-size=10GB --image=ubuntu-1604-xenial-v20170815a --image-project=ubuntu-os-cloud --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b --metadata-from-file startup-script=./startup_script1.sh reddit-app`
| Infra
=======
DevOps course, GCP practice 6.
Project has scripts for manual setup:
- install Ruby `install_ruby.sh`
- install MongoDB `install_mongodb.sh`
- deploy application 'reddit' from Artemmkin `deploy.sh`
Project has scripts to make automatic setup at the time startup new instance:
- startup script `startup_script1.sh`
- inner script `startup_script2.sh` with main tasks
Use command to build `reddit-app` instance in GCE:
- use default image from GCE
- use startup script to make prepare installations
`gcloud compute instances create --boot-disk-size=10GB --image=ubuntu-1604-xenial-v20170815a --image-project=ubuntu-os-cloud --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b --metadata-from-file startup-script=./startup_script1.sh reddit-app`
- use a custom image with installed software
`gcloud compute instances create --boot-disk-size=10GB --image=reddit-base-1505047437 --image-project=practice-devops-gcp-1 --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b reddit-app`
| Add a description for creating an instance from a custom image | Add a description for creating an instance from a custom image
| Markdown | mit | DmitriySh/infra,DmitriySh/infra,DmitriySh/infra | markdown | ## Code Before:
Infra
=======
DevOps course, GCP practice 6.
Project has scripts for manual setup:
- install Ruby `install_ruby.sh`
- install MongoDB `install_mongodb.sh`
- deploy application 'reddit' from Artemmkin `deploy.sh`
Project has scripts to make automatic setup at the time startup new instance:
- startup script `startup_script1.sh`
- inner script `startup_script2.sh` with main tasks
Use command to build `reddit-app` instance in Google Compute Engine (GCE):
`gcloud compute instances create --boot-disk-size=10GB --image=ubuntu-1604-xenial-v20170815a --image-project=ubuntu-os-cloud --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b --metadata-from-file startup-script=./startup_script1.sh reddit-app`
## Instruction:
Add a description for creating an instance from a custom image
## Code After:
Infra
=======
DevOps course, GCP practice 6.
Project has scripts for manual setup:
- install Ruby `install_ruby.sh`
- install MongoDB `install_mongodb.sh`
- deploy application 'reddit' from Artemmkin `deploy.sh`
Project has scripts to make automatic setup at the time startup new instance:
- startup script `startup_script1.sh`
- inner script `startup_script2.sh` with main tasks
Use command to build `reddit-app` instance in GCE:
- use default image from GCE
- use startup script to make prepare installations
`gcloud compute instances create --boot-disk-size=10GB --image=ubuntu-1604-xenial-v20170815a --image-project=ubuntu-os-cloud --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b --metadata-from-file startup-script=./startup_script1.sh reddit-app`
- use a custom image with installed software
`gcloud compute instances create --boot-disk-size=10GB --image=reddit-base-1505047437 --image-project=practice-devops-gcp-1 --machine-type=g1-small --tags puma-server --restart-on-failure --zone=europe-west1-b reddit-app`
|
4001a94fc2ba021a791b6125430b3c65cce69ca0 | lib/analyze_staff_table.rb | lib/analyze_staff_table.rb | require 'csv'
class AnalyzeStaffTable < Struct.new(:path)
def contents
encoding_options = {
invalid: :replace,
undef: :replace,
replace: ''
}
@file ||= File.read(path).encode('UTF-8', 'binary', encoding_options)
.gsub(/\\\\/, '')
.gsub(/\\"/, '')
end
def data
csv_options = {
headers: true,
header_converters: :symbol,
converters: ->(h) { nil_converter(h) }
}
@parsed_csv ||= CSV.parse(contents, csv_options)
end
def nil_converter(value)
value unless value == '\N'
end
def get_educator_data_by_full_name(full_name)
data.select { |row| row[:stf_name_view] == full_name }[0].to_hash
end
end
| require 'csv'
class AnalyzeStaffTable < Struct.new(:path)
def contents
encoding_options = {
invalid: :replace,
undef: :replace,
replace: ''
}
@file ||= File.read(path).encode('UTF-8', 'binary', encoding_options)
.gsub(/\\\\/, '')
.gsub(/\\"/, '')
end
def data
csv_options = {
headers: true,
header_converters: :symbol,
converters: ->(h) { nil_converter(h) }
}
@parsed_csv ||= CSV.parse(contents, csv_options)
end
def nil_converter(value)
value unless value == '\N'
end
def get_educator_data_by_full_name(full_name)
data.select { |row| row[:stf_name_view] == full_name }[0].to_hash
end
def get_educators_missing_local_ids
data.select { |row| row[:stf_id_local].nil? }
.map { |row| row[:stf_name_view] }
.sort
end
end
| Print names of all educators in X2 w/o local ID | Print names of all educators in X2 w/o local ID
+ #6
| Ruby | mit | jhilde/studentinsights,jhilde/studentinsights,studentinsights/studentinsights,erose/studentinsights,erose/studentinsights,jhilde/studentinsights,erose/studentinsights,jhilde/studentinsights,studentinsights/studentinsights,studentinsights/studentinsights,erose/studentinsights,studentinsights/studentinsights | ruby | ## Code Before:
require 'csv'
class AnalyzeStaffTable < Struct.new(:path)
def contents
encoding_options = {
invalid: :replace,
undef: :replace,
replace: ''
}
@file ||= File.read(path).encode('UTF-8', 'binary', encoding_options)
.gsub(/\\\\/, '')
.gsub(/\\"/, '')
end
def data
csv_options = {
headers: true,
header_converters: :symbol,
converters: ->(h) { nil_converter(h) }
}
@parsed_csv ||= CSV.parse(contents, csv_options)
end
def nil_converter(value)
value unless value == '\N'
end
def get_educator_data_by_full_name(full_name)
data.select { |row| row[:stf_name_view] == full_name }[0].to_hash
end
end
## Instruction:
Print names of all educators in X2 w/o local ID
+ #6
## Code After:
require 'csv'
class AnalyzeStaffTable < Struct.new(:path)
def contents
encoding_options = {
invalid: :replace,
undef: :replace,
replace: ''
}
@file ||= File.read(path).encode('UTF-8', 'binary', encoding_options)
.gsub(/\\\\/, '')
.gsub(/\\"/, '')
end
def data
csv_options = {
headers: true,
header_converters: :symbol,
converters: ->(h) { nil_converter(h) }
}
@parsed_csv ||= CSV.parse(contents, csv_options)
end
def nil_converter(value)
value unless value == '\N'
end
def get_educator_data_by_full_name(full_name)
data.select { |row| row[:stf_name_view] == full_name }[0].to_hash
end
def get_educators_missing_local_ids
data.select { |row| row[:stf_id_local].nil? }
.map { |row| row[:stf_name_view] }
.sort
end
end
|
60447c80583f52e88ded52eddc8a51e94260c230 | hands-on00.yml | hands-on00.yml | ---
- hosts: webservers
become: yes
become_user: root
tasks:
- name: yum install opstools
yum: pkg={{ item }} state=installed
with_items:
- epel-release
- telnet
- wget
- rsync
- tree
- tcpdump
- sysstat
- dstat
- vim-enhanced
- git
- htop
| ---
- hosts: webservers
become: yes
become_user: root
tasks:
- name: yum install opstools
yum: pkg={{ item }} state=installed
with_items:
- epel-release
- telnet
- wget
- rsync
- tree
- tcpdump
- sysstat
- dstat
- vim-enhanced
- git
| Move task installing htop to hands-on03. | Move task installing htop to hands-on03.
| YAML | mit | uorat/ansible-handson,uorat/ansible-handson | yaml | ## Code Before:
---
- hosts: webservers
become: yes
become_user: root
tasks:
- name: yum install opstools
yum: pkg={{ item }} state=installed
with_items:
- epel-release
- telnet
- wget
- rsync
- tree
- tcpdump
- sysstat
- dstat
- vim-enhanced
- git
- htop
## Instruction:
Move task installing htop to hands-on03.
## Code After:
---
- hosts: webservers
become: yes
become_user: root
tasks:
- name: yum install opstools
yum: pkg={{ item }} state=installed
with_items:
- epel-release
- telnet
- wget
- rsync
- tree
- tcpdump
- sysstat
- dstat
- vim-enhanced
- git
|
4836cd2b4b7c344c69a0c50c22354858f6220062 | app/assets/javascripts/show_hide_checkboxes.coffee | app/assets/javascripts/show_hide_checkboxes.coffee | root = exports ? this
ShowHideCheckboxesModule =
expandOnLoad: ->
$('input.show-hide-checkbox:checkbox').each ->
if $(this).is(':checked')
$('#' + $(this).data('section') + '-only').toggle('hide')
bindToCheckboxes: ->
$('input.show-hide-checkbox:checkbox').on 'change', ->
$('#' + $(this).data('section') + '-only').toggle('hide')
setup: ->
ShowHideCheckboxesModule.bindToCheckboxes()
ShowHideCheckboxesModule.expandOnLoad()
root.ShowHideCheckboxesModule = ShowHideCheckboxesModule
jQuery ->
ShowHideCheckboxesModule.setup()
| root = exports ? this
ShowHideCheckboxesModule =
expandOnLoad: ->
$('input.show-hide-checkbox:checkbox').each ->
$(this).parents('label').toggleClass('selected', $(this).is(':checked'));
if $(this).is(':checked')
$('#' + $(this).data('section') + '-only').toggle('hide')
bindToCheckboxes: ->
$('input.show-hide-checkbox:checkbox').on 'change', ->
$('#' + $(this).data('section') + '-only').toggle('hide')
$('input[type=checkbox]').on 'change', ->
$(this).parents('label').toggleClass('selected', $(this).is(':checked'));
setup: ->
ShowHideCheckboxesModule.bindToCheckboxes()
ShowHideCheckboxesModule.expandOnLoad()
root.ShowHideCheckboxesModule = ShowHideCheckboxesModule
jQuery ->
ShowHideCheckboxesModule.setup()
| Add selected to checkbox labels | Add selected to checkbox labels
| CoffeeScript | mit | ministryofjustice/fr-staffapp,ministryofjustice/fr-staffapp,ministryofjustice/fr-staffapp,ministryofjustice/fr-staffapp | coffeescript | ## Code Before:
root = exports ? this
ShowHideCheckboxesModule =
expandOnLoad: ->
$('input.show-hide-checkbox:checkbox').each ->
if $(this).is(':checked')
$('#' + $(this).data('section') + '-only').toggle('hide')
bindToCheckboxes: ->
$('input.show-hide-checkbox:checkbox').on 'change', ->
$('#' + $(this).data('section') + '-only').toggle('hide')
setup: ->
ShowHideCheckboxesModule.bindToCheckboxes()
ShowHideCheckboxesModule.expandOnLoad()
root.ShowHideCheckboxesModule = ShowHideCheckboxesModule
jQuery ->
ShowHideCheckboxesModule.setup()
## Instruction:
Add selected to checkbox labels
## Code After:
root = exports ? this
ShowHideCheckboxesModule =
expandOnLoad: ->
$('input.show-hide-checkbox:checkbox').each ->
$(this).parents('label').toggleClass('selected', $(this).is(':checked'));
if $(this).is(':checked')
$('#' + $(this).data('section') + '-only').toggle('hide')
bindToCheckboxes: ->
$('input.show-hide-checkbox:checkbox').on 'change', ->
$('#' + $(this).data('section') + '-only').toggle('hide')
$('input[type=checkbox]').on 'change', ->
$(this).parents('label').toggleClass('selected', $(this).is(':checked'));
setup: ->
ShowHideCheckboxesModule.bindToCheckboxes()
ShowHideCheckboxesModule.expandOnLoad()
root.ShowHideCheckboxesModule = ShowHideCheckboxesModule
jQuery ->
ShowHideCheckboxesModule.setup()
|
b1bb08a8ee246774b43e521e8f754cdcc88c418b | gasistafelice/gas/management.py | gasistafelice/gas/management.py | from django.db.models.signals import post_syncdb
from gasistafelice.gas.workflow_data import workflow_dict
def init_workflows(app, created_models, verbosity, **kwargs):
app_label = app.__name__.split('.')[-2]
if app_label == 'workflows' and created_models: # `worklows` app was syncronized for the first time
# now that all necessary tables are in the DB, we can register our workflows
for name, w in workflow_dict.items():
w.register_workflow()
if verbosity == 2:
# give some feedback to the user
print "Workflow %s was successfully registered." % name
return
post_syncdb.connect(init_workflows)
| from django.db.models.signals import post_syncdb
from gasistafelice.gas.workflow_data import workflow_dict
def init_workflows(app, created_models, verbosity, **kwargs):
app_label = app.__name__.split('.')[-2]
if app_label == 'workflows' and "Workflow" in created_models: # `worklows` app was syncronized for the first time
# now that all necessary tables are in the DB, we can register our workflows
for name, w in workflow_dict.items():
w.register_workflow()
if verbosity == 2:
# give some feedback to the user
print "Workflow %s was successfully registered." % name
return
post_syncdb.connect(init_workflows)
| Fix in post_syncdb workflow registration | Fix in post_syncdb workflow registration
| Python | agpl-3.0 | michelesr/gasistafelice,befair/gasistafelice,matteo88/gasistafelice,matteo88/gasistafelice,OrlyMar/gasistafelice,kobe25/gasistafelice,michelesr/gasistafelice,kobe25/gasistafelice,befair/gasistafelice,michelesr/gasistafelice,matteo88/gasistafelice,kobe25/gasistafelice,feroda/gasistafelice,OrlyMar/gasistafelice,michelesr/gasistafelice,OrlyMar/gasistafelice,feroda/gasistafelice,OrlyMar/gasistafelice,kobe25/gasistafelice,matteo88/gasistafelice,befair/gasistafelice,feroda/gasistafelice,befair/gasistafelice,feroda/gasistafelice | python | ## Code Before:
from django.db.models.signals import post_syncdb
from gasistafelice.gas.workflow_data import workflow_dict
def init_workflows(app, created_models, verbosity, **kwargs):
app_label = app.__name__.split('.')[-2]
if app_label == 'workflows' and created_models: # `worklows` app was syncronized for the first time
# now that all necessary tables are in the DB, we can register our workflows
for name, w in workflow_dict.items():
w.register_workflow()
if verbosity == 2:
# give some feedback to the user
print "Workflow %s was successfully registered." % name
return
post_syncdb.connect(init_workflows)
## Instruction:
Fix in post_syncdb workflow registration
## Code After:
from django.db.models.signals import post_syncdb
from gasistafelice.gas.workflow_data import workflow_dict
def init_workflows(app, created_models, verbosity, **kwargs):
app_label = app.__name__.split('.')[-2]
if app_label == 'workflows' and "Workflow" in created_models: # `worklows` app was syncronized for the first time
# now that all necessary tables are in the DB, we can register our workflows
for name, w in workflow_dict.items():
w.register_workflow()
if verbosity == 2:
# give some feedback to the user
print "Workflow %s was successfully registered." % name
return
post_syncdb.connect(init_workflows)
|
9db440e31afcd877d5b3f586ccffc52ff20f56b7 | tmuxinator/survey_tool_elixir.yml | tmuxinator/survey_tool_elixir.yml |
name: survey_tool_elixir
root: ~/elixir/survey_tool_elixir
# Runs before everything. Use it to start daemons etc.
pre:
# - brew services start postgresql
# - brew services start redis
# - mailcatcher
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
pre_window:
- asdf local elixir 1.6.3
- asdf local erlang 20.2.4
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
startup_window: editor
windows:
- editor: vim
- tests: mix test.watch
- console: iex -S mix
|
name: survey_tool_elixir
root: ~/elixir/survey_tool_elixir
# Runs before everything. Use it to start daemons etc.
pre:
# - brew services start postgresql
# - brew services start redis
# - mailcatcher
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
pre_window:
- asdf local elixir 1.6.3
- asdf local erlang 20.2.4
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
startup_window: editor
windows:
- editor: vim
- tests: mix test.watch
- console: iex -S mix
- grip: grip
| Add grip to survey elixir project | Add grip to survey elixir project
| YAML | mit | paulfioravanti/dotfiles,paulfioravanti/dotfiles,paulfioravanti/dotfiles | yaml | ## Code Before:
name: survey_tool_elixir
root: ~/elixir/survey_tool_elixir
# Runs before everything. Use it to start daemons etc.
pre:
# - brew services start postgresql
# - brew services start redis
# - mailcatcher
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
pre_window:
- asdf local elixir 1.6.3
- asdf local erlang 20.2.4
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
startup_window: editor
windows:
- editor: vim
- tests: mix test.watch
- console: iex -S mix
## Instruction:
Add grip to survey elixir project
## Code After:
name: survey_tool_elixir
root: ~/elixir/survey_tool_elixir
# Runs before everything. Use it to start daemons etc.
pre:
# - brew services start postgresql
# - brew services start redis
# - mailcatcher
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
pre_window:
- asdf local elixir 1.6.3
- asdf local erlang 20.2.4
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
startup_window: editor
windows:
- editor: vim
- tests: mix test.watch
- console: iex -S mix
- grip: grip
|
fdefb568697322d4e1f8e19f8fdba90a7959e080 | src/main/resources/resources/vocabulary/sql/getMappedSourcecodes.sql | src/main/resources/resources/vocabulary/sql/getMappedSourcecodes.sql | select CONCEPT_ID, CONCEPT_NAME, ISNULL(STANDARD_CONCEPT,'N') STANDARD_CONCEPT, ISNULL(c.INVALID_REASON,'V') INVALID_REASON, CONCEPT_CODE, CONCEPT_CLASS_ID, DOMAIN_ID, VOCABULARY_ID
from @CDM_schema.concept_relationship cr
join @CDM_schema.concept c on c.concept_id = cr.concept_id_1
where cr.concept_id_2 in (@identifiers)
and relationship_id in ('Maps to')
and standard_concept IS NULL
order by domain_id, vocabulary_id
| select CONCEPT_ID, CONCEPT_NAME, ISNULL(STANDARD_CONCEPT,'N') STANDARD_CONCEPT, ISNULL(c.INVALID_REASON,'V') INVALID_REASON, CONCEPT_CODE, CONCEPT_CLASS_ID, DOMAIN_ID, VOCABULARY_ID
from @CDM_schema.concept_relationship cr
join @CDM_schema.concept c on c.concept_id = cr.concept_id_1
where cr.concept_id_2 in (@identifiers)
and cr.INVALID_REASON is null
and relationship_id in ('Maps to')
and standard_concept IS NULL
order by domain_id, vocabulary_id
| Remove invalid concept relationships when looking up mapped concepts. | Remove invalid concept relationships when looking up mapped concepts.
Fixes #85
| SQL | apache-2.0 | leeevans/WebAPI,rkboyce/WebAPI,OHDSI/WebAPI,OHDSI/WebAPI,OHDSI/WebAPI | sql | ## Code Before:
select CONCEPT_ID, CONCEPT_NAME, ISNULL(STANDARD_CONCEPT,'N') STANDARD_CONCEPT, ISNULL(c.INVALID_REASON,'V') INVALID_REASON, CONCEPT_CODE, CONCEPT_CLASS_ID, DOMAIN_ID, VOCABULARY_ID
from @CDM_schema.concept_relationship cr
join @CDM_schema.concept c on c.concept_id = cr.concept_id_1
where cr.concept_id_2 in (@identifiers)
and relationship_id in ('Maps to')
and standard_concept IS NULL
order by domain_id, vocabulary_id
## Instruction:
Remove invalid concept relationships when looking up mapped concepts.
Fixes #85
## Code After:
select CONCEPT_ID, CONCEPT_NAME, ISNULL(STANDARD_CONCEPT,'N') STANDARD_CONCEPT, ISNULL(c.INVALID_REASON,'V') INVALID_REASON, CONCEPT_CODE, CONCEPT_CLASS_ID, DOMAIN_ID, VOCABULARY_ID
from @CDM_schema.concept_relationship cr
join @CDM_schema.concept c on c.concept_id = cr.concept_id_1
where cr.concept_id_2 in (@identifiers)
and cr.INVALID_REASON is null
and relationship_id in ('Maps to')
and standard_concept IS NULL
order by domain_id, vocabulary_id
|
a4eb4066fe02a83c5281381f9577fafca9d4f37c | spec/factories/transactions.rb | spec/factories/transactions.rb | FactoryGirl.define do
factory :transaction do
sender
receiver
activity
balance
image
amount 100
end
end
| FactoryGirl.define do
factory :transaction do
sender
receiver
activity
balance
image File.new(Rails.root + 'spec/fixtures/images/rails.png')
amount 100
end
end
| Create new file in FactoryGirl image to fix tests | Create new file in FactoryGirl image to fix tests
| Ruby | mit | kabisa/kudo-o-matic,kabisa/kudo-o-matic,kabisa/kudo-o-matic | ruby | ## Code Before:
FactoryGirl.define do
factory :transaction do
sender
receiver
activity
balance
image
amount 100
end
end
## Instruction:
Create new file in FactoryGirl image to fix tests
## Code After:
FactoryGirl.define do
factory :transaction do
sender
receiver
activity
balance
image File.new(Rails.root + 'spec/fixtures/images/rails.png')
amount 100
end
end
|
65f069c82beea8e96bce780add4f6c3637a0d549 | challenge_3/python/ning/challenge_3.py | challenge_3/python/ning/challenge_3.py | def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
for item, item_count in item_counter.items():
if item_count > len(sequence) / 2:
return item
test_sequence_list = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7]
print(find_majority(test_sequence_list))
| def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
if item_counter[item] > len(sequence) / 2:
return item
test_sequence_list = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7]
print(find_majority(test_sequence_list))
| Include check majority in first loop rather than separate loop | Include check majority in first loop rather than separate loop
| Python | mit | mindm/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,popcornanachronism/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,erocs/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges | python | ## Code Before:
def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
for item, item_count in item_counter.items():
if item_count > len(sequence) / 2:
return item
test_sequence_list = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7]
print(find_majority(test_sequence_list))
## Instruction:
Include check majority in first loop rather than separate loop
## Code After:
def find_majority(sequence):
item_counter = dict()
for item in sequence:
if item not in item_counter:
item_counter[item] = 1
else:
item_counter[item] += 1
if item_counter[item] > len(sequence) / 2:
return item
test_sequence_list = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7]
print(find_majority(test_sequence_list))
|
fd5674a1b36498e5d3a597203c180ded8c57d058 | morph_proxy.py | morph_proxy.py |
def request(context, flow):
# print out all the basic information to determine what request is being made
# coming from which container
# print flow.request.method
# print flow.request.host
# print flow.request.path
# print flow.request.scheme
# print flow.request.client_conn.address[0]
# print "***"
#text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn
text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn.address[0]
print text
# print "***"
|
def response(context, flow):
text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn.address[0] + " REQUEST SIZE " + str(len(flow.request.content)) + " RESPONSE SIZE " + str(len(flow.response.content))
print text
| Add request and response size | Add request and response size
| Python | agpl-3.0 | otherchirps/morph,openaustralia/morph,otherchirps/morph,otherchirps/morph,OpenAddressesUK/morph,otherchirps/morph,otherchirps/morph,openaustralia/morph,openaustralia/morph,otherchirps/morph,otherchirps/morph,OpenAddressesUK/morph,openaustralia/morph,OpenAddressesUK/morph,openaustralia/morph,openaustralia/morph,OpenAddressesUK/morph,openaustralia/morph | python | ## Code Before:
def request(context, flow):
# print out all the basic information to determine what request is being made
# coming from which container
# print flow.request.method
# print flow.request.host
# print flow.request.path
# print flow.request.scheme
# print flow.request.client_conn.address[0]
# print "***"
#text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn
text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn.address[0]
print text
# print "***"
## Instruction:
Add request and response size
## Code After:
def response(context, flow):
text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn.address[0] + " REQUEST SIZE " + str(len(flow.request.content)) + " RESPONSE SIZE " + str(len(flow.response.content))
print text
|
c42b8cf5fef2ed392bbc5bde73dfca6d482ba198 | website/about/python-about.tpl.php | website/about/python-about.tpl.php | <?=$Version;?>
<p>Home Page: <a href="http://www.python.org/">http://www.python.org/</a></p>
<p>Download: <a href="http://www.python.org/download/">http://www.python.org/download/</a></p>
| <?=$Version;?>
<p>Paul Grahm's <a href="http://paulgraham.com/pypar.html">Essay</a></p>
<p>Home Page: <a href="http://www.python.org/">http://www.python.org/</a></p>
<p>Download: <a href="http://www.python.org/download/">http://www.python.org/download/</a></p>
| Add a Paul Graham's note about Python. | Add a Paul Graham's note about Python.
| PHP | bsd-3-clause | kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout,kragen/shootout | php | ## Code Before:
<?=$Version;?>
<p>Home Page: <a href="http://www.python.org/">http://www.python.org/</a></p>
<p>Download: <a href="http://www.python.org/download/">http://www.python.org/download/</a></p>
## Instruction:
Add a Paul Graham's note about Python.
## Code After:
<?=$Version;?>
<p>Paul Grahm's <a href="http://paulgraham.com/pypar.html">Essay</a></p>
<p>Home Page: <a href="http://www.python.org/">http://www.python.org/</a></p>
<p>Download: <a href="http://www.python.org/download/">http://www.python.org/download/</a></p>
|
8fe291d7b8b28b7e9ff06a55d322055a23989145 | spec/models/model_spec.rb | spec/models/model_spec.rb | describe Model do
before(:each) do
Webtrends::Event.stub(:track)
end
context 'successfull load' do
context 'after validation' do
it 'should respond to track event' do
subject.some_attribute = 'cupcake'
expect(subject).to receive(:track_event)
subject.save
end
end
end
context 'usuccessfull load' do
context 'after validation' do
it 'should not respond to track event' do
expect(subject).to_not receive(:track_event)
subject.save
end
end
end
end | describe Model do
context 'successfull load' do
context 'after validation' do
it 'should respond to track event' do
subject.some_attribute = 'cupcake'
expect_any_instance_of(Webtrends::Event).to receive(:track)
subject.save
end
end
end
context 'usuccessfull load' do
context 'after validation' do
it 'should not respond to track event' do
expect_any_instance_of(Webtrends::Event).to_not receive(:track)
subject.save
end
end
end
end | Change expect to use expect_any_instance_of | Change expect to use expect_any_instance_of
* Remove stub track to use expect_any_instance_of
| Ruby | mit | amaabca/webtrends-rails | ruby | ## Code Before:
describe Model do
before(:each) do
Webtrends::Event.stub(:track)
end
context 'successfull load' do
context 'after validation' do
it 'should respond to track event' do
subject.some_attribute = 'cupcake'
expect(subject).to receive(:track_event)
subject.save
end
end
end
context 'usuccessfull load' do
context 'after validation' do
it 'should not respond to track event' do
expect(subject).to_not receive(:track_event)
subject.save
end
end
end
end
## Instruction:
Change expect to use expect_any_instance_of
* Remove stub track to use expect_any_instance_of
## Code After:
describe Model do
context 'successfull load' do
context 'after validation' do
it 'should respond to track event' do
subject.some_attribute = 'cupcake'
expect_any_instance_of(Webtrends::Event).to receive(:track)
subject.save
end
end
end
context 'usuccessfull load' do
context 'after validation' do
it 'should not respond to track event' do
expect_any_instance_of(Webtrends::Event).to_not receive(:track)
subject.save
end
end
end
end |
0a12d964049c4a83695bb334a627c98edaee3b9c | src/package.json | src/package.json | {
"name": "dash-ci",
"version": "1.0.0",
"description": "Dashboard for continuous integration",
"main": "index.html",
"author": "Marcos Junior <junalmeida@gmail.com>",
"license": "MIT",
"dependencies": {
"angular": "1.6.9",
"angular-animate": "1.6.9",
"angular-material": "1.1.7",
"angular-widget-grid": "0.3.0",
"angular-aria": "1.6.9",
"angular-css": "1.0.8",
"angular-resource": "1.6.9",
"jquery": "3.3.1",
"moment": "2.21.0",
"multiplexjs": "1.0.0"
},
"scripts": { "start": "http-server -a 127.0.0.1 -p 8080" },
"devDependencies": {
"@types/angular": "1.6.43",
"@types/jquery": "3.3.1",
"@types/angular-material": "~1.1.58",
"@types/angular-resource": "1.5.14",
"http-server": "0.11.1",
"typescript": "2.7.2"
}
} | {
"name": "dash-ci",
"version": "1.0.0",
"description": "Dashboard for continuous integration",
"main": "index.html",
"author": "Marcos Junior <junalmeida@gmail.com>",
"license": "MIT",
"dependencies": {
"angular": "1.6.9",
"angular-animate": "1.6.9",
"angular-material": "1.1.7",
"angular-widget-grid": "0.3.0",
"angular-aria": "1.6.9",
"angular-css": "1.0.8",
"angular-resource": "1.6.9",
"jquery": "3.3.1",
"moment": "2.21.0",
"multiplexjs": "1.0.0"
},
"scripts": {
"start": "http-server -a 127.0.0.1 -p 8080",
"build": "./node_modules/.bin/tsc --sourceMap"
},
"devDependencies": {
"@types/angular": "1.6.43",
"@types/jquery": "3.3.1",
"@types/angular-material": "~1.1.58",
"@types/angular-resource": "1.5.14",
"http-server": "0.11.1",
"typescript": "2.7.2"
}
}
| Add npm script to build TypeScript with source map | Add npm script to build TypeScript with source map
| JSON | mit | junalmeida/dash-ci,junalmeida/dash-ci,junalmeida/dash-ci,junalmeida/dash-ci | json | ## Code Before:
{
"name": "dash-ci",
"version": "1.0.0",
"description": "Dashboard for continuous integration",
"main": "index.html",
"author": "Marcos Junior <junalmeida@gmail.com>",
"license": "MIT",
"dependencies": {
"angular": "1.6.9",
"angular-animate": "1.6.9",
"angular-material": "1.1.7",
"angular-widget-grid": "0.3.0",
"angular-aria": "1.6.9",
"angular-css": "1.0.8",
"angular-resource": "1.6.9",
"jquery": "3.3.1",
"moment": "2.21.0",
"multiplexjs": "1.0.0"
},
"scripts": { "start": "http-server -a 127.0.0.1 -p 8080" },
"devDependencies": {
"@types/angular": "1.6.43",
"@types/jquery": "3.3.1",
"@types/angular-material": "~1.1.58",
"@types/angular-resource": "1.5.14",
"http-server": "0.11.1",
"typescript": "2.7.2"
}
}
## Instruction:
Add npm script to build TypeScript with source map
## Code After:
{
"name": "dash-ci",
"version": "1.0.0",
"description": "Dashboard for continuous integration",
"main": "index.html",
"author": "Marcos Junior <junalmeida@gmail.com>",
"license": "MIT",
"dependencies": {
"angular": "1.6.9",
"angular-animate": "1.6.9",
"angular-material": "1.1.7",
"angular-widget-grid": "0.3.0",
"angular-aria": "1.6.9",
"angular-css": "1.0.8",
"angular-resource": "1.6.9",
"jquery": "3.3.1",
"moment": "2.21.0",
"multiplexjs": "1.0.0"
},
"scripts": {
"start": "http-server -a 127.0.0.1 -p 8080",
"build": "./node_modules/.bin/tsc --sourceMap"
},
"devDependencies": {
"@types/angular": "1.6.43",
"@types/jquery": "3.3.1",
"@types/angular-material": "~1.1.58",
"@types/angular-resource": "1.5.14",
"http-server": "0.11.1",
"typescript": "2.7.2"
}
}
|
bc7ed292d2ab30a56442bb8f4ee7bc0e54ce48ff | server/server.go | server/server.go | package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("../ui/")))
http.ListenAndServe(":8080", nil)
}
| package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("../ui/")))
http.HandleFunc("/edit", EditPageHandler)
http.HandleFunc("/save", SavePageHandler)
http.HandleFunc("/delete", DeletePageHandler)
http.ListenAndServe(":8080", nil)
}
func EditPageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The edit handler"))
}
func SavePageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The save handler"))
}
func DeletePageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The delete handler"))
}
| Add stubs for various request handlers | Add stubs for various request handlers
| Go | bsd-2-clause | ambidextrousTx/RWiki,ambidextrousTx/RWiki | go | ## Code Before:
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("../ui/")))
http.ListenAndServe(":8080", nil)
}
## Instruction:
Add stubs for various request handlers
## Code After:
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("../ui/")))
http.HandleFunc("/edit", EditPageHandler)
http.HandleFunc("/save", SavePageHandler)
http.HandleFunc("/delete", DeletePageHandler)
http.ListenAndServe(":8080", nil)
}
func EditPageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The edit handler"))
}
func SavePageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The save handler"))
}
func DeletePageHandler(rw http.ResponseWriter, r *http.Request) {
rw.Write([]byte("The delete handler"))
}
|
b96084fea6fb5feddffed89fa323baffe4e2ea97 | README.md | README.md | Javascript library for managing Web Access Control ACLs / permissions.
## Usage
```js
var acl = require('solid-permissions')
```
|
[](https://github.com/solid/solid)
[](https://npm.im/solid-permissions)
[](https://travis-ci.org/solid/solid-permissions)
Javascript library for managing [Web Access
Control](https://github.com/solid/web-access-control-spec) ACLs / permissions.
## Usage
```js
var rdf = require('rdflib')
var webClient = require('solid-web-client')
var acl = require('solid-permissions')
```
| Add nmp and travis badges | Add nmp and travis badges
| Markdown | mit | solid/solid-permissions | markdown | ## Code Before:
Javascript library for managing Web Access Control ACLs / permissions.
## Usage
```js
var acl = require('solid-permissions')
```
## Instruction:
Add nmp and travis badges
## Code After:
[](https://github.com/solid/solid)
[](https://npm.im/solid-permissions)
[](https://travis-ci.org/solid/solid-permissions)
Javascript library for managing [Web Access
Control](https://github.com/solid/web-access-control-spec) ACLs / permissions.
## Usage
```js
var rdf = require('rdflib')
var webClient = require('solid-web-client')
var acl = require('solid-permissions')
```
|
090a7c5f053b9350966bf364b8c14b1fe0e100d8 | web/controllers/auth_controller.ex | web/controllers/auth_controller.ex | defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user = Repo.get_by(User, email: user_info["email"])
user_params = User.build_user_from_oauth(user_info)
user = if !user do
changeset = User.changeset(%User{}, user_params)
Repo.insert!(changeset)
else
changeset = User.changeset(user, user_params)
Repo.update!(changeset)
end
user = Map.delete(user, :__meta__)
user = Map.delete(user, :__struct__)
conn = put_session(conn, :current_user, user)
redirect conn, to: get_session(conn, "requested_endpoint") || "/"
end
defp authorize_url! do
Google.authorize_url!(scope: "email profile")
end
end
| defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user_params = User.build_user_from_oauth(user_info)
{:ok, user} =
case Repo.get_by(User, email: user_info["email"]) do
nil -> %User{}
user_from_db -> user_from_db
end
|> User.changeset(user_params)
|> Repo.insert_or_update
user =
user
|> Map.delete(:__meta__)
|> Map.delete(:__struct__)
conn = put_session(conn, :current_user, user)
redirect conn, to: get_session(conn, "requested_endpoint") || "/"
end
defp authorize_url! do
Google.authorize_url!(scope: "email profile")
end
end
| Modify AuthController to use insert_or_update | Modify AuthController to use insert_or_update
Work on #136
| Elixir | mit | stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro | elixir | ## Code Before:
defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user = Repo.get_by(User, email: user_info["email"])
user_params = User.build_user_from_oauth(user_info)
user = if !user do
changeset = User.changeset(%User{}, user_params)
Repo.insert!(changeset)
else
changeset = User.changeset(user, user_params)
Repo.update!(changeset)
end
user = Map.delete(user, :__meta__)
user = Map.delete(user, :__struct__)
conn = put_session(conn, :current_user, user)
redirect conn, to: get_session(conn, "requested_endpoint") || "/"
end
defp authorize_url! do
Google.authorize_url!(scope: "email profile")
end
end
## Instruction:
Modify AuthController to use insert_or_update
Work on #136
## Code After:
defmodule RemoteRetro.AuthController do
use RemoteRetro.Web, :controller
alias RemoteRetro.OAuth.Google
alias RemoteRetro.User
def index(conn, _params) do
redirect conn, external: authorize_url!()
end
def callback(conn, %{"code" => code}) do
user_info = Google.get_user_info!(code)
user_params = User.build_user_from_oauth(user_info)
{:ok, user} =
case Repo.get_by(User, email: user_info["email"]) do
nil -> %User{}
user_from_db -> user_from_db
end
|> User.changeset(user_params)
|> Repo.insert_or_update
user =
user
|> Map.delete(:__meta__)
|> Map.delete(:__struct__)
conn = put_session(conn, :current_user, user)
redirect conn, to: get_session(conn, "requested_endpoint") || "/"
end
defp authorize_url! do
Google.authorize_url!(scope: "email profile")
end
end
|
d18fd99dce6660014612da0dcb3f2dfab2895e9e | ruby-sun-times.gemspec | ruby-sun-times.gemspec | $LOAD_PATH << File.expand_path('lib', File.dirname(__FILE__))
require 'sun_times/version'
Gem::Specification.new do |s|
s.name = 'ruby-sun-times'
s.summary = 'Calculate sunrise and sunset times for a given time and place'
s.version = SunTimes::VERSION::STRING
s.homepage = 'https://github.com/joeyates/ruby-sun-times'
s.author = 'Joe Yates'
s.email = 'joe.g.yates@gmail.com'
s.files = `git ls-files -z`.split("\0")
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
s.test_files = s.files.grep(%r{^spec/})
s.require_paths = ['lib']
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec'
end
| $LOAD_PATH << File.expand_path('lib', File.dirname(__FILE__))
require 'sun_times/version'
Gem::Specification.new do |spec|
spec.name = 'ruby-sun-times'
spec.summary = 'Calculate sunrise and sunset times for a given time and place'
spec.version = SunTimes::VERSION::STRING
spec.homepage = 'https://github.com/joeyates/ruby-sun-times'
spec.author = 'Joe Yates'
spec.email = 'joe.g.yates@gmail.com'
spec.files = `git ls-files -z`.split("\0")
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ['lib']
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rspec'
end
| Use a more descriptive variable name | Use a more descriptive variable name
| Ruby | mit | joeyates/ruby-sun-times | ruby | ## Code Before:
$LOAD_PATH << File.expand_path('lib', File.dirname(__FILE__))
require 'sun_times/version'
Gem::Specification.new do |s|
s.name = 'ruby-sun-times'
s.summary = 'Calculate sunrise and sunset times for a given time and place'
s.version = SunTimes::VERSION::STRING
s.homepage = 'https://github.com/joeyates/ruby-sun-times'
s.author = 'Joe Yates'
s.email = 'joe.g.yates@gmail.com'
s.files = `git ls-files -z`.split("\0")
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
s.test_files = s.files.grep(%r{^spec/})
s.require_paths = ['lib']
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec'
end
## Instruction:
Use a more descriptive variable name
## Code After:
$LOAD_PATH << File.expand_path('lib', File.dirname(__FILE__))
require 'sun_times/version'
Gem::Specification.new do |spec|
spec.name = 'ruby-sun-times'
spec.summary = 'Calculate sunrise and sunset times for a given time and place'
spec.version = SunTimes::VERSION::STRING
spec.homepage = 'https://github.com/joeyates/ruby-sun-times'
spec.author = 'Joe Yates'
spec.email = 'joe.g.yates@gmail.com'
spec.files = `git ls-files -z`.split("\0")
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ['lib']
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rspec'
end
|
8b5f58b245a8752cf1e5738edd993367363c9753 | .lgtm.yml | .lgtm.yml | path_classifiers:
library:
- app/private
- vagrant/shake.js
queries:
-
exclude: js/missing-token-validation
| path_classifiers:
library:
- frontend/src/assets/private
queries:
-
exclude: js/missing-token-validation
| Update ignored code for LGTM analysis | Update ignored code for LGTM analysis | YAML | mit | bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop | yaml | ## Code Before:
path_classifiers:
library:
- app/private
- vagrant/shake.js
queries:
-
exclude: js/missing-token-validation
## Instruction:
Update ignored code for LGTM analysis
## Code After:
path_classifiers:
library:
- frontend/src/assets/private
queries:
-
exclude: js/missing-token-validation
|
386bd63f8d21fde74018815d410179758f5241cf | server/store/requests.js | server/store/requests.js | const redis = require('./redis');
const config = require('./config');
const getRequest = async (requestId) => {
// Set TTL for request
redis.expire(`requests:${requestId}`, config('requests_ttl'));
return await redis.hgetallAsync(`requests:${requestId}`);
};
const createRequest = async (requestDetails) => {
// get new unique id for request
const requestId = await redis.incrAsync('next_request_id');
// create a new request entry in Redis
const {user_id, pickup, dropoff, requested_pickup_time, size, weight} = requestDetails;
const [pickup_lat, pickup_long] = pickup.split(',');
const [dropoff_lat, dropoff_long] = dropoff.split(',');
redis.hmsetAsync(`requests:${requestId}`,
'user_id', user_id,
'pickup_lat', pickup_lat,
'pickup_long', pickup_long,
'dropoff_lat', dropoff_lat,
'dropoff_long', dropoff_long,
'requested_pickup_time', requested_pickup_time,
'size', size,
'weight', weight,
);
// Set TTL for request
redis.expire(`requests:${requestId}`, 43200);
return requestId;
};
const deleteRequest = async (requestId) => {
return await redis.del(`requests:${requestId}`);
};
module.exports = {
createRequest,
getRequest,
deleteRequest
};
| const redis = require('./redis');
const config = require('../config/index.js');
const getRequest = async (requestId) => {
// Set TTL for request
redis.expire(`requests:${requestId}`, config('requests_ttl'));
return await redis.hgetallAsync(`requests:${requestId}`);
};
const createRequest = async (requestDetails) => {
// get new unique id for request
const requestId = await redis.incrAsync('next_request_id');
// create a new request entry in Redis
const {user_id, pickup, dropoff, requested_pickup_time, size, weight} = requestDetails;
const [pickup_lat, pickup_long] = pickup.split(',');
const [dropoff_lat, dropoff_long] = dropoff.split(',');
redis.hmsetAsync(`requests:${requestId}`,
'user_id', user_id,
'pickup_lat', pickup_lat,
'pickup_long', pickup_long,
'dropoff_lat', dropoff_lat,
'dropoff_long', dropoff_long,
'requested_pickup_time', requested_pickup_time,
'size', size,
'weight', weight,
);
// Set TTL for request
redis.expire(`requests:${requestId}`, 43200);
return requestId;
};
const deleteRequest = async (requestId) => {
return await redis.del(`requests:${requestId}`);
};
module.exports = {
createRequest,
getRequest,
deleteRequest
};
| Fix dependency inclusion for require statement | Fix dependency inclusion for require statement
| JavaScript | mit | DAVFoundation/missioncontrol,DAVFoundation/missioncontrol,DAVFoundation/missioncontrol | javascript | ## Code Before:
const redis = require('./redis');
const config = require('./config');
const getRequest = async (requestId) => {
// Set TTL for request
redis.expire(`requests:${requestId}`, config('requests_ttl'));
return await redis.hgetallAsync(`requests:${requestId}`);
};
const createRequest = async (requestDetails) => {
// get new unique id for request
const requestId = await redis.incrAsync('next_request_id');
// create a new request entry in Redis
const {user_id, pickup, dropoff, requested_pickup_time, size, weight} = requestDetails;
const [pickup_lat, pickup_long] = pickup.split(',');
const [dropoff_lat, dropoff_long] = dropoff.split(',');
redis.hmsetAsync(`requests:${requestId}`,
'user_id', user_id,
'pickup_lat', pickup_lat,
'pickup_long', pickup_long,
'dropoff_lat', dropoff_lat,
'dropoff_long', dropoff_long,
'requested_pickup_time', requested_pickup_time,
'size', size,
'weight', weight,
);
// Set TTL for request
redis.expire(`requests:${requestId}`, 43200);
return requestId;
};
const deleteRequest = async (requestId) => {
return await redis.del(`requests:${requestId}`);
};
module.exports = {
createRequest,
getRequest,
deleteRequest
};
## Instruction:
Fix dependency inclusion for require statement
## Code After:
const redis = require('./redis');
const config = require('../config/index.js');
const getRequest = async (requestId) => {
// Set TTL for request
redis.expire(`requests:${requestId}`, config('requests_ttl'));
return await redis.hgetallAsync(`requests:${requestId}`);
};
const createRequest = async (requestDetails) => {
// get new unique id for request
const requestId = await redis.incrAsync('next_request_id');
// create a new request entry in Redis
const {user_id, pickup, dropoff, requested_pickup_time, size, weight} = requestDetails;
const [pickup_lat, pickup_long] = pickup.split(',');
const [dropoff_lat, dropoff_long] = dropoff.split(',');
redis.hmsetAsync(`requests:${requestId}`,
'user_id', user_id,
'pickup_lat', pickup_lat,
'pickup_long', pickup_long,
'dropoff_lat', dropoff_lat,
'dropoff_long', dropoff_long,
'requested_pickup_time', requested_pickup_time,
'size', size,
'weight', weight,
);
// Set TTL for request
redis.expire(`requests:${requestId}`, 43200);
return requestId;
};
const deleteRequest = async (requestId) => {
return await redis.del(`requests:${requestId}`);
};
module.exports = {
createRequest,
getRequest,
deleteRequest
};
|
a7993f97013314ae1f2f6802252659d4960d6270 | Kiwi/Config.hs | Kiwi/Config.hs | {-# LANGUAGE DeriveDataTypeable #-}
module Kiwi.Config where
import System.Console.CmdArgs (cmdArgs, Data, Typeable)
data Args = Args
{ wikidir :: FilePath
, port :: Int
, host :: String
}
deriving (Show, Data, Typeable)
defaultArgs :: Args
defaultArgs = Args
{ wikidir = "./wiki"
, port = 8000
, host = "localhost"
}
args :: IO Args
args = cmdArgs defaultArgs
| {-# LANGUAGE DeriveDataTypeable #-}
module Kiwi.Config where
import System.Environment
import System.Console.CmdArgs ((&=), cmdArgs, Data, details, help, program,
summary, Typeable)
data Args = Args
{ wikidir :: FilePath
, port :: Int
, host :: String
}
deriving (Show, Data, Typeable)
defaultArgs :: Args
defaultArgs = Args
{ wikidir = "./wiki" &= help "Wiki directory"
, port = 8000 &= help "Listening port"
, host = "localhost" &= help "Listening host"
}
&= summary "kiwi v0.1"
&= details ["More info at http://github.com/acieroid/kiwi"]
args :: IO Args
args = getProgName >>= (\p -> cmdArgs (defaultArgs &= program p))
| Add more information on command line arguments | Add more information on command line arguments
| Haskell | bsd-3-clause | acieroid/kiwi | haskell | ## Code Before:
{-# LANGUAGE DeriveDataTypeable #-}
module Kiwi.Config where
import System.Console.CmdArgs (cmdArgs, Data, Typeable)
data Args = Args
{ wikidir :: FilePath
, port :: Int
, host :: String
}
deriving (Show, Data, Typeable)
defaultArgs :: Args
defaultArgs = Args
{ wikidir = "./wiki"
, port = 8000
, host = "localhost"
}
args :: IO Args
args = cmdArgs defaultArgs
## Instruction:
Add more information on command line arguments
## Code After:
{-# LANGUAGE DeriveDataTypeable #-}
module Kiwi.Config where
import System.Environment
import System.Console.CmdArgs ((&=), cmdArgs, Data, details, help, program,
summary, Typeable)
data Args = Args
{ wikidir :: FilePath
, port :: Int
, host :: String
}
deriving (Show, Data, Typeable)
defaultArgs :: Args
defaultArgs = Args
{ wikidir = "./wiki" &= help "Wiki directory"
, port = 8000 &= help "Listening port"
, host = "localhost" &= help "Listening host"
}
&= summary "kiwi v0.1"
&= details ["More info at http://github.com/acieroid/kiwi"]
args :: IO Args
args = getProgName >>= (\p -> cmdArgs (defaultArgs &= program p))
|
2e1216e70acc23fcd68888d8c7f0bb4bc39bb630 | lib/core_ext/patch-remove_commit_search_from_form.rb | lib/core_ext/patch-remove_commit_search_from_form.rb | module ActionView
module Helpers
module TagHelper
# submit_tag "Search" generates a submit tag that adds "commit=Search" to the URL,
# which is ugly and unnecessary. Override TagHelper#tag and remove this globally.
alias_method :orig_tag, :tag
def tag(name, options = nil, open = false, escape = true)
if name == :input && options['type'] == 'submit' && options['name'] == 'commit' && options['value'] == 'Search'
options.delete 'name'
end
orig_tag name, options, open, escape
end
end
end
end
| module ActionView
module Helpers
module TagHelper
# submit_tag "Search" generates a submit tag that adds "commit=Search" to the URL,
# which is ugly and unnecessary. Override TagHelper#tag and remove this globally.
def tag_with_remove_commit_search(name, options = nil, open = false, escape = true)
if name == :input && options['type'] == 'submit' && options['name'] == 'commit' && options['value'] == 'Search'
options.delete 'name'
end
tag_without_remove_commit_search name, options, open, escape
end
alias_method_chain :tag, :remove_commit_search
end
end
end
| Use method chaining instead of orig_ prefix. | Use method chaining instead of orig_ prefix.
| Ruby | isc | moebooru/moebooru,moebooru/moebooru,nanaya/moebooru,moebooru/moebooru,nanaya/moebooru,euank/moebooru-thin,nanaya/moebooru,nanaya/moebooru,euank/moebooru-thin,euank/moebooru-thin,nanaya/moebooru,euank/moebooru-thin,moebooru/moebooru,euank/moebooru-thin,moebooru/moebooru | ruby | ## Code Before:
module ActionView
module Helpers
module TagHelper
# submit_tag "Search" generates a submit tag that adds "commit=Search" to the URL,
# which is ugly and unnecessary. Override TagHelper#tag and remove this globally.
alias_method :orig_tag, :tag
def tag(name, options = nil, open = false, escape = true)
if name == :input && options['type'] == 'submit' && options['name'] == 'commit' && options['value'] == 'Search'
options.delete 'name'
end
orig_tag name, options, open, escape
end
end
end
end
## Instruction:
Use method chaining instead of orig_ prefix.
## Code After:
module ActionView
module Helpers
module TagHelper
# submit_tag "Search" generates a submit tag that adds "commit=Search" to the URL,
# which is ugly and unnecessary. Override TagHelper#tag and remove this globally.
def tag_with_remove_commit_search(name, options = nil, open = false, escape = true)
if name == :input && options['type'] == 'submit' && options['name'] == 'commit' && options['value'] == 'Search'
options.delete 'name'
end
tag_without_remove_commit_search name, options, open, escape
end
alias_method_chain :tag, :remove_commit_search
end
end
end
|
606f186c67f4e56b988e0dc43180fbc63a8cd512 | subclass-error.js | subclass-error.js | /*global define*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory)
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory()
} else {
// Browser globals (root is window)
root.SubclassError = factory()
}
}(this, function () {
var ErrorInheritor = function () {}
function SubclassError (name, BaseError, props) {
if (name === undefined) throw new Error('Name of subclass must be provided as first argument.')
if (!(BaseError instanceof Function)) {
props = BaseError
BaseError = Error
}
ErrorInheritor.prototype = BaseError.prototype
var e = function (message) {
this.message = message
// stack "hack"
var goodStack = (new Error()).stack.split('\n')
goodStack.splice(1, 1)
goodStack[0] = name
if (message) goodStack[0] += ': ' + message
this.stack = goodStack.join('\n')
}
e.prototype = new ErrorInheritor()
e.prototype.constructor = e
e.prototype.name = name
for (var prop in props) {
e.prototype[prop] = props[prop]
}
return e
}
return SubclassError
}))
| /*global define*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory)
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory()
} else {
// Browser globals (root is window)
root.SubclassError = factory()
}
}(this, function () {
var ErrorInheritor = function () {}
function SubclassError (name, BaseError, props) {
if (name === undefined) throw new Error('Name of subclass must be provided as first argument.')
if (!(BaseError instanceof Function)) {
props = BaseError
BaseError = Error
}
ErrorInheritor.prototype = BaseError.prototype
var e = function (message) {
if (message) this.message = message
// stack "hack"
var goodStack = (new Error()).stack.split('\n')
goodStack.splice(1, 1)
goodStack[0] = name
if (message) goodStack[0] += ': ' + message
this.stack = goodStack.join('\n')
}
e.prototype = new ErrorInheritor()
e.prototype.constructor = e
e.prototype.name = name
for (var prop in props) {
e.prototype[prop] = props[prop]
}
return e
}
return SubclassError
}))
| Allow `message` to be inherited from prototype | Allow `message` to be inherited from prototype
| JavaScript | mit | dasilvacontin/subclass-error | javascript | ## Code Before:
/*global define*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory)
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory()
} else {
// Browser globals (root is window)
root.SubclassError = factory()
}
}(this, function () {
var ErrorInheritor = function () {}
function SubclassError (name, BaseError, props) {
if (name === undefined) throw new Error('Name of subclass must be provided as first argument.')
if (!(BaseError instanceof Function)) {
props = BaseError
BaseError = Error
}
ErrorInheritor.prototype = BaseError.prototype
var e = function (message) {
this.message = message
// stack "hack"
var goodStack = (new Error()).stack.split('\n')
goodStack.splice(1, 1)
goodStack[0] = name
if (message) goodStack[0] += ': ' + message
this.stack = goodStack.join('\n')
}
e.prototype = new ErrorInheritor()
e.prototype.constructor = e
e.prototype.name = name
for (var prop in props) {
e.prototype[prop] = props[prop]
}
return e
}
return SubclassError
}))
## Instruction:
Allow `message` to be inherited from prototype
## Code After:
/*global define*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory)
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory()
} else {
// Browser globals (root is window)
root.SubclassError = factory()
}
}(this, function () {
var ErrorInheritor = function () {}
function SubclassError (name, BaseError, props) {
if (name === undefined) throw new Error('Name of subclass must be provided as first argument.')
if (!(BaseError instanceof Function)) {
props = BaseError
BaseError = Error
}
ErrorInheritor.prototype = BaseError.prototype
var e = function (message) {
if (message) this.message = message
// stack "hack"
var goodStack = (new Error()).stack.split('\n')
goodStack.splice(1, 1)
goodStack[0] = name
if (message) goodStack[0] += ': ' + message
this.stack = goodStack.join('\n')
}
e.prototype = new ErrorInheritor()
e.prototype.constructor = e
e.prototype.name = name
for (var prop in props) {
e.prototype[prop] = props[prop]
}
return e
}
return SubclassError
}))
|
570b04a2a5e299089830a43cf0f3a7d1ca392a89 | lib/tests/module.js | lib/tests/module.js | var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, module, suite, config, tests) {
suite = Mocha.Suite.create(suite, module.slug);
tests = _.extend({
exists: function () {
return browser
.$('#' + module.slug).isDisplayed()
.should.eventually.be.ok;
},
'has a title': function () {
return browser
.$('#' + module.slug + ' h2').text()
.should.eventually.equal(module.title);
}
}, tests);
_.each(tests, function (test, key) {
suite.addTest(new Mocha.Test(key, test));
});
try { // to load a test suite corresponding with the module-type
var moduleTests = require('./modules/' + module['module-type']);
moduleTests(browser, module, suite, config);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
suite.addTest(new Mocha.Test('no test suite is defined for module-type ' + module['module-type']));
}
}
return suite;
};
| var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, module, suite, config, tests) {
suite = Mocha.Suite.create(suite, module.slug);
tests = _.extend({
exists: function () {
return browser
.$('#' + module.slug).isDisplayed()
.should.eventually.be.ok;
},
'contains no error message': function () {
return browser
.hasElementByCssSelector('#' + module.slug + ' h2.error')
.should.eventually.not.be.ok;
},
'has a title': function () {
return browser
.$('#' + module.slug + ' h2').text()
.should.eventually.equal(module.title);
}
}, tests);
_.each(tests, function (test, key) {
suite.addTest(new Mocha.Test(key, test));
});
try { // to load a test suite corresponding with the module-type
var moduleTests = require('./modules/' + module['module-type']);
moduleTests(browser, module, suite, config);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
suite.addTest(new Mocha.Test('no test suite is defined for module-type ' + module['module-type']));
}
}
return suite;
};
| Add tests for the non-existence of error messages | Add tests for the non-existence of error messages
| JavaScript | mit | alphagov/cheapseats | javascript | ## Code Before:
var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, module, suite, config, tests) {
suite = Mocha.Suite.create(suite, module.slug);
tests = _.extend({
exists: function () {
return browser
.$('#' + module.slug).isDisplayed()
.should.eventually.be.ok;
},
'has a title': function () {
return browser
.$('#' + module.slug + ' h2').text()
.should.eventually.equal(module.title);
}
}, tests);
_.each(tests, function (test, key) {
suite.addTest(new Mocha.Test(key, test));
});
try { // to load a test suite corresponding with the module-type
var moduleTests = require('./modules/' + module['module-type']);
moduleTests(browser, module, suite, config);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
suite.addTest(new Mocha.Test('no test suite is defined for module-type ' + module['module-type']));
}
}
return suite;
};
## Instruction:
Add tests for the non-existence of error messages
## Code After:
var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, module, suite, config, tests) {
suite = Mocha.Suite.create(suite, module.slug);
tests = _.extend({
exists: function () {
return browser
.$('#' + module.slug).isDisplayed()
.should.eventually.be.ok;
},
'contains no error message': function () {
return browser
.hasElementByCssSelector('#' + module.slug + ' h2.error')
.should.eventually.not.be.ok;
},
'has a title': function () {
return browser
.$('#' + module.slug + ' h2').text()
.should.eventually.equal(module.title);
}
}, tests);
_.each(tests, function (test, key) {
suite.addTest(new Mocha.Test(key, test));
});
try { // to load a test suite corresponding with the module-type
var moduleTests = require('./modules/' + module['module-type']);
moduleTests(browser, module, suite, config);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
suite.addTest(new Mocha.Test('no test suite is defined for module-type ' + module['module-type']));
}
}
return suite;
};
|
082a50129ba598fd2f5e7f0d9fafd0113415e8b0 | courses/paa/projects/papini-bani/README.md | courses/paa/projects/papini-bani/README.md |
This is the folder that contains project ideas and proposal for
students Papini and Bani, in order to pass their PAA exam.
The proposal can be read [here]. Their work is versioned at [GitHub],
where there's a work-in-progress [notebook].
Event log:
- **December 2015, 22**: make a proposal for the project: a study of the average number of checks in the
standard Quicksort implementation, with the pivot is the right-most element. Also, a little
discussion happen about difficulties and ideas.
[here]:http://nbviewer.jupyter.org/github/massimo-nocentini/PhD/blob/master/courses/paa/projects/papini-bani/Papini%20and%20Bani%27s%20PAA%20Project%20proposal.ipynb?flush_cache=true
[GitHub]:https://github.com/oddlord/paa-project
[notebook]:http://nbviewer.jupyter.org/github/oddlord/paa-project/blob/master/Progetto%20PAA.ipynb?flush_cache=true
|
This is the folder that contains project ideas and proposal for
students Papini and Bani, in order to pass their PAA exam.
The proposal can be read [here]. Their work is versioned at [GitHub],
where there's a work-in-progress [notebook].
Event log:
- **December 2015, 22**: make a proposal for the project: a study of the average number of checks in the
standard Quicksort implementation, with the pivot is the right-most element. Also, a little
discussion happen about difficulties and ideas.
[here]:http://nbviewer.jupyter.org/github/massimo-nocentini/PhD/blob/master/courses/paa/projects/papini-bani/Papini%20and%20Bani%27s%20PAA%20Project%20proposal.ipynb?flush_cache=true
[GitHub]:https://github.com/oddlord/paa-project
[notebook]:http://nbviewer.jupyter.org/github/oddlord/paa-project/blob/master/PAA%20Project.ipynb?flush_cache=true
| Change the reference to the notebook since they changed its name. | Change the reference to the notebook since they changed its name.
| Markdown | apache-2.0 | massimo-nocentini/PhD,massimo-nocentini/recurrences-unfolding | markdown | ## Code Before:
This is the folder that contains project ideas and proposal for
students Papini and Bani, in order to pass their PAA exam.
The proposal can be read [here]. Their work is versioned at [GitHub],
where there's a work-in-progress [notebook].
Event log:
- **December 2015, 22**: make a proposal for the project: a study of the average number of checks in the
standard Quicksort implementation, with the pivot is the right-most element. Also, a little
discussion happen about difficulties and ideas.
[here]:http://nbviewer.jupyter.org/github/massimo-nocentini/PhD/blob/master/courses/paa/projects/papini-bani/Papini%20and%20Bani%27s%20PAA%20Project%20proposal.ipynb?flush_cache=true
[GitHub]:https://github.com/oddlord/paa-project
[notebook]:http://nbviewer.jupyter.org/github/oddlord/paa-project/blob/master/Progetto%20PAA.ipynb?flush_cache=true
## Instruction:
Change the reference to the notebook since they changed its name.
## Code After:
This is the folder that contains project ideas and proposal for
students Papini and Bani, in order to pass their PAA exam.
The proposal can be read [here]. Their work is versioned at [GitHub],
where there's a work-in-progress [notebook].
Event log:
- **December 2015, 22**: make a proposal for the project: a study of the average number of checks in the
standard Quicksort implementation, with the pivot is the right-most element. Also, a little
discussion happen about difficulties and ideas.
[here]:http://nbviewer.jupyter.org/github/massimo-nocentini/PhD/blob/master/courses/paa/projects/papini-bani/Papini%20and%20Bani%27s%20PAA%20Project%20proposal.ipynb?flush_cache=true
[GitHub]:https://github.com/oddlord/paa-project
[notebook]:http://nbviewer.jupyter.org/github/oddlord/paa-project/blob/master/PAA%20Project.ipynb?flush_cache=true
|
c08eac787349ed9b89c972dda81c3a14c8db1ad6 | prospector.yml | prospector.yml | strictness: low
test-warnings: false
doc-warnings: true
uses:
- django
- celery
ignore-paths:
- projects
- builds
- docs
ignore-patterns:
- /migrations/
pep8:
full: true
options:
max-line-length: 100
pylint:
max-line-length: 100
mccabe:
run: false
pep257:
run: false
| strictness: low
test-warnings: false
doc-warnings: true
uses:
- django
- celery
ignore-paths:
- projects
- builds
- docs
ignore-patterns:
- /migrations/
pep8:
full: true
options:
max-line-length: 100
pylint:
max-line-length: 100
disable:
- logging-format-interpolation
mccabe:
run: false
pep257:
run: false
| Disable pylint check for logging-format-interpolation | Disable pylint check for logging-format-interpolation
Otherwise pylint will raise a warning if this is used:
logger.debug('Logging value: {value}'.format(value=123))
And recommends using:
logger.debug('Logging value: %(value)s', value=123)
| YAML | mit | pombredanne/readthedocs.org,royalwang/readthedocs.org,wijerasa/readthedocs.org,stevepiercy/readthedocs.org,istresearch/readthedocs.org,Tazer/readthedocs.org,soulshake/readthedocs.org,rtfd/readthedocs.org,espdev/readthedocs.org,titiushko/readthedocs.org,fujita-shintaro/readthedocs.org,michaelmcandrew/readthedocs.org,laplaceliu/readthedocs.org,istresearch/readthedocs.org,istresearch/readthedocs.org,sunnyzwh/readthedocs.org,kdkeyser/readthedocs.org,kenwang76/readthedocs.org,attakei/readthedocs-oauth,wanghaven/readthedocs.org,sunnyzwh/readthedocs.org,techtonik/readthedocs.org,hach-que/readthedocs.org,michaelmcandrew/readthedocs.org,singingwolfboy/readthedocs.org,titiushko/readthedocs.org,royalwang/readthedocs.org,espdev/readthedocs.org,kdkeyser/readthedocs.org,clarkperkins/readthedocs.org,sid-kap/readthedocs.org,techtonik/readthedocs.org,atsuyim/readthedocs.org,emawind84/readthedocs.org,soulshake/readthedocs.org,VishvajitP/readthedocs.org,clarkperkins/readthedocs.org,emawind84/readthedocs.org,CedarLogic/readthedocs.org,SteveViss/readthedocs.org,gjtorikian/readthedocs.org,sid-kap/readthedocs.org,mhils/readthedocs.org,safwanrahman/readthedocs.org,Tazer/readthedocs.org,wijerasa/readthedocs.org,LukasBoersma/readthedocs.org,kdkeyser/readthedocs.org,rtfd/readthedocs.org,hach-que/readthedocs.org,kenshinthebattosai/readthedocs.org,stevepiercy/readthedocs.org,davidfischer/readthedocs.org,techtonik/readthedocs.org,SteveViss/readthedocs.org,singingwolfboy/readthedocs.org,CedarLogic/readthedocs.org,GovReady/readthedocs.org,gjtorikian/readthedocs.org,laplaceliu/readthedocs.org,asampat3090/readthedocs.org,hach-que/readthedocs.org,wanghaven/readthedocs.org,asampat3090/readthedocs.org,istresearch/readthedocs.org,laplaceliu/readthedocs.org,tddv/readthedocs.org,emawind84/readthedocs.org,kdkeyser/readthedocs.org,gjtorikian/readthedocs.org,pombredanne/readthedocs.org,kenshinthebattosai/readthedocs.org,SteveViss/readthedocs.org,royalwang/readthedocs.org,tddv/readthedocs.org,clarkperkins/readthedocs.org,rtfd/readthedocs.org,mhils/readthedocs.org,fujita-shintaro/readthedocs.org,GovReady/readthedocs.org,LukasBoersma/readthedocs.org,mhils/readthedocs.org,VishvajitP/readthedocs.org,sid-kap/readthedocs.org,VishvajitP/readthedocs.org,sunnyzwh/readthedocs.org,stevepiercy/readthedocs.org,atsuyim/readthedocs.org,SteveViss/readthedocs.org,kenwang76/readthedocs.org,gjtorikian/readthedocs.org,attakei/readthedocs-oauth,sid-kap/readthedocs.org,kenwang76/readthedocs.org,singingwolfboy/readthedocs.org,michaelmcandrew/readthedocs.org,mhils/readthedocs.org,atsuyim/readthedocs.org,hach-que/readthedocs.org,davidfischer/readthedocs.org,emawind84/readthedocs.org,kenshinthebattosai/readthedocs.org,wijerasa/readthedocs.org,espdev/readthedocs.org,LukasBoersma/readthedocs.org,pombredanne/readthedocs.org,espdev/readthedocs.org,royalwang/readthedocs.org,espdev/readthedocs.org,wanghaven/readthedocs.org,safwanrahman/readthedocs.org,CedarLogic/readthedocs.org,clarkperkins/readthedocs.org,safwanrahman/readthedocs.org,stevepiercy/readthedocs.org,wijerasa/readthedocs.org,GovReady/readthedocs.org,attakei/readthedocs-oauth,Tazer/readthedocs.org,laplaceliu/readthedocs.org,attakei/readthedocs-oauth,singingwolfboy/readthedocs.org,VishvajitP/readthedocs.org,davidfischer/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedocs.org,wanghaven/readthedocs.org,kenwang76/readthedocs.org,kenshinthebattosai/readthedocs.org,techtonik/readthedocs.org,titiushko/readthedocs.org,soulshake/readthedocs.org,michaelmcandrew/readthedocs.org,LukasBoersma/readthedocs.org,asampat3090/readthedocs.org,sunnyzwh/readthedocs.org,asampat3090/readthedocs.org,soulshake/readthedocs.org,tddv/readthedocs.org,rtfd/readthedocs.org,atsuyim/readthedocs.org,titiushko/readthedocs.org,fujita-shintaro/readthedocs.org,GovReady/readthedocs.org,Tazer/readthedocs.org,CedarLogic/readthedocs.org,fujita-shintaro/readthedocs.org | yaml | ## Code Before:
strictness: low
test-warnings: false
doc-warnings: true
uses:
- django
- celery
ignore-paths:
- projects
- builds
- docs
ignore-patterns:
- /migrations/
pep8:
full: true
options:
max-line-length: 100
pylint:
max-line-length: 100
mccabe:
run: false
pep257:
run: false
## Instruction:
Disable pylint check for logging-format-interpolation
Otherwise pylint will raise a warning if this is used:
logger.debug('Logging value: {value}'.format(value=123))
And recommends using:
logger.debug('Logging value: %(value)s', value=123)
## Code After:
strictness: low
test-warnings: false
doc-warnings: true
uses:
- django
- celery
ignore-paths:
- projects
- builds
- docs
ignore-patterns:
- /migrations/
pep8:
full: true
options:
max-line-length: 100
pylint:
max-line-length: 100
disable:
- logging-format-interpolation
mccabe:
run: false
pep257:
run: false
|
494e303419cab0ff1b0f58265b190d306a100f50 | src/transform/curry.ml | src/transform/curry.ml | open Ident
open Term
open Decl
open Theory
open Task
let rec curry t = match t.t_node with
| Tbinop (Timplies, lhs, rhs) -> expand t lhs (curry rhs)
| _ -> t_map curry t
and expand orig l r = match l.t_node with
| Tbinop (Tand, a, b) -> expand orig a (expand orig b r)
| _ -> t_label_copy orig (t_implies (curry l) r)
let curry = Trans.goal (fun pr t -> [create_prop_decl Pgoal pr (curry t)])
let () =
Trans.register_transform "curry" curry
~desc:"Currify."
| open Term
open Decl
let rec curry t = match t.t_node with
| Tbinop (Timplies, lhs, rhs) -> expand t lhs (curry rhs)
| _ -> t_map curry t
and expand orig l r = match l.t_node with
| Tbinop (Tand, a, b) -> expand orig a (expand orig b r)
| _ -> t_label_copy orig (t_implies (curry l) r)
let curry = Trans.goal (fun pr t -> [create_prop_decl Pgoal pr (curry t)])
let () =
Trans.register_transform "curry" curry
~desc:"Currify."
| Fix warning from OCaml compiler | Fix warning from OCaml compiler
| OCaml | lgpl-2.1 | ssaavedra/why3,ssaavedra/why3,ssaavedra/why3 | ocaml | ## Code Before:
open Ident
open Term
open Decl
open Theory
open Task
let rec curry t = match t.t_node with
| Tbinop (Timplies, lhs, rhs) -> expand t lhs (curry rhs)
| _ -> t_map curry t
and expand orig l r = match l.t_node with
| Tbinop (Tand, a, b) -> expand orig a (expand orig b r)
| _ -> t_label_copy orig (t_implies (curry l) r)
let curry = Trans.goal (fun pr t -> [create_prop_decl Pgoal pr (curry t)])
let () =
Trans.register_transform "curry" curry
~desc:"Currify."
## Instruction:
Fix warning from OCaml compiler
## Code After:
open Term
open Decl
let rec curry t = match t.t_node with
| Tbinop (Timplies, lhs, rhs) -> expand t lhs (curry rhs)
| _ -> t_map curry t
and expand orig l r = match l.t_node with
| Tbinop (Tand, a, b) -> expand orig a (expand orig b r)
| _ -> t_label_copy orig (t_implies (curry l) r)
let curry = Trans.goal (fun pr t -> [create_prop_decl Pgoal pr (curry t)])
let () =
Trans.register_transform "curry" curry
~desc:"Currify."
|
90017332a560332176fa65a0bea0ae79e6e6d4cf | reactor-kafka/src/main/java/reactor/kafka/KafkaPublisher.java | reactor-kafka/src/main/java/reactor/kafka/KafkaPublisher.java | package reactor.kafka;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
public class KafkaPublisher<T> implements Publisher<T> {
@Override
public void subscribe(Subscriber<? super T> subscriber) {
}
}
| package reactor.kafka;
import kafka.consumer.Consumer;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import kafka.message.MessageAndMetadata;
import kafka.serializer.Decoder;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class KafkaPublisher<K, V> implements Publisher<KeyValuePair<K, V>> {
private final static int concurrencyLevel = 1;
private final ExecutorService executor;
private final Map<Subscription, Subscriber<? super KeyValuePair<K, V>>> subscribers;
public KafkaPublisher(Properties consumerProperties,
String topic,
Decoder<K> keyDecoder,
Decoder<V> valueDecoder) {
this.subscribers = new ConcurrentHashMap<>();
this.executor = Executors.newFixedThreadPool(concurrencyLevel);
ConsumerConnector consumer = Consumer.createJavaConsumerConnector(
new ConsumerConfig(consumerProperties));
Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
topicCountMap.put(topic, concurrencyLevel);
Map<String, List<KafkaStream<K, V>>> consumerMap =
consumer.createMessageStreams(topicCountMap,
keyDecoder,
valueDecoder);
List<KafkaStream<K, V>> streams = consumerMap.get(topic);
for (final KafkaStream stream : streams) {
executor.execute(() -> {
ConsumerIterator<K, V> it = stream.iterator();
while (it.hasNext() && !Thread.currentThread().isInterrupted()) {
MessageAndMetadata<K, V> msg = it.next();
KeyValuePair<K, V> kvp = new KeyValuePair<K, V>(msg.key(), msg.message());
for(Map.Entry<Subscription, Subscriber<? super KeyValuePair<K, V>>> entry: subscribers.entrySet()) {
entry.getValue().onNext(kvp);
}
}
});
}
}
@Override
public void subscribe(Subscriber<? super KeyValuePair<K, V>> subscriber) {
this.subscribers.put(new KafkaSubscription<>(subscriber,
subscribers::remove),
subscriber);
}
}
| Implement kafka publisher on top of reactive streams | Implement kafka publisher on top of reactive streams
| Java | apache-2.0 | reactor/reactor-incubator,jbrisbin/reactor-extensions | java | ## Code Before:
package reactor.kafka;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
public class KafkaPublisher<T> implements Publisher<T> {
@Override
public void subscribe(Subscriber<? super T> subscriber) {
}
}
## Instruction:
Implement kafka publisher on top of reactive streams
## Code After:
package reactor.kafka;
import kafka.consumer.Consumer;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import kafka.message.MessageAndMetadata;
import kafka.serializer.Decoder;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class KafkaPublisher<K, V> implements Publisher<KeyValuePair<K, V>> {
private final static int concurrencyLevel = 1;
private final ExecutorService executor;
private final Map<Subscription, Subscriber<? super KeyValuePair<K, V>>> subscribers;
public KafkaPublisher(Properties consumerProperties,
String topic,
Decoder<K> keyDecoder,
Decoder<V> valueDecoder) {
this.subscribers = new ConcurrentHashMap<>();
this.executor = Executors.newFixedThreadPool(concurrencyLevel);
ConsumerConnector consumer = Consumer.createJavaConsumerConnector(
new ConsumerConfig(consumerProperties));
Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
topicCountMap.put(topic, concurrencyLevel);
Map<String, List<KafkaStream<K, V>>> consumerMap =
consumer.createMessageStreams(topicCountMap,
keyDecoder,
valueDecoder);
List<KafkaStream<K, V>> streams = consumerMap.get(topic);
for (final KafkaStream stream : streams) {
executor.execute(() -> {
ConsumerIterator<K, V> it = stream.iterator();
while (it.hasNext() && !Thread.currentThread().isInterrupted()) {
MessageAndMetadata<K, V> msg = it.next();
KeyValuePair<K, V> kvp = new KeyValuePair<K, V>(msg.key(), msg.message());
for(Map.Entry<Subscription, Subscriber<? super KeyValuePair<K, V>>> entry: subscribers.entrySet()) {
entry.getValue().onNext(kvp);
}
}
});
}
}
@Override
public void subscribe(Subscriber<? super KeyValuePair<K, V>> subscriber) {
this.subscribers.put(new KafkaSubscription<>(subscriber,
subscribers::remove),
subscriber);
}
}
|
caf161894a0c5e648bebe9a2bbf66435e0edb79f | test/post.js | test/post.js |
var st = require('../lib/stocktwits');
var token = 'YOUR_ACCESS_TOKEN';
describe('POST', function () {
it('should make a POST request', function (done) {
st.post('messages/create', {access_token:token}, {body:'message'}, function (err, res) {
if (err) return done(err);
res.body.response.status.should.equal(200);
res.body.message.body.should.equal('message');
done();
});
});
});
|
var st = require('../lib/stocktwits');
var token = 'YOUR_ACCESS_TOKEN';
describe('POST', function () {
it('should make a POST request', function (done) {
if (token == 'YOUR_ACCESS_TOKEN') return done(new Error('Access token required'));
st.post('messages/create', {access_token:token}, {body:'message'}, function (err, res) {
if (err) return done(err);
res.body.response.status.should.equal(200);
res.body.message.body.should.equal('message');
done();
});
});
});
| Return error on missing access token | Return error on missing access token
| JavaScript | mit | simov/stocktwits | javascript | ## Code Before:
var st = require('../lib/stocktwits');
var token = 'YOUR_ACCESS_TOKEN';
describe('POST', function () {
it('should make a POST request', function (done) {
st.post('messages/create', {access_token:token}, {body:'message'}, function (err, res) {
if (err) return done(err);
res.body.response.status.should.equal(200);
res.body.message.body.should.equal('message');
done();
});
});
});
## Instruction:
Return error on missing access token
## Code After:
var st = require('../lib/stocktwits');
var token = 'YOUR_ACCESS_TOKEN';
describe('POST', function () {
it('should make a POST request', function (done) {
if (token == 'YOUR_ACCESS_TOKEN') return done(new Error('Access token required'));
st.post('messages/create', {access_token:token}, {body:'message'}, function (err, res) {
if (err) return done(err);
res.body.response.status.should.equal(200);
res.body.message.body.should.equal('message');
done();
});
});
});
|
d404236e286366cf2f9e4c81ff5e6d3fb9fa0456 | app/src/alquimia/index.js | app/src/alquimia/index.js | /**
* @ngdoc overview
* @name alquimia
* @author Mauro Constantinescu <mauro.constantinescu@gmail.com>
* @copyright © 2015 White, Red & Green Digital S.r.l.
*
* @description
* The `alquimia` module provides utility objects for using the Alquimia framework as efficiently as possible.
* The main goal of this module is to help developers handling `$location`'s **HTML5 mode** and communicating
* with the Wordpress' **WP REST API** plugin and specifically with the Alquimia Wordpress plugin for the API.
*/
angular.module( 'alquimia', ['restangular'] )
/*
Uncomment this directive if you want to use $location's html5Mode. You should keep it
into your project only while developing. For more information, see the readme file.
*/
// .directive( 'a', ['$location', require( './d-a' )] )
.provider( 'WPApi', require( './p-wp-api' ) );
| /**
* @ngdoc overview
* @name alquimia
* @author Mauro Constantinescu <mauro.constantinescu@gmail.com>
* @copyright © 2015 White, Red & Green Digital S.r.l.
*
* @description
* The `alquimia` module provides utility objects for using the Alquimia framework as efficiently as possible.
* The main goal of this module is to help developers handling `$location`'s **HTML5 mode** and communicating
* with the Wordpress' **WP REST API** plugin and specifically with the Alquimia Wordpress plugin for the API.
*/
var module = angular.module( 'alquimia', ['restangular'] )
if ( window.location && window.location.hostname === 'localhost' ) {
module.directive( 'a', ['$location', require( './d-a' )] )
}
module.provider( 'WPApi', require( './p-wp-api' ) );
| Set alquimia "a" directive to be executed only on localhost | Set alquimia "a" directive to be executed only on localhost
| JavaScript | mit | AlquimiaWRG/alquimia-wa,AlquimiaWRG/alquimia-wa,AlquimiaWRG/alquimia-wa | javascript | ## Code Before:
/**
* @ngdoc overview
* @name alquimia
* @author Mauro Constantinescu <mauro.constantinescu@gmail.com>
* @copyright © 2015 White, Red & Green Digital S.r.l.
*
* @description
* The `alquimia` module provides utility objects for using the Alquimia framework as efficiently as possible.
* The main goal of this module is to help developers handling `$location`'s **HTML5 mode** and communicating
* with the Wordpress' **WP REST API** plugin and specifically with the Alquimia Wordpress plugin for the API.
*/
angular.module( 'alquimia', ['restangular'] )
/*
Uncomment this directive if you want to use $location's html5Mode. You should keep it
into your project only while developing. For more information, see the readme file.
*/
// .directive( 'a', ['$location', require( './d-a' )] )
.provider( 'WPApi', require( './p-wp-api' ) );
## Instruction:
Set alquimia "a" directive to be executed only on localhost
## Code After:
/**
* @ngdoc overview
* @name alquimia
* @author Mauro Constantinescu <mauro.constantinescu@gmail.com>
* @copyright © 2015 White, Red & Green Digital S.r.l.
*
* @description
* The `alquimia` module provides utility objects for using the Alquimia framework as efficiently as possible.
* The main goal of this module is to help developers handling `$location`'s **HTML5 mode** and communicating
* with the Wordpress' **WP REST API** plugin and specifically with the Alquimia Wordpress plugin for the API.
*/
var module = angular.module( 'alquimia', ['restangular'] )
if ( window.location && window.location.hostname === 'localhost' ) {
module.directive( 'a', ['$location', require( './d-a' )] )
}
module.provider( 'WPApi', require( './p-wp-api' ) );
|
e6d1af0e9bcbf996bb835e9774976f08a58a1ca8 | README.md | README.md | Troposphere
===========
```bash
cp troposphere/troposphere.cfg.dist troposphere/troposphere.cfg
```
Edit `troposphere.cfg` with your own settings.
```bash
pip install -r requirements.txt
python troposphere/__init__.py
```
| Troposphere
===========
```bash
cp troposphere/troposphere.cfg.dist troposphere/troposphere.cfg
```
Edit `troposphere.cfg` with your own settings. You'll have to generate a new
SSL keypair from Groupy for the Troposphere application. The configuration
variable `OAUTH_PRIVATE_KEY` should refer to the absolute path of that key.
```bash
pip install -r requirements.txt
python troposphere/__init__.py
```
| Add groupy instructions to readme | Add groupy instructions to readme
| Markdown | apache-2.0 | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | markdown | ## Code Before:
Troposphere
===========
```bash
cp troposphere/troposphere.cfg.dist troposphere/troposphere.cfg
```
Edit `troposphere.cfg` with your own settings.
```bash
pip install -r requirements.txt
python troposphere/__init__.py
```
## Instruction:
Add groupy instructions to readme
## Code After:
Troposphere
===========
```bash
cp troposphere/troposphere.cfg.dist troposphere/troposphere.cfg
```
Edit `troposphere.cfg` with your own settings. You'll have to generate a new
SSL keypair from Groupy for the Troposphere application. The configuration
variable `OAUTH_PRIVATE_KEY` should refer to the absolute path of that key.
```bash
pip install -r requirements.txt
python troposphere/__init__.py
```
|
50b621fb3279b81a4c1411dc7508789629dd2c59 | cmake/modules/GetRE2C.cmake | cmake/modules/GetRE2C.cmake |
include(DownloadProject)
macro(getRE2C)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
download_project(
PROJ re2c
GIT_REPOSITORY https://github.com/skvadrik/re2c.git
GIT_TAG 1.2
GIT_PROGRESS 1
)
set(RE2C_BIN "${re2c_BINARY_DIR}/re2c")
if(NOT EXISTS "${re2c_SOURCE_DIR}/configure")
execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${re2c_SOURCE_DIR})
endif()
execute_process(COMMAND ${re2c_SOURCE_DIR}/configure WORKING_DIRECTORY ${re2c_BINARY_DIR})
execute_process(COMMAND make WORKING_DIRECTORY ${re2c_BINARY_DIR})
endmacro()
|
include(DownloadProject)
macro(getRE2C)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
download_project(
PROJ re2c
GIT_REPOSITORY https://github.com/skvadrik/re2c.git
GIT_TAG 1.1.1
GIT_PROGRESS 1
)
set(RE2C_BIN "${re2c_BINARY_DIR}/re2c")
if(NOT EXISTS "${re2c_SOURCE_DIR}/re2c/configure")
execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${re2c_SOURCE_DIR}/re2c)
endif()
execute_process(COMMAND ${re2c_SOURCE_DIR}/re2c/configure WORKING_DIRECTORY ${re2c_BINARY_DIR})
execute_process(COMMAND make WORKING_DIRECTORY ${re2c_BINARY_DIR})
endmacro()
| Revert "update re2c to 1.2" due to build error in some environment like Mac or openSUSE tumbleweed | Revert "update re2c to 1.2" due to build error in some environment like
Mac or openSUSE tumbleweed
This reverts commit f8e43c07682f2e8a13294d89aa1d28186dbd8620.
| CMake | apache-2.0 | sekiguchi-nagisa/ydsh,sekiguchi-nagisa/ydsh,sekiguchi-nagisa/ydsh | cmake | ## Code Before:
include(DownloadProject)
macro(getRE2C)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
download_project(
PROJ re2c
GIT_REPOSITORY https://github.com/skvadrik/re2c.git
GIT_TAG 1.2
GIT_PROGRESS 1
)
set(RE2C_BIN "${re2c_BINARY_DIR}/re2c")
if(NOT EXISTS "${re2c_SOURCE_DIR}/configure")
execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${re2c_SOURCE_DIR})
endif()
execute_process(COMMAND ${re2c_SOURCE_DIR}/configure WORKING_DIRECTORY ${re2c_BINARY_DIR})
execute_process(COMMAND make WORKING_DIRECTORY ${re2c_BINARY_DIR})
endmacro()
## Instruction:
Revert "update re2c to 1.2" due to build error in some environment like
Mac or openSUSE tumbleweed
This reverts commit f8e43c07682f2e8a13294d89aa1d28186dbd8620.
## Code After:
include(DownloadProject)
macro(getRE2C)
if (CMAKE_VERSION VERSION_LESS 3.2)
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
else()
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
endif()
download_project(
PROJ re2c
GIT_REPOSITORY https://github.com/skvadrik/re2c.git
GIT_TAG 1.1.1
GIT_PROGRESS 1
)
set(RE2C_BIN "${re2c_BINARY_DIR}/re2c")
if(NOT EXISTS "${re2c_SOURCE_DIR}/re2c/configure")
execute_process(COMMAND ./autogen.sh WORKING_DIRECTORY ${re2c_SOURCE_DIR}/re2c)
endif()
execute_process(COMMAND ${re2c_SOURCE_DIR}/re2c/configure WORKING_DIRECTORY ${re2c_BINARY_DIR})
execute_process(COMMAND make WORKING_DIRECTORY ${re2c_BINARY_DIR})
endmacro()
|
542ac0d373116adb9ef36a6fa0c958f9a45140f4 | apps/hard_hat/lib/hard_hat/users.ex | apps/hard_hat/lib/hard_hat/users.ex | defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHat.response
def whoami(client) do
get(client, "users")
end
@doc """
Show the user identified by `id`.
## Examples
HardHat.Users.show(client, 267)
"""
@spec show(Client.t, pos_integer) :: HardHat.response
def show(client, id) do
get(client, "users/#{id}")
end
@doc """
Trigger a new sync with GitHub.
## Examples
HardHat.Users.sync(client)
"""
@spec sync(Client.t) :: HardHat.response
def sync(client) do
post(client, "users/sync")
end
end
| defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat, except: [get: 2]
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHat.response
def whoami(client) do
HardHat.get(client, "users")
end
@doc """
Gets the user identified by `id`.
## Examples
HardHat.Users.get(client, 267)
HardHat.Users.get(client, "267")
"""
@spec get(Client.t, pos_integer | String.t) :: HardHat.response
def get(client, id) when is_integer(id) and id > 0 do
HardHat.get(client, "users/#{id}")
end
def get(client, id) when is_binary(id) do
get(client, String.to_integer(id))
end
@doc """
Trigger a new sync with GitHub.
## Examples
HardHat.Users.sync(client)
"""
@spec sync(Client.t) :: HardHat.response
def sync(client) do
post(client, "users/sync")
end
end
| Use the verb "get" for consistency | Use the verb "get" for consistency
Rather that use the inconsistent verbs that are in place in the upstream
API documentation, I think it makes sense to standardize on using "get"
for pure GET requests, which also is familiar to other usages of the
term throughout Elixir as a language. The verbs "fetch" and "show"
either have different meanings in Elixir, or are not used, so I think
this will make the wrapper feel more native.
| Elixir | isc | gullintanni/gullintanni,gullintanni/gullintanni | elixir | ## Code Before:
defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHat.response
def whoami(client) do
get(client, "users")
end
@doc """
Show the user identified by `id`.
## Examples
HardHat.Users.show(client, 267)
"""
@spec show(Client.t, pos_integer) :: HardHat.response
def show(client, id) do
get(client, "users/#{id}")
end
@doc """
Trigger a new sync with GitHub.
## Examples
HardHat.Users.sync(client)
"""
@spec sync(Client.t) :: HardHat.response
def sync(client) do
post(client, "users/sync")
end
end
## Instruction:
Use the verb "get" for consistency
Rather that use the inconsistent verbs that are in place in the upstream
API documentation, I think it makes sense to standardize on using "get"
for pure GET requests, which also is familiar to other usages of the
term throughout Elixir as a language. The verbs "fetch" and "show"
either have different meanings in Elixir, or are not used, so I think
this will make the wrapper feel more native.
## Code After:
defmodule HardHat.Users do
@moduledoc """
A wrapper for the Users entity.
<https://docs.travis-ci.com/api/#users>
"""
import HardHat, except: [get: 2]
alias HardHat.Client
@doc """
Show the authenticated user.
## Examples
HardHat.Users.whoami(client)
"""
@spec whoami(Client.t) :: HardHat.response
def whoami(client) do
HardHat.get(client, "users")
end
@doc """
Gets the user identified by `id`.
## Examples
HardHat.Users.get(client, 267)
HardHat.Users.get(client, "267")
"""
@spec get(Client.t, pos_integer | String.t) :: HardHat.response
def get(client, id) when is_integer(id) and id > 0 do
HardHat.get(client, "users/#{id}")
end
def get(client, id) when is_binary(id) do
get(client, String.to_integer(id))
end
@doc """
Trigger a new sync with GitHub.
## Examples
HardHat.Users.sync(client)
"""
@spec sync(Client.t) :: HardHat.response
def sync(client) do
post(client, "users/sync")
end
end
|
d6f92b85f62db9a6aa6e12f701467cb4eaf3d933 | src/doc/components/DocCommentParser.php | src/doc/components/DocCommentParser.php | <?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/
public $source;
/**
* @var
*/
public $params;
/**
*
*/
public function init()
{
}
/**
* @return string
*/
public function getDescription()
{
$string = explode(PHP_EOL, $this->source);
$values = array_splice($string, 1);
array_walk($values, function (&$item) {
$item = trim($item, '* /\t\r\n');
});
return implode(array_filter($values), '<br/>');
}
} | <?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/
public $source;
/**
* @var
*/
public $params;
/**
*
*/
public function init()
{
}
/**
* @return string
*/
public function getDescription()
{
$string = explode(PHP_EOL, $this->source);
$values = array_splice($string, 1);
array_walk($values, function (&$item) {
$item = trim($item, "* /\t\r\n");
});
$filtered = array_filter($values, function ($string) {
return !empty($string)
&& strpos($string, '@throws') === false
&& strpos($string, '@return') === false;
});
return implode($filtered, '<br/>');
}
} | Change the parsing doc comments algorithm to show full method documentation but not just the first string | Change the parsing doc comments algorithm to show full method documentation but not just the first string
| PHP | mit | voodoo-mobile/yii2-api,voodoo-mobile/yii2-api,voodoo-mobile/yii2-api,voodoo-rocks/yii2-api,voodoo-rocks/yii2-api | php | ## Code Before:
<?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/
public $source;
/**
* @var
*/
public $params;
/**
*
*/
public function init()
{
}
/**
* @return string
*/
public function getDescription()
{
$string = explode(PHP_EOL, $this->source);
$values = array_splice($string, 1);
array_walk($values, function (&$item) {
$item = trim($item, '* /\t\r\n');
});
return implode(array_filter($values), '<br/>');
}
}
## Instruction:
Change the parsing doc comments algorithm to show full method documentation but not just the first string
## Code After:
<?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/
public $source;
/**
* @var
*/
public $params;
/**
*
*/
public function init()
{
}
/**
* @return string
*/
public function getDescription()
{
$string = explode(PHP_EOL, $this->source);
$values = array_splice($string, 1);
array_walk($values, function (&$item) {
$item = trim($item, "* /\t\r\n");
});
$filtered = array_filter($values, function ($string) {
return !empty($string)
&& strpos($string, '@throws') === false
&& strpos($string, '@return') === false;
});
return implode($filtered, '<br/>');
}
} |
00ba5f6f0b3eb79180fea2f6559d41c9b95e509d | ui/templates/organizationView.html | ui/templates/organizationView.html | {{define "main"}}
<div class="col-md-9">
<div class="row">
<div class="col-md-2">
<a class="btn btn-block btn-primary" href="/organizations/{{.Organization.ID.Hex}}/projects/new">New project</a>
</div>
</div>
<br>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>{{.Organization.Name}}'s projects</h4>
</div>
</div>
<div class="panel-body">
{{if eq (len .Projects) 0}}
<p class="text-center">
No projects
</p>
{{else}}
<div class="list-group">
{{range $prj := .Projects}}
<a href="/projects/{{$prj.ID.Hex}}" class="list-group-item">{{$prj.Name}}</a>
{{end}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
| {{define "main"}}
<div class="col-md-9">
{{if eq .Organization.OwnerID .Context.Account.ID}}
<div class="row">
<div class="col-md-2">
<a class="btn btn-block btn-primary" href="/organizations/{{.Organization.ID.Hex}}/projects/new">New project</a>
</div>
</div>
{{end}}
<br>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>{{.Organization.Name}}'s projects</h4>
</div>
</div>
<div class="panel-body">
{{if eq (len .Projects) 0}}
<p class="text-center">
No projects
</p>
{{else}}
<div class="list-group">
{{range $prj := .Projects}}
<a href="/projects/{{$prj.ID.Hex}}" class="list-group-item">{{$prj.Name}}</a>
{{end}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
| Hide new document button from invited organizations | Hide new document button from invited organizations
| HTML | bsd-3-clause | FurqanSoftware/papyrus,FurqanSoftware/papyrus,FurqanSoftware/papyrus | html | ## Code Before:
{{define "main"}}
<div class="col-md-9">
<div class="row">
<div class="col-md-2">
<a class="btn btn-block btn-primary" href="/organizations/{{.Organization.ID.Hex}}/projects/new">New project</a>
</div>
</div>
<br>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>{{.Organization.Name}}'s projects</h4>
</div>
</div>
<div class="panel-body">
{{if eq (len .Projects) 0}}
<p class="text-center">
No projects
</p>
{{else}}
<div class="list-group">
{{range $prj := .Projects}}
<a href="/projects/{{$prj.ID.Hex}}" class="list-group-item">{{$prj.Name}}</a>
{{end}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
## Instruction:
Hide new document button from invited organizations
## Code After:
{{define "main"}}
<div class="col-md-9">
{{if eq .Organization.OwnerID .Context.Account.ID}}
<div class="row">
<div class="col-md-2">
<a class="btn btn-block btn-primary" href="/organizations/{{.Organization.ID.Hex}}/projects/new">New project</a>
</div>
</div>
{{end}}
<br>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>{{.Organization.Name}}'s projects</h4>
</div>
</div>
<div class="panel-body">
{{if eq (len .Projects) 0}}
<p class="text-center">
No projects
</p>
{{else}}
<div class="list-group">
{{range $prj := .Projects}}
<a href="/projects/{{$prj.ID.Hex}}" class="list-group-item">{{$prj.Name}}</a>
{{end}}
</div>
{{end}}
</div>
</div>
</div>
{{end}}
|
9cd6a20525e417e166fd82437fbf5a04216f5559 | contrib/src/ebml/rules.mak | contrib/src/ebml/rules.mak |
EBML_VERSION := 1.2.2
EBML_URL := http://dl.matroska.org/downloads/libebml/libebml-$(EBML_VERSION).tar.bz2
#EBML_URL := $(CONTRIB_VIDEOLAN)/libebml-$(EBML_VERSION).tar.bz2
$(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
$(call download,$(EBML_URL))
.sum-ebml: libebml-$(EBML_VERSION).tar.bz2
libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
$(UNPACK)
$(APPLY) $(SRC)/ebml/ebml-pic.patch
$(APPLY) $(SRC)/ebml/no-ansi.patch
$(MOVE)
.ebml: libebml
ifdef HAVE_WIN32
cd $< && $(MAKE) -C make/mingw32 prefix="$(PREFIX)" $(HOSTVARS) SHARED=no
else
cd $< && $(MAKE) -C make/linux prefix="$(PREFIX)" $(HOSTVARS) staticlib
endif
cd $< && $(MAKE) -C make/linux install_staticlib install_headers prefix="$(PREFIX)" $(HOSTVARS)
$(RANLIB) "$(PREFIX)/lib/libebml.a"
touch $@
|
EBML_VERSION := 1.2.2
EBML_URL := http://dl.matroska.org/downloads/libebml/libebml-$(EBML_VERSION).tar.bz2
#EBML_URL := $(CONTRIB_VIDEOLAN)/libebml-$(EBML_VERSION).tar.bz2
$(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
$(call download,$(EBML_URL))
.sum-ebml: libebml-$(EBML_VERSION).tar.bz2
libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
$(UNPACK)
$(APPLY) $(SRC)/ebml/ebml-pic.patch
$(APPLY) $(SRC)/ebml/no-ansi.patch
$(MOVE)
# libebml requires exceptions
EBML_EXTRA_FLAGS = CXXFLAGS="${CXXFLAGS} -fexceptions" \
CPPFLAGS=""
.ebml: libebml
ifdef HAVE_WIN32
cd $< && $(MAKE) -C make/mingw32 prefix="$(PREFIX)" $(HOSTVARS) SHARED=no
else
cd $< && $(MAKE) -C make/linux prefix="$(PREFIX)" $(HOSTVARS) $(EBML_EXTRA_FLAGS) staticlib
endif
cd $< && $(MAKE) -C make/linux install_staticlib install_headers prefix="$(PREFIX)" $(HOSTVARS)
$(RANLIB) "$(PREFIX)/lib/libebml.a"
touch $@
| Allow libebml build on Android x86 | contrib: Allow libebml build on Android x86
This package needs exceptions.
Signed-off-by: Rafaël Carré <29a40ef51885229607cd1e19e467be5d13190cad@videolan.org>
| Makefile | lgpl-2.1 | vlc-mirror/vlc-2.1,xkfz007/vlc,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.1,krichter722/vlc,xkfz007/vlc,jomanmuk/vlc-2.1,jomanmuk/vlc-2.2,krichter722/vlc,krichter722/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc,xkfz007/vlc,vlc-mirror/vlc,jomanmuk/vlc-2.2,jomanmuk/vlc-2.2,jomanmuk/vlc-2.2,jomanmuk/vlc-2.2,jomanmuk/vlc-2.1,xkfz007/vlc,vlc-mirror/vlc,vlc-mirror/vlc-2.1,vlc-mirror/vlc-2.1,shyamalschandra/vlc,xkfz007/vlc,krichter722/vlc,krichter722/vlc,jomanmuk/vlc-2.1,shyamalschandra/vlc,xkfz007/vlc,krichter722/vlc,vlc-mirror/vlc-2.1,vlc-mirror/vlc-2.1,xkfz007/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc,vlc-mirror/vlc,vlc-mirror/vlc,jomanmuk/vlc-2.2,krichter722/vlc,shyamalschandra/vlc,vlc-mirror/vlc,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.1,shyamalschandra/vlc,shyamalschandra/vlc,shyamalschandra/vlc | makefile | ## Code Before:
EBML_VERSION := 1.2.2
EBML_URL := http://dl.matroska.org/downloads/libebml/libebml-$(EBML_VERSION).tar.bz2
#EBML_URL := $(CONTRIB_VIDEOLAN)/libebml-$(EBML_VERSION).tar.bz2
$(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
$(call download,$(EBML_URL))
.sum-ebml: libebml-$(EBML_VERSION).tar.bz2
libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
$(UNPACK)
$(APPLY) $(SRC)/ebml/ebml-pic.patch
$(APPLY) $(SRC)/ebml/no-ansi.patch
$(MOVE)
.ebml: libebml
ifdef HAVE_WIN32
cd $< && $(MAKE) -C make/mingw32 prefix="$(PREFIX)" $(HOSTVARS) SHARED=no
else
cd $< && $(MAKE) -C make/linux prefix="$(PREFIX)" $(HOSTVARS) staticlib
endif
cd $< && $(MAKE) -C make/linux install_staticlib install_headers prefix="$(PREFIX)" $(HOSTVARS)
$(RANLIB) "$(PREFIX)/lib/libebml.a"
touch $@
## Instruction:
contrib: Allow libebml build on Android x86
This package needs exceptions.
Signed-off-by: Rafaël Carré <29a40ef51885229607cd1e19e467be5d13190cad@videolan.org>
## Code After:
EBML_VERSION := 1.2.2
EBML_URL := http://dl.matroska.org/downloads/libebml/libebml-$(EBML_VERSION).tar.bz2
#EBML_URL := $(CONTRIB_VIDEOLAN)/libebml-$(EBML_VERSION).tar.bz2
$(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
$(call download,$(EBML_URL))
.sum-ebml: libebml-$(EBML_VERSION).tar.bz2
libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
$(UNPACK)
$(APPLY) $(SRC)/ebml/ebml-pic.patch
$(APPLY) $(SRC)/ebml/no-ansi.patch
$(MOVE)
# libebml requires exceptions
EBML_EXTRA_FLAGS = CXXFLAGS="${CXXFLAGS} -fexceptions" \
CPPFLAGS=""
.ebml: libebml
ifdef HAVE_WIN32
cd $< && $(MAKE) -C make/mingw32 prefix="$(PREFIX)" $(HOSTVARS) SHARED=no
else
cd $< && $(MAKE) -C make/linux prefix="$(PREFIX)" $(HOSTVARS) $(EBML_EXTRA_FLAGS) staticlib
endif
cd $< && $(MAKE) -C make/linux install_staticlib install_headers prefix="$(PREFIX)" $(HOSTVARS)
$(RANLIB) "$(PREFIX)/lib/libebml.a"
touch $@
|
80b1eb778022213f09785ccc6fe8136117f7efdf | src/om_forms/core.clj | src/om_forms/core.clj | (ns om-forms.core)
(defmacro with-options
[options & body]
`(binding [om-forms.core/*options* (cljs.core/merge om-forms.core/*options* ~options)]
~@body)) | (ns om-forms.core)
(defmacro with-options
[options & body]
`(binding [om-forms.core/*options*
(cljs.core/merge-with
(cljs.core/fn [old# new#]
(cljs.core/cond
(cljs.core/map? old#) (cljs.core/merge old# new#)
:else new#))
om-forms.core/*options*
~options)]
~@body)) | Add support for nested options to `with-options`. | Add support for nested options to `with-options`. | Clojure | epl-1.0 | bilus/reforms | clojure | ## Code Before:
(ns om-forms.core)
(defmacro with-options
[options & body]
`(binding [om-forms.core/*options* (cljs.core/merge om-forms.core/*options* ~options)]
~@body))
## Instruction:
Add support for nested options to `with-options`.
## Code After:
(ns om-forms.core)
(defmacro with-options
[options & body]
`(binding [om-forms.core/*options*
(cljs.core/merge-with
(cljs.core/fn [old# new#]
(cljs.core/cond
(cljs.core/map? old#) (cljs.core/merge old# new#)
:else new#))
om-forms.core/*options*
~options)]
~@body)) |
624a69251febdb164d57082fdbec2a9d96b8aa9c | docs/api/index.rst | docs/api/index.rst | .. _api-ref:
*************
API reference
*************
.. note:: What is public?
Only APIs documented here are public and open for use by Mopidy
extensions.
.. toctree::
:glob:
concepts
models
backends
core
audio
mixer
frontends
commands
ext
config
zeroconf
http-server
http
js
| .. _api-ref:
*************
API reference
*************
.. note:: What is public?
Only APIs documented here are public and open for use by Mopidy
extensions.
.. toctree::
:glob:
concepts
models
core
backends
audio
mixer
frontends
commands
ext
config
zeroconf
http-server
http
js
| Move Backend API docs to after Core API | docs: Move Backend API docs to after Core API
| reStructuredText | apache-2.0 | SuperStarPL/mopidy,mopidy/mopidy,kingosticks/mopidy,bacontext/mopidy,adamcik/mopidy,jmarsik/mopidy,kingosticks/mopidy,pacificIT/mopidy,dbrgn/mopidy,jcass77/mopidy,bacontext/mopidy,pacificIT/mopidy,glogiotatidis/mopidy,mokieyue/mopidy,jmarsik/mopidy,rawdlite/mopidy,swak/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,mopidy/mopidy,pacificIT/mopidy,ZenithDK/mopidy,jmarsik/mopidy,dbrgn/mopidy,bencevans/mopidy,jodal/mopidy,adamcik/mopidy,tkem/mopidy,quartz55/mopidy,ali/mopidy,rawdlite/mopidy,mokieyue/mopidy,diandiankan/mopidy,bencevans/mopidy,hkariti/mopidy,swak/mopidy,vrs01/mopidy,tkem/mopidy,bencevans/mopidy,jodal/mopidy,ZenithDK/mopidy,kingosticks/mopidy,adamcik/mopidy,ali/mopidy,jcass77/mopidy,SuperStarPL/mopidy,swak/mopidy,ali/mopidy,bacontext/mopidy,diandiankan/mopidy,rawdlite/mopidy,glogiotatidis/mopidy,glogiotatidis/mopidy,jcass77/mopidy,diandiankan/mopidy,jmarsik/mopidy,tkem/mopidy,quartz55/mopidy,hkariti/mopidy,vrs01/mopidy,SuperStarPL/mopidy,rawdlite/mopidy,mokieyue/mopidy,ZenithDK/mopidy,hkariti/mopidy,quartz55/mopidy,bencevans/mopidy,mopidy/mopidy,ZenithDK/mopidy,dbrgn/mopidy,diandiankan/mopidy,quartz55/mopidy,glogiotatidis/mopidy,tkem/mopidy,pacificIT/mopidy,jodal/mopidy,bacontext/mopidy,hkariti/mopidy,ali/mopidy,vrs01/mopidy,mokieyue/mopidy,swak/mopidy,vrs01/mopidy | restructuredtext | ## Code Before:
.. _api-ref:
*************
API reference
*************
.. note:: What is public?
Only APIs documented here are public and open for use by Mopidy
extensions.
.. toctree::
:glob:
concepts
models
backends
core
audio
mixer
frontends
commands
ext
config
zeroconf
http-server
http
js
## Instruction:
docs: Move Backend API docs to after Core API
## Code After:
.. _api-ref:
*************
API reference
*************
.. note:: What is public?
Only APIs documented here are public and open for use by Mopidy
extensions.
.. toctree::
:glob:
concepts
models
core
backends
audio
mixer
frontends
commands
ext
config
zeroconf
http-server
http
js
|
218d79072f4c4d569790f819e84bea9f26f2340d | spec/lib/hours_spec.rb | spec/lib/hours_spec.rb | describe Hours do
context "helpful_enabled" do
it "returns false when there's no account or url" do
allow(Hours).to receive(:helpful_account).and_return false
allow(Hours).to receive(:helpful_url).and_return false
expect(Hours.helpful_enabled?).to eq(false)
end
it "raises an error when the account or url is empty" do
allow(Hours).to receive(:helpful_account).and_return ""
allow(Hours).to receive(:helpful_url).and_return ""
expect { Hours.helpful_enabled? }. to raise_error
end
it "returns true when account and url are set" do
allow(Hours).to receive(:helpful_account).and_return "Helpful account"
allow(Hours).to receive(:helpful_url).and_return "www.helpful.com/messages"
expect(Hours.helpful_enabled?).to eq(true)
end
end
end
| describe Hours do
context "helpful_enabled" do
it "returns false when there's no account or url" do
allow(Hours).to receive(:helpful_account).and_return false
allow(Hours).to receive(:helpful_url).and_return false
expect(Hours.helpful_enabled?).to eq(false)
end
it "raises an error when the account or url is empty" do
allow(Hours).to receive(:helpful_account).and_return ""
allow(Hours).to receive(:helpful_url).and_return ""
expect { Hours.helpful_enabled? }. to raise_error(RuntimeError)
end
it "returns true when account and url are set" do
allow(Hours).to receive(:helpful_account).and_return "Helpful account"
allow(Hours).to receive(:helpful_url).and_return "www.helpful.com/messages"
expect(Hours.helpful_enabled?).to eq(true)
end
end
end
| Fix using bare raise_error matcher | Fix using bare raise_error matcher
This is due to receiving a deprecation warning:
```sh
WARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match
-- snip --
```
| Ruby | mit | DefactoSoftware/Hours,michalsz/Hours,DefactoSoftware/Hours,DefactoSoftware/Hours,michalsz/Hours,DefactoSoftware/Hours,michalsz/Hours,michalsz/Hours | ruby | ## Code Before:
describe Hours do
context "helpful_enabled" do
it "returns false when there's no account or url" do
allow(Hours).to receive(:helpful_account).and_return false
allow(Hours).to receive(:helpful_url).and_return false
expect(Hours.helpful_enabled?).to eq(false)
end
it "raises an error when the account or url is empty" do
allow(Hours).to receive(:helpful_account).and_return ""
allow(Hours).to receive(:helpful_url).and_return ""
expect { Hours.helpful_enabled? }. to raise_error
end
it "returns true when account and url are set" do
allow(Hours).to receive(:helpful_account).and_return "Helpful account"
allow(Hours).to receive(:helpful_url).and_return "www.helpful.com/messages"
expect(Hours.helpful_enabled?).to eq(true)
end
end
end
## Instruction:
Fix using bare raise_error matcher
This is due to receiving a deprecation warning:
```sh
WARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match
-- snip --
```
## Code After:
describe Hours do
context "helpful_enabled" do
it "returns false when there's no account or url" do
allow(Hours).to receive(:helpful_account).and_return false
allow(Hours).to receive(:helpful_url).and_return false
expect(Hours.helpful_enabled?).to eq(false)
end
it "raises an error when the account or url is empty" do
allow(Hours).to receive(:helpful_account).and_return ""
allow(Hours).to receive(:helpful_url).and_return ""
expect { Hours.helpful_enabled? }. to raise_error(RuntimeError)
end
it "returns true when account and url are set" do
allow(Hours).to receive(:helpful_account).and_return "Helpful account"
allow(Hours).to receive(:helpful_url).and_return "www.helpful.com/messages"
expect(Hours.helpful_enabled?).to eq(true)
end
end
end
|
ad70a7ec6543d64ec185eb2d52ccfa291a1dfad6 | servicerating/views.py | servicerating/views.py | import csv
from django.http import HttpResponse
from servicerating.models import Response
def report_responses(request):
qs = Response.objects.raw("SELECT servicerating_response.*, servicerating_extra.value AS clinic_code from servicerating_response INNER JOIN servicerating_extra ON servicerating_response.contact_id = servicerating_extra.contact_id WHERE servicerating_extra.key = 'clinic_code'")
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="servicerating_incl_clinic_code.csv"'
writer = csv.writer(response)
writer.writerow(["Contact", "Key", "Value", "Created At", "Updated At", "Clinic Code"])
for obj in qs:
writer.writerow([obj.contact, obj.key, obj.value, obj.created_at,
obj.updated_at, obj.clinic_code])
return response
| import csv
from django.http import HttpResponse
from servicerating.models import Response
def report_responses(request):
qs = Response.objects.raw("SELECT servicerating_response.*, servicerating_extra.value AS clinic_code from servicerating_response INNER JOIN servicerating_extra ON servicerating_response.contact_id = servicerating_extra.contact_id WHERE servicerating_extra.key = 'clinic_code'")
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="servicerating_incl_clinic_code.csv"'
writer = csv.writer(response)
writer.writerow(["Rating ID", "Contact ID", "Key", "Value", "Created At", "Updated At", "Clinic Code"])
for obj in qs:
writer.writerow([obj.id, obj.contact_id, obj.key, obj.value, obj.created_at,
obj.updated_at, obj.clinic_code])
return response
| Remove FK's from CSV export for massive speed boost | Remove FK's from CSV export for massive speed boost
| Python | bsd-3-clause | praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control | python | ## Code Before:
import csv
from django.http import HttpResponse
from servicerating.models import Response
def report_responses(request):
qs = Response.objects.raw("SELECT servicerating_response.*, servicerating_extra.value AS clinic_code from servicerating_response INNER JOIN servicerating_extra ON servicerating_response.contact_id = servicerating_extra.contact_id WHERE servicerating_extra.key = 'clinic_code'")
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="servicerating_incl_clinic_code.csv"'
writer = csv.writer(response)
writer.writerow(["Contact", "Key", "Value", "Created At", "Updated At", "Clinic Code"])
for obj in qs:
writer.writerow([obj.contact, obj.key, obj.value, obj.created_at,
obj.updated_at, obj.clinic_code])
return response
## Instruction:
Remove FK's from CSV export for massive speed boost
## Code After:
import csv
from django.http import HttpResponse
from servicerating.models import Response
def report_responses(request):
qs = Response.objects.raw("SELECT servicerating_response.*, servicerating_extra.value AS clinic_code from servicerating_response INNER JOIN servicerating_extra ON servicerating_response.contact_id = servicerating_extra.contact_id WHERE servicerating_extra.key = 'clinic_code'")
# Create the HttpResponse object with the appropriate CSV header.
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="servicerating_incl_clinic_code.csv"'
writer = csv.writer(response)
writer.writerow(["Rating ID", "Contact ID", "Key", "Value", "Created At", "Updated At", "Clinic Code"])
for obj in qs:
writer.writerow([obj.id, obj.contact_id, obj.key, obj.value, obj.created_at,
obj.updated_at, obj.clinic_code])
return response
|
32cb7b862399ec9a7e297316cf3e7a781229b086 | src/Model/UrlInterface.php | src/Model/UrlInterface.php | <?php
declare(strict_types=1);
namespace SitemapPlugin\Model;
use DateTimeInterface;
use Doctrine\Common\Collections\Collection;
interface UrlInterface
{
public function getLocation(): string;
public function setLocation(string $location): void;
public function getLastModification(): ?DateTimeInterface;
public function setLastModification(DateTimeInterface $lastModification): void;
public function getChangeFrequency(): string;
public function setChangeFrequency(ChangeFrequency $changeFrequency): void;
public function getPriority(): ?float;
public function setPriority(float $priority): void;
/**
* @return Collection|AlternativeUrlInterface[]
*/
public function getAlternatives(): Collection;
/**
* @param AlternativeUrlInterface[] $alternatives
*/
public function setAlternatives(iterable $alternatives): void;
public function addAlternative(AlternativeUrlInterface $image): void;
public function hasAlternative(AlternativeUrlInterface $image): bool;
public function removeAlternative(AlternativeUrlInterface $image): void;
public function hasAlternatives(): bool;
/**
* @return Collection|ImageInterface[]
*/
public function getImages(): Collection;
/**
* @param ImageInterface[] $images
*/
public function setImages(iterable $images): void;
public function addImage(ImageInterface $image): void;
public function hasImage(ImageInterface $image): bool;
public function removeImage(ImageInterface $image): void;
public function hasImages(): bool;
}
| <?php
declare(strict_types=1);
namespace SitemapPlugin\Model;
use DateTimeInterface;
use Doctrine\Common\Collections\Collection;
interface UrlInterface
{
public function getLocation(): string;
public function setLocation(string $location): void;
public function getLastModification(): ?DateTimeInterface;
public function setLastModification(DateTimeInterface $lastModification): void;
public function getChangeFrequency(): string;
public function setChangeFrequency(ChangeFrequency $changeFrequency): void;
public function getPriority(): ?float;
public function setPriority(float $priority): void;
/**
* @return Collection|AlternativeUrlInterface[]
*/
public function getAlternatives(): Collection;
/**
* @param AlternativeUrlInterface[] $alternatives
*/
public function setAlternatives(iterable $alternatives): void;
public function addAlternative(AlternativeUrlInterface $alternative): void;
public function hasAlternative(AlternativeUrlInterface $alternative): bool;
public function removeAlternative(AlternativeUrlInterface $alternative): void;
public function hasAlternatives(): bool;
/**
* @return Collection|ImageInterface[]
*/
public function getImages(): Collection;
/**
* @param ImageInterface[] $images
*/
public function setImages(iterable $images): void;
public function addImage(ImageInterface $image): void;
public function hasImage(ImageInterface $image): bool;
public function removeImage(ImageInterface $image): void;
public function hasImages(): bool;
}
| Fix variable name in interface | Fix variable name in interface
| PHP | mit | stefandoorn/sitemap-plugin,stefandoorn/sitemap-plugin,stefandoorn/sitemap-plugin | php | ## Code Before:
<?php
declare(strict_types=1);
namespace SitemapPlugin\Model;
use DateTimeInterface;
use Doctrine\Common\Collections\Collection;
interface UrlInterface
{
public function getLocation(): string;
public function setLocation(string $location): void;
public function getLastModification(): ?DateTimeInterface;
public function setLastModification(DateTimeInterface $lastModification): void;
public function getChangeFrequency(): string;
public function setChangeFrequency(ChangeFrequency $changeFrequency): void;
public function getPriority(): ?float;
public function setPriority(float $priority): void;
/**
* @return Collection|AlternativeUrlInterface[]
*/
public function getAlternatives(): Collection;
/**
* @param AlternativeUrlInterface[] $alternatives
*/
public function setAlternatives(iterable $alternatives): void;
public function addAlternative(AlternativeUrlInterface $image): void;
public function hasAlternative(AlternativeUrlInterface $image): bool;
public function removeAlternative(AlternativeUrlInterface $image): void;
public function hasAlternatives(): bool;
/**
* @return Collection|ImageInterface[]
*/
public function getImages(): Collection;
/**
* @param ImageInterface[] $images
*/
public function setImages(iterable $images): void;
public function addImage(ImageInterface $image): void;
public function hasImage(ImageInterface $image): bool;
public function removeImage(ImageInterface $image): void;
public function hasImages(): bool;
}
## Instruction:
Fix variable name in interface
## Code After:
<?php
declare(strict_types=1);
namespace SitemapPlugin\Model;
use DateTimeInterface;
use Doctrine\Common\Collections\Collection;
interface UrlInterface
{
public function getLocation(): string;
public function setLocation(string $location): void;
public function getLastModification(): ?DateTimeInterface;
public function setLastModification(DateTimeInterface $lastModification): void;
public function getChangeFrequency(): string;
public function setChangeFrequency(ChangeFrequency $changeFrequency): void;
public function getPriority(): ?float;
public function setPriority(float $priority): void;
/**
* @return Collection|AlternativeUrlInterface[]
*/
public function getAlternatives(): Collection;
/**
* @param AlternativeUrlInterface[] $alternatives
*/
public function setAlternatives(iterable $alternatives): void;
public function addAlternative(AlternativeUrlInterface $alternative): void;
public function hasAlternative(AlternativeUrlInterface $alternative): bool;
public function removeAlternative(AlternativeUrlInterface $alternative): void;
public function hasAlternatives(): bool;
/**
* @return Collection|ImageInterface[]
*/
public function getImages(): Collection;
/**
* @param ImageInterface[] $images
*/
public function setImages(iterable $images): void;
public function addImage(ImageInterface $image): void;
public function hasImage(ImageInterface $image): bool;
public function removeImage(ImageInterface $image): void;
public function hasImages(): bool;
}
|
a3924e6f13a1edd37fedc78791f3f9f506fcfaaa | views/faq.jade | views/faq.jade | extends layout
block content
#content
h1= title
.spacer
.left
h3 ROSEDu Challenge Cookbook
p Glad you joined our challenge! To get started you should join the ROSEdu Challenge,
go to Home page and click "Start".
p As you can see you have many projects from which you can choose from. You don't have
to pick just one, you can add contributions to all of them. We encourgae you to
discover all of them.
p Each project has a mentor which can help you get started with the project, and
review your code.
.right
.submenu
.submenu-item-selected FAQ
a(href='/contact')
.submenu-item Contact
.spacer
| extends layout
block content
#content
h1= title
.spacer
.left
h3 ROSEDu Challenge Cookbook
p Glad you joined our challenge! To get started you should join the ROSEdu Challenge,
go to Home page and click "Start".
p As you can see you have many projects from which you can choose from. You don't have
to pick just one, you can add contributions to all of them. We encourgae you to
discover all of them.
p Each project has a mentor which can help you get started with the project, and
review your code.
h3 Why ROSEdu Challenge?
p We love Open Source and we have a lot of projects which need attention.
Events like Upstream Challenge, ROSEDu Summer of Code inspired us in this quest.
p Learn by contributing! :)
h3 How to contribute to Open Source?
p Github has a good a(href='https://guides.github.com/activities/contributing-to-open-source/')= "tutorial" which we recommend you read.
p You will quickly discover that each project is unique (of course). Most of the projects
have a Development/Hask section in the repository README.md, search for that when you browse
a new project.
h3 How to get started with Git and GitHub?
p We recommend you start with a(href='https://try.github.io/levels/1/challenges/1')= "Learn Git" and for more
answers nothing is better than a(href='http://git-scm.com/docs')= "official docs".
p GitHub is very easy to ease, their a(href='https://guides.github.com/introduction/flow/index.html')= "flow introduction"
will help you get started.
h3 Whom I can ask for help?
p You can drop as an email from the a(href='/contact')="Contact" section, or
a(href='https://github.com/blog/821-mention-somebody-they-re-notified')="mention one of the mentors" in an issue or pull request.
.right
.submenu
.submenu-item-selected FAQ
a(href='/contact')
.submenu-item Contact
.spacer
| Add help sections in FAQ | Add help sections in FAQ
| Jade | mit | catalin-oancea/challenge,catalin-oancea/challenge,rosedu/challenge,rosedu/challenge | jade | ## Code Before:
extends layout
block content
#content
h1= title
.spacer
.left
h3 ROSEDu Challenge Cookbook
p Glad you joined our challenge! To get started you should join the ROSEdu Challenge,
go to Home page and click "Start".
p As you can see you have many projects from which you can choose from. You don't have
to pick just one, you can add contributions to all of them. We encourgae you to
discover all of them.
p Each project has a mentor which can help you get started with the project, and
review your code.
.right
.submenu
.submenu-item-selected FAQ
a(href='/contact')
.submenu-item Contact
.spacer
## Instruction:
Add help sections in FAQ
## Code After:
extends layout
block content
#content
h1= title
.spacer
.left
h3 ROSEDu Challenge Cookbook
p Glad you joined our challenge! To get started you should join the ROSEdu Challenge,
go to Home page and click "Start".
p As you can see you have many projects from which you can choose from. You don't have
to pick just one, you can add contributions to all of them. We encourgae you to
discover all of them.
p Each project has a mentor which can help you get started with the project, and
review your code.
h3 Why ROSEdu Challenge?
p We love Open Source and we have a lot of projects which need attention.
Events like Upstream Challenge, ROSEDu Summer of Code inspired us in this quest.
p Learn by contributing! :)
h3 How to contribute to Open Source?
p Github has a good a(href='https://guides.github.com/activities/contributing-to-open-source/')= "tutorial" which we recommend you read.
p You will quickly discover that each project is unique (of course). Most of the projects
have a Development/Hask section in the repository README.md, search for that when you browse
a new project.
h3 How to get started with Git and GitHub?
p We recommend you start with a(href='https://try.github.io/levels/1/challenges/1')= "Learn Git" and for more
answers nothing is better than a(href='http://git-scm.com/docs')= "official docs".
p GitHub is very easy to ease, their a(href='https://guides.github.com/introduction/flow/index.html')= "flow introduction"
will help you get started.
h3 Whom I can ask for help?
p You can drop as an email from the a(href='/contact')="Contact" section, or
a(href='https://github.com/blog/821-mention-somebody-they-re-notified')="mention one of the mentors" in an issue or pull request.
.right
.submenu
.submenu-item-selected FAQ
a(href='/contact')
.submenu-item Contact
.spacer
|
a9ff19c2ab5432bf3be53fe2ea70e1a729778244 | gem/templates/springster/patterns/basics/languages/sp_variations/language-list-center_fixed.html | gem/templates/springster/patterns/basics/languages/sp_variations/language-list-center_fixed.html | {% load i18n %}
{% if languages|length > 1 %}
<div class="languages languages--fixed-header">
<ul class="language-list language-list--standard-center">
{% for language in languages %}
<li class="language-list__item language-list__item--standard-center">
<a href="{% url 'locale_set' language.locale %}?next={{request.path}}?{{ request.GET.urlencode }}" class="language-list__anchor language-list__anchor-standard-center {% if LANGUAGE_CODE == language.locale %} is-active {% endif %}">
{{language.locale|language_name_local}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
| {% load i18n %}
{% if languages|length > 1 %}
<div class="languages languages--fixed-header">
<ul class="language-list language-list--standard-center">
{% for language in languages %}
<li class="language-list__item language-list__item--standard-center">
<a href="{% url 'locale_set' language.locale %}?next={{request.path}}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="language-list__anchor language-list__anchor-standard-center {% if LANGUAGE_CODE == language.locale %} is-active {% endif %}">
{{language.locale|language_name_local}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
| Fix locale links for springster templates | Fix locale links for springster templates
| HTML | bsd-2-clause | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | html | ## Code Before:
{% load i18n %}
{% if languages|length > 1 %}
<div class="languages languages--fixed-header">
<ul class="language-list language-list--standard-center">
{% for language in languages %}
<li class="language-list__item language-list__item--standard-center">
<a href="{% url 'locale_set' language.locale %}?next={{request.path}}?{{ request.GET.urlencode }}" class="language-list__anchor language-list__anchor-standard-center {% if LANGUAGE_CODE == language.locale %} is-active {% endif %}">
{{language.locale|language_name_local}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
## Instruction:
Fix locale links for springster templates
## Code After:
{% load i18n %}
{% if languages|length > 1 %}
<div class="languages languages--fixed-header">
<ul class="language-list language-list--standard-center">
{% for language in languages %}
<li class="language-list__item language-list__item--standard-center">
<a href="{% url 'locale_set' language.locale %}?next={{request.path}}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="language-list__anchor language-list__anchor-standard-center {% if LANGUAGE_CODE == language.locale %} is-active {% endif %}">
{{language.locale|language_name_local}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
|
4a876f1d3d7916f903b66eaa94b34b09b3c9e681 | src/main/scala/cpup/mc/lib/util/GUIUtil.scala | src/main/scala/cpup/mc/lib/util/GUIUtil.scala | package cpup.mc.lib.util
import net.minecraft.util.{IIcon, ResourceLocation}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import org.lwjgl.opengl.GL11
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.Tessellator
@SideOnly(Side.CLIENT)
object GUIUtil {
val itemsIcon = new ResourceLocation("textures/atlas/items.png")
def mc = Minecraft.getMinecraft
def tess = Tessellator.instance
def drawItemIconAt(icon: IIcon, x: Int, y: Int, z: Double, width: Int, height: Int) {
GL11.glMatrixMode(5890)
GL11.glPushMatrix
mc.renderEngine.bindTexture(itemsIcon)
tess.startDrawingQuads
tess.addVertexWithUV(x, y, z, icon.getMinU, icon.getMinV)
tess.addVertexWithUV(x, y + height, z, icon.getMinU, icon.getMaxV)
tess.addVertexWithUV(x + width, y + height, z, icon.getMaxU, icon.getMaxV)
tess.addVertexWithUV(x + width, y, z, icon.getMaxU, icon.getMinV)
tess.draw
GL11.glPopMatrix
GL11.glMatrixMode(5888)
}
} | package cpup.mc.lib.util
import net.minecraft.util.{IIcon, ResourceLocation}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import org.lwjgl.opengl.GL11
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.Tessellator
@SideOnly(Side.CLIENT)
object GUIUtil {
val itemsIcon = new ResourceLocation("textures/atlas/items.png")
def mc = Minecraft.getMinecraft
def tess = Tessellator.instance
def drawItemIconAt(icon: IIcon, x: Double, y: Double, z: Double, width: Double, height: Double) {
GL11.glMatrixMode(5890)
GL11.glPushMatrix
mc.renderEngine.bindTexture(itemsIcon)
tess.startDrawingQuads
tess.addVertexWithUV(x, y, z, icon.getMinU, icon.getMinV)
tess.addVertexWithUV(x, y + height, z, icon.getMinU, icon.getMaxV)
tess.addVertexWithUV(x + width, y + height, z, icon.getMaxU, icon.getMaxV)
tess.addVertexWithUV(x + width, y, z, icon.getMaxU, icon.getMinV)
tess.draw
GL11.glPopMatrix
GL11.glMatrixMode(5888)
}
} | Use doubles instead of ints | Use doubles instead of ints
| Scala | mit | CoderPuppy/cpup-mc | scala | ## Code Before:
package cpup.mc.lib.util
import net.minecraft.util.{IIcon, ResourceLocation}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import org.lwjgl.opengl.GL11
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.Tessellator
@SideOnly(Side.CLIENT)
object GUIUtil {
val itemsIcon = new ResourceLocation("textures/atlas/items.png")
def mc = Minecraft.getMinecraft
def tess = Tessellator.instance
def drawItemIconAt(icon: IIcon, x: Int, y: Int, z: Double, width: Int, height: Int) {
GL11.glMatrixMode(5890)
GL11.glPushMatrix
mc.renderEngine.bindTexture(itemsIcon)
tess.startDrawingQuads
tess.addVertexWithUV(x, y, z, icon.getMinU, icon.getMinV)
tess.addVertexWithUV(x, y + height, z, icon.getMinU, icon.getMaxV)
tess.addVertexWithUV(x + width, y + height, z, icon.getMaxU, icon.getMaxV)
tess.addVertexWithUV(x + width, y, z, icon.getMaxU, icon.getMinV)
tess.draw
GL11.glPopMatrix
GL11.glMatrixMode(5888)
}
}
## Instruction:
Use doubles instead of ints
## Code After:
package cpup.mc.lib.util
import net.minecraft.util.{IIcon, ResourceLocation}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import org.lwjgl.opengl.GL11
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.Tessellator
@SideOnly(Side.CLIENT)
object GUIUtil {
val itemsIcon = new ResourceLocation("textures/atlas/items.png")
def mc = Minecraft.getMinecraft
def tess = Tessellator.instance
def drawItemIconAt(icon: IIcon, x: Double, y: Double, z: Double, width: Double, height: Double) {
GL11.glMatrixMode(5890)
GL11.glPushMatrix
mc.renderEngine.bindTexture(itemsIcon)
tess.startDrawingQuads
tess.addVertexWithUV(x, y, z, icon.getMinU, icon.getMinV)
tess.addVertexWithUV(x, y + height, z, icon.getMinU, icon.getMaxV)
tess.addVertexWithUV(x + width, y + height, z, icon.getMaxU, icon.getMaxV)
tess.addVertexWithUV(x + width, y, z, icon.getMaxU, icon.getMinV)
tess.draw
GL11.glPopMatrix
GL11.glMatrixMode(5888)
}
} |
b53ec4cd4dcdfedcd07fd4040da70a83e74602c8 | ssh/README.md | ssh/README.md | SSH
===
SSH comes with a big privacy hole by default. To fix that
* Edit `~/.ssh/config`
* Include the following
```
Host github.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/id_rsa # Or whatever you named your key
Host *
UseRoaming no
PubkeyAuthentication no
IdentitiesOnly yes
```
Remember to put `github.com` before `*`, if you don’t want to get an error.
Testing
-------
Test your configuration with [Filippo Valsorda’s tool][tool] by typing `ssh whoami.filippo.io` in your terminal. If you aren’t identified, you’ve set up your configuration correctly
| SSH
===
SSH comes with a big privacy hole by default. To fix that
* Edit `~/.ssh/config`
* Include the following
```
Host github.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/id_rsa # Or whatever you named your key
Host *
UseRoaming no
PubkeyAuthentication no
IdentitiesOnly yes
```
Remember to put `github.com` before `*`, if you don’t want to get an error.
Testing
-------
Test your configuration with [Filippo Valsorda’s tool][tool] by typing `ssh whoami.filippo.io` in your terminal. If you aren’t identified, you’ve set up your configuration correctly
[tool]: https://blog.filippo.io/ssh-whoami-filippo-io/
| Add missing link for ssh guide | Add missing link for ssh guide
| Markdown | mit | ndarville/style,ndarville/style | markdown | ## Code Before:
SSH
===
SSH comes with a big privacy hole by default. To fix that
* Edit `~/.ssh/config`
* Include the following
```
Host github.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/id_rsa # Or whatever you named your key
Host *
UseRoaming no
PubkeyAuthentication no
IdentitiesOnly yes
```
Remember to put `github.com` before `*`, if you don’t want to get an error.
Testing
-------
Test your configuration with [Filippo Valsorda’s tool][tool] by typing `ssh whoami.filippo.io` in your terminal. If you aren’t identified, you’ve set up your configuration correctly
## Instruction:
Add missing link for ssh guide
## Code After:
SSH
===
SSH comes with a big privacy hole by default. To fix that
* Edit `~/.ssh/config`
* Include the following
```
Host github.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/id_rsa # Or whatever you named your key
Host *
UseRoaming no
PubkeyAuthentication no
IdentitiesOnly yes
```
Remember to put `github.com` before `*`, if you don’t want to get an error.
Testing
-------
Test your configuration with [Filippo Valsorda’s tool][tool] by typing `ssh whoami.filippo.io` in your terminal. If you aren’t identified, you’ve set up your configuration correctly
[tool]: https://blog.filippo.io/ssh-whoami-filippo-io/
|
b05c2c05d46f0283f68cc6a3278538b185f15abc | app/views/pages/scaled.html.haml | app/views/pages/scaled.html.haml | = form_for root_path, html: { id: 'new_scaled_scenario' } do |f|
.row
.field
= render "pages/root_page/country_select"
.field
= render "pages/root_page/year_select"
.row
.field
%p Scaling attribute
%select(name="scaling_attribute")
%option(value="number_of_residences") Number of residences
.field
%p Scale to…
%input.string(type="text" name="scaling_value" placeholder="e.g. 1000, 250000, ...")
#submit
= render "pages/root_page/start_button"
| = form_tag root_path, id: 'new_scaled_scenario' do
.row
.field
= render "pages/root_page/country_select"
.field
= render "pages/root_page/year_select"
.row
.field
%p Scaling attribute
%select(name="scaling_attribute")
%option(value="number_of_residences") Number of residences
.field
%p Scale to…
%input.string(type="text" name="scaling_value" placeholder="e.g. 1000, 250000, ...")
#submit
= render "pages/root_page/start_button"
| Fix submission of scaled scenario form | Fix submission of scaled scenario form
| Haml | mit | quintel/etmodel,quintel/etmodel,quintel/etmodel,quintel/etmodel | haml | ## Code Before:
= form_for root_path, html: { id: 'new_scaled_scenario' } do |f|
.row
.field
= render "pages/root_page/country_select"
.field
= render "pages/root_page/year_select"
.row
.field
%p Scaling attribute
%select(name="scaling_attribute")
%option(value="number_of_residences") Number of residences
.field
%p Scale to…
%input.string(type="text" name="scaling_value" placeholder="e.g. 1000, 250000, ...")
#submit
= render "pages/root_page/start_button"
## Instruction:
Fix submission of scaled scenario form
## Code After:
= form_tag root_path, id: 'new_scaled_scenario' do
.row
.field
= render "pages/root_page/country_select"
.field
= render "pages/root_page/year_select"
.row
.field
%p Scaling attribute
%select(name="scaling_attribute")
%option(value="number_of_residences") Number of residences
.field
%p Scale to…
%input.string(type="text" name="scaling_value" placeholder="e.g. 1000, 250000, ...")
#submit
= render "pages/root_page/start_button"
|
9fa045649e847cf5994baa0e8a0d67fb0f313e3b | config/routes.php | config/routes.php | <?php
/**
* Which method in which MVC set will be executed
* for each defined action in this array.
*/
$actions = array(
'index' => \Ragnaroq\App\Runner::mvcAction('home', 'index'),
'welcome' => \Ragnaroq\App\Runner::mvcAction('example', 'greet'),
);
/**
* Which of the previously defined actions will
* be executed in each route.
*/
$routes = array(
'GET' => array(
'homepage' => $actions['index'],
'example' => $actions['welcome'],
),
'POST' => array(
),
'DELETE' => array(
),
'PUT' => array(
),
'OPTIONS' => array(
),
);
return $routes;
| <?php
/**
* Which method in which MVC set will be executed
* for each defined action in this array.
*/
$actions = array(
'index' => \Ragnaroq\App\Runner::mvcAction('home', 'index'),
'welcome' => \Ragnaroq\App\Runner::mvcAction('example', 'greet'),
'authorize' => \Ragnaroq\App\Runner::mvcAction('oauth2', 'authorizeCallback'),
);
/**
* Which of the previously defined actions will
* be executed in each route.
*/
$routes = array(
'GET' => array(
'homepage' => $actions['index'],
'example' => $actions['welcome'],
'authorize_callback' => $actions['authorize'],
),
'POST' => array(
),
'DELETE' => array(
),
'PUT' => array(
),
'OPTIONS' => array(
),
);
return $routes;
| Add route for OAuth2 callback | Add route for OAuth2 callback
| PHP | mit | spasquier/sv-egg-giver,spasquier/sv-egg-giver | php | ## Code Before:
<?php
/**
* Which method in which MVC set will be executed
* for each defined action in this array.
*/
$actions = array(
'index' => \Ragnaroq\App\Runner::mvcAction('home', 'index'),
'welcome' => \Ragnaroq\App\Runner::mvcAction('example', 'greet'),
);
/**
* Which of the previously defined actions will
* be executed in each route.
*/
$routes = array(
'GET' => array(
'homepage' => $actions['index'],
'example' => $actions['welcome'],
),
'POST' => array(
),
'DELETE' => array(
),
'PUT' => array(
),
'OPTIONS' => array(
),
);
return $routes;
## Instruction:
Add route for OAuth2 callback
## Code After:
<?php
/**
* Which method in which MVC set will be executed
* for each defined action in this array.
*/
$actions = array(
'index' => \Ragnaroq\App\Runner::mvcAction('home', 'index'),
'welcome' => \Ragnaroq\App\Runner::mvcAction('example', 'greet'),
'authorize' => \Ragnaroq\App\Runner::mvcAction('oauth2', 'authorizeCallback'),
);
/**
* Which of the previously defined actions will
* be executed in each route.
*/
$routes = array(
'GET' => array(
'homepage' => $actions['index'],
'example' => $actions['welcome'],
'authorize_callback' => $actions['authorize'],
),
'POST' => array(
),
'DELETE' => array(
),
'PUT' => array(
),
'OPTIONS' => array(
),
);
return $routes;
|
3bed7e08bab74f7e0b0b4c07abeb48709c78c218 | README.md | README.md |
A website that tries to help the Computer Science and Media students from our university with the hassle of remembering all the different links for their courses by eliminating that necessity.
## To Do / Problems
- Lack of order. The current implementation knows no order of the list items, so after reverting a filtered list to a former state, the order changes. That’s not good.
- `courses.json` is a bad name for the file since there are not only items for courses in it
- HTMLProofer to make sure links do not 404 too much.
- Find out whether `window.open(activeLinkItems[0].href, '_blank');` is troublesome
## Done
- BIG IDEA: Additionally of setting `list-item--active`(or instead), transfer `:focus` state. This *might* actually also scroll them into view!!!! OH MY GOD.
- Refactor the CSS mess
|
A website that tries to help the Computer Science and Media students from our university with the hassle of remembering all the different links for their courses by eliminating that necessity.
## To Do / Problems
- Lack of order. The current implementation knows no order of the list items, so after reverting a filtered list to a former state, the order changes. That’s not good.
- `courses.json` is a bad name for the file since there are not only items for courses in it
- HTMLProofer to make sure links do not 404 too much.
- Find out whether `window.open(activeLinkItems[0].href, '_blank');` is troublesome
- On navigating away from the page while there is any input in the filter results in a divergence when going back via browser history: the list is not filtered from the get go
- Special cased handling of enter key press on mobile should just hide keyboard?
## Done
- BIG IDEA: Additionally of setting `list-item--active`(or instead), transfer `:focus` state. This *might* actually also scroll them into view!!!! OH MY GOD.
- Refactor the CSS mess
| Add some to do entries | Add some to do entries | Markdown | mit | kleinfreund/vlau.me,kleinfreund/vlau.me,kleinfreund/hyperlink.cool,kleinfreund/hyperlink.cool | markdown | ## Code Before:
A website that tries to help the Computer Science and Media students from our university with the hassle of remembering all the different links for their courses by eliminating that necessity.
## To Do / Problems
- Lack of order. The current implementation knows no order of the list items, so after reverting a filtered list to a former state, the order changes. That’s not good.
- `courses.json` is a bad name for the file since there are not only items for courses in it
- HTMLProofer to make sure links do not 404 too much.
- Find out whether `window.open(activeLinkItems[0].href, '_blank');` is troublesome
## Done
- BIG IDEA: Additionally of setting `list-item--active`(or instead), transfer `:focus` state. This *might* actually also scroll them into view!!!! OH MY GOD.
- Refactor the CSS mess
## Instruction:
Add some to do entries
## Code After:
A website that tries to help the Computer Science and Media students from our university with the hassle of remembering all the different links for their courses by eliminating that necessity.
## To Do / Problems
- Lack of order. The current implementation knows no order of the list items, so after reverting a filtered list to a former state, the order changes. That’s not good.
- `courses.json` is a bad name for the file since there are not only items for courses in it
- HTMLProofer to make sure links do not 404 too much.
- Find out whether `window.open(activeLinkItems[0].href, '_blank');` is troublesome
- On navigating away from the page while there is any input in the filter results in a divergence when going back via browser history: the list is not filtered from the get go
- Special cased handling of enter key press on mobile should just hide keyboard?
## Done
- BIG IDEA: Additionally of setting `list-item--active`(or instead), transfer `:focus` state. This *might* actually also scroll them into view!!!! OH MY GOD.
- Refactor the CSS mess
|
d011be956948f5a3a6f50ded1d8b6e93b8a80e8b | README.md | README.md |
[](https://codeclimate.com/github/innosoft-pro/label-them)
[](https://www.codacy.com/app/LabelThem/label-them?utm_source=github.com&utm_medium=referral&utm_content=innosoft-pro/label-them&utm_campaign=Badge_Grade)
LabelThem is an online markup tool aimed at building image datasets for computer vision research, and integrated with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/).
#### Important Notice
At the moment LabelThem works only with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/) in [Chromium Browser](http://www.chromium.org/Home). |
[](https://codeclimate.com/github/innosoft-pro/label-them)
[](https://www.codacy.com/app/LabelThem/label-them?utm_source=github.com&utm_medium=referral&utm_content=innosoft-pro/label-them&utm_campaign=Badge_Grade)
LabelThem is an online markup tool aimed at building image datasets for computer vision research, and integrated with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/).
#### Important Notice
At the moment LabelThem works only with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/) in [Chromium Browser](http://www.chromium.org/Home).
!!! Concatenated and minified 'build' file generation (through 'Grunt' process builder):
In case of modifying the 'front-end':
Type the following commands in terminal:
// If you don’t already have Node.js installed on your system, go do that first.
1) npm update // goes through the package.json file and installs all the pre-defined dependencies (plugins)
2) grunt // builds the project's minified and concatenated file
In case of working only on the 'back-end' (i.e. python),
there is an 'app.min.js' folder available on the version control,
so you don't have to do anything related to the building process. | Write instruction for the building generation (Grunt). | [MF] Write instruction for the building generation (Grunt).
| Markdown | mit | AlNedorezov/label-them,innosoft-pro/label-them,innosoft-pro/label-them,AlNedorezov/label-them,innosoft-pro/label-them,innosoft-pro/label-them,AlNedorezov/label-them | markdown | ## Code Before:
[](https://codeclimate.com/github/innosoft-pro/label-them)
[](https://www.codacy.com/app/LabelThem/label-them?utm_source=github.com&utm_medium=referral&utm_content=innosoft-pro/label-them&utm_campaign=Badge_Grade)
LabelThem is an online markup tool aimed at building image datasets for computer vision research, and integrated with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/).
#### Important Notice
At the moment LabelThem works only with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/) in [Chromium Browser](http://www.chromium.org/Home).
## Instruction:
[MF] Write instruction for the building generation (Grunt).
## Code After:
[](https://codeclimate.com/github/innosoft-pro/label-them)
[](https://www.codacy.com/app/LabelThem/label-them?utm_source=github.com&utm_medium=referral&utm_content=innosoft-pro/label-them&utm_campaign=Badge_Grade)
LabelThem is an online markup tool aimed at building image datasets for computer vision research, and integrated with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/).
#### Important Notice
At the moment LabelThem works only with [Yandex.Toloka crowdsourcing system](https://toloka.yandex.ru/) in [Chromium Browser](http://www.chromium.org/Home).
!!! Concatenated and minified 'build' file generation (through 'Grunt' process builder):
In case of modifying the 'front-end':
Type the following commands in terminal:
// If you don’t already have Node.js installed on your system, go do that first.
1) npm update // goes through the package.json file and installs all the pre-defined dependencies (plugins)
2) grunt // builds the project's minified and concatenated file
In case of working only on the 'back-end' (i.e. python),
there is an 'app.min.js' folder available on the version control,
so you don't have to do anything related to the building process. |
3f84446082351a015cb36311dfb55ca0486ea62a | lib/stacks/proxy_server.rb | lib/stacks/proxy_server.rb | require 'stacks/namespace'
class Stacks::ProxyServer < Stacks::MachineDef
attr_reader :virtual_service
def initialize(virtual_service, index)
super(virtual_service.name + "-" + index)
@virtual_service = virtual_service
end
def bind_to(environment)
super(environment)
end
def to_enc
service_resources = Hash[virtual_service.downstream_services()]
{'role::proxyserver' => {
'prod_vip_fqdn' => @virtual_service.vip_fqdn(:prod),
'vhosts' => service_resources,
'environment' => environment.name
}
}
end
end
| require 'stacks/namespace'
class Stacks::ProxyServer < Stacks::MachineDef
attr_reader :virtual_service, :disable_enc
def initialize(virtual_service, index)
super(virtual_service.name + "-" + index)
@virtual_service = virtual_service
@disable_enc = false
end
def bind_to(environment)
super(environment)
end
def disable_enc
@disable_enc = true
end
def to_enc
if @disable_enc
{}
else
service_resources = Hash[virtual_service.downstream_services()]
{
'role::proxyserver' => {
'prod_vip_fqdn' => @virtual_service.vip_fqdn(:prod),
'vhosts' => service_resources,
'environment' => environment.name
}
}
end
end
end
| Add temporary hack to disable enc data output for proxy servers. This is going to be coming from puppet for the shared proxy. | rpearce: Add temporary hack to disable enc data output for proxy
servers. This is going to be coming from puppet for the shared proxy.
| Ruby | mit | tim-group/stackbuilder,tim-group/stackbuilder | ruby | ## Code Before:
require 'stacks/namespace'
class Stacks::ProxyServer < Stacks::MachineDef
attr_reader :virtual_service
def initialize(virtual_service, index)
super(virtual_service.name + "-" + index)
@virtual_service = virtual_service
end
def bind_to(environment)
super(environment)
end
def to_enc
service_resources = Hash[virtual_service.downstream_services()]
{'role::proxyserver' => {
'prod_vip_fqdn' => @virtual_service.vip_fqdn(:prod),
'vhosts' => service_resources,
'environment' => environment.name
}
}
end
end
## Instruction:
rpearce: Add temporary hack to disable enc data output for proxy
servers. This is going to be coming from puppet for the shared proxy.
## Code After:
require 'stacks/namespace'
class Stacks::ProxyServer < Stacks::MachineDef
attr_reader :virtual_service, :disable_enc
def initialize(virtual_service, index)
super(virtual_service.name + "-" + index)
@virtual_service = virtual_service
@disable_enc = false
end
def bind_to(environment)
super(environment)
end
def disable_enc
@disable_enc = true
end
def to_enc
if @disable_enc
{}
else
service_resources = Hash[virtual_service.downstream_services()]
{
'role::proxyserver' => {
'prod_vip_fqdn' => @virtual_service.vip_fqdn(:prod),
'vhosts' => service_resources,
'environment' => environment.name
}
}
end
end
end
|
1a4f8de838f9ba4fc1b5d01e4f8c4ba0557ff87b | src/popup/components/BlacklistConfirm.css | src/popup/components/BlacklistConfirm.css | .container {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20px;
height: 200px;
}
.header {
font-size: 1.5em;
text-align: center;
}
.content {
font-size: 1.1em;
text-align: center;
}
.btnBar {
display: flex;
flex-direction: row;
justify-content: space-around;
width: 100%;
}
.btn {
font-size: 1.5em;
border: none;
width: 60px;
cursor: pointer;
&:hover {
color: rgb(62, 185, 149);
}
}
.btnDanger {
color: rgb(255, 74, 85);
}
| .container {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20px;
height: 200px;
}
.header {
font-size: 1.5em;
text-align: center;
}
.content {
font-size: 1.1em;
text-align: center;
}
.btnBar {
display: flex;
flex-direction: row;
justify-content: space-around;
width: 100%;
}
.btn {
font-size: 1.5em;
border: 1px solid #e5e5e5;
padding: 10px 20px;
border-radius: 15px;
width: 80px;
cursor: pointer;
&:hover {
color: rgb(62, 185, 149);
background: #f2f2f2;
}
}
.btnDanger {
color: rgb(255, 74, 85);
}
| Put a little border around blacklist confirm buttons | Put a little border around blacklist confirm buttons
| CSS | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | css | ## Code Before:
.container {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20px;
height: 200px;
}
.header {
font-size: 1.5em;
text-align: center;
}
.content {
font-size: 1.1em;
text-align: center;
}
.btnBar {
display: flex;
flex-direction: row;
justify-content: space-around;
width: 100%;
}
.btn {
font-size: 1.5em;
border: none;
width: 60px;
cursor: pointer;
&:hover {
color: rgb(62, 185, 149);
}
}
.btnDanger {
color: rgb(255, 74, 85);
}
## Instruction:
Put a little border around blacklist confirm buttons
## Code After:
.container {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20px;
height: 200px;
}
.header {
font-size: 1.5em;
text-align: center;
}
.content {
font-size: 1.1em;
text-align: center;
}
.btnBar {
display: flex;
flex-direction: row;
justify-content: space-around;
width: 100%;
}
.btn {
font-size: 1.5em;
border: 1px solid #e5e5e5;
padding: 10px 20px;
border-radius: 15px;
width: 80px;
cursor: pointer;
&:hover {
color: rgb(62, 185, 149);
background: #f2f2f2;
}
}
.btnDanger {
color: rgb(255, 74, 85);
}
|
8be5f534f42691942e74ed98f5eaa327df684fe6 | js/main.js | js/main.js | function openCourse(Course) {
var i, x;
x = document.getElementsByClassName("schedule");
for(i=0;i<x.length;i++){
x[i].style.display = 'none';
}
document.getElementById(Course).style.display = "block";
}
| function openCourse(Course) {
var i, x, y;
x = document.getElementsByClassName("schedule");
y = document.getElementById(Course);
for(i=0;i<x.length;i++){
x[i].style.display = 'none';
}
y.style.display = "block";
y.className = y.className + ' ' + Course.toLowerCase();
}
| Add change of tab color on click to schedule | Add change of tab color on click to schedule
| JavaScript | cc0-1.0 | FatecSorocaba/semana-da-tecnologia,FatecSorocaba/semana-da-tecnologia | javascript | ## Code Before:
function openCourse(Course) {
var i, x;
x = document.getElementsByClassName("schedule");
for(i=0;i<x.length;i++){
x[i].style.display = 'none';
}
document.getElementById(Course).style.display = "block";
}
## Instruction:
Add change of tab color on click to schedule
## Code After:
function openCourse(Course) {
var i, x, y;
x = document.getElementsByClassName("schedule");
y = document.getElementById(Course);
for(i=0;i<x.length;i++){
x[i].style.display = 'none';
}
y.style.display = "block";
y.className = y.className + ' ' + Course.toLowerCase();
}
|
743755b24cb40999c00b6aae84fa605850d7ccde | app/views/advocates/claims/index.html.haml | app/views/advocates/claims/index.html.haml | - if current_user.persona.admin?
= render 'nav_tabs'
%header.page-title
%h1
= t('.claims')
= link_to t('link.add_claim'), new_advocates_claim_path, class: 'button'
#summary
= render partial: 'financial_summary', locals: { financial_summary: @financial_summary }
#search-options
= render partial: 'search_form'
#search-summary
- if params[:search].present?
= render partial: 'shared/search_summary'
#claim-accordion
%h2
=t('.draft')
(#{@draft_claims.count})
%section#draft
= render partial: 'claims', locals: { claims: @draft_claims }
%h2
=t('.rejected')
(#{@rejected_claims.count})
%section#rejected
= render partial: 'claims', locals: { claims: @rejected_claims }
%h2
= t('.submitted')
(#{@submitted_claims.count})
%section#submitted
= render partial: 'claims', locals: { claims: @submitted_claims }
%h2
=t('.part_paid')
(#{@part_paid_claims.count})
%section#part_paid
= render partial: 'claims', locals: { claims: @part_paid_claims }
%h2
=t('.completed')
(#{@completed_claims.count})
%section#completed
= render partial: 'claims', locals: { claims: @completed_claims }
| %header.page-title
%h1
= t('.claims')
= link_to t('link.add_claim'), new_advocates_claim_path, class: 'button'
#summary
= render partial: 'financial_summary', locals: { financial_summary: @financial_summary }
#search-options
= render partial: 'search_form'
#search-summary
- if params[:search].present?
= render partial: 'shared/search_summary'
#claim-accordion
%h2
=t('.draft')
(#{@draft_claims.count})
%section#draft
= render partial: 'claims', locals: { claims: @draft_claims }
%h2
=t('.rejected')
(#{@rejected_claims.count})
%section#rejected
= render partial: 'claims', locals: { claims: @rejected_claims }
%h2
= t('.submitted')
(#{@submitted_claims.count})
%section#submitted
= render partial: 'claims', locals: { claims: @submitted_claims }
%h2
=t('.part_paid')
(#{@part_paid_claims.count})
%section#part_paid
= render partial: 'claims', locals: { claims: @part_paid_claims }
%h2
=t('.completed')
(#{@completed_claims.count})
%section#completed
= render partial: 'claims', locals: { claims: @completed_claims }
| Remove tabs from the advocate admin users home page | Remove tabs from the advocate admin users home page
| Haml | mit | ministryofjustice/advocate-defence-payments,ministryofjustice/advocate-defence-payments,ministryofjustice/advocate-defence-payments,ministryofjustice/advocate-defence-payments | haml | ## Code Before:
- if current_user.persona.admin?
= render 'nav_tabs'
%header.page-title
%h1
= t('.claims')
= link_to t('link.add_claim'), new_advocates_claim_path, class: 'button'
#summary
= render partial: 'financial_summary', locals: { financial_summary: @financial_summary }
#search-options
= render partial: 'search_form'
#search-summary
- if params[:search].present?
= render partial: 'shared/search_summary'
#claim-accordion
%h2
=t('.draft')
(#{@draft_claims.count})
%section#draft
= render partial: 'claims', locals: { claims: @draft_claims }
%h2
=t('.rejected')
(#{@rejected_claims.count})
%section#rejected
= render partial: 'claims', locals: { claims: @rejected_claims }
%h2
= t('.submitted')
(#{@submitted_claims.count})
%section#submitted
= render partial: 'claims', locals: { claims: @submitted_claims }
%h2
=t('.part_paid')
(#{@part_paid_claims.count})
%section#part_paid
= render partial: 'claims', locals: { claims: @part_paid_claims }
%h2
=t('.completed')
(#{@completed_claims.count})
%section#completed
= render partial: 'claims', locals: { claims: @completed_claims }
## Instruction:
Remove tabs from the advocate admin users home page
## Code After:
%header.page-title
%h1
= t('.claims')
= link_to t('link.add_claim'), new_advocates_claim_path, class: 'button'
#summary
= render partial: 'financial_summary', locals: { financial_summary: @financial_summary }
#search-options
= render partial: 'search_form'
#search-summary
- if params[:search].present?
= render partial: 'shared/search_summary'
#claim-accordion
%h2
=t('.draft')
(#{@draft_claims.count})
%section#draft
= render partial: 'claims', locals: { claims: @draft_claims }
%h2
=t('.rejected')
(#{@rejected_claims.count})
%section#rejected
= render partial: 'claims', locals: { claims: @rejected_claims }
%h2
= t('.submitted')
(#{@submitted_claims.count})
%section#submitted
= render partial: 'claims', locals: { claims: @submitted_claims }
%h2
=t('.part_paid')
(#{@part_paid_claims.count})
%section#part_paid
= render partial: 'claims', locals: { claims: @part_paid_claims }
%h2
=t('.completed')
(#{@completed_claims.count})
%section#completed
= render partial: 'claims', locals: { claims: @completed_claims }
|
33f17b7a829f596f6f4cf8a4aa56964dc729aa30 | Cargo.toml | Cargo.toml | [package]
name = "mio-serial"
version = "3.1.0"
authors = ["Zac Berkowitz <zac.berkowitz@gmail.com>"]
description = "A serial port implementation for mio"
license = "MIT"
homepage = "https://github.com/berkowski/mio-serial"
repository = "https://github.com/berkowski/mio-serial"
documentation = "http://docs.rs/mio-serial"
readme = "README.md"
keywords = ["rs232", "serial", "mio"]
categories = ["asynchronous", "hardware-support"]
[badges]
appveyor = { repository = "berkowski/mio-serial", service = "github" }
travis-ci = { repository = "berkowski/mio-serial", service = "github" }
[features]
default = ["libudev"]
libudev = ["serialport/libudev"]
[dependencies]
mio = "0.6"
serialport = "~3.1"
[target.'cfg(unix)'.dependencies]
nix = "0.11"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["commapi", "handleapi", "winbase"] }
mio-named-pipes = "0.1.5"
[[example]]
name = "serial_printline"
path = "examples/serial_printline.rs"
| [package]
name = "mio-serial"
version = "3.1.0"
authors = ["Zac Berkowitz <zac.berkowitz@gmail.com>"]
description = "A serial port implementation for mio"
license = "MIT"
homepage = "https://github.com/berkowski/mio-serial"
repository = "https://github.com/berkowski/mio-serial"
documentation = "http://docs.rs/mio-serial"
readme = "README.md"
keywords = ["rs232", "serial", "mio"]
categories = ["asynchronous", "hardware-support"]
[badges]
appveyor = { repository = "berkowski/mio-serial", service = "github" }
travis-ci = { repository = "berkowski/mio-serial", service = "github" }
[features]
default = ["libudev"]
libudev = ["serialport/libudev"]
[dependencies]
mio = "0.6"
serialport = { version = "~3.1", default-features = false }
[target.'cfg(unix)'.dependencies]
nix = "0.11"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["commapi", "handleapi", "winbase"] }
mio-named-pipes = "0.1.5"
[[example]]
name = "serial_printline"
path = "examples/serial_printline.rs"
| Fix feature flag to not mandatory require libudev | Fix feature flag to not mandatory require libudev
Before, the serialport/default feature wasn't turned off even if the default
feature of the mio-serial was off. We need to deselect the serialport/default
explicitly, and turn it on by the default of the mio-serial.
| TOML | mit | berkowski/mio-serial | toml | ## Code Before:
[package]
name = "mio-serial"
version = "3.1.0"
authors = ["Zac Berkowitz <zac.berkowitz@gmail.com>"]
description = "A serial port implementation for mio"
license = "MIT"
homepage = "https://github.com/berkowski/mio-serial"
repository = "https://github.com/berkowski/mio-serial"
documentation = "http://docs.rs/mio-serial"
readme = "README.md"
keywords = ["rs232", "serial", "mio"]
categories = ["asynchronous", "hardware-support"]
[badges]
appveyor = { repository = "berkowski/mio-serial", service = "github" }
travis-ci = { repository = "berkowski/mio-serial", service = "github" }
[features]
default = ["libudev"]
libudev = ["serialport/libudev"]
[dependencies]
mio = "0.6"
serialport = "~3.1"
[target.'cfg(unix)'.dependencies]
nix = "0.11"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["commapi", "handleapi", "winbase"] }
mio-named-pipes = "0.1.5"
[[example]]
name = "serial_printline"
path = "examples/serial_printline.rs"
## Instruction:
Fix feature flag to not mandatory require libudev
Before, the serialport/default feature wasn't turned off even if the default
feature of the mio-serial was off. We need to deselect the serialport/default
explicitly, and turn it on by the default of the mio-serial.
## Code After:
[package]
name = "mio-serial"
version = "3.1.0"
authors = ["Zac Berkowitz <zac.berkowitz@gmail.com>"]
description = "A serial port implementation for mio"
license = "MIT"
homepage = "https://github.com/berkowski/mio-serial"
repository = "https://github.com/berkowski/mio-serial"
documentation = "http://docs.rs/mio-serial"
readme = "README.md"
keywords = ["rs232", "serial", "mio"]
categories = ["asynchronous", "hardware-support"]
[badges]
appveyor = { repository = "berkowski/mio-serial", service = "github" }
travis-ci = { repository = "berkowski/mio-serial", service = "github" }
[features]
default = ["libudev"]
libudev = ["serialport/libudev"]
[dependencies]
mio = "0.6"
serialport = { version = "~3.1", default-features = false }
[target.'cfg(unix)'.dependencies]
nix = "0.11"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["commapi", "handleapi", "winbase"] }
mio-named-pipes = "0.1.5"
[[example]]
name = "serial_printline"
path = "examples/serial_printline.rs"
|
f3419f9fb93c181ce7f1cc56de19cc50d32b94ae | kolibri/plugins/style_guide/assets/src/views/shell/table-of-contents.vue | kolibri/plugins/style_guide/assets/src/views/shell/table-of-contents.vue | <template>
<ul>
<li v-for="anchor in anchors">
<a :href="route" @click="goToAnchor(anchor.hash)">
{{ anchor.label }}
</a>
</li>
</ul>
</template>
<script>
/**
* A component for auto-generating a table of contents for a page. All
* elements with an [id] attribute defined will be shown in the TOC.
*/
const map = require('lodash/map');
module.exports = {
name: 'TableOfContents',
data() {
return {
// These are all the anchors to show in the TOC.
// They are objects with the "hash" and "label" properties.
anchors: [],
route: ''
};
},
mounted() {
this.route = this.$route.path.replace('/', '#');
this.anchors = map(
this.$parent.$el.querySelectorAll('[id]'),
(sectionHeadingEl) => ({
hash: `#${sectionHeadingEl.id}`,
label: sectionHeadingEl.innerText
}));
},
methods: {
// Uses the provided hash (e.g. "#heading") as the ID to find the element
// with anchor behavior, and scrolls it into view.
goToAnchor(hash) {
// Notes: scrollIntoView() may not be available in older browsers.
document.querySelector(hash).scrollIntoView();
}
},
};
</script>
<style lang="stylus" scoped>
ul
list-style-type: none
</style>
| <template>
<ul>
<li v-for="anchor in anchors">
<a :href="route" @click="goToAnchor(anchor.hash)">
{{ anchor.label }}
</a>
</li>
</ul>
</template>
<script>
/**
* A component for auto-generating a table of contents for a page. All
* elements with an [id] attribute defined will be shown in the TOC.
*/
const map = require('lodash/map');
module.exports = {
name: 'TableOfContents',
data() {
return {
// These are all the anchors to show in the TOC.
// They are objects with the "hash" and "label" properties.
anchors: [],
// This will be auto-populated to the current route.
route: ''
};
},
mounted() {
this.route = this.$route.path.replace('/', '#');
this.anchors = map(
this.$parent.$el.querySelectorAll('[id]'),
(sectionHeadingEl) => ({
hash: `#${sectionHeadingEl.id}`,
label: sectionHeadingEl.innerText
}));
},
methods: {
// Uses the provided hash (e.g. "#heading") as the ID to find the element
// with anchor behavior, and scrolls it into view.
goToAnchor(hash) {
// Notes: scrollIntoView() may not be available in older browsers.
document.querySelector(hash).scrollIntoView();
}
},
};
</script>
<style lang="stylus" scoped>
ul
list-style-type: none
</style>
| Add comments for the 'route' data | Add comments for the
'route' data
| Vue | mit | benjaoming/kolibri,learningequality/kolibri,jonboiser/kolibri,DXCanas/kolibri,christianmemije/kolibri,indirectlylit/kolibri,DXCanas/kolibri,lyw07/kolibri,mrpau/kolibri,benjaoming/kolibri,lyw07/kolibri,mrpau/kolibri,indirectlylit/kolibri,benjaoming/kolibri,learningequality/kolibri,learningequality/kolibri,lyw07/kolibri,mrpau/kolibri,mrpau/kolibri,lyw07/kolibri,jonboiser/kolibri,indirectlylit/kolibri,DXCanas/kolibri,christianmemije/kolibri,DXCanas/kolibri,jonboiser/kolibri,learningequality/kolibri,christianmemije/kolibri,christianmemije/kolibri,benjaoming/kolibri,indirectlylit/kolibri,jonboiser/kolibri | vue | ## Code Before:
<template>
<ul>
<li v-for="anchor in anchors">
<a :href="route" @click="goToAnchor(anchor.hash)">
{{ anchor.label }}
</a>
</li>
</ul>
</template>
<script>
/**
* A component for auto-generating a table of contents for a page. All
* elements with an [id] attribute defined will be shown in the TOC.
*/
const map = require('lodash/map');
module.exports = {
name: 'TableOfContents',
data() {
return {
// These are all the anchors to show in the TOC.
// They are objects with the "hash" and "label" properties.
anchors: [],
route: ''
};
},
mounted() {
this.route = this.$route.path.replace('/', '#');
this.anchors = map(
this.$parent.$el.querySelectorAll('[id]'),
(sectionHeadingEl) => ({
hash: `#${sectionHeadingEl.id}`,
label: sectionHeadingEl.innerText
}));
},
methods: {
// Uses the provided hash (e.g. "#heading") as the ID to find the element
// with anchor behavior, and scrolls it into view.
goToAnchor(hash) {
// Notes: scrollIntoView() may not be available in older browsers.
document.querySelector(hash).scrollIntoView();
}
},
};
</script>
<style lang="stylus" scoped>
ul
list-style-type: none
</style>
## Instruction:
Add comments for the
'route' data
## Code After:
<template>
<ul>
<li v-for="anchor in anchors">
<a :href="route" @click="goToAnchor(anchor.hash)">
{{ anchor.label }}
</a>
</li>
</ul>
</template>
<script>
/**
* A component for auto-generating a table of contents for a page. All
* elements with an [id] attribute defined will be shown in the TOC.
*/
const map = require('lodash/map');
module.exports = {
name: 'TableOfContents',
data() {
return {
// These are all the anchors to show in the TOC.
// They are objects with the "hash" and "label" properties.
anchors: [],
// This will be auto-populated to the current route.
route: ''
};
},
mounted() {
this.route = this.$route.path.replace('/', '#');
this.anchors = map(
this.$parent.$el.querySelectorAll('[id]'),
(sectionHeadingEl) => ({
hash: `#${sectionHeadingEl.id}`,
label: sectionHeadingEl.innerText
}));
},
methods: {
// Uses the provided hash (e.g. "#heading") as the ID to find the element
// with anchor behavior, and scrolls it into view.
goToAnchor(hash) {
// Notes: scrollIntoView() may not be available in older browsers.
document.querySelector(hash).scrollIntoView();
}
},
};
</script>
<style lang="stylus" scoped>
ul
list-style-type: none
</style>
|
7d60b0e20d4e93336cadb941e121fa2716194445 | .travis.yml | .travis.yml | language: ruby
rvm:
- '2.1.2'
- '2.1.1'
- '2.1.0'
- '2.0.0'
- '1.9.3'
gemfile:
- gemfiles/rails_3.2.21.gemfile
- gemfiles/rails_4.0.12.gemfile
- gemfiles/rails_4.1.8.gemfile
- gemfiles/rails_4.2.0.rc1.gemfile
addons:
postgresql: '9.3'
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- cp spec/dummy/config/database.travis.yml spec/dummy/config/database.yml
script: 'bundle exec rspec spec'
| language: ruby
rvm:
- '2.1.2'
- '2.1.1'
- '2.1.0'
- '2.0.0'
- '1.9.3'
gemfile:
- gemfiles/rails_3.2.21.gemfile
- gemfiles/rails_4.0.12.gemfile
- gemfiles/rails_4.1.8.gemfile
- gemfiles/rails_4.2.0.rc1.gemfile
addons:
postgresql: '9.3'
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- cd spec/dummy/
- cp config/database.travis.yml config/database.yml
- bundle exec rake db:schema:load
- cd ../../
script: 'bundle exec rspec spec'
| Load and prepare DB before test | Load and prepare DB before test
The bin/rake db:migrate task runs the migrations and then dumps the
structure of the database to a file called db/schema.rb. This structure
allows you to restore your database using the bin/rake db:schema:load
task if you wish, which is better than running all the migrations on a
large project again!
Source:
http://www.42.mach7x.com/2013/10/03/dbmigrate-or-dbschemaload-for-rails-
project-with-many-migations/
| YAML | mit | itsmrwave/annotator_store-gem,itsmrwave/annotator_store-gem | yaml | ## Code Before:
language: ruby
rvm:
- '2.1.2'
- '2.1.1'
- '2.1.0'
- '2.0.0'
- '1.9.3'
gemfile:
- gemfiles/rails_3.2.21.gemfile
- gemfiles/rails_4.0.12.gemfile
- gemfiles/rails_4.1.8.gemfile
- gemfiles/rails_4.2.0.rc1.gemfile
addons:
postgresql: '9.3'
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- cp spec/dummy/config/database.travis.yml spec/dummy/config/database.yml
script: 'bundle exec rspec spec'
## Instruction:
Load and prepare DB before test
The bin/rake db:migrate task runs the migrations and then dumps the
structure of the database to a file called db/schema.rb. This structure
allows you to restore your database using the bin/rake db:schema:load
task if you wish, which is better than running all the migrations on a
large project again!
Source:
http://www.42.mach7x.com/2013/10/03/dbmigrate-or-dbschemaload-for-rails-
project-with-many-migations/
## Code After:
language: ruby
rvm:
- '2.1.2'
- '2.1.1'
- '2.1.0'
- '2.0.0'
- '1.9.3'
gemfile:
- gemfiles/rails_3.2.21.gemfile
- gemfiles/rails_4.0.12.gemfile
- gemfiles/rails_4.1.8.gemfile
- gemfiles/rails_4.2.0.rc1.gemfile
addons:
postgresql: '9.3'
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- cd spec/dummy/
- cp config/database.travis.yml config/database.yml
- bundle exec rake db:schema:load
- cd ../../
script: 'bundle exec rspec spec'
|
0dccd00330602537099595dc2cb419f71a113025 | scouts.html | scouts.html | ---
bg: "moon_stick.jpg"
layout: page
permalink: /scouts/
tab_text: "Krewe Du Moon Sailor Scouts"
title: "Sailor Scouts"
summary: "Krewe Du Moon Sailor Scouts"
active: scouts
---
{% for post in site.posts limit: 5 %}
{% if post.categories contains "scout" %}
<article class="index-page">
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<h5>{{ post.date | date: "%m/%d/%Y" }}</h5>
{{ post.excerpt }}
</article>
{% endif %}
{% endfor %}
| ---
bg: "girl_gang.jpg"
layout: page
permalink: /scouts/
tab_text: "Krewe Du Moon Sailor Scouts"
title: "Sailor Scouts"
summary: "Krewe Du Moon Sailor Scouts"
active: scouts
---
{% for post in site.posts limit: 5 %}
{% if post.categories contains "scout" %}
<article class="index-page">
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<h5>{{ post.date | date: "%m/%d/%Y" }}</h5>
{{ post.excerpt }}
</article>
{% endif %}
{% endfor %}
| Update Phpto Scout Bio Page | Update Phpto Scout Bio Page
| HTML | mit | SpaceOtterInSpace/krewedumoon,krewedumoon/krewedumoon,SpaceOtterInSpace/krewedumoon,krewedumoon/krewedumoon | html | ## Code Before:
---
bg: "moon_stick.jpg"
layout: page
permalink: /scouts/
tab_text: "Krewe Du Moon Sailor Scouts"
title: "Sailor Scouts"
summary: "Krewe Du Moon Sailor Scouts"
active: scouts
---
{% for post in site.posts limit: 5 %}
{% if post.categories contains "scout" %}
<article class="index-page">
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<h5>{{ post.date | date: "%m/%d/%Y" }}</h5>
{{ post.excerpt }}
</article>
{% endif %}
{% endfor %}
## Instruction:
Update Phpto Scout Bio Page
## Code After:
---
bg: "girl_gang.jpg"
layout: page
permalink: /scouts/
tab_text: "Krewe Du Moon Sailor Scouts"
title: "Sailor Scouts"
summary: "Krewe Du Moon Sailor Scouts"
active: scouts
---
{% for post in site.posts limit: 5 %}
{% if post.categories contains "scout" %}
<article class="index-page">
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<h5>{{ post.date | date: "%m/%d/%Y" }}</h5>
{{ post.excerpt }}
</article>
{% endif %}
{% endfor %}
|
c9735ce9ea330737cf47474ef420303c56a32873 | apps/demos/admin.py | apps/demos/admin.py | from django.contrib import admin
from .models import Submission
class SubmissionAdmin(admin.ModelAdmin):
list_display = ( 'title', 'creator', 'featured', 'hidden', 'tags', 'modified', )
admin.site.register(Submission, SubmissionAdmin)
| from django.contrib import admin
from .models import Submission
class SubmissionAdmin(admin.ModelAdmin):
list_display = ( 'title', 'creator', 'featured', 'hidden', 'tags', 'modified', )
list_editable = ( 'featured', 'hidden' )
admin.site.register(Submission, SubmissionAdmin)
| Make featured and hidden flags editable from demo listing | Make featured and hidden flags editable from demo listing
| Python | mpl-2.0 | bluemini/kuma,openjck/kuma,hoosteeno/kuma,Elchi3/kuma,davehunt/kuma,anaran/kuma,robhudson/kuma,davidyezsetz/kuma,darkwing/kuma,anaran/kuma,chirilo/kuma,jezdez/kuma,yfdyh000/kuma,nhenezi/kuma,Elchi3/kuma,ronakkhunt/kuma,a2sheppy/kuma,groovecoder/kuma,SphinxKnight/kuma,escattone/kuma,jezdez/kuma,tximikel/kuma,a2sheppy/kuma,varunkamra/kuma,ollie314/kuma,ronakkhunt/kuma,biswajitsahu/kuma,hoosteeno/kuma,escattone/kuma,SphinxKnight/kuma,cindyyu/kuma,Elchi3/kuma,groovecoder/kuma,biswajitsahu/kuma,utkbansal/kuma,FrankBian/kuma,nhenezi/kuma,davehunt/kuma,openjck/kuma,jgmize/kuma,nhenezi/kuma,escattone/kuma,bluemini/kuma,jwhitlock/kuma,bluemini/kuma,varunkamra/kuma,RanadeepPolavarapu/kuma,biswajitsahu/kuma,SphinxKnight/kuma,carnell69/kuma,anaran/kuma,cindyyu/kuma,hoosteeno/kuma,ronakkhunt/kuma,cindyyu/kuma,mozilla/kuma,SphinxKnight/kuma,tximikel/kuma,scrollback/kuma,jezdez/kuma,mozilla/kuma,scrollback/kuma,SphinxKnight/kuma,surajssd/kuma,robhudson/kuma,YOTOV-LIMITED/kuma,FrankBian/kuma,tximikel/kuma,jgmize/kuma,robhudson/kuma,varunkamra/kuma,carnell69/kuma,yfdyh000/kuma,scrollback/kuma,jwhitlock/kuma,utkbansal/kuma,scrollback/kuma,varunkamra/kuma,chirilo/kuma,safwanrahman/kuma,Elchi3/kuma,cindyyu/kuma,bluemini/kuma,openjck/kuma,groovecoder/kuma,utkbansal/kuma,jezdez/kuma,surajssd/kuma,ronakkhunt/kuma,RanadeepPolavarapu/kuma,davidyezsetz/kuma,jgmize/kuma,utkbansal/kuma,surajssd/kuma,surajssd/kuma,whip112/Whip112,yfdyh000/kuma,biswajitsahu/kuma,davehunt/kuma,whip112/Whip112,FrankBian/kuma,jgmize/kuma,hoosteeno/kuma,chirilo/kuma,safwanrahman/kuma,mastizada/kuma,jezdez/kuma,robhudson/kuma,tximikel/kuma,mozilla/kuma,mastizada/kuma,surajssd/kuma,a2sheppy/kuma,tximikel/kuma,FrankBian/kuma,openjck/kuma,varunkamra/kuma,YOTOV-LIMITED/kuma,carnell69/kuma,RanadeepPolavarapu/kuma,MenZil/kuma,varunkamra/kuma,darkwing/kuma,tximikel/kuma,RanadeepPolavarapu/kuma,groovecoder/kuma,nhenezi/kuma,biswajitsahu/kuma,hoosteeno/kuma,FrankBian/kuma,carnell69/kuma,robhudson/kuma,MenZil/kuma,anaran/kuma,jgmize/kuma,cindyyu/kuma,mastizada/kuma,ollie314/kuma,safwanrahman/kuma,chirilo/kuma,whip112/Whip112,carnell69/kuma,anaran/kuma,utkbansal/kuma,ollie314/kuma,whip112/Whip112,safwanrahman/kuma,YOTOV-LIMITED/kuma,jwhitlock/kuma,jwhitlock/kuma,openjck/kuma,safwanrahman/kuma,surajssd/kuma,openjck/kuma,cindyyu/kuma,MenZil/kuma,groovecoder/kuma,nhenezi/kuma,a2sheppy/kuma,YOTOV-LIMITED/kuma,ollie314/kuma,ronakkhunt/kuma,darkwing/kuma,chirilo/kuma,ollie314/kuma,groovecoder/kuma,robhudson/kuma,YOTOV-LIMITED/kuma,darkwing/kuma,a2sheppy/kuma,RanadeepPolavarapu/kuma,mastizada/kuma,MenZil/kuma,biswajitsahu/kuma,ollie314/kuma,anaran/kuma,whip112/Whip112,RanadeepPolavarapu/kuma,bluemini/kuma,YOTOV-LIMITED/kuma,yfdyh000/kuma,mozilla/kuma,ronakkhunt/kuma,davidyezsetz/kuma,davidyezsetz/kuma,davehunt/kuma,hoosteeno/kuma,Elchi3/kuma,SphinxKnight/kuma,MenZil/kuma,davidyezsetz/kuma,mozilla/kuma,jwhitlock/kuma,jgmize/kuma,MenZil/kuma,darkwing/kuma,davehunt/kuma,yfdyh000/kuma,jezdez/kuma,utkbansal/kuma,davehunt/kuma,carnell69/kuma,scrollback/kuma,chirilo/kuma,yfdyh000/kuma,safwanrahman/kuma,bluemini/kuma,darkwing/kuma,whip112/Whip112 | python | ## Code Before:
from django.contrib import admin
from .models import Submission
class SubmissionAdmin(admin.ModelAdmin):
list_display = ( 'title', 'creator', 'featured', 'hidden', 'tags', 'modified', )
admin.site.register(Submission, SubmissionAdmin)
## Instruction:
Make featured and hidden flags editable from demo listing
## Code After:
from django.contrib import admin
from .models import Submission
class SubmissionAdmin(admin.ModelAdmin):
list_display = ( 'title', 'creator', 'featured', 'hidden', 'tags', 'modified', )
list_editable = ( 'featured', 'hidden' )
admin.site.register(Submission, SubmissionAdmin)
|
e573900f38071317a6d076b331b3d9a500864de8 | src/widgets/widget.xml.tpl | src/widgets/widget.xml.tpl | <?xml version="1.0" encoding="UTF-8" ?>
<!-- generated on <%= grunt.template.today() %> -->
<Module>
<ModulePrefs
title="<%= meta.title %>"
description="<%= meta.description %>"
author="<%= grunt.config('pkg.author.name') %>"
author_email="<%= grunt.config('pkg.author.email') %>"
width="<%= meta.width %>"
height="<%= meta.height %>">
<Require feature="opensocial-0.8" ></Require>
<Require feature="openapp" ></Require>
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="<%= grunt.config('baseUrl') %>/js/config.js"></script>
<script src="<%= grunt.config('baseUrl') %>/js/lib/vendor/require.js"></script>
<%= partial(bodyPartial,null) %>
<script src="<%= grunt.config('baseUrl') %>/js/shared.js"></script>
]]>
</Content>
</Module>
| <?xml version="1.0" encoding="UTF-8" ?>
<!-- generated on <%= grunt.template.today() %> -->
<Module>
<ModulePrefs
title="<%= meta.title %>"
description="<%= meta.description %>"
author="<%= grunt.config('pkg.author.name') %>"
author_email="<%= grunt.config('pkg.author.email') %>"
width="<%= meta.width %>"
height="<%= meta.height %>">
<Require feature="opensocial-0.8" ></Require>
<Require feature="openapp" ></Require>
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="application/javascript">
(function(){
var cnt = 30; // 5 attempts per second => 6 seconds
var timeout = function(){
var btn = document.getElementById("oauthPersonalizeButton");
var wrapper = document.getElementById("oauthPersonalize");
if(wrapper && wrapper.offsetParent !== null && btn && btn.onclick){
var win = null;
var openWindow = window.open;
window.open = function(){return win = openWindow.apply(window,arguments);};
btn.onclick.call(btn);
if(win){
win.onload = function(){
win.document.getElementsByTagName("form")[0].submit();
setTimeout(function(){
window.location.reload();
if(win){
win.close();
}
},1000);
};
}
} else {
if(cnt > 0){
cnt -= 1;
setTimeout(timeout,200);
}
}
};
timeout();
})();
</script>
<script src="<%= grunt.config('baseUrl') %>/js/config.js"></script>
<script src="<%= grunt.config('baseUrl') %>/js/lib/vendor/require.js"></script>
<%= partial(bodyPartial,null) %>
<script src="<%= grunt.config('baseUrl') %>/js/shared.js"></script>
]]>
</Content>
</Module>
| Revert "Removed the pop ups hack for authorization" | Revert "Removed the pop ups hack for authorization"
This reverts commit 3a431fd11fa4e7614455cc6d34c5a075a7000831.
| Smarty | bsd-3-clause | Mortymus/syncmeta,Mortymus/syncmeta,Mari0/syncmeta,Mari0/syncmeta | smarty | ## Code Before:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- generated on <%= grunt.template.today() %> -->
<Module>
<ModulePrefs
title="<%= meta.title %>"
description="<%= meta.description %>"
author="<%= grunt.config('pkg.author.name') %>"
author_email="<%= grunt.config('pkg.author.email') %>"
width="<%= meta.width %>"
height="<%= meta.height %>">
<Require feature="opensocial-0.8" ></Require>
<Require feature="openapp" ></Require>
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="<%= grunt.config('baseUrl') %>/js/config.js"></script>
<script src="<%= grunt.config('baseUrl') %>/js/lib/vendor/require.js"></script>
<%= partial(bodyPartial,null) %>
<script src="<%= grunt.config('baseUrl') %>/js/shared.js"></script>
]]>
</Content>
</Module>
## Instruction:
Revert "Removed the pop ups hack for authorization"
This reverts commit 3a431fd11fa4e7614455cc6d34c5a075a7000831.
## Code After:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- generated on <%= grunt.template.today() %> -->
<Module>
<ModulePrefs
title="<%= meta.title %>"
description="<%= meta.description %>"
author="<%= grunt.config('pkg.author.name') %>"
author_email="<%= grunt.config('pkg.author.email') %>"
width="<%= meta.width %>"
height="<%= meta.height %>">
<Require feature="opensocial-0.8" ></Require>
<Require feature="openapp" ></Require>
<Require feature="dynamic-height"></Require>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="application/javascript">
(function(){
var cnt = 30; // 5 attempts per second => 6 seconds
var timeout = function(){
var btn = document.getElementById("oauthPersonalizeButton");
var wrapper = document.getElementById("oauthPersonalize");
if(wrapper && wrapper.offsetParent !== null && btn && btn.onclick){
var win = null;
var openWindow = window.open;
window.open = function(){return win = openWindow.apply(window,arguments);};
btn.onclick.call(btn);
if(win){
win.onload = function(){
win.document.getElementsByTagName("form")[0].submit();
setTimeout(function(){
window.location.reload();
if(win){
win.close();
}
},1000);
};
}
} else {
if(cnt > 0){
cnt -= 1;
setTimeout(timeout,200);
}
}
};
timeout();
})();
</script>
<script src="<%= grunt.config('baseUrl') %>/js/config.js"></script>
<script src="<%= grunt.config('baseUrl') %>/js/lib/vendor/require.js"></script>
<%= partial(bodyPartial,null) %>
<script src="<%= grunt.config('baseUrl') %>/js/shared.js"></script>
]]>
</Content>
</Module>
|
8a6ef1a837929cd1b64550c0a4e8eb8b5cf3f688 | source/jquery.singlemask.js | source/jquery.singlemask.js | /*
Character mask for jQuery.
https://github.com/sobrinho/jquery.singlemask
Copyright (c) 2011-2013 Gabriel Sobrinho (http://gabrielsobrinho.com/).
Released under the MIT license
*/
(function ($) {
function getPasteEvent() {
var el = document.createElement('input'),
name = 'onpaste';
el.setAttribute(name, '');
return (typeof el[name] === 'function') ? 'paste' : 'input';
}
var pasteEventName = getPasteEvent();
$.fn.singlemask = function (mask) {
$(this).keydown(function (event) {
var key = event.keyCode;
if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
return;
}
return String.fromCharCode(key).match(mask);
}).bind(pasteEventName, function () {
this.value = $.grep(this.value, function (character) {
return character.match(mask);
}).join('');
});
}
})(jQuery);
| /*
Character mask for jQuery.
https://github.com/sobrinho/jquery.singlemask
Copyright (c) 2011-2013 Gabriel Sobrinho (http://gabrielsobrinho.com/).
Released under the MIT license
*/
(function ($) {
function getPasteEvent() {
var el = document.createElement('input'),
name = 'onpaste';
el.setAttribute(name, '');
return (typeof el[name] === 'function') ? 'paste' : 'input';
}
var pasteEventName = getPasteEvent();
$.fn.singlemask = function (mask) {
$(this).keydown(function (event) {
var key = event.keyCode;
if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
return;
}
// Numpad key numbers starts on 96 (0) and ends on 105 (9)
// Somehow the String.fromCharCode doesn't knows that
// Subtracting 48 we have the 'standard' number code
if (key >= 96 && key <= 105) {
key = key - 48;
}
return String.fromCharCode(key).match(mask);
}).bind(pasteEventName, function () {
this.value = $.grep(this.value, function (character) {
return character.match(mask);
}).join('');
});
}
})(jQuery);
| Fix problem when using the numpad | Fix problem when using the numpad
The numpad numbers' code are different from the standard numbers. The
code number starts in 96 (number 0) and ends in 105 (number 9).
The problem is in the String.fromCharCode function because it doesn't
recognize the numpad code numbers.
To fix that this commit was made to calculate the 'correct' key code to
be used in the String.fromCharCode function.
Keyboard keys code:
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
| JavaScript | mit | sobrinho/jquery.singlemask | javascript | ## Code Before:
/*
Character mask for jQuery.
https://github.com/sobrinho/jquery.singlemask
Copyright (c) 2011-2013 Gabriel Sobrinho (http://gabrielsobrinho.com/).
Released under the MIT license
*/
(function ($) {
function getPasteEvent() {
var el = document.createElement('input'),
name = 'onpaste';
el.setAttribute(name, '');
return (typeof el[name] === 'function') ? 'paste' : 'input';
}
var pasteEventName = getPasteEvent();
$.fn.singlemask = function (mask) {
$(this).keydown(function (event) {
var key = event.keyCode;
if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
return;
}
return String.fromCharCode(key).match(mask);
}).bind(pasteEventName, function () {
this.value = $.grep(this.value, function (character) {
return character.match(mask);
}).join('');
});
}
})(jQuery);
## Instruction:
Fix problem when using the numpad
The numpad numbers' code are different from the standard numbers. The
code number starts in 96 (number 0) and ends in 105 (number 9).
The problem is in the String.fromCharCode function because it doesn't
recognize the numpad code numbers.
To fix that this commit was made to calculate the 'correct' key code to
be used in the String.fromCharCode function.
Keyboard keys code:
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
## Code After:
/*
Character mask for jQuery.
https://github.com/sobrinho/jquery.singlemask
Copyright (c) 2011-2013 Gabriel Sobrinho (http://gabrielsobrinho.com/).
Released under the MIT license
*/
(function ($) {
function getPasteEvent() {
var el = document.createElement('input'),
name = 'onpaste';
el.setAttribute(name, '');
return (typeof el[name] === 'function') ? 'paste' : 'input';
}
var pasteEventName = getPasteEvent();
$.fn.singlemask = function (mask) {
$(this).keydown(function (event) {
var key = event.keyCode;
if (key < 16 || (key > 16 && key < 32) || (key > 32 && key < 41)) {
return;
}
// Numpad key numbers starts on 96 (0) and ends on 105 (9)
// Somehow the String.fromCharCode doesn't knows that
// Subtracting 48 we have the 'standard' number code
if (key >= 96 && key <= 105) {
key = key - 48;
}
return String.fromCharCode(key).match(mask);
}).bind(pasteEventName, function () {
this.value = $.grep(this.value, function (character) {
return character.match(mask);
}).join('');
});
}
})(jQuery);
|
70475e60e0948271d7171cd5c61353f384fcaa91 | less/availity-modal.less | less/availity-modal.less | .modal-header {
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-header-bg-color;
.border-top-radius(@availity-modal-input-border-radius);
}
.modal-footer {
border-top: 0;
background-color: @availity-modal-footer-bg-color;
.border-bottom-radius(@availity-modal-input-border-radius);
}
| .modal-header {
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-header-bg-color;
.border-top-radius(@availity-modal-input-border-radius);
}
.modal-footer {
border-top: 0;
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-footer-bg-color;
.border-bottom-radius(@availity-modal-input-border-radius);
}
| Apply same padding to modal-footer and modal-header | Apply same padding to modal-footer and modal-header
| Less | mit | Availity/availity-uikit,Availity/availity-uikit | less | ## Code Before:
.modal-header {
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-header-bg-color;
.border-top-radius(@availity-modal-input-border-radius);
}
.modal-footer {
border-top: 0;
background-color: @availity-modal-footer-bg-color;
.border-bottom-radius(@availity-modal-input-border-radius);
}
## Instruction:
Apply same padding to modal-footer and modal-header
## Code After:
.modal-header {
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-header-bg-color;
.border-top-radius(@availity-modal-input-border-radius);
}
.modal-footer {
border-top: 0;
padding: @modal-title-padding @availity-modal-padding;
background-color: @availity-modal-footer-bg-color;
.border-bottom-radius(@availity-modal-input-border-radius);
}
|
204c0e57f6ac885793f6ef0d392f5884f04c66d2 | .travis.yml | .travis.yml | language: perl6
perl6:
- latest
install:
- rakudobrew build-panda
- panda --notests installdeps .
script:
- prove -e 'perl6 -Ilib' -rv t/
sudo: false
| language: perl6
perl6:
- latest
install:
- rakudobrew build-zef
- zef install --/test --depsonly .
script:
- zef test .
sudo: false
| Use zef instead of panda | Use zef instead of panda
| YAML | artistic-2.0 | moznion/p6-IO-Blob | yaml | ## Code Before:
language: perl6
perl6:
- latest
install:
- rakudobrew build-panda
- panda --notests installdeps .
script:
- prove -e 'perl6 -Ilib' -rv t/
sudo: false
## Instruction:
Use zef instead of panda
## Code After:
language: perl6
perl6:
- latest
install:
- rakudobrew build-zef
- zef install --/test --depsonly .
script:
- zef test .
sudo: false
|
dc03172d76fd9cc690da3f3ff1ebd5abe43b4d2e | recreate_database.sh | recreate_database.sh | mysqladmin -u root -p drop recipieces_development
mysqladmin -u root -p create recipieces_development
rake db:migrate
rake db:seed
| rake db:reset
rake db:seed
| Use db:reset instead of calling mysql directly. | Use db:reset instead of calling mysql directly.
| Shell | mit | quattro004/scratches,quattro004/scratches,quattro004/scratches | shell | ## Code Before:
mysqladmin -u root -p drop recipieces_development
mysqladmin -u root -p create recipieces_development
rake db:migrate
rake db:seed
## Instruction:
Use db:reset instead of calling mysql directly.
## Code After:
rake db:reset
rake db:seed
|
c2f1178e4174b170185815c43e01f68ec54dc539 | lib/views/page_presentation.html | lib/views/page_presentation.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
<link rel="stylesheet" type="text/css" href="/js/reveal/lib/css/zenburn.css">
<link rel="stylesheet" type="text/css" href="/css/reveal/css/theme/black.css">
<script src="{{ assets('/js/bundled.js') }}"></script>
<title>{{ path|path2name }} | {{ path }}</title>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator="^\n\n\n">
<script type="text/template">
{{ revision.body|presentation|safe }}
# おしまい
</script>
</section>
</div>
</div>
<script src="{{ assets('/js/presentation.js') }}"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
<link rel="stylesheet" type="text/css" href="/js/reveal/lib/css/zenburn.css">
<link rel="stylesheet" type="text/css" href="/css/reveal/css/theme/black.css">
<script src="{{ assets('/js/runtime.js') }}"></script>
<script src="{{ assets('/js/bundled.js') }}"></script>
<title>{{ path|path2name }} | {{ path }}</title>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator="^\n\n\n">
<script type="text/template">
{{ revision.body|presentation|safe }}
# おしまい
</script>
</section>
</div>
</div>
<script src="{{ assets('/js/presentation.js') }}"></script>
</body>
</html>
| Load runtime.js in the presentation page | Load runtime.js in the presentation page
| HTML | mit | crowi/crowi,crowi/crowi,crowi/crowi | html | ## Code Before:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
<link rel="stylesheet" type="text/css" href="/js/reveal/lib/css/zenburn.css">
<link rel="stylesheet" type="text/css" href="/css/reveal/css/theme/black.css">
<script src="{{ assets('/js/bundled.js') }}"></script>
<title>{{ path|path2name }} | {{ path }}</title>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator="^\n\n\n">
<script type="text/template">
{{ revision.body|presentation|safe }}
# おしまい
</script>
</section>
</div>
</div>
<script src="{{ assets('/js/presentation.js') }}"></script>
</body>
</html>
## Instruction:
Load runtime.js in the presentation page
## Code After:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
<link rel="stylesheet" type="text/css" href="/js/reveal/lib/css/zenburn.css">
<link rel="stylesheet" type="text/css" href="/css/reveal/css/theme/black.css">
<script src="{{ assets('/js/runtime.js') }}"></script>
<script src="{{ assets('/js/bundled.js') }}"></script>
<title>{{ path|path2name }} | {{ path }}</title>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator="^\n\n\n">
<script type="text/template">
{{ revision.body|presentation|safe }}
# おしまい
</script>
</section>
</div>
</div>
<script src="{{ assets('/js/presentation.js') }}"></script>
</body>
</html>
|
c176213c87b1e63da4e79f10b95c5b34a5ec3fce | OpenIPSL/NonElectrical/Logical/LV_GATE.mo | OpenIPSL/NonElectrical/Logical/LV_GATE.mo | within OpenIPSL.NonElectrical.Logical;
block LV_GATE "Passes through the lower value of the two inputs"
extends Modelica.Blocks.Math.Min;
equation
connect(y, y) annotation (Line(points={{110,0},{110,0}}, color={0,0,127}));
annotation (Icon(graphics={Polygon(
points={{-100,100},{40,100},{100,0},{40,-100},{-100,-100},{-100,100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Text(
extent={{-100,40},{60,-40}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.None,
textString="LV
GATE")}));
end LV_GATE;
| within OpenIPSL.NonElectrical.Logical;
block LV_GATE "Passes through the lower value of the two inputs"
extends Modelica.Blocks.Math.Min;
annotation (Icon(graphics={Polygon(
points={{-100,100},{40,100},{100,0},{40,-100},{-100,-100},{-100,100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Text(
extent={{-100,40},{60,-40}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.None,
textString="LV
GATE")}));
end LV_GATE;
| Remove dummy erroneous self connection. | Remove dummy erroneous self connection.
| Modelica | bsd-3-clause | SmarTS-Lab/OpenIPSL,SmarTS-Lab/OpenIPSL,OpenIPSL/OpenIPSL | modelica | ## Code Before:
within OpenIPSL.NonElectrical.Logical;
block LV_GATE "Passes through the lower value of the two inputs"
extends Modelica.Blocks.Math.Min;
equation
connect(y, y) annotation (Line(points={{110,0},{110,0}}, color={0,0,127}));
annotation (Icon(graphics={Polygon(
points={{-100,100},{40,100},{100,0},{40,-100},{-100,-100},{-100,100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Text(
extent={{-100,40},{60,-40}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.None,
textString="LV
GATE")}));
end LV_GATE;
## Instruction:
Remove dummy erroneous self connection.
## Code After:
within OpenIPSL.NonElectrical.Logical;
block LV_GATE "Passes through the lower value of the two inputs"
extends Modelica.Blocks.Math.Min;
annotation (Icon(graphics={Polygon(
points={{-100,100},{40,100},{100,0},{40,-100},{-100,-100},{-100,100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Text(
extent={{-100,40},{60,-40}},
lineColor={0,0,255},
fillColor={255,255,255},
fillPattern=FillPattern.None,
textString="LV
GATE")}));
end LV_GATE;
|
ebee68811693969ca779004ffb6328a445e02ff4 | src/React3/lib/descriptors/Material/PointsMaterialDescriptor.js | src/React3/lib/descriptors/Material/PointsMaterialDescriptor.js | import THREE from 'three';
import MaterialDescriptorBase from './MaterialDescriptorBase';
class PointsMaterialDescriptor extends MaterialDescriptorBase {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasColor();
}
construct(props) {
const materialDescription = {};
if (props.hasOwnProperty('color')) {
materialDescription.color = props.color;
}
return new THREE.PointsMaterial(materialDescription);
}
}
export default PointsMaterialDescriptor;
| import THREE from 'three';
import MaterialDescriptorBase from './MaterialDescriptorBase';
class PointsMaterialDescriptor extends MaterialDescriptorBase {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasColor();
}
construct(props) {
const materialDescription = this.getMaterialDescription(props);
return new THREE.PointsMaterial(materialDescription);
}
}
export default PointsMaterialDescriptor;
| Use base getMaterialDescription for PointsMaterial | Use base getMaterialDescription for PointsMaterial
| JavaScript | mit | toxicFork/react-three-renderer | javascript | ## Code Before:
import THREE from 'three';
import MaterialDescriptorBase from './MaterialDescriptorBase';
class PointsMaterialDescriptor extends MaterialDescriptorBase {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasColor();
}
construct(props) {
const materialDescription = {};
if (props.hasOwnProperty('color')) {
materialDescription.color = props.color;
}
return new THREE.PointsMaterial(materialDescription);
}
}
export default PointsMaterialDescriptor;
## Instruction:
Use base getMaterialDescription for PointsMaterial
## Code After:
import THREE from 'three';
import MaterialDescriptorBase from './MaterialDescriptorBase';
class PointsMaterialDescriptor extends MaterialDescriptorBase {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasColor();
}
construct(props) {
const materialDescription = this.getMaterialDescription(props);
return new THREE.PointsMaterial(materialDescription);
}
}
export default PointsMaterialDescriptor;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.