commit stringlengths 40 40 | old_file stringlengths 4 184 | new_file stringlengths 4 184 | old_contents stringlengths 1 3.6k | new_contents stringlengths 5 3.38k | subject stringlengths 15 778 | message stringlengths 16 6.74k | lang stringclasses 201 values | license stringclasses 13 values | repos stringlengths 6 116k | config stringclasses 201 values | content stringlengths 137 7.24k | diff stringlengths 26 5.55k | diff_length int64 1 123 | relative_diff_length float64 0.01 89 | n_lines_added int64 0 108 | n_lines_deleted int64 0 106 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b3ca6bcc13d41487be74eccff7477195278a80ec | .eslintrc.yml | .eslintrc.yml | extends: 'standard'
globals:
Vue: true
rules:
no-new: 0
| parser: babel-eslint
extends: vue
globals:
Vue: true
rules:
no-dynamic-import: 0
no-new: 0
| Change eslint rules. use cue extend and babel-eslint parser | Change eslint rules. use cue extend and babel-eslint parser
| YAML | mit | akifo/vue-movable | yaml | ## Code Before:
extends: 'standard'
globals:
Vue: true
rules:
no-new: 0
## Instruction:
Change eslint rules. use cue extend and babel-eslint parser
## Code After:
parser: babel-eslint
extends: vue
globals:
Vue: true
rules:
no-dynamic-import: 0
no-new: 0
| - extends: 'standard'
+ parser: babel-eslint
+ extends: vue
globals:
Vue: true
rules:
+ no-dynamic-import: 0
no-new: 0 | 4 | 0.8 | 3 | 1 |
6f1e00ea36bdcc39da955f7aa2add6a21432d190 | spec/factories/ci/runner_projects.rb | spec/factories/ci/runner_projects.rb | FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
runner_id 1
project_id 1
end
end
| FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
runner factory: :ci_runner
project factory: :empty_project
end
end
| Update CI runner factories to not use invalid IDs | Update CI runner factories to not use invalid IDs
These IDs point to non-existing rows, causing the foreign key
constraints to fail.
| Ruby | mit | t-zuehlsdorff/gitlabhq,dreampet/gitlab,stoplightio/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,iiet/iiet-git,dreampet/gitlab,axilleas/gitlabhq,stoplightio/gitlabhq,dreampet/gitlab,jirutka/gitlabhq,axilleas/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,t-zuehlsdorff/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,t-zuehlsdorff/gitlabhq,dplarson/gitlabhq,mmkassem/gitlabhq,t-zuehlsdorff/gitlabhq,dplarson/gitlabhq,iiet/iiet-git,axilleas/gitlabhq,dplarson/gitlabhq,jirutka/gitlabhq,jirutka/gitlabhq,stoplightio/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,dplarson/gitlabhq,jirutka/gitlabhq | ruby | ## Code Before:
FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
runner_id 1
project_id 1
end
end
## Instruction:
Update CI runner factories to not use invalid IDs
These IDs point to non-existing rows, causing the foreign key
constraints to fail.
## Code After:
FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
runner factory: :ci_runner
project factory: :empty_project
end
end
| FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
- runner_id 1
- project_id 1
+ runner factory: :ci_runner
+ project factory: :empty_project
end
end | 4 | 0.666667 | 2 | 2 |
27354916697704e4bf91778d559c47c2da310ea8 | css/main.styl | css/main.styl | ---
---
@import '_normalize'
@import '_base'
@import '_syntax-highlighting'
@import '_syntax' | ---
---
@import '_normalize'
@import '_base'
@import '_syntax'
@import '_syntax-highlighting' | Update stylus order for err troubleshoot | Update stylus order for err troubleshoot
| Stylus | mit | kelsymichael/kelsymichael.github.io | stylus | ## Code Before:
---
---
@import '_normalize'
@import '_base'
@import '_syntax-highlighting'
@import '_syntax'
## Instruction:
Update stylus order for err troubleshoot
## Code After:
---
---
@import '_normalize'
@import '_base'
@import '_syntax'
@import '_syntax-highlighting' | ---
---
@import '_normalize'
@import '_base'
+ @import '_syntax'
@import '_syntax-highlighting'
- @import '_syntax' | 2 | 0.285714 | 1 | 1 |
f9552625ab9089d9796206aa1b6e43bc7efcd56d | deploy.sh | deploy.sh | set -ex
aws --region=us-west-2 s3 sync --acl public-read --exclude ".*" ./dist/ s3://apps.other.chat/
aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /apps.other.chat/otherjs/0.0.1%2B3880ffe/other.min.js --content-type application/javascript
| set -ex
aws --region=us-west-2 s3 sync --acl public-read --exclude ".*" ./dist/ s3://apps.other.chat/
aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /otherjs/0.0.1+3880ffe/other.min.js --content-type application/javascript
| Fix redirect (for realz this time) | Fix redirect (for realz this time)
| Shell | agpl-3.0 | other-xyz/other.js,other-xyz/other.js | shell | ## Code Before:
set -ex
aws --region=us-west-2 s3 sync --acl public-read --exclude ".*" ./dist/ s3://apps.other.chat/
aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /apps.other.chat/otherjs/0.0.1%2B3880ffe/other.min.js --content-type application/javascript
## Instruction:
Fix redirect (for realz this time)
## Code After:
set -ex
aws --region=us-west-2 s3 sync --acl public-read --exclude ".*" ./dist/ s3://apps.other.chat/
aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /otherjs/0.0.1+3880ffe/other.min.js --content-type application/javascript
| set -ex
aws --region=us-west-2 s3 sync --acl public-read --exclude ".*" ./dist/ s3://apps.other.chat/
- aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /apps.other.chat/otherjs/0.0.1%2B3880ffe/other.min.js --content-type application/javascript
? ---------------- ^^^
+ aws --region=us-west-2 s3api put-object --bucket apps.other.chat --acl public-read --key otherjs/0.0.x/other.min.js --website-redirect-location /otherjs/0.0.1+3880ffe/other.min.js --content-type application/javascript
? ^
| 2 | 0.5 | 1 | 1 |
2b651ee0323da13de3135b07933e195b75935ff5 | testdata/vok.in.txt | testdata/vok.in.txt | === RUN TestRegexes
--- PASS: TestRegexes (0.01s)
ok foo.org/bar 0.050s
| === RUN TestFoo
--- PASS: TestFoo (0.01s)
ok foo.org/bar 0.050s
| Make all test data neutral | Make all test data neutral
| Text | bsd-3-clause | mvdan/stest | text | ## Code Before:
=== RUN TestRegexes
--- PASS: TestRegexes (0.01s)
ok foo.org/bar 0.050s
## Instruction:
Make all test data neutral
## Code After:
=== RUN TestFoo
--- PASS: TestFoo (0.01s)
ok foo.org/bar 0.050s
| - === RUN TestRegexes
+ === RUN TestFoo
- --- PASS: TestRegexes (0.01s)
? ^^^^^^^
+ --- PASS: TestFoo (0.01s)
? ^^^
ok foo.org/bar 0.050s | 4 | 1.333333 | 2 | 2 |
d47c58d728b946c8a30472fda2e03973191a185f | pkgdcl.lisp | pkgdcl.lisp | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software published under an MIT-like license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2012 Google, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Alejandro Sedeño ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
(defpackage mysqlnd)
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software published under an MIT-like license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2012 Google, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Alejandro Sedeño ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
(defpackage mysqlnd
(:use :common-lisp))
| Use COMMON-LISP package in mysqlnd | Use COMMON-LISP package in mysqlnd
| Common Lisp | mit | dkochmanski/qmynd,qitab/qmynd | common-lisp | ## Code Before:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software published under an MIT-like license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2012 Google, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Alejandro Sedeño ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
(defpackage mysqlnd)
## Instruction:
Use COMMON-LISP package in mysqlnd
## Code After:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software published under an MIT-like license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2012 Google, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Alejandro Sedeño ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
(defpackage mysqlnd
(:use :common-lisp))
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software published under an MIT-like license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2012 Google, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Alejandro Sedeño ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :cl-user)
- (defpackage mysqlnd)
? -
+ (defpackage mysqlnd
+ (:use :common-lisp)) | 3 | 0.230769 | 2 | 1 |
2d321a96cefac11c8ca393ae55276d4861ce848d | circle.yml | circle.yml | machine:
environment:
PROJECT_GOPATH: "${HOME}/.go_project"
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
GOPATH: "${PROJECT_GOPATH}" | machine:
environment:
PROJECT_GOPATH: "${HOME}/.go_project"
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
GOPATH: "${PROJECT_GOPATH}"
dependencies:
override:
- go build -v -o $CIRCLE_ARTIFACTS/rnchat
| Move built app to artifact directory | Move built app to artifact directory
| YAML | mit | mthmulders/rnchat | yaml | ## Code Before:
machine:
environment:
PROJECT_GOPATH: "${HOME}/.go_project"
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
GOPATH: "${PROJECT_GOPATH}"
## Instruction:
Move built app to artifact directory
## Code After:
machine:
environment:
PROJECT_GOPATH: "${HOME}/.go_project"
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
GOPATH: "${PROJECT_GOPATH}"
dependencies:
override:
- go build -v -o $CIRCLE_ARTIFACTS/rnchat
| machine:
environment:
PROJECT_GOPATH: "${HOME}/.go_project"
PROJECT_PARENT_PATH: "${PROJECT_GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}"
PROJECT_PATH: "${PROJECT_PARENT_PATH}/${CIRCLE_PROJECT_REPONAME}"
GOPATH: "${PROJECT_GOPATH}"
+
+ dependencies:
+ override:
+ - go build -v -o $CIRCLE_ARTIFACTS/rnchat | 4 | 0.666667 | 4 | 0 |
8b8dc14e72cb159acb9f796c8602e144d66a0052 | .idea/inspectionProfiles/Project_Default.xml | .idea/inspectionProfiles/Project_Default.xml | <component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component> | <component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="SSBasedInspection" enabled="true" level="ERROR" enabled_by_default="true">
<replaceConfiguration name="Escape apostrophes in Android string XMLs" text="<string $attributes$>$text$</string>" recursive="false" caseInsensitive="true" type="XML" reformatAccordingToStyle="true" shortenFQN="true" useStaticImport="true" replacement="<string $attributes$>$fixedText$</string>">
<constraint name="attributes" within="" contains="" />
<constraint name="text" regexp=".*[^\\]'.*" maxCount="2147483647" within="" contains="" />
<variableDefinition name="fixedText" script=""text.getValue().replaceAll( "\\\\'|\'", "\\\\'" )"" />
</replaceConfiguration>
</inspection_tool>
</profile>
</component> | Add autocorrection of string missing apostrophes escaping | Add autocorrection of string missing apostrophes escaping
| XML | mit | neoranga55/CleanGUITestArchitecture | xml | ## Code Before:
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>
## Instruction:
Add autocorrection of string missing apostrophes escaping
## Code After:
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="SSBasedInspection" enabled="true" level="ERROR" enabled_by_default="true">
<replaceConfiguration name="Escape apostrophes in Android string XMLs" text="<string $attributes$>$text$</string>" recursive="false" caseInsensitive="true" type="XML" reformatAccordingToStyle="true" shortenFQN="true" useStaticImport="true" replacement="<string $attributes$>$fixedText$</string>">
<constraint name="attributes" within="" contains="" />
<constraint name="text" regexp=".*[^\\]'.*" maxCount="2147483647" within="" contains="" />
<variableDefinition name="fixedText" script=""text.getValue().replaceAll( "\\\\'|\'", "\\\\'" )"" />
</replaceConfiguration>
</inspection_tool>
</profile>
</component> | <component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" />
+ <inspection_tool class="SSBasedInspection" enabled="true" level="ERROR" enabled_by_default="true">
+ <replaceConfiguration name="Escape apostrophes in Android string XMLs" text="<string $attributes$>$text$</string>" recursive="false" caseInsensitive="true" type="XML" reformatAccordingToStyle="true" shortenFQN="true" useStaticImport="true" replacement="<string $attributes$>$fixedText$</string>">
+ <constraint name="attributes" within="" contains="" />
+ <constraint name="text" regexp=".*[^\\]'.*" maxCount="2147483647" within="" contains="" />
+ <variableDefinition name="fixedText" script=""text.getValue().replaceAll( "\\\\'|\'", "\\\\'" )"" />
+ </replaceConfiguration>
+ </inspection_tool>
</profile>
</component> | 7 | 1.166667 | 7 | 0 |
ba4a475fb93ef65b622312b44c00b538d130a8fa | jobs/languages.rb | jobs/languages.rb | require 'net/http'
require 'json'
require 'gruff'
require 'octokit'
projects = settings.projects || []
SCHEDULER.every '1h' do
client = Octokit::Client.new(:access_token => settings.github['token'])
languages = Hash.new(0)
sum = 0
projects.each do |project|
data = client.languages project['repo']
data.each do |lang, val|
languages[lang] = languages[lang] + val
sum += val
end
end
#Begin constructing actual graph
g = Gruff::Pie.new
g.title = nil
g.theme = {
:colors => ['#A11C03', '#9DB61E', '#2C3E50', '#F39C12', '#BF42F4',
'#00C437', '#210FA8', '#763e82', '#D1C600', '#05B270'],
:marker_color => '#000',
:background_colors => ['#00B0C6', '#00B0C6']
}
languages
.select { |_, val| val > 0.01 }
.sort_by{ |_, val| val }
.reverse
.each do |lang, val|
g.data(lang, val)
end
g.write("assets/images/piechart.png")
send_event('languages', {})
end
| require 'net/http'
require 'json'
require 'gruff'
require 'octokit'
projects = settings.projects || []
SCHEDULER.every '1h' do
client = Octokit::Client.new(:access_token => settings.github['token'])
languages = Hash.new(0)
sum = 0
projects.each do |project|
data = client.languages project['repo']
data.each do |lang, val|
languages[lang] = languages[lang] + val
sum += val
end
end
#Begin constructing actual graph
g = Gruff::Pie.new
g.title = nil
g.theme = {
:colors => ['#A11C03', '#9DB61E', '#2C3E50', '#F39C12', '#BF42F4',
'#00C437', '#210FA8', '#763e82', '#D1C600', '#05B270'],
:marker_color => '#000',
:background_colors => ['#00B0C6', '#00B0C6']
}
languages
.select { |_, val| val.fdiv(sum) > 0.01 }
.sort_by{ |_, val| val }
.reverse
.each do |lang, val|
g.data(lang, val)
end
g.write("assets/images/piechart.png")
send_event('languages', {})
end
| Fix language selection in sorting. | Fix language selection in sorting.
| Ruby | apache-2.0 | osuosl/fenestra,osuosl/fenestra,osuosl/fenestra | ruby | ## Code Before:
require 'net/http'
require 'json'
require 'gruff'
require 'octokit'
projects = settings.projects || []
SCHEDULER.every '1h' do
client = Octokit::Client.new(:access_token => settings.github['token'])
languages = Hash.new(0)
sum = 0
projects.each do |project|
data = client.languages project['repo']
data.each do |lang, val|
languages[lang] = languages[lang] + val
sum += val
end
end
#Begin constructing actual graph
g = Gruff::Pie.new
g.title = nil
g.theme = {
:colors => ['#A11C03', '#9DB61E', '#2C3E50', '#F39C12', '#BF42F4',
'#00C437', '#210FA8', '#763e82', '#D1C600', '#05B270'],
:marker_color => '#000',
:background_colors => ['#00B0C6', '#00B0C6']
}
languages
.select { |_, val| val > 0.01 }
.sort_by{ |_, val| val }
.reverse
.each do |lang, val|
g.data(lang, val)
end
g.write("assets/images/piechart.png")
send_event('languages', {})
end
## Instruction:
Fix language selection in sorting.
## Code After:
require 'net/http'
require 'json'
require 'gruff'
require 'octokit'
projects = settings.projects || []
SCHEDULER.every '1h' do
client = Octokit::Client.new(:access_token => settings.github['token'])
languages = Hash.new(0)
sum = 0
projects.each do |project|
data = client.languages project['repo']
data.each do |lang, val|
languages[lang] = languages[lang] + val
sum += val
end
end
#Begin constructing actual graph
g = Gruff::Pie.new
g.title = nil
g.theme = {
:colors => ['#A11C03', '#9DB61E', '#2C3E50', '#F39C12', '#BF42F4',
'#00C437', '#210FA8', '#763e82', '#D1C600', '#05B270'],
:marker_color => '#000',
:background_colors => ['#00B0C6', '#00B0C6']
}
languages
.select { |_, val| val.fdiv(sum) > 0.01 }
.sort_by{ |_, val| val }
.reverse
.each do |lang, val|
g.data(lang, val)
end
g.write("assets/images/piechart.png")
send_event('languages', {})
end
| require 'net/http'
require 'json'
require 'gruff'
require 'octokit'
projects = settings.projects || []
SCHEDULER.every '1h' do
client = Octokit::Client.new(:access_token => settings.github['token'])
languages = Hash.new(0)
sum = 0
projects.each do |project|
data = client.languages project['repo']
data.each do |lang, val|
languages[lang] = languages[lang] + val
sum += val
end
end
#Begin constructing actual graph
g = Gruff::Pie.new
g.title = nil
g.theme = {
:colors => ['#A11C03', '#9DB61E', '#2C3E50', '#F39C12', '#BF42F4',
'#00C437', '#210FA8', '#763e82', '#D1C600', '#05B270'],
:marker_color => '#000',
:background_colors => ['#00B0C6', '#00B0C6']
}
languages
- .select { |_, val| val > 0.01 }
+ .select { |_, val| val.fdiv(sum) > 0.01 }
? ++++++++++
.sort_by{ |_, val| val }
.reverse
.each do |lang, val|
g.data(lang, val)
end
g.write("assets/images/piechart.png")
send_event('languages', {})
end | 2 | 0.05 | 1 | 1 |
bb5e56866a2b78c9fa027166fee1ea61b9625af5 | stylesheets/app/_header.scss | stylesheets/app/_header.scss | .app > header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: $header_height;
// background: #eee;
h1 {
line-height: $header_height;
margin: 0 20px;
float: left;
}
.sections {
float: right;
}
.section {
display: inline-block;
position: relative;
padding: 0 20px;
line-height: $header_height;
cursor: pointer;
&:hover ul {
display: block;
}
}
ul {
display: none;
position: absolute;
z-index: 1;
right: 0;
margin: 0;
padding: 0;
width: 170px;
}
li {
display: block;
list-style-type: none;
padding: 10px 20px;
cursor: pointer;
vertical-align: top;
line-height: 18px;
box-sizing: border-box;
}
hr {
height: 1px;
border: 0;
outline: 0;
}
.section:hover,
li:hover {
background: rgba(#fff, 0.1);
}
li:active {
background: rgba(#fff, 0.05);
}
}
| .app > header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: $header_height;
// background: #eee;
h1 {
line-height: $header_height;
margin: 0 20px;
float: left;
}
.sections {
float: right;
}
.section {
display: inline-block;
position: relative;
padding: 0 20px;
line-height: $header_height;
cursor: pointer;
&:hover ul {
display: block;
}
}
ul {
display: none;
position: absolute;
z-index: 1000000; // this is getting out of control
right: 0;
margin: 0;
padding: 0;
width: 170px;
}
li {
display: block;
list-style-type: none;
padding: 10px 20px;
cursor: pointer;
vertical-align: top;
line-height: 18px;
box-sizing: border-box;
}
hr {
height: 1px;
border: 0;
outline: 0;
}
.section:hover,
li:hover {
background: rgba(#fff, 0.1);
}
li:active {
background: rgba(#fff, 0.05);
}
}
| Move open-window menu to z-index 1000000 | Move open-window menu to z-index 1000000
| SCSS | mit | stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy,stayradiated/terminal.sexy | scss | ## Code Before:
.app > header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: $header_height;
// background: #eee;
h1 {
line-height: $header_height;
margin: 0 20px;
float: left;
}
.sections {
float: right;
}
.section {
display: inline-block;
position: relative;
padding: 0 20px;
line-height: $header_height;
cursor: pointer;
&:hover ul {
display: block;
}
}
ul {
display: none;
position: absolute;
z-index: 1;
right: 0;
margin: 0;
padding: 0;
width: 170px;
}
li {
display: block;
list-style-type: none;
padding: 10px 20px;
cursor: pointer;
vertical-align: top;
line-height: 18px;
box-sizing: border-box;
}
hr {
height: 1px;
border: 0;
outline: 0;
}
.section:hover,
li:hover {
background: rgba(#fff, 0.1);
}
li:active {
background: rgba(#fff, 0.05);
}
}
## Instruction:
Move open-window menu to z-index 1000000
## Code After:
.app > header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: $header_height;
// background: #eee;
h1 {
line-height: $header_height;
margin: 0 20px;
float: left;
}
.sections {
float: right;
}
.section {
display: inline-block;
position: relative;
padding: 0 20px;
line-height: $header_height;
cursor: pointer;
&:hover ul {
display: block;
}
}
ul {
display: none;
position: absolute;
z-index: 1000000; // this is getting out of control
right: 0;
margin: 0;
padding: 0;
width: 170px;
}
li {
display: block;
list-style-type: none;
padding: 10px 20px;
cursor: pointer;
vertical-align: top;
line-height: 18px;
box-sizing: border-box;
}
hr {
height: 1px;
border: 0;
outline: 0;
}
.section:hover,
li:hover {
background: rgba(#fff, 0.1);
}
li:active {
background: rgba(#fff, 0.05);
}
}
| .app > header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: $header_height;
// background: #eee;
h1 {
line-height: $header_height;
margin: 0 20px;
float: left;
}
.sections {
float: right;
}
.section {
display: inline-block;
position: relative;
padding: 0 20px;
line-height: $header_height;
cursor: pointer;
&:hover ul {
display: block;
}
}
ul {
display: none;
position: absolute;
- z-index: 1;
+ z-index: 1000000; // this is getting out of control
right: 0;
margin: 0;
padding: 0;
width: 170px;
}
li {
display: block;
list-style-type: none;
padding: 10px 20px;
cursor: pointer;
vertical-align: top;
line-height: 18px;
box-sizing: border-box;
}
hr {
height: 1px;
border: 0;
outline: 0;
}
.section:hover,
li:hover {
background: rgba(#fff, 0.1);
}
li:active {
background: rgba(#fff, 0.05);
}
}
| 2 | 0.029851 | 1 | 1 |
1f0bddff927b5143baabbab45562b16916f5f74d | tests/dk_stem_SUITE.erl | tests/dk_stem_SUITE.erl | -module(dk_stem_SUITE).
-include_lib("common_test/include/ct.hrl").
-compile(export_all).
-define(value(Key,Config), proplists:get_value(Key,Config)).
all() ->
[{group, integration_tests}].
groups() ->
[{integration_tests, [test_en, test_nl]}].
test_en(Config) ->
vocab_stemmed("en", Config),
ok.
test_nl(Config) ->
vocab_stemmed("nl", Config),
ok.
vocab_stemmed(Lang, Config) ->
DataDir = ?value(data_dir, Config),
{ok, Binary} =
file:read_file(DataDir ++ "vocabulary_stemmed_" ++ Lang ++ ".txt"),
Lines = re:split(Binary, <<"\n">>, [trim]),
{ok, Re} = re:compile(<<"^([^ ]*) *([^ ]*)$">>, [unicode]),
Options = [{capture, all_but_first, binary}],
Mod = list_to_atom("dk_stem_" ++ Lang),
lists:foreach(
fun(Line) ->
{match, [Word, Stem]} = re:run(Line, Re, Options),
Stem = apply(Mod, stem, [Word])
end,
Lines).
%%% Local variables:
%%% mode: erlang
%%% fill-column: 78
%%% coding: latin-1
%%% End:
| -module(dk_stem_SUITE).
-include_lib("common_test/include/ct.hrl").
-compile(export_all).
-define(value(Key,Config), proplists:get_value(Key,Config)).
all() ->
[{group, integration_tests}].
groups() ->
[{integration_tests, [test_en, test_nl]}].
test_en(Config) ->
vocab_stemmed("en", Config),
ok.
test_nl(Config) ->
vocab_stemmed("nl", Config),
ok.
vocab_stemmed(Lang, Config) ->
DataDir = ?value(data_dir, Config),
{ok, Binary} =
file:read_file(DataDir ++ "vocabulary_stemmed_" ++ Lang ++ ".txt"),
Lines = re:split(Binary, <<"\n">>, [trim]),
{ok, Re} = re:compile(<<"^([^ ]*) *([^ ]*)$">>, [unicode]),
Options = [{capture, all_but_first, binary}],
Mod = list_to_atom("dk_stem_" ++ Lang),
lists:foreach(
fun(Line) ->
{match, [Word, Stem]} = re:run(Line, Re, Options),
Stem = Mod:stem(Word)
end,
Lines).
%%% Local variables:
%%% mode: erlang
%%% fill-column: 78
%%% coding: latin-1
%%% End:
| Use variable instead of `apply` | Use variable instead of `apply`
| Erlang | bsd-3-clause | moretea/doko,moretea/doko | erlang | ## Code Before:
-module(dk_stem_SUITE).
-include_lib("common_test/include/ct.hrl").
-compile(export_all).
-define(value(Key,Config), proplists:get_value(Key,Config)).
all() ->
[{group, integration_tests}].
groups() ->
[{integration_tests, [test_en, test_nl]}].
test_en(Config) ->
vocab_stemmed("en", Config),
ok.
test_nl(Config) ->
vocab_stemmed("nl", Config),
ok.
vocab_stemmed(Lang, Config) ->
DataDir = ?value(data_dir, Config),
{ok, Binary} =
file:read_file(DataDir ++ "vocabulary_stemmed_" ++ Lang ++ ".txt"),
Lines = re:split(Binary, <<"\n">>, [trim]),
{ok, Re} = re:compile(<<"^([^ ]*) *([^ ]*)$">>, [unicode]),
Options = [{capture, all_but_first, binary}],
Mod = list_to_atom("dk_stem_" ++ Lang),
lists:foreach(
fun(Line) ->
{match, [Word, Stem]} = re:run(Line, Re, Options),
Stem = apply(Mod, stem, [Word])
end,
Lines).
%%% Local variables:
%%% mode: erlang
%%% fill-column: 78
%%% coding: latin-1
%%% End:
## Instruction:
Use variable instead of `apply`
## Code After:
-module(dk_stem_SUITE).
-include_lib("common_test/include/ct.hrl").
-compile(export_all).
-define(value(Key,Config), proplists:get_value(Key,Config)).
all() ->
[{group, integration_tests}].
groups() ->
[{integration_tests, [test_en, test_nl]}].
test_en(Config) ->
vocab_stemmed("en", Config),
ok.
test_nl(Config) ->
vocab_stemmed("nl", Config),
ok.
vocab_stemmed(Lang, Config) ->
DataDir = ?value(data_dir, Config),
{ok, Binary} =
file:read_file(DataDir ++ "vocabulary_stemmed_" ++ Lang ++ ".txt"),
Lines = re:split(Binary, <<"\n">>, [trim]),
{ok, Re} = re:compile(<<"^([^ ]*) *([^ ]*)$">>, [unicode]),
Options = [{capture, all_but_first, binary}],
Mod = list_to_atom("dk_stem_" ++ Lang),
lists:foreach(
fun(Line) ->
{match, [Word, Stem]} = re:run(Line, Re, Options),
Stem = Mod:stem(Word)
end,
Lines).
%%% Local variables:
%%% mode: erlang
%%% fill-column: 78
%%% coding: latin-1
%%% End:
| -module(dk_stem_SUITE).
-include_lib("common_test/include/ct.hrl").
-compile(export_all).
-define(value(Key,Config), proplists:get_value(Key,Config)).
all() ->
[{group, integration_tests}].
groups() ->
[{integration_tests, [test_en, test_nl]}].
test_en(Config) ->
vocab_stemmed("en", Config),
ok.
test_nl(Config) ->
vocab_stemmed("nl", Config),
ok.
vocab_stemmed(Lang, Config) ->
DataDir = ?value(data_dir, Config),
{ok, Binary} =
file:read_file(DataDir ++ "vocabulary_stemmed_" ++ Lang ++ ".txt"),
Lines = re:split(Binary, <<"\n">>, [trim]),
{ok, Re} = re:compile(<<"^([^ ]*) *([^ ]*)$">>, [unicode]),
Options = [{capture, all_but_first, binary}],
Mod = list_to_atom("dk_stem_" ++ Lang),
lists:foreach(
fun(Line) ->
{match, [Word, Stem]} = re:run(Line, Re, Options),
- Stem = apply(Mod, stem, [Word])
? ------ ^^ ^^^ -
+ Stem = Mod:stem(Word)
? ^ ^
end,
Lines).
%%% Local variables:
%%% mode: erlang
%%% fill-column: 78
%%% coding: latin-1
%%% End: | 2 | 0.04878 | 1 | 1 |
569426d0640584984c9d551bf198110a1649574a | README.md | README.md | Allows the usage in .NET of the Mixed Integer Linear Programming (MILP) solver lp_solve.
| LpSolveDotNet is a .NET wrapper for the Mixed Integer Linear Programming (MILP) solver lp_solve. The wrapper works with both 32-bit and 64-bit applications.
The solver lp_solve solves pure linear, (mixed) integer/binary, semi-cont and special ordered sets (SOS) models.
To use lpsolve in .NET follow these steps:
1. Add NuGet package LpSolveDotNet to your project using NuGet Package Manager: `Install-Package LpSolveDotNet`. This will
* Add a reference to the LpSolveDotNet library
* Add a post-build step to your project file that will copy the native library lpsolve55.dll to your output folder. Note that this will copy both the 32-bit and 64-bit versions of the library and LpSolveDotNet will load the correct one at runtime.
2. In your project, add a call to either of the `LpSolveDotNet.lpsolve.Init()` methods defined below. Both of them will modify the *PATH* environment variable of the current process to allow it to find the lpsolve methods. Note that calling multiple times these methods has no side effects (unless you pass different parameters).
* *Init(dllFolderPath)*: This method will use the given *dllFolderPath* to find *lpsolve55.dll*.
* *Parameterless Init()*: This method will determine where is *lpsolve55.dll* based on IntPtr.Size, using either `NativeBinaries\win64` or `NativeBinaries\win32` relative to executing assembly.
3. Use methods on `LpSolveDotNet.lpsolve` class by following [lpsolve documentation](http://lpsolve.sourceforge.net/5.5/index.htm). | Add a bit of documentation | Add a bit of documentation
| Markdown | lgpl-2.1 | MarcelGosselin/LpSolveDotNet | markdown | ## Code Before:
Allows the usage in .NET of the Mixed Integer Linear Programming (MILP) solver lp_solve.
## Instruction:
Add a bit of documentation
## Code After:
LpSolveDotNet is a .NET wrapper for the Mixed Integer Linear Programming (MILP) solver lp_solve. The wrapper works with both 32-bit and 64-bit applications.
The solver lp_solve solves pure linear, (mixed) integer/binary, semi-cont and special ordered sets (SOS) models.
To use lpsolve in .NET follow these steps:
1. Add NuGet package LpSolveDotNet to your project using NuGet Package Manager: `Install-Package LpSolveDotNet`. This will
* Add a reference to the LpSolveDotNet library
* Add a post-build step to your project file that will copy the native library lpsolve55.dll to your output folder. Note that this will copy both the 32-bit and 64-bit versions of the library and LpSolveDotNet will load the correct one at runtime.
2. In your project, add a call to either of the `LpSolveDotNet.lpsolve.Init()` methods defined below. Both of them will modify the *PATH* environment variable of the current process to allow it to find the lpsolve methods. Note that calling multiple times these methods has no side effects (unless you pass different parameters).
* *Init(dllFolderPath)*: This method will use the given *dllFolderPath* to find *lpsolve55.dll*.
* *Parameterless Init()*: This method will determine where is *lpsolve55.dll* based on IntPtr.Size, using either `NativeBinaries\win64` or `NativeBinaries\win32` relative to executing assembly.
3. Use methods on `LpSolveDotNet.lpsolve` class by following [lpsolve documentation](http://lpsolve.sourceforge.net/5.5/index.htm). | - Allows the usage in .NET of the Mixed Integer Linear Programming (MILP) solver lp_solve.
+ LpSolveDotNet is a .NET wrapper for the Mixed Integer Linear Programming (MILP) solver lp_solve. The wrapper works with both 32-bit and 64-bit applications.
+
+ The solver lp_solve solves pure linear, (mixed) integer/binary, semi-cont and special ordered sets (SOS) models.
+
+ To use lpsolve in .NET follow these steps:
+ 1. Add NuGet package LpSolveDotNet to your project using NuGet Package Manager: `Install-Package LpSolveDotNet`. This will
+ * Add a reference to the LpSolveDotNet library
+ * Add a post-build step to your project file that will copy the native library lpsolve55.dll to your output folder. Note that this will copy both the 32-bit and 64-bit versions of the library and LpSolveDotNet will load the correct one at runtime.
+ 2. In your project, add a call to either of the `LpSolveDotNet.lpsolve.Init()` methods defined below. Both of them will modify the *PATH* environment variable of the current process to allow it to find the lpsolve methods. Note that calling multiple times these methods has no side effects (unless you pass different parameters).
+ * *Init(dllFolderPath)*: This method will use the given *dllFolderPath* to find *lpsolve55.dll*.
+ * *Parameterless Init()*: This method will determine where is *lpsolve55.dll* based on IntPtr.Size, using either `NativeBinaries\win64` or `NativeBinaries\win32` relative to executing assembly.
+ 3. Use methods on `LpSolveDotNet.lpsolve` class by following [lpsolve documentation](http://lpsolve.sourceforge.net/5.5/index.htm). | 13 | 13 | 12 | 1 |
2944aff6e135d61d36a90ed40e4f7db24334dfd0 | projects/kickstart/2019/practice/kickstart_alarm/CMakeLists.txt | projects/kickstart/2019/practice/kickstart_alarm/CMakeLists.txt | project(kickstart_alarm)
enable_testing()
# Header-only lib
set(KICKSTART_ALARM_SOURCES)
set(KICKSTART_ALARM_HEADERS include/KickStartAlarm.hpp)
set(KICKSTART_ALARM_DEMO_SOURCES src/main.cpp)
add_library(kickstart_alarm INTERFACE)
# Dummy project to show the header-only lib in VS
add_custom_target(
kickstart_alarm_
EXCLUDE_FROM_ALL
SOURCES include/KickStartAlarm.hpp
)
set_target_properties(kickstart_alarm_ PROPERTIES FOLDER "kickstart/2019/practice")
# Demo
add_executable(kickstart_alarm_demo ${KICKSTART_ALARM_DEMO_SOURCES})
target_include_directories(kickstart_alarm INTERFACE include)
# Header-only library, so the project_warnings doesn't make sense, because it shouldn't be
# propagated to dependant targets
target_link_libraries(kickstart_alarm INTERFACE project_options)
target_link_libraries(
kickstart_alarm_demo
PRIVATE kickstart_alarm
project_warnings
project_options
)
set_target_properties(kickstart_alarm_demo PROPERTIES FOLDER "kickstart/2019/practice")
| project(kickstart_alarm)
enable_testing()
# Header-only lib
set(KICKSTART_ALARM_SOURCES)
set(KICKSTART_ALARM_HEADERS include/KickStartAlarm.hpp)
set(KICKSTART_ALARM_DEMO_SOURCES src/main.cpp)
add_library(kickstart_alarm INTERFACE)
# Dummy project to show the header-only lib in VS
add_custom_target(
kickstart_alarm_
EXCLUDE_FROM_ALL
SOURCES ${KICKSTART_ALARM_HEADERS}
)
set_target_properties(kickstart_alarm_ PROPERTIES FOLDER "kickstart/2019/practice")
# Demo
add_executable(kickstart_alarm_demo ${KICKSTART_ALARM_DEMO_SOURCES})
target_include_directories(kickstart_alarm INTERFACE include)
# Header-only library, so the project_warnings doesn't make sense, because it shouldn't be
# propagated to dependant targets
target_link_libraries(kickstart_alarm INTERFACE project_options)
target_link_libraries(
kickstart_alarm_demo
PRIVATE kickstart_alarm
project_warnings
project_options
)
set_target_properties(kickstart_alarm_demo PROPERTIES FOLDER "kickstart/2019/practice")
| Use KICKSTART_ALARM_HEADERS instead of string literal in cmake | Use KICKSTART_ALARM_HEADERS instead of string literal in cmake
| Text | mit | antaljanosbenjamin/miscellaneous,antaljanosbenjamin/miscellaneous | text | ## Code Before:
project(kickstart_alarm)
enable_testing()
# Header-only lib
set(KICKSTART_ALARM_SOURCES)
set(KICKSTART_ALARM_HEADERS include/KickStartAlarm.hpp)
set(KICKSTART_ALARM_DEMO_SOURCES src/main.cpp)
add_library(kickstart_alarm INTERFACE)
# Dummy project to show the header-only lib in VS
add_custom_target(
kickstart_alarm_
EXCLUDE_FROM_ALL
SOURCES include/KickStartAlarm.hpp
)
set_target_properties(kickstart_alarm_ PROPERTIES FOLDER "kickstart/2019/practice")
# Demo
add_executable(kickstart_alarm_demo ${KICKSTART_ALARM_DEMO_SOURCES})
target_include_directories(kickstart_alarm INTERFACE include)
# Header-only library, so the project_warnings doesn't make sense, because it shouldn't be
# propagated to dependant targets
target_link_libraries(kickstart_alarm INTERFACE project_options)
target_link_libraries(
kickstart_alarm_demo
PRIVATE kickstart_alarm
project_warnings
project_options
)
set_target_properties(kickstart_alarm_demo PROPERTIES FOLDER "kickstart/2019/practice")
## Instruction:
Use KICKSTART_ALARM_HEADERS instead of string literal in cmake
## Code After:
project(kickstart_alarm)
enable_testing()
# Header-only lib
set(KICKSTART_ALARM_SOURCES)
set(KICKSTART_ALARM_HEADERS include/KickStartAlarm.hpp)
set(KICKSTART_ALARM_DEMO_SOURCES src/main.cpp)
add_library(kickstart_alarm INTERFACE)
# Dummy project to show the header-only lib in VS
add_custom_target(
kickstart_alarm_
EXCLUDE_FROM_ALL
SOURCES ${KICKSTART_ALARM_HEADERS}
)
set_target_properties(kickstart_alarm_ PROPERTIES FOLDER "kickstart/2019/practice")
# Demo
add_executable(kickstart_alarm_demo ${KICKSTART_ALARM_DEMO_SOURCES})
target_include_directories(kickstart_alarm INTERFACE include)
# Header-only library, so the project_warnings doesn't make sense, because it shouldn't be
# propagated to dependant targets
target_link_libraries(kickstart_alarm INTERFACE project_options)
target_link_libraries(
kickstart_alarm_demo
PRIVATE kickstart_alarm
project_warnings
project_options
)
set_target_properties(kickstart_alarm_demo PROPERTIES FOLDER "kickstart/2019/practice")
| project(kickstart_alarm)
enable_testing()
# Header-only lib
set(KICKSTART_ALARM_SOURCES)
set(KICKSTART_ALARM_HEADERS include/KickStartAlarm.hpp)
set(KICKSTART_ALARM_DEMO_SOURCES src/main.cpp)
add_library(kickstart_alarm INTERFACE)
# Dummy project to show the header-only lib in VS
add_custom_target(
kickstart_alarm_
EXCLUDE_FROM_ALL
- SOURCES include/KickStartAlarm.hpp
+ SOURCES ${KICKSTART_ALARM_HEADERS}
)
set_target_properties(kickstart_alarm_ PROPERTIES FOLDER "kickstart/2019/practice")
# Demo
add_executable(kickstart_alarm_demo ${KICKSTART_ALARM_DEMO_SOURCES})
target_include_directories(kickstart_alarm INTERFACE include)
# Header-only library, so the project_warnings doesn't make sense, because it shouldn't be
# propagated to dependant targets
target_link_libraries(kickstart_alarm INTERFACE project_options)
target_link_libraries(
kickstart_alarm_demo
PRIVATE kickstart_alarm
project_warnings
project_options
)
set_target_properties(kickstart_alarm_demo PROPERTIES FOLDER "kickstart/2019/practice") | 2 | 0.052632 | 1 | 1 |
cc693feb7b3562571f42bbbc6ec9834c263151a0 | CMakeLists.txt | CMakeLists.txt | cmake_minimum_required(VERSION 3.5)
project(control_toolbox)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(realtime_tools REQUIRED)
add_library(${PROJECT_NAME}
#src/dither.cpp
#src/limited_proxy.cpp
src/pid.cpp
#src/pid_gains_setter.cpp
#src/sine_sweep.cpp
#src/sinusoid.cpp
)
ament_target_dependencies(${PROJECT_NAME} "rclcpp")
ament_target_dependencies(${PROJECT_NAME} "realtime_tools")
target_include_directories(${PROJECT_NAME} PUBLIC include)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# Tests
ament_add_gmock(pid_tests test/pid_tests.cpp)
target_link_libraries(pid_tests ${PROJECT_NAME})
# add_executable(test_linear test/linear.cpp)
endif()
# Install
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
ament_export_dependencies("rclcpp")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()
| cmake_minimum_required(VERSION 3.5)
project(control_toolbox)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(realtime_tools REQUIRED)
add_library(${PROJECT_NAME}
#src/dither.cpp
#src/limited_proxy.cpp
src/pid.cpp
#src/pid_gains_setter.cpp
#src/sine_sweep.cpp
#src/sinusoid.cpp
)
ament_target_dependencies(${PROJECT_NAME} "rclcpp")
ament_target_dependencies(${PROJECT_NAME} "realtime_tools")
target_include_directories(${PROJECT_NAME} PUBLIC include)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# Tests
ament_add_gmock(pid_tests test/pid_tests.cpp)
target_link_libraries(pid_tests ${PROJECT_NAME})
# add_executable(test_linear test/linear.cpp)
endif()
# Install
install(DIRECTORY include/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
ament_export_dependencies(
"rclcpp"
"realtime_tools")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()
| Fix dependency export and include installation | Fix dependency export and include installation
Signed-off-by: Shane Loretz <7fde345e8e2e22c78a1570a4807e4629866dc7de@osrfoundation.org>
| Text | bsd-3-clause | ros-controls/control_toolbox | text | ## Code Before:
cmake_minimum_required(VERSION 3.5)
project(control_toolbox)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(realtime_tools REQUIRED)
add_library(${PROJECT_NAME}
#src/dither.cpp
#src/limited_proxy.cpp
src/pid.cpp
#src/pid_gains_setter.cpp
#src/sine_sweep.cpp
#src/sinusoid.cpp
)
ament_target_dependencies(${PROJECT_NAME} "rclcpp")
ament_target_dependencies(${PROJECT_NAME} "realtime_tools")
target_include_directories(${PROJECT_NAME} PUBLIC include)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# Tests
ament_add_gmock(pid_tests test/pid_tests.cpp)
target_link_libraries(pid_tests ${PROJECT_NAME})
# add_executable(test_linear test/linear.cpp)
endif()
# Install
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
ament_export_dependencies("rclcpp")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()
## Instruction:
Fix dependency export and include installation
Signed-off-by: Shane Loretz <7fde345e8e2e22c78a1570a4807e4629866dc7de@osrfoundation.org>
## Code After:
cmake_minimum_required(VERSION 3.5)
project(control_toolbox)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(realtime_tools REQUIRED)
add_library(${PROJECT_NAME}
#src/dither.cpp
#src/limited_proxy.cpp
src/pid.cpp
#src/pid_gains_setter.cpp
#src/sine_sweep.cpp
#src/sinusoid.cpp
)
ament_target_dependencies(${PROJECT_NAME} "rclcpp")
ament_target_dependencies(${PROJECT_NAME} "realtime_tools")
target_include_directories(${PROJECT_NAME} PUBLIC include)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# Tests
ament_add_gmock(pid_tests test/pid_tests.cpp)
target_link_libraries(pid_tests ${PROJECT_NAME})
# add_executable(test_linear test/linear.cpp)
endif()
# Install
install(DIRECTORY include/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
ament_export_dependencies(
"rclcpp"
"realtime_tools")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()
| cmake_minimum_required(VERSION 3.5)
project(control_toolbox)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(realtime_tools REQUIRED)
add_library(${PROJECT_NAME}
#src/dither.cpp
#src/limited_proxy.cpp
src/pid.cpp
#src/pid_gains_setter.cpp
#src/sine_sweep.cpp
#src/sinusoid.cpp
)
ament_target_dependencies(${PROJECT_NAME} "rclcpp")
ament_target_dependencies(${PROJECT_NAME} "realtime_tools")
target_include_directories(${PROJECT_NAME} PUBLIC include)
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# Tests
ament_add_gmock(pid_tests test/pid_tests.cpp)
target_link_libraries(pid_tests ${PROJECT_NAME})
# add_executable(test_linear test/linear.cpp)
endif()
# Install
- install(DIRECTORY include/${PROJECT_NAME}/
? ----------------
+ install(DIRECTORY include/
DESTINATION include)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
- ament_export_dependencies("rclcpp")
? ---------
+ ament_export_dependencies(
+ "rclcpp"
+ "realtime_tools")
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package() | 6 | 0.130435 | 4 | 2 |
935bbb97d14fb256b53417c19f9da38c52a29e15 | CETAVFilter/FilterHelper.swift | CETAVFilter/FilterHelper.swift | //
// FilterHelper.swift
// CETAVFilter
//
// Created by Chris Jimenez on 2/14/16.
// Copyright © 2016 Chris Jimenez. All rights reserved.
//
import Foundation
import UIKit
/// A helper class to apply filters to an image
public class FilterHelper {
//The context that will help us creating the image
let context = CIContext(options: nil)
/**
Applys the filter to an image and returns it
- parameter imageToFilter: Image to apply the filter to
- returns: image with the filter apply
*/
public func applyFilter(imageToFilter: UIImage) -> UIImage
{
//Creates the CI image
let inputImage = CIImage(image: imageToFilter)
//Adds the filter to the image
let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:200])
//Renders the image
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent)
//Returns the image
return UIImage(CGImage: renderedImage)
}
}
| //
// FilterHelper.swift
// CETAVFilter
//
// Created by Chris Jimenez on 2/14/16.
// Copyright © 2016 Chris Jimenez. All rights reserved.
//
import Foundation
import UIKit
/// A helper class to apply filters to an image
public class FilterHelper {
//The context that will help us creating the image
let context = CIContext(options: nil)
/**
Applys the filter to an image and returns it
- parameter imageToFilter: Image to apply the filter to
- returns: image with the filter apply
*/
public func applyFilter(imageToFilter: UIImage) -> UIImage
{
//Creates the CI image
let inputImage = CIImage(image: imageToFilter)
//Generates a random number
let randomNumber = Double(arc4random_uniform(300)+1)
//Adds the filter to the image
let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:randomNumber])
//Renders the image
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent)
//Returns the image
return UIImage(CGImage: renderedImage)
}
}
| Add a random number to more filter awesomeness | Add a random number to more filter awesomeness
| Swift | mit | CocoaHeadsCR/CETAVFilter | swift | ## Code Before:
//
// FilterHelper.swift
// CETAVFilter
//
// Created by Chris Jimenez on 2/14/16.
// Copyright © 2016 Chris Jimenez. All rights reserved.
//
import Foundation
import UIKit
/// A helper class to apply filters to an image
public class FilterHelper {
//The context that will help us creating the image
let context = CIContext(options: nil)
/**
Applys the filter to an image and returns it
- parameter imageToFilter: Image to apply the filter to
- returns: image with the filter apply
*/
public func applyFilter(imageToFilter: UIImage) -> UIImage
{
//Creates the CI image
let inputImage = CIImage(image: imageToFilter)
//Adds the filter to the image
let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:200])
//Renders the image
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent)
//Returns the image
return UIImage(CGImage: renderedImage)
}
}
## Instruction:
Add a random number to more filter awesomeness
## Code After:
//
// FilterHelper.swift
// CETAVFilter
//
// Created by Chris Jimenez on 2/14/16.
// Copyright © 2016 Chris Jimenez. All rights reserved.
//
import Foundation
import UIKit
/// A helper class to apply filters to an image
public class FilterHelper {
//The context that will help us creating the image
let context = CIContext(options: nil)
/**
Applys the filter to an image and returns it
- parameter imageToFilter: Image to apply the filter to
- returns: image with the filter apply
*/
public func applyFilter(imageToFilter: UIImage) -> UIImage
{
//Creates the CI image
let inputImage = CIImage(image: imageToFilter)
//Generates a random number
let randomNumber = Double(arc4random_uniform(300)+1)
//Adds the filter to the image
let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:randomNumber])
//Renders the image
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent)
//Returns the image
return UIImage(CGImage: renderedImage)
}
}
| //
// FilterHelper.swift
// CETAVFilter
//
// Created by Chris Jimenez on 2/14/16.
// Copyright © 2016 Chris Jimenez. All rights reserved.
//
import Foundation
import UIKit
/// A helper class to apply filters to an image
public class FilterHelper {
//The context that will help us creating the image
let context = CIContext(options: nil)
/**
Applys the filter to an image and returns it
- parameter imageToFilter: Image to apply the filter to
- returns: image with the filter apply
*/
public func applyFilter(imageToFilter: UIImage) -> UIImage
{
//Creates the CI image
let inputImage = CIImage(image: imageToFilter)
+ //Generates a random number
+ let randomNumber = Double(arc4random_uniform(300)+1)
+
//Adds the filter to the image
- let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:200])
? ^^^
+ let filteredImage = inputImage!.imageByApplyingFilter("CIHueAdjust", withInputParameters: [kCIInputAngleKey:randomNumber])
? ^^^^^^^^^^^^
//Renders the image
let renderedImage = context.createCGImage(filteredImage, fromRect: filteredImage.extent)
//Returns the image
return UIImage(CGImage: renderedImage)
}
} | 5 | 0.121951 | 4 | 1 |
faf24e319f3c60874a1804fc0f065104b9b6d656 | pages/contact.md | pages/contact.md | ---
layout: page-fullwidth
title: "Contact Us"
permalink: /contact/
---
There are several ways to get in touch.
* Our main communication channel is our [Library Carpentry Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). Sign up to stay in touch via email.
* You can also chat with community members in our [Gitter chatroom](https://gitter.im/LibraryCarpentry/Lobby). Join with your GitHub username or Twitter handle.
* If you are new to the community and have questions, reach out to community members via the channels above and/or the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* Want a Library Carpentry workshop at your institution? [Request one](https://amy.software-carpentry.org/forms/workshop/). Note your interest in Library Carpentry, and also reach out to the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* You can raise issues and/or pull requests on any of the lesson repositories and this site through the [Library Carpentry GitHub organisation](https://github.com/LibraryCarpentry).
* Library Carpentry also maintains a [Twitter handle](https://twitter.com/LibCarpentry) which you can follow and learn about what community members are doing.
| ---
layout: page-fullwidth
title: "Contact Us"
permalink: /contact/
---
There are several ways to get in touch.
* Our main communication channel is our [Library Carpentry Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). Sign up to stay in touch via email.
* You can also chat with community members in our [Gitter chatroom](https://gitter.im/LibraryCarpentry/Lobby). Join with your GitHub username or Twitter handle.
* If you are new to the community and have questions, reach out to community members via the channels above and/or the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* Want a Library Carpentry workshop at your institution? [Request one](https://amy.software-carpentry.org/forms/workshop/). Note your interest in Library Carpentry, and also reach out to the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* You can raise issues and/or pull requests on any of the lesson repositories and this site through the [Library Carpentry GitHub organisation](https://github.com/LibraryCarpentry).
* Library Carpentry also maintains a [Twitter handle](https://twitter.com/LibCarpentry) which you can follow and learn about what community members are doing.
* For general Carpentries information, inquiries or comments, please get in touch via team@carpentries.org.
| Include general inquiry language and team@ | Include general inquiry language and team@ | Markdown | mit | LibraryCarpentry/librarycarpentry.github.io,LibraryCarpentry/librarycarpentry.github.io,LibraryCarpentry/librarycarpentry.github.io | markdown | ## Code Before:
---
layout: page-fullwidth
title: "Contact Us"
permalink: /contact/
---
There are several ways to get in touch.
* Our main communication channel is our [Library Carpentry Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). Sign up to stay in touch via email.
* You can also chat with community members in our [Gitter chatroom](https://gitter.im/LibraryCarpentry/Lobby). Join with your GitHub username or Twitter handle.
* If you are new to the community and have questions, reach out to community members via the channels above and/or the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* Want a Library Carpentry workshop at your institution? [Request one](https://amy.software-carpentry.org/forms/workshop/). Note your interest in Library Carpentry, and also reach out to the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* You can raise issues and/or pull requests on any of the lesson repositories and this site through the [Library Carpentry GitHub organisation](https://github.com/LibraryCarpentry).
* Library Carpentry also maintains a [Twitter handle](https://twitter.com/LibCarpentry) which you can follow and learn about what community members are doing.
## Instruction:
Include general inquiry language and team@
## Code After:
---
layout: page-fullwidth
title: "Contact Us"
permalink: /contact/
---
There are several ways to get in touch.
* Our main communication channel is our [Library Carpentry Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). Sign up to stay in touch via email.
* You can also chat with community members in our [Gitter chatroom](https://gitter.im/LibraryCarpentry/Lobby). Join with your GitHub username or Twitter handle.
* If you are new to the community and have questions, reach out to community members via the channels above and/or the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* Want a Library Carpentry workshop at your institution? [Request one](https://amy.software-carpentry.org/forms/workshop/). Note your interest in Library Carpentry, and also reach out to the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* You can raise issues and/or pull requests on any of the lesson repositories and this site through the [Library Carpentry GitHub organisation](https://github.com/LibraryCarpentry).
* Library Carpentry also maintains a [Twitter handle](https://twitter.com/LibCarpentry) which you can follow and learn about what community members are doing.
* For general Carpentries information, inquiries or comments, please get in touch via team@carpentries.org.
| ---
layout: page-fullwidth
title: "Contact Us"
permalink: /contact/
---
There are several ways to get in touch.
* Our main communication channel is our [Library Carpentry Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). Sign up to stay in touch via email.
* You can also chat with community members in our [Gitter chatroom](https://gitter.im/LibraryCarpentry/Lobby). Join with your GitHub username or Twitter handle.
* If you are new to the community and have questions, reach out to community members via the channels above and/or the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* Want a Library Carpentry workshop at your institution? [Request one](https://amy.software-carpentry.org/forms/workshop/). Note your interest in Library Carpentry, and also reach out to the Library Carpentry Community and Development Director, [Chris Erdmann](mailto:chris@carpentries.org).
* You can raise issues and/or pull requests on any of the lesson repositories and this site through the [Library Carpentry GitHub organisation](https://github.com/LibraryCarpentry).
* Library Carpentry also maintains a [Twitter handle](https://twitter.com/LibCarpentry) which you can follow and learn about what community members are doing.
+
+ * For general Carpentries information, inquiries or comments, please get in touch via team@carpentries.org. | 2 | 0.105263 | 2 | 0 |
65a4352846bb570c33bd918584977f084e147d54 | src/components/RouterHistoryContainer.js | src/components/RouterHistoryContainer.js | /**
* RouterHistoryContainer is already connected to the router state, so you only
* have to pass in `routes`. It also responds to history/click events and
* dispatches routeTo actions appropriately.
*/
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Router from './Router';
import connectRouter from './connectRouter';
import History from './History';
const RouterHistoryContainer = createReactClass({
propTypes: {
routes: PropTypes.object.isRequired
},
onChangeAddress(url, state) {
this.props.routeTo(url, {
state,
isHistoryChange: true
});
},
render() {
const { router } = this.props;
const url = router.current ? router.current.url : null;
const state = router.current ? router.current.state : undefined;
const replace = router.current ? router.current.replace : undefined;
return (
<div>
<Router {...this.props} router={router}/>
<History
history={this.props.history}
url={url} state={state} replace={replace}
isWaiting={!!router.next}
onChange={this.onChangeAddress}
/>
</div>
);
}
});
export default connectRouter(RouterHistoryContainer);
| /**
* RouterHistoryContainer is already connected to the router state, so you only
* have to pass in `routes`. It also responds to history/click events and
* dispatches routeTo actions appropriately.
*/
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Router from './Router';
import connectRouter from './connectRouter';
import History from './History';
const RouterHistoryContainer = createReactClass({
propTypes: {
routes: PropTypes.object.isRequired,
},
onChangeAddress(url, state) {
this.props.routeTo(url, {
state,
isHistoryChange: true,
});
},
render() {
const { router } = this.props;
const url = router.current ? router.current.url : null;
const state = router.current ? router.current.state : undefined;
const replace = router.current ? router.current.replace : undefined;
return [
<Router key="router" {...this.props} router={router} />,
<History
key="history"
history={this.props.history}
url={url}
state={state}
replace={replace}
isWaiting={!!router.next}
onChange={this.onChangeAddress}
/>,
];
},
});
export default connectRouter(RouterHistoryContainer);
| Send the minimal amount of DOM to the client | Send the minimal amount of DOM to the client
| JavaScript | mit | zapier/redux-router-kit | javascript | ## Code Before:
/**
* RouterHistoryContainer is already connected to the router state, so you only
* have to pass in `routes`. It also responds to history/click events and
* dispatches routeTo actions appropriately.
*/
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Router from './Router';
import connectRouter from './connectRouter';
import History from './History';
const RouterHistoryContainer = createReactClass({
propTypes: {
routes: PropTypes.object.isRequired
},
onChangeAddress(url, state) {
this.props.routeTo(url, {
state,
isHistoryChange: true
});
},
render() {
const { router } = this.props;
const url = router.current ? router.current.url : null;
const state = router.current ? router.current.state : undefined;
const replace = router.current ? router.current.replace : undefined;
return (
<div>
<Router {...this.props} router={router}/>
<History
history={this.props.history}
url={url} state={state} replace={replace}
isWaiting={!!router.next}
onChange={this.onChangeAddress}
/>
</div>
);
}
});
export default connectRouter(RouterHistoryContainer);
## Instruction:
Send the minimal amount of DOM to the client
## Code After:
/**
* RouterHistoryContainer is already connected to the router state, so you only
* have to pass in `routes`. It also responds to history/click events and
* dispatches routeTo actions appropriately.
*/
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Router from './Router';
import connectRouter from './connectRouter';
import History from './History';
const RouterHistoryContainer = createReactClass({
propTypes: {
routes: PropTypes.object.isRequired,
},
onChangeAddress(url, state) {
this.props.routeTo(url, {
state,
isHistoryChange: true,
});
},
render() {
const { router } = this.props;
const url = router.current ? router.current.url : null;
const state = router.current ? router.current.state : undefined;
const replace = router.current ? router.current.replace : undefined;
return [
<Router key="router" {...this.props} router={router} />,
<History
key="history"
history={this.props.history}
url={url}
state={state}
replace={replace}
isWaiting={!!router.next}
onChange={this.onChangeAddress}
/>,
];
},
});
export default connectRouter(RouterHistoryContainer);
| /**
* RouterHistoryContainer is already connected to the router state, so you only
* have to pass in `routes`. It also responds to history/click events and
* dispatches routeTo actions appropriately.
*/
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Router from './Router';
import connectRouter from './connectRouter';
import History from './History';
const RouterHistoryContainer = createReactClass({
-
propTypes: {
- routes: PropTypes.object.isRequired
+ routes: PropTypes.object.isRequired,
? +
},
onChangeAddress(url, state) {
this.props.routeTo(url, {
state,
- isHistoryChange: true
+ isHistoryChange: true,
? +
});
},
render() {
const { router } = this.props;
const url = router.current ? router.current.url : null;
const state = router.current ? router.current.state : undefined;
const replace = router.current ? router.current.replace : undefined;
- return (
? ^
+ return [
? ^
- <div>
- <Router {...this.props} router={router}/>
? --
+ <Router key="router" {...this.props} router={router} />,
? +++++++++++++ + +
- <History
? --
+ <History
+ key="history"
- history={this.props.history}
? --
+ history={this.props.history}
- url={url} state={state} replace={replace}
+ url={url}
+ state={state}
+ replace={replace}
- isWaiting={!!router.next}
? --
+ isWaiting={!!router.next}
- onChange={this.onChangeAddress}
? --
+ onChange={this.onChangeAddress}
- />
? --
+ />,
? +
- </div>
- );
? ^
+ ];
? ^
- }
+ },
? +
});
export default connectRouter(RouterHistoryContainer); | 30 | 0.612245 | 15 | 15 |
4bdc618e4ac0b597aa3aaaa7aad1abbb4ce8c774 | src/FormatterProvider.php | src/FormatterProvider.php | <?php
namespace Benrowe\Formatter;
/**
* Formatter Provider interface
*
* Provide a standard format interface for Providers to adher to
*
* @package Benrowe\Formatter
*/
interface FormatterProvider
{
/**
* Describes the formats that this formatter provides
*
* @return string[]
*/
public function formats();
/**
* Checks if the format exists
*
* @param string $format
* @return boolean
*/
public function hasFormat($format);
/**
* Format the corresponding value to the format provided
*
* @param mixed $value
* @param array $params
* @return mixed
*/
public function format($value, array $params = []);
}
| <?php
namespace Benrowe\Formatter;
/**
* Formatter Provider interface
*
* Provide a standard format interface for Providers to adher to
*
* @package Benrowe\Formatter
*/
interface FormatterProvider
{
/**
* Describes the formats that this formatter provides
*
* @return string[]
*/
public function formats();
/**
* Checks if the format exists
*
* @param string $format
* @return boolean
*/
public function hasFormat($format);
/**
* Format the corresponding value to the format provided
*
* @param mixed $value
* @param string|array $format either the format as a string, or an array,
* where the first element is the format type
* @return mixed
*/
public function format($value, $format = null);
}
| Update FormatProvider::format() signature so it doesnt force an array | Update FormatProvider::format() signature so it doesnt force an array
| PHP | mit | benrowe/formatter | php | ## Code Before:
<?php
namespace Benrowe\Formatter;
/**
* Formatter Provider interface
*
* Provide a standard format interface for Providers to adher to
*
* @package Benrowe\Formatter
*/
interface FormatterProvider
{
/**
* Describes the formats that this formatter provides
*
* @return string[]
*/
public function formats();
/**
* Checks if the format exists
*
* @param string $format
* @return boolean
*/
public function hasFormat($format);
/**
* Format the corresponding value to the format provided
*
* @param mixed $value
* @param array $params
* @return mixed
*/
public function format($value, array $params = []);
}
## Instruction:
Update FormatProvider::format() signature so it doesnt force an array
## Code After:
<?php
namespace Benrowe\Formatter;
/**
* Formatter Provider interface
*
* Provide a standard format interface for Providers to adher to
*
* @package Benrowe\Formatter
*/
interface FormatterProvider
{
/**
* Describes the formats that this formatter provides
*
* @return string[]
*/
public function formats();
/**
* Checks if the format exists
*
* @param string $format
* @return boolean
*/
public function hasFormat($format);
/**
* Format the corresponding value to the format provided
*
* @param mixed $value
* @param string|array $format either the format as a string, or an array,
* where the first element is the format type
* @return mixed
*/
public function format($value, $format = null);
}
| <?php
namespace Benrowe\Formatter;
/**
* Formatter Provider interface
*
* Provide a standard format interface for Providers to adher to
*
* @package Benrowe\Formatter
*/
interface FormatterProvider
{
/**
* Describes the formats that this formatter provides
*
* @return string[]
*/
public function formats();
/**
* Checks if the format exists
*
* @param string $format
* @return boolean
*/
public function hasFormat($format);
/**
* Format the corresponding value to the format provided
*
* @param mixed $value
- * @param array $params
+ * @param string|array $format either the format as a string, or an array,
+ * where the first element is the format type
* @return mixed
*/
- public function format($value, array $params = []);
? ^^^^^^^^^^^^ ^^
+ public function format($value, $format = null);
? +++++ ^ ^^^^
} | 5 | 0.135135 | 3 | 2 |
84a4ff5b16b0be42c969e7da50c7da7ce22fbe55 | test/bootstrap.php | test/bootstrap.php | <?php
/*
* This file is part of Mustache.php.
*
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require dirname(__FILE__).'/../src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php';
| <?php
/*
* This file is part of Mustache.php.
*
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$loader = require dirname(__FILE__).'/../vendor/autoload.php';
$loader->add('Mustache_Test', dirname(__FILE__));
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php';
| Use Composer autoload for unit tests. | Use Composer autoload for unit tests. | PHP | mit | zuluf/mustache.php,cgvarela/mustache.php,evdevgit/mustache.php,BrunoDeBarros/mustache.php,sophatvathana/mustache.php,ericariyanto/mustache.php,irontec/mustache,bobthecow/mustache.php,thecocce/mustache.php | php | ## Code Before:
<?php
/*
* This file is part of Mustache.php.
*
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require dirname(__FILE__).'/../src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php';
## Instruction:
Use Composer autoload for unit tests.
## Code After:
<?php
/*
* This file is part of Mustache.php.
*
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$loader = require dirname(__FILE__).'/../vendor/autoload.php';
$loader->add('Mustache_Test', dirname(__FILE__));
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php';
| <?php
/*
* This file is part of Mustache.php.
*
* (c) 2010-2014 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
- require dirname(__FILE__).'/../src/Mustache/Autoloader.php';
? ^ - ---- ----- --
+ $loader = require dirname(__FILE__).'/../vendor/autoload.php';
? ++++++++++ ^^^^^
- Mustache_Autoloader::register();
+ $loader->add('Mustache_Test', dirname(__FILE__));
require dirname(__FILE__).'/../vendor/yaml/lib/sfYamlParser.php'; | 4 | 0.266667 | 2 | 2 |
c620b12428fcb99242c7118a9b261b7c84aa8055 | README.md | README.md |
A small library to interact with Kissmetrics that can be shared across a client (browser) and server (Node.js)
## Annotated Source
In place of a more detailed readme, the [annotated source](http://evansolomon.github.com/kissmetrics-js/) is very thorough.
|
A small library to interact with Kissmetrics that can be shared across a client (browser) and server (Node.js)
## Annotated Source
In place of a more detailed readme, the [annotated source](http://evansolomon.github.com/kissmetrics-js/) is very thorough.
## Limitations
Currently there is no support for automatic identifiers for logged out visitors, which is one of the main benefits of Kissmetrics' own JavaScript library. I might add support for it eventually, but it's absent for now. It also won't support (or know anything about) the automatic events you have set in Kissmetrics.
tl;dr -- if you want to record data, it's up to you to figure out what you're recording.
| Add limitations section to readme | Add limitations section to readme | Markdown | mit | evansolomon/kissmetrics-js,evansolomon/kissmetrics-js | markdown | ## Code Before:
A small library to interact with Kissmetrics that can be shared across a client (browser) and server (Node.js)
## Annotated Source
In place of a more detailed readme, the [annotated source](http://evansolomon.github.com/kissmetrics-js/) is very thorough.
## Instruction:
Add limitations section to readme
## Code After:
A small library to interact with Kissmetrics that can be shared across a client (browser) and server (Node.js)
## Annotated Source
In place of a more detailed readme, the [annotated source](http://evansolomon.github.com/kissmetrics-js/) is very thorough.
## Limitations
Currently there is no support for automatic identifiers for logged out visitors, which is one of the main benefits of Kissmetrics' own JavaScript library. I might add support for it eventually, but it's absent for now. It also won't support (or know anything about) the automatic events you have set in Kissmetrics.
tl;dr -- if you want to record data, it's up to you to figure out what you're recording.
|
A small library to interact with Kissmetrics that can be shared across a client (browser) and server (Node.js)
## Annotated Source
In place of a more detailed readme, the [annotated source](http://evansolomon.github.com/kissmetrics-js/) is very thorough.
+
+ ## Limitations
+
+ Currently there is no support for automatic identifiers for logged out visitors, which is one of the main benefits of Kissmetrics' own JavaScript library. I might add support for it eventually, but it's absent for now. It also won't support (or know anything about) the automatic events you have set in Kissmetrics.
+
+ tl;dr -- if you want to record data, it's up to you to figure out what you're recording. | 6 | 1 | 6 | 0 |
3380a40a33b8899777efeebc7d37716b8a3d0e1e | jenkins/basic-docker-build.groovy | jenkins/basic-docker-build.groovy | node {
def built_img = ''
def taggedImageName = ''
stage('Checkout git repo') {
git branch: 'master', url: params.git_repo
}
stage('Build Docker image') {
built_img = docker.build(params.docker_repository + ":${env.BUILD_NUMBER}", '.')
}
stage('Push Docker image to Azure Container Registry') {
docker.withRegistry(params.registry_url, params.registry_credentials_id ) {
taggedImageName = built_img.tag("${env.BUILD_NUMBER}")
built_img.push("${env.BUILD_NUMBER}");
}
}
stage('Deploy configurations to Azure Container Service (AKS)') {
acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
}
} | node {
def built_img = ''
def taggedImageName = ''
stage('Checkout git repo') {
git branch: 'master', url: params.git_repo
}
stage('Build Docker image') {
built_img = docker.build(params.docker_repository + ":${env.BUILD_NUMBER}", '.')
}
stage('Push Docker image to Azure Container Registry') {
docker.withRegistry(params.registry_url, params.registry_credentials_id ) {
taggedImageName = built_img.tag("${env.BUILD_NUMBER}")
built_img.push("${env.BUILD_NUMBER}");
}
}
stage('Deploy configurations to Azure Container Service (AKS)') {
withEnv(['IMAGE_NAME=' + taggedImageName]) {
acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
}
}
} | Update Jenkins pipeline script: add IMAGE_NAME enviroment variable | Update Jenkins pipeline script: add IMAGE_NAME enviroment variable
| Groovy | mit | TylerLu/hello-world,TylerLu/hello-world,TylerLu/hello-world | groovy | ## Code Before:
node {
def built_img = ''
def taggedImageName = ''
stage('Checkout git repo') {
git branch: 'master', url: params.git_repo
}
stage('Build Docker image') {
built_img = docker.build(params.docker_repository + ":${env.BUILD_NUMBER}", '.')
}
stage('Push Docker image to Azure Container Registry') {
docker.withRegistry(params.registry_url, params.registry_credentials_id ) {
taggedImageName = built_img.tag("${env.BUILD_NUMBER}")
built_img.push("${env.BUILD_NUMBER}");
}
}
stage('Deploy configurations to Azure Container Service (AKS)') {
acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
}
}
## Instruction:
Update Jenkins pipeline script: add IMAGE_NAME enviroment variable
## Code After:
node {
def built_img = ''
def taggedImageName = ''
stage('Checkout git repo') {
git branch: 'master', url: params.git_repo
}
stage('Build Docker image') {
built_img = docker.build(params.docker_repository + ":${env.BUILD_NUMBER}", '.')
}
stage('Push Docker image to Azure Container Registry') {
docker.withRegistry(params.registry_url, params.registry_credentials_id ) {
taggedImageName = built_img.tag("${env.BUILD_NUMBER}")
built_img.push("${env.BUILD_NUMBER}");
}
}
stage('Deploy configurations to Azure Container Service (AKS)') {
withEnv(['IMAGE_NAME=' + taggedImageName]) {
acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
}
}
} | node {
def built_img = ''
def taggedImageName = ''
stage('Checkout git repo') {
git branch: 'master', url: params.git_repo
}
stage('Build Docker image') {
built_img = docker.build(params.docker_repository + ":${env.BUILD_NUMBER}", '.')
}
stage('Push Docker image to Azure Container Registry') {
docker.withRegistry(params.registry_url, params.registry_credentials_id ) {
taggedImageName = built_img.tag("${env.BUILD_NUMBER}")
built_img.push("${env.BUILD_NUMBER}");
}
}
stage('Deploy configurations to Azure Container Service (AKS)') {
+ withEnv(['IMAGE_NAME=' + taggedImageName]) {
- acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
+ acsDeploy azureCredentialsId: params.azure_service_principal_id, configFilePaths: 'kubernetes/*.yaml', containerService: params.aks_cluster_name + ' | AKS', dcosDockerCredentialsPath: '', enableConfigSubstitution: true, resourceGroupName: params.aks_resource_group_name, secretName: '', sshCredentialsId: ''
? ++
+ }
}
} | 4 | 0.210526 | 3 | 1 |
b864cd44a0c77cc7c5b76eb03f266e094b2293f5 | path.go | path.go | package main
import (
"os"
"strings"
)
func init() {
home := os.Getenv("HOME")
paths := []string{
home + "/bin",
home + "/.vvmn/vim/current/bin",
"/usr/local/bin",
"/usr/local/opt/coreutils/libexec/gnubin",
}
setPath(paths...)
}
func setPath(args ...string) {
s := os.Getenv("PATH")
paths := strings.Split(s, ":")
var newPaths []string
for _, arg := range args {
for _, path := range paths {
if path != arg {
newPaths = append(newPaths, path)
}
}
}
newPaths = append(args, newPaths...)
os.Setenv("PATH", strings.Join(newPaths, ":"))
}
| package main
import (
"os"
"strings"
)
func init() {
home := os.Getenv("HOME")
paths := []string{
home + "/bin",
home + "/.vvmn/vim/current/bin",
"/usr/local/bin",
"/usr/local/opt/coreutils/libexec/gnubin",
}
setPath(paths...)
}
func setPath(args ...string) {
s := os.Getenv("PATH")
paths := strings.Split(s, ":")
var newPaths []string
for _, path := range paths {
for _, arg := range args {
if path != arg {
newPaths = append(newPaths, path)
}
}
}
newPaths = append(args, newPaths...)
os.Setenv("PATH", strings.Join(newPaths, ":"))
}
| Make setPath set $PATH correctly | Make setPath set $PATH correctly
| Go | mit | elpinal/coco3 | go | ## Code Before:
package main
import (
"os"
"strings"
)
func init() {
home := os.Getenv("HOME")
paths := []string{
home + "/bin",
home + "/.vvmn/vim/current/bin",
"/usr/local/bin",
"/usr/local/opt/coreutils/libexec/gnubin",
}
setPath(paths...)
}
func setPath(args ...string) {
s := os.Getenv("PATH")
paths := strings.Split(s, ":")
var newPaths []string
for _, arg := range args {
for _, path := range paths {
if path != arg {
newPaths = append(newPaths, path)
}
}
}
newPaths = append(args, newPaths...)
os.Setenv("PATH", strings.Join(newPaths, ":"))
}
## Instruction:
Make setPath set $PATH correctly
## Code After:
package main
import (
"os"
"strings"
)
func init() {
home := os.Getenv("HOME")
paths := []string{
home + "/bin",
home + "/.vvmn/vim/current/bin",
"/usr/local/bin",
"/usr/local/opt/coreutils/libexec/gnubin",
}
setPath(paths...)
}
func setPath(args ...string) {
s := os.Getenv("PATH")
paths := strings.Split(s, ":")
var newPaths []string
for _, path := range paths {
for _, arg := range args {
if path != arg {
newPaths = append(newPaths, path)
}
}
}
newPaths = append(args, newPaths...)
os.Setenv("PATH", strings.Join(newPaths, ":"))
}
| package main
import (
"os"
"strings"
)
func init() {
home := os.Getenv("HOME")
paths := []string{
home + "/bin",
home + "/.vvmn/vim/current/bin",
"/usr/local/bin",
"/usr/local/opt/coreutils/libexec/gnubin",
}
setPath(paths...)
}
func setPath(args ...string) {
s := os.Getenv("PATH")
paths := strings.Split(s, ":")
var newPaths []string
- for _, arg := range args {
- for _, path := range paths {
? -
+ for _, path := range paths {
+ for _, arg := range args {
if path != arg {
newPaths = append(newPaths, path)
}
}
}
newPaths = append(args, newPaths...)
os.Setenv("PATH", strings.Join(newPaths, ":"))
} | 4 | 0.125 | 2 | 2 |
573199649c87eb7487e6579569380e7e95fe361f | appveyor.yml | appveyor.yml | version: 0.1.{build}
image: Visual Studio 2017
init:
- cmd: git config --global core.autocrlf true
before_build:
- cmd: dotnet --version
- cmd: dotnet restore src --verbosity m
build_script:
- cmd: dotnet publish src -o out
clone_depth: 1
deploy: off
| version: 0.0.1.{build}
image: Visual Studio 2017
init:
- git config --global core.autocrlf true
dotnet_csproj:
patch: true
file: 'src\**\*.csproj'
version: '{version}'
package_version: '{version}'
before_build:
- dotnet --version
- dotnet restore src --verbosity m
build_script:
- dotnet pack src -c Release
artifacts:
- path: src/**/*.nupkg
name: Nuget Packages
type: NuGetPackage
clone_depth: 1
deploy: off
| Package nugets in Appveyor and expose as artifacts | Package nugets in Appveyor and expose as artifacts
| YAML | mit | tlycken/RdbmsEventStore | yaml | ## Code Before:
version: 0.1.{build}
image: Visual Studio 2017
init:
- cmd: git config --global core.autocrlf true
before_build:
- cmd: dotnet --version
- cmd: dotnet restore src --verbosity m
build_script:
- cmd: dotnet publish src -o out
clone_depth: 1
deploy: off
## Instruction:
Package nugets in Appveyor and expose as artifacts
## Code After:
version: 0.0.1.{build}
image: Visual Studio 2017
init:
- git config --global core.autocrlf true
dotnet_csproj:
patch: true
file: 'src\**\*.csproj'
version: '{version}'
package_version: '{version}'
before_build:
- dotnet --version
- dotnet restore src --verbosity m
build_script:
- dotnet pack src -c Release
artifacts:
- path: src/**/*.nupkg
name: Nuget Packages
type: NuGetPackage
clone_depth: 1
deploy: off
| - version: 0.1.{build}
+ version: 0.0.1.{build}
? ++
image: Visual Studio 2017
init:
- - cmd: git config --global core.autocrlf true
? -----
+ - git config --global core.autocrlf true
+ dotnet_csproj:
+ patch: true
+ file: 'src\**\*.csproj'
+ version: '{version}'
+ package_version: '{version}'
before_build:
- - cmd: dotnet --version
? -----
+ - dotnet --version
- - cmd: dotnet restore src --verbosity m
? -----
+ - dotnet restore src --verbosity m
build_script:
- - cmd: dotnet publish src -o out
+ - dotnet pack src -c Release
+ artifacts:
+ - path: src/**/*.nupkg
+ name: Nuget Packages
+ type: NuGetPackage
clone_depth: 1
deploy: off | 19 | 1.727273 | 14 | 5 |
84948a32aaffe5876ebc6be8a35c52610929a7b5 | .travis.yml | .travis.yml | ---
language: node_js
node_js:
- iojs
cache:
directories:
- bower_components
- node_modules
sudo: false
before_script:
- npm run install
script: npm run build
| ---
language: node_js
node_js:
- stable
- iojs
- iojs-v2
cache:
directories:
- bower_components
- node_modules
sudo: false
script: npm run build
| Test against more node versions. | Test against more node versions.
| YAML | mit | makenew/libsass-package | yaml | ## Code Before:
---
language: node_js
node_js:
- iojs
cache:
directories:
- bower_components
- node_modules
sudo: false
before_script:
- npm run install
script: npm run build
## Instruction:
Test against more node versions.
## Code After:
---
language: node_js
node_js:
- stable
- iojs
- iojs-v2
cache:
directories:
- bower_components
- node_modules
sudo: false
script: npm run build
| ---
language: node_js
node_js:
+ - stable
- iojs
+ - iojs-v2
cache:
directories:
- bower_components
- node_modules
sudo: false
- before_script:
- - npm run install
-
script: npm run build | 5 | 0.357143 | 2 | 3 |
abab68727e519615aa0cf1be0aae5cf56b91b7af | docker-compose.yml | docker-compose.yml | version: "3"
services:
website:
image: openstates/new-openstates.org
volumes:
- .:/opt/openstates/openstates.org/
entrypoint: ['/bin/bash']
| version: "3"
services:
website:
image: openstates/new-openstates.org
volumes:
- .:/opt/openstates/openstates.org/
entrypoint: ['/bin/bash']
database:
# With this service up, your host can use a database URL of
# `postgres://openstates@localhost:5433/openstates`
image: mdillon/postgis:9.6
ports:
# Avoid conflict with the host's Postgres port
- "5433:5432"
environment:
- POSTGRES_DB=openstates
- POSTGRES_USER=openstates
| Add database service to Docker Compose, although don't suggest it in the README yet | Add database service to Docker Compose, although don't suggest it in the README yet
| YAML | mit | openstates/openstates.org,openstates/openstates.org,openstates/openstates.org,openstates/openstates.org | yaml | ## Code Before:
version: "3"
services:
website:
image: openstates/new-openstates.org
volumes:
- .:/opt/openstates/openstates.org/
entrypoint: ['/bin/bash']
## Instruction:
Add database service to Docker Compose, although don't suggest it in the README yet
## Code After:
version: "3"
services:
website:
image: openstates/new-openstates.org
volumes:
- .:/opt/openstates/openstates.org/
entrypoint: ['/bin/bash']
database:
# With this service up, your host can use a database URL of
# `postgres://openstates@localhost:5433/openstates`
image: mdillon/postgis:9.6
ports:
# Avoid conflict with the host's Postgres port
- "5433:5432"
environment:
- POSTGRES_DB=openstates
- POSTGRES_USER=openstates
| version: "3"
services:
website:
image: openstates/new-openstates.org
volumes:
- .:/opt/openstates/openstates.org/
entrypoint: ['/bin/bash']
+
+ database:
+ # With this service up, your host can use a database URL of
+ # `postgres://openstates@localhost:5433/openstates`
+ image: mdillon/postgis:9.6
+ ports:
+ # Avoid conflict with the host's Postgres port
+ - "5433:5432"
+ environment:
+ - POSTGRES_DB=openstates
+ - POSTGRES_USER=openstates | 11 | 1.571429 | 11 | 0 |
2585fbe68c7ed9b5fc709e3e543a1e3e68229705 | app/views/training_modules/index.json.jbuilder | app/views/training_modules/index.json.jbuilder |
json.training_modules do
json.array! @training_modules, :name, :id, :status, :slug
end
json.training_libraries @training_libraries do |library|
json.slug library.slug
json.modules library.categories.collect(&:modules).flatten.map(&:slug)
end
|
json.training_modules do
json.array! @training_modules, :name, :id, :status, :slug
end
json.training_libraries @training_libraries do |library|
json.slug library.slug
json.modules library.categories.pluck('modules').flatten.pluck('slug')
end
| Use pluck instead of collect | Use pluck instead of collect
| Ruby | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ruby | ## Code Before:
json.training_modules do
json.array! @training_modules, :name, :id, :status, :slug
end
json.training_libraries @training_libraries do |library|
json.slug library.slug
json.modules library.categories.collect(&:modules).flatten.map(&:slug)
end
## Instruction:
Use pluck instead of collect
## Code After:
json.training_modules do
json.array! @training_modules, :name, :id, :status, :slug
end
json.training_libraries @training_libraries do |library|
json.slug library.slug
json.modules library.categories.pluck('modules').flatten.pluck('slug')
end
|
json.training_modules do
json.array! @training_modules, :name, :id, :status, :slug
end
json.training_libraries @training_libraries do |library|
json.slug library.slug
- json.modules library.categories.collect(&:modules).flatten.map(&:slug)
? ^^^^^^ ^^ -- ^^
+ json.modules library.categories.pluck('modules').flatten.pluck('slug')
? +++ ^ ^ + ++++ ^ +
end | 2 | 0.222222 | 1 | 1 |
730e1d711e4d55289cc4a6afa18c0dbd80525cb6 | index.js | index.js | var Promise = require('es6-promise').Promise;
var compose = require('static-compose');
module.exports = function (formulas) {
var promises = formulas.map(function(plugins) {
return compose(plugins)([]);
});
return Promise.all(promises);
};
| var Promise = require('es6-promise').Promise;
var compose = require('static-compose');
module.exports = function (formulas) {
if(!Array.isArray(formulas) || arguments.length > 1) {
formulas = [].slice.call(arguments);
}
var promises = formulas.map(function(plugins) {
return compose(plugins)([]);
});
return Promise.all(promises);
};
| Allow for a single array or multiple arguments | Allow for a single array or multiple arguments
| JavaScript | mit | erickmerchant/static-engine | javascript | ## Code Before:
var Promise = require('es6-promise').Promise;
var compose = require('static-compose');
module.exports = function (formulas) {
var promises = formulas.map(function(plugins) {
return compose(plugins)([]);
});
return Promise.all(promises);
};
## Instruction:
Allow for a single array or multiple arguments
## Code After:
var Promise = require('es6-promise').Promise;
var compose = require('static-compose');
module.exports = function (formulas) {
if(!Array.isArray(formulas) || arguments.length > 1) {
formulas = [].slice.call(arguments);
}
var promises = formulas.map(function(plugins) {
return compose(plugins)([]);
});
return Promise.all(promises);
};
| var Promise = require('es6-promise').Promise;
var compose = require('static-compose');
module.exports = function (formulas) {
+
+ if(!Array.isArray(formulas) || arguments.length > 1) {
+
+ formulas = [].slice.call(arguments);
+ }
var promises = formulas.map(function(plugins) {
return compose(plugins)([]);
});
return Promise.all(promises);
}; | 5 | 0.416667 | 5 | 0 |
67337102eaa5b01da1a9ad2c1f6a48290d4ff044 | src/test/java/com/quizdeck/analysis/QuizAnalysisFactoryTest.java | src/test/java/com/quizdeck/analysis/QuizAnalysisFactoryTest.java | package com.quizdeck.analysis;
import com.quizdeck.Application.QuizDeckApplication;
import com.quizdeck.analysis.exceptions.AnalysisException;
import com.quizdeck.analysis.inputs.*;
import com.quizdeck.analysis.outputs.QuizAnalysisData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.LinkedList;
/**
* Test for the QuizAnalysisFactory
*
* @author Alex
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuizDeckApplication.class)
public class QuizAnalysisFactoryTest {
@Test
public void dummyTest() throws AnalysisException {
LinkedList<Question> questions = new LinkedList<>();
questions.add(new MockQuestion(1, new MockSelection('0')));
questions.add(new MockQuestion(2, new MockSelection('1')));
MockMember steve = new MockMember();
LinkedList<Response> responses = new LinkedList<>();
for(int i = 0; i < 50; i++)
responses.add(new MockResponse(steve, new MockSelection(Integer.toString(i).charAt(0)), questions.get(0), i));
QuizAnalysisFactory factory = new QuizAnalysisFactory();
factory.setResponses(responses);
factory.setQuestions(questions);
factory.setQuizID("Q1");
factory.setDeckID("D1");
factory.setOwner(steve);
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
analysis.performAnalysis();
QuizAnalysisData result = (QuizAnalysisData) analysis.getResults();
}
}
| package com.quizdeck.analysis;
import com.quizdeck.Application.QuizDeckApplication;
import com.quizdeck.analysis.exceptions.AnalysisException;
import com.quizdeck.analysis.exceptions.InsufficientDataException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.LinkedList;
/**
* Test for the QuizAnalysisFactory
*
* @author Alex
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuizDeckApplication.class)
public class QuizAnalysisFactoryTest {
@Test(expected = InsufficientDataException.class)
public void insufficientDataTest() throws AnalysisException {
QuizAnalysisFactory factory = new QuizAnalysisFactory();
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
}
@Test
public void constructEmptyAnalysis() throws AnalysisException {
QuizAnalysisFactory factory = new QuizAnalysisFactory();
factory.setOwner(new MockMember());
factory.setDeckID("DeckID");
factory.setQuizID("QuizID");
factory.setQuestions(new LinkedList<>());
factory.setResponses(new LinkedList<>());
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
}
}
| Make QuizAnalysisFactory unit tests more specific. | Make QuizAnalysisFactory unit tests more specific.
| Java | mit | bcroden/QuizDeck-Server | java | ## Code Before:
package com.quizdeck.analysis;
import com.quizdeck.Application.QuizDeckApplication;
import com.quizdeck.analysis.exceptions.AnalysisException;
import com.quizdeck.analysis.inputs.*;
import com.quizdeck.analysis.outputs.QuizAnalysisData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.LinkedList;
/**
* Test for the QuizAnalysisFactory
*
* @author Alex
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuizDeckApplication.class)
public class QuizAnalysisFactoryTest {
@Test
public void dummyTest() throws AnalysisException {
LinkedList<Question> questions = new LinkedList<>();
questions.add(new MockQuestion(1, new MockSelection('0')));
questions.add(new MockQuestion(2, new MockSelection('1')));
MockMember steve = new MockMember();
LinkedList<Response> responses = new LinkedList<>();
for(int i = 0; i < 50; i++)
responses.add(new MockResponse(steve, new MockSelection(Integer.toString(i).charAt(0)), questions.get(0), i));
QuizAnalysisFactory factory = new QuizAnalysisFactory();
factory.setResponses(responses);
factory.setQuestions(questions);
factory.setQuizID("Q1");
factory.setDeckID("D1");
factory.setOwner(steve);
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
analysis.performAnalysis();
QuizAnalysisData result = (QuizAnalysisData) analysis.getResults();
}
}
## Instruction:
Make QuizAnalysisFactory unit tests more specific.
## Code After:
package com.quizdeck.analysis;
import com.quizdeck.Application.QuizDeckApplication;
import com.quizdeck.analysis.exceptions.AnalysisException;
import com.quizdeck.analysis.exceptions.InsufficientDataException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.LinkedList;
/**
* Test for the QuizAnalysisFactory
*
* @author Alex
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuizDeckApplication.class)
public class QuizAnalysisFactoryTest {
@Test(expected = InsufficientDataException.class)
public void insufficientDataTest() throws AnalysisException {
QuizAnalysisFactory factory = new QuizAnalysisFactory();
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
}
@Test
public void constructEmptyAnalysis() throws AnalysisException {
QuizAnalysisFactory factory = new QuizAnalysisFactory();
factory.setOwner(new MockMember());
factory.setDeckID("DeckID");
factory.setQuizID("QuizID");
factory.setQuestions(new LinkedList<>());
factory.setResponses(new LinkedList<>());
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
}
}
| package com.quizdeck.analysis;
import com.quizdeck.Application.QuizDeckApplication;
import com.quizdeck.analysis.exceptions.AnalysisException;
+ import com.quizdeck.analysis.exceptions.InsufficientDataException;
- import com.quizdeck.analysis.inputs.*;
- import com.quizdeck.analysis.outputs.QuizAnalysisData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.LinkedList;
/**
* Test for the QuizAnalysisFactory
*
* @author Alex
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = QuizDeckApplication.class)
public class QuizAnalysisFactoryTest {
+ @Test(expected = InsufficientDataException.class)
+ public void insufficientDataTest() throws AnalysisException {
+ QuizAnalysisFactory factory = new QuizAnalysisFactory();
+ StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
+ }
+
@Test
- public void dummyTest() throws AnalysisException {
? ^^^^^^^
+ public void constructEmptyAnalysis() throws AnalysisException {
? ^^^ +++++++++++++++++
- LinkedList<Question> questions = new LinkedList<>();
- questions.add(new MockQuestion(1, new MockSelection('0')));
- questions.add(new MockQuestion(2, new MockSelection('1')));
-
-
- MockMember steve = new MockMember();
- LinkedList<Response> responses = new LinkedList<>();
- for(int i = 0; i < 50; i++)
- responses.add(new MockResponse(steve, new MockSelection(Integer.toString(i).charAt(0)), questions.get(0), i));
-
QuizAnalysisFactory factory = new QuizAnalysisFactory();
+ factory.setOwner(new MockMember());
- factory.setResponses(responses);
- factory.setQuestions(questions);
- factory.setQuizID("Q1");
- factory.setDeckID("D1");
? ^
+ factory.setDeckID("DeckID");
? ^^^^^
- factory.setOwner(steve);
+ factory.setQuizID("QuizID");
+ factory.setQuestions(new LinkedList<>());
+ factory.setResponses(new LinkedList<>());
StaticAnalysis analysis = (StaticAnalysis) factory.getAnalysisUsing(QuizAlgorithm.ACCURACY);
- analysis.performAnalysis();
- QuizAnalysisData result = (QuizAnalysisData) analysis.getResults();
}
}
| 33 | 0.733333 | 13 | 20 |
15ed94891a088ce43f6e249e1b9c5442067727d1 | apps/about/components/education_examples/index.jade | apps/about/components/education_examples/index.jade | .AboutPosts.PageNarrowBreakout
a.AboutPost( href='https://www.are.na/lucy-siyao-liu/orthographies' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/1289511/large_e9633fb2e60304030f3bb831b30450b1.jpg")'
)
h3.Type
strong Orthographies
p.Type
| A fall 2017 course taught by Lucy Siyao Liu in MIT’s Arts, Culture, and Technology program. Exercises, projects, and references are all clearly organized into channels within the class channel.
a.AboutPost( href='https://www.are.na/sfpc-arena/channels')
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/785357/large_a9b4ce77bf21d4fc76bb197462d7fdd9")'
)
h3.Type
strong SFPC
p.Type
| SFPC is an artist-run school in New York that explores intersections of code, design, hardware and theory. The school maintains channels for all kinds of information and resources.
a.AboutPost( href='https://www.are.na/chris-collins/uic-nma-topics-in-new-media' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/438461/original_ed30ed66ea2e2fd780618bf4415aa9ee.gif")'
)
h3.Type
strong Topics in New Media
p.Type
| This was a fall 2015 course taught by Chris Collins at the University of Illinois, Chicago. This channel is an informal site where students all shared links relevant to their coursework. | .AboutPosts.PageNarrowBreakout
a.AboutPost( href='https://www.are.na/lucy-siyao-liu/orthographies' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/1289511/large_e9633fb2e60304030f3bb831b30450b1.jpg")'
)
h3.Type
strong Orthographies
p.Type
| A fall 2017 course taught by Lucy Siyao Liu in the Art, Culture Technology Program (ACT) at MIT. Exercises, projects, and references are all clearly organized into channels within the class channel. | Remove uncofirmed examples for now | Remove uncofirmed examples for now
| Jade | mit | aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell | jade | ## Code Before:
.AboutPosts.PageNarrowBreakout
a.AboutPost( href='https://www.are.na/lucy-siyao-liu/orthographies' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/1289511/large_e9633fb2e60304030f3bb831b30450b1.jpg")'
)
h3.Type
strong Orthographies
p.Type
| A fall 2017 course taught by Lucy Siyao Liu in MIT’s Arts, Culture, and Technology program. Exercises, projects, and references are all clearly organized into channels within the class channel.
a.AboutPost( href='https://www.are.na/sfpc-arena/channels')
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/785357/large_a9b4ce77bf21d4fc76bb197462d7fdd9")'
)
h3.Type
strong SFPC
p.Type
| SFPC is an artist-run school in New York that explores intersections of code, design, hardware and theory. The school maintains channels for all kinds of information and resources.
a.AboutPost( href='https://www.are.na/chris-collins/uic-nma-topics-in-new-media' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/438461/original_ed30ed66ea2e2fd780618bf4415aa9ee.gif")'
)
h3.Type
strong Topics in New Media
p.Type
| This was a fall 2015 course taught by Chris Collins at the University of Illinois, Chicago. This channel is an informal site where students all shared links relevant to their coursework.
## Instruction:
Remove uncofirmed examples for now
## Code After:
.AboutPosts.PageNarrowBreakout
a.AboutPost( href='https://www.are.na/lucy-siyao-liu/orthographies' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/1289511/large_e9633fb2e60304030f3bb831b30450b1.jpg")'
)
h3.Type
strong Orthographies
p.Type
| A fall 2017 course taught by Lucy Siyao Liu in the Art, Culture Technology Program (ACT) at MIT. Exercises, projects, and references are all clearly organized into channels within the class channel. | .AboutPosts.PageNarrowBreakout
a.AboutPost( href='https://www.are.na/lucy-siyao-liu/orthographies' )
.AboutPost__cover(
style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/1289511/large_e9633fb2e60304030f3bb831b30450b1.jpg")'
)
h3.Type
strong Orthographies
p.Type
- | A fall 2017 course taught by Lucy Siyao Liu in MIT’s Arts, Culture, and Technology program. Exercises, projects, and references are all clearly organized into channels within the class channel.
? ----------------------------------------
+ | A fall 2017 course taught by Lucy Siyao Liu in the Art, Culture Technology Program (ACT) at MIT. Exercises, projects, and references are all clearly organized into channels within the class channel.
? +++++++++++++++++++++++++++++++++++++++++++++
-
- a.AboutPost( href='https://www.are.na/sfpc-arena/channels')
- .AboutPost__cover(
- style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/785357/large_a9b4ce77bf21d4fc76bb197462d7fdd9")'
- )
- h3.Type
- strong SFPC
-
- p.Type
- | SFPC is an artist-run school in New York that explores intersections of code, design, hardware and theory. The school maintains channels for all kinds of information and resources.
-
- a.AboutPost( href='https://www.are.na/chris-collins/uic-nma-topics-in-new-media' )
- .AboutPost__cover(
- style='background-image: url("https://d2w9rnfcy7mm78.cloudfront.net/438461/original_ed30ed66ea2e2fd780618bf4415aa9ee.gif")'
- )
- h3.Type
- strong Topics in New Media
-
- p.Type
- | This was a fall 2015 course taught by Chris Collins at the University of Illinois, Chicago. This channel is an informal site where students all shared links relevant to their coursework. | 22 | 0.733333 | 1 | 21 |
a6061ef140e371101c3d04c5b85562586293eee8 | scrappyr/scraps/tests/test_models.py | scrappyr/scraps/tests/test_models.py | from test_plus.test import TestCase
from ..models import Scrap
class TestScrap(TestCase):
def test__str__(self):
scrap = Scrap(raw_title='hello')
assert str(scrap) == 'hello'
def test_html_title(self):
scrap = Scrap(raw_title='hello')
assert scrap.html_title == 'hello'
def test_html_title_bold(self):
scrap = Scrap(raw_title='**hello**')
assert scrap.html_title == '<strong>hello</strong>'
| from test_plus.test import TestCase
from ..models import Scrap
class TestScrap(TestCase):
def test__str__(self):
scrap = Scrap(raw_title='hello')
assert str(scrap) == 'hello'
def test_html_title(self):
scrap = Scrap(raw_title='hello')
assert scrap.html_title == 'hello'
def test_html_title_bold(self):
scrap = Scrap(raw_title='**hello**')
assert scrap.html_title == '<strong>hello</strong>'
def test_html_title_with_block_element_gets_escaped(self):
scrap = Scrap(raw_title='<div>hello</div>')
assert scrap.html_title == '<div>hello</div>'
| Add test of block-elements in scrap title | Add test of block-elements in scrap title
| Python | mit | tonysyu/scrappyr-app,tonysyu/scrappyr-app,tonysyu/scrappyr-app,tonysyu/scrappyr-app | python | ## Code Before:
from test_plus.test import TestCase
from ..models import Scrap
class TestScrap(TestCase):
def test__str__(self):
scrap = Scrap(raw_title='hello')
assert str(scrap) == 'hello'
def test_html_title(self):
scrap = Scrap(raw_title='hello')
assert scrap.html_title == 'hello'
def test_html_title_bold(self):
scrap = Scrap(raw_title='**hello**')
assert scrap.html_title == '<strong>hello</strong>'
## Instruction:
Add test of block-elements in scrap title
## Code After:
from test_plus.test import TestCase
from ..models import Scrap
class TestScrap(TestCase):
def test__str__(self):
scrap = Scrap(raw_title='hello')
assert str(scrap) == 'hello'
def test_html_title(self):
scrap = Scrap(raw_title='hello')
assert scrap.html_title == 'hello'
def test_html_title_bold(self):
scrap = Scrap(raw_title='**hello**')
assert scrap.html_title == '<strong>hello</strong>'
def test_html_title_with_block_element_gets_escaped(self):
scrap = Scrap(raw_title='<div>hello</div>')
assert scrap.html_title == '<div>hello</div>'
| from test_plus.test import TestCase
from ..models import Scrap
class TestScrap(TestCase):
def test__str__(self):
scrap = Scrap(raw_title='hello')
assert str(scrap) == 'hello'
def test_html_title(self):
scrap = Scrap(raw_title='hello')
assert scrap.html_title == 'hello'
def test_html_title_bold(self):
scrap = Scrap(raw_title='**hello**')
assert scrap.html_title == '<strong>hello</strong>'
+
+ def test_html_title_with_block_element_gets_escaped(self):
+ scrap = Scrap(raw_title='<div>hello</div>')
+ assert scrap.html_title == '<div>hello</div>' | 4 | 0.222222 | 4 | 0 |
70845d42f79a95da517fe8bbc7692b3b2f96c1bf | app/controllers/schools_controller.rb | app/controllers/schools_controller.rb | class SchoolsController < ApplicationController
def index
end
def search
# @results = PgSearch.multisearch(params["search"])
@results = School.search_schools(params["search"])
end
def random40
@json = Array.new
20.times do
offset = rand(School.count)
rand_record = School.offset(offset).first
@json << {
dbn: rand_record.dbn,
school: rand_record.school,
total_enrollment: rand_record.total_enrollment,
amount_owed: rand_record.amount_owed
}
end
respond_to do |format|
format.html
format.json { render json: @json }
end
end
end
| class SchoolsController < ApplicationController
def index
end
def search
@results = School.search_schools(params["search"])
end
def random40
@json = Array.new
20.times do
offset = rand(School.count)
rand_record = School.offset(offset).first
@json << {
dbn: rand_record.dbn,
school: rand_record.school,
total_enrollment: rand_record.total_enrollment,
amount_owed: rand_record.amount_owed
}
end
respond_to do |format|
format.html
format.json { render json: @json }
end
end
end
| Remove commented out code in search method | Remove commented out code in search method
| Ruby | mit | fma2/cfe-money,fma2/cfe-money,fma2/cfe-money | ruby | ## Code Before:
class SchoolsController < ApplicationController
def index
end
def search
# @results = PgSearch.multisearch(params["search"])
@results = School.search_schools(params["search"])
end
def random40
@json = Array.new
20.times do
offset = rand(School.count)
rand_record = School.offset(offset).first
@json << {
dbn: rand_record.dbn,
school: rand_record.school,
total_enrollment: rand_record.total_enrollment,
amount_owed: rand_record.amount_owed
}
end
respond_to do |format|
format.html
format.json { render json: @json }
end
end
end
## Instruction:
Remove commented out code in search method
## Code After:
class SchoolsController < ApplicationController
def index
end
def search
@results = School.search_schools(params["search"])
end
def random40
@json = Array.new
20.times do
offset = rand(School.count)
rand_record = School.offset(offset).first
@json << {
dbn: rand_record.dbn,
school: rand_record.school,
total_enrollment: rand_record.total_enrollment,
amount_owed: rand_record.amount_owed
}
end
respond_to do |format|
format.html
format.json { render json: @json }
end
end
end
| class SchoolsController < ApplicationController
def index
end
def search
- # @results = PgSearch.multisearch(params["search"])
@results = School.search_schools(params["search"])
end
def random40
@json = Array.new
20.times do
offset = rand(School.count)
rand_record = School.offset(offset).first
@json << {
dbn: rand_record.dbn,
school: rand_record.school,
total_enrollment: rand_record.total_enrollment,
amount_owed: rand_record.amount_owed
}
end
respond_to do |format|
format.html
format.json { render json: @json }
end
end
end | 1 | 0.034483 | 0 | 1 |
7d1463fc732cdc6aef3299c6d2bbe916418e6d6e | hkisaml/api.py | hkisaml/api.py | from django.contrib.auth.models import User
from rest_framework import permissions, routers, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_representation(obj)
if hasattr(obj, 'profile'):
ret['department_name'] = obj.profile.department_name
return ret
class Meta:
fields = [
'last_login', 'username', 'email', 'date_joined',
'first_name', 'last_name'
]
model = User
# ViewSets define the view behavior.
class UserView(generics.RetrieveAPIView,
mixins.RetrieveModelMixin):
def get_queryset(self):
user = self.request.user
if user.is_superuser:
return self.queryset
else:
return self.queryset.filter(id=user.id)
def get_object(self):
username = self.kwargs.get('username', None)
if username:
qs = self.get_queryset()
obj = generics.get_object_or_404(qs, username=username)
else:
obj = self.request.user
return obj
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = User.objects.all()
serializer_class = UserSerializer
#router = routers.DefaultRouter()
#router.register(r'users', UserViewSet)
| from django.contrib.auth.models import User
from rest_framework import permissions, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_representation(obj)
if hasattr(obj, 'profile'):
ret['department_name'] = obj.profile.department_name
if obj.first_name and obj.last_name:
ret['full_name'] = '%s %s' % (obj.first_name, obj.last_name)
return ret
class Meta:
fields = [
'last_login', 'username', 'email', 'date_joined',
'first_name', 'last_name'
]
model = User
# ViewSets define the view behavior.
class UserView(generics.RetrieveAPIView,
mixins.RetrieveModelMixin):
def get_queryset(self):
user = self.request.user
if user.is_superuser:
return self.queryset
else:
return self.queryset.filter(id=user.id)
def get_object(self):
username = self.kwargs.get('username', None)
if username:
qs = self.get_queryset()
obj = generics.get_object_or_404(qs, username=username)
else:
obj = self.request.user
return obj
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = User.objects.all()
serializer_class = UserSerializer
#router = routers.DefaultRouter()
#router.register(r'users', UserViewSet)
| Add full_name field to API | Add full_name field to API
| Python | mit | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | python | ## Code Before:
from django.contrib.auth.models import User
from rest_framework import permissions, routers, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_representation(obj)
if hasattr(obj, 'profile'):
ret['department_name'] = obj.profile.department_name
return ret
class Meta:
fields = [
'last_login', 'username', 'email', 'date_joined',
'first_name', 'last_name'
]
model = User
# ViewSets define the view behavior.
class UserView(generics.RetrieveAPIView,
mixins.RetrieveModelMixin):
def get_queryset(self):
user = self.request.user
if user.is_superuser:
return self.queryset
else:
return self.queryset.filter(id=user.id)
def get_object(self):
username = self.kwargs.get('username', None)
if username:
qs = self.get_queryset()
obj = generics.get_object_or_404(qs, username=username)
else:
obj = self.request.user
return obj
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = User.objects.all()
serializer_class = UserSerializer
#router = routers.DefaultRouter()
#router.register(r'users', UserViewSet)
## Instruction:
Add full_name field to API
## Code After:
from django.contrib.auth.models import User
from rest_framework import permissions, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_representation(obj)
if hasattr(obj, 'profile'):
ret['department_name'] = obj.profile.department_name
if obj.first_name and obj.last_name:
ret['full_name'] = '%s %s' % (obj.first_name, obj.last_name)
return ret
class Meta:
fields = [
'last_login', 'username', 'email', 'date_joined',
'first_name', 'last_name'
]
model = User
# ViewSets define the view behavior.
class UserView(generics.RetrieveAPIView,
mixins.RetrieveModelMixin):
def get_queryset(self):
user = self.request.user
if user.is_superuser:
return self.queryset
else:
return self.queryset.filter(id=user.id)
def get_object(self):
username = self.kwargs.get('username', None)
if username:
qs = self.get_queryset()
obj = generics.get_object_or_404(qs, username=username)
else:
obj = self.request.user
return obj
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = User.objects.all()
serializer_class = UserSerializer
#router = routers.DefaultRouter()
#router.register(r'users', UserViewSet)
| from django.contrib.auth.models import User
- from rest_framework import permissions, routers, serializers, generics, mixins
? ---------
+ from rest_framework import permissions, serializers, generics, mixins
from oauth2_provider.ext.rest_framework import TokenHasReadWriteScope
class UserSerializer(serializers.ModelSerializer):
def to_representation(self, obj):
ret = super(UserSerializer, self).to_representation(obj)
if hasattr(obj, 'profile'):
ret['department_name'] = obj.profile.department_name
+ if obj.first_name and obj.last_name:
+ ret['full_name'] = '%s %s' % (obj.first_name, obj.last_name)
return ret
class Meta:
fields = [
'last_login', 'username', 'email', 'date_joined',
'first_name', 'last_name'
]
model = User
# ViewSets define the view behavior.
class UserView(generics.RetrieveAPIView,
mixins.RetrieveModelMixin):
def get_queryset(self):
user = self.request.user
if user.is_superuser:
return self.queryset
else:
return self.queryset.filter(id=user.id)
def get_object(self):
username = self.kwargs.get('username', None)
if username:
qs = self.get_queryset()
obj = generics.get_object_or_404(qs, username=username)
else:
obj = self.request.user
return obj
permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope]
queryset = User.objects.all()
serializer_class = UserSerializer
#router = routers.DefaultRouter()
#router.register(r'users', UserViewSet) | 4 | 0.086957 | 3 | 1 |
e922d5cad411e9f5b8469e8e8439ca4f4318d457 | GitHub-Tool.package/GitHubLogBrowser.class/instance/initializeWidgets.st | GitHub-Tool.package/GitHubLogBrowser.class/instance/initializeWidgets.st | initialization
initializeWidgets
log := self newTree.
diff := self instantiate: DiffModel.
info := self newText. | initialization
initializeWidgets
log := self newTree.
diff := (self instantiate: DiffModel)
showOptions: false;
yourself.
info := self newText. | Disable \"pretty print\" option of diff in GitHubLogBrowser | Disable \"pretty print\" option of diff in GitHubLogBrowser
| Smalltalk | mit | Balletie/GitHub | smalltalk | ## Code Before:
initialization
initializeWidgets
log := self newTree.
diff := self instantiate: DiffModel.
info := self newText.
## Instruction:
Disable \"pretty print\" option of diff in GitHubLogBrowser
## Code After:
initialization
initializeWidgets
log := self newTree.
diff := (self instantiate: DiffModel)
showOptions: false;
yourself.
info := self newText. | initialization
initializeWidgets
log := self newTree.
- diff := self instantiate: DiffModel.
? ^
+ diff := (self instantiate: DiffModel)
? + ^
+ showOptions: false;
+ yourself.
info := self newText. | 4 | 0.666667 | 3 | 1 |
d230af881cb4824829d541378a0ebaf4ef0a94a6 | Resolver.php | Resolver.php | <?php
namespace Gl3n\SerializationGroupBundle;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Resolves groups and permissions
*/
class Resolver
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* @var array
*/
private $groups;
/**
* Constructor
*
* @param AuthorizationCheckerInterface $authorizationChecker
* @param array $groups
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, array $groups)
{
$this->authorizationChecker = $authorizationChecker;
$this->groups = $groups;
}
/**
* Resolves group
*
* @param string $groupName
*
* @return array An array of group names
*/
public function resolve($groupName)
{
$groupNames = [$groupName];
if (isset($this->groups[$groupName])) {
if (!$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
throw new AccessDeniedException(
sprintf('User has not the required role to use "%s" serialization group', $groupName)
);
}
foreach ($this->groups[$groupName]['include'] as $includedGroupName) {
$groupNames = array_merge($groupNames, $this->resolve($includedGroupName));
}
}
return $groupNames;
}
} | <?php
namespace Gl3n\SerializationGroupBundle;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Resolves groups and permissions
*/
class Resolver
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* @var array
*/
private $groups;
/**
* Constructor
*
* @param AuthorizationCheckerInterface $authorizationChecker
* @param array $groups
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, array $groups)
{
$this->authorizationChecker = $authorizationChecker;
$this->groups = $groups;
}
/**
* Resolves group
*
* @param string $groupName
*
* @return array An array of group names
*/
public function resolve($groupName)
{
$groupNames = [$groupName];
if (isset($this->groups[$groupName])) {
if (0 < count($this->groups[$groupName]['roles']) && !$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
throw new AccessDeniedException(
sprintf('User has not the required role to use "%s" serialization group', $groupName)
);
}
foreach ($this->groups[$groupName]['include'] as $includedGroupName) {
$groupNames = array_merge($groupNames, $this->resolve($includedGroupName));
}
}
return $groupNames;
}
} | Fix authorisation checking when 'roles' is empty | Fix authorisation checking when 'roles' is empty
| PHP | mit | gl3n/SerializationGroupBundle | php | ## Code Before:
<?php
namespace Gl3n\SerializationGroupBundle;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Resolves groups and permissions
*/
class Resolver
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* @var array
*/
private $groups;
/**
* Constructor
*
* @param AuthorizationCheckerInterface $authorizationChecker
* @param array $groups
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, array $groups)
{
$this->authorizationChecker = $authorizationChecker;
$this->groups = $groups;
}
/**
* Resolves group
*
* @param string $groupName
*
* @return array An array of group names
*/
public function resolve($groupName)
{
$groupNames = [$groupName];
if (isset($this->groups[$groupName])) {
if (!$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
throw new AccessDeniedException(
sprintf('User has not the required role to use "%s" serialization group', $groupName)
);
}
foreach ($this->groups[$groupName]['include'] as $includedGroupName) {
$groupNames = array_merge($groupNames, $this->resolve($includedGroupName));
}
}
return $groupNames;
}
}
## Instruction:
Fix authorisation checking when 'roles' is empty
## Code After:
<?php
namespace Gl3n\SerializationGroupBundle;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Resolves groups and permissions
*/
class Resolver
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* @var array
*/
private $groups;
/**
* Constructor
*
* @param AuthorizationCheckerInterface $authorizationChecker
* @param array $groups
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, array $groups)
{
$this->authorizationChecker = $authorizationChecker;
$this->groups = $groups;
}
/**
* Resolves group
*
* @param string $groupName
*
* @return array An array of group names
*/
public function resolve($groupName)
{
$groupNames = [$groupName];
if (isset($this->groups[$groupName])) {
if (0 < count($this->groups[$groupName]['roles']) && !$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
throw new AccessDeniedException(
sprintf('User has not the required role to use "%s" serialization group', $groupName)
);
}
foreach ($this->groups[$groupName]['include'] as $includedGroupName) {
$groupNames = array_merge($groupNames, $this->resolve($includedGroupName));
}
}
return $groupNames;
}
} | <?php
namespace Gl3n\SerializationGroupBundle;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* Resolves groups and permissions
*/
class Resolver
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
/**
* @var array
*/
private $groups;
/**
* Constructor
*
* @param AuthorizationCheckerInterface $authorizationChecker
* @param array $groups
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, array $groups)
{
$this->authorizationChecker = $authorizationChecker;
$this->groups = $groups;
}
/**
* Resolves group
*
* @param string $groupName
*
* @return array An array of group names
*/
public function resolve($groupName)
{
$groupNames = [$groupName];
if (isset($this->groups[$groupName])) {
- if (!$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
+ if (0 < count($this->groups[$groupName]['roles']) && !$this->authorizationChecker->isGranted($this->groups[$groupName]['roles'])) {
? +++++++++++++++++++++++++++++++++++++++++++++++++
throw new AccessDeniedException(
sprintf('User has not the required role to use "%s" serialization group', $groupName)
);
}
foreach ($this->groups[$groupName]['include'] as $includedGroupName) {
$groupNames = array_merge($groupNames, $this->resolve($includedGroupName));
}
}
return $groupNames;
}
} | 2 | 0.033898 | 1 | 1 |
cde484f90a699e302ac77b6baa70f4b8f19786de | lib/postmark/message_extensions/shared.rb | lib/postmark/message_extensions/shared.rb | module Postmark
module SharedMessageExtensions
def self.included(klass)
klass.instance_eval do
attr_accessor :delivered, :postmark_response
end
end
def delivered?
self.delivered
end
def tag
self['TAG']
end
def tag=(value)
self['TAG'] = value
end
def postmark_attachments=(value)
Kernel.warn("Mail::Message#postmark_attachments= is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments = wrap_in_array(value)
end
def postmark_attachments
return [] if @_attachments.nil?
Kernel.warn("Mail::Message#postmark_attachments is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments.map do |item|
if item.is_a?(Hash)
item
elsif item.is_a?(File)
{
"Name" => item.path.split("/")[-1],
"Content" => pack_attachment_data(IO.read(item.path)),
"ContentType" => "application/octet-stream"
}
end
end
end
protected
def pack_attachment_data(data)
[data].pack('m')
end
# From ActiveSupport (Array#wrap)
def wrap_in_array(object)
if object.nil?
[]
elsif object.respond_to?(:to_ary)
object.to_ary || [object]
else
[object]
end
end
end
end
| module Postmark
module SharedMessageExtensions
def self.included(klass)
klass.instance_eval do
attr_accessor :delivered, :postmark_response
end
end
def delivered?
self.delivered
end
def tag
self['TAG']
end
def tag=(value)
self['TAG'] = value
end
def postmark_attachments=(value)
Kernel.warn("Mail::Message#postmark_attachments= is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments = value
end
def postmark_attachments
return [] if @_attachments.nil?
Kernel.warn("Mail::Message#postmark_attachments is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
Postmark::MessageHelper.attachments_to_postmark(@_attachments)
end
protected
def pack_attachment_data(data)
MessageHelper.encode_in_base64(data)
end
end
end
| Use Postmark::MessageHelper in Postmark::SharedMessageExtensions to avoid duplication of code. | Use Postmark::MessageHelper in Postmark::SharedMessageExtensions to avoid duplication of code.
| Ruby | mit | temochka/postmark-gem,wildbit/postmark-gem | ruby | ## Code Before:
module Postmark
module SharedMessageExtensions
def self.included(klass)
klass.instance_eval do
attr_accessor :delivered, :postmark_response
end
end
def delivered?
self.delivered
end
def tag
self['TAG']
end
def tag=(value)
self['TAG'] = value
end
def postmark_attachments=(value)
Kernel.warn("Mail::Message#postmark_attachments= is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments = wrap_in_array(value)
end
def postmark_attachments
return [] if @_attachments.nil?
Kernel.warn("Mail::Message#postmark_attachments is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments.map do |item|
if item.is_a?(Hash)
item
elsif item.is_a?(File)
{
"Name" => item.path.split("/")[-1],
"Content" => pack_attachment_data(IO.read(item.path)),
"ContentType" => "application/octet-stream"
}
end
end
end
protected
def pack_attachment_data(data)
[data].pack('m')
end
# From ActiveSupport (Array#wrap)
def wrap_in_array(object)
if object.nil?
[]
elsif object.respond_to?(:to_ary)
object.to_ary || [object]
else
[object]
end
end
end
end
## Instruction:
Use Postmark::MessageHelper in Postmark::SharedMessageExtensions to avoid duplication of code.
## Code After:
module Postmark
module SharedMessageExtensions
def self.included(klass)
klass.instance_eval do
attr_accessor :delivered, :postmark_response
end
end
def delivered?
self.delivered
end
def tag
self['TAG']
end
def tag=(value)
self['TAG'] = value
end
def postmark_attachments=(value)
Kernel.warn("Mail::Message#postmark_attachments= is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
@_attachments = value
end
def postmark_attachments
return [] if @_attachments.nil?
Kernel.warn("Mail::Message#postmark_attachments is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
Postmark::MessageHelper.attachments_to_postmark(@_attachments)
end
protected
def pack_attachment_data(data)
MessageHelper.encode_in_base64(data)
end
end
end
| module Postmark
module SharedMessageExtensions
def self.included(klass)
klass.instance_eval do
attr_accessor :delivered, :postmark_response
end
end
def delivered?
self.delivered
end
def tag
self['TAG']
end
def tag=(value)
self['TAG'] = value
end
def postmark_attachments=(value)
Kernel.warn("Mail::Message#postmark_attachments= is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
- @_attachments = wrap_in_array(value)
? -------------- -
+ @_attachments = value
end
def postmark_attachments
return [] if @_attachments.nil?
Kernel.warn("Mail::Message#postmark_attachments is deprecated and will " \
"be removed in the future. Please consider using the native " \
"attachments API provided by Mail library.")
+ Postmark::MessageHelper.attachments_to_postmark(@_attachments)
- @_attachments.map do |item|
- if item.is_a?(Hash)
- item
- elsif item.is_a?(File)
- {
- "Name" => item.path.split("/")[-1],
- "Content" => pack_attachment_data(IO.read(item.path)),
- "ContentType" => "application/octet-stream"
- }
- end
- end
end
protected
def pack_attachment_data(data)
+ MessageHelper.encode_in_base64(data)
- [data].pack('m')
- end
-
- # From ActiveSupport (Array#wrap)
- def wrap_in_array(object)
- if object.nil?
- []
- elsif object.respond_to?(:to_ary)
- object.to_ary || [object]
- else
- [object]
- end
end
end
end | 27 | 0.409091 | 3 | 24 |
eff5d1f14f3edeb57427e3a2b91646b7bf008d11 | serviceworker.js | serviceworker.js | importScripts('serviceworker-cache-polyfill.js');
// TODO: cache figures and other external resources on install
self.onfetch = function(event) {
var fetchRequest = event.request.clone();
event.respondWith(fetch(fetchRequest).then(function (response) {
caches.open('responses').then(function (cache) {
cache.put(fetchRequest, response.clone());
});
return response;
}, function () {
return caches.match(event.request).then(function (response) {
return response;
});
}));
};
| importScripts('serviceworker-cache-polyfill.js');
self.addEventListener('activate', function(event) {
console.log('activated');
// clear everything from the cache
/*event.waitUntil(
caches.keys().then(function(keyList) {
return Promise.all(keyList.map(function(key) {
return caches.delete(key);
}));
})
);*/
var addToCache = function(cache, url) {
console.log('caching ' + url);
//caches.match(url).catch(function() {
fetch(url).then(function(response) {
cache.put(url, response);
});
//});
};
fetch('index.json').then(function(response) {
response.json().then(function(data) {
caches.open('require').then(function (cache) {
data.require.forEach(function(item) {
addToCache(cache, item);
});
});
caches.open('figures').then(function (cache) {
data.figures.forEach(function(item) {
if (item.image) {
addToCache(cache, item.image);
}
});
});
});
});
});
self.addEventListener('fetch', function(event) {
var fetchRequest = event.request;
var returnFetchOrCached = function(response) {
return response || fetch(fetchRequest);
};
var response = caches.match(event.request.url).then(returnFetchOrCached);
event.respondWith(response);
});
| Update ServiceWorker to only fetch specific files | Update ServiceWorker to only fetch specific files
| JavaScript | mit | kikuito/paper-now,abremges/paper-now,hubgit/allen-insula,katrinleinweber/paper-now,cjleonard/paper-now,abremges/paper-now,PedroJSilva/paper-now,KBMD/paper-now-test,PeerJ/paper-now,opexxx/paper-now,boyercb/Generalized-Linear-Models-Final,KBMD/paper-now-test,DimEvil/paper-now2,nate-d-olson/genomic_purity_pub,kliemann/paper-now,PeerJ/paper-now,pjacobetty/papertest,opexxx/paper-now,refgenomics/bacillus-anthracis-panel,zach-nelson/atto,cjleonard/paper-now,DimEvil/paper-now2,katrinleinweber/paper-now,Read-Lab-Confederation/nyc-subway-anthrax-study,abremges/paper-now,kikuito/paper-now,zach-nelson/atto,opexxx/paper-now,DimEvil/paper-now2,cjleonard/paper-now,KBMD/paper-now-test,hubgit/allen-insula,Read-Lab-Confederation/nyc-subway-anthrax-study,kikuito/paper-now,zach-nelson/atto,katrinleinweber/paper-now,Read-Lab-Confederation/nyc-subway-anthrax-study,pjacobetty/papertest,kikuito/paper-now,nate-d-olson/genomic_purity_pub,refgenomics/bacillus-anthracis-panel,Read-Lab-Confederation/nyc-subway-anthrax-study,cjleonard/paper-now,zach-nelson/atto,hubgit/allen-insula,opexxx/paper-now,Read-Lab-Confederation/nyc-subway-anthrax-study,boyercb/Generalized-Linear-Models-Final,PedroJSilva/paper-now,kliemann/paper-now,kliemann/paper-now,iqbal-lab/ASM_NGS_conf_report,kliemann/paper-now,PedroJSilva/paper-now,nate-d-olson/genomic_purity_pub,PedroJSilva/paper-now,Read-Lab-Confederation/nyc-subway-anthrax-study,PeerJ/paper-now,DimEvil/paper-now2,abremges/paper-now,pjacobetty/papertest,refgenomics/bacillus-anthracis-panel,iqbal-lab/ASM_NGS_conf_report,pjacobetty/papertest,iqbal-lab/ASM_NGS_conf_report,iqbal-lab/ASM_NGS_conf_report,nate-d-olson/genomic_purity_pub,KBMD/paper-now-test,PeerJ/paper-now,boyercb/Generalized-Linear-Models-Final | javascript | ## Code Before:
importScripts('serviceworker-cache-polyfill.js');
// TODO: cache figures and other external resources on install
self.onfetch = function(event) {
var fetchRequest = event.request.clone();
event.respondWith(fetch(fetchRequest).then(function (response) {
caches.open('responses').then(function (cache) {
cache.put(fetchRequest, response.clone());
});
return response;
}, function () {
return caches.match(event.request).then(function (response) {
return response;
});
}));
};
## Instruction:
Update ServiceWorker to only fetch specific files
## Code After:
importScripts('serviceworker-cache-polyfill.js');
self.addEventListener('activate', function(event) {
console.log('activated');
// clear everything from the cache
/*event.waitUntil(
caches.keys().then(function(keyList) {
return Promise.all(keyList.map(function(key) {
return caches.delete(key);
}));
})
);*/
var addToCache = function(cache, url) {
console.log('caching ' + url);
//caches.match(url).catch(function() {
fetch(url).then(function(response) {
cache.put(url, response);
});
//});
};
fetch('index.json').then(function(response) {
response.json().then(function(data) {
caches.open('require').then(function (cache) {
data.require.forEach(function(item) {
addToCache(cache, item);
});
});
caches.open('figures').then(function (cache) {
data.figures.forEach(function(item) {
if (item.image) {
addToCache(cache, item.image);
}
});
});
});
});
});
self.addEventListener('fetch', function(event) {
var fetchRequest = event.request;
var returnFetchOrCached = function(response) {
return response || fetch(fetchRequest);
};
var response = caches.match(event.request.url).then(returnFetchOrCached);
event.respondWith(response);
});
| importScripts('serviceworker-cache-polyfill.js');
- // TODO: cache figures and other external resources on install
+ self.addEventListener('activate', function(event) {
+ console.log('activated');
- self.onfetch = function(event) {
- var fetchRequest = event.request.clone();
+ // clear everything from the cache
+ /*event.waitUntil(
+ caches.keys().then(function(keyList) {
+ return Promise.all(keyList.map(function(key) {
+ return caches.delete(key);
+ }));
+ })
+ );*/
- event.respondWith(fetch(fetchRequest).then(function (response) {
+ var addToCache = function(cache, url) {
+ console.log('caching ' + url);
+
+ //caches.match(url).catch(function() {
+ fetch(url).then(function(response) {
+ cache.put(url, response);
+ });
+ //});
+ };
+
+ fetch('index.json').then(function(response) {
+ response.json().then(function(data) {
- caches.open('responses').then(function (cache) {
? ^^^^^ -
+ caches.open('require').then(function (cache) {
? ++++ ^^^^
- cache.put(fetchRequest, response.clone());
+ data.require.forEach(function(item) {
+ addToCache(cache, item);
+ });
+ });
+
+ caches.open('figures').then(function (cache) {
+ data.figures.forEach(function(item) {
+ if (item.image) {
+ addToCache(cache, item.image);
+ }
+ });
+ });
});
+ });
+ });
- return response;
- }, function () {
- return caches.match(event.request).then(function (response) {
- return response;
- });
+ self.addEventListener('fetch', function(event) {
+ var fetchRequest = event.request;
+
+ var returnFetchOrCached = function(response) {
+ return response || fetch(fetchRequest);
- }));
? --
+ };
+
+ var response = caches.match(event.request.url).then(returnFetchOrCached);
+
+ event.respondWith(response);
- };
+ });
? +
| 61 | 3.210526 | 48 | 13 |
81b1840f5687c19d2ced2b53039a66ab8f7ca72a | tests/stand-alone/spies-teardown/spies-teardown-tests.js | tests/stand-alone/spies-teardown/spies-teardown-tests.js | import assert from 'assert';
import SpiesTeardown from './spies-teardown';
import ReactTester from '../../../src/index';
describe('spies teardown', () => {
let component;
beforeEach(() => {
component = ReactTester
.create()
.use(SpiesTeardown);
});
describe('refreshes spies each time', () => {
beforeEach(() => {
component
.addFlavour('lemon', {});
});
it('is called once the first time I check', () => {
const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
assert(callcount, 1);
});
it('is called once the second time I check', () => {
const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
assert(callcount, 1);
});
});
describe('allows me to tear down when I want to', () => {
beforeEach(() => {
component
.addFlavour('chocolate', {});
});
it('spies automatically', () => {
const isSpy = component.ComponentToUse.prototype.spiedOn.isSinonProxy;
assert(isSpy, true);
});
it('can be unwrapped', () => {
component.teardown();
const isSpy = typeof component.ComponentToUse.prototype.spiedOn.isSinonProxy;
assert(isSpy, 'undefined');
});
});
});
| import assert from 'assert';
import SpiesTeardown from './spies-teardown';
import ReactTester from '../../../src/index';
describe('spies teardown', () => {
let tester;
beforeEach(() => {
tester = ReactTester
.create()
.use(SpiesTeardown);
});
describe('refresh spies each time should', () => {
beforeEach(() => tester.addFlavour('LEMON', {}));
it('allow normal spy behaviour on the first test pass', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
const expected = 1;
assert(actual, expected);
});
it('allow normal spy behaviour on the second test pass', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
const expected = 1;
assert(actual, expected);
});
});
describe('should', () => {
beforeEach(() => tester.addFlavour('CHOCOLATE', {}));
it('add spies automatically', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
const expected = true;
assert(actual, expected);
});
it('allow them to be unwrapped', () => {
tester.teardown();
const actual = typeof tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
const expected = 'undefined';
assert(actual, expected);
});
});
});
| Bring tests inline with CraigB style | Bring tests inline with CraigB style
| JavaScript | apache-2.0 | craigbilner/react-component-tester,craigbilner/react-component-tester | javascript | ## Code Before:
import assert from 'assert';
import SpiesTeardown from './spies-teardown';
import ReactTester from '../../../src/index';
describe('spies teardown', () => {
let component;
beforeEach(() => {
component = ReactTester
.create()
.use(SpiesTeardown);
});
describe('refreshes spies each time', () => {
beforeEach(() => {
component
.addFlavour('lemon', {});
});
it('is called once the first time I check', () => {
const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
assert(callcount, 1);
});
it('is called once the second time I check', () => {
const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
assert(callcount, 1);
});
});
describe('allows me to tear down when I want to', () => {
beforeEach(() => {
component
.addFlavour('chocolate', {});
});
it('spies automatically', () => {
const isSpy = component.ComponentToUse.prototype.spiedOn.isSinonProxy;
assert(isSpy, true);
});
it('can be unwrapped', () => {
component.teardown();
const isSpy = typeof component.ComponentToUse.prototype.spiedOn.isSinonProxy;
assert(isSpy, 'undefined');
});
});
});
## Instruction:
Bring tests inline with CraigB style
## Code After:
import assert from 'assert';
import SpiesTeardown from './spies-teardown';
import ReactTester from '../../../src/index';
describe('spies teardown', () => {
let tester;
beforeEach(() => {
tester = ReactTester
.create()
.use(SpiesTeardown);
});
describe('refresh spies each time should', () => {
beforeEach(() => tester.addFlavour('LEMON', {}));
it('allow normal spy behaviour on the first test pass', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
const expected = 1;
assert(actual, expected);
});
it('allow normal spy behaviour on the second test pass', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
const expected = 1;
assert(actual, expected);
});
});
describe('should', () => {
beforeEach(() => tester.addFlavour('CHOCOLATE', {}));
it('add spies automatically', () => {
const actual = tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
const expected = true;
assert(actual, expected);
});
it('allow them to be unwrapped', () => {
tester.teardown();
const actual = typeof tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
const expected = 'undefined';
assert(actual, expected);
});
});
});
| import assert from 'assert';
import SpiesTeardown from './spies-teardown';
import ReactTester from '../../../src/index';
describe('spies teardown', () => {
- let component;
+ let tester;
beforeEach(() => {
- component = ReactTester
? ^^^^^^ ^
+ tester = ReactTester
? ^ ^ ++
.create()
.use(SpiesTeardown);
});
- describe('refreshes spies each time', () => {
? --
+ describe('refresh spies each time should', () => {
? +++++++
- beforeEach(() => {
- component
- .addFlavour('lemon', {});
+ beforeEach(() => tester.addFlavour('LEMON', {}));
+
+ it('allow normal spy behaviour on the first test pass', () => {
+ const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
+ const expected = 1;
+
+ assert(actual, expected);
});
- it('is called once the first time I check', () => {
+ it('allow normal spy behaviour on the second test pass', () => {
- const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
? ------ ^^^^^^ ^
+ const actual = tester.ComponentToUse.prototype.spiedOn.callCount;
? + ++ ^ ^ ++
+ const expected = 1;
+ assert(actual, expected);
- assert(callcount, 1);
- });
-
- it('is called once the second time I check', () => {
- const callcount = component.ComponentToUse.prototype.spiedOn.callCount;
-
- assert(callcount, 1);
});
});
- describe('allows me to tear down when I want to', () => {
- beforeEach(() => {
- component
- .addFlavour('chocolate', {});
+ describe('should', () => {
+ beforeEach(() => tester.addFlavour('CHOCOLATE', {}));
+
+ it('add spies automatically', () => {
+ const actual = tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
+ const expected = true;
+ assert(actual, expected);
});
- it('spies automatically', () => {
+ it('allow them to be unwrapped', () => {
+ tester.teardown();
- const isSpy = component.ComponentToUse.prototype.spiedOn.isSinonProxy;
? ^^^^^ ^ ^^^^ ^
+ const actual = typeof tester.ComponentToUse.prototype.spiedOn.isSinonProxy;
? ^^^^^^ ^^^^ ^^^ ^ ++
+ const expected = 'undefined';
+ assert(actual, expected);
- assert(isSpy, true);
- });
-
- it('can be unwrapped', () => {
- component.teardown();
- const isSpy = typeof component.ComponentToUse.prototype.spiedOn.isSinonProxy;
-
- assert(isSpy, 'undefined');
});
});
}); | 55 | 1.057692 | 26 | 29 |
bddf3e47c1c3069fdfec6963eaf9dff1a398d012 | .travis.yml | .travis.yml | dist: trusty
sudo: required
services: docker
language: bash
branches:
only:
- master
- wip
- develop
before_script:
- env | sort
- name="uxbox"
- image="madmath03/uxbox:${VERSION}"
- dir="docker/"
script:
- travis_retry docker build -t "$image" "$dir"
after_script:
- docker images
- docker run --name "$name" -d "$image" "$dir"
- docker ps
- docker logs "$name"
notifications:
email: false
env: # Environments
- VERSION=beta
| dist: trusty
sudo: required
services: docker
language: bash
branches:
only:
- master
- wip
- develop
before_script:
- env | sort
script:
- manager.sh run
after_script:
- docker images
- docker ps
notifications:
email: false
env: # Environments
- VERSION=beta
| Use the helper for automated build | :construction_worker: Use the helper for automated build
| YAML | mpl-2.0 | uxbox/uxbox,uxbox/uxbox,uxbox/uxbox | yaml | ## Code Before:
dist: trusty
sudo: required
services: docker
language: bash
branches:
only:
- master
- wip
- develop
before_script:
- env | sort
- name="uxbox"
- image="madmath03/uxbox:${VERSION}"
- dir="docker/"
script:
- travis_retry docker build -t "$image" "$dir"
after_script:
- docker images
- docker run --name "$name" -d "$image" "$dir"
- docker ps
- docker logs "$name"
notifications:
email: false
env: # Environments
- VERSION=beta
## Instruction:
:construction_worker: Use the helper for automated build
## Code After:
dist: trusty
sudo: required
services: docker
language: bash
branches:
only:
- master
- wip
- develop
before_script:
- env | sort
script:
- manager.sh run
after_script:
- docker images
- docker ps
notifications:
email: false
env: # Environments
- VERSION=beta
| dist: trusty
sudo: required
services: docker
language: bash
branches:
only:
- master
- wip
- develop
before_script:
- env | sort
- - name="uxbox"
- - image="madmath03/uxbox:${VERSION}"
- - dir="docker/"
script:
- - travis_retry docker build -t "$image" "$dir"
+ - manager.sh run
after_script:
- docker images
- - docker run --name "$name" -d "$image" "$dir"
- docker ps
- - docker logs "$name"
notifications:
email: false
env: # Environments
- VERSION=beta | 7 | 0.212121 | 1 | 6 |
832afc8b0bbaa09a3245defa4a133a1b6019d59c | README.md | README.md | A very simple Javascript unit test tool
# Install
Install salep globally:
```
npm install --global salep
```
or install as a dependency to your project
```
npm install --save-dev salep
```
# Usage
```javascript
const expect = require('chai').expect;
const salep = require('salep');
salep.test("FunctionToTest", function() {
salep.case("Case1", function() {
expect("Hello World!").to.be.a("string");
});
// This will fail and throw exception
salep.case("FailCase", function() {
expect(false).to.be.a("string");
});
});
``` | A very simple Javascript unit test tool
# Install
Install salep globally:
```
npm install --global salep
```
or install as a dependency to your project
```
npm install --save-dev salep
```
# Usage
```javascript
require('salep');
const expect = require('chai').expect;
// This test will be ignored since salep.run() not called yet
salep.test("FunctionToSkip", function() {
this.case("SkippedCase", function() {
throw "This case and test will be ignored";
});
});
// Start salep
salep.run();
salep.test("FunctionToTest", function() {
// This will be recorded as success
this.case("SuccessCase", function() {
expect("Hello World!").to.be.a("string");
});
// This will be recorded as fail
this.case("FailCase", function() {
expect(false).to.be.a("string");
});
});
// Get results
var result = salep.stop();
console.log(JSON.stringify(result, null, 2));
``` | Update readme for new structure | Update readme for new structure
| Markdown | mit | mhalitk/salep | markdown | ## Code Before:
A very simple Javascript unit test tool
# Install
Install salep globally:
```
npm install --global salep
```
or install as a dependency to your project
```
npm install --save-dev salep
```
# Usage
```javascript
const expect = require('chai').expect;
const salep = require('salep');
salep.test("FunctionToTest", function() {
salep.case("Case1", function() {
expect("Hello World!").to.be.a("string");
});
// This will fail and throw exception
salep.case("FailCase", function() {
expect(false).to.be.a("string");
});
});
```
## Instruction:
Update readme for new structure
## Code After:
A very simple Javascript unit test tool
# Install
Install salep globally:
```
npm install --global salep
```
or install as a dependency to your project
```
npm install --save-dev salep
```
# Usage
```javascript
require('salep');
const expect = require('chai').expect;
// This test will be ignored since salep.run() not called yet
salep.test("FunctionToSkip", function() {
this.case("SkippedCase", function() {
throw "This case and test will be ignored";
});
});
// Start salep
salep.run();
salep.test("FunctionToTest", function() {
// This will be recorded as success
this.case("SuccessCase", function() {
expect("Hello World!").to.be.a("string");
});
// This will be recorded as fail
this.case("FailCase", function() {
expect(false).to.be.a("string");
});
});
// Get results
var result = salep.stop();
console.log(JSON.stringify(result, null, 2));
``` | A very simple Javascript unit test tool
# Install
Install salep globally:
```
npm install --global salep
```
or install as a dependency to your project
```
npm install --save-dev salep
```
# Usage
```javascript
+ require('salep');
const expect = require('chai').expect;
- const salep = require('salep');
+
+ // This test will be ignored since salep.run() not called yet
+ salep.test("FunctionToSkip", function() {
+ this.case("SkippedCase", function() {
+ throw "This case and test will be ignored";
+ });
+ });
+
+ // Start salep
+ salep.run();
salep.test("FunctionToTest", function() {
+ // This will be recorded as success
- salep.case("Case1", function() {
? ---- -
+ this.case("SuccessCase", function() {
? +++ +++++++
expect("Hello World!").to.be.a("string");
});
- // This will fail and throw exception
+ // This will be recorded as fail
- salep.case("FailCase", function() {
? ----
+ this.case("FailCase", function() {
? +++
expect(false).to.be.a("string");
});
});
+
+ // Get results
+ var result = salep.stop();
+ console.log(JSON.stringify(result, null, 2));
``` | 23 | 0.766667 | 19 | 4 |
db36e1ea9fd16eec9cfbff8ee4e1b4a400c10cef | packages/ca/call-stack.yaml | packages/ca/call-stack.yaml | homepage: https://github.com/sol/call-stack#readme
changelog-type: ''
hash: 5ce796b78d5f964468ec6fe0717b4e7d0430817f37370c47b3e6b38e345b6643
test-bench-deps:
base: ! '>=4.5.0.0 && <5'
nanospec: -any
call-stack: -any
maintainer: Simon Hengel <sol@typeful.net>
synopsis: Use GHC call-stacks in a backward compatible way
changelog: ''
basic-deps:
base: ! '>=4.5.0.0 && <5'
all-versions:
- 0.1.0
- 0.2.0
author: ''
latest: 0.2.0
description-type: haddock
description: ''
license-name: MIT
| homepage: https://github.com/sol/call-stack#readme
changelog-type: ''
hash: dc369179410fd39542efde04778d1c4a18a015b3cf4b1703d9c88e07d58ece20
test-bench-deps:
base: ==4.*
nanospec: -any
call-stack: -any
maintainer: Simon Hengel <sol@typeful.net>
synopsis: Use GHC call-stacks in a backward compatible way
changelog: ''
basic-deps:
base: ==4.*
all-versions:
- 0.1.0
- 0.2.0
- 0.3.0
author: ''
latest: 0.3.0
description-type: haddock
description: ''
license-name: MIT
| Update from Hackage at 2021-01-19T17:14:28Z | Update from Hackage at 2021-01-19T17:14:28Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: https://github.com/sol/call-stack#readme
changelog-type: ''
hash: 5ce796b78d5f964468ec6fe0717b4e7d0430817f37370c47b3e6b38e345b6643
test-bench-deps:
base: ! '>=4.5.0.0 && <5'
nanospec: -any
call-stack: -any
maintainer: Simon Hengel <sol@typeful.net>
synopsis: Use GHC call-stacks in a backward compatible way
changelog: ''
basic-deps:
base: ! '>=4.5.0.0 && <5'
all-versions:
- 0.1.0
- 0.2.0
author: ''
latest: 0.2.0
description-type: haddock
description: ''
license-name: MIT
## Instruction:
Update from Hackage at 2021-01-19T17:14:28Z
## Code After:
homepage: https://github.com/sol/call-stack#readme
changelog-type: ''
hash: dc369179410fd39542efde04778d1c4a18a015b3cf4b1703d9c88e07d58ece20
test-bench-deps:
base: ==4.*
nanospec: -any
call-stack: -any
maintainer: Simon Hengel <sol@typeful.net>
synopsis: Use GHC call-stacks in a backward compatible way
changelog: ''
basic-deps:
base: ==4.*
all-versions:
- 0.1.0
- 0.2.0
- 0.3.0
author: ''
latest: 0.3.0
description-type: haddock
description: ''
license-name: MIT
| homepage: https://github.com/sol/call-stack#readme
changelog-type: ''
- hash: 5ce796b78d5f964468ec6fe0717b4e7d0430817f37370c47b3e6b38e345b6643
+ hash: dc369179410fd39542efde04778d1c4a18a015b3cf4b1703d9c88e07d58ece20
test-bench-deps:
- base: ! '>=4.5.0.0 && <5'
+ base: ==4.*
nanospec: -any
call-stack: -any
maintainer: Simon Hengel <sol@typeful.net>
synopsis: Use GHC call-stacks in a backward compatible way
changelog: ''
basic-deps:
- base: ! '>=4.5.0.0 && <5'
+ base: ==4.*
all-versions:
- 0.1.0
- 0.2.0
+ - 0.3.0
author: ''
- latest: 0.2.0
? ^
+ latest: 0.3.0
? ^
description-type: haddock
description: ''
license-name: MIT | 9 | 0.45 | 5 | 4 |
033da1f164029bb29e19bc89badbdc36c7a35542 | README.md | README.md | jeevan-js
=========
node-js version of jeevan
| jeevan-js
=========
node-js version of jeevan
## DB Import
In order to import data from a csv file to the database, make sure that the csv has the exact schema as that of the database table then the command to import data is :
COPY table_name (*Column names*)
FROM 'CSV_FILE' WITH CSV HEADER;
## Dump and Restore DB
In order to backup and restor the data on local to the remote server three steps should be performed
1. Generate a sql script dump of the database (containing SQL scripts to build the database)
2. scp the file on to the database server
3. Run the file on the server wth the psql -f | Add sensible readme for db tasks | Add sensible readme for db tasks
| Markdown | mit | gprasant/jeevan-js,gprasant/jeevan-js | markdown | ## Code Before:
jeevan-js
=========
node-js version of jeevan
## Instruction:
Add sensible readme for db tasks
## Code After:
jeevan-js
=========
node-js version of jeevan
## DB Import
In order to import data from a csv file to the database, make sure that the csv has the exact schema as that of the database table then the command to import data is :
COPY table_name (*Column names*)
FROM 'CSV_FILE' WITH CSV HEADER;
## Dump and Restore DB
In order to backup and restor the data on local to the remote server three steps should be performed
1. Generate a sql script dump of the database (containing SQL scripts to build the database)
2. scp the file on to the database server
3. Run the file on the server wth the psql -f | jeevan-js
=========
node-js version of jeevan
+
+ ## DB Import
+
+ In order to import data from a csv file to the database, make sure that the csv has the exact schema as that of the database table then the command to import data is :
+
+ COPY table_name (*Column names*)
+ FROM 'CSV_FILE' WITH CSV HEADER;
+
+ ## Dump and Restore DB
+
+ In order to backup and restor the data on local to the remote server three steps should be performed
+
+ 1. Generate a sql script dump of the database (containing SQL scripts to build the database)
+ 2. scp the file on to the database server
+ 3. Run the file on the server wth the psql -f | 15 | 3.75 | 15 | 0 |
e84cf097b52790c1dccd394df24484f7a008c86e | test-integration/mysql-flag.sh | test-integration/mysql-flag.sh | export PATH=$PATH:$HOME/gopath/bin
OPTIONS="-config=test-integration/dbconfig.yml -env mysql_noflag"
set -ex
sql-migrate status $OPTIONS | grep -q "Make sure that the parseTime option is supplied"
| export PATH=$PATH:$HOME/gopath/bin
OPTIONS="-config=test-integration/dbconfig.yml -env mysql_noflag"
output=$(mktemp $TMPDIR/mysql-flag.XXXXXX)
set -ex
sql-migrate status $OPTIONS | tee $output
cat $output | grep -q "Make sure that the parseTime option is supplied"
| Split integration test to investigate output during CI | Split integration test to investigate output during CI
| Shell | mit | rubenv/sql-migrate,rubenv/sql-migrate | shell | ## Code Before:
export PATH=$PATH:$HOME/gopath/bin
OPTIONS="-config=test-integration/dbconfig.yml -env mysql_noflag"
set -ex
sql-migrate status $OPTIONS | grep -q "Make sure that the parseTime option is supplied"
## Instruction:
Split integration test to investigate output during CI
## Code After:
export PATH=$PATH:$HOME/gopath/bin
OPTIONS="-config=test-integration/dbconfig.yml -env mysql_noflag"
output=$(mktemp $TMPDIR/mysql-flag.XXXXXX)
set -ex
sql-migrate status $OPTIONS | tee $output
cat $output | grep -q "Make sure that the parseTime option is supplied"
| export PATH=$PATH:$HOME/gopath/bin
OPTIONS="-config=test-integration/dbconfig.yml -env mysql_noflag"
+ output=$(mktemp $TMPDIR/mysql-flag.XXXXXX)
+
set -ex
+ sql-migrate status $OPTIONS | tee $output
- sql-migrate status $OPTIONS | grep -q "Make sure that the parseTime option is supplied"
? ^^^^^^^^ -------- ^^^^^^^
+ cat $output | grep -q "Make sure that the parseTime option is supplied"
? ^ ^^^^^^
| 5 | 0.714286 | 4 | 1 |
c8cd4c5463b82b72a55faa96037dee1f0f38c97a | jwebform-integration/src/main/java/jwebform/integration/bean2form/FormResultWithBean.java | jwebform-integration/src/main/java/jwebform/integration/bean2form/FormResultWithBean.java | package jwebform.integration.bean2form;
import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;
public class FormResultWithBean extends FormResult {
public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
FormModelBuilder viewBuilder, Object bean) {
super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
/*
* if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
* else { fillBean(bean, this); }
*/
}
}
| package jwebform.integration.bean2form;
import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;
public class FormResultWithBean extends FormResult {
private final Object bean;
public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
FormModelBuilder viewBuilder, Object bean) {
super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
this.bean = bean;
/*
* if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
* else { fillBean(bean, this); }
*/
}
public Object getBean() {
return bean;
}
}
| Enable access to bean for FormRunner | Enable access to bean for FormRunner
| Java | mit | jochen777/jWebForm,jochen777/jWebForm | java | ## Code Before:
package jwebform.integration.bean2form;
import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;
public class FormResultWithBean extends FormResult {
public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
FormModelBuilder viewBuilder, Object bean) {
super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
/*
* if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
* else { fillBean(bean, this); }
*/
}
}
## Instruction:
Enable access to bean for FormRunner
## Code After:
package jwebform.integration.bean2form;
import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;
public class FormResultWithBean extends FormResult {
private final Object bean;
public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
FormModelBuilder viewBuilder, Object bean) {
super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
this.bean = bean;
/*
* if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
* else { fillBean(bean, this); }
*/
}
public Object getBean() {
return bean;
}
}
| package jwebform.integration.bean2form;
import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;
public class FormResultWithBean extends FormResult {
+ private final Object bean;
public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
FormModelBuilder viewBuilder, Object bean) {
super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
+ this.bean = bean;
/*
* if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
* else { fillBean(bean, this); }
*/
}
-
-
+ public Object getBean() {
+ return bean;
+ }
} | 7 | 0.291667 | 5 | 2 |
f3308666628e311d4f39be1e3078ed4cd1484024 | application/libraries/core/class.fork.inc.php | application/libraries/core/class.fork.inc.php | <?php
/**
* Process forking implementation
* @author M2Mobi, Heinz Wiesinger
*/
class Fork
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Destructor
*/
public function __destruct()
{
}
/**
* Start multiple parallel child processes
* @param Integer $number Amount of child processes to start
* @param Mixed $call The call that should be executed by the child processes
* either "function" or "array('class','method')"
* @param Array $data Prepared array of data to be processed by the child processes
* this array should be size() = $number
* @return Mixed Either false if run out of CLI context or an array of child process statuses
*/
public static function fork($number, $call, $data)
{
global $cli;
if ($cli)
{
for($i = 0; $i < $number; ++$i)
{
$pids[$i] = pcntl_fork();
if(!$pids[$i])
{
// child process
call_user_func_array($call,$data[$i]);
exit();
}
}
$result = SplFixedArray($number);
for($i = 0; $i < $number; ++$i)
{
pcntl_waitpid($pids[$i], $status, WUNTRACED);
$result[$i] = $status;
}
return $result;
}
else
{
return FALSE;
}
}
}
?> | <?php
/**
* Process forking implementation
* @author M2Mobi, Heinz Wiesinger
*/
class Fork
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Destructor
*/
public function __destruct()
{
}
/**
* Start multiple parallel child processes
* WARNING: make sure to not reuse an already existing DB-Connection established by the parent
* in the children. Best would be to not establish a DB-Connection in the parent at all.
* @param Integer $number Amount of child processes to start
* @param Mixed $call The call that should be executed by the child processes
* either "function" or "array('class','method')"
* @param Array $data Prepared array of data to be processed by the child processes
* this array should be size() = $number
* @return Mixed Either false if run out of CLI context or an array of child process statuses
*/
public static function fork($number, $call, $data)
{
global $cli;
if ($cli)
{
for($i = 0; $i < $number; ++$i)
{
$pids[$i] = pcntl_fork();
if(!$pids[$i])
{
// child process
call_user_func_array($call,$data[$i]);
exit();
}
}
$result = SplFixedArray($number);
for($i = 0; $i < $number; ++$i)
{
pcntl_waitpid($pids[$i], $status, WUNTRACED);
$result[$i] = $status;
}
return $result;
}
else
{
return FALSE;
}
}
}
?> | Add warning about db connection issues to the fork class | application: Add warning about db connection issues to the fork class
| PHP | mit | pprkut/lunr,M2Mobi/lunr,tardypad/lunr,pprkut/lunr,M2Mobi/lunr,tardypad/lunr,pprkut/lunr,tardypad/lunr,M2Mobi/lunr | php | ## Code Before:
<?php
/**
* Process forking implementation
* @author M2Mobi, Heinz Wiesinger
*/
class Fork
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Destructor
*/
public function __destruct()
{
}
/**
* Start multiple parallel child processes
* @param Integer $number Amount of child processes to start
* @param Mixed $call The call that should be executed by the child processes
* either "function" or "array('class','method')"
* @param Array $data Prepared array of data to be processed by the child processes
* this array should be size() = $number
* @return Mixed Either false if run out of CLI context or an array of child process statuses
*/
public static function fork($number, $call, $data)
{
global $cli;
if ($cli)
{
for($i = 0; $i < $number; ++$i)
{
$pids[$i] = pcntl_fork();
if(!$pids[$i])
{
// child process
call_user_func_array($call,$data[$i]);
exit();
}
}
$result = SplFixedArray($number);
for($i = 0; $i < $number; ++$i)
{
pcntl_waitpid($pids[$i], $status, WUNTRACED);
$result[$i] = $status;
}
return $result;
}
else
{
return FALSE;
}
}
}
?>
## Instruction:
application: Add warning about db connection issues to the fork class
## Code After:
<?php
/**
* Process forking implementation
* @author M2Mobi, Heinz Wiesinger
*/
class Fork
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Destructor
*/
public function __destruct()
{
}
/**
* Start multiple parallel child processes
* WARNING: make sure to not reuse an already existing DB-Connection established by the parent
* in the children. Best would be to not establish a DB-Connection in the parent at all.
* @param Integer $number Amount of child processes to start
* @param Mixed $call The call that should be executed by the child processes
* either "function" or "array('class','method')"
* @param Array $data Prepared array of data to be processed by the child processes
* this array should be size() = $number
* @return Mixed Either false if run out of CLI context or an array of child process statuses
*/
public static function fork($number, $call, $data)
{
global $cli;
if ($cli)
{
for($i = 0; $i < $number; ++$i)
{
$pids[$i] = pcntl_fork();
if(!$pids[$i])
{
// child process
call_user_func_array($call,$data[$i]);
exit();
}
}
$result = SplFixedArray($number);
for($i = 0; $i < $number; ++$i)
{
pcntl_waitpid($pids[$i], $status, WUNTRACED);
$result[$i] = $status;
}
return $result;
}
else
{
return FALSE;
}
}
}
?> | <?php
/**
* Process forking implementation
* @author M2Mobi, Heinz Wiesinger
*/
class Fork
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Destructor
*/
public function __destruct()
{
}
/**
* Start multiple parallel child processes
+ * WARNING: make sure to not reuse an already existing DB-Connection established by the parent
+ * in the children. Best would be to not establish a DB-Connection in the parent at all.
* @param Integer $number Amount of child processes to start
* @param Mixed $call The call that should be executed by the child processes
* either "function" or "array('class','method')"
* @param Array $data Prepared array of data to be processed by the child processes
* this array should be size() = $number
* @return Mixed Either false if run out of CLI context or an array of child process statuses
*/
public static function fork($number, $call, $data)
{
global $cli;
if ($cli)
{
for($i = 0; $i < $number; ++$i)
{
$pids[$i] = pcntl_fork();
if(!$pids[$i])
{
// child process
call_user_func_array($call,$data[$i]);
exit();
}
}
$result = SplFixedArray($number);
for($i = 0; $i < $number; ++$i)
{
pcntl_waitpid($pids[$i], $status, WUNTRACED);
$result[$i] = $status;
}
return $result;
}
else
{
return FALSE;
}
}
}
?> | 2 | 0.028571 | 2 | 0 |
2249423d86a369a1c31c93fc1441ccff71dbd0e9 | xfire-aegis/src/main/org/codehaus/xfire/aegis/MessageWriter.java | xfire-aegis/src/main/org/codehaus/xfire/aegis/MessageWriter.java | package org.codehaus.xfire.aegis;
import javax.xml.namespace.QName;
/**
* Writes messages to an output stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface MessageWriter
{
void writeValue( Object value );
void writeValueAsInt( Integer i );
void writeValueAsDouble(Double double1);
void writeValueAsLong(Long l);
void writeValueAsFloat(Float f);
void writeValueAsBoolean(boolean b);
MessageWriter getAttributeWriter(String name);
MessageWriter getAttributeWriter(String name, String namespace);
MessageWriter getAttributeWriter(QName qname);
MessageWriter getElementWriter(String name);
MessageWriter getElementWriter(String name, String namespace);
MessageWriter getElementWriter(QName qname);
/**
* Tells the MessageWriter that writing operations are completed so
* it can write the end element.
*/
void close();
}
| package org.codehaus.xfire.aegis;
import javax.xml.namespace.QName;
/**
* Writes messages to an output stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface MessageWriter
{
void writeValue( Object value );
void writeValueAsInt( Integer i );
void writeValueAsDouble(Double double1);
void writeValueAsLong(Long l);
void writeValueAsFloat(Float f);
void writeValueAsBoolean(boolean b);
MessageWriter getAttributeWriter(String name);
MessageWriter getAttributeWriter(String name, String namespace);
MessageWriter getAttributeWriter(QName qname);
MessageWriter getElementWriter(String name);
MessageWriter getElementWriter(String name, String namespace);
MessageWriter getElementWriter(QName qname);
String getPrefixForNamespace( String namespace );
/**
* Tells the MessageWriter that writing operations are completed so
* it can write the end element.
*/
void close();
}
| Add ability to get the prefix for a given namespace | Add ability to get the prefix for a given namespace
git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@889 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba
| Java | mit | eduardodaluz/xfire,eduardodaluz/xfire | java | ## Code Before:
package org.codehaus.xfire.aegis;
import javax.xml.namespace.QName;
/**
* Writes messages to an output stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface MessageWriter
{
void writeValue( Object value );
void writeValueAsInt( Integer i );
void writeValueAsDouble(Double double1);
void writeValueAsLong(Long l);
void writeValueAsFloat(Float f);
void writeValueAsBoolean(boolean b);
MessageWriter getAttributeWriter(String name);
MessageWriter getAttributeWriter(String name, String namespace);
MessageWriter getAttributeWriter(QName qname);
MessageWriter getElementWriter(String name);
MessageWriter getElementWriter(String name, String namespace);
MessageWriter getElementWriter(QName qname);
/**
* Tells the MessageWriter that writing operations are completed so
* it can write the end element.
*/
void close();
}
## Instruction:
Add ability to get the prefix for a given namespace
git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@889 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba
## Code After:
package org.codehaus.xfire.aegis;
import javax.xml.namespace.QName;
/**
* Writes messages to an output stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface MessageWriter
{
void writeValue( Object value );
void writeValueAsInt( Integer i );
void writeValueAsDouble(Double double1);
void writeValueAsLong(Long l);
void writeValueAsFloat(Float f);
void writeValueAsBoolean(boolean b);
MessageWriter getAttributeWriter(String name);
MessageWriter getAttributeWriter(String name, String namespace);
MessageWriter getAttributeWriter(QName qname);
MessageWriter getElementWriter(String name);
MessageWriter getElementWriter(String name, String namespace);
MessageWriter getElementWriter(QName qname);
String getPrefixForNamespace( String namespace );
/**
* Tells the MessageWriter that writing operations are completed so
* it can write the end element.
*/
void close();
}
| package org.codehaus.xfire.aegis;
import javax.xml.namespace.QName;
/**
* Writes messages to an output stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface MessageWriter
{
void writeValue( Object value );
void writeValueAsInt( Integer i );
void writeValueAsDouble(Double double1);
void writeValueAsLong(Long l);
void writeValueAsFloat(Float f);
void writeValueAsBoolean(boolean b);
MessageWriter getAttributeWriter(String name);
MessageWriter getAttributeWriter(String name, String namespace);
MessageWriter getAttributeWriter(QName qname);
MessageWriter getElementWriter(String name);
MessageWriter getElementWriter(String name, String namespace);
MessageWriter getElementWriter(QName qname);
+
+ String getPrefixForNamespace( String namespace );
/**
* Tells the MessageWriter that writing operations are completed so
* it can write the end element.
*/
void close();
} | 2 | 0.04878 | 2 | 0 |
f33657f9772012abb3070bd6f8a4325a915fce9e | spec/factories/places.rb | spec/factories/places.rb |
FactoryGirl.define do
factory :place do
name "Testplace"
wheelchair "yes"
end
end
|
FactoryGirl.define do
factory :place do
data_set
name "Testplace"
wheelchair "yes"
end
end
| Add association during factory create. | Add association during factory create. | Ruby | mit | sozialhelden/poichecker,sozialhelden/poichecker,sozialhelden/poichecker | ruby | ## Code Before:
FactoryGirl.define do
factory :place do
name "Testplace"
wheelchair "yes"
end
end
## Instruction:
Add association during factory create.
## Code After:
FactoryGirl.define do
factory :place do
data_set
name "Testplace"
wheelchair "yes"
end
end
|
FactoryGirl.define do
factory :place do
+ data_set
name "Testplace"
wheelchair "yes"
end
end | 1 | 0.142857 | 1 | 0 |
6ad0f920e49df8e3f280286f01b2f0993f47d759 | docs/releasing.md | docs/releasing.md |
_This guide is a work-in-progress._
## Updating the version
- Update `lib/opal/version.rb`
- Update `opal/corelib/constants.rb` with the same version number along with release dates
## Updating the changelog
- Ensure all the unreleased changes are documented in UNRELEASED.md
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
## The commit
- Commit the updated changelog along with the version bump using this commit message:
"Release v1.2.3"
## Opal docs
- Open `opal-docs` and run `bin/build v1.2.3`
- Then run `bin/deploy`
## Opal site
- Open `opal.github.io` and update the opal version in the `Gemfile`
- run `bin/build`
- `git push` the latest changes
## Opal CDN
- Run `bin/release v1.2.3`
|
_This guide is a work-in-progress._
## Updating the version
- Update `lib/opal/version.rb`
- Update `opal/corelib/constants.rb` with the same version number along with release dates
## Updating the changelog
- Ensure all the unreleased changes are documented in UNRELEASED.md
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
## The commit
- Commit the updated changelog along with the version bump using this commit message:
"Release v1.2.3"
- Push the commit and run `bin/rake release` to release the new version to Rubygems
- Go to GitHub releases and create a new release from the latest tag pasting the contents of UNRELEASED.md
- Empty UNRELEASED.md and run `bin/rake changelog`
- Push the updated changelog
## Opal docs
- Open `opal-docs` and run `bin/build v1.2.3`
- Then run `bin/deploy`
## Opal site
- Open `opal.github.io` and update the opal version in the `Gemfile`
- run `bin/build`
- `git push` the latest changes
## Opal CDN
- Run `bin/release v1.2.3`
| Add instructions on how to do github releases | Add instructions on how to do github releases
| Markdown | mit | Mogztter/opal,Mogztter/opal,opal/opal,Mogztter/opal,opal/opal,Mogztter/opal,opal/opal,opal/opal | markdown | ## Code Before:
_This guide is a work-in-progress._
## Updating the version
- Update `lib/opal/version.rb`
- Update `opal/corelib/constants.rb` with the same version number along with release dates
## Updating the changelog
- Ensure all the unreleased changes are documented in UNRELEASED.md
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
## The commit
- Commit the updated changelog along with the version bump using this commit message:
"Release v1.2.3"
## Opal docs
- Open `opal-docs` and run `bin/build v1.2.3`
- Then run `bin/deploy`
## Opal site
- Open `opal.github.io` and update the opal version in the `Gemfile`
- run `bin/build`
- `git push` the latest changes
## Opal CDN
- Run `bin/release v1.2.3`
## Instruction:
Add instructions on how to do github releases
## Code After:
_This guide is a work-in-progress._
## Updating the version
- Update `lib/opal/version.rb`
- Update `opal/corelib/constants.rb` with the same version number along with release dates
## Updating the changelog
- Ensure all the unreleased changes are documented in UNRELEASED.md
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
## The commit
- Commit the updated changelog along with the version bump using this commit message:
"Release v1.2.3"
- Push the commit and run `bin/rake release` to release the new version to Rubygems
- Go to GitHub releases and create a new release from the latest tag pasting the contents of UNRELEASED.md
- Empty UNRELEASED.md and run `bin/rake changelog`
- Push the updated changelog
## Opal docs
- Open `opal-docs` and run `bin/build v1.2.3`
- Then run `bin/deploy`
## Opal site
- Open `opal.github.io` and update the opal version in the `Gemfile`
- run `bin/build`
- `git push` the latest changes
## Opal CDN
- Run `bin/release v1.2.3`
|
_This guide is a work-in-progress._
## Updating the version
- Update `lib/opal/version.rb`
- Update `opal/corelib/constants.rb` with the same version number along with release dates
## Updating the changelog
- Ensure all the unreleased changes are documented in UNRELEASED.md
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
## The commit
- Commit the updated changelog along with the version bump using this commit message:
"Release v1.2.3"
+ - Push the commit and run `bin/rake release` to release the new version to Rubygems
+ - Go to GitHub releases and create a new release from the latest tag pasting the contents of UNRELEASED.md
+ - Empty UNRELEASED.md and run `bin/rake changelog`
+ - Push the updated changelog
## Opal docs
- Open `opal-docs` and run `bin/build v1.2.3`
- Then run `bin/deploy`
## Opal site
- Open `opal.github.io` and update the opal version in the `Gemfile`
- run `bin/build`
- `git push` the latest changes
## Opal CDN
- Run `bin/release v1.2.3` | 4 | 0.125 | 4 | 0 |
3b8ab731cda464e6e53cbf65cb53b37027a6e7e4 | test/models/api_key_test.rb | test/models/api_key_test.rb |
require 'test_helper'
class ApiKeyTest < ActiveSupport::TestCase
should belong_to(:user)
test "creating a new Api Key should generate an access token" do
api_key = ApiKey.create!(name: "MyApiKey")
assert_not_nil api_key.access_token
end
end
|
require 'test_helper'
class ApiKeyTest < ActiveSupport::TestCase
should belong_to(:user)
test "creating a new api key should generate an access token" do
api_key = ApiKey.create!(name: "MyApiKey")
assert_not_nil api_key.access_token
end
test "updating an existing api key should not modify its access token" do
api_key = ApiKey.create!(name: "MyApiKey")
access_token = api_key.access_token
api_key.name = "ChangedApiKeyName"
api_key.save!
assert_equal access_token, api_key.access_token
end
test "expired should be false" do
api_key = ApiKey.create!(name: "MyApiKey")
assert (api_key.expired? == false), "ApiKey#expired? should be false when date_expired is not present"
end
test "expired should be true" do
api_key = ApiKey.create!(name: "MyApiKey", date_expired: 1.month.ago)
assert (api_key.expired? == true), "ApiKey#expired? should be true when date_expired is present"
end
end
| Add assertations for the expired? method on the ApiKey model | Add assertations for the expired? method on the ApiKey model
| Ruby | mit | Rynaro/helpy,scott/helpy,Rynaro/helpy,CGA1123/helpy,helpyio/helpy,scott/helpy,helpyio/helpy,felipewmartins/helpy,CGA1123/helpy,felipewmartins/helpy,scott/helpy__helpdesk_knowledgebase,CGA1123/helpy,felipewmartins/helpy,scott/helpy,CGA1123/helpy,monami-ya/helpy,scott/helpy__helpdesk_knowledgebase,scott/helpy__helpdesk_knowledgebase,Rynaro/helpy,monami-ya/helpy,helpyio/helpy,helpyio/helpy,monami-ya/helpy | ruby | ## Code Before:
require 'test_helper'
class ApiKeyTest < ActiveSupport::TestCase
should belong_to(:user)
test "creating a new Api Key should generate an access token" do
api_key = ApiKey.create!(name: "MyApiKey")
assert_not_nil api_key.access_token
end
end
## Instruction:
Add assertations for the expired? method on the ApiKey model
## Code After:
require 'test_helper'
class ApiKeyTest < ActiveSupport::TestCase
should belong_to(:user)
test "creating a new api key should generate an access token" do
api_key = ApiKey.create!(name: "MyApiKey")
assert_not_nil api_key.access_token
end
test "updating an existing api key should not modify its access token" do
api_key = ApiKey.create!(name: "MyApiKey")
access_token = api_key.access_token
api_key.name = "ChangedApiKeyName"
api_key.save!
assert_equal access_token, api_key.access_token
end
test "expired should be false" do
api_key = ApiKey.create!(name: "MyApiKey")
assert (api_key.expired? == false), "ApiKey#expired? should be false when date_expired is not present"
end
test "expired should be true" do
api_key = ApiKey.create!(name: "MyApiKey", date_expired: 1.month.ago)
assert (api_key.expired? == true), "ApiKey#expired? should be true when date_expired is present"
end
end
|
require 'test_helper'
class ApiKeyTest < ActiveSupport::TestCase
should belong_to(:user)
- test "creating a new Api Key should generate an access token" do
? ^ ^
+ test "creating a new api key should generate an access token" do
? ^ ^
api_key = ApiKey.create!(name: "MyApiKey")
assert_not_nil api_key.access_token
end
+ test "updating an existing api key should not modify its access token" do
+ api_key = ApiKey.create!(name: "MyApiKey")
+ access_token = api_key.access_token
+ api_key.name = "ChangedApiKeyName"
+ api_key.save!
+ assert_equal access_token, api_key.access_token
+ end
+
+ test "expired should be false" do
+ api_key = ApiKey.create!(name: "MyApiKey")
+ assert (api_key.expired? == false), "ApiKey#expired? should be false when date_expired is not present"
+ end
+
+ test "expired should be true" do
+ api_key = ApiKey.create!(name: "MyApiKey", date_expired: 1.month.ago)
+ assert (api_key.expired? == true), "ApiKey#expired? should be true when date_expired is present"
+ end
+
end | 20 | 1.538462 | 19 | 1 |
9e1ccfc621f34371a27533f70c83570b6252e5b1 | src/Oro/Bundle/FeatureToggleBundle/Checker/FeatureCheckerHolderTrait.php | src/Oro/Bundle/FeatureToggleBundle/Checker/FeatureCheckerHolderTrait.php | <?php
namespace Oro\Bundle\FeatureToggleBundle\Checker;
trait FeatureCheckerHolderTrait
{
/**
* @var FeatureChecker
*/
protected $featureChecker;
/**
* @var array
*/
protected $features = [];
/**
* @param FeatureChecker $checker
*/
public function setFeatureChecker(FeatureChecker $checker)
{
$this->featureChecker = $checker;
}
/**
* @param string $feature
*/
public function addFeature($feature)
{
$this->features[] = $feature;
}
/**
* @param null|int|object $scopeIdentifier
* @return bool
*/
public function isFeaturesEnabled($scopeIdentifier = null)
{
foreach ($this->features as $feature) {
if (!$this->featureChecker->isFeatureEnabled($feature, $scopeIdentifier)) {
return false;
}
}
return true;
}
/**
* @param string|null $route
* @param null|int|object $scopeIdentifier
*
* @return bool
*/
public function isRouteEnabled($route = null, $scopeIdentifier = null)
{
return $this->featureChecker->isResourceEnabled($route, 'routes', $scopeIdentifier);
}
}
| <?php
namespace Oro\Bundle\FeatureToggleBundle\Checker;
trait FeatureCheckerHolderTrait
{
/**
* @var FeatureChecker
*/
protected $featureChecker;
/**
* @var array
*/
protected $features = [];
/**
* @param FeatureChecker $checker
*/
public function setFeatureChecker(FeatureChecker $checker)
{
$this->featureChecker = $checker;
}
/**
* @param string $feature
*/
public function addFeature($feature)
{
$this->features[] = $feature;
}
/**
* @param null|int|object $scopeIdentifier
* @return bool
*/
public function isFeaturesEnabled($scopeIdentifier = null)
{
foreach ($this->features as $feature) {
if (!$this->featureChecker->isFeatureEnabled($feature, $scopeIdentifier)) {
return false;
}
}
return true;
}
}
| Disable email as a feature - Updated unit tests for navigation history builder | CRM-6121: Disable email as a feature
- Updated unit tests for navigation history builder
| PHP | mit | geoffroycochard/platform,geoffroycochard/platform,orocrm/platform,Djamy/platform,orocrm/platform,Djamy/platform,Djamy/platform,orocrm/platform,geoffroycochard/platform | php | ## Code Before:
<?php
namespace Oro\Bundle\FeatureToggleBundle\Checker;
trait FeatureCheckerHolderTrait
{
/**
* @var FeatureChecker
*/
protected $featureChecker;
/**
* @var array
*/
protected $features = [];
/**
* @param FeatureChecker $checker
*/
public function setFeatureChecker(FeatureChecker $checker)
{
$this->featureChecker = $checker;
}
/**
* @param string $feature
*/
public function addFeature($feature)
{
$this->features[] = $feature;
}
/**
* @param null|int|object $scopeIdentifier
* @return bool
*/
public function isFeaturesEnabled($scopeIdentifier = null)
{
foreach ($this->features as $feature) {
if (!$this->featureChecker->isFeatureEnabled($feature, $scopeIdentifier)) {
return false;
}
}
return true;
}
/**
* @param string|null $route
* @param null|int|object $scopeIdentifier
*
* @return bool
*/
public function isRouteEnabled($route = null, $scopeIdentifier = null)
{
return $this->featureChecker->isResourceEnabled($route, 'routes', $scopeIdentifier);
}
}
## Instruction:
CRM-6121: Disable email as a feature
- Updated unit tests for navigation history builder
## Code After:
<?php
namespace Oro\Bundle\FeatureToggleBundle\Checker;
trait FeatureCheckerHolderTrait
{
/**
* @var FeatureChecker
*/
protected $featureChecker;
/**
* @var array
*/
protected $features = [];
/**
* @param FeatureChecker $checker
*/
public function setFeatureChecker(FeatureChecker $checker)
{
$this->featureChecker = $checker;
}
/**
* @param string $feature
*/
public function addFeature($feature)
{
$this->features[] = $feature;
}
/**
* @param null|int|object $scopeIdentifier
* @return bool
*/
public function isFeaturesEnabled($scopeIdentifier = null)
{
foreach ($this->features as $feature) {
if (!$this->featureChecker->isFeatureEnabled($feature, $scopeIdentifier)) {
return false;
}
}
return true;
}
}
| <?php
namespace Oro\Bundle\FeatureToggleBundle\Checker;
trait FeatureCheckerHolderTrait
{
/**
* @var FeatureChecker
*/
protected $featureChecker;
/**
* @var array
*/
protected $features = [];
/**
* @param FeatureChecker $checker
*/
public function setFeatureChecker(FeatureChecker $checker)
{
$this->featureChecker = $checker;
}
/**
* @param string $feature
*/
public function addFeature($feature)
{
$this->features[] = $feature;
}
/**
* @param null|int|object $scopeIdentifier
* @return bool
*/
public function isFeaturesEnabled($scopeIdentifier = null)
{
foreach ($this->features as $feature) {
if (!$this->featureChecker->isFeatureEnabled($feature, $scopeIdentifier)) {
return false;
}
}
return true;
}
-
- /**
- * @param string|null $route
- * @param null|int|object $scopeIdentifier
- *
- * @return bool
- */
- public function isRouteEnabled($route = null, $scopeIdentifier = null)
- {
- return $this->featureChecker->isResourceEnabled($route, 'routes', $scopeIdentifier);
- }
} | 11 | 0.189655 | 0 | 11 |
390d5a87d13565bc429debdc2e4cfb0c07e570cb | week-9/review.js | week-9/review.js | // psuedocode
// a grocery list
//
// initial solution
// refactor
// reflection
// What concepts did you solidify in working on this challenge?
// What was the most difficult part of this challenge?
// Did you solve the problem in a new way this time?
// Was your pseudocode different from the Ruby version? What was the same and what was different? | // I chose to re-do the Die Class 2 challenge from week 6 in JavaScript.
// psuedocode
// create a dice Object that takes an array of sides
// tells you how many sides there are.
// allows you to roll the dice
// and returns the result of your roll.
// initial solution
// var dieObject = {}
// dieObject.sideLabels = ["blue", "green", "sad", "froggy"];
// dieObject.sides = dieObject.sideLabels.length;
// dieObject.roll = function() {
// var randomNum = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
// return dieObject.sideLabels[randomNum];
// }
// console.log(dieObject.roll());
// refactor
var dieObject = {};
dieObject.sideLabels = prompt("Enter a list of things, seperated by a space, please.").split(" ");
dieObject.sides = dieObject.sideLabels.length;
dieObject.roll = function() {
var randomSide = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
return dieObject.sideLabels[randomSide];
}
// reflection
// What concepts did you solidify in working on this challenge?
// I feel really good about my array skills. I also think that I'm starting to understand Math.floor and other Math things about JS so that makes me feel pretty good. I loved the dice challenge because it wasn't easy but it was simple, ifthat makes sense. I knew something that simple would be harder to translate.
// What was the most difficult part of this challenge?
// Getting all the parts to work and be declared correctly. I get this and hashes mixed up so sometimes they get mixed up and I have to console.log() things until I get them right.
// Did you solve the problem in a new way this time?
// Well I had to - Ruby has classes where JavaScript has objects. I think I need to sit down and review how to write them. I think I probably could have gotten this all delcared in the object itself, but I also think this makes it a little more readable. I love that you can just write a new thing into the Object. JS is sometimes frustrating because it's so slippery, but this time, I liked it.
// Was your pseudocode different from the Ruby version? What was the same and what was different?
// I've actually gotten better at making my pseudocode more readable and understanding. At least, I hope so. I also think that the methods are different so I couldn't really say the same things. | Complete 9.2.1 Ruby challenge and recreated Die Class | Complete 9.2.1 Ruby challenge and recreated Die Class
| JavaScript | mit | tomorrow-lauren/phase-0,tomorrow-lauren/phase-0,tomorrow-lauren/phase-0 | javascript | ## Code Before:
// psuedocode
// a grocery list
//
// initial solution
// refactor
// reflection
// What concepts did you solidify in working on this challenge?
// What was the most difficult part of this challenge?
// Did you solve the problem in a new way this time?
// Was your pseudocode different from the Ruby version? What was the same and what was different?
## Instruction:
Complete 9.2.1 Ruby challenge and recreated Die Class
## Code After:
// I chose to re-do the Die Class 2 challenge from week 6 in JavaScript.
// psuedocode
// create a dice Object that takes an array of sides
// tells you how many sides there are.
// allows you to roll the dice
// and returns the result of your roll.
// initial solution
// var dieObject = {}
// dieObject.sideLabels = ["blue", "green", "sad", "froggy"];
// dieObject.sides = dieObject.sideLabels.length;
// dieObject.roll = function() {
// var randomNum = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
// return dieObject.sideLabels[randomNum];
// }
// console.log(dieObject.roll());
// refactor
var dieObject = {};
dieObject.sideLabels = prompt("Enter a list of things, seperated by a space, please.").split(" ");
dieObject.sides = dieObject.sideLabels.length;
dieObject.roll = function() {
var randomSide = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
return dieObject.sideLabels[randomSide];
}
// reflection
// What concepts did you solidify in working on this challenge?
// I feel really good about my array skills. I also think that I'm starting to understand Math.floor and other Math things about JS so that makes me feel pretty good. I loved the dice challenge because it wasn't easy but it was simple, ifthat makes sense. I knew something that simple would be harder to translate.
// What was the most difficult part of this challenge?
// Getting all the parts to work and be declared correctly. I get this and hashes mixed up so sometimes they get mixed up and I have to console.log() things until I get them right.
// Did you solve the problem in a new way this time?
// Well I had to - Ruby has classes where JavaScript has objects. I think I need to sit down and review how to write them. I think I probably could have gotten this all delcared in the object itself, but I also think this makes it a little more readable. I love that you can just write a new thing into the Object. JS is sometimes frustrating because it's so slippery, but this time, I liked it.
// Was your pseudocode different from the Ruby version? What was the same and what was different?
// I've actually gotten better at making my pseudocode more readable and understanding. At least, I hope so. I also think that the methods are different so I couldn't really say the same things. | + // I chose to re-do the Die Class 2 challenge from week 6 in JavaScript.
+
// psuedocode
- // a grocery list
- //
+ // create a dice Object that takes an array of sides
+ // tells you how many sides there are.
+ // allows you to roll the dice
+ // and returns the result of your roll.
// initial solution
+ // var dieObject = {}
+ // dieObject.sideLabels = ["blue", "green", "sad", "froggy"];
+ // dieObject.sides = dieObject.sideLabels.length;
+ // dieObject.roll = function() {
+ // var randomNum = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
+ // return dieObject.sideLabels[randomNum];
+ // }
+ // console.log(dieObject.roll());
+
// refactor
+ var dieObject = {};
+ dieObject.sideLabels = prompt("Enter a list of things, seperated by a space, please.").split(" ");
+ dieObject.sides = dieObject.sideLabels.length;
+ dieObject.roll = function() {
+ var randomSide = Math.floor(Math.random() * (dieObject.sides - 0) + 0);
+ return dieObject.sideLabels[randomSide];
+ }
+
// reflection
// What concepts did you solidify in working on this challenge?
+ // I feel really good about my array skills. I also think that I'm starting to understand Math.floor and other Math things about JS so that makes me feel pretty good. I loved the dice challenge because it wasn't easy but it was simple, ifthat makes sense. I knew something that simple would be harder to translate.
// What was the most difficult part of this challenge?
+ // Getting all the parts to work and be declared correctly. I get this and hashes mixed up so sometimes they get mixed up and I have to console.log() things until I get them right.
// Did you solve the problem in a new way this time?
+ // Well I had to - Ruby has classes where JavaScript has objects. I think I need to sit down and review how to write them. I think I probably could have gotten this all delcared in the object itself, but I also think this makes it a little more readable. I love that you can just write a new thing into the Object. JS is sometimes frustrating because it's so slippery, but this time, I liked it.
// Was your pseudocode different from the Ruby version? What was the same and what was different?
+ // I've actually gotten better at making my pseudocode more readable and understanding. At least, I hope so. I also think that the methods are different so I couldn't really say the same things. | 29 | 2.416667 | 27 | 2 |
f14b1ca7c01179a2d8031de54960efd3b8ef2d63 | setup.cfg | setup.cfg | [bdist]
formats = rpm
[bdist_rpm]
requires = bash, bash-completion, python-argcomplete
doc_files = README
[versioneer]
VCS = git
style = pep440
versionfile_source = finddata/_version.py
versionfile_build = finddata/_version.py
tag_prefix = v
| [bdist]
formats = rpm
[bdist_rpm]
requires = python, bash, bash-completion, python-argcomplete
build_requires = python, python-setuptools
doc_files = README
[versioneer]
VCS = git
style = pep440
versionfile_source = finddata/_version.py
versionfile_build = finddata/_version.py
tag_prefix = v
| Fix rpm requirements to build in mock | Fix rpm requirements to build in mock
| INI | mit | peterfpeterson/finddata | ini | ## Code Before:
[bdist]
formats = rpm
[bdist_rpm]
requires = bash, bash-completion, python-argcomplete
doc_files = README
[versioneer]
VCS = git
style = pep440
versionfile_source = finddata/_version.py
versionfile_build = finddata/_version.py
tag_prefix = v
## Instruction:
Fix rpm requirements to build in mock
## Code After:
[bdist]
formats = rpm
[bdist_rpm]
requires = python, bash, bash-completion, python-argcomplete
build_requires = python, python-setuptools
doc_files = README
[versioneer]
VCS = git
style = pep440
versionfile_source = finddata/_version.py
versionfile_build = finddata/_version.py
tag_prefix = v
| [bdist]
formats = rpm
[bdist_rpm]
- requires = bash, bash-completion, python-argcomplete
+ requires = python, bash, bash-completion, python-argcomplete
? ++++++++
+ build_requires = python, python-setuptools
doc_files = README
[versioneer]
VCS = git
style = pep440
versionfile_source = finddata/_version.py
versionfile_build = finddata/_version.py
tag_prefix = v | 3 | 0.230769 | 2 | 1 |
59ae2f118cd043671ffc1e00d9eccb21d35aff3c | packages/shared/lib/helpers/object.js | packages/shared/lib/helpers/object.js | /**
* Convert Object<Boolean> to bitmap
* @param {Object<Boolean>} o ex: { announcements: true, features: false, newsletter: false, beta: false }
* @returns {Number} bitmap
*/
export const toBitMap = (o = {}) => Object.keys(o).reduce((acc, key, index) => acc + (o[key] << index), 0);
/**
* Define an Object from a bitmap value
* @param {Number} value bitmap
* @param {Array<String>} keys ex: ['announcements', 'features', 'newsletter', 'beta']
* @returns {Object<Boolean>} ex: { announcements: true, features: false, newsletter: false, beta: false }
*/
export const fromBitmap = (value, keys = []) =>
keys.reduce((acc, key, index) => {
acc[key] = !!(value & (1 << index));
return acc;
}, {});
| /**
* Convert Object<Boolean> to bitmap
* @param {Object<Boolean>} o ex: { announcements: true, features: false, newsletter: false, beta: false }
* @returns {Number} bitmap
*/
export const toBitMap = (o = {}) => Object.keys(o).reduce((acc, key, index) => acc + (o[key] << index), 0);
/**
* Define an Object from a bitmap value
* @param {Number} value bitmap
* @param {Array<String>} keys ex: ['announcements', 'features', 'newsletter', 'beta']
* @returns {Object<Boolean>} ex: { announcements: true, features: false, newsletter: false, beta: false }
*/
export const fromBitmap = (value, keys = []) =>
keys.reduce((acc, key, index) => {
acc[key] = !!(value & (1 << index));
return acc;
}, {});
/**
* This method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.
* @param {object} model The source object.
* @param {Array} properties The property paths to omit.
* @retuns {Object} Returns the new object.
*/
export const omit = (model, properties = []) => {
return Object.entries(model)
.filter(([key]) => !properties.includes(key))
.reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {});
};
| Add omit helper for Object | Add omit helper for Object
| JavaScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | javascript | ## Code Before:
/**
* Convert Object<Boolean> to bitmap
* @param {Object<Boolean>} o ex: { announcements: true, features: false, newsletter: false, beta: false }
* @returns {Number} bitmap
*/
export const toBitMap = (o = {}) => Object.keys(o).reduce((acc, key, index) => acc + (o[key] << index), 0);
/**
* Define an Object from a bitmap value
* @param {Number} value bitmap
* @param {Array<String>} keys ex: ['announcements', 'features', 'newsletter', 'beta']
* @returns {Object<Boolean>} ex: { announcements: true, features: false, newsletter: false, beta: false }
*/
export const fromBitmap = (value, keys = []) =>
keys.reduce((acc, key, index) => {
acc[key] = !!(value & (1 << index));
return acc;
}, {});
## Instruction:
Add omit helper for Object
## Code After:
/**
* Convert Object<Boolean> to bitmap
* @param {Object<Boolean>} o ex: { announcements: true, features: false, newsletter: false, beta: false }
* @returns {Number} bitmap
*/
export const toBitMap = (o = {}) => Object.keys(o).reduce((acc, key, index) => acc + (o[key] << index), 0);
/**
* Define an Object from a bitmap value
* @param {Number} value bitmap
* @param {Array<String>} keys ex: ['announcements', 'features', 'newsletter', 'beta']
* @returns {Object<Boolean>} ex: { announcements: true, features: false, newsletter: false, beta: false }
*/
export const fromBitmap = (value, keys = []) =>
keys.reduce((acc, key, index) => {
acc[key] = !!(value & (1 << index));
return acc;
}, {});
/**
* This method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.
* @param {object} model The source object.
* @param {Array} properties The property paths to omit.
* @retuns {Object} Returns the new object.
*/
export const omit = (model, properties = []) => {
return Object.entries(model)
.filter(([key]) => !properties.includes(key))
.reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {});
};
| /**
* Convert Object<Boolean> to bitmap
* @param {Object<Boolean>} o ex: { announcements: true, features: false, newsletter: false, beta: false }
* @returns {Number} bitmap
*/
export const toBitMap = (o = {}) => Object.keys(o).reduce((acc, key, index) => acc + (o[key] << index), 0);
/**
* Define an Object from a bitmap value
* @param {Number} value bitmap
* @param {Array<String>} keys ex: ['announcements', 'features', 'newsletter', 'beta']
* @returns {Object<Boolean>} ex: { announcements: true, features: false, newsletter: false, beta: false }
*/
export const fromBitmap = (value, keys = []) =>
keys.reduce((acc, key, index) => {
acc[key] = !!(value & (1 << index));
return acc;
}, {});
+
+ /**
+ * This method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.
+ * @param {object} model The source object.
+ * @param {Array} properties The property paths to omit.
+ * @retuns {Object} Returns the new object.
+ */
+ export const omit = (model, properties = []) => {
+ return Object.entries(model)
+ .filter(([key]) => !properties.includes(key))
+ .reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {});
+ }; | 12 | 0.666667 | 12 | 0 |
568ec5b7e4c4ddb3d30b06452881b70fbb2b8089 | README.md | README.md | Garoa Push
==========
The bridge between the [Garoa Status][garoa-status] API and your smartphone: the easiest way to know when the [Garoa Hacker Club][garoa] is opened or closed - powered by [Pushbullet][pushbullet].
## The development environment
You have to create a test application using [Pushbullet's dashboard][pushbullet-createapp], then add its credentials to your `.env` file.
# Create an .env file from the template
cp .env.template .env
# Edit it as needed
vim .env
# Inside a virtualenv
pip install -r requirements.txt
python manage.py migrate
# Launch the three services on different terminals
python manage.py runserver
python manage.py rqworker default
rqscheduler
[garoa]: https://garoa.net.br/
[garoa-status]: http://status.garoa.net.br/
[pushbullet]: https://www.pushbullet.com/
[pushbullet-createapp]: https://www.pushbullet.com/create-client
| Garoa Push
==========
The bridge between the [Garoa Status][garoa-status] API and your smartphone: the easiest way to know when the [Garoa Hacker Club][garoa] is opened or closed - powered by [Pushbullet][pushbullet].
## The development environment
You have to create a test application using [Pushbullet's dashboard][pushbullet-createapp], then add its credentials to your `.env` file.
# Create an .env file from the template
cp .env.template .env
# Edit it as needed
vim .env
# Inside a virtualenv
pip install -r requirements.txt
python manage.py migrate
# Launch the three services on different terminals
python manage.py runserver
python manage.py rqworker default
rqscheduler
# Add the notification task to the scheduler
python manage.py schedule-task
[garoa]: https://garoa.net.br/
[garoa-status]: http://status.garoa.net.br/
[pushbullet]: https://www.pushbullet.com/
[pushbullet-createapp]: https://www.pushbullet.com/create-client
| Add a note about the notification task | Add a note about the notification task
| Markdown | mit | myhro/garoa-push | markdown | ## Code Before:
Garoa Push
==========
The bridge between the [Garoa Status][garoa-status] API and your smartphone: the easiest way to know when the [Garoa Hacker Club][garoa] is opened or closed - powered by [Pushbullet][pushbullet].
## The development environment
You have to create a test application using [Pushbullet's dashboard][pushbullet-createapp], then add its credentials to your `.env` file.
# Create an .env file from the template
cp .env.template .env
# Edit it as needed
vim .env
# Inside a virtualenv
pip install -r requirements.txt
python manage.py migrate
# Launch the three services on different terminals
python manage.py runserver
python manage.py rqworker default
rqscheduler
[garoa]: https://garoa.net.br/
[garoa-status]: http://status.garoa.net.br/
[pushbullet]: https://www.pushbullet.com/
[pushbullet-createapp]: https://www.pushbullet.com/create-client
## Instruction:
Add a note about the notification task
## Code After:
Garoa Push
==========
The bridge between the [Garoa Status][garoa-status] API and your smartphone: the easiest way to know when the [Garoa Hacker Club][garoa] is opened or closed - powered by [Pushbullet][pushbullet].
## The development environment
You have to create a test application using [Pushbullet's dashboard][pushbullet-createapp], then add its credentials to your `.env` file.
# Create an .env file from the template
cp .env.template .env
# Edit it as needed
vim .env
# Inside a virtualenv
pip install -r requirements.txt
python manage.py migrate
# Launch the three services on different terminals
python manage.py runserver
python manage.py rqworker default
rqscheduler
# Add the notification task to the scheduler
python manage.py schedule-task
[garoa]: https://garoa.net.br/
[garoa-status]: http://status.garoa.net.br/
[pushbullet]: https://www.pushbullet.com/
[pushbullet-createapp]: https://www.pushbullet.com/create-client
| Garoa Push
==========
The bridge between the [Garoa Status][garoa-status] API and your smartphone: the easiest way to know when the [Garoa Hacker Club][garoa] is opened or closed - powered by [Pushbullet][pushbullet].
## The development environment
You have to create a test application using [Pushbullet's dashboard][pushbullet-createapp], then add its credentials to your `.env` file.
# Create an .env file from the template
cp .env.template .env
# Edit it as needed
vim .env
# Inside a virtualenv
pip install -r requirements.txt
python manage.py migrate
# Launch the three services on different terminals
python manage.py runserver
python manage.py rqworker default
rqscheduler
+ # Add the notification task to the scheduler
+ python manage.py schedule-task
+
[garoa]: https://garoa.net.br/
[garoa-status]: http://status.garoa.net.br/
[pushbullet]: https://www.pushbullet.com/
[pushbullet-createapp]: https://www.pushbullet.com/create-client | 3 | 0.111111 | 3 | 0 |
ac4a59c6e5a30cbbfb096efe38afd119087e6359 | NOTES.md | NOTES.md |
- https://github.com/vangware/fontawesome-iconset
|
- https://github.com/vangware/fontawesome-iconset
- Apparently a company has released a polymer that can cure via the light a LCD emits
- http://www.photocentric3d.com/#!blank/thd1s
| Add some more notes about new resin development | Add some more notes about new resin development
| Markdown | apache-2.0 | DanielJoyce/microtome,DanielJoyce/microtome,Microtome/microtome,DanielJoyce/microtome,Microtome/microtome,DanielJoyce/microtome,Microtome/microtome | markdown | ## Code Before:
- https://github.com/vangware/fontawesome-iconset
## Instruction:
Add some more notes about new resin development
## Code After:
- https://github.com/vangware/fontawesome-iconset
- Apparently a company has released a polymer that can cure via the light a LCD emits
- http://www.photocentric3d.com/#!blank/thd1s
|
- https://github.com/vangware/fontawesome-iconset
+
+ - Apparently a company has released a polymer that can cure via the light a LCD emits
+ - http://www.photocentric3d.com/#!blank/thd1s | 3 | 1.5 | 3 | 0 |
7a045fa53fecfbc6bc955feed52a1aae5a160703 | app/models/hbx_enrollment_exemption.rb | app/models/hbx_enrollment_exemption.rb | class EnrollmentExemption
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Versioning
include Mongoid::Paranoia
# TYPES = %w[]
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
auto_increment :_id
field :certificate_number, type: String
field :kind, type: String
field :start_date, type: Date
field :end_date, type: Date
embedded_in :application_group
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
validates :kind,
presence: true,
allow_blank: false,
allow_nil: false,
inclusion: {in: KINDS}
end
| class HbxEnrollmentExemption
include Mongoid::Document
include Mongoid::Timestamps
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
embedded_in :application_group
auto_increment :_id, seed: 9999
field :kind, type: String
field :certificate_number, type: String
field :start_date, type: Date
field :end_date, type: Date
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
validates :kind,
presence: true,
allow_blank: false,
allow_nil: false,
inclusion: {in: KINDS}
end
| Rename class name and fields to comply with system conventions | Rename class name and fields to comply with system conventions
| Ruby | mit | dchbx/gluedb,dchbx/gluedb,dchbx/gluedb,dchbx/gluedb | ruby | ## Code Before:
class EnrollmentExemption
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Versioning
include Mongoid::Paranoia
# TYPES = %w[]
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
auto_increment :_id
field :certificate_number, type: String
field :kind, type: String
field :start_date, type: Date
field :end_date, type: Date
embedded_in :application_group
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
validates :kind,
presence: true,
allow_blank: false,
allow_nil: false,
inclusion: {in: KINDS}
end
## Instruction:
Rename class name and fields to comply with system conventions
## Code After:
class HbxEnrollmentExemption
include Mongoid::Document
include Mongoid::Timestamps
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
embedded_in :application_group
auto_increment :_id, seed: 9999
field :kind, type: String
field :certificate_number, type: String
field :start_date, type: Date
field :end_date, type: Date
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
validates :kind,
presence: true,
allow_blank: false,
allow_nil: false,
inclusion: {in: KINDS}
end
| - class EnrollmentExemption
+ class HbxEnrollmentExemption
? +++
include Mongoid::Document
include Mongoid::Timestamps
- include Mongoid::Versioning
- include Mongoid::Paranoia
- # TYPES = %w[]
KINDS = %W[hardship health_care_ministry_member incarceration indian_tribe_member religious_conscience]
+ embedded_in :application_group
+
- auto_increment :_id
+ auto_increment :_id, seed: 9999
? ++++++++++++
+ field :kind, type: String
field :certificate_number, type: String
- field :kind, type: String
field :start_date, type: Date
field :end_date, type: Date
-
- embedded_in :application_group
embeds_many :comments
accepts_nested_attributes_for :comments, reject_if: proc { |attribs| attribs['content'].blank? }, allow_destroy: true
validates :kind,
presence: true,
allow_blank: false,
allow_nil: false,
inclusion: {in: KINDS}
end | 13 | 0.481481 | 5 | 8 |
16dfa9b72e46545f03ec76cb6fbf9d793f64e640 | app/views/users/index.html.erb | app/views/users/index.html.erb | <% title "Utilisateurs" %>
<div class="grid_9 center">
<%= action_links do %>
<%= link_to "Nouvel utilisateur", new_user_path %>
<% end %>
<table class="list pretty">
<tr>
<th>Nom</th>
<th>Mode d'authentification</th>
<th></th>
</tr>
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, edit_user_path(user) %></td>
<td><%= user.provider %> / <%= user.uid %></td>
<td><%= link_to_delete user %></td>
</tr>
<% end %>
</table>
</div>
| <% title "Utilisateurs" %>
<div class="grid_9 center">
<%= action_links do %>
<%= link_to "Nouvel utilisateur", new_user_path %>
<% end %>
<table class="list pretty">
<tr>
<th>Nom</th>
<th>Mode d'authentification</th>
<th></th>
</tr>
<tbody class="long-list">
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, edit_user_path(user) %></td>
<td><%= user.provider %> / <%= user.uid %></td>
<td><%= link_to_delete user %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
| Apply 'long-list' CSS class in users/index | Apply 'long-list' CSS class in users/index
| HTML+ERB | mit | jbbarth/cartoque,jbbarth/cartoque,cartoque/cartoque,jbbarth/cartoque,cartoque/cartoque,skylost/cartoque,skylost/cartoque,cartoque/cartoque | html+erb | ## Code Before:
<% title "Utilisateurs" %>
<div class="grid_9 center">
<%= action_links do %>
<%= link_to "Nouvel utilisateur", new_user_path %>
<% end %>
<table class="list pretty">
<tr>
<th>Nom</th>
<th>Mode d'authentification</th>
<th></th>
</tr>
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, edit_user_path(user) %></td>
<td><%= user.provider %> / <%= user.uid %></td>
<td><%= link_to_delete user %></td>
</tr>
<% end %>
</table>
</div>
## Instruction:
Apply 'long-list' CSS class in users/index
## Code After:
<% title "Utilisateurs" %>
<div class="grid_9 center">
<%= action_links do %>
<%= link_to "Nouvel utilisateur", new_user_path %>
<% end %>
<table class="list pretty">
<tr>
<th>Nom</th>
<th>Mode d'authentification</th>
<th></th>
</tr>
<tbody class="long-list">
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, edit_user_path(user) %></td>
<td><%= user.provider %> / <%= user.uid %></td>
<td><%= link_to_delete user %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
| <% title "Utilisateurs" %>
<div class="grid_9 center">
<%= action_links do %>
<%= link_to "Nouvel utilisateur", new_user_path %>
<% end %>
<table class="list pretty">
<tr>
<th>Nom</th>
<th>Mode d'authentification</th>
<th></th>
</tr>
+ <tbody class="long-list">
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, edit_user_path(user) %></td>
<td><%= user.provider %> / <%= user.uid %></td>
<td><%= link_to_delete user %></td>
</tr>
<% end %>
+ </tbody>
</table>
</div> | 2 | 0.083333 | 2 | 0 |
884d22aa7a9f9784537fe4adbaf6cf86689aa60a | haproxy/rebuild.sh | haproxy/rebuild.sh | pushd "$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )" > /dev/null
PORT=$1
OLD_CONTAINER=`docker-compose ps -q haproxy`
if [ -z ${PORT} ]; then
echo "No port specified, looking up current port in haproxy container..."
PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
read -p "Rebuilding with backend route to port '${PORT}', OK? [y/N] " yn
case $yn in
[Yy]*)
;;
*)
echo "usage: $0 [PORT]"
exit 1
;;
esac
fi
docker-compose build haproxy || exit 1
docker-compose up -d haproxy || exit 1
NEW_CONTAINER=`docker-compose ps -q haproxy`
echo "Rebuild complete, rerouting backend..."
docker exec ${NEW_CONTAINER} ./route-backend.sh ${PORT}
popd > /dev/null
| pushd "$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )" > /dev/null
PORT=$1
OLD_CONTAINER=`docker-compose ps -q haproxy`
if [ -z ${PORT} ]; then
echo "No port specified, looking up current port in haproxy container..."
PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | grep \"\-\-dport 8080\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
read -p "Rebuilding with backend route to port '${PORT}', OK? [y/N] " yn
case $yn in
[Yy]*)
;;
*)
echo "usage: $0 [PORT]"
exit 1
;;
esac
fi
docker-compose build haproxy || exit 1
docker-compose up -d haproxy || exit 1
NEW_CONTAINER=`docker-compose ps -q haproxy`
echo "Rebuild complete, rerouting backend..."
docker exec ${NEW_CONTAINER} ./route-backend.sh ${PORT}
popd > /dev/null
| Add grep clause to narrow down port search to dport 8080 | Add grep clause to narrow down port search to dport 8080
| Shell | mit | Turistforeningen/sherpa-prod,Turistforeningen/sherpa-prod,Turistforeningen/sherpa-prod | shell | ## Code Before:
pushd "$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )" > /dev/null
PORT=$1
OLD_CONTAINER=`docker-compose ps -q haproxy`
if [ -z ${PORT} ]; then
echo "No port specified, looking up current port in haproxy container..."
PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
read -p "Rebuilding with backend route to port '${PORT}', OK? [y/N] " yn
case $yn in
[Yy]*)
;;
*)
echo "usage: $0 [PORT]"
exit 1
;;
esac
fi
docker-compose build haproxy || exit 1
docker-compose up -d haproxy || exit 1
NEW_CONTAINER=`docker-compose ps -q haproxy`
echo "Rebuild complete, rerouting backend..."
docker exec ${NEW_CONTAINER} ./route-backend.sh ${PORT}
popd > /dev/null
## Instruction:
Add grep clause to narrow down port search to dport 8080
## Code After:
pushd "$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )" > /dev/null
PORT=$1
OLD_CONTAINER=`docker-compose ps -q haproxy`
if [ -z ${PORT} ]; then
echo "No port specified, looking up current port in haproxy container..."
PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | grep \"\-\-dport 8080\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
read -p "Rebuilding with backend route to port '${PORT}', OK? [y/N] " yn
case $yn in
[Yy]*)
;;
*)
echo "usage: $0 [PORT]"
exit 1
;;
esac
fi
docker-compose build haproxy || exit 1
docker-compose up -d haproxy || exit 1
NEW_CONTAINER=`docker-compose ps -q haproxy`
echo "Rebuild complete, rerouting backend..."
docker exec ${NEW_CONTAINER} ./route-backend.sh ${PORT}
popd > /dev/null
| pushd "$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) )" > /dev/null
PORT=$1
OLD_CONTAINER=`docker-compose ps -q haproxy`
if [ -z ${PORT} ]; then
echo "No port specified, looking up current port in haproxy container..."
- PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
+ PORT=`docker exec ${OLD_CONTAINER} /bin/bash -c "iptables -t nat -S | grep \"\-A OUTPUT\" | grep \"\-\-dport 8080\" | sed -r 's/^.+ --to-destination :([0-9]+)$/\1/'"`
? ++++++++++++++++++++++++++
read -p "Rebuilding with backend route to port '${PORT}', OK? [y/N] " yn
case $yn in
[Yy]*)
;;
*)
echo "usage: $0 [PORT]"
exit 1
;;
esac
fi
docker-compose build haproxy || exit 1
docker-compose up -d haproxy || exit 1
NEW_CONTAINER=`docker-compose ps -q haproxy`
echo "Rebuild complete, rerouting backend..."
docker exec ${NEW_CONTAINER} ./route-backend.sh ${PORT}
popd > /dev/null | 2 | 0.076923 | 1 | 1 |
84a9337ffb7535786a3f22d5f91ba5938408a75c | ci/get_hdf5_if_needed.sh | ci/get_hdf5_if_needed.sh |
set -e
if [ -z ${HDF5_DIR+x} ]; then
echo "Using OS HDF5"
else
echo "Using downloaded HDF5"
if [ -z ${HDF5_MPI+x} ]; then
echo "Building serial"
EXTRA_MPI_FLAGS=''
else
echo "Building with MPI"
EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
lib_name=libhdf5.dylib
else
lib_name=libhdf5.so
fi
if [ -f $HDF5_DIR/lib/$lib_name ]; then
echo "using cached build"
else
pushd /tmp
# Remove trailing .*, to get e.g. '1.12' ↓
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
pushd hdf5-$HDF5_VERSION
chmod u+x autogen.sh
./configure --prefix --enable-tests=no $HDF5_DIR $EXTRA_MPI_FLAGS
make -j $(nproc)
make install
popd
popd
fi
fi
|
set -e
if [ -z ${HDF5_DIR+x} ]; then
echo "Using OS HDF5"
else
echo "Using downloaded HDF5"
if [ -z ${HDF5_MPI+x} ]; then
echo "Building serial"
EXTRA_MPI_FLAGS=''
else
echo "Building with MPI"
EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
lib_name=libhdf5.dylib
else
lib_name=libhdf5.so
fi
if [ -f $HDF5_DIR/lib/$lib_name ]; then
echo "using cached build"
else
pushd /tmp
# Remove trailing .*, to get e.g. '1.12' ↓
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
pushd hdf5-$HDF5_VERSION
chmod u+x autogen.sh
./configure --prefix $HDF5_DIR --enable-tests=no $EXTRA_MPI_FLAGS
make -j $(nproc)
make install
popd
popd
fi
fi
| Fix argument order for ./configure | Fix argument order for ./configure
| Shell | bsd-3-clause | h5py/h5py,h5py/h5py,h5py/h5py | shell | ## Code Before:
set -e
if [ -z ${HDF5_DIR+x} ]; then
echo "Using OS HDF5"
else
echo "Using downloaded HDF5"
if [ -z ${HDF5_MPI+x} ]; then
echo "Building serial"
EXTRA_MPI_FLAGS=''
else
echo "Building with MPI"
EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
lib_name=libhdf5.dylib
else
lib_name=libhdf5.so
fi
if [ -f $HDF5_DIR/lib/$lib_name ]; then
echo "using cached build"
else
pushd /tmp
# Remove trailing .*, to get e.g. '1.12' ↓
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
pushd hdf5-$HDF5_VERSION
chmod u+x autogen.sh
./configure --prefix --enable-tests=no $HDF5_DIR $EXTRA_MPI_FLAGS
make -j $(nproc)
make install
popd
popd
fi
fi
## Instruction:
Fix argument order for ./configure
## Code After:
set -e
if [ -z ${HDF5_DIR+x} ]; then
echo "Using OS HDF5"
else
echo "Using downloaded HDF5"
if [ -z ${HDF5_MPI+x} ]; then
echo "Building serial"
EXTRA_MPI_FLAGS=''
else
echo "Building with MPI"
EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
lib_name=libhdf5.dylib
else
lib_name=libhdf5.so
fi
if [ -f $HDF5_DIR/lib/$lib_name ]; then
echo "using cached build"
else
pushd /tmp
# Remove trailing .*, to get e.g. '1.12' ↓
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
pushd hdf5-$HDF5_VERSION
chmod u+x autogen.sh
./configure --prefix $HDF5_DIR --enable-tests=no $EXTRA_MPI_FLAGS
make -j $(nproc)
make install
popd
popd
fi
fi
|
set -e
if [ -z ${HDF5_DIR+x} ]; then
echo "Using OS HDF5"
else
echo "Using downloaded HDF5"
if [ -z ${HDF5_MPI+x} ]; then
echo "Building serial"
EXTRA_MPI_FLAGS=''
else
echo "Building with MPI"
EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
lib_name=libhdf5.dylib
else
lib_name=libhdf5.so
fi
if [ -f $HDF5_DIR/lib/$lib_name ]; then
echo "using cached build"
else
pushd /tmp
# Remove trailing .*, to get e.g. '1.12' ↓
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
pushd hdf5-$HDF5_VERSION
chmod u+x autogen.sh
- ./configure --prefix --enable-tests=no $HDF5_DIR $EXTRA_MPI_FLAGS
? ----------
+ ./configure --prefix $HDF5_DIR --enable-tests=no $EXTRA_MPI_FLAGS
? ++++++++++
make -j $(nproc)
make install
popd
popd
fi
fi | 2 | 0.054054 | 1 | 1 |
76e8a56cee1955f50888e952f88e221932c9a3c1 | src/utils/children.ts | src/utils/children.ts | import * as React from 'react';
const childrenToMap = (children: React.ReactNode): Map<string, React.ReactChild> => {
const childrenArray = React.Children.toArray(children);
const childMap: Map<string, React.ReactChild> = new Map();
childrenArray.forEach((child) => {
childMap.set(child.key, child);
});
return childMap;
};
const compareChildren = (children1: Map<string, React.ReactNode>, children2: Map<string, React.ReactNode>): boolean => {
const keys1 = Array.from(children1.keys());
const keys2 = Array.from(children2.keys());
return keys1 === keys2;
};
export {
childrenToMap,
compareChildren,
} | import * as React from 'react';
const childrenToMap = (children?: any): Map<string, React.ReactElement<any>> => {
const childMap: Map<string, React.ReactElement<any>> = new Map();
if (!children) return childMap;
React.Children.forEach(children, (child) => {
if (React.isValidElement(child)) {
childMap.set(<string>child.key, child)
}
});
return childMap;
};
const compareChildren = (children1: Map<string, React.ReactNode>, children2: Map<string, React.ReactNode>): boolean => {
const keys1 = Array.from(children1.keys());
const keys2 = Array.from(children2.keys());
return keys1 === keys2;
};
export {
childrenToMap,
compareChildren,
} | Change to implement type safety | Change to implement type safety
| TypeScript | mit | bkazi/react-layout-transition,bkazi/react-layout-transition,bkazi/react-layout-transition | typescript | ## Code Before:
import * as React from 'react';
const childrenToMap = (children: React.ReactNode): Map<string, React.ReactChild> => {
const childrenArray = React.Children.toArray(children);
const childMap: Map<string, React.ReactChild> = new Map();
childrenArray.forEach((child) => {
childMap.set(child.key, child);
});
return childMap;
};
const compareChildren = (children1: Map<string, React.ReactNode>, children2: Map<string, React.ReactNode>): boolean => {
const keys1 = Array.from(children1.keys());
const keys2 = Array.from(children2.keys());
return keys1 === keys2;
};
export {
childrenToMap,
compareChildren,
}
## Instruction:
Change to implement type safety
## Code After:
import * as React from 'react';
const childrenToMap = (children?: any): Map<string, React.ReactElement<any>> => {
const childMap: Map<string, React.ReactElement<any>> = new Map();
if (!children) return childMap;
React.Children.forEach(children, (child) => {
if (React.isValidElement(child)) {
childMap.set(<string>child.key, child)
}
});
return childMap;
};
const compareChildren = (children1: Map<string, React.ReactNode>, children2: Map<string, React.ReactNode>): boolean => {
const keys1 = Array.from(children1.keys());
const keys2 = Array.from(children2.keys());
return keys1 === keys2;
};
export {
childrenToMap,
compareChildren,
} | import * as React from 'react';
- const childrenToMap = (children: React.ReactNode): Map<string, React.ReactChild> => {
? -- ^^^^^^^^^^^^ ^^^ ^
+ const childrenToMap = (children?: any): Map<string, React.ReactElement<any>> => {
? + ^^ ^ ^^^^^^^^^^
- const childrenArray = React.Children.toArray(children);
- const childMap: Map<string, React.ReactChild> = new Map();
? ^^^ ^
+ const childMap: Map<string, React.ReactElement<any>> = new Map();
? ^ ^^^^^^^^^^
+ if (!children) return childMap;
- childrenArray.forEach((child) => {
? -----
+ React.Children.forEach(children, (child) => {
? +++ +++ ++++++++++
+ if (React.isValidElement(child)) {
- childMap.set(child.key, child);
? -
+ childMap.set(<string>child.key, child)
? ++++++++ ++++++++
+ }
- });
+ });
? ++++
return childMap;
};
const compareChildren = (children1: Map<string, React.ReactNode>, children2: Map<string, React.ReactNode>): boolean => {
const keys1 = Array.from(children1.keys());
const keys2 = Array.from(children2.keys());
return keys1 === keys2;
};
export {
childrenToMap,
compareChildren,
} | 14 | 0.636364 | 8 | 6 |
129144c9192443cd5bac714433e32974ade9d7e0 | requirements-test.txt | requirements-test.txt | pytest==3.2.2
pytest-cov==2.5.1
python-coveralls==2.9.1
pillow==6.0.0 | pytest==4.4.0
pytest-cov==2.5.1
python-coveralls==2.9.1
pillow==6.0.0
pytest-xdist==1.28.0
| Update pytest and add pytest-xdist | chore: Update pytest and add pytest-xdist
To enable parallel testing | Text | mit | andreroggeri/pynubank | text | ## Code Before:
pytest==3.2.2
pytest-cov==2.5.1
python-coveralls==2.9.1
pillow==6.0.0
## Instruction:
chore: Update pytest and add pytest-xdist
To enable parallel testing
## Code After:
pytest==4.4.0
pytest-cov==2.5.1
python-coveralls==2.9.1
pillow==6.0.0
pytest-xdist==1.28.0
| - pytest==3.2.2
? ^ ^ ^
+ pytest==4.4.0
? ^ ^ ^
pytest-cov==2.5.1
python-coveralls==2.9.1
pillow==6.0.0
+ pytest-xdist==1.28.0 | 3 | 0.75 | 2 | 1 |
87ad3ceb34072fd7ecbf3621c50282ec79dfaa03 | .circleci/config.yml | .circleci/config.yml | version: 2
jobs:
build:
machine:
image: circleci/classic:latest
steps:
- checkout
- run:
name: Install build tools
command: sudo apt-get update && sudo apt-get install build-essential cpio squashfs-tools debootstrap realpath
- run:
name: Prepare branches
command: cp .circleci/branches.yaml platform/upload/branches.yaml && echo "ci" >platform/upload/BRANCH_NAME
- run:
name: Construct build chroot
command: HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/create.sh
- run:
name: Import gpg key
command: echo "gpg --batch --no-tty --yes --import /homeworld/.circleci/ci-key-private.asc" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Check gpg key presence
command: echo "gpg --list-secret-keys" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Launch build with bazel
command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
| version: 2
jobs:
build:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install build tools
command: sudo apt-get update && sudo apt-get install build-essential cpio squashfs-tools debootstrap realpath
- run:
name: Prepare branches
command: cp .circleci/branches.yaml platform/upload/branches.yaml && echo "ci" >platform/upload/BRANCH_NAME
- run:
name: Construct build chroot
command: HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/create.sh
- run:
name: Import gpg key
command: echo "gpg --batch --no-tty --yes --import /homeworld/.circleci/ci-key-private.asc" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Check gpg key presence
command: echo "gpg --list-secret-keys" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Launch build with bazel
command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
| Use ubuntu 16.04 image for CircleCI | ci: Use ubuntu 16.04 image for CircleCI
This is the image recommended by the documentation:
https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
| YAML | mit | sipb/homeworld,sipb/homeworld,sipb/homeworld,sipb/homeworld | yaml | ## Code Before:
version: 2
jobs:
build:
machine:
image: circleci/classic:latest
steps:
- checkout
- run:
name: Install build tools
command: sudo apt-get update && sudo apt-get install build-essential cpio squashfs-tools debootstrap realpath
- run:
name: Prepare branches
command: cp .circleci/branches.yaml platform/upload/branches.yaml && echo "ci" >platform/upload/BRANCH_NAME
- run:
name: Construct build chroot
command: HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/create.sh
- run:
name: Import gpg key
command: echo "gpg --batch --no-tty --yes --import /homeworld/.circleci/ci-key-private.asc" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Check gpg key presence
command: echo "gpg --list-secret-keys" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Launch build with bazel
command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
## Instruction:
ci: Use ubuntu 16.04 image for CircleCI
This is the image recommended by the documentation:
https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
## Code After:
version: 2
jobs:
build:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install build tools
command: sudo apt-get update && sudo apt-get install build-essential cpio squashfs-tools debootstrap realpath
- run:
name: Prepare branches
command: cp .circleci/branches.yaml platform/upload/branches.yaml && echo "ci" >platform/upload/BRANCH_NAME
- run:
name: Construct build chroot
command: HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/create.sh
- run:
name: Import gpg key
command: echo "gpg --batch --no-tty --yes --import /homeworld/.circleci/ci-key-private.asc" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Check gpg key presence
command: echo "gpg --list-secret-keys" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Launch build with bazel
command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
| version: 2
jobs:
build:
machine:
- image: circleci/classic:latest
+ image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install build tools
command: sudo apt-get update && sudo apt-get install build-essential cpio squashfs-tools debootstrap realpath
- run:
name: Prepare branches
command: cp .circleci/branches.yaml platform/upload/branches.yaml && echo "ci" >platform/upload/BRANCH_NAME
- run:
name: Construct build chroot
command: HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/create.sh
- run:
name: Import gpg key
command: echo "gpg --batch --no-tty --yes --import /homeworld/.circleci/ci-key-private.asc" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Check gpg key presence
command: echo "gpg --list-secret-keys" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh
- run:
name: Launch build with bazel
command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh | 2 | 0.08 | 1 | 1 |
21ac8f2e49e137a49b1fb4255e9c34e0d29fa2b0 | node-modules.zsh | node-modules.zsh |
set -e
set -u
node_modules=()
command -v npm >/dev/null 2>&1 || exit 0
npm config set sign-git-tag true
node_modules+=('bower@^1.8.0')
node_modules+=('brunch@^2.8.2')
node_modules+=('ember-cli@^2.7.0')
node_modules+=('gh-home@^1.4.1')
node_modules+=('grunt-cli@^1.2.0')
node_modules+=('gulp-cli@^1.2.2')
node_modules+=('jsctags@^5.0.1')
node_modules+=('json-diff@^0.5.2')
node_modules+=('tern@^0.21.0')
npm install --global ${node_modules}
exit
|
set -e
set -u
node_modules=()
command -v npm >/dev/null 2>&1 || exit 0
npm config set sign-git-tag true
node_modules+=('bower@^1.8.0')
node_modules+=('gh-home@^1.4.1')
node_modules+=('jsctags@^5.0.1')
node_modules+=('json-diff@^0.5.2')
node_modules+=('tern@^0.21.0')
npm install --global ${node_modules}
exit
| Remove some node CLI tools | Remove some node CLI tools
| Shell | mit | rxrc/dotfiles,rxrc/dotfiles,rxrc/dotfiles | shell | ## Code Before:
set -e
set -u
node_modules=()
command -v npm >/dev/null 2>&1 || exit 0
npm config set sign-git-tag true
node_modules+=('bower@^1.8.0')
node_modules+=('brunch@^2.8.2')
node_modules+=('ember-cli@^2.7.0')
node_modules+=('gh-home@^1.4.1')
node_modules+=('grunt-cli@^1.2.0')
node_modules+=('gulp-cli@^1.2.2')
node_modules+=('jsctags@^5.0.1')
node_modules+=('json-diff@^0.5.2')
node_modules+=('tern@^0.21.0')
npm install --global ${node_modules}
exit
## Instruction:
Remove some node CLI tools
## Code After:
set -e
set -u
node_modules=()
command -v npm >/dev/null 2>&1 || exit 0
npm config set sign-git-tag true
node_modules+=('bower@^1.8.0')
node_modules+=('gh-home@^1.4.1')
node_modules+=('jsctags@^5.0.1')
node_modules+=('json-diff@^0.5.2')
node_modules+=('tern@^0.21.0')
npm install --global ${node_modules}
exit
|
set -e
set -u
node_modules=()
command -v npm >/dev/null 2>&1 || exit 0
npm config set sign-git-tag true
node_modules+=('bower@^1.8.0')
- node_modules+=('brunch@^2.8.2')
- node_modules+=('ember-cli@^2.7.0')
node_modules+=('gh-home@^1.4.1')
- node_modules+=('grunt-cli@^1.2.0')
- node_modules+=('gulp-cli@^1.2.2')
node_modules+=('jsctags@^5.0.1')
node_modules+=('json-diff@^0.5.2')
node_modules+=('tern@^0.21.0')
npm install --global ${node_modules}
exit | 4 | 0.173913 | 0 | 4 |
1a568009721ee667bc69bbbe2a8fe80106865828 | lib/dry/types/builder_methods.rb | lib/dry/types/builder_methods.rb | module Dry
module Types
module BuilderMethods
def Array(type)
self::Array.of(type)
end
def Hash(schema, type_map)
self::Hash.public_send(schema, type_map)
end
def Instance(klass)
Definition.new(klass).constrained(type: klass)
end
def Value(value)
Definition.new(value.class).constrained(eql: value)
end
def Constant(object)
Definition.new(object.class).constrained(equal: object)
end
def Constructor(klass, cons = nil, &block)
Definition.new(klass).constructor(cons || block)
end
end
end
end
| module Dry
module Types
module BuilderMethods
# Build an array type.
# It is a shortcut for Array.of
#
# @example
# Types::Strings = Types.Array(Types::String)
#
# @param [Dry::Types::Type] type
#
# @return [Dry::Types::Array]
def Array(type)
self::Array.of(type)
end
# Build a hash schema
#
# @param [Symbol] schema Schema type
# @param [Hash{Symbol => Dry::Types::Type}] type_map
#
# @return [Dry::Types::Array]
# @api public
def Hash(schema, type_map)
self::Hash.public_send(schema, type_map)
end
# Build a type which values are instances of a given class
# Values are checked using `is_a?` call
#
# @param [Class,Module] klass Class or module
#
# @return [Dry::Types::Type]
# @api public
def Instance(klass)
Definition.new(klass).constrained(type: klass)
end
# Build a type with a single value
# The equality check done with `eql?`
#
# @param [Object] value
#
# @return [Dry::Types::Type]
# @api public
def Value(value)
Definition.new(value.class).constrained(eql: value)
end
# Build a type with a single value
# The equality check done with `equal?`
#
# @param [Object] object
#
# @return [Dry::Types::Type]
# @api public
def Constant(object)
Definition.new(object.class).constrained(equal: object)
end
# Build a constructor type
#
# @param [Class] klass
# @param [#call,nil] cons Value constructor
# @param [#call,nil] block Value constructor
#
# @return [Dry::Types::Type]
# @api public
def Constructor(klass, cons = nil, &block)
Definition.new(klass).constructor(cons || block)
end
end
end
end
| Add YARD for type constructores | Add YARD for type constructores [skip ci]
| Ruby | mit | dryrb/dry-data,dryrb/dry-types,dryrb/dry-data,dryrb/dry-types | ruby | ## Code Before:
module Dry
module Types
module BuilderMethods
def Array(type)
self::Array.of(type)
end
def Hash(schema, type_map)
self::Hash.public_send(schema, type_map)
end
def Instance(klass)
Definition.new(klass).constrained(type: klass)
end
def Value(value)
Definition.new(value.class).constrained(eql: value)
end
def Constant(object)
Definition.new(object.class).constrained(equal: object)
end
def Constructor(klass, cons = nil, &block)
Definition.new(klass).constructor(cons || block)
end
end
end
end
## Instruction:
Add YARD for type constructores [skip ci]
## Code After:
module Dry
module Types
module BuilderMethods
# Build an array type.
# It is a shortcut for Array.of
#
# @example
# Types::Strings = Types.Array(Types::String)
#
# @param [Dry::Types::Type] type
#
# @return [Dry::Types::Array]
def Array(type)
self::Array.of(type)
end
# Build a hash schema
#
# @param [Symbol] schema Schema type
# @param [Hash{Symbol => Dry::Types::Type}] type_map
#
# @return [Dry::Types::Array]
# @api public
def Hash(schema, type_map)
self::Hash.public_send(schema, type_map)
end
# Build a type which values are instances of a given class
# Values are checked using `is_a?` call
#
# @param [Class,Module] klass Class or module
#
# @return [Dry::Types::Type]
# @api public
def Instance(klass)
Definition.new(klass).constrained(type: klass)
end
# Build a type with a single value
# The equality check done with `eql?`
#
# @param [Object] value
#
# @return [Dry::Types::Type]
# @api public
def Value(value)
Definition.new(value.class).constrained(eql: value)
end
# Build a type with a single value
# The equality check done with `equal?`
#
# @param [Object] object
#
# @return [Dry::Types::Type]
# @api public
def Constant(object)
Definition.new(object.class).constrained(equal: object)
end
# Build a constructor type
#
# @param [Class] klass
# @param [#call,nil] cons Value constructor
# @param [#call,nil] block Value constructor
#
# @return [Dry::Types::Type]
# @api public
def Constructor(klass, cons = nil, &block)
Definition.new(klass).constructor(cons || block)
end
end
end
end
| module Dry
module Types
module BuilderMethods
+ # Build an array type.
+ # It is a shortcut for Array.of
+ #
+ # @example
+ # Types::Strings = Types.Array(Types::String)
+ #
+ # @param [Dry::Types::Type] type
+ #
+ # @return [Dry::Types::Array]
def Array(type)
self::Array.of(type)
end
+ # Build a hash schema
+ #
+ # @param [Symbol] schema Schema type
+ # @param [Hash{Symbol => Dry::Types::Type}] type_map
+ #
+ # @return [Dry::Types::Array]
+ # @api public
def Hash(schema, type_map)
self::Hash.public_send(schema, type_map)
end
+ # Build a type which values are instances of a given class
+ # Values are checked using `is_a?` call
+ #
+ # @param [Class,Module] klass Class or module
+ #
+ # @return [Dry::Types::Type]
+ # @api public
def Instance(klass)
Definition.new(klass).constrained(type: klass)
end
+ # Build a type with a single value
+ # The equality check done with `eql?`
+ #
+ # @param [Object] value
+ #
+ # @return [Dry::Types::Type]
+ # @api public
def Value(value)
Definition.new(value.class).constrained(eql: value)
end
+ # Build a type with a single value
+ # The equality check done with `equal?`
+ #
+ # @param [Object] object
+ #
+ # @return [Dry::Types::Type]
+ # @api public
def Constant(object)
Definition.new(object.class).constrained(equal: object)
end
+ # Build a constructor type
+ #
+ # @param [Class] klass
+ # @param [#call,nil] cons Value constructor
+ # @param [#call,nil] block Value constructor
+ #
+ # @return [Dry::Types::Type]
+ # @api public
def Constructor(klass, cons = nil, &block)
Definition.new(klass).constructor(cons || block)
end
end
end
end | 45 | 1.551724 | 45 | 0 |
6a8040a4e99aa770b88f540a83bede5f96738e80 | lib/base62.rb | lib/base62.rb | require "base62/version"
require "base62/string"
require "base62/integer"
module Base62
PRIMITIVES = (0..9).collect { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a
class << self
def decode(str)
out = 0
str.chars.reverse.each_with_index do |char, index|
place = PRIMITIVES.size ** index
out += PRIMITIVES.index(char) * place
end
out
end
def encode(int)
raise ArgumentError, "Can't Base62 encode negative number (#{int} given)" if int < 0
return "0" if int == 0
rem = int
result = ''
while rem != 0
result = PRIMITIVES[rem % PRIMITIVES.size].to_s + result
rem /= PRIMITIVES.size
end
result
end
end
end | require "base62/version"
require "base62/string"
require "base62/integer"
module Base62
PRIMITIVES = (0..9).collect { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a
class << self
def decode(str)
out = 0
str.chars.reverse.each_with_index do |char, index|
place = PRIMITIVES.size ** index
out += PRIMITIVES.index(char) * place
end
out
end
def encode(int)
raise ArgumentError, "Can't Base62 encode negative number (#{int} given)" if int < 0
return "0" if int == 0
rem = int
result = ''
while rem != 0
result.prepend PRIMITIVES[rem % PRIMITIVES.size]
rem /= PRIMITIVES.size
end
result
end
end
end | Use `prepend` to avoid creating new string objects | Use `prepend` to avoid creating new string objects
| Ruby | mit | jtzemp/base62 | ruby | ## Code Before:
require "base62/version"
require "base62/string"
require "base62/integer"
module Base62
PRIMITIVES = (0..9).collect { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a
class << self
def decode(str)
out = 0
str.chars.reverse.each_with_index do |char, index|
place = PRIMITIVES.size ** index
out += PRIMITIVES.index(char) * place
end
out
end
def encode(int)
raise ArgumentError, "Can't Base62 encode negative number (#{int} given)" if int < 0
return "0" if int == 0
rem = int
result = ''
while rem != 0
result = PRIMITIVES[rem % PRIMITIVES.size].to_s + result
rem /= PRIMITIVES.size
end
result
end
end
end
## Instruction:
Use `prepend` to avoid creating new string objects
## Code After:
require "base62/version"
require "base62/string"
require "base62/integer"
module Base62
PRIMITIVES = (0..9).collect { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a
class << self
def decode(str)
out = 0
str.chars.reverse.each_with_index do |char, index|
place = PRIMITIVES.size ** index
out += PRIMITIVES.index(char) * place
end
out
end
def encode(int)
raise ArgumentError, "Can't Base62 encode negative number (#{int} given)" if int < 0
return "0" if int == 0
rem = int
result = ''
while rem != 0
result.prepend PRIMITIVES[rem % PRIMITIVES.size]
rem /= PRIMITIVES.size
end
result
end
end
end | require "base62/version"
require "base62/string"
require "base62/integer"
module Base62
PRIMITIVES = (0..9).collect { |i| i.to_s } + ('A'..'Z').to_a + ('a'..'z').to_a
class << self
def decode(str)
out = 0
str.chars.reverse.each_with_index do |char, index|
place = PRIMITIVES.size ** index
out += PRIMITIVES.index(char) * place
end
out
end
def encode(int)
raise ArgumentError, "Can't Base62 encode negative number (#{int} given)" if int < 0
return "0" if int == 0
rem = int
result = ''
while rem != 0
- result = PRIMITIVES[rem % PRIMITIVES.size].to_s + result
? ^^ --------------
+ result.prepend PRIMITIVES[rem % PRIMITIVES.size]
? ^^^^^^^^
rem /= PRIMITIVES.size
end
result
end
end
end | 2 | 0.064516 | 1 | 1 |
633fa0f4facaacea0cb22d50819e2b5577fbba11 | src/Main.hs | src/Main.hs | import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter
printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"
main = do
params <- getArgs
case length params of
0 -> printUsage
_ -> do
let fileName = head params
content <- readFile fileName
let config = parse configFile fileName content
case config of
Left error -> do
print error
exitFailure
Right (Config decls) ->
if null messages
then exitSuccess
else do
sequence_ $ map (printLintMessage content) messages
exitFailure
where messages = lint decls
| import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter
printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"
main = do
params <- getArgs
case length params of
0 -> printUsage
_ -> do
let fileName = head params
content <- readFile fileName
let config = parse configFile fileName content
case config of
Left error -> do
print error
exitFailure
Right (Config decls) ->
if null messages
then exitSuccess
else do
mapM_ (printLintMessage content) messages
exitFailure
where messages = lint decls
| Use mapM_ instead of sequence_ $ map | Use mapM_ instead of sequence_ $ map
| Haskell | mit | federicobond/nglint | haskell | ## Code Before:
import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter
printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"
main = do
params <- getArgs
case length params of
0 -> printUsage
_ -> do
let fileName = head params
content <- readFile fileName
let config = parse configFile fileName content
case config of
Left error -> do
print error
exitFailure
Right (Config decls) ->
if null messages
then exitSuccess
else do
sequence_ $ map (printLintMessage content) messages
exitFailure
where messages = lint decls
## Instruction:
Use mapM_ instead of sequence_ $ map
## Code After:
import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter
printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"
main = do
params <- getArgs
case length params of
0 -> printUsage
_ -> do
let fileName = head params
content <- readFile fileName
let config = parse configFile fileName content
case config of
Left error -> do
print error
exitFailure
Right (Config decls) ->
if null messages
then exitSuccess
else do
mapM_ (printLintMessage content) messages
exitFailure
where messages = lint decls
| import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter
printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"
main = do
params <- getArgs
case length params of
0 -> printUsage
_ -> do
let fileName = head params
content <- readFile fileName
let config = parse configFile fileName content
case config of
Left error -> do
print error
exitFailure
Right (Config decls) ->
if null messages
then exitSuccess
else do
- sequence_ $ map (printLintMessage content) messages
? ------------
+ mapM_ (printLintMessage content) messages
? ++
exitFailure
where messages = lint decls | 2 | 0.0625 | 1 | 1 |
4aca8e4a530bb55b777fb3a92705c4df2e74c5d8 | Distribution/Server/Pages/BuildReports.hs | Distribution/Server/Pages/BuildReports.hs | -- Generate an HTML page listing all build reports for a package
module Distribution.Server.Pages.BuildReports (buildReportSummary) where
import Distribution.Server.BuildReport
import Distribution.Server.BuildReports
import Distribution.Server.Pages.Template ( hackagePage )
import Distribution.Package
( PackageIdentifier )
import Distribution.Text
( display )
import qualified Text.XHtml as XHtml
import Text.XHtml ((<<))
buildReportSummary :: PackageIdentifier
-> [(BuildReportId, BuildReport)] -> XHtml.Html
buildReportSummary pkgid reports = hackagePage title body
where
title = display pkgid ++ ": build reports"
body = []
| -- Generate an HTML page listing all build reports for a package
module Distribution.Server.Pages.BuildReports (buildReportSummary) where
import qualified Distribution.Server.BuildReport as BuildReport
import Distribution.Server.BuildReport (BuildReport)
import Distribution.Server.BuildReports
import Distribution.Server.Pages.Template ( hackagePage )
import Distribution.Package
( PackageIdentifier )
import Distribution.Text
( display )
import qualified Text.XHtml as XHtml
import Text.XHtml ((<<), (!), tr, th, td)
buildReportSummary :: PackageIdentifier
-> [(BuildReportId, BuildReport)] -> XHtml.Html
buildReportSummary pkgid reports = hackagePage title body
where
title = display pkgid ++ ": build reports"
body = [summaryTable]
summaryTable = XHtml.table <<
(headerRow : dataRows)
headerRow = tr << [ th ! [XHtml.theclass "horizontal"] <<
columnName
| columnName <- columnNames ]
columnNames = ["Platform", "Compiler", "Build outcome"]
dataRows =
[ tr <<
[ td << (display (BuildReport.arch report)
++ " / "
++ display (BuildReport.os report))
, td << display (BuildReport.compiler report)
, td << detailLink reportId <<
display (BuildReport.installOutcome report) ]
| (reportId, report) <- reports ]
detailLink reportId =
XHtml.anchor ! [XHtml.href $ "/buildreports/" ++ display reportId ]
| Add initial build report summary table | Add initial build report summary table
| Haskell | bsd-3-clause | grayjay/hackage-server,dzackgarza/hackage-server,agrafix/hackage-server,chrisdotcode/hackage-server,erantapaa/hackage-server,agrafix/hackage-server,snoyberg/hackage-server,chrisdotcode/hackage-server,haskell-infra/hackage-server,grayjay/hackage-server,tkvogt/hackage-server,dzackgarza/hackage-server,erantapaa/hackage-server,snoyberg/hackage-server,ocharles/hackage-server,tkvogt/hackage-server,edsko/hackage-server,edsko/hackage-server,ocharles/hackage-server | haskell | ## Code Before:
-- Generate an HTML page listing all build reports for a package
module Distribution.Server.Pages.BuildReports (buildReportSummary) where
import Distribution.Server.BuildReport
import Distribution.Server.BuildReports
import Distribution.Server.Pages.Template ( hackagePage )
import Distribution.Package
( PackageIdentifier )
import Distribution.Text
( display )
import qualified Text.XHtml as XHtml
import Text.XHtml ((<<))
buildReportSummary :: PackageIdentifier
-> [(BuildReportId, BuildReport)] -> XHtml.Html
buildReportSummary pkgid reports = hackagePage title body
where
title = display pkgid ++ ": build reports"
body = []
## Instruction:
Add initial build report summary table
## Code After:
-- Generate an HTML page listing all build reports for a package
module Distribution.Server.Pages.BuildReports (buildReportSummary) where
import qualified Distribution.Server.BuildReport as BuildReport
import Distribution.Server.BuildReport (BuildReport)
import Distribution.Server.BuildReports
import Distribution.Server.Pages.Template ( hackagePage )
import Distribution.Package
( PackageIdentifier )
import Distribution.Text
( display )
import qualified Text.XHtml as XHtml
import Text.XHtml ((<<), (!), tr, th, td)
buildReportSummary :: PackageIdentifier
-> [(BuildReportId, BuildReport)] -> XHtml.Html
buildReportSummary pkgid reports = hackagePage title body
where
title = display pkgid ++ ": build reports"
body = [summaryTable]
summaryTable = XHtml.table <<
(headerRow : dataRows)
headerRow = tr << [ th ! [XHtml.theclass "horizontal"] <<
columnName
| columnName <- columnNames ]
columnNames = ["Platform", "Compiler", "Build outcome"]
dataRows =
[ tr <<
[ td << (display (BuildReport.arch report)
++ " / "
++ display (BuildReport.os report))
, td << display (BuildReport.compiler report)
, td << detailLink reportId <<
display (BuildReport.installOutcome report) ]
| (reportId, report) <- reports ]
detailLink reportId =
XHtml.anchor ! [XHtml.href $ "/buildreports/" ++ display reportId ]
| -- Generate an HTML page listing all build reports for a package
module Distribution.Server.Pages.BuildReports (buildReportSummary) where
+ import qualified Distribution.Server.BuildReport as BuildReport
- import Distribution.Server.BuildReport
+ import Distribution.Server.BuildReport (BuildReport)
? ++++++++++++++
import Distribution.Server.BuildReports
- import Distribution.Server.Pages.Template ( hackagePage )
? ^
+ import Distribution.Server.Pages.Template ( hackagePage )
? ^
import Distribution.Package
( PackageIdentifier )
import Distribution.Text
( display )
import qualified Text.XHtml as XHtml
- import Text.XHtml ((<<))
+ import Text.XHtml ((<<), (!), tr, th, td)
buildReportSummary :: PackageIdentifier
-> [(BuildReportId, BuildReport)] -> XHtml.Html
buildReportSummary pkgid reports = hackagePage title body
where
title = display pkgid ++ ": build reports"
- body = []
+ body = [summaryTable]
+
+ summaryTable = XHtml.table <<
+ (headerRow : dataRows)
+ headerRow = tr << [ th ! [XHtml.theclass "horizontal"] <<
+ columnName
+ | columnName <- columnNames ]
+ columnNames = ["Platform", "Compiler", "Build outcome"]
+ dataRows =
+ [ tr <<
+ [ td << (display (BuildReport.arch report)
+ ++ " / "
+ ++ display (BuildReport.os report))
+ , td << display (BuildReport.compiler report)
+ , td << detailLink reportId <<
+ display (BuildReport.installOutcome report) ]
+ | (reportId, report) <- reports ]
+ detailLink reportId =
+ XHtml.anchor ! [XHtml.href $ "/buildreports/" ++ display reportId ] | 27 | 1.173913 | 23 | 4 |
1e80d5f2e57808965f138447c6f89e5f0c2cabbf | ecplurkbot/lib/contentfilter.js | ecplurkbot/lib/contentfilter.js | function verifiyKeyword(keywordList, content) {
var keywords = Object.keys(keywordList);
for (var i = 0; i < keywordList.length; i++){
if(keywordList.indexOf(content) === -1){
var response = keywordList[i][content];
return response;
}
return null;
}
}
module.exports = {
'verifiyKeyword': verifiyKeyword
};
| function verifiyKeyword(keywordList, content) {
for (var i = 0; i < keywordList.length; i++){
var keywords = Object.keys(keywordList[i]);
console.log(keywords.indexOf(content));
if(keywords.indexOf(content) != -1){
var response = keywordList[i][content];
return response;
}
return null;
}
}
module.exports = {
'verifiyKeyword': verifiyKeyword
};
| Fix the bug of filiter | Fix the bug of filiter
| JavaScript | apache-2.0 | dollars0427/ecplurkbot | javascript | ## Code Before:
function verifiyKeyword(keywordList, content) {
var keywords = Object.keys(keywordList);
for (var i = 0; i < keywordList.length; i++){
if(keywordList.indexOf(content) === -1){
var response = keywordList[i][content];
return response;
}
return null;
}
}
module.exports = {
'verifiyKeyword': verifiyKeyword
};
## Instruction:
Fix the bug of filiter
## Code After:
function verifiyKeyword(keywordList, content) {
for (var i = 0; i < keywordList.length; i++){
var keywords = Object.keys(keywordList[i]);
console.log(keywords.indexOf(content));
if(keywords.indexOf(content) != -1){
var response = keywordList[i][content];
return response;
}
return null;
}
}
module.exports = {
'verifiyKeyword': verifiyKeyword
};
| function verifiyKeyword(keywordList, content) {
-
- var keywords = Object.keys(keywordList);
for (var i = 0; i < keywordList.length; i++){
+ var keywords = Object.keys(keywordList[i]);
+
+ console.log(keywords.indexOf(content));
+
- if(keywordList.indexOf(content) === -1){
? -- - ^^
+ if(keywords.indexOf(content) != -1){
? ^
var response = keywordList[i][content];
return response;
}
return null;
}
}
module.exports = {
'verifiyKeyword': verifiyKeyword
}; | 8 | 0.4 | 5 | 3 |
3bad30eff7eba741a81e76a7e7070cdb96b60331 | postinstall.sh | postinstall.sh | node ./node_modules/coffee-script/bin/coffee -c ./src
rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile
| node ./node_modules/coffee-script/bin/coffee -c ./src
rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile /app/src/*.coffee
npm uninstall coffee-script | Remove the coffeescript source files and coffeescript module after compilation since they're only needed at compile time (and not at runtime). | Remove the coffeescript source files and coffeescript module after compilation since they're only needed at compile time (and not at runtime).
| Shell | apache-2.0 | nghiant2710/resin-supervisor,nghiant2710/resin-supervisor,resin-io/resin-multivisor,deviceMP/resin-supervisor,deviceMP/resin-supervisor | shell | ## Code Before:
node ./node_modules/coffee-script/bin/coffee -c ./src
rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile
## Instruction:
Remove the coffeescript source files and coffeescript module after compilation since they're only needed at compile time (and not at runtime).
## Code After:
node ./node_modules/coffee-script/bin/coffee -c ./src
rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile /app/src/*.coffee
npm uninstall coffee-script | node ./node_modules/coffee-script/bin/coffee -c ./src
- rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile
+ rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile /app/src/*.coffee
? ++++++++++++++++++
+ npm uninstall coffee-script | 3 | 1.5 | 2 | 1 |
36309f8def2580a2a174438399bd4ff18e14c674 | .dotfiles/cron/rsync_phatblat.sh | .dotfiles/cron/rsync_phatblat.sh |
. $HOME/.dotfiles/cron/cron.env
. $HOME/.dotfiles/shell/rsync.sh # Defines sync function
# Sync user dir from iMac -> ThunderBay
time sync $phatblat_imac $phatblat_external "go"
|
. $HOME/.dotfiles/cron/cron.env
. $HOME/.dotfiles/shell/rsync.sh # Defines sync function
this_host=$(hostname)
# Only run this on iMac
if [[ $this_host != "imac.local" ]]; then
exit
fi
# Sync user dir from iMac -> ThunderBay
time sync $phatblat_imac $phatblat_external "go"
| Configure sync command to only run on iMac | Configure sync command to only run on iMac
| Shell | mit | phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles,phatblat/dotfiles | shell | ## Code Before:
. $HOME/.dotfiles/cron/cron.env
. $HOME/.dotfiles/shell/rsync.sh # Defines sync function
# Sync user dir from iMac -> ThunderBay
time sync $phatblat_imac $phatblat_external "go"
## Instruction:
Configure sync command to only run on iMac
## Code After:
. $HOME/.dotfiles/cron/cron.env
. $HOME/.dotfiles/shell/rsync.sh # Defines sync function
this_host=$(hostname)
# Only run this on iMac
if [[ $this_host != "imac.local" ]]; then
exit
fi
# Sync user dir from iMac -> ThunderBay
time sync $phatblat_imac $phatblat_external "go"
|
. $HOME/.dotfiles/cron/cron.env
. $HOME/.dotfiles/shell/rsync.sh # Defines sync function
+ this_host=$(hostname)
+
+ # Only run this on iMac
+ if [[ $this_host != "imac.local" ]]; then
+ exit
+ fi
+
# Sync user dir from iMac -> ThunderBay
time sync $phatblat_imac $phatblat_external "go" | 7 | 1.166667 | 7 | 0 |
1af7f5f6bc8272de89dd9bb56eabd6b73c44dd74 | app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :authenticate_user!, except: [:home]
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
| class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :authenticate_user!, except: [:home]
helper_method :correct_user
def correct_user
!!(current_user == @resource.user)
end
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
| Add correct_user method as controller method and helper. | Add correct_user method as controller method and helper.
| Ruby | mit | abonner1/sorter,abonner1/sorter,abonner1/code_learning_resources_manager,abonner1/code_learning_resources_manager,abonner1/code_learning_resources_manager,abonner1/sorter | ruby | ## Code Before:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :authenticate_user!, except: [:home]
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
## Instruction:
Add correct_user method as controller method and helper.
## Code After:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :authenticate_user!, except: [:home]
helper_method :correct_user
def correct_user
!!(current_user == @resource.user)
end
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
| class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :authenticate_user!, except: [:home]
+
+ helper_method :correct_user
+
+ def correct_user
+ !!(current_user == @resource.user)
+ end
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end | 6 | 0.545455 | 6 | 0 |
e819e5803e61bd4630771c9c08e682a23527a96b | roles/common/tasks/etcd.yml | roles/common/tasks/etcd.yml | ---
- name: derive the etcd client connection URL
set_fact: etcd_api_url=http://{{ ansible_eth1.ipv4.address }}:{{ etcd_api_port }}
- name: etcd2 unit file
template: src=etcd-20-cluster.conf.j2 dest=/etc/systemd/system/etcd2.service.d/20-cluster.conf
sudo: yes
- name: etcd2 service
service: name=etcd2.service enabled=yes state=started
sudo: yes
- name: ensure etcd2 is listening
wait_for: port={{ etcd_api_port }} delay=5 state=started
- name: bootstrap the etcd key
command: etcdctl set /deconst/control_updated 1
| ---
- name: derive the etcd client connection URL
set_fact: etcd_api_url=http://{{ ansible_eth1.ipv4.address }}:{{ etcd_api_port }}
- name: etcd2 unit file directory
file: state=directory path=/etc/systemd/system/etcd2.service.d owner=root group=root mode=0755
sudo: yes
- name: etcd2 unit file
template: src=etcd-20-cluster.conf.j2 dest=/etc/systemd/system/etcd2.service.d/20-cluster.conf
sudo: yes
- name: etcd2 service
service: name=etcd2.service enabled=yes state=started
sudo: yes
- name: ensure etcd2 is listening
wait_for: port={{ etcd_api_port }} delay=5 state=started
- name: bootstrap the etcd key
command: etcdctl set /deconst/control_updated 1
| Create the directory for the unit file. | Create the directory for the unit file.
| YAML | apache-2.0 | ktbartholomew/deploy,deconst/deploy,ktbartholomew/deploy,deconst/deploy | yaml | ## Code Before:
---
- name: derive the etcd client connection URL
set_fact: etcd_api_url=http://{{ ansible_eth1.ipv4.address }}:{{ etcd_api_port }}
- name: etcd2 unit file
template: src=etcd-20-cluster.conf.j2 dest=/etc/systemd/system/etcd2.service.d/20-cluster.conf
sudo: yes
- name: etcd2 service
service: name=etcd2.service enabled=yes state=started
sudo: yes
- name: ensure etcd2 is listening
wait_for: port={{ etcd_api_port }} delay=5 state=started
- name: bootstrap the etcd key
command: etcdctl set /deconst/control_updated 1
## Instruction:
Create the directory for the unit file.
## Code After:
---
- name: derive the etcd client connection URL
set_fact: etcd_api_url=http://{{ ansible_eth1.ipv4.address }}:{{ etcd_api_port }}
- name: etcd2 unit file directory
file: state=directory path=/etc/systemd/system/etcd2.service.d owner=root group=root mode=0755
sudo: yes
- name: etcd2 unit file
template: src=etcd-20-cluster.conf.j2 dest=/etc/systemd/system/etcd2.service.d/20-cluster.conf
sudo: yes
- name: etcd2 service
service: name=etcd2.service enabled=yes state=started
sudo: yes
- name: ensure etcd2 is listening
wait_for: port={{ etcd_api_port }} delay=5 state=started
- name: bootstrap the etcd key
command: etcdctl set /deconst/control_updated 1
| ---
- name: derive the etcd client connection URL
set_fact: etcd_api_url=http://{{ ansible_eth1.ipv4.address }}:{{ etcd_api_port }}
+
+ - name: etcd2 unit file directory
+ file: state=directory path=/etc/systemd/system/etcd2.service.d owner=root group=root mode=0755
+ sudo: yes
- name: etcd2 unit file
template: src=etcd-20-cluster.conf.j2 dest=/etc/systemd/system/etcd2.service.d/20-cluster.conf
sudo: yes
- name: etcd2 service
service: name=etcd2.service enabled=yes state=started
sudo: yes
- name: ensure etcd2 is listening
wait_for: port={{ etcd_api_port }} delay=5 state=started
- name: bootstrap the etcd key
command: etcdctl set /deconst/control_updated 1 | 4 | 0.222222 | 4 | 0 |
9bd3b61f6633878eced588147b2b008593c1e616 | js/menu-nested-item.jsx | js/menu-nested-item.jsx | /**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js'),
Icon = require('./icon.jsx'),
Menu = require('./menu.jsx');
var MenuNestedItem = React.createClass({
mixins: [Classable],
propTypes: {
key: React.PropTypes.number.isRequired,
menuItems: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired,
selected: React.PropTypes.bool
},
getDefaultProps: function() {
return {
Mark: sux
};
},
render: function() {
var classes = this.getClasses('mui-nested', {
//'mui-icon': this.props.icon != null
});
return (
<div key={this.props.key} className={classes} onClick={this._onClick}>
{this.props.children}
<Menu menuItems={this.props.menuItems} zDepth={1} />
</div>
);
},
_onClick: function(e) {
if (this.props.onClick) this.props.onClick(e, this.props.key);
},
});
module.exports = MenuNestedItem; | /**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js'),
Icon = require('./icon.jsx'),
Menu = require('./menu.jsx');
var MenuNestedItem = React.createClass({
mixins: [Classable],
propTypes: {
key: React.PropTypes.number.isRequired,
menuItems: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired,
selected: React.PropTypes.bool
},
getDefaultProps: function() {
return {
};
},
render: function() {
var classes = this.getClasses('mui-nested', {
//'mui-icon': this.props.icon != null
});
return (
<div key={this.props.key} className={classes} onClick={this._onClick}>
{this.props.children}
<Menu menuItems={this.props.menuItems} zDepth={1} />
</div>
);
},
_onClick: function(e) {
if (this.props.onClick) this.props.onClick(e, this.props.key);
},
});
module.exports = MenuNestedItem; | Remove test code from nested menu item | Remove test code from nested menu item
| JSX | mit | manchesergit/material-ui,mubassirhayat/material-ui,zuren/material-ui,skarnecki/material-ui,whatupdave/material-ui,whatupdave/material-ui,tan-jerene/material-ui,glabcn/material-ui,hesling/material-ui,jeroencoumans/material-ui,demoalex/material-ui,mmrtnz/material-ui,vaiRk/material-ui,tribecube/material-ui,tomgco/material-ui,ashfaqueahmadbari/material-ui,Syncano/material-ui,janmarsicek/material-ui,lawrence-yu/material-ui,jkruder/material-ui,2390183798/material-ui,dsslimshaddy/material-ui,bdsabian/material-ui-old,cloudseven/material-ui,cherniavskii/material-ui,deerawan/material-ui,janmarsicek/material-ui,developer-prosenjit/material-ui,woanversace/material-ui,yh453926638/material-ui,Videri/material-ui,tingi/material-ui,domagojk/material-ui,shaurya947/material-ui,loaf/material-ui,garth/material-ui,bratva/material-ui,pomerantsev/material-ui,owencm/material-ui,zuren/material-ui,tastyeggs/material-ui,JonatanGarciaClavo/material-ui,121nexus/material-ui,zulfatilyasov/material-ui-yearpicker,wdamron/material-ui,freedomson/material-ui,safareli/material-ui,zhengjunwei/material-ui,AllenSH12/material-ui,vmaudgalya/material-ui,matthewoates/material-ui,kabaka/material-ui,barakmitz/material-ui,nevir/material-ui,pradel/material-ui,btmills/material-ui,alitaheri/material-ui,ahlee2326/material-ui,yongxu/material-ui,kasra-co/material-ui,rodolfo2488/material-ui,Unforgiven-wanda/learning-react,frnk94/material-ui,Jonekee/material-ui,wunderlink/material-ui,wustxing/material-ui,zulfatilyasov/material-ui-yearpicker,ddebowczyk/material-ui,oliviertassinari/material-ui,freeslugs/material-ui,pancho111203/material-ui,RickyDan/material-ui,ichiohta/material-ui,kybarg/material-ui,juhaelee/material-ui-io,yulric/material-ui,CumpsD/material-ui,creatorkuang/mui-react,myfintech/material-ui,subjectix/material-ui,Josh-a-e/material-ui,maoziliang/material-ui,zenlambda/material-ui,glabcn/material-ui,19hz/material-ui,Iamronan/material-ui,pomerantsev/material-ui,loki315zx/material-ui,kittyjumbalaya/material-components-web,ashfaqueahmadbari/material-ui,mbrookes/material-ui,manchesergit/material-ui,lightning18/material-ui,oToUC/material-ui,shadowhunter2/material-ui,yinickzhou/material-ui,DenisPostu/material-ui,felipethome/material-ui,VirtueMe/material-ui,mui-org/material-ui,cmpereirasi/material-ui,inoc603/material-ui,freeslugs/material-ui,igorbt/material-ui,patelh18/material-ui,br0r/material-ui,nik4152/material-ui,rscnt/material-ui,MrLeebo/material-ui,oliviertassinari/material-ui,ababol/material-ui,b4456609/pet-new,EcutDavid/material-ui,hybrisCole/material-ui,grovelabs/material-ui,mtsandeep/material-ui,lionkeng/material-ui,XiaonuoGantan/material-ui,pschlette/material-ui-with-sass,alex-dixon/material-ui,tungmv7/material-ui,marnusw/material-ui,allanalexandre/material-ui,gsls1817/material-ui,tirams/material-ui,isakib/material-ui,mui-org/material-ui,ButuzGOL/material-ui,conundrumer/material-ui,AndriusBil/material-ui,cjhveal/material-ui,developer-prosenjit/material-ui,JAStanton/material-ui,JAStanton/material-ui-io,ziad-saab/material-ui,agnivade/material-ui,lionkeng/material-ui,tomrosier/material-ui,chirilo/material-ui,pospisil1/material-ui,ddebowczyk/material-ui,ArcanisCz/material-ui,hiddentao/material-ui,udhayam/material-ui,mit-cml/iot-website-source,pschlette/material-ui-with-sass,insionng/material-ui,Jandersolutions/material-ui,felipeptcho/material-ui,nathanmarks/material-ui,chrxn/material-ui,CumpsD/material-ui,mbrookes/material-ui,andrejunges/material-ui,NogsMPLS/material-ui,hai-cea/material-ui,bdsabian/material-ui-old,mogii/material-ui,meimz/material-ui,AndriusBil/material-ui,lucy-orbach/material-ui,motiz88/material-ui,sarink/material-ui-with-sass,Shiiir/learning-reactjs-first-demo,mjhasbach/material-ui,verdan/material-ui,b4456609/pet-new,oliverfencott/material-ui,mtnk/material-ui,yhikishima/material-ui,callemall/material-ui,ProductiveMobile/material-ui,trendchaser4u/material-ui,tingi/material-ui,juhaelee/material-ui-io,ahlee2326/material-ui,adamlee/material-ui,nahue/material-ui,bright-sparks/material-ui,mui-org/material-ui,wunderlink/material-ui,dsslimshaddy/material-ui,haf/material-ui,MrOrz/material-ui,tastyeggs/material-ui,rscnt/material-ui,NatalieT/material-ui,JsonChiu/material-ui,isakib/material-ui,mjhasbach/material-ui,insionng/material-ui,xiaoking/material-ui,hwo411/material-ui,kebot/material-ui,mobilelife/material-ui,jarno-steeman/material-ui,Qix-/material-ui,drojas/material-ui,callemall/material-ui,WolfspiritM/material-ui,und3fined/material-ui,chrismcv/material-ui,enriqueojedalara/material-ui,arkxu/material-ui,mbrookes/material-ui,ArcanisCz/material-ui,maoziliang/material-ui,Cerebri/material-ui,keokilee/material-ui,JsonChiu/material-ui,nevir/material-ui,ramsey-darling1/material-ui,gaowenbin/material-ui,2947721120/material-ui,mulesoft-labs/material-ui,matthewoates/material-ui,CalebEverett/material-ui,ngbrown/material-ui,rhaedes/material-ui,tyfoo/material-ui,louy/material-ui,arkxu/material-ui,staticinstance/material-ui,Iamronan/material-ui,Saworieza/material-ui,hybrisCole/material-ui,ababol/material-ui,bratva/material-ui,mikedklein/material-ui,rolandpoulter/material-ui,salamer/material-ui,cherniavskii/material-ui,skyflux/material-ui,Yepstr/material-ui,ziad-saab/material-ui,buttercloud/material-ui,hophacker/material-ui,ButuzGOL/material-ui,bgribben/material-ui,callemall/material-ui,w01fgang/material-ui,ludiculous/material-ui,safareli/material-ui,lgollut/material-ui,bright-sparks/material-ui,gobadiah/material-ui,hai-cea/material-ui,w01fgang/material-ui,christopherL91/material-ui,gaowenbin/material-ui,trendchaser4u/material-ui,hellokitty111/material-ui,jacobrosenthal/material-ui,jkruder/material-ui,cjhveal/material-ui,gsklee/material-ui,motiz88/material-ui,mulesoft/material-ui,roderickwang/material-ui,sanemat/material-ui,lastjune/material-ui,Tionx/material-ui,Kagami/material-ui,ilear/material-ui,Saworieza/material-ui,Shiiir/learning-reactjs-first-demo,ghondar/material-ui,br0r/material-ui,yhikishima/material-ui,ntgn81/material-ui,ahmedshuhel/material-ui,JAStanton/material-ui,ichiohta/material-ui,suvjunmd/material-ui,buttercloud/material-ui,mogii/material-ui,tungmv7/material-ui,esleducation/material-ui,verdan/material-ui,mit-cml/iot-website-source,nik4152/material-ui,domagojk/material-ui,AndriusBil/material-ui,mayblue9/material-ui,salamer/material-ui,mmrtnz/material-ui,pospisil1/material-ui,2390183798/material-ui,hiddentao/material-ui,jmknoll/material-ui,Zadielerick/material-ui,izziaraffaele/material-ui,callemall/material-ui,frnk94/material-ui,und3fined/material-ui,ludiculous/material-ui,JAStanton/material-ui-io,elwebdeveloper/material-ui,ilovezy/material-ui,lunohq/material-ui,mit-cml/iot-website-source,igorbt/material-ui,sarink/material-ui-with-sass,ruifortes/material-ui,baiyanghese/material-ui,cpojer/material-ui,inoc603/material-ui,juhaelee/material-ui,Hamstr/material-ui,ahmedshuhel/material-ui,timuric/material-ui,WolfspiritM/material-ui,kwangkim/course-react,AndriusBil/material-ui,Jandersolutions/material-ui,dsslimshaddy/material-ui,freedomson/material-ui,Chuck8080/materialdesign-react,agnivade/material-ui,gsklee/material-ui,mtsandeep/material-ui,marcelmokos/material-ui,bokzor/material-ui,oliviertassinari/material-ui,RickyDan/material-ui,kybarg/material-ui,marwein/material-ui,b4456609/pet-new,checkraiser/material-ui,checkraiser/material-ui,bjfletcher/material-ui,suvjunmd/material-ui,Kagami/material-ui,Kagami/material-ui,spiermar/material-ui,azazdeaz/material-ui,Zeboch/material-ui,kittyjumbalaya/material-components-web,ronlobo/material-ui,owencm/material-ui,Joker666/material-ui,milworm/material-ui,ask-izzy/material-ui,mgibeau/material-ui,grovelabs/material-ui,hwo411/material-ui,janmarsicek/material-ui,rodolfo2488/material-ui,kybarg/material-ui,gitmithy/material-ui,kasra-co/material-ui,ianwcarlson/material-ui,VirtueMe/material-ui,Kagami/material-ui,kybarg/material-ui,lawrence-yu/material-ui,ProductiveMobile/material-ui,mikey2XU/material-ui,cherniavskii/material-ui,cgestes/material-ui,Tionx/material-ui,oliverfencott/material-ui,EllieAdam/material-ui,Qix-/material-ui,unageanu/material-ui,cherniavskii/material-ui,jeroencoumans/material-ui,Lottid/material-ui,chirilo/material-ui,rscnt/material-ui,yinickzhou/material-ui,dsslimshaddy/material-ui,hjmoss/material-ui,milworm/material-ui,MrOrz/material-ui,und3fined/material-ui,juhaelee/material-ui,hellokitty111/material-ui,xiaoking/material-ui,bORm/material-ui,janmarsicek/material-ui,andrejunges/material-ui,wdamron/material-ui,Joker666/material-ui,marwein/material-ui,patelh18/material-ui,Dolmio/material-ui,ilovezy/material-ui,gsls1817/material-ui,pancho111203/material-ui,KevinMcIntyre/material-ui,xmityaz/material-ui,jtollerene/material-ui,tan-jerene/material-ui,JohnnyRockenstein/material-ui,CyberSpace7/material-ui,Josh-a-e/material-ui,ruifortes/material-ui | jsx | ## Code Before:
/**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js'),
Icon = require('./icon.jsx'),
Menu = require('./menu.jsx');
var MenuNestedItem = React.createClass({
mixins: [Classable],
propTypes: {
key: React.PropTypes.number.isRequired,
menuItems: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired,
selected: React.PropTypes.bool
},
getDefaultProps: function() {
return {
Mark: sux
};
},
render: function() {
var classes = this.getClasses('mui-nested', {
//'mui-icon': this.props.icon != null
});
return (
<div key={this.props.key} className={classes} onClick={this._onClick}>
{this.props.children}
<Menu menuItems={this.props.menuItems} zDepth={1} />
</div>
);
},
_onClick: function(e) {
if (this.props.onClick) this.props.onClick(e, this.props.key);
},
});
module.exports = MenuNestedItem;
## Instruction:
Remove test code from nested menu item
## Code After:
/**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js'),
Icon = require('./icon.jsx'),
Menu = require('./menu.jsx');
var MenuNestedItem = React.createClass({
mixins: [Classable],
propTypes: {
key: React.PropTypes.number.isRequired,
menuItems: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired,
selected: React.PropTypes.bool
},
getDefaultProps: function() {
return {
};
},
render: function() {
var classes = this.getClasses('mui-nested', {
//'mui-icon': this.props.icon != null
});
return (
<div key={this.props.key} className={classes} onClick={this._onClick}>
{this.props.children}
<Menu menuItems={this.props.menuItems} zDepth={1} />
</div>
);
},
_onClick: function(e) {
if (this.props.onClick) this.props.onClick(e, this.props.key);
},
});
module.exports = MenuNestedItem; | /**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js'),
Icon = require('./icon.jsx'),
Menu = require('./menu.jsx');
var MenuNestedItem = React.createClass({
mixins: [Classable],
propTypes: {
key: React.PropTypes.number.isRequired,
menuItems: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired,
selected: React.PropTypes.bool
},
getDefaultProps: function() {
return {
- Mark: sux
};
},
render: function() {
var classes = this.getClasses('mui-nested', {
//'mui-icon': this.props.icon != null
});
return (
<div key={this.props.key} className={classes} onClick={this._onClick}>
{this.props.children}
<Menu menuItems={this.props.menuItems} zDepth={1} />
</div>
);
},
_onClick: function(e) {
if (this.props.onClick) this.props.onClick(e, this.props.key);
},
});
module.exports = MenuNestedItem; | 1 | 0.021739 | 0 | 1 |
e75eefefe73ce3e73d7bbf10c6edc08bb3bf2b79 | client/styles/sass/modules/_intro-band.scss | client/styles/sass/modules/_intro-band.scss | // * * * * * * INTRODUCTION BAND * * * * * * //
.intro-band {
background-color: #fff;
padding: 60px 0;
}
.intro-col {
@include align-items(center);
@include display-flex(flex);
}
.intro-photo {
@include border-radius(4px);
margin-right: 35px;
-webkit-transition: all 300ms;
-moz-transition: all 300ms;
transition: all 300ms;
}
.intro-title {
font-size: 55px;
font-weight: 100;
}
.intro-body {
font-size: 35px;
font-weight: 100;
}
.intro-love {
color: $color-action;
font-weight: 400;
}
@include breakpoint($breakpoint-single-col) {
.intro-photo {
max-width: 275px;
}
}
@include breakpoint($breakpoint-mobile) {
.intro-col {
@include flex-wrap(wrap);
}
.intro-photo {
margin: 0 auto 20px auto;
max-width: 100%;
}
.intro-text {
text-align: center;
}
}
| // * * * * * * INTRODUCTION BAND * * * * * * //
.intro-band {
background-color: #fff;
padding: 60px 0;
}
.intro-col {
@include align-items(center);
@include display-flex(flex);
}
.intro-photo {
@include border-radius(4px);
@include transition-duration(300ms);
@include transition-property(all);
margin-right: 35px;
}
.intro-title {
font-size: 55px;
font-weight: 100;
}
.intro-body {
font-size: 35px;
font-weight: 100;
}
.intro-love {
color: $color-action;
font-weight: 400;
}
@include breakpoint($breakpoint-single-col) {
.intro-photo {
max-width: 275px;
}
}
@include breakpoint($breakpoint-mobile) {
.intro-col {
@include flex-wrap(wrap);
}
.intro-photo {
margin: 0 auto 20px auto;
max-width: 100%;
}
.intro-text {
text-align: center;
}
}
| Use compass mixins for CSS transitions | Use compass mixins for CSS transitions
| SCSS | apache-2.0 | evancorl/portfolio,evancorl/portfolio,evancorl/skate-scenes,evancorl/skate-scenes,evancorl/skate-scenes,evancorl/portfolio | scss | ## Code Before:
// * * * * * * INTRODUCTION BAND * * * * * * //
.intro-band {
background-color: #fff;
padding: 60px 0;
}
.intro-col {
@include align-items(center);
@include display-flex(flex);
}
.intro-photo {
@include border-radius(4px);
margin-right: 35px;
-webkit-transition: all 300ms;
-moz-transition: all 300ms;
transition: all 300ms;
}
.intro-title {
font-size: 55px;
font-weight: 100;
}
.intro-body {
font-size: 35px;
font-weight: 100;
}
.intro-love {
color: $color-action;
font-weight: 400;
}
@include breakpoint($breakpoint-single-col) {
.intro-photo {
max-width: 275px;
}
}
@include breakpoint($breakpoint-mobile) {
.intro-col {
@include flex-wrap(wrap);
}
.intro-photo {
margin: 0 auto 20px auto;
max-width: 100%;
}
.intro-text {
text-align: center;
}
}
## Instruction:
Use compass mixins for CSS transitions
## Code After:
// * * * * * * INTRODUCTION BAND * * * * * * //
.intro-band {
background-color: #fff;
padding: 60px 0;
}
.intro-col {
@include align-items(center);
@include display-flex(flex);
}
.intro-photo {
@include border-radius(4px);
@include transition-duration(300ms);
@include transition-property(all);
margin-right: 35px;
}
.intro-title {
font-size: 55px;
font-weight: 100;
}
.intro-body {
font-size: 35px;
font-weight: 100;
}
.intro-love {
color: $color-action;
font-weight: 400;
}
@include breakpoint($breakpoint-single-col) {
.intro-photo {
max-width: 275px;
}
}
@include breakpoint($breakpoint-mobile) {
.intro-col {
@include flex-wrap(wrap);
}
.intro-photo {
margin: 0 auto 20px auto;
max-width: 100%;
}
.intro-text {
text-align: center;
}
}
| // * * * * * * INTRODUCTION BAND * * * * * * //
.intro-band {
background-color: #fff;
padding: 60px 0;
}
.intro-col {
@include align-items(center);
@include display-flex(flex);
}
.intro-photo {
@include border-radius(4px);
+ @include transition-duration(300ms);
+ @include transition-property(all);
margin-right: 35px;
- -webkit-transition: all 300ms;
- -moz-transition: all 300ms;
- transition: all 300ms;
}
.intro-title {
font-size: 55px;
font-weight: 100;
}
.intro-body {
font-size: 35px;
font-weight: 100;
}
.intro-love {
color: $color-action;
font-weight: 400;
}
@include breakpoint($breakpoint-single-col) {
.intro-photo {
max-width: 275px;
}
}
@include breakpoint($breakpoint-mobile) {
.intro-col {
@include flex-wrap(wrap);
}
.intro-photo {
margin: 0 auto 20px auto;
max-width: 100%;
}
.intro-text {
text-align: center;
}
} | 5 | 0.090909 | 2 | 3 |
f73368aeff140d34b7579c44dc9955d81d946051 | lib/unparser/emitter/float.rb | lib/unparser/emitter/float.rb |
module Unparser
class Emitter
# Emiter for float literals
class Float < self
handle :float
children :value
INFINITY = ::Float::INFINITY
NEG_INFINITY = -::Float::INFINITY
private
def dispatch
if value.eql?(INFINITY)
write('10e1000000000000000000')
elsif value.eql?(NEG_INFINITY)
write('-10e1000000000000000000')
else
write(value.inspect)
end
end
end # Float
end # Emitter
end # Unparser
|
module Unparser
class Emitter
# Emiter for float literals
class Float < self
handle :float
children :value
INFINITY = ::Float::INFINITY
NEG_INFINITY = -::Float::INFINITY
private
def dispatch
case value
when INFINITY
write('10e1000000000000000000')
when NEG_INFINITY
write('-10e1000000000000000000')
else
write(value.inspect)
end
end
end # Float
end # Emitter
end # Unparser
| Change to case over if else | Change to case over if else
| Ruby | mit | mbj/unparser,mbj/unparser | ruby | ## Code Before:
module Unparser
class Emitter
# Emiter for float literals
class Float < self
handle :float
children :value
INFINITY = ::Float::INFINITY
NEG_INFINITY = -::Float::INFINITY
private
def dispatch
if value.eql?(INFINITY)
write('10e1000000000000000000')
elsif value.eql?(NEG_INFINITY)
write('-10e1000000000000000000')
else
write(value.inspect)
end
end
end # Float
end # Emitter
end # Unparser
## Instruction:
Change to case over if else
## Code After:
module Unparser
class Emitter
# Emiter for float literals
class Float < self
handle :float
children :value
INFINITY = ::Float::INFINITY
NEG_INFINITY = -::Float::INFINITY
private
def dispatch
case value
when INFINITY
write('10e1000000000000000000')
when NEG_INFINITY
write('-10e1000000000000000000')
else
write(value.inspect)
end
end
end # Float
end # Emitter
end # Unparser
|
module Unparser
class Emitter
# Emiter for float literals
class Float < self
handle :float
children :value
INFINITY = ::Float::INFINITY
NEG_INFINITY = -::Float::INFINITY
private
def dispatch
- if value.eql?(INFINITY)
+ case value
+ when INFINITY
write('10e1000000000000000000')
- elsif value.eql?(NEG_INFINITY)
+ when NEG_INFINITY
write('-10e1000000000000000000')
else
write(value.inspect)
end
end
end # Float
end # Emitter
end # Unparser | 5 | 0.185185 | 3 | 2 |
2ced5535f62925c53d4cc7736771735b203c6397 | .travis.yml | .travis.yml | sudo: false
language: rust
rust:
- nightly
before_install:
# Check formatting
- cargo install rustfmt
script:
# Check build script formatting separately because cargo fmt doesn't pick it up
- rustfmt --write-mode=diff build.rs
# Check formatting of sources
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose
- cargo bench --verbose
cache: cargo
| sudo: false
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
before_install:
# Check formatting
- cargo install rustfmt
script:
# Check build script formatting separately because cargo fmt doesn't pick it up
- rustfmt --write-mode=diff build.rs
# Check formatting of sources
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose
- cargo bench --verbose
cache: cargo
| Test against stable and beta | Test against stable and beta
| YAML | apache-2.0 | lunaryorn/xkpwgen.rs | yaml | ## Code Before:
sudo: false
language: rust
rust:
- nightly
before_install:
# Check formatting
- cargo install rustfmt
script:
# Check build script formatting separately because cargo fmt doesn't pick it up
- rustfmt --write-mode=diff build.rs
# Check formatting of sources
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose
- cargo bench --verbose
cache: cargo
## Instruction:
Test against stable and beta
## Code After:
sudo: false
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
before_install:
# Check formatting
- cargo install rustfmt
script:
# Check build script formatting separately because cargo fmt doesn't pick it up
- rustfmt --write-mode=diff build.rs
# Check formatting of sources
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose
- cargo bench --verbose
cache: cargo
| sudo: false
language: rust
rust:
+ - stable
+ - beta
- nightly
+ matrix:
+ allow_failures:
+ - rust: nightly
before_install:
# Check formatting
- cargo install rustfmt
script:
# Check build script formatting separately because cargo fmt doesn't pick it up
- rustfmt --write-mode=diff build.rs
# Check formatting of sources
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose
- cargo bench --verbose
cache: cargo | 5 | 0.3125 | 5 | 0 |
dbe7322e49dee09f874ed38af78197c30be4d583 | README.md | README.md |
pa11y-reporter-rainbows
=======================
This is a simple reporter for [pa11y][pa11y]. It's main purpose is to demonstrate how to build a custom reporter.
**Current Version:** *0.0.0*
Usage
-----
Install [pa11y][pa11y] and this module. You can now run pa11y with the reporter `rainbows`:
```sh
$ pa11y -r rainbows rowanmanning.com
```
License
-------
pa11y-reporter-rainbows is licensed under the [MIT][mit] license.
[pa11y]: https://github.com/nature/pa11y
[mit]: http://opensource.org/licenses/mit-license.php
|
pa11y-reporter-rainbows
=======================
This is a simple reporter for [pa11y][pa11y]. It's main purpose is to demonstrate how to build a custom reporter.
**Current Version:** *0.0.0*
Usage
-----
Install [pa11y][pa11y] and this module. You can now run pa11y with the reporter `rainbows`:
```sh
$ pa11y -r rainbows rowanmanning.com
```

License
-------
pa11y-reporter-rainbows is licensed under the [MIT][mit] license.
[pa11y]: https://github.com/nature/pa11y
[mit]: http://opensource.org/licenses/mit-license.php
| Add an output example to the readme | Add an output example to the readme
| Markdown | mit | rowanmanning/pa11y-reporter-rainbows | markdown | ## Code Before:
pa11y-reporter-rainbows
=======================
This is a simple reporter for [pa11y][pa11y]. It's main purpose is to demonstrate how to build a custom reporter.
**Current Version:** *0.0.0*
Usage
-----
Install [pa11y][pa11y] and this module. You can now run pa11y with the reporter `rainbows`:
```sh
$ pa11y -r rainbows rowanmanning.com
```
License
-------
pa11y-reporter-rainbows is licensed under the [MIT][mit] license.
[pa11y]: https://github.com/nature/pa11y
[mit]: http://opensource.org/licenses/mit-license.php
## Instruction:
Add an output example to the readme
## Code After:
pa11y-reporter-rainbows
=======================
This is a simple reporter for [pa11y][pa11y]. It's main purpose is to demonstrate how to build a custom reporter.
**Current Version:** *0.0.0*
Usage
-----
Install [pa11y][pa11y] and this module. You can now run pa11y with the reporter `rainbows`:
```sh
$ pa11y -r rainbows rowanmanning.com
```

License
-------
pa11y-reporter-rainbows is licensed under the [MIT][mit] license.
[pa11y]: https://github.com/nature/pa11y
[mit]: http://opensource.org/licenses/mit-license.php
|
pa11y-reporter-rainbows
=======================
This is a simple reporter for [pa11y][pa11y]. It's main purpose is to demonstrate how to build a custom reporter.
**Current Version:** *0.0.0*
Usage
-----
Install [pa11y][pa11y] and this module. You can now run pa11y with the reporter `rainbows`:
```sh
$ pa11y -r rainbows rowanmanning.com
```
+ 
+
License
-------
pa11y-reporter-rainbows is licensed under the [MIT][mit] license.
[pa11y]: https://github.com/nature/pa11y
[mit]: http://opensource.org/licenses/mit-license.php | 2 | 0.071429 | 2 | 0 |
aac3d7b1254c9e94200aced3f456ec75946d4abd | requirements.txt | requirements.txt | numpy
scipy
astropy
matplotlib
# Distribution tools
# pypandoc
# Not used, but why not
# HDF5 datasets allow chunked I/O
# h5py >=2.0, <3.0 | numpy
scipy
astropy
matplotlib
hyperspectral
# Distribution tools
# pypandoc
# Not used, but why not
# HDF5 datasets allow chunked I/O
# h5py >=2.0, <3.0 | Add hyperspectral lib as a requirement | Add hyperspectral lib as a requirement
| Text | mit | irap-omp/deconv3d,irap-omp/deconv3d | text | ## Code Before:
numpy
scipy
astropy
matplotlib
# Distribution tools
# pypandoc
# Not used, but why not
# HDF5 datasets allow chunked I/O
# h5py >=2.0, <3.0
## Instruction:
Add hyperspectral lib as a requirement
## Code After:
numpy
scipy
astropy
matplotlib
hyperspectral
# Distribution tools
# pypandoc
# Not used, but why not
# HDF5 datasets allow chunked I/O
# h5py >=2.0, <3.0 | numpy
scipy
astropy
matplotlib
+ hyperspectral
# Distribution tools
# pypandoc
# Not used, but why not
# HDF5 datasets allow chunked I/O
# h5py >=2.0, <3.0 | 1 | 0.090909 | 1 | 0 |
425aa9921544bd60bd26f2429a41deb2e156bd34 | Cpp/declare.h | Cpp/declare.h | /*!
* @brief Template C++-header file
*
* This is a template C++-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
/*!
* @brief Template class
*/
class <+FILEBASE+>
{
private:
public:
<+FILEBASE+>() {
<+CURSOR+>
}
}; // class <+FILEBASE+>
#endif // <+FILE_CAPITAL+>_H
| /*!
* @brief Template C++-header file
*
* This is a template C++-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
#include <iostream>
/*!
* @brief Template class
*/
class <+FILE_PASCAL+>
{
private:
public:
<+FILEBASE+>() {
<+CURSOR+>
}
template<typename CharT, typename Traits>
friend std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_);
template<typename CharT, typename Traits>
friend std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_);
}; // class <+FILE_PASCAL+>
template<typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_)
{
return os;
}
template<typename CharT, typename Traits>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_)
{
return is;
}
#endif // <+FILE_CAPITAL+>_H
| Enable to treat with std::cout and std::cin | Enable to treat with std::cout and std::cin
| C | mit | koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate,koturn/kotemplate | c | ## Code Before:
/*!
* @brief Template C++-header file
*
* This is a template C++-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
/*!
* @brief Template class
*/
class <+FILEBASE+>
{
private:
public:
<+FILEBASE+>() {
<+CURSOR+>
}
}; // class <+FILEBASE+>
#endif // <+FILE_CAPITAL+>_H
## Instruction:
Enable to treat with std::cout and std::cin
## Code After:
/*!
* @brief Template C++-header file
*
* This is a template C++-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
#include <iostream>
/*!
* @brief Template class
*/
class <+FILE_PASCAL+>
{
private:
public:
<+FILEBASE+>() {
<+CURSOR+>
}
template<typename CharT, typename Traits>
friend std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_);
template<typename CharT, typename Traits>
friend std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_);
}; // class <+FILE_PASCAL+>
template<typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_)
{
return os;
}
template<typename CharT, typename Traits>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_)
{
return is;
}
#endif // <+FILE_CAPITAL+>_H
| /*!
* @brief Template C++-header file
*
* This is a template C++-header file
* @author <+AUTHOR+>
* @date <+DATE+>
* @file <+FILE+>
* @version 0.1
*/
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H
+ #include <iostream>
+
/*!
* @brief Template class
*/
- class <+FILEBASE+>
? ^ ^
+ class <+FILE_PASCAL+>
? ^^ ^^^
{
private:
public:
<+FILEBASE+>() {
<+CURSOR+>
}
+
+ template<typename CharT, typename Traits>
+ friend std::basic_ostream<CharT, Traits>&
+ operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_);
+
+ template<typename CharT, typename Traits>
+ friend std::basic_istream<CharT, Traits>&
+ operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_);
- }; // class <+FILEBASE+>
? ^ ^
+ }; // class <+FILE_PASCAL+>
? ^^ ^^^
+
+
+ template<typename CharT, typename Traits>
+ std::basic_ostream<CharT, Traits>&
+ operator<<(std::basic_ostream<CharT, Traits>& os, const CoutTest& this_)
+ {
+
+ return os;
+ }
+
+
+ template<typename CharT, typename Traits>
+ std::basic_istream<CharT, Traits>&
+ operator>>(std::basic_istream<CharT, Traits>& is, CoutTest& this_)
+ {
+
+ return is;
+ }
#endif // <+FILE_CAPITAL+>_H | 32 | 1.185185 | 30 | 2 |
d34311cf7bc4dd33e020913538b28a1f5727ed92 | kafka_influxdb/tests/encoder_test/test_echo_encoder.py | kafka_influxdb/tests/encoder_test/test_echo_encoder.py | import unittest
from kafka_influxdb.encoder import echo_encoder
class TestEchoEncoder(unittest.TestCase):
def setUp(self):
self.encoder = echo_encoder.Encoder()
self.messages = [
"yeaal",
["this", "is", "a", "list"],
{'hash': {'maps': 'rule'}},
42,
42.23
]
def test_encode(self):
for msg in self.messages:
yield check_encode, msg
def check_encode(self, msg):
""" Output must be same as input for echo sender """
self.assertEqual(self.encoder.encode(msg), msg)
| import unittest
from kafka_influxdb.encoder import echo_encoder
class TestEchoEncoder(unittest.TestCase):
def setUp(self):
self.encoder = echo_encoder.Encoder()
self.messages = [
"yeaal",
["this", "is", "a", "list"],
{'hash': {'maps': 'rule'}},
42,
42.23
]
def test_encode(self):
for msg in self.messages:
yield self.check_encode(msg)
def check_encode(self, msg):
""" Output must be same as input for echo sender """
self.assertEqual(self.encoder.encode(msg), msg)
| Fix unit test for echo encoder | Fix unit test for echo encoder
| Python | apache-2.0 | mre/kafka-influxdb,mre/kafka-influxdb | python | ## Code Before:
import unittest
from kafka_influxdb.encoder import echo_encoder
class TestEchoEncoder(unittest.TestCase):
def setUp(self):
self.encoder = echo_encoder.Encoder()
self.messages = [
"yeaal",
["this", "is", "a", "list"],
{'hash': {'maps': 'rule'}},
42,
42.23
]
def test_encode(self):
for msg in self.messages:
yield check_encode, msg
def check_encode(self, msg):
""" Output must be same as input for echo sender """
self.assertEqual(self.encoder.encode(msg), msg)
## Instruction:
Fix unit test for echo encoder
## Code After:
import unittest
from kafka_influxdb.encoder import echo_encoder
class TestEchoEncoder(unittest.TestCase):
def setUp(self):
self.encoder = echo_encoder.Encoder()
self.messages = [
"yeaal",
["this", "is", "a", "list"],
{'hash': {'maps': 'rule'}},
42,
42.23
]
def test_encode(self):
for msg in self.messages:
yield self.check_encode(msg)
def check_encode(self, msg):
""" Output must be same as input for echo sender """
self.assertEqual(self.encoder.encode(msg), msg)
| import unittest
+ from kafka_influxdb.encoder import echo_encoder
- from kafka_influxdb.encoder import echo_encoder
class TestEchoEncoder(unittest.TestCase):
def setUp(self):
self.encoder = echo_encoder.Encoder()
self.messages = [
"yeaal",
["this", "is", "a", "list"],
{'hash': {'maps': 'rule'}},
42,
42.23
]
def test_encode(self):
for msg in self.messages:
- yield check_encode, msg
? ^^
+ yield self.check_encode(msg)
? +++++ ^ +
def check_encode(self, msg):
""" Output must be same as input for echo sender """
self.assertEqual(self.encoder.encode(msg), msg) | 4 | 0.173913 | 2 | 2 |
9ea9d111c8b6a20015f9ad6149f690c9e8c0774d | tools/tiny-test-fw/Utility/__init__.py | tools/tiny-test-fw/Utility/__init__.py | from __future__ import print_function
import sys
_COLOR_CODES = {
"white": '\033[0m',
"red": '\033[31m',
"green": '\033[32m',
"orange": '\033[33m',
"blue": '\033[34m',
"purple": '\033[35m',
"W": '\033[0m',
"R": '\033[31m',
"G": '\033[32m',
"O": '\033[33m',
"B": '\033[34m',
"P": '\033[35m'
}
def console_log(data, color="white", end="\n"):
"""
log data to console.
(if not flush console log, Gitlab-CI won't update logs during job execution)
:param data: data content
:param color: color
"""
if color not in _COLOR_CODES:
color = "white"
color_codes = _COLOR_CODES[color]
print(color_codes + data, end=end)
if color not in ["white", "W"]:
# reset color to white for later logs
print(_COLOR_CODES["white"] + "\r")
sys.stdout.flush()
| from __future__ import print_function
import sys
_COLOR_CODES = {
"white": u'\033[0m',
"red": u'\033[31m',
"green": u'\033[32m',
"orange": u'\033[33m',
"blue": u'\033[34m',
"purple": u'\033[35m',
"W": u'\033[0m',
"R": u'\033[31m',
"G": u'\033[32m',
"O": u'\033[33m',
"B": u'\033[34m',
"P": u'\033[35m'
}
def console_log(data, color="white", end="\n"):
"""
log data to console.
(if not flush console log, Gitlab-CI won't update logs during job execution)
:param data: data content
:param color: color
"""
if color not in _COLOR_CODES:
color = "white"
color_codes = _COLOR_CODES[color]
if type(data) is type(b''):
data = data.decode('utf-8', 'replace')
print(color_codes + data, end=end)
if color not in ["white", "W"]:
# reset color to white for later logs
print(_COLOR_CODES["white"] + u"\r")
sys.stdout.flush()
| Make Utility.console_log accept Unicode and byte strings as well | tools: Make Utility.console_log accept Unicode and byte strings as well
| Python | apache-2.0 | mashaoze/esp-idf,espressif/esp-idf,armada-ai/esp-idf,www220/esp-idf,www220/esp-idf,mashaoze/esp-idf,www220/esp-idf,www220/esp-idf,mashaoze/esp-idf,espressif/esp-idf,www220/esp-idf,espressif/esp-idf,espressif/esp-idf,armada-ai/esp-idf,mashaoze/esp-idf,armada-ai/esp-idf,armada-ai/esp-idf,mashaoze/esp-idf | python | ## Code Before:
from __future__ import print_function
import sys
_COLOR_CODES = {
"white": '\033[0m',
"red": '\033[31m',
"green": '\033[32m',
"orange": '\033[33m',
"blue": '\033[34m',
"purple": '\033[35m',
"W": '\033[0m',
"R": '\033[31m',
"G": '\033[32m',
"O": '\033[33m',
"B": '\033[34m',
"P": '\033[35m'
}
def console_log(data, color="white", end="\n"):
"""
log data to console.
(if not flush console log, Gitlab-CI won't update logs during job execution)
:param data: data content
:param color: color
"""
if color not in _COLOR_CODES:
color = "white"
color_codes = _COLOR_CODES[color]
print(color_codes + data, end=end)
if color not in ["white", "W"]:
# reset color to white for later logs
print(_COLOR_CODES["white"] + "\r")
sys.stdout.flush()
## Instruction:
tools: Make Utility.console_log accept Unicode and byte strings as well
## Code After:
from __future__ import print_function
import sys
_COLOR_CODES = {
"white": u'\033[0m',
"red": u'\033[31m',
"green": u'\033[32m',
"orange": u'\033[33m',
"blue": u'\033[34m',
"purple": u'\033[35m',
"W": u'\033[0m',
"R": u'\033[31m',
"G": u'\033[32m',
"O": u'\033[33m',
"B": u'\033[34m',
"P": u'\033[35m'
}
def console_log(data, color="white", end="\n"):
"""
log data to console.
(if not flush console log, Gitlab-CI won't update logs during job execution)
:param data: data content
:param color: color
"""
if color not in _COLOR_CODES:
color = "white"
color_codes = _COLOR_CODES[color]
if type(data) is type(b''):
data = data.decode('utf-8', 'replace')
print(color_codes + data, end=end)
if color not in ["white", "W"]:
# reset color to white for later logs
print(_COLOR_CODES["white"] + u"\r")
sys.stdout.flush()
| from __future__ import print_function
import sys
_COLOR_CODES = {
- "white": '\033[0m',
+ "white": u'\033[0m',
? +
- "red": '\033[31m',
+ "red": u'\033[31m',
? +
- "green": '\033[32m',
+ "green": u'\033[32m',
? +
- "orange": '\033[33m',
+ "orange": u'\033[33m',
? +
- "blue": '\033[34m',
+ "blue": u'\033[34m',
? +
- "purple": '\033[35m',
+ "purple": u'\033[35m',
? +
- "W": '\033[0m',
+ "W": u'\033[0m',
? +
- "R": '\033[31m',
? ^
+ "R": u'\033[31m',
? ^
- "G": '\033[32m',
+ "G": u'\033[32m',
? +
- "O": '\033[33m',
+ "O": u'\033[33m',
? +
- "B": '\033[34m',
+ "B": u'\033[34m',
? +
- "P": '\033[35m'
+ "P": u'\033[35m'
? +
}
def console_log(data, color="white", end="\n"):
"""
log data to console.
(if not flush console log, Gitlab-CI won't update logs during job execution)
:param data: data content
:param color: color
"""
if color not in _COLOR_CODES:
color = "white"
color_codes = _COLOR_CODES[color]
+ if type(data) is type(b''):
+ data = data.decode('utf-8', 'replace')
print(color_codes + data, end=end)
if color not in ["white", "W"]:
# reset color to white for later logs
- print(_COLOR_CODES["white"] + "\r")
+ print(_COLOR_CODES["white"] + u"\r")
? +
sys.stdout.flush() | 28 | 0.777778 | 15 | 13 |
b878603f9122d058a3730dd6f716a0c03a7a64e4 | base/mac/launchd.h | base/mac/launchd.h | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once
#include <launch.h>
#include <sys/types.h>
#include <string>
namespace base {
namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
launch_data_t MessageForJob(const std::string& job_label,
const char* operation);
// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
pid_t PIDForJob(const std::string& job_label);
} // namespace mac
} // namespace base
#endif // BASE_MAC_LAUNCHD_H_
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once
#include <launch.h>
#include <sys/types.h>
#include <string>
#include "base/base_export.h"
namespace base {
namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
const char* operation);
// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
BASE_EXPORT
pid_t PIDForJob(const std::string& job_label);
} // namespace mac
} // namespace base
#endif // BASE_MAC_LAUNCHD_H_
| Add BASE_EXPORT macros to base ... again. | Add BASE_EXPORT macros to base ... again.
BUG=90078
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9959092
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@130367 0039d316-1c4b-4281-b951-d872f2087c98
| C | bsd-3-clause | adobe/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,adobe/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,ropik/chromium,yitian134/chromium,ropik/chromium,ropik/chromium | c | ## Code Before:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once
#include <launch.h>
#include <sys/types.h>
#include <string>
namespace base {
namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
launch_data_t MessageForJob(const std::string& job_label,
const char* operation);
// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
pid_t PIDForJob(const std::string& job_label);
} // namespace mac
} // namespace base
#endif // BASE_MAC_LAUNCHD_H_
## Instruction:
Add BASE_EXPORT macros to base ... again.
BUG=90078
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9959092
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@130367 0039d316-1c4b-4281-b951-d872f2087c98
## Code After:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once
#include <launch.h>
#include <sys/types.h>
#include <string>
#include "base/base_export.h"
namespace base {
namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
const char* operation);
// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
BASE_EXPORT
pid_t PIDForJob(const std::string& job_label);
} // namespace mac
} // namespace base
#endif // BASE_MAC_LAUNCHD_H_
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once
#include <launch.h>
#include <sys/types.h>
#include <string>
+ #include "base/base_export.h"
+
namespace base {
namespace mac {
// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
+ BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
const char* operation);
// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
+ BASE_EXPORT
pid_t PIDForJob(const std::string& job_label);
} // namespace mac
} // namespace base
#endif // BASE_MAC_LAUNCHD_H_ | 4 | 0.129032 | 4 | 0 |
b70f65aff53e171b8fa3135ac6412d1fa37dcec3 | _config.yml | _config.yml | baseurl: ""
url: "https://robisateam.github.io/courses/"
title: Visualising Data on the Web
email: isa.kiral@gmail.com
author: Isabell Kiral-Kornek and Robert Kerr
collections:
course_1_web:
output: true
path: /web-course
permalink: /web-course/:path
description: "Introduction to Web Development"
course_2_d3:
output: true
path: /d3-course
permalink: /d3-course/:path
description: "Visualising Data with D3"
course_3_threejs:
output: true
path: /threejs-course
permalink: /threejs-course/:path
description: "Visualising Data with ThreeJS"
# Build settings
markdown: kramdown
exclude: [code]
| baseurl: "https://robisateam.github.io/courses/"
url: "https://robisateam.github.io/courses/"
title: Visualising Data on the Web
email: isa.kiral@gmail.com
author: Isabell Kiral-Kornek and Robert Kerr
collections:
course_1_web:
output: true
path: /web-course
permalink: /web-course/:path
description: "Introduction to Web Development"
course_2_d3:
output: true
path: /d3-course
permalink: /d3-course/:path
description: "Visualising Data with D3"
course_3_threejs:
output: true
path: /threejs-course
permalink: /threejs-course/:path
description: "Visualising Data with ThreeJS"
# Build settings
markdown: kramdown
exclude: [code]
| Set baseurl to fix deployment on github pages. | Set baseurl to fix deployment on github pages.
| YAML | mit | RobIsaTeam/courses,RobIsaTeam/courses | yaml | ## Code Before:
baseurl: ""
url: "https://robisateam.github.io/courses/"
title: Visualising Data on the Web
email: isa.kiral@gmail.com
author: Isabell Kiral-Kornek and Robert Kerr
collections:
course_1_web:
output: true
path: /web-course
permalink: /web-course/:path
description: "Introduction to Web Development"
course_2_d3:
output: true
path: /d3-course
permalink: /d3-course/:path
description: "Visualising Data with D3"
course_3_threejs:
output: true
path: /threejs-course
permalink: /threejs-course/:path
description: "Visualising Data with ThreeJS"
# Build settings
markdown: kramdown
exclude: [code]
## Instruction:
Set baseurl to fix deployment on github pages.
## Code After:
baseurl: "https://robisateam.github.io/courses/"
url: "https://robisateam.github.io/courses/"
title: Visualising Data on the Web
email: isa.kiral@gmail.com
author: Isabell Kiral-Kornek and Robert Kerr
collections:
course_1_web:
output: true
path: /web-course
permalink: /web-course/:path
description: "Introduction to Web Development"
course_2_d3:
output: true
path: /d3-course
permalink: /d3-course/:path
description: "Visualising Data with D3"
course_3_threejs:
output: true
path: /threejs-course
permalink: /threejs-course/:path
description: "Visualising Data with ThreeJS"
# Build settings
markdown: kramdown
exclude: [code]
| - baseurl: ""
+ baseurl: "https://robisateam.github.io/courses/"
url: "https://robisateam.github.io/courses/"
title: Visualising Data on the Web
email: isa.kiral@gmail.com
author: Isabell Kiral-Kornek and Robert Kerr
collections:
course_1_web:
output: true
path: /web-course
permalink: /web-course/:path
description: "Introduction to Web Development"
course_2_d3:
output: true
path: /d3-course
permalink: /d3-course/:path
description: "Visualising Data with D3"
course_3_threejs:
output: true
path: /threejs-course
permalink: /threejs-course/:path
description: "Visualising Data with ThreeJS"
# Build settings
markdown: kramdown
exclude: [code] | 2 | 0.08 | 1 | 1 |
443cc34ad448790ab55dc7ff1047c48c4f589d4b | .travis.yml | .travis.yml | language: python
matrix:
include:
- os: linux
language: python
- os: osx
language: generic
addons:
apt:
packages:
- gcc
- libssl-dev
- libsqlite3-dev
- uuid-dev
before_install:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install python; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then virtualenv -p /usr/local/bin/python venv; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then . ./venv/bin/activate; fi
install:
# Required for OS X. Not restricted by TRAVIS_OS_NAME because including an
# `install` section overrides the implicit `pip install` on Linux.
- pip install -r requirements.txt
script: make test
notifications:
email: false
| language: python
matrix:
include:
- os: linux
language: python
- os: osx
language: generic
addons:
apt:
packages:
- gcc
- libssl-dev
- libsqlite3-dev
- uuid-dev
before_install:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then virtualenv -p /usr/local/bin/python venv; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then . ./venv/bin/activate; fi
install:
# Required for OS X. Not restricted by TRAVIS_OS_NAME because including an
# `install` section overrides the implicit `pip install` on Linux.
- pip install -r requirements.txt
script: make test
notifications:
email: false
| Remove Python install from OS X build steps | Remove Python install from OS X build steps
| YAML | unlicense | benwebber/sqlite3-uuid,benwebber/sqlite3-uuid | yaml | ## Code Before:
language: python
matrix:
include:
- os: linux
language: python
- os: osx
language: generic
addons:
apt:
packages:
- gcc
- libssl-dev
- libsqlite3-dev
- uuid-dev
before_install:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install python; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then virtualenv -p /usr/local/bin/python venv; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then . ./venv/bin/activate; fi
install:
# Required for OS X. Not restricted by TRAVIS_OS_NAME because including an
# `install` section overrides the implicit `pip install` on Linux.
- pip install -r requirements.txt
script: make test
notifications:
email: false
## Instruction:
Remove Python install from OS X build steps
## Code After:
language: python
matrix:
include:
- os: linux
language: python
- os: osx
language: generic
addons:
apt:
packages:
- gcc
- libssl-dev
- libsqlite3-dev
- uuid-dev
before_install:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then virtualenv -p /usr/local/bin/python venv; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then . ./venv/bin/activate; fi
install:
# Required for OS X. Not restricted by TRAVIS_OS_NAME because including an
# `install` section overrides the implicit `pip install` on Linux.
- pip install -r requirements.txt
script: make test
notifications:
email: false
| language: python
matrix:
include:
- os: linux
language: python
- os: osx
language: generic
addons:
apt:
packages:
- gcc
- libssl-dev
- libsqlite3-dev
- uuid-dev
before_install:
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
- - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install python; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then virtualenv -p /usr/local/bin/python venv; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then . ./venv/bin/activate; fi
install:
# Required for OS X. Not restricted by TRAVIS_OS_NAME because including an
# `install` section overrides the implicit `pip install` on Linux.
- pip install -r requirements.txt
script: make test
notifications:
email: false | 1 | 0.03125 | 0 | 1 |
c336f01d2013183cb47a15c9823abca2f5bb2e7a | stdlib/misc/discard_kernel.cpp | stdlib/misc/discard_kernel.cpp |
namespace scanner {
class DiscardKernel : public BatchedKernel {
public:
DiscardKernel(const KernelConfig& config)
: BatchedKernel(config),
device_(config.devices[0]),
work_item_size_(config.work_item_size) {}
void execute(const BatchedColumns& input_columns,
BatchedColumns& output_columns) override {
i32 input_count = (i32)num_rows(input_columns[0]);
u8* output_block = new_block_buffer(device_, 1, input_count);
for (i32 i = 0; i < input_count; ++i) {
insert_element(output_columns[0], output_block, 1);
}
}
private:
DeviceHandle device_;
i32 work_item_size_;
};
REGISTER_OP(Discard).input("ignore").output("dummy");
REGISTER_OP(DiscardFrame).frame_input("ignore").output("dummy");
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::CPU).num_devices(1);
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::GPU).num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::CPU)
.num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::GPU)
.num_devices(1);
}
|
namespace scanner {
class DiscardKernel : public BatchedKernel {
public:
DiscardKernel(const KernelConfig& config)
: BatchedKernel(config),
device_(config.devices[0]),
work_item_size_(config.work_item_size) {}
void execute(const BatchedColumns& input_columns,
BatchedColumns& output_columns) override {
i32 input_count = (i32)num_rows(input_columns[0]);
u8* output_block = new_block_buffer(device_, 1, input_count);
for (i32 i = 0; i < input_count; ++i) {
insert_element(output_columns[0], output_block, 1);
}
}
private:
DeviceHandle device_;
i32 work_item_size_;
};
REGISTER_OP(Discard).input("ignore").output("dummy");
REGISTER_OP(DiscardFrame).frame_input("ignore").output("dummy");
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::CPU).num_devices(1);
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::GPU).num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::CPU)
.batch()
.num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::GPU)
.batch()
.num_devices(1);
}
| Support batching on discard kernel | Support batching on discard kernel
| C++ | apache-2.0 | scanner-research/scanner,scanner-research/scanner,scanner-research/scanner,scanner-research/scanner | c++ | ## Code Before:
namespace scanner {
class DiscardKernel : public BatchedKernel {
public:
DiscardKernel(const KernelConfig& config)
: BatchedKernel(config),
device_(config.devices[0]),
work_item_size_(config.work_item_size) {}
void execute(const BatchedColumns& input_columns,
BatchedColumns& output_columns) override {
i32 input_count = (i32)num_rows(input_columns[0]);
u8* output_block = new_block_buffer(device_, 1, input_count);
for (i32 i = 0; i < input_count; ++i) {
insert_element(output_columns[0], output_block, 1);
}
}
private:
DeviceHandle device_;
i32 work_item_size_;
};
REGISTER_OP(Discard).input("ignore").output("dummy");
REGISTER_OP(DiscardFrame).frame_input("ignore").output("dummy");
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::CPU).num_devices(1);
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::GPU).num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::CPU)
.num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::GPU)
.num_devices(1);
}
## Instruction:
Support batching on discard kernel
## Code After:
namespace scanner {
class DiscardKernel : public BatchedKernel {
public:
DiscardKernel(const KernelConfig& config)
: BatchedKernel(config),
device_(config.devices[0]),
work_item_size_(config.work_item_size) {}
void execute(const BatchedColumns& input_columns,
BatchedColumns& output_columns) override {
i32 input_count = (i32)num_rows(input_columns[0]);
u8* output_block = new_block_buffer(device_, 1, input_count);
for (i32 i = 0; i < input_count; ++i) {
insert_element(output_columns[0], output_block, 1);
}
}
private:
DeviceHandle device_;
i32 work_item_size_;
};
REGISTER_OP(Discard).input("ignore").output("dummy");
REGISTER_OP(DiscardFrame).frame_input("ignore").output("dummy");
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::CPU).num_devices(1);
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::GPU).num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::CPU)
.batch()
.num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::GPU)
.batch()
.num_devices(1);
}
|
namespace scanner {
class DiscardKernel : public BatchedKernel {
public:
DiscardKernel(const KernelConfig& config)
: BatchedKernel(config),
device_(config.devices[0]),
work_item_size_(config.work_item_size) {}
void execute(const BatchedColumns& input_columns,
BatchedColumns& output_columns) override {
i32 input_count = (i32)num_rows(input_columns[0]);
u8* output_block = new_block_buffer(device_, 1, input_count);
for (i32 i = 0; i < input_count; ++i) {
insert_element(output_columns[0], output_block, 1);
}
}
private:
DeviceHandle device_;
i32 work_item_size_;
};
REGISTER_OP(Discard).input("ignore").output("dummy");
REGISTER_OP(DiscardFrame).frame_input("ignore").output("dummy");
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::CPU).num_devices(1);
REGISTER_KERNEL(Discard, DiscardKernel).device(DeviceType::GPU).num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::CPU)
+ .batch()
.num_devices(1);
REGISTER_KERNEL(DiscardFrame, DiscardKernel)
.device(DeviceType::GPU)
+ .batch()
.num_devices(1);
} | 2 | 0.05 | 2 | 0 |
2e468e797e8acc20c624faffbf473fdedcb74f12 | .travis.yml | .travis.yml | language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
after_success:
- npm run coverage
- npm i codecov
- codecov -f ./coverage/lcov.info
notifications:
email:
on_success: never
| language: node_js
sudo: false
node_js:
- "6"
after_success:
- npm run coverage
- npm i codecov
- codecov -f ./coverage/lcov.info
notifications:
email:
on_success: never
| Drop support for Node.js 0.10, 0.12 et 4 | CI: Drop support for Node.js 0.10, 0.12 et 4
| YAML | isc | pugjs/jade-lint,pugjs/pug-lint,benedfit/jadelint,benedfit/jade-lint | yaml | ## Code Before:
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
after_success:
- npm run coverage
- npm i codecov
- codecov -f ./coverage/lcov.info
notifications:
email:
on_success: never
## Instruction:
CI: Drop support for Node.js 0.10, 0.12 et 4
## Code After:
language: node_js
sudo: false
node_js:
- "6"
after_success:
- npm run coverage
- npm i codecov
- codecov -f ./coverage/lcov.info
notifications:
email:
on_success: never
| language: node_js
sudo: false
node_js:
- - "0.10"
- - "0.12"
- - "4"
- "6"
after_success:
- npm run coverage
- npm i codecov
- codecov -f ./coverage/lcov.info
notifications:
email:
on_success: never | 3 | 0.214286 | 0 | 3 |
664a588cf8e45ce32ff2286754be61e3787a080b | tox.ini | tox.ini | [tox]
envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,latest}
[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
deps =
pytest_4: pytest>=4.6,<5.0
pytest_50: pytest>=5.0,<5.2
pytest_51: pytest>=5.1,<5.2
pytest_52: pytest>=5.2,<5.3
pytest_53: pytest>=5.3,<5.4
pytest_54: pytest>=5.4,<5.5
pytest_60: pytest>=6.0,<6.1
pytest_61: pytest>=6.1,<6.2
pytest_62: pytest>=6.2,<6.3
pytest_latest: pytest
commands = pytest -rw {posargs}
| [tox]
envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,60,61,62,latest}
[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
deps =
pytest_4: pytest>=4.6,<5.0
pytest_50: pytest>=5.0,<5.2
pytest_51: pytest>=5.1,<5.2
pytest_52: pytest>=5.2,<5.3
pytest_53: pytest>=5.3,<5.4
pytest_54: pytest>=5.4,<5.5
pytest_60: pytest>=6.0,<6.1
pytest_61: pytest>=6.1,<6.2
pytest_62: pytest>=6.2,<6.3
pytest_latest: pytest
commands = pytest -rw {posargs}
[pytest]
minversion = 4.6
filterwarnings =
ignore:The TerminalReporter\.writer attribute is deprecated, use TerminalReporter\._tw instead at your own risk\.:DeprecationWarning
| Remove nonrelevant deprecation warning during tests | Remove nonrelevant deprecation warning during tests
See https://github.com/pytest-dev/pytest/issues/6936
| INI | mit | ropez/pytest-describe | ini | ## Code Before:
[tox]
envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,latest}
[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
deps =
pytest_4: pytest>=4.6,<5.0
pytest_50: pytest>=5.0,<5.2
pytest_51: pytest>=5.1,<5.2
pytest_52: pytest>=5.2,<5.3
pytest_53: pytest>=5.3,<5.4
pytest_54: pytest>=5.4,<5.5
pytest_60: pytest>=6.0,<6.1
pytest_61: pytest>=6.1,<6.2
pytest_62: pytest>=6.2,<6.3
pytest_latest: pytest
commands = pytest -rw {posargs}
## Instruction:
Remove nonrelevant deprecation warning during tests
See https://github.com/pytest-dev/pytest/issues/6936
## Code After:
[tox]
envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,60,61,62,latest}
[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
deps =
pytest_4: pytest>=4.6,<5.0
pytest_50: pytest>=5.0,<5.2
pytest_51: pytest>=5.1,<5.2
pytest_52: pytest>=5.2,<5.3
pytest_53: pytest>=5.3,<5.4
pytest_54: pytest>=5.4,<5.5
pytest_60: pytest>=6.0,<6.1
pytest_61: pytest>=6.1,<6.2
pytest_62: pytest>=6.2,<6.3
pytest_latest: pytest
commands = pytest -rw {posargs}
[pytest]
minversion = 4.6
filterwarnings =
ignore:The TerminalReporter\.writer attribute is deprecated, use TerminalReporter\._tw instead at your own risk\.:DeprecationWarning
| [tox]
- envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,latest}
+ envlist = {py36,py37,py38,py39}-pytest_{4,50,51,52,53,54,60,61,62,latest}
? +++++++++
[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
deps =
pytest_4: pytest>=4.6,<5.0
pytest_50: pytest>=5.0,<5.2
pytest_51: pytest>=5.1,<5.2
pytest_52: pytest>=5.2,<5.3
pytest_53: pytest>=5.3,<5.4
pytest_54: pytest>=5.4,<5.5
pytest_60: pytest>=6.0,<6.1
pytest_61: pytest>=6.1,<6.2
pytest_62: pytest>=6.2,<6.3
pytest_latest: pytest
commands = pytest -rw {posargs}
+
+ [pytest]
+ minversion = 4.6
+ filterwarnings =
+ ignore:The TerminalReporter\.writer attribute is deprecated, use TerminalReporter\._tw instead at your own risk\.:DeprecationWarning | 7 | 0.333333 | 6 | 1 |
3f38e6607e9c990465f5221c79282d2dd11282bf | package.json | package.json | {
"name": "hit-validation",
"version": "0.0.9",
"description": "HTTP hit validation against API Blueprint",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"dependencies": {
"amanda": "git://github.com/apiaryio/Amanda.git",
"async": ""
},
"devDependencies": {
"chai": "~1.6.0",
"coffee-script": "~1.6.3",
"mocha": "~1.10.0",
"cucumber": "0.3.0",
"lodash": "1.3.1"
},
"scripts": {
"test": "mocha --compilers 'coffee:coffee-script' ./test/**/*-test.coffee",
"prepublish": "scripts/build"
},
"repository": {
"type": "git",
"url": "git@github.com:apiaryio/hit-validation.git"
},
"keywords": [
"http",
"hit",
"proxy",
"mock",
"api",
"bluerpint",
"rest"
],
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Adam Kliment",
"email": "adam@apiary.io"
},
{
"name": "Peter Grilli",
"email": "tully@apiary.io"
}
],
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
"node": "*"
}
}
| {
"name": "hit-validation",
"version": "0.0.9",
"description": "HTTP hit validation against API Blueprint",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"dependencies": {
"amanda": "git://github.com/apiaryio/Amanda.git",
"async": ""
},
"devDependencies": {
"chai": "~1.6.0",
"coffee-script": "~1.6.3",
"mocha": "~1.10.0",
"cucumber": "0.3.0",
"lodash": "1.3.1"
},
"scripts": {
"test": "scripts/test",
"prepublish": "scripts/build"
},
"repository": {
"type": "git",
"url": "git@github.com:apiaryio/hit-validation.git"
},
"keywords": [
"http",
"hit",
"proxy",
"mock",
"api",
"bluerpint",
"rest"
],
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Adam Kliment",
"email": "adam@apiary.io"
},
{
"name": "Peter Grilli",
"email": "tully@apiary.io"
}
],
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
"node": "*"
}
}
| Test command in dedicated script | Test command in dedicated script
| JSON | mit | joaosa/gavel.js,joaosa/gavel.js,apiaryio/gavel.js | json | ## Code Before:
{
"name": "hit-validation",
"version": "0.0.9",
"description": "HTTP hit validation against API Blueprint",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"dependencies": {
"amanda": "git://github.com/apiaryio/Amanda.git",
"async": ""
},
"devDependencies": {
"chai": "~1.6.0",
"coffee-script": "~1.6.3",
"mocha": "~1.10.0",
"cucumber": "0.3.0",
"lodash": "1.3.1"
},
"scripts": {
"test": "mocha --compilers 'coffee:coffee-script' ./test/**/*-test.coffee",
"prepublish": "scripts/build"
},
"repository": {
"type": "git",
"url": "git@github.com:apiaryio/hit-validation.git"
},
"keywords": [
"http",
"hit",
"proxy",
"mock",
"api",
"bluerpint",
"rest"
],
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Adam Kliment",
"email": "adam@apiary.io"
},
{
"name": "Peter Grilli",
"email": "tully@apiary.io"
}
],
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
"node": "*"
}
}
## Instruction:
Test command in dedicated script
## Code After:
{
"name": "hit-validation",
"version": "0.0.9",
"description": "HTTP hit validation against API Blueprint",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"dependencies": {
"amanda": "git://github.com/apiaryio/Amanda.git",
"async": ""
},
"devDependencies": {
"chai": "~1.6.0",
"coffee-script": "~1.6.3",
"mocha": "~1.10.0",
"cucumber": "0.3.0",
"lodash": "1.3.1"
},
"scripts": {
"test": "scripts/test",
"prepublish": "scripts/build"
},
"repository": {
"type": "git",
"url": "git@github.com:apiaryio/hit-validation.git"
},
"keywords": [
"http",
"hit",
"proxy",
"mock",
"api",
"bluerpint",
"rest"
],
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Adam Kliment",
"email": "adam@apiary.io"
},
{
"name": "Peter Grilli",
"email": "tully@apiary.io"
}
],
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
"node": "*"
}
}
| {
"name": "hit-validation",
"version": "0.0.9",
"description": "HTTP hit validation against API Blueprint",
"main": "lib/index.js",
"directories": {
"test": "test"
},
"dependencies": {
"amanda": "git://github.com/apiaryio/Amanda.git",
"async": ""
},
"devDependencies": {
"chai": "~1.6.0",
"coffee-script": "~1.6.3",
"mocha": "~1.10.0",
"cucumber": "0.3.0",
"lodash": "1.3.1"
},
"scripts": {
- "test": "mocha --compilers 'coffee:coffee-script' ./test/**/*-test.coffee",
+ "test": "scripts/test",
"prepublish": "scripts/build"
},
"repository": {
"type": "git",
"url": "git@github.com:apiaryio/hit-validation.git"
},
"keywords": [
"http",
"hit",
"proxy",
"mock",
"api",
"bluerpint",
"rest"
],
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Adam Kliment",
"email": "adam@apiary.io"
},
{
"name": "Peter Grilli",
"email": "tully@apiary.io"
}
],
"license": "MIT",
"readmeFilename": "README.md",
"engines": {
"node": "*"
}
} | 2 | 0.037736 | 1 | 1 |
bbd679d4227504d51fb5be40f2dd3e4053942e20 | playbook_minio.yml | playbook_minio.yml | ---
- hosts: all
remote_user: root
roles:
- { role: minio,
minio_server_datadirs: [ "/data/local/minio" ] }
any_errors_fatal: true
| ---
- hosts: minio
remote_user: root
vars_files:
- vars/minio_vars.yml
roles:
- minio
any_errors_fatal: true
| Use only hosts assigned for minio and use the global variables defined for minio | Use only hosts assigned for minio and use the global variables defined for minio
| YAML | apache-2.0 | nlesc-sherlock/emma,nlesc-sherlock/emma,nlesc-sherlock/emma | yaml | ## Code Before:
---
- hosts: all
remote_user: root
roles:
- { role: minio,
minio_server_datadirs: [ "/data/local/minio" ] }
any_errors_fatal: true
## Instruction:
Use only hosts assigned for minio and use the global variables defined for minio
## Code After:
---
- hosts: minio
remote_user: root
vars_files:
- vars/minio_vars.yml
roles:
- minio
any_errors_fatal: true
| ---
- - hosts: all
+ - hosts: minio
remote_user: root
+ vars_files:
+ - vars/minio_vars.yml
roles:
+ - minio
- - { role: minio,
- minio_server_datadirs: [ "/data/local/minio" ] }
any_errors_fatal: true | 7 | 0.875 | 4 | 3 |
57577003c5b97539e2f6afa7e7fca828d09102db | README.md | README.md |
Sample ES6 JavaScript project setup with jspm, SystemJS, Babel and React.
## Environment setup
```sh
$ npm install
$ jspm install
```
There's no server included here, but you can use Python's built in server:
```sh
$ python -m SimpleHTTPServer 8000
``` |
Sample ES6 JavaScript project setup with jspm, SystemJS, Babel and React.
## Environment setup
```sh
$ npm install
$ jspm install
```
There's no server included here, but you can use Python's built in server:
```sh
$ python -m SimpleHTTPServer 8000
```
## Bundle all the modules (no HTML script tag changes needed)
```sh
$ jspm bundle app/main --inject
``` | Add section about module bundling | Add section about module bundling
| Markdown | mit | akikoo/systemjs-jspm-boilerplate,akikoo/systemjs-jspm-sass-setup,akikoo/systemjs-jspm-boilerplate,akikoo/systemjs-jspm-sass-setup | markdown | ## Code Before:
Sample ES6 JavaScript project setup with jspm, SystemJS, Babel and React.
## Environment setup
```sh
$ npm install
$ jspm install
```
There's no server included here, but you can use Python's built in server:
```sh
$ python -m SimpleHTTPServer 8000
```
## Instruction:
Add section about module bundling
## Code After:
Sample ES6 JavaScript project setup with jspm, SystemJS, Babel and React.
## Environment setup
```sh
$ npm install
$ jspm install
```
There's no server included here, but you can use Python's built in server:
```sh
$ python -m SimpleHTTPServer 8000
```
## Bundle all the modules (no HTML script tag changes needed)
```sh
$ jspm bundle app/main --inject
``` |
Sample ES6 JavaScript project setup with jspm, SystemJS, Babel and React.
## Environment setup
```sh
$ npm install
$ jspm install
```
There's no server included here, but you can use Python's built in server:
```sh
$ python -m SimpleHTTPServer 8000
```
+
+ ## Bundle all the modules (no HTML script tag changes needed)
+
+ ```sh
+ $ jspm bundle app/main --inject
+ ``` | 6 | 0.4 | 6 | 0 |
a90ecdeea29892d105168302b4f20e40c9febc6a | packages/po/polynomials-bernstein.yaml | packages/po/polynomials-bernstein.yaml | homepage: ''
changelog-type: ''
hash: a2995b8f6a613204d2e946ec26c9e247bfa578af29f120f8484b87a3d9d587bd
test-bench-deps: {}
maintainer: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
synopsis: A solver for systems of polynomial equations in bernstein form
changelog: ''
basic-deps:
base: <5
vector: -any
all-versions:
- '1'
- '1.1'
- '1.1.1'
author: ''
latest: '1.1.1'
description-type: haddock
description: ! 'This library defines an optimized type for representing polynomials
in Bernstein form, as well as instances of numeric classes and other
manipulation functions, and a solver of systems of polynomial
equations in this form.'
license-name: GPL
| homepage: ''
changelog-type: ''
hash: 4b1ecc97eacbda313eafff66ecd83f08d345f6ac3f14c2d1bee71f33d497ac2b
test-bench-deps: {}
maintainer: Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>
synopsis: A solver for systems of polynomial equations in bernstein form
changelog: ''
basic-deps:
base: <5
vector: ! '>=0.11'
all-versions:
- '1'
- '1.1'
- '1.1.1'
- '1.1.2'
author: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
latest: '1.1.2'
description-type: haddock
description: ! 'This library defines an optimized type for representing polynomials
in Bernstein form, as well as instances of numeric classes and other
manipulation functions, and a solver of systems of polynomial
equations in this form.'
license-name: GPL
| Update from Hackage at 2015-09-29T13:37:45+0000 | Update from Hackage at 2015-09-29T13:37:45+0000
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: ''
changelog-type: ''
hash: a2995b8f6a613204d2e946ec26c9e247bfa578af29f120f8484b87a3d9d587bd
test-bench-deps: {}
maintainer: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
synopsis: A solver for systems of polynomial equations in bernstein form
changelog: ''
basic-deps:
base: <5
vector: -any
all-versions:
- '1'
- '1.1'
- '1.1.1'
author: ''
latest: '1.1.1'
description-type: haddock
description: ! 'This library defines an optimized type for representing polynomials
in Bernstein form, as well as instances of numeric classes and other
manipulation functions, and a solver of systems of polynomial
equations in this form.'
license-name: GPL
## Instruction:
Update from Hackage at 2015-09-29T13:37:45+0000
## Code After:
homepage: ''
changelog-type: ''
hash: 4b1ecc97eacbda313eafff66ecd83f08d345f6ac3f14c2d1bee71f33d497ac2b
test-bench-deps: {}
maintainer: Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>
synopsis: A solver for systems of polynomial equations in bernstein form
changelog: ''
basic-deps:
base: <5
vector: ! '>=0.11'
all-versions:
- '1'
- '1.1'
- '1.1.1'
- '1.1.2'
author: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
latest: '1.1.2'
description-type: haddock
description: ! 'This library defines an optimized type for representing polynomials
in Bernstein form, as well as instances of numeric classes and other
manipulation functions, and a solver of systems of polynomial
equations in this form.'
license-name: GPL
| homepage: ''
changelog-type: ''
- hash: a2995b8f6a613204d2e946ec26c9e247bfa578af29f120f8484b87a3d9d587bd
+ hash: 4b1ecc97eacbda313eafff66ecd83f08d345f6ac3f14c2d1bee71f33d497ac2b
test-bench-deps: {}
- maintainer: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
+ maintainer: Jean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>
synopsis: A solver for systems of polynomial equations in bernstein form
changelog: ''
basic-deps:
base: <5
- vector: -any
+ vector: ! '>=0.11'
all-versions:
- '1'
- '1.1'
- '1.1.1'
- author: ''
+ - '1.1.2'
+ author: Pierre-Etienne Meunier <pierreetienne.meunier@gmail.com>
- latest: '1.1.1'
? ^
+ latest: '1.1.2'
? ^
description-type: haddock
description: ! 'This library defines an optimized type for representing polynomials
in Bernstein form, as well as instances of numeric classes and other
manipulation functions, and a solver of systems of polynomial
equations in this form.'
license-name: GPL | 11 | 0.44 | 6 | 5 |
add000663a614ba63f96657434480bd68ee8e49a | app/views/subscriptions/create.js.erb | app/views/subscriptions/create.js.erb | <% if @results[:options].any? %>
feedbin.modalBox('<%= j render partial: "choices", locals: { options: @results[:options].first } %>');
<% elsif @results[:success].any? %>
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, saved_searches: @saved_searches, tags: @tags, feeds: @feeds} %>');
feedbin.showNotification('You have subscribed.');
$("[data-feed-id=<%= @click_feed %>] a").click();
$('.feeds').animate({
scrollTop: feedbin.scrollTo($("[data-feed-id=<%= @click_feed %>]"), $('.feeds'))
}, 200);
feedbin.updateTitle('<%= j @user.title_with_count %>')
<% else %>
feedbin.showNotification('No feed found.');
<% end %>
| <% if @results[:options].any? %>
feedbin.modalBox('<%= j render partial: "choices", locals: { options: @results[:options].first } %>');
<% elsif @results[:success].any? %>
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, saved_searches: @saved_searches, tags: @tags, feeds: @feeds} %>');
feedbin.showNotification('You have subscribed.');
$("[data-feed-id=<%= @click_feed %>] a").click();
feedbin.hideSubscribe()
$('.feeds').animate({
scrollTop: feedbin.scrollTo($("[data-feed-id=<%= @click_feed %>]"), $('.feeds'))
}, 200);
feedbin.updateTitle('<%= j @user.title_with_count %>')
<% else %>
feedbin.showNotification('No feed found.');
<% end %>
| Hide subscribe after successful subscription. | Hide subscribe after successful subscription.
| HTML+ERB | mit | brendanlong/feedbin,azukiapp/feedbin,feedbin/feedbin,nota-ja/feedbin,azukiapp/feedbin,brendanlong/feedbin,feedbin/feedbin,saitodisse/feedbin,nota-ja/feedbin,saitodisse/feedbin,nota-ja/feedbin,brendanlong/feedbin,saitodisse/feedbin,feedbin/feedbin,fearenales/feedbin,feedbin/feedbin,fearenales/feedbin,azukiapp/feedbin,fearenales/feedbin | html+erb | ## Code Before:
<% if @results[:options].any? %>
feedbin.modalBox('<%= j render partial: "choices", locals: { options: @results[:options].first } %>');
<% elsif @results[:success].any? %>
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, saved_searches: @saved_searches, tags: @tags, feeds: @feeds} %>');
feedbin.showNotification('You have subscribed.');
$("[data-feed-id=<%= @click_feed %>] a").click();
$('.feeds').animate({
scrollTop: feedbin.scrollTo($("[data-feed-id=<%= @click_feed %>]"), $('.feeds'))
}, 200);
feedbin.updateTitle('<%= j @user.title_with_count %>')
<% else %>
feedbin.showNotification('No feed found.');
<% end %>
## Instruction:
Hide subscribe after successful subscription.
## Code After:
<% if @results[:options].any? %>
feedbin.modalBox('<%= j render partial: "choices", locals: { options: @results[:options].first } %>');
<% elsif @results[:success].any? %>
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, saved_searches: @saved_searches, tags: @tags, feeds: @feeds} %>');
feedbin.showNotification('You have subscribed.');
$("[data-feed-id=<%= @click_feed %>] a").click();
feedbin.hideSubscribe()
$('.feeds').animate({
scrollTop: feedbin.scrollTo($("[data-feed-id=<%= @click_feed %>]"), $('.feeds'))
}, 200);
feedbin.updateTitle('<%= j @user.title_with_count %>')
<% else %>
feedbin.showNotification('No feed found.');
<% end %>
| <% if @results[:options].any? %>
feedbin.modalBox('<%= j render partial: "choices", locals: { options: @results[:options].first } %>');
<% elsif @results[:success].any? %>
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, saved_searches: @saved_searches, tags: @tags, feeds: @feeds} %>');
feedbin.showNotification('You have subscribed.');
$("[data-feed-id=<%= @click_feed %>] a").click();
+ feedbin.hideSubscribe()
$('.feeds').animate({
scrollTop: feedbin.scrollTo($("[data-feed-id=<%= @click_feed %>]"), $('.feeds'))
}, 200);
feedbin.updateTitle('<%= j @user.title_with_count %>')
<% else %>
feedbin.showNotification('No feed found.');
<% end %> | 1 | 0.076923 | 1 | 0 |
00f0230d83da534374285e25ee4be1043b228cb7 | test/transform/index.js | test/transform/index.js | // A unit for each method.
const almostEqual = require('./almostEqual.test')
const create = require('./create.test')
const createFromArray = require('./createFromArray.test')
const createFromPolar = require('./createFromPolar.test')
const epsilon = require('./epsilon.test')
const equal = require('./equal.test')
const getRotation = require('./getRotation.test')
const getScale = require('./getScale.test')
const getTranslation = require('./getTranslation.test')
const inverse = require('./inverse.test')
const multiply = require('./multiply.test')
const toMatrix = require('./toMatrix.test')
const validate = require('./validate.test')
module.exports = (t) => {
t.test('nudged.transform.almostEqual', almostEqual)
t.test('nudged.transform.create', create)
t.test('nudged.transform.createFromArray', createFromArray)
t.test('nudged.transform.createFromPolar', createFromPolar)
t.test('nudged.transform.EPSILON', epsilon)
t.test('nudged.transform.equal', equal)
t.test('nudged.transform.getRotation', getRotation)
t.test('nudged.transform.getScale', getScale)
t.test('nudged.transform.getTranslation', getTranslation)
t.test('nudged.transform.inverse', inverse)
t.test('nudged.transform.toMatrix', toMatrix)
t.test('nudged.transform.validate', validate)
}
| // A unit for each method.
const almostEqual = require('./almostEqual.test')
const create = require('./create.test')
const createFromArray = require('./createFromArray.test')
const createFromPolar = require('./createFromPolar.test')
const epsilon = require('./epsilon.test')
const equal = require('./equal.test')
const getRotation = require('./getRotation.test')
const getScale = require('./getScale.test')
const getTranslation = require('./getTranslation.test')
const inverse = require('./inverse.test')
const multiply = require('./multiply.test')
const toMatrix = require('./toMatrix.test')
const validate = require('./validate.test')
module.exports = (t) => {
t.test('nudged.transform.almostEqual', almostEqual)
t.test('nudged.transform.create', create)
t.test('nudged.transform.createFromArray', createFromArray)
t.test('nudged.transform.createFromPolar', createFromPolar)
t.test('nudged.transform.EPSILON', epsilon)
t.test('nudged.transform.equal', equal)
t.test('nudged.transform.getRotation', getRotation)
t.test('nudged.transform.getScale', getScale)
t.test('nudged.transform.getTranslation', getTranslation)
t.test('nudged.transform.inverse', inverse)
t.test('nudged.transform.multiply', multiply)
t.test('nudged.transform.toMatrix', toMatrix)
t.test('nudged.transform.validate', validate)
}
| Add missing test line for multiply | Add missing test line for multiply
| JavaScript | mit | axelpale/nudged | javascript | ## Code Before:
// A unit for each method.
const almostEqual = require('./almostEqual.test')
const create = require('./create.test')
const createFromArray = require('./createFromArray.test')
const createFromPolar = require('./createFromPolar.test')
const epsilon = require('./epsilon.test')
const equal = require('./equal.test')
const getRotation = require('./getRotation.test')
const getScale = require('./getScale.test')
const getTranslation = require('./getTranslation.test')
const inverse = require('./inverse.test')
const multiply = require('./multiply.test')
const toMatrix = require('./toMatrix.test')
const validate = require('./validate.test')
module.exports = (t) => {
t.test('nudged.transform.almostEqual', almostEqual)
t.test('nudged.transform.create', create)
t.test('nudged.transform.createFromArray', createFromArray)
t.test('nudged.transform.createFromPolar', createFromPolar)
t.test('nudged.transform.EPSILON', epsilon)
t.test('nudged.transform.equal', equal)
t.test('nudged.transform.getRotation', getRotation)
t.test('nudged.transform.getScale', getScale)
t.test('nudged.transform.getTranslation', getTranslation)
t.test('nudged.transform.inverse', inverse)
t.test('nudged.transform.toMatrix', toMatrix)
t.test('nudged.transform.validate', validate)
}
## Instruction:
Add missing test line for multiply
## Code After:
// A unit for each method.
const almostEqual = require('./almostEqual.test')
const create = require('./create.test')
const createFromArray = require('./createFromArray.test')
const createFromPolar = require('./createFromPolar.test')
const epsilon = require('./epsilon.test')
const equal = require('./equal.test')
const getRotation = require('./getRotation.test')
const getScale = require('./getScale.test')
const getTranslation = require('./getTranslation.test')
const inverse = require('./inverse.test')
const multiply = require('./multiply.test')
const toMatrix = require('./toMatrix.test')
const validate = require('./validate.test')
module.exports = (t) => {
t.test('nudged.transform.almostEqual', almostEqual)
t.test('nudged.transform.create', create)
t.test('nudged.transform.createFromArray', createFromArray)
t.test('nudged.transform.createFromPolar', createFromPolar)
t.test('nudged.transform.EPSILON', epsilon)
t.test('nudged.transform.equal', equal)
t.test('nudged.transform.getRotation', getRotation)
t.test('nudged.transform.getScale', getScale)
t.test('nudged.transform.getTranslation', getTranslation)
t.test('nudged.transform.inverse', inverse)
t.test('nudged.transform.multiply', multiply)
t.test('nudged.transform.toMatrix', toMatrix)
t.test('nudged.transform.validate', validate)
}
| // A unit for each method.
const almostEqual = require('./almostEqual.test')
const create = require('./create.test')
const createFromArray = require('./createFromArray.test')
const createFromPolar = require('./createFromPolar.test')
const epsilon = require('./epsilon.test')
const equal = require('./equal.test')
const getRotation = require('./getRotation.test')
const getScale = require('./getScale.test')
const getTranslation = require('./getTranslation.test')
const inverse = require('./inverse.test')
const multiply = require('./multiply.test')
const toMatrix = require('./toMatrix.test')
const validate = require('./validate.test')
module.exports = (t) => {
t.test('nudged.transform.almostEqual', almostEqual)
t.test('nudged.transform.create', create)
t.test('nudged.transform.createFromArray', createFromArray)
t.test('nudged.transform.createFromPolar', createFromPolar)
t.test('nudged.transform.EPSILON', epsilon)
t.test('nudged.transform.equal', equal)
t.test('nudged.transform.getRotation', getRotation)
t.test('nudged.transform.getScale', getScale)
t.test('nudged.transform.getTranslation', getTranslation)
t.test('nudged.transform.inverse', inverse)
+ t.test('nudged.transform.multiply', multiply)
t.test('nudged.transform.toMatrix', toMatrix)
t.test('nudged.transform.validate', validate)
} | 1 | 0.034483 | 1 | 0 |
2ed84787fb6ae9c9277d2a4ffa7d7ca48e0f1ae3 | show-a-message-when-two-or-more-random-numbers-match.md | show-a-message-when-two-or-more-random-numbers-match.md |
> In this task, you'll use HTML, CSS, and JavaScript to show a message when some of the random numbers match.

Now that your page has three different random numbers, sometimes they'll match. Write some JavaScript that checks if any of numbers match.
## Highlighting
Highlight the numbers that are the matching ones by
* using JS to add a class to the `div` in the HTML;
* adding styles in the your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
## Messaging
Display a message under the numbers that says
* what the matched number was;
* how many matches there were.
## Add files and push them to GitHub
Once you're done, add your changes to git by using similar commands to the ones you used for the previous tasks. If you want to add multiple files at the same time, you can do it like this:
```
git add index.html styles.css script.js
```
|
> In this task, you'll use HTML, CSS, and JavaScript to show a message when some of the random numbers match.

Now that your page has three different random numbers, sometimes they'll match. Write some JavaScript that checks if any of numbers match.
## Highlighting
Highlight the numbers that are the matching ones by
* using JS to add a class (for example, `highlight`) to the `div` in the HTML;
* adding styles in your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
For adding and removing classes, have a look at:
* [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
* [classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)
## Messaging
Display a message under the numbers that says
* what the matched number was;
* how many matches there were.
## Add files and push them to GitHub
Once you're done, add your changes to git by using similar commands to the ones you used for the previous tasks. If you want to add multiple files at the same time, you can do it like this:
```
git add index.html styles.css script.js
```
| Add helpful links for class manipulation | Add helpful links for class manipulation | Markdown | mit | SteveBarnett/Playing-With-Matches | markdown | ## Code Before:
> In this task, you'll use HTML, CSS, and JavaScript to show a message when some of the random numbers match.

Now that your page has three different random numbers, sometimes they'll match. Write some JavaScript that checks if any of numbers match.
## Highlighting
Highlight the numbers that are the matching ones by
* using JS to add a class to the `div` in the HTML;
* adding styles in the your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
## Messaging
Display a message under the numbers that says
* what the matched number was;
* how many matches there were.
## Add files and push them to GitHub
Once you're done, add your changes to git by using similar commands to the ones you used for the previous tasks. If you want to add multiple files at the same time, you can do it like this:
```
git add index.html styles.css script.js
```
## Instruction:
Add helpful links for class manipulation
## Code After:
> In this task, you'll use HTML, CSS, and JavaScript to show a message when some of the random numbers match.

Now that your page has three different random numbers, sometimes they'll match. Write some JavaScript that checks if any of numbers match.
## Highlighting
Highlight the numbers that are the matching ones by
* using JS to add a class (for example, `highlight`) to the `div` in the HTML;
* adding styles in your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
For adding and removing classes, have a look at:
* [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
* [classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)
## Messaging
Display a message under the numbers that says
* what the matched number was;
* how many matches there were.
## Add files and push them to GitHub
Once you're done, add your changes to git by using similar commands to the ones you used for the previous tasks. If you want to add multiple files at the same time, you can do it like this:
```
git add index.html styles.css script.js
```
|
> In this task, you'll use HTML, CSS, and JavaScript to show a message when some of the random numbers match.

Now that your page has three different random numbers, sometimes they'll match. Write some JavaScript that checks if any of numbers match.
## Highlighting
Highlight the numbers that are the matching ones by
- * using JS to add a class to the `div` in the HTML;
+ * using JS to add a class (for example, `highlight`) to the `div` in the HTML;
? +++++++++++++++++++++++++++
- * adding styles in the your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
? ----
+ * adding styles in your CSS file that use your new class (try changing the `color`, `background-color`, `border`, and more!).
+
+ For adding and removing classes, have a look at:
+
+ * [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
+ * [classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)
## Messaging
Display a message under the numbers that says
* what the matched number was;
* how many matches there were.
## Add files and push them to GitHub
Once you're done, add your changes to git by using similar commands to the ones you used for the previous tasks. If you want to add multiple files at the same time, you can do it like this:
```
git add index.html styles.css script.js
``` | 9 | 0.321429 | 7 | 2 |
da06f86ffd03c2693fe08d50d0e61faf53fbfd15 | wercker.yml | wercker.yml | box: wercker/php
build:
# The steps that will be executed on build
steps:
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- mbrevda/php-lint:
directory: .
- script:
name: install dependencies
code: composer install --no-interaction
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
- mbrevda/phpcs:
directory: src/
standard: PSR2
- script:
name: PHPUnit
code: vendor/bin/phpunit --configuration tests/phpunit.xml
| box: wercker/php
build:
# The steps that will be executed on build
steps:
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- mbrevda/php-lint:
directory: .
- script:
name: update composer
code: composer selfupdate
- script:
name: install dependencies
code: composer install --no-interaction
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
- mbrevda/phpcs:
directory: src/
standard: PSR2
- script:
name: PHPUnit
code: vendor/bin/phpunit --configuration tests/phpunit.xml
| Update composer before running tests so that its psr-4 compatible | Update composer before running tests so that its psr-4 compatible
| YAML | bsd-3-clause | mbrevda/aurasql-queryproxy | yaml | ## Code Before:
box: wercker/php
build:
# The steps that will be executed on build
steps:
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- mbrevda/php-lint:
directory: .
- script:
name: install dependencies
code: composer install --no-interaction
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
- mbrevda/phpcs:
directory: src/
standard: PSR2
- script:
name: PHPUnit
code: vendor/bin/phpunit --configuration tests/phpunit.xml
## Instruction:
Update composer before running tests so that its psr-4 compatible
## Code After:
box: wercker/php
build:
# The steps that will be executed on build
steps:
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- mbrevda/php-lint:
directory: .
- script:
name: update composer
code: composer selfupdate
- script:
name: install dependencies
code: composer install --no-interaction
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
- mbrevda/phpcs:
directory: src/
standard: PSR2
- script:
name: PHPUnit
code: vendor/bin/phpunit --configuration tests/phpunit.xml
| box: wercker/php
build:
# The steps that will be executed on build
steps:
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- mbrevda/php-lint:
directory: .
+ - script:
+ name: update composer
+ code: composer selfupdate
- script:
name: install dependencies
code: composer install --no-interaction
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
- mbrevda/phpcs:
directory: src/
standard: PSR2
- script:
name: PHPUnit
code: vendor/bin/phpunit --configuration tests/phpunit.xml | 3 | 0.136364 | 3 | 0 |
13e8e8e4ae50fa4fed25a489ca554e70705923bb | packages/viu-ui/client/components/IconButton.vue | packages/viu-ui/client/components/IconButton.vue | <template>
<div class="viu-icon-button" @click="$emit('click')" @mousedown="$emit('mousedown')" @mouseup="$emit('mouseup')">
<Icon :name="name"></Icon>
</div>
</template>
<script>
import Icon from "./Icon.vue";
export default {
props: {
name: String,
},
components: {
Icon,
},
}
</script>
| <template>
<div class="viu-icon-button" @click="$emit('click')" @mousedown="$emit('mousedown')" @mouseup="$emit('mouseup')">
<icon @click="$emit('click')" :name="name"></icon>
</div>
</template>
<script>
import Icon from "./Icon.vue";
export default {
props: {
name: String,
},
components: {
Icon,
},
}
</script>
| Add click emit for Icon Button | Add click emit for Icon Button
| Vue | mit | DevsignStudio/viu,DevsignStudio/viu,DevsignStudio/viu | vue | ## Code Before:
<template>
<div class="viu-icon-button" @click="$emit('click')" @mousedown="$emit('mousedown')" @mouseup="$emit('mouseup')">
<Icon :name="name"></Icon>
</div>
</template>
<script>
import Icon from "./Icon.vue";
export default {
props: {
name: String,
},
components: {
Icon,
},
}
</script>
## Instruction:
Add click emit for Icon Button
## Code After:
<template>
<div class="viu-icon-button" @click="$emit('click')" @mousedown="$emit('mousedown')" @mouseup="$emit('mouseup')">
<icon @click="$emit('click')" :name="name"></icon>
</div>
</template>
<script>
import Icon from "./Icon.vue";
export default {
props: {
name: String,
},
components: {
Icon,
},
}
</script>
| <template>
<div class="viu-icon-button" @click="$emit('click')" @mousedown="$emit('mousedown')" @mouseup="$emit('mouseup')">
- <Icon :name="name"></Icon>
+ <icon @click="$emit('click')" :name="name"></icon>
</div>
</template>
<script>
import Icon from "./Icon.vue";
export default {
props: {
name: String,
},
components: {
Icon,
},
}
</script> | 2 | 0.117647 | 1 | 1 |
09240c56f36dea23571ce8796b1732bbdc498e1e | jar-service/src/main/java/com/sixsq/slipstream/resource/MeteringRedirector.java | jar-service/src/main/java/com/sixsq/slipstream/resource/MeteringRedirector.java | package com.sixsq.slipstream.resource;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Reference;
import org.restlet.routing.Redirector;
public class MeteringRedirector extends Redirector {
public MeteringRedirector(Context context, String targetPattern, int mode) {
super(context, targetPattern, mode);
}
protected void outboundServerRedirect(Reference targetRef, Request request,
Response response) {
String user = request.getClientInfo().getUser().getName();
request = addUserToQuery(request, user);
super.outboundServerRedirect(targetRef, request,
response);
}
private Request addUserToQuery(Request request, String user) {
String query = request.getResourceRef().getQuery();
request.getResourceRef().setQuery(query + "&user_id=" + user);
return request;
}
}
| package com.sixsq.slipstream.resource;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Reference;
import org.restlet.routing.Redirector;
public class MeteringRedirector extends Redirector {
public MeteringRedirector(Context context, String targetPattern, int mode) {
super(context, targetPattern, mode);
}
protected void outboundServerRedirect(Reference targetRef, Request request,
Response response) {
String user = request.getClientInfo().getUser().getName();
targetRef.addQueryParameter("user_id", user);
super.outboundServerRedirect(targetRef, request,
response);
}
}
| Add query fragment to target | Add query fragment to target
| Java | apache-2.0 | slipstream/SlipStreamServer,slipstream/SlipStreamServer,slipstream/SlipStreamServer,slipstream/SlipStreamServer | java | ## Code Before:
package com.sixsq.slipstream.resource;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Reference;
import org.restlet.routing.Redirector;
public class MeteringRedirector extends Redirector {
public MeteringRedirector(Context context, String targetPattern, int mode) {
super(context, targetPattern, mode);
}
protected void outboundServerRedirect(Reference targetRef, Request request,
Response response) {
String user = request.getClientInfo().getUser().getName();
request = addUserToQuery(request, user);
super.outboundServerRedirect(targetRef, request,
response);
}
private Request addUserToQuery(Request request, String user) {
String query = request.getResourceRef().getQuery();
request.getResourceRef().setQuery(query + "&user_id=" + user);
return request;
}
}
## Instruction:
Add query fragment to target
## Code After:
package com.sixsq.slipstream.resource;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Reference;
import org.restlet.routing.Redirector;
public class MeteringRedirector extends Redirector {
public MeteringRedirector(Context context, String targetPattern, int mode) {
super(context, targetPattern, mode);
}
protected void outboundServerRedirect(Reference targetRef, Request request,
Response response) {
String user = request.getClientInfo().getUser().getName();
targetRef.addQueryParameter("user_id", user);
super.outboundServerRedirect(targetRef, request,
response);
}
}
| package com.sixsq.slipstream.resource;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Reference;
import org.restlet.routing.Redirector;
public class MeteringRedirector extends Redirector {
public MeteringRedirector(Context context, String targetPattern, int mode) {
super(context, targetPattern, mode);
}
protected void outboundServerRedirect(Reference targetRef, Request request,
Response response) {
String user = request.getClientInfo().getUser().getName();
- request = addUserToQuery(request, user);
+ targetRef.addQueryParameter("user_id", user);
super.outboundServerRedirect(targetRef, request,
response);
}
- private Request addUserToQuery(Request request, String user) {
- String query = request.getResourceRef().getQuery();
- request.getResourceRef().setQuery(query + "&user_id=" + user);
- return request;
- }
-
} | 8 | 0.275862 | 1 | 7 |
0f0a9eda5be7cfe0a2076dc2dd8a4d24068f75e0 | benchmarks/step_detect.py | benchmarks/step_detect.py | try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
def time_detect_regressions(self):
step_detect.detect_regressions(self.y)
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, p=1)
| try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
if hasattr(step_detect, 'detect_steps'):
def time_detect_regressions(self):
steps = step_detect.detect_steps(self.y)
step_detect.detect_regressions(steps)
else:
def time_detect_regressions(self):
step_detect.detect_regressions(self.y)
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, p=1)
| Fix benchmarks vs. changes in b1cc0a9aa5107 | Fix benchmarks vs. changes in b1cc0a9aa5107
| Python | bsd-3-clause | qwhelan/asv,qwhelan/asv,pv/asv,pv/asv,spacetelescope/asv,spacetelescope/asv,airspeed-velocity/asv,spacetelescope/asv,airspeed-velocity/asv,airspeed-velocity/asv,qwhelan/asv,pv/asv,airspeed-velocity/asv,spacetelescope/asv,qwhelan/asv,pv/asv | python | ## Code Before:
try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
def time_detect_regressions(self):
step_detect.detect_regressions(self.y)
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, p=1)
## Instruction:
Fix benchmarks vs. changes in b1cc0a9aa5107
## Code After:
try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
if hasattr(step_detect, 'detect_steps'):
def time_detect_regressions(self):
steps = step_detect.detect_steps(self.y)
step_detect.detect_regressions(steps)
else:
def time_detect_regressions(self):
step_detect.detect_regressions(self.y)
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, p=1)
| try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
+ if hasattr(step_detect, 'detect_steps'):
- def time_detect_regressions(self):
+ def time_detect_regressions(self):
? ++++
+ steps = step_detect.detect_steps(self.y)
+ step_detect.detect_regressions(steps)
+ else:
+ def time_detect_regressions(self):
- step_detect.detect_regressions(self.y)
+ step_detect.detect_regressions(self.y)
? ++++
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, p=1) | 9 | 0.6 | 7 | 2 |
bd24d0c9e18ff665cc7f0222bd5cf69c41cb042e | Game.Ghost/Model/Furniture/chair_wood_1_1.data.json | Game.Ghost/Model/Furniture/chair_wood_1_1.data.json | {
"id": "chair_wood_1_1",
"dimension": [ 1, 1, 1 ],
"blockSight": false,
"support": 0.6,
"slot": null,
"model": "",
"texture": [ "chair_wood_1_1.png" ],
"icon": "chair_wood_1_1.icon.png"
} | {
"id": "chair_wood_1_1",
"dimension": [ 1, 1, 1 ],
"blockSight": false,
"support": 0.6,
"slot": [ 0, 0, 0.6 ],
"model": "",
"texture": [ "chair_wood_1_1.png" ],
"icon": "chair_wood_1_1.icon.png"
} | Add key slot on chair | Add key slot on chair
| JSON | mit | Rendxx/Game-Ghost,Rendxx/Game-Ghost | json | ## Code Before:
{
"id": "chair_wood_1_1",
"dimension": [ 1, 1, 1 ],
"blockSight": false,
"support": 0.6,
"slot": null,
"model": "",
"texture": [ "chair_wood_1_1.png" ],
"icon": "chair_wood_1_1.icon.png"
}
## Instruction:
Add key slot on chair
## Code After:
{
"id": "chair_wood_1_1",
"dimension": [ 1, 1, 1 ],
"blockSight": false,
"support": 0.6,
"slot": [ 0, 0, 0.6 ],
"model": "",
"texture": [ "chair_wood_1_1.png" ],
"icon": "chair_wood_1_1.icon.png"
} | {
"id": "chair_wood_1_1",
"dimension": [ 1, 1, 1 ],
"blockSight": false,
"support": 0.6,
- "slot": null,
+ "slot": [ 0, 0, 0.6 ],
"model": "",
"texture": [ "chair_wood_1_1.png" ],
"icon": "chair_wood_1_1.icon.png"
} | 2 | 0.2 | 1 | 1 |
2d91b17b798c30ee3784307191677483bfefc39a | uber/templates/staffing/shirt_item.html | uber/templates/staffing/shirt_item.html | {% import 'macros.html' as macros %}
{% if c.HOURS_FOR_SHIRT and attendee.gets_any_kind_of_shirt %}
<li>
{{ macros.checklist_image(attendee.shirt_info_marked) }}
{% if not attendee.placeholder and attendee.food_restrictions_filled_out %}
<a href="shirt_size">Let us know</a>
{% else %}
Let us know
{% endif %}
your shirt size
{% if c.STAFF_EVENT_SHIRT_OPTS and attendee.gets_staff_shirt %}
and your preference of staff or event shirt
{% endif %}
{% if c.VOLUNTEER_SHIRT_DEADLINE %}
<b>no later than {{ c.VOLUNTEER_SHIRT_DEADLINE|datetime_local }}</b>
{% endif %}
so that we can set aside shirts in the right sizes.
</li>
{% endif %} | {% import 'macros.html' as macros %}
{% if c.HOURS_FOR_SHIRT and attendee.gets_any_kind_of_shirt %}
<li>
{{ macros.checklist_image(attendee.shirt_info_marked) }}
{% if not attendee.placeholder %}
<a href="shirt_size">Let us know</a>
{% else %}
Let us know
{% endif %}
your shirt size
{% if c.STAFF_EVENT_SHIRT_OPTS and attendee.gets_staff_shirt %}
and your preference of staff or event shirt
{% endif %}
{% if c.VOLUNTEER_SHIRT_DEADLINE %}
<b>no later than {{ c.VOLUNTEER_SHIRT_DEADLINE|datetime_local }}</b>
{% endif %}
so that we can set aside shirts in the right sizes.
</li>
{% endif %} | Enable shirt step before food restrictions are filled out We re-ordered these steps again so we have to edit their prerequisites. | Enable shirt step before food restrictions are filled out
We re-ordered these steps again so we have to edit their prerequisites.
| HTML | agpl-3.0 | magfest/ubersystem,magfest/ubersystem,magfest/ubersystem,magfest/ubersystem | html | ## Code Before:
{% import 'macros.html' as macros %}
{% if c.HOURS_FOR_SHIRT and attendee.gets_any_kind_of_shirt %}
<li>
{{ macros.checklist_image(attendee.shirt_info_marked) }}
{% if not attendee.placeholder and attendee.food_restrictions_filled_out %}
<a href="shirt_size">Let us know</a>
{% else %}
Let us know
{% endif %}
your shirt size
{% if c.STAFF_EVENT_SHIRT_OPTS and attendee.gets_staff_shirt %}
and your preference of staff or event shirt
{% endif %}
{% if c.VOLUNTEER_SHIRT_DEADLINE %}
<b>no later than {{ c.VOLUNTEER_SHIRT_DEADLINE|datetime_local }}</b>
{% endif %}
so that we can set aside shirts in the right sizes.
</li>
{% endif %}
## Instruction:
Enable shirt step before food restrictions are filled out
We re-ordered these steps again so we have to edit their prerequisites.
## Code After:
{% import 'macros.html' as macros %}
{% if c.HOURS_FOR_SHIRT and attendee.gets_any_kind_of_shirt %}
<li>
{{ macros.checklist_image(attendee.shirt_info_marked) }}
{% if not attendee.placeholder %}
<a href="shirt_size">Let us know</a>
{% else %}
Let us know
{% endif %}
your shirt size
{% if c.STAFF_EVENT_SHIRT_OPTS and attendee.gets_staff_shirt %}
and your preference of staff or event shirt
{% endif %}
{% if c.VOLUNTEER_SHIRT_DEADLINE %}
<b>no later than {{ c.VOLUNTEER_SHIRT_DEADLINE|datetime_local }}</b>
{% endif %}
so that we can set aside shirts in the right sizes.
</li>
{% endif %} | {% import 'macros.html' as macros %}
{% if c.HOURS_FOR_SHIRT and attendee.gets_any_kind_of_shirt %}
<li>
{{ macros.checklist_image(attendee.shirt_info_marked) }}
- {% if not attendee.placeholder and attendee.food_restrictions_filled_out %}
+ {% if not attendee.placeholder %}
<a href="shirt_size">Let us know</a>
{% else %}
Let us know
{% endif %}
your shirt size
{% if c.STAFF_EVENT_SHIRT_OPTS and attendee.gets_staff_shirt %}
and your preference of staff or event shirt
{% endif %}
{% if c.VOLUNTEER_SHIRT_DEADLINE %}
<b>no later than {{ c.VOLUNTEER_SHIRT_DEADLINE|datetime_local }}</b>
{% endif %}
so that we can set aside shirts in the right sizes.
</li>
{% endif %} | 2 | 0.105263 | 1 | 1 |
532b8d15500aaa4726b5c9d273ef7178e60e0b7f | models/user.js | models/user.js | var mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose');
var UserSchema = mongoose.Schema({
username: String,
password: String
});
UserSchema.plugin(passportLocalMongoose);
module.exports = mongoose.model('User', UserSchema);
| var mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose');
var UserSchema = mongoose.Schema({
name: String,
age: Number,
email: String,
picture: String,
username: String,
password: String
});
UserSchema.plugin(passportLocalMongoose);
module.exports = mongoose.model('User', UserSchema);
| Add new fields to the User Schema. | Add new fields to the User Schema.
| JavaScript | mit | JuanHenriquez/yelp-camp,JuanHenriquez/yelp-camp | javascript | ## Code Before:
var mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose');
var UserSchema = mongoose.Schema({
username: String,
password: String
});
UserSchema.plugin(passportLocalMongoose);
module.exports = mongoose.model('User', UserSchema);
## Instruction:
Add new fields to the User Schema.
## Code After:
var mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose');
var UserSchema = mongoose.Schema({
name: String,
age: Number,
email: String,
picture: String,
username: String,
password: String
});
UserSchema.plugin(passportLocalMongoose);
module.exports = mongoose.model('User', UserSchema);
| var mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose');
var UserSchema = mongoose.Schema({
+ name: String,
+ age: Number,
+ email: String,
+ picture: String,
username: String,
password: String
});
UserSchema.plugin(passportLocalMongoose);
module.exports = mongoose.model('User', UserSchema); | 4 | 0.363636 | 4 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.