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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
74e3b954e6ef768058e7626cbd1d9821bb446580 | README.md | README.md |
Simple script that uses www.locu.com to return the names of restaurants in a given city.
# Usage
Install python 3.5 and run locu-restaurants.py. Enter the name of a city
and it's country. The names of the restaurants in that city will be saved
to output.txt.
|
Simple script that uses www.locu.com to return the names of restaurants in a given city.
# Usage
Replace `YOUR_API_KEY` in the `api_key` variable to your api key from locu. Install python 3.5 and run locu-restaurants.py. Enter the name of a city and it's country. The names of the restaurants in that city will be saved to output.txt.
| Add instructions for API keys | Add instructions for API keys | Markdown | mit | rasheedja/api-practice,rasheedja/locu-restaurants | markdown | ## Code Before:
Simple script that uses www.locu.com to return the names of restaurants in a given city.
# Usage
Install python 3.5 and run locu-restaurants.py. Enter the name of a city
and it's country. The names of the restaurants in that city will be saved
to output.txt.
## Instruction:
Add instructions for API keys
## Code After:
Simple script that uses www.locu.com to return the names of restaurants in a given city.
# Usage
Replace `YOUR_API_KEY` in the `api_key` variable to your api key from locu. Install python 3.5 and run locu-restaurants.py. Enter the name of a city and it's country. The names of the restaurants in that city will be saved to output.txt.
|
Simple script that uses www.locu.com to return the names of restaurants in a given city.
# Usage
+
+ Replace `YOUR_API_KEY` in the `api_key` variable to your api key from locu. Install python 3.5 and run locu-restaurants.py. Enter the name of a city and it's country. The names of the restaurants in that city will be saved to output.txt.
- Install python 3.5 and run locu-restaurants.py. Enter the name of a city
- and it's country. The names of the restaurants in that city will be saved
- to output.txt. | 5 | 0.714286 | 2 | 3 |
6b26d7991ae84e8b0892e2b132ffdbcda351be60 | provision/provisioners.sh | provision/provisioners.sh |
exec 6>&1
exec 7>&2
source /srv/provision/provision-helpers.sh
function provisioner_begin() {
VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}"
log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}"
touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
echo -e "------------------------------------------------------------------------------------"
vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..."
echo -e "------------------------------------------------------------------------------------"
start_seconds="$(date +%s)"
trap "provisioner_end" EXIT
}
function provisioner_end() {
PROVISION_SUCCESS="$?"
end_seconds="$(date +%s)"
local elapsed="$(( end_seconds - start_seconds ))"
if [[ $PROVISION_SUCCESS -eq "0" ]]; then
echo -e "------------------------------------------------------------------------------------"
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
echo -e "------------------------------------------------------------------------------------"
vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
fi
echo ""
}
if [[ ! -z $VVV_LOG ]]; then
provisioner_begin "${VVV_LOG}"
fi
|
exec 6>&1
exec 7>&2
source /srv/provision/provision-helpers.sh
function provisioner_begin() {
VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}"
log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}"
touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
echo -e "------------------------------------------------------------------------------------"
vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..."
echo -e "------------------------------------------------------------------------------------"
start_seconds="$(date +%s)"
trap "provisioner_end" EXIT
}
function provisioner_end() {
PROVISION_SUCCESS="$?"
end_seconds="$(date +%s)"
local elapsed="$(( end_seconds - start_seconds ))"
if [[ $PROVISION_SUCCESS -eq "0" ]]; then
echo -e "------------------------------------------------------------------------------------"
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
echo -e "------------------------------------------------------------------------------------"
vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
fi
echo ""
trap - EXIT
}
if [[ ! -z $VVV_LOG ]]; then
provisioner_begin "${VVV_LOG}"
fi
| Clear EXIT trap after end (just in case) | Clear EXIT trap after end (just in case)
| Shell | mit | trepmal/varying-vagrant-vagrants,Varying-Vagrant-Vagrants/VVV,Varying-Vagrant-Vagrants/VVV,trepmal/varying-vagrant-vagrants,Varying-Vagrant-Vagrants/VVV,saucal/VVV,saucal/VVV,saucal/VVV | shell | ## Code Before:
exec 6>&1
exec 7>&2
source /srv/provision/provision-helpers.sh
function provisioner_begin() {
VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}"
log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}"
touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
echo -e "------------------------------------------------------------------------------------"
vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..."
echo -e "------------------------------------------------------------------------------------"
start_seconds="$(date +%s)"
trap "provisioner_end" EXIT
}
function provisioner_end() {
PROVISION_SUCCESS="$?"
end_seconds="$(date +%s)"
local elapsed="$(( end_seconds - start_seconds ))"
if [[ $PROVISION_SUCCESS -eq "0" ]]; then
echo -e "------------------------------------------------------------------------------------"
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
echo -e "------------------------------------------------------------------------------------"
vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
fi
echo ""
}
if [[ ! -z $VVV_LOG ]]; then
provisioner_begin "${VVV_LOG}"
fi
## Instruction:
Clear EXIT trap after end (just in case)
## Code After:
exec 6>&1
exec 7>&2
source /srv/provision/provision-helpers.sh
function provisioner_begin() {
VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}"
log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}"
touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
echo -e "------------------------------------------------------------------------------------"
vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..."
echo -e "------------------------------------------------------------------------------------"
start_seconds="$(date +%s)"
trap "provisioner_end" EXIT
}
function provisioner_end() {
PROVISION_SUCCESS="$?"
end_seconds="$(date +%s)"
local elapsed="$(( end_seconds - start_seconds ))"
if [[ $PROVISION_SUCCESS -eq "0" ]]; then
echo -e "------------------------------------------------------------------------------------"
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
echo -e "------------------------------------------------------------------------------------"
vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
fi
echo ""
trap - EXIT
}
if [[ ! -z $VVV_LOG ]]; then
provisioner_begin "${VVV_LOG}"
fi
|
exec 6>&1
exec 7>&2
source /srv/provision/provision-helpers.sh
function provisioner_begin() {
VVV_PROVISIONER_RUNNING="${1:-${FUNCNAME[1]}}"
log_to_file "provisioner-${VVV_PROVISIONER_RUNNING}"
touch "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
echo -e "------------------------------------------------------------------------------------"
vvv_success " ▷ Running the '${VVV_PROVISIONER_RUNNING}' provisioner..."
echo -e "------------------------------------------------------------------------------------"
start_seconds="$(date +%s)"
trap "provisioner_end" EXIT
}
function provisioner_end() {
PROVISION_SUCCESS="$?"
end_seconds="$(date +%s)"
local elapsed="$(( end_seconds - start_seconds ))"
if [[ $PROVISION_SUCCESS -eq "0" ]]; then
echo -e "------------------------------------------------------------------------------------"
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
rm -f "/vagrant/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
echo -e "------------------------------------------------------------------------------------"
vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
echo -e "------------------------------------------------------------------------------------"
fi
echo ""
+ trap - EXIT
}
if [[ ! -z $VVV_LOG ]]; then
provisioner_begin "${VVV_LOG}"
fi | 1 | 0.027027 | 1 | 0 |
45df5251657aab50fb44e6667bef1b115cefa33f | tox.ini | tox.ini | [tox]
envlist =
py26-django{1.6,1.5},
py27-django{1.10,1.9,1.8,1.7,1.6,1.5},
py33-django{1.8,1.7,1.6,1.5},
py34-django{1.10,1.9,1.8,1.7,1.6,1.5},
py35-django{1.10,1.9,1.8},
[testenv]
usedevelop = true
pip_pre = true
commands = coverage run -p tests/unit_tests.py
deps=
coverage==3.7.1
selenium==2.52.0
django1.5: Django>=1.5,<1.6
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
django1.8: Django>=1.8,<1.9
django1.9: Django>=1.9,<1.10
django1.10: Django>=1.10,<1.11
| [tox]
envlist =
py27-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
py33-django{1.8,1.7,1.6,1.5},
py34-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
py35-django{1.11,1.10,1.9,1.8},
[testenv]
usedevelop = true
pip_pre = true
commands = coverage run -p tests/unit_tests.py
deps=
coverage==3.7.1
selenium==2.52.0
django1.5: Django>=1.5,<1.6
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
django1.8: Django>=1.8,<1.9
django1.9: Django>=1.9,<1.10
django1.10: Django>=1.10,<1.11
django1.11: Django>=1.11,<1.12
| Update test matrix to add Django 1.11 and remove python 2.6 | Update test matrix to add Django 1.11 and remove python 2.6
Travis builds for Django 1.5 and 1.6 under Python 2.6 failed.
$ tox
py26-django1.6 create: /home/travis/build/ierror/django-js-reverse/.tox/py26-django1.6
ERROR: InterpreterNotFound: python2.6
py26-django1.5 create: /home/travis/build/ierror/django-js-reverse/.tox/py26-django1.5
ERROR: InterpreterNotFound: python2.6
| INI | mit | ierror/django-js-reverse | ini | ## Code Before:
[tox]
envlist =
py26-django{1.6,1.5},
py27-django{1.10,1.9,1.8,1.7,1.6,1.5},
py33-django{1.8,1.7,1.6,1.5},
py34-django{1.10,1.9,1.8,1.7,1.6,1.5},
py35-django{1.10,1.9,1.8},
[testenv]
usedevelop = true
pip_pre = true
commands = coverage run -p tests/unit_tests.py
deps=
coverage==3.7.1
selenium==2.52.0
django1.5: Django>=1.5,<1.6
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
django1.8: Django>=1.8,<1.9
django1.9: Django>=1.9,<1.10
django1.10: Django>=1.10,<1.11
## Instruction:
Update test matrix to add Django 1.11 and remove python 2.6
Travis builds for Django 1.5 and 1.6 under Python 2.6 failed.
$ tox
py26-django1.6 create: /home/travis/build/ierror/django-js-reverse/.tox/py26-django1.6
ERROR: InterpreterNotFound: python2.6
py26-django1.5 create: /home/travis/build/ierror/django-js-reverse/.tox/py26-django1.5
ERROR: InterpreterNotFound: python2.6
## Code After:
[tox]
envlist =
py27-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
py33-django{1.8,1.7,1.6,1.5},
py34-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
py35-django{1.11,1.10,1.9,1.8},
[testenv]
usedevelop = true
pip_pre = true
commands = coverage run -p tests/unit_tests.py
deps=
coverage==3.7.1
selenium==2.52.0
django1.5: Django>=1.5,<1.6
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
django1.8: Django>=1.8,<1.9
django1.9: Django>=1.9,<1.10
django1.10: Django>=1.10,<1.11
django1.11: Django>=1.11,<1.12
| [tox]
envlist =
- py26-django{1.6,1.5},
- py27-django{1.10,1.9,1.8,1.7,1.6,1.5},
+ py27-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
? +++++
py33-django{1.8,1.7,1.6,1.5},
- py34-django{1.10,1.9,1.8,1.7,1.6,1.5},
+ py34-django{1.11,1.10,1.9,1.8,1.7,1.6,1.5},
? +++++
- py35-django{1.10,1.9,1.8},
+ py35-django{1.11,1.10,1.9,1.8},
? +++++
[testenv]
usedevelop = true
pip_pre = true
commands = coverage run -p tests/unit_tests.py
deps=
coverage==3.7.1
selenium==2.52.0
django1.5: Django>=1.5,<1.6
django1.6: Django>=1.6,<1.7
django1.7: Django>=1.7,<1.8
django1.8: Django>=1.8,<1.9
django1.9: Django>=1.9,<1.10
django1.10: Django>=1.10,<1.11
+ django1.11: Django>=1.11,<1.12 | 8 | 0.380952 | 4 | 4 |
53b2223d3345651339f00c236607ebfad26a3665 | integration/mediation-tests/tests-transport/src/test/resources/artifacts/ESB/jms/transport/jms_transport.xml | integration/mediation-tests/tests-transport/src/test/resources/artifacts/ESB/jms/transport/jms_transport.xml | <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMSEndpointTestCaseProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint key="jmsAddressEP"/>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
<endpoint name="jmsAddressEP">
<address uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</endpoint>
</definitions>
| <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMSEndpointTestCaseProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<address
uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
</definitions>
| Fix failure of JMSEndpointTestCase due to endpoint name being common | Fix failure of JMSEndpointTestCase due to endpoint name being common
| XML | apache-2.0 | wso2/product-ei,milindaperera/product-ei,wso2/product-ei,milindaperera/product-ei,milindaperera/product-ei,milindaperera/product-ei,milindaperera/product-ei,wso2/product-ei,wso2/product-ei,wso2/product-ei | xml | ## Code Before:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMSEndpointTestCaseProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<endpoint key="jmsAddressEP"/>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
<endpoint name="jmsAddressEP">
<address uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</endpoint>
</definitions>
## Instruction:
Fix failure of JMSEndpointTestCase due to endpoint name being common
## Code After:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMSEndpointTestCaseProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
<address
uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
</definitions>
| <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMSEndpointTestCaseProxy" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<send>
- <endpoint key="jmsAddressEP"/>
+ <address
+ uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
- <endpoint name="jmsAddressEP">
- <address uri="jms:/SimpleStockQuoteServiceJMSEndpointTestCase?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=contentType&java.naming.provider.url=tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=10&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.SessionTransacted=true&transport.jms.ConnectionFactoryType=queue&transport.jms.SessionAcknowledgement=CLIENT_ACKNOWLEDGE&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
- </endpoint>
</definitions> | 6 | 0.25 | 2 | 4 |
a83bd8889e3a277ce4f5a3a26ddd8e459228532c | deployment/05_before_deploy.sh | deployment/05_before_deploy.sh | set -e # Exit with nonzero exit code if anything fails
# If we're on master, build for gh-pages & push to that branch
if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then
mv dist/* .
rmdir dist
git add . --all
git commit -m "Build for gh-pages: ${SHA}"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true
git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm
git commit -m "Merge into gh-pages: ${SHA}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
git push $SSH_REPO $TARGET_BRANCH
git branch -D TEMP_BRANCH
fi
| set -e # Exit with nonzero exit code if anything fails
# If we're on master, build for gh-pages & push to that branch
if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then
mv dist/* .
rmdir dist
git add . --all
git commit -m "Build for gh-pages: ${SHA}"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true
git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm
git add .
git commit -m "Merge into gh-pages: ${SHA}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
git push $SSH_REPO $TARGET_BRANCH
git branch -D TEMP_BRANCH
fi
| Add files to be merged to gh-pages. | fix(Deployment): Add files to be merged to gh-pages.
| Shell | mit | chanceaclark/rocketbelt,Pier1/rocketbelt,Pier1/rocketbelt,jkeddy/rocketbelt,chanceaclark/rocketbelt,jkeddy/rocketbelt,jkeddy/rocketbelt,chanceaclark/rocketbelt | shell | ## Code Before:
set -e # Exit with nonzero exit code if anything fails
# If we're on master, build for gh-pages & push to that branch
if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then
mv dist/* .
rmdir dist
git add . --all
git commit -m "Build for gh-pages: ${SHA}"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true
git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm
git commit -m "Merge into gh-pages: ${SHA}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
git push $SSH_REPO $TARGET_BRANCH
git branch -D TEMP_BRANCH
fi
## Instruction:
fix(Deployment): Add files to be merged to gh-pages.
## Code After:
set -e # Exit with nonzero exit code if anything fails
# If we're on master, build for gh-pages & push to that branch
if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then
mv dist/* .
rmdir dist
git add . --all
git commit -m "Build for gh-pages: ${SHA}"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true
git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm
git add .
git commit -m "Merge into gh-pages: ${SHA}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
git push $SSH_REPO $TARGET_BRANCH
git branch -D TEMP_BRANCH
fi
| set -e # Exit with nonzero exit code if anything fails
# If we're on master, build for gh-pages & push to that branch
if [ $TRAVIS_PULL_REQUEST = "false" -a $TRAVIS_BRANCH = $SOURCE_BRANCH ]; then
mv dist/* .
rmdir dist
git add . --all
git commit -m "Build for gh-pages: ${SHA}"
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git merge -s recursive -X theirs TEMP_BRANCH -m "Merge into gh-pages: ${SHA}" || true
git status --porcelain | awk '{if ($1=="DU") print $2}' | xargs git rm
+ git add .
git commit -m "Merge into gh-pages: ${SHA}"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
git push $SSH_REPO $TARGET_BRANCH
git branch -D TEMP_BRANCH
fi | 1 | 0.037037 | 1 | 0 |
bfcd2eb5d4fab7bcb698719c3f02fc2aea768cf3 | lib/Data/Tree/Binary.agda | lib/Data/Tree/Binary.agda | {-# OPTIONS --without-K #-}
open import Type hiding (★)
module Data.Tree.Binary where
data BinTree {a} (A : ★ a) : ★ a where
empty : BinTree A
leaf : A → BinTree A
fork : (ℓ r : BinTree A) → BinTree A
| {-# OPTIONS --without-K #-}
open import Type hiding (★)
open import Level
open import Data.Zero
open import Data.Sum
module Data.Tree.Binary where
data BinTree {a} (A : ★ a) : ★ a where
empty : BinTree A
leaf : A → BinTree A
fork : (ℓ r : BinTree A) → BinTree A
Any : ∀ {a p}{A : ★ a}(P : A → ★ p) → BinTree A → ★ p
Any P empty = Lift 𝟘
Any P (leaf x) = P x
Any P (fork ts ts₁) = Any P ts ⊎ Any P ts₁
| Add Any predicate for binary tree | Add Any predicate for binary tree
| Agda | bsd-3-clause | crypto-agda/agda-nplib | agda | ## Code Before:
{-# OPTIONS --without-K #-}
open import Type hiding (★)
module Data.Tree.Binary where
data BinTree {a} (A : ★ a) : ★ a where
empty : BinTree A
leaf : A → BinTree A
fork : (ℓ r : BinTree A) → BinTree A
## Instruction:
Add Any predicate for binary tree
## Code After:
{-# OPTIONS --without-K #-}
open import Type hiding (★)
open import Level
open import Data.Zero
open import Data.Sum
module Data.Tree.Binary where
data BinTree {a} (A : ★ a) : ★ a where
empty : BinTree A
leaf : A → BinTree A
fork : (ℓ r : BinTree A) → BinTree A
Any : ∀ {a p}{A : ★ a}(P : A → ★ p) → BinTree A → ★ p
Any P empty = Lift 𝟘
Any P (leaf x) = P x
Any P (fork ts ts₁) = Any P ts ⊎ Any P ts₁
| {-# OPTIONS --without-K #-}
open import Type hiding (★)
+
+ open import Level
+ open import Data.Zero
+ open import Data.Sum
module Data.Tree.Binary where
data BinTree {a} (A : ★ a) : ★ a where
empty : BinTree A
leaf : A → BinTree A
fork : (ℓ r : BinTree A) → BinTree A
+
+ Any : ∀ {a p}{A : ★ a}(P : A → ★ p) → BinTree A → ★ p
+ Any P empty = Lift 𝟘
+ Any P (leaf x) = P x
+ Any P (fork ts ts₁) = Any P ts ⊎ Any P ts₁ | 9 | 1 | 9 | 0 |
042496fa9173db31963a8ea32f94931a27a59678 | lib/pegasus/r/Pegasus/setup.sh | lib/pegasus/r/Pegasus/setup.sh |
DEST_DIR=$1
LOG_FILE=build.log
type R >/dev/null 2>&1 || { echo >&2 "R is not available. Skipping R compilation."; exit 0; }
echo "Building R DAX API..."
rm -rf $DEST_DIR/*.tar.gz
R CMD build DAX &> $LOG_FILE
if [ $? -ne 0 ]; then
cat $LOG_FILE >&2
exit 1
fi
mv *.tar.gz $DEST_DIR/$PKG_FILE
rm -rf $LOG_FILE
echo "R DAX API successfully built."
|
DEST_DIR=$1
LOG_FILE=build.log
if ! type R >/dev/null 2>&1; then
if [ "x$PEGASUS_BUILD_R_MODULES" == "x0" ]; then
echo "R is not available, but user has overridden with PEGASUS_BUILD_R_MODULES=0. Skipping R compilation."
exit 0
else
echo "R is not available. Either install the R development packages, or disable this part of the build by setting PEGASUS_BUILD_R_MODULES=0 in your environment before executing ant."
exit 1
fi
fi
echo "Building R DAX API..."
rm -rf $DEST_DIR/*.tar.gz
R CMD build DAX &> $LOG_FILE
if [ $? -ne 0 ]; then
cat $LOG_FILE >&2
exit 1
fi
mv *.tar.gz $DEST_DIR/$PKG_FILE
rm -rf $LOG_FILE
echo "R DAX API successfully built."
| Make sure we don't skip R builds without explicit confirmation | Make sure we don't skip R builds without explicit confirmation
| Shell | apache-2.0 | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | shell | ## Code Before:
DEST_DIR=$1
LOG_FILE=build.log
type R >/dev/null 2>&1 || { echo >&2 "R is not available. Skipping R compilation."; exit 0; }
echo "Building R DAX API..."
rm -rf $DEST_DIR/*.tar.gz
R CMD build DAX &> $LOG_FILE
if [ $? -ne 0 ]; then
cat $LOG_FILE >&2
exit 1
fi
mv *.tar.gz $DEST_DIR/$PKG_FILE
rm -rf $LOG_FILE
echo "R DAX API successfully built."
## Instruction:
Make sure we don't skip R builds without explicit confirmation
## Code After:
DEST_DIR=$1
LOG_FILE=build.log
if ! type R >/dev/null 2>&1; then
if [ "x$PEGASUS_BUILD_R_MODULES" == "x0" ]; then
echo "R is not available, but user has overridden with PEGASUS_BUILD_R_MODULES=0. Skipping R compilation."
exit 0
else
echo "R is not available. Either install the R development packages, or disable this part of the build by setting PEGASUS_BUILD_R_MODULES=0 in your environment before executing ant."
exit 1
fi
fi
echo "Building R DAX API..."
rm -rf $DEST_DIR/*.tar.gz
R CMD build DAX &> $LOG_FILE
if [ $? -ne 0 ]; then
cat $LOG_FILE >&2
exit 1
fi
mv *.tar.gz $DEST_DIR/$PKG_FILE
rm -rf $LOG_FILE
echo "R DAX API successfully built."
|
DEST_DIR=$1
LOG_FILE=build.log
- type R >/dev/null 2>&1 || { echo >&2 "R is not available. Skipping R compilation."; exit 0; }
+ if ! type R >/dev/null 2>&1; then
+ if [ "x$PEGASUS_BUILD_R_MODULES" == "x0" ]; then
+ echo "R is not available, but user has overridden with PEGASUS_BUILD_R_MODULES=0. Skipping R compilation."
+ exit 0
+ else
+ echo "R is not available. Either install the R development packages, or disable this part of the build by setting PEGASUS_BUILD_R_MODULES=0 in your environment before executing ant."
+ exit 1
+ fi
+ fi
echo "Building R DAX API..."
rm -rf $DEST_DIR/*.tar.gz
R CMD build DAX &> $LOG_FILE
if [ $? -ne 0 ]; then
cat $LOG_FILE >&2
exit 1
fi
mv *.tar.gz $DEST_DIR/$PKG_FILE
rm -rf $LOG_FILE
echo "R DAX API successfully built."
| 10 | 0.47619 | 9 | 1 |
bf2ec28bc9282700de9461829341e320594f7318 | .travis.yml | .travis.yml | language: ruby
rvm:
- "1.9.3-p551"
- "2.0.0-p648"
- "2.1.8"
- "2.2.4"
- "2.3.0"
- jruby-19mode
before_install:
- gem update --system
- gem update bundler
| language: ruby
rvm:
- "2.2.4"
- "2.3.0"
before_install:
- gem update --system
- gem update bundler
| Drop support for Ruby < 2.2 | Drop support for Ruby < 2.2
| YAML | mit | RISCfuture/find_or_create_on_scopes | yaml | ## Code Before:
language: ruby
rvm:
- "1.9.3-p551"
- "2.0.0-p648"
- "2.1.8"
- "2.2.4"
- "2.3.0"
- jruby-19mode
before_install:
- gem update --system
- gem update bundler
## Instruction:
Drop support for Ruby < 2.2
## Code After:
language: ruby
rvm:
- "2.2.4"
- "2.3.0"
before_install:
- gem update --system
- gem update bundler
| language: ruby
rvm:
- - "1.9.3-p551"
- - "2.0.0-p648"
- - "2.1.8"
- "2.2.4"
- "2.3.0"
- - jruby-19mode
before_install:
- gem update --system
- gem update bundler | 4 | 0.363636 | 0 | 4 |
e9ac01889138ffc5acc421f93b7eae87dd3baa86 | .travis.yml | .travis.yml | sudo: required
group: edge
language: python
services:
- docker
addons:
apt:
packages:
- openvswitch-switch
python:
- "3.5"
install:
- "pip3 install -r requirements.txt -r test-requirements.txt"
- "python3 setup.py sdist"
- "pip3 install dist/*tar.gz"
script:
- "cd ./tests"
- "PYTHONPATH='../faucet' ./test_min_pylint.sh"
- "python3 ./test_config.py"
- "python3 ./test_check_config.py"
- "python3 ./test_valve.py"
- "cd .."
- "docker build -t reannz/faucet-tests -f Dockerfile.tests ."
- "sudo docker run --privileged -ti reannz/faucet-tests"
| sudo: required
group: edge
language: python
services:
- docker
addons:
apt:
packages:
- openvswitch-switch
python:
- "3.5"
install:
- "pip3 install -r requirements.txt -r test-requirements.txt"
- "python3 setup.py sdist"
- "pip3 install dist/*tar.gz"
- "pip3 show faucet"
script:
- "cd ./tests"
- "PYTHONPATH='../faucet' ./test_min_pylint.sh"
- "python3 ./test_config.py"
- "python3 ./test_check_config.py"
- "python3 ./test_valve.py"
- "cd .."
- "docker build -t reannz/faucet-tests -f Dockerfile.tests ."
- "sudo docker run --privileged -ti reannz/faucet-tests"
| Add show of installed package as check. | Add show of installed package as check.
| YAML | apache-2.0 | anarkiwi/faucet,gizmoguy/faucet,REANNZ/faucet,anarkiwi/faucet,Bairdo/faucet,trentindav/faucet,wackerly/faucet,REANNZ/faucet,wackerly/faucet,mwutzke/faucet,shivarammysore/faucet,byllyfish/faucet,shivarammysore/faucet,faucetsdn/faucet,byllyfish/faucet,faucetsdn/faucet,Bairdo/faucet,trungdtbk/faucet,trungdtbk/faucet,gizmoguy/faucet,trentindav/faucet,mwutzke/faucet | yaml | ## Code Before:
sudo: required
group: edge
language: python
services:
- docker
addons:
apt:
packages:
- openvswitch-switch
python:
- "3.5"
install:
- "pip3 install -r requirements.txt -r test-requirements.txt"
- "python3 setup.py sdist"
- "pip3 install dist/*tar.gz"
script:
- "cd ./tests"
- "PYTHONPATH='../faucet' ./test_min_pylint.sh"
- "python3 ./test_config.py"
- "python3 ./test_check_config.py"
- "python3 ./test_valve.py"
- "cd .."
- "docker build -t reannz/faucet-tests -f Dockerfile.tests ."
- "sudo docker run --privileged -ti reannz/faucet-tests"
## Instruction:
Add show of installed package as check.
## Code After:
sudo: required
group: edge
language: python
services:
- docker
addons:
apt:
packages:
- openvswitch-switch
python:
- "3.5"
install:
- "pip3 install -r requirements.txt -r test-requirements.txt"
- "python3 setup.py sdist"
- "pip3 install dist/*tar.gz"
- "pip3 show faucet"
script:
- "cd ./tests"
- "PYTHONPATH='../faucet' ./test_min_pylint.sh"
- "python3 ./test_config.py"
- "python3 ./test_check_config.py"
- "python3 ./test_valve.py"
- "cd .."
- "docker build -t reannz/faucet-tests -f Dockerfile.tests ."
- "sudo docker run --privileged -ti reannz/faucet-tests"
| sudo: required
group: edge
language: python
services:
- docker
addons:
apt:
packages:
- openvswitch-switch
python:
- "3.5"
install:
- "pip3 install -r requirements.txt -r test-requirements.txt"
- "python3 setup.py sdist"
- "pip3 install dist/*tar.gz"
+ - "pip3 show faucet"
script:
- "cd ./tests"
- "PYTHONPATH='../faucet' ./test_min_pylint.sh"
- "python3 ./test_config.py"
- "python3 ./test_check_config.py"
- "python3 ./test_valve.py"
- "cd .."
- "docker build -t reannz/faucet-tests -f Dockerfile.tests ."
- "sudo docker run --privileged -ti reannz/faucet-tests" | 1 | 0.041667 | 1 | 0 |
9a7a5ec6511e0fde949bf2e4cc35732ee4f54cfc | test/shared/testHelpers.js | test/shared/testHelpers.js | import { platform, DefaultDOMElement as DOM } from 'substance'
// ATTENTION: have to use a custom getMountPoint because
// during the tests are change the behavior of platform and DefaultDOMElement
export function getMountPoint (t) {
if (platform.inBrowser) {
if (t.sandbox) {
let el = t.sandbox.createElement('div')
t.sandbox.append(el)
return el
} else {
let bodyEl = DOM.wrap(window.document.body)
let sandboxEl = bodyEl.createElement('div')
bodyEl.append(sandboxEl)
return sandboxEl
}
} else {
// otherwise we create a detached DOM
let htmlDoc = DOM.parseHTML('<html><body></body></html>')
return htmlDoc.find('body')
}
}
| import { platform, DefaultDOMElement as DOM, DefaultDOMElement } from 'substance'
// ATTENTION: have to use a custom getMountPoint because
// during the tests we change the behavior of platform and DefaultDOMElement
export function getMountPoint (t) {
if (platform.inBrowser) {
if (t.sandbox) {
// let el = t.sandbox.createElement('div')
// HACK: struggling to avoid that the wron substance API is used
// i.e. substance-test is using its own version. When using the sandbox element
// generated by the test-suite, we will not 'see' elements and components
// created with the substance API used here
let el = DefaultDOMElement.wrap(window.document).createElement('div')
t.sandbox.append(el)
return el
} else {
let bodyEl = DOM.wrap(window.document.body)
let sandboxEl = bodyEl.createElement('div')
bodyEl.append(sandboxEl)
return sandboxEl
}
} else {
// otherwise we create a detached DOM
let htmlDoc = DOM.parseHTML('<html><body></body></html>')
return htmlDoc.find('body')
}
}
| Use correct substance API in tests. | Use correct substance API in tests.
| JavaScript | mit | michael/substance-1,substance/substance,michael/substance-1,substance/substance | javascript | ## Code Before:
import { platform, DefaultDOMElement as DOM } from 'substance'
// ATTENTION: have to use a custom getMountPoint because
// during the tests are change the behavior of platform and DefaultDOMElement
export function getMountPoint (t) {
if (platform.inBrowser) {
if (t.sandbox) {
let el = t.sandbox.createElement('div')
t.sandbox.append(el)
return el
} else {
let bodyEl = DOM.wrap(window.document.body)
let sandboxEl = bodyEl.createElement('div')
bodyEl.append(sandboxEl)
return sandboxEl
}
} else {
// otherwise we create a detached DOM
let htmlDoc = DOM.parseHTML('<html><body></body></html>')
return htmlDoc.find('body')
}
}
## Instruction:
Use correct substance API in tests.
## Code After:
import { platform, DefaultDOMElement as DOM, DefaultDOMElement } from 'substance'
// ATTENTION: have to use a custom getMountPoint because
// during the tests we change the behavior of platform and DefaultDOMElement
export function getMountPoint (t) {
if (platform.inBrowser) {
if (t.sandbox) {
// let el = t.sandbox.createElement('div')
// HACK: struggling to avoid that the wron substance API is used
// i.e. substance-test is using its own version. When using the sandbox element
// generated by the test-suite, we will not 'see' elements and components
// created with the substance API used here
let el = DefaultDOMElement.wrap(window.document).createElement('div')
t.sandbox.append(el)
return el
} else {
let bodyEl = DOM.wrap(window.document.body)
let sandboxEl = bodyEl.createElement('div')
bodyEl.append(sandboxEl)
return sandboxEl
}
} else {
// otherwise we create a detached DOM
let htmlDoc = DOM.parseHTML('<html><body></body></html>')
return htmlDoc.find('body')
}
}
| - import { platform, DefaultDOMElement as DOM } from 'substance'
+ import { platform, DefaultDOMElement as DOM, DefaultDOMElement } from 'substance'
? +++++++++++++++++++
// ATTENTION: have to use a custom getMountPoint because
- // during the tests are change the behavior of platform and DefaultDOMElement
? ^^
+ // during the tests we change the behavior of platform and DefaultDOMElement
? ^
export function getMountPoint (t) {
if (platform.inBrowser) {
if (t.sandbox) {
- let el = t.sandbox.createElement('div')
+ // let el = t.sandbox.createElement('div')
? +++
+ // HACK: struggling to avoid that the wron substance API is used
+ // i.e. substance-test is using its own version. When using the sandbox element
+ // generated by the test-suite, we will not 'see' elements and components
+ // created with the substance API used here
+ let el = DefaultDOMElement.wrap(window.document).createElement('div')
t.sandbox.append(el)
return el
} else {
let bodyEl = DOM.wrap(window.document.body)
let sandboxEl = bodyEl.createElement('div')
bodyEl.append(sandboxEl)
return sandboxEl
}
} else {
// otherwise we create a detached DOM
let htmlDoc = DOM.parseHTML('<html><body></body></html>')
return htmlDoc.find('body')
}
} | 11 | 0.5 | 8 | 3 |
71b0adcdf10e9edd1503e75c0927a0c18acc7c97 | README.md | README.md |
A CSV parser and builder for PHP.
The `CsvParser` class implements the `Iterator` interface meaning large files can be parsed
without hitting any memory limits because only one line is loaded at a time.
## Requirements
* PHP >= 5.3
## Usage
#### Building a CSV file for download
```php
<?php
use Palmtree\Csv\CsvBuilder;
$csv = new CsvBuilder( 'people.csv' );
$csv->addHeaders( [ 'name', 'age', 'gender' ] );
$csv->addRow( [ 'Alice', '24', 'Female'] );
$csv->addRow( [ 'Bob', '28', 'Male' ] );
$csv->download();
```
#### Parsing a CSV file into an array
```php
<?php
use Palmtree\Csv\CsvParser;
$csv = new CsvParser( 'people.csv' );
foreach( $csv as $row ) {
// Alice is a 24 year old female.
echo "{$row['name']} is a {$row['age']} year old {$row['gender']}";
}
```
|
A CSV reader and writer for PHP.
The `Reader` class implements the `Iterator` interface meaning large files can be parsed
without hitting any memory limits because only one line is loaded at a time.
## Requirements
* PHP >= 5.3
## Usage
#### Building a CSV file for download
```php
<?php
use Palmtree\Csv\Writer;
$people = [];
$people[] = [
'name' => 'Alice',
'age' => '24',
'gender' => 'Female',
];
$people[] = [
'name' => 'Bob',
'age' => '28',
'gender' => 'Male',
];
$csv = new Writer( $people );
$csv->download('people.csv');
// OR
$csv->write('/path/to/save/people.csv');
```
#### Reading a CSV file
```php
<?php
use Palmtree\Csv\Reader;
$csv = new Reader( 'people.csv' );
foreach( $csv as $row ) {
echo "{$row['name']} is a {$row['age']} year old {$row['gender']}";
}
```
See the [examples](examples) directory for more usage examples.
| Update readme with new class names | Update readme with new class names
| Markdown | mit | palmtreephp/csv | markdown | ## Code Before:
A CSV parser and builder for PHP.
The `CsvParser` class implements the `Iterator` interface meaning large files can be parsed
without hitting any memory limits because only one line is loaded at a time.
## Requirements
* PHP >= 5.3
## Usage
#### Building a CSV file for download
```php
<?php
use Palmtree\Csv\CsvBuilder;
$csv = new CsvBuilder( 'people.csv' );
$csv->addHeaders( [ 'name', 'age', 'gender' ] );
$csv->addRow( [ 'Alice', '24', 'Female'] );
$csv->addRow( [ 'Bob', '28', 'Male' ] );
$csv->download();
```
#### Parsing a CSV file into an array
```php
<?php
use Palmtree\Csv\CsvParser;
$csv = new CsvParser( 'people.csv' );
foreach( $csv as $row ) {
// Alice is a 24 year old female.
echo "{$row['name']} is a {$row['age']} year old {$row['gender']}";
}
```
## Instruction:
Update readme with new class names
## Code After:
A CSV reader and writer for PHP.
The `Reader` class implements the `Iterator` interface meaning large files can be parsed
without hitting any memory limits because only one line is loaded at a time.
## Requirements
* PHP >= 5.3
## Usage
#### Building a CSV file for download
```php
<?php
use Palmtree\Csv\Writer;
$people = [];
$people[] = [
'name' => 'Alice',
'age' => '24',
'gender' => 'Female',
];
$people[] = [
'name' => 'Bob',
'age' => '28',
'gender' => 'Male',
];
$csv = new Writer( $people );
$csv->download('people.csv');
// OR
$csv->write('/path/to/save/people.csv');
```
#### Reading a CSV file
```php
<?php
use Palmtree\Csv\Reader;
$csv = new Reader( 'people.csv' );
foreach( $csv as $row ) {
echo "{$row['name']} is a {$row['age']} year old {$row['gender']}";
}
```
See the [examples](examples) directory for more usage examples.
|
- A CSV parser and builder for PHP.
? ^ ^^ ^^ ^^
+ A CSV reader and writer for PHP.
? ^^ ^ ^^ ^
- The `CsvParser` class implements the `Iterator` interface meaning large files can be parsed
? ^^^^ ^^
+ The `Reader` class implements the `Iterator` interface meaning large files can be parsed
? ^^ ^
without hitting any memory limits because only one line is loaded at a time.
## Requirements
* PHP >= 5.3
## Usage
#### Building a CSV file for download
```php
<?php
- use Palmtree\Csv\CsvBuilder;
? ^^^^^ ^^
+ use Palmtree\Csv\Writer;
? ^^ ^
- $csv = new CsvBuilder( 'people.csv' );
- $csv->addHeaders( [ 'name', 'age', 'gender' ] );
- $csv->addRow( [ 'Alice', '24', 'Female'] );
- $csv->addRow( [ 'Bob', '28', 'Male' ] );
+ $people = [];
+ $people[] = [
+ 'name' => 'Alice',
+ 'age' => '24',
+ 'gender' => 'Female',
+ ];
+ $people[] = [
+ 'name' => 'Bob',
+ 'age' => '28',
+ 'gender' => 'Male',
+ ];
- $csv->download();
+ $csv = new Writer( $people );
+
+ $csv->download('people.csv');
+ // OR
+ $csv->write('/path/to/save/people.csv');
```
- #### Parsing a CSV file into an array
+ #### Reading a CSV file
```php
<?php
- use Palmtree\Csv\CsvParser;
? ^^^^ ^^
+ use Palmtree\Csv\Reader;
? ^^ ^
+
- $csv = new CsvParser( 'people.csv' );
? ^^^^ ^^
+ $csv = new Reader( 'people.csv' );
? ^^ ^
foreach( $csv as $row ) {
- // Alice is a 24 year old female.
echo "{$row['name']} is a {$row['age']} year old {$row['gender']}";
}
```
+
+ See the [examples](examples) directory for more usage examples. | 37 | 1.027778 | 25 | 12 |
45a9b60c2cd2f90c287e6947e65ab026f7c103bb | .travis.yml | .travis.yml | sudo: true
language: ruby
rvm:
- 2.2.6
- 2.3.3
env:
- TEST_MONKEYPATCHES=true
- TEST_MONKEYPATCHES=false
- WITH_REGRESSION=true
before_install:
- gem install bundler -v 1.12.5
- curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
- bundle && bundle exec rake build_src && rake clean_src
script: bundle exec rake test
| sudo: true
language: ruby
rvm:
- 2.2.6
- 2.3.3
env:
- NO_ENV_VARS=USED
- WITH_REGRESSION=true
- TEST_MONKEYPATCHES=true
- TEST_MONKEYPATCHES=true WITH_REGRESSION=true
before_install:
- gem install bundler -v 1.12.5
- curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
- bundle && bundle exec rake build_src && rake clean_src
script: bundle exec rake test
| Change build matrix on TravisCI | Change build matrix on TravisCI
| YAML | mit | danielpclark/faster_path,danielpclark/faster_path,danielpclark/faster_path | yaml | ## Code Before:
sudo: true
language: ruby
rvm:
- 2.2.6
- 2.3.3
env:
- TEST_MONKEYPATCHES=true
- TEST_MONKEYPATCHES=false
- WITH_REGRESSION=true
before_install:
- gem install bundler -v 1.12.5
- curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
- bundle && bundle exec rake build_src && rake clean_src
script: bundle exec rake test
## Instruction:
Change build matrix on TravisCI
## Code After:
sudo: true
language: ruby
rvm:
- 2.2.6
- 2.3.3
env:
- NO_ENV_VARS=USED
- WITH_REGRESSION=true
- TEST_MONKEYPATCHES=true
- TEST_MONKEYPATCHES=true WITH_REGRESSION=true
before_install:
- gem install bundler -v 1.12.5
- curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
- bundle && bundle exec rake build_src && rake clean_src
script: bundle exec rake test
| sudo: true
language: ruby
rvm:
- 2.2.6
- 2.3.3
env:
+ - NO_ENV_VARS=USED
+ - WITH_REGRESSION=true
- TEST_MONKEYPATCHES=true
+ - TEST_MONKEYPATCHES=true WITH_REGRESSION=true
- - TEST_MONKEYPATCHES=false
- - WITH_REGRESSION=true
before_install:
- gem install bundler -v 1.12.5
- curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
- bundle && bundle exec rake build_src && rake clean_src
script: bundle exec rake test | 5 | 0.357143 | 3 | 2 |
4e5e448708492b116f8353a15dd249dea35df167 | public/app.xml | public/app.xml | <?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Your App Name">
<Require feature="rpc"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- Your application code -->
<p>Here is a thing I've published.</p>
]]>
</Content>
</Module> | <?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Your App Name">
<Require feature="rpc"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- Your application code -->
<p>Here is a thing I've published.</p>
<p>Here is another thing I've published.</p>
<p>Here is yet another thing I've published.</p>
]]>
</Content>
</Module> | Add some more test elements to the presentation layer. | Add some more test elements to the presentation layer.
| XML | mit | DeBTech/HangoutRundown,DeBTech/HangoutRundown | xml | ## Code Before:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Your App Name">
<Require feature="rpc"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- Your application code -->
<p>Here is a thing I've published.</p>
]]>
</Content>
</Module>
## Instruction:
Add some more test elements to the presentation layer.
## Code After:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Your App Name">
<Require feature="rpc"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- Your application code -->
<p>Here is a thing I've published.</p>
<p>Here is another thing I've published.</p>
<p>Here is yet another thing I've published.</p>
]]>
</Content>
</Module> | <?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Your App Name">
<Require feature="rpc"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- Your application code -->
<p>Here is a thing I've published.</p>
+ <p>Here is another thing I've published.</p>
+ <p>Here is yet another thing I've published.</p>
]]>
</Content>
</Module> | 2 | 0.133333 | 2 | 0 |
2ada1e1a135dae244922c17acc5cd4b3e30a4d83 | tests/StencilTest.php | tests/StencilTest.php | <?php
require __DIR__.'/../paths.php';
require VENDOR_DIR.'autoload.php';
require STENCIL_DIR.'stencil.php';
use Stencil\Stencil as Stencil;
class StencilTest extends PHPUnit_Framework_TestCase
{
public function testVersion()
{
$stencil = new Stencil();
$this->assertEquals($stencil->version(), VERSION);
}
} | <?php
require_once __DIR__.'/../paths.php';
require_once VENDOR_DIR.'autoload.php';
require_once STENCIL_DIR.'stencil.php';
use Stencil\Stencil as Stencil;
class StencilTest extends PHPUnit_Framework_TestCase
{
public function testVersion()
{
$stencil = new Stencil();
$this->assertEquals($stencil->version(), VERSION);
}
} | Change require statement to require_once | Change require statement to require_once
| PHP | mit | aniketpant/stencil | php | ## Code Before:
<?php
require __DIR__.'/../paths.php';
require VENDOR_DIR.'autoload.php';
require STENCIL_DIR.'stencil.php';
use Stencil\Stencil as Stencil;
class StencilTest extends PHPUnit_Framework_TestCase
{
public function testVersion()
{
$stencil = new Stencil();
$this->assertEquals($stencil->version(), VERSION);
}
}
## Instruction:
Change require statement to require_once
## Code After:
<?php
require_once __DIR__.'/../paths.php';
require_once VENDOR_DIR.'autoload.php';
require_once STENCIL_DIR.'stencil.php';
use Stencil\Stencil as Stencil;
class StencilTest extends PHPUnit_Framework_TestCase
{
public function testVersion()
{
$stencil = new Stencil();
$this->assertEquals($stencil->version(), VERSION);
}
} | <?php
- require __DIR__.'/../paths.php';
+ require_once __DIR__.'/../paths.php';
? +++++
- require VENDOR_DIR.'autoload.php';
+ require_once VENDOR_DIR.'autoload.php';
? +++++
- require STENCIL_DIR.'stencil.php';
+ require_once STENCIL_DIR.'stencil.php';
? +++++
use Stencil\Stencil as Stencil;
class StencilTest extends PHPUnit_Framework_TestCase
{
public function testVersion()
{
$stencil = new Stencil();
$this->assertEquals($stencil->version(), VERSION);
}
} | 6 | 0.352941 | 3 | 3 |
a264abe98892c489e6133b29af54c5bed7d9b0d2 | regex/regex_getting_started/getting_started.md | regex/regex_getting_started/getting_started.md |
11/30/2015 10:26 AM
* Regex means Regular Expression a syntax that is used to search for and characterize strings
* delimited by two forward slashes /regex goes here/
* search for a string with matching content
* you can search for the match string "string" in the following sentence "The cat chased the string"
* "The cat chased the string."[/string/]
* the output is the string "string"
* the output of "The cat chased the string."[/hello/] => nil means that there was no string found matching the regular expression /hello/ within the sentence "The cat chased the string."
* another syntax using the match method
* regex.match(string)
* /string/.match("The cat chased the string.") => "string"
* /needle/.match("We're in a haystack.") => nil
* ? optionality character
* example: "abcdef"[/abz?/] => "ab"
|
11/30/2015 10:26 AM
* Regex means Regular Expression a syntax that is used to search for and characterize strings
* delimited by two forward slashes /regex goes here/
* search for a string with matching content
* you can search for the match string "string" in the following sentence "The cat chased the string"
* "The cat chased the string."[/string/]
* the output is the string "string"
* the output of "The cat chased the string."[/hello/] => nil means that there was no string found matching the regular expression /hello/ within the sentence "The cat chased the string."
* another syntax using the match method
* regex.match(string)
* /string/.match("The cat chased the string.") => "string"
* /needle/.match("We're in a haystack.") => nil
* ? optionality character
* example: "abcdef"[/abz?/] => "ab"
12/01/2015 12:38 PM
## More of the regex basics
* . a wild card any one character except line breaks
* gre.t
* [] character set, any one character listed inside []
* gr[ea]y
* [^ ] negative character set any one character not listed inside the []
* [^aeiou]
- range indicator when inside a character set
* [A-Za-z0-9]
* * Preceding element can occur zero or more times
* file_*name
* + preceding element can occur one or more times * extended regex syntax
* gro+ve
* ? preceding element can occur zero or more times * extended regex syntax
* colou?r | Add regex getting started edits regex character set basics | Add regex getting started edits regex character set basics
| Markdown | mit | calvinsettachatgul/athena,calvinsettachatgul/athena,calvinsettachatgul/athena,calvinsettachatgul/athena,calvinsettachatgul/athena | markdown | ## Code Before:
11/30/2015 10:26 AM
* Regex means Regular Expression a syntax that is used to search for and characterize strings
* delimited by two forward slashes /regex goes here/
* search for a string with matching content
* you can search for the match string "string" in the following sentence "The cat chased the string"
* "The cat chased the string."[/string/]
* the output is the string "string"
* the output of "The cat chased the string."[/hello/] => nil means that there was no string found matching the regular expression /hello/ within the sentence "The cat chased the string."
* another syntax using the match method
* regex.match(string)
* /string/.match("The cat chased the string.") => "string"
* /needle/.match("We're in a haystack.") => nil
* ? optionality character
* example: "abcdef"[/abz?/] => "ab"
## Instruction:
Add regex getting started edits regex character set basics
## Code After:
11/30/2015 10:26 AM
* Regex means Regular Expression a syntax that is used to search for and characterize strings
* delimited by two forward slashes /regex goes here/
* search for a string with matching content
* you can search for the match string "string" in the following sentence "The cat chased the string"
* "The cat chased the string."[/string/]
* the output is the string "string"
* the output of "The cat chased the string."[/hello/] => nil means that there was no string found matching the regular expression /hello/ within the sentence "The cat chased the string."
* another syntax using the match method
* regex.match(string)
* /string/.match("The cat chased the string.") => "string"
* /needle/.match("We're in a haystack.") => nil
* ? optionality character
* example: "abcdef"[/abz?/] => "ab"
12/01/2015 12:38 PM
## More of the regex basics
* . a wild card any one character except line breaks
* gre.t
* [] character set, any one character listed inside []
* gr[ea]y
* [^ ] negative character set any one character not listed inside the []
* [^aeiou]
- range indicator when inside a character set
* [A-Za-z0-9]
* * Preceding element can occur zero or more times
* file_*name
* + preceding element can occur one or more times * extended regex syntax
* gro+ve
* ? preceding element can occur zero or more times * extended regex syntax
* colou?r |
11/30/2015 10:26 AM
* Regex means Regular Expression a syntax that is used to search for and characterize strings
* delimited by two forward slashes /regex goes here/
* search for a string with matching content
* you can search for the match string "string" in the following sentence "The cat chased the string"
* "The cat chased the string."[/string/]
* the output is the string "string"
* the output of "The cat chased the string."[/hello/] => nil means that there was no string found matching the regular expression /hello/ within the sentence "The cat chased the string."
* another syntax using the match method
* regex.match(string)
* /string/.match("The cat chased the string.") => "string"
* /needle/.match("We're in a haystack.") => nil
* ? optionality character
* example: "abcdef"[/abz?/] => "ab"
+ 12/01/2015 12:38 PM
+
+ ## More of the regex basics
+
+ * . a wild card any one character except line breaks
+ * gre.t
+ * [] character set, any one character listed inside []
+ * gr[ea]y
+ * [^ ] negative character set any one character not listed inside the []
+ * [^aeiou]
+ - range indicator when inside a character set
+ * [A-Za-z0-9]
+ * * Preceding element can occur zero or more times
+ * file_*name
+ * + preceding element can occur one or more times * extended regex syntax
+ * gro+ve
+ * ? preceding element can occur zero or more times * extended regex syntax
+ * colou?r | 18 | 0.857143 | 18 | 0 |
577564d1d5603f50e8ecc78362ea520cb12b1e29 | fileserver/fileserver.go | fileserver/fileserver.go | package fileserver
// FileServer serves web resources from files.
type FileServer struct {
// ContentRoot is the folder containing the content
ContentRoot string
Getters []Getter
}
// NewFileServer creates a new instance with default cacheServ & fileServ
func NewFileServer(contentRoot string) (fs FileServer) {
fs.Getters = []Getter{
cacheServ{},
fileServ{},
}
fs.ContentRoot = contentRoot
return
}
// Get retrieves content for the specifie path.
func (fs FileServer) Get(path string) (content []byte, err error) {
for i, getter := range fs.Getters {
content, err = getter.Get(path)
if err == nil {
return content, nil
}
if i == len(fs.Getters)-1 { // All getters returned errors
return nil, ErrInvalidContentPath{path}
}
}
return
}
| package fileserver
// FileServer serves web resources from files.
type FileServer struct {
// ContentRoot is the folder containing the content
ContentRoot string
Getters []Getter
}
// NewFileServer creates a new instance with default cacheServ & fileServ Getters
func NewFileServer(contentRoot string) (fs FileServer) {
fs = FileServer{
ContentRoot: contentRoot,
Getters: []Getter{
cacheServ{},
fileServ{},
},
}
return
}
// Get retrieves content for the specifie path.
func (fs FileServer) Get(path string) (content []byte, err error) {
for i, getter := range fs.Getters {
content, err = getter.Get(path)
if err == nil {
return content, nil
}
if i == len(fs.Getters)-1 { // All getters returned errors
return nil, ErrInvalidContentPath{path}
}
}
return
}
| Use constructor rather than object.Param = syntax | Use constructor rather than object.Param = syntax
| Go | mit | jacobhands/multiweb,jacobhands/multiweb | go | ## Code Before:
package fileserver
// FileServer serves web resources from files.
type FileServer struct {
// ContentRoot is the folder containing the content
ContentRoot string
Getters []Getter
}
// NewFileServer creates a new instance with default cacheServ & fileServ
func NewFileServer(contentRoot string) (fs FileServer) {
fs.Getters = []Getter{
cacheServ{},
fileServ{},
}
fs.ContentRoot = contentRoot
return
}
// Get retrieves content for the specifie path.
func (fs FileServer) Get(path string) (content []byte, err error) {
for i, getter := range fs.Getters {
content, err = getter.Get(path)
if err == nil {
return content, nil
}
if i == len(fs.Getters)-1 { // All getters returned errors
return nil, ErrInvalidContentPath{path}
}
}
return
}
## Instruction:
Use constructor rather than object.Param = syntax
## Code After:
package fileserver
// FileServer serves web resources from files.
type FileServer struct {
// ContentRoot is the folder containing the content
ContentRoot string
Getters []Getter
}
// NewFileServer creates a new instance with default cacheServ & fileServ Getters
func NewFileServer(contentRoot string) (fs FileServer) {
fs = FileServer{
ContentRoot: contentRoot,
Getters: []Getter{
cacheServ{},
fileServ{},
},
}
return
}
// Get retrieves content for the specifie path.
func (fs FileServer) Get(path string) (content []byte, err error) {
for i, getter := range fs.Getters {
content, err = getter.Get(path)
if err == nil {
return content, nil
}
if i == len(fs.Getters)-1 { // All getters returned errors
return nil, ErrInvalidContentPath{path}
}
}
return
}
| package fileserver
// FileServer serves web resources from files.
type FileServer struct {
// ContentRoot is the folder containing the content
ContentRoot string
Getters []Getter
}
- // NewFileServer creates a new instance with default cacheServ & fileServ
+ // NewFileServer creates a new instance with default cacheServ & fileServ Getters
? ++++++++
func NewFileServer(contentRoot string) (fs FileServer) {
+ fs = FileServer{
+ ContentRoot: contentRoot,
- fs.Getters = []Getter{
? ^^^ ^^
+ Getters: []Getter{
? ^ ^
- cacheServ{},
+ cacheServ{},
? +
- fileServ{},
+ fileServ{},
? +
+ },
}
- fs.ContentRoot = contentRoot
return
}
// Get retrieves content for the specifie path.
func (fs FileServer) Get(path string) (content []byte, err error) {
for i, getter := range fs.Getters {
content, err = getter.Get(path)
if err == nil {
return content, nil
}
if i == len(fs.Getters)-1 { // All getters returned errors
return nil, ErrInvalidContentPath{path}
}
}
return
} | 12 | 0.375 | 7 | 5 |
d4dede3ed83c1551d82cc6e24d7ac4ee61bf152f | client/app/umm/umm.controller.js | client/app/umm/umm.controller.js | 'use strict';
angular.module('yeoMeanApp')
.controller('UmmCtrl', function ($scope, $http) {
$scope.movieList = [];
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.addMovie = function() {
if($scope.newMovie === '' || $scope.newRating === '') {
return;
}
$http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating });
$scope.newMovie = '';
$scope.newRating = '';
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
};
$scope.deleteMovie = function(movie) {
$http.delete('/api/movies/' + movie._id);
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
};
});
| 'use strict';
angular.module('yeoMeanApp')
.controller('UmmCtrl', function ($scope, $http) {
$scope.movieList = [];
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.addMovie = function() {
if($scope.newMovie === '' || $scope.newRating === '') {
return;
}
$http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating }).success(function(){
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.newMovie = '';
$scope.newRating = '';
});
};
$scope.deleteMovie = function(movie) {
$http.delete('/api/movies/' + movie._id).success(function(){
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
});
};
});
| Put the get requests for updating the light into a success to keep things safe. | Put the get requests for updating the light into a success to keep things safe.
| JavaScript | mit | bman4789/YeoMEAN,bman4789/YeoMEAN | javascript | ## Code Before:
'use strict';
angular.module('yeoMeanApp')
.controller('UmmCtrl', function ($scope, $http) {
$scope.movieList = [];
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.addMovie = function() {
if($scope.newMovie === '' || $scope.newRating === '') {
return;
}
$http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating });
$scope.newMovie = '';
$scope.newRating = '';
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
};
$scope.deleteMovie = function(movie) {
$http.delete('/api/movies/' + movie._id);
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
};
});
## Instruction:
Put the get requests for updating the light into a success to keep things safe.
## Code After:
'use strict';
angular.module('yeoMeanApp')
.controller('UmmCtrl', function ($scope, $http) {
$scope.movieList = [];
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.addMovie = function() {
if($scope.newMovie === '' || $scope.newRating === '') {
return;
}
$http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating }).success(function(){
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.newMovie = '';
$scope.newRating = '';
});
};
$scope.deleteMovie = function(movie) {
$http.delete('/api/movies/' + movie._id).success(function(){
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
});
};
});
| 'use strict';
angular.module('yeoMeanApp')
.controller('UmmCtrl', function ($scope, $http) {
$scope.movieList = [];
//Update movieList to have the same data that's in the database on the sever
$http.get('/api/movies').success(function(movieList) {
$scope.movieList = movieList;
});
$scope.addMovie = function() {
if($scope.newMovie === '' || $scope.newRating === '') {
return;
}
- $http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating });
? ^
+ $http.post('/api/movies', { name: $scope.newMovie, rating: $scope.newRating }).success(function(){
? ^^^^^^^^^^^^^^^^^^^^
- $scope.newMovie = '';
- $scope.newRating = '';
- //Update movieList to have the same data that's in the database on the sever
+ //Update movieList to have the same data that's in the database on the sever
? ++++
- $http.get('/api/movies').success(function(movieList) {
+ $http.get('/api/movies').success(function(movieList) {
? ++++
- $scope.movieList = movieList;
+ $scope.movieList = movieList;
? ++++
+ });
+ $scope.newMovie = '';
+ $scope.newRating = '';
});
};
$scope.deleteMovie = function(movie) {
- $http.delete('/api/movies/' + movie._id);
? ^
+ $http.delete('/api/movies/' + movie._id).success(function(){
? ^^^^^^^^^^^^^^^^^^^^
- //Update movieList to have the same data that's in the database on the sever
+ //Update movieList to have the same data that's in the database on the sever
? ++++
- $http.get('/api/movies').success(function(movieList) {
+ $http.get('/api/movies').success(function(movieList) {
? ++++
- $scope.movieList = movieList;
+ $scope.movieList = movieList;
? ++++
+ });
});
};
}); | 22 | 0.6875 | 12 | 10 |
da29c71f4668f22d55f562f5e5a4bbdbccbe08c9 | fig_power_supply_connection.txt | fig_power_supply_connection.txt | CIRKIT-5 (forrow as i-cart mini)
2016 0916
2016 0929
|===================|
|Source 24V (PbBatt)|
|===================|
|
|===================|
|Emergency Switch |<- Post_Added
|===================|
|
|===================|
|Power Supply Board |
|===================|
|5V |12V
| L---------------------------------------|
| |
|===================| |
|Motor Driver | |
|===================| |
| | |
| L-----------------| |
| | |
|==================| |===========================| |=====|
|DC Motor Clockwise| | DC Motor Counter Clockwise| |LRF |
|==================| |===========================| |=====|
| CIRKIT-5 (forrow as i-cart mini)
2016 0916
2016 0929
|===================|
|Source 24V (PbBatt)|
|===================|
|
|===================|
|Emergency switch |<- Post_Added
|===================|
|
|===================|
|Power supply board |
|===================|
|5V |12V
| L---------------------------------------|
| |
|===================| |
|Motor driver | |
|===================| |
| | |
| L-----------------| |
| | |
|==================| |===========================| |=====|
|DC motor clockwise| | DC motor counter clockwise| |LRF |
|==================| |===========================| |=====|
| Update power supply connection for readability | Update power supply connection for readability
見やすいように成形
全部大文字から始まっていたのでword 2以降は小文字に。
意味のないインデントを削除 | Text | bsd-3-clause | CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg,CIR-KIT/fifth_robot_pkg | text | ## Code Before:
CIRKIT-5 (forrow as i-cart mini)
2016 0916
2016 0929
|===================|
|Source 24V (PbBatt)|
|===================|
|
|===================|
|Emergency Switch |<- Post_Added
|===================|
|
|===================|
|Power Supply Board |
|===================|
|5V |12V
| L---------------------------------------|
| |
|===================| |
|Motor Driver | |
|===================| |
| | |
| L-----------------| |
| | |
|==================| |===========================| |=====|
|DC Motor Clockwise| | DC Motor Counter Clockwise| |LRF |
|==================| |===========================| |=====|
## Instruction:
Update power supply connection for readability
見やすいように成形
全部大文字から始まっていたのでword 2以降は小文字に。
意味のないインデントを削除
## Code After:
CIRKIT-5 (forrow as i-cart mini)
2016 0916
2016 0929
|===================|
|Source 24V (PbBatt)|
|===================|
|
|===================|
|Emergency switch |<- Post_Added
|===================|
|
|===================|
|Power supply board |
|===================|
|5V |12V
| L---------------------------------------|
| |
|===================| |
|Motor driver | |
|===================| |
| | |
| L-----------------| |
| | |
|==================| |===========================| |=====|
|DC motor clockwise| | DC motor counter clockwise| |LRF |
|==================| |===========================| |=====|
| CIRKIT-5 (forrow as i-cart mini)
2016 0916
2016 0929
- |===================|
? --
+ |===================|
- |Source 24V (PbBatt)|
? --
+ |Source 24V (PbBatt)|
- |===================|
? --
+ |===================|
- |
? --
+ |
- |===================|
? --
+ |===================|
- |Emergency Switch |<- Post_Added
? -- ^
+ |Emergency switch |<- Post_Added
? ^
- |===================|
? --
+ |===================|
- |
? --
+ |
- |===================|
? --
+ |===================|
- |Power Supply Board |
? -- ^ ^
+ |Power supply board |
? ^ ^
- |===================|
? --
+ |===================|
- |5V |12V
? --
+ |5V |12V
- | L---------------------------------------|
? --
+ | L---------------------------------------|
- | |
? --
+ | |
- |===================| |
? --
+ |===================| |
- |Motor Driver | |
? -- ^
+ |Motor driver | |
? ^
- |===================| |
? --
+ |===================| |
- | | |
? --
+ | | |
- | L-----------------| |
? --
+ | L-----------------| |
- | | |
? --
+ | | |
- |==================| |===========================| |=====|
? --
+ |==================| |===========================| |=====|
- |DC Motor Clockwise| | DC Motor Counter Clockwise| |LRF |
? -- ^ ^ ^ ^ ^
+ |DC motor clockwise| | DC motor counter clockwise| |LRF |
? ^ ^ ^ ^ ^
- |==================| |===========================| |=====|
? --
+ |==================| |===========================| |=====|
- | 47 | 1.678571 | 23 | 24 |
cff5618d4e847b9f13e1f051d56e09ee00cfb089 | testing/libfuzzer/pdf_css_fuzzer.cc | testing/libfuzzer/pdf_css_fuzzer.cc | // Copyright 2016 The PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
CFDE_CSSSyntaxParser parser;
parser.Init(input.c_str(), size);
FDE_CSSSyntaxStatus status;
do {
status = parser.DoSyntaxParse();
} while (status != FDE_CSSSyntaxStatus::Error &&
status != FDE_CSSSyntaxStatus::EOS);
return 0;
}
| // Copyright 2016 The PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
// If we convert the input into an empty string bail out.
if (input.GetLength() == 0)
return 0;
CFDE_CSSSyntaxParser parser;
parser.Init(input.c_str(), input.GetLength());
FDE_CSSSyntaxStatus status;
do {
status = parser.DoSyntaxParse();
} while (status != FDE_CSSSyntaxStatus::Error &&
status != FDE_CSSSyntaxStatus::EOS);
return 0;
}
| Fix CSS fuzzer input size | Fix CSS fuzzer input size
Currently we use the size provided by clusterfuzz when initializing the
css syntax parser. This maybe incorrect as the CFX_WideString may have a
different count after converting to UTF. Use the wide string length instead
of the provided size.
We need to guard against strings that convert to blank when doing the wide
conversion so add an early exit.
BUG=682551
Change-Id: I3e014647fcf869681098a1b4446306b8b3eb9323
Reviewed-on: https://pdfium-review.googlesource.com/2391
Reviewed-by: Tom Sepez <47f022c5217a84c904816c5375403e20a45c37f6@chromium.org>
Commit-Queue: dsinclair <f70dc21b1b6a10340b65b6dcc0bde33e44f9236b@chromium.org>
| C++ | bsd-3-clause | DrAlexx/pdfium,DrAlexx/pdfium,DrAlexx/pdfium,DrAlexx/pdfium | c++ | ## Code Before:
// Copyright 2016 The PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
CFDE_CSSSyntaxParser parser;
parser.Init(input.c_str(), size);
FDE_CSSSyntaxStatus status;
do {
status = parser.DoSyntaxParse();
} while (status != FDE_CSSSyntaxStatus::Error &&
status != FDE_CSSSyntaxStatus::EOS);
return 0;
}
## Instruction:
Fix CSS fuzzer input size
Currently we use the size provided by clusterfuzz when initializing the
css syntax parser. This maybe incorrect as the CFX_WideString may have a
different count after converting to UTF. Use the wide string length instead
of the provided size.
We need to guard against strings that convert to blank when doing the wide
conversion so add an early exit.
BUG=682551
Change-Id: I3e014647fcf869681098a1b4446306b8b3eb9323
Reviewed-on: https://pdfium-review.googlesource.com/2391
Reviewed-by: Tom Sepez <47f022c5217a84c904816c5375403e20a45c37f6@chromium.org>
Commit-Queue: dsinclair <f70dc21b1b6a10340b65b6dcc0bde33e44f9236b@chromium.org>
## Code After:
// Copyright 2016 The PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
// If we convert the input into an empty string bail out.
if (input.GetLength() == 0)
return 0;
CFDE_CSSSyntaxParser parser;
parser.Init(input.c_str(), input.GetLength());
FDE_CSSSyntaxStatus status;
do {
status = parser.DoSyntaxParse();
} while (status != FDE_CSSSyntaxStatus::Error &&
status != FDE_CSSSyntaxStatus::EOS);
return 0;
}
| // Copyright 2016 The PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/cfde_csssyntaxparser.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
+ // If we convert the input into an empty string bail out.
+ if (input.GetLength() == 0)
+ return 0;
+
CFDE_CSSSyntaxParser parser;
- parser.Init(input.c_str(), size);
? - ^
+ parser.Init(input.c_str(), input.GetLength());
? ^^^^^^ +++++++++
FDE_CSSSyntaxStatus status;
do {
status = parser.DoSyntaxParse();
} while (status != FDE_CSSSyntaxStatus::Error &&
status != FDE_CSSSyntaxStatus::EOS);
return 0;
} | 6 | 0.222222 | 5 | 1 |
f5e83a23d31b528445f830ff1487573610a3c358 | roles/wt_streaming_api_server.json | roles/wt_streaming_api_server.json | {
"name": "wt_streaming_api_server",
"default_attributes": {
},
"override_attributes": {
"ulimit" : {
"soft": "65000",
"hard": "65000"
},
"java" : {
"install_flavor": "oracle",
"jdk_version": "7"
}
},
"json_class": "Chef::Role",
"env_run_lists": {
},
"run_list": [
"recipe[ulimit]",
"recipe[java]",
"recipe[wt_streamingapi]"
],
"description": "Webtrends Streaming API Server",
"chef_type": "role"
} | {
"name": "wt_streaming_api_server",
"default_attributes": {
},
"override_attributes": {
"java" : {
"install_flavor": "oracle",
"jdk_version": "7"
}
},
"json_class": "Chef::Role",
"env_run_lists": {
},
"run_list": [
"recipe[java]",
"recipe[wt_streamingapi]"
],
"description": "Webtrends Streaming API Server",
"chef_type": "role"
} | Update SAPI role to not use ulimit since we're doing this in runit | Update SAPI role to not use ulimit since we're doing this in runit
Former-commit-id: 3f62560ed3499e4a9efac030ec1133ea839b5a78 [formerly a9f3550b327fc6740acfcb573da8e7e79d09055b] [formerly def9ce75acea816d1821e60037a906c8359602fe [formerly dd999fafd1f8fb4a66188ac54051fac1ea6074d8]]
Former-commit-id: efdf4c052a8d6f5e1441a23760a031b85a4c614a [formerly 50085de4b6efef675f86c94177b640a365aff402]
Former-commit-id: c06a557dbdcb72e4bc4580f431dcec8bc7564161 | JSON | apache-2.0 | ARentz07/rundeck,tas50/rundeck,edwlarkey/rundeck,tas50/rundeck,marthag8/rundeck,ARentz07/rundeck,ronabop/rundeck,edwlarkey/rundeck,edwlarkey/rundeck,marthag8/rundeck,ARentz07/rundeck,ronabop/rundeck,ronabop/rundeck,tas50/rundeck,marthag8/rundeck | json | ## Code Before:
{
"name": "wt_streaming_api_server",
"default_attributes": {
},
"override_attributes": {
"ulimit" : {
"soft": "65000",
"hard": "65000"
},
"java" : {
"install_flavor": "oracle",
"jdk_version": "7"
}
},
"json_class": "Chef::Role",
"env_run_lists": {
},
"run_list": [
"recipe[ulimit]",
"recipe[java]",
"recipe[wt_streamingapi]"
],
"description": "Webtrends Streaming API Server",
"chef_type": "role"
}
## Instruction:
Update SAPI role to not use ulimit since we're doing this in runit
Former-commit-id: 3f62560ed3499e4a9efac030ec1133ea839b5a78 [formerly a9f3550b327fc6740acfcb573da8e7e79d09055b] [formerly def9ce75acea816d1821e60037a906c8359602fe [formerly dd999fafd1f8fb4a66188ac54051fac1ea6074d8]]
Former-commit-id: efdf4c052a8d6f5e1441a23760a031b85a4c614a [formerly 50085de4b6efef675f86c94177b640a365aff402]
Former-commit-id: c06a557dbdcb72e4bc4580f431dcec8bc7564161
## Code After:
{
"name": "wt_streaming_api_server",
"default_attributes": {
},
"override_attributes": {
"java" : {
"install_flavor": "oracle",
"jdk_version": "7"
}
},
"json_class": "Chef::Role",
"env_run_lists": {
},
"run_list": [
"recipe[java]",
"recipe[wt_streamingapi]"
],
"description": "Webtrends Streaming API Server",
"chef_type": "role"
} | {
"name": "wt_streaming_api_server",
"default_attributes": {
},
"override_attributes": {
- "ulimit" : {
- "soft": "65000",
- "hard": "65000"
- },
"java" : {
"install_flavor": "oracle",
"jdk_version": "7"
}
},
"json_class": "Chef::Role",
"env_run_lists": {
},
"run_list": [
- "recipe[ulimit]",
"recipe[java]",
"recipe[wt_streamingapi]"
],
"description": "Webtrends Streaming API Server",
"chef_type": "role"
} | 5 | 0.2 | 0 | 5 |
b8814f2577482974876b992a3f46e01eca096623 | .travis.yml | .travis.yml | language: go
go:
- 1.3
- tip
script:
- go test -v ./...
| language: go
go:
- 1.3
- tip
script:
- go test -v ./...
notifications:
slack:
secure: YyKza3/7/PKJ5b+zIffDS0WNCdW03zBWg1A/ABqIXcR+sqkYJcaKVOg/PpfmliV3DMTg5Hkbegx4DI+O/zjGMP4v0dPjxK7jS4fkHRdlh4nocJWoxWJvLMWnGy1HnxIBhEWBwWlsgyTMb4ujujzbCk+4M25xKP+WHP+cAQtfTxQF9beZOjTzWENaIoW5SweV0RrtKrLkDROol4XWoRZF2vtMfemu/ovEEZ+u9o793SNceYtYjjM2X2MtBWpb0xoktBo0yy12zbjKaPjId34zF6PoED4sxhqSsl7jTEP4H1WAEFBzbGGqR0ewpJ4dhzbL1g2SF8RKtAlpv7NjZ1504e2R+rnis7fLaSyy5ZlMYIyeEpnYYcw6bUtBlApsBuwjl51FGBpygKzznWRERl/poDJ27kluQmVBmoS6OHXRpQs6PV0YXrv9nC8iz3tG5zfPNJQ0PvVQi3j6poET5/fal1inq+/cFWnyDpByCKhcq3V0r9atYDzvn2pz7Ebxt3Xrlzf4c5cz6iQ7KP7CJ4UHs0F37Y31FBuxLx73eye7iHAiYJms/mjAM80ykOqk4aKY7/AHrDOzsHPP/A2VZP8KGOiK6PJ0MUM/KSzHovaS7dLEq/Z73c4SuXdQiST9AYLZF3anbmpu+5Aw4CRq6zE6g3xUS55drgja5YF4nI/ujWI=
| Add slack notifications to the ableton channel for builds | Add slack notifications to the ableton channel for builds
| YAML | bsd-3-clause | AbletonAG/go-travis,Ableton/go-travis | yaml | ## Code Before:
language: go
go:
- 1.3
- tip
script:
- go test -v ./...
## Instruction:
Add slack notifications to the ableton channel for builds
## Code After:
language: go
go:
- 1.3
- tip
script:
- go test -v ./...
notifications:
slack:
secure: YyKza3/7/PKJ5b+zIffDS0WNCdW03zBWg1A/ABqIXcR+sqkYJcaKVOg/PpfmliV3DMTg5Hkbegx4DI+O/zjGMP4v0dPjxK7jS4fkHRdlh4nocJWoxWJvLMWnGy1HnxIBhEWBwWlsgyTMb4ujujzbCk+4M25xKP+WHP+cAQtfTxQF9beZOjTzWENaIoW5SweV0RrtKrLkDROol4XWoRZF2vtMfemu/ovEEZ+u9o793SNceYtYjjM2X2MtBWpb0xoktBo0yy12zbjKaPjId34zF6PoED4sxhqSsl7jTEP4H1WAEFBzbGGqR0ewpJ4dhzbL1g2SF8RKtAlpv7NjZ1504e2R+rnis7fLaSyy5ZlMYIyeEpnYYcw6bUtBlApsBuwjl51FGBpygKzznWRERl/poDJ27kluQmVBmoS6OHXRpQs6PV0YXrv9nC8iz3tG5zfPNJQ0PvVQi3j6poET5/fal1inq+/cFWnyDpByCKhcq3V0r9atYDzvn2pz7Ebxt3Xrlzf4c5cz6iQ7KP7CJ4UHs0F37Y31FBuxLx73eye7iHAiYJms/mjAM80ykOqk4aKY7/AHrDOzsHPP/A2VZP8KGOiK6PJ0MUM/KSzHovaS7dLEq/Z73c4SuXdQiST9AYLZF3anbmpu+5Aw4CRq6zE6g3xUS55drgja5YF4nI/ujWI=
| language: go
+ go:
+ - 1.3
+ - tip
+ script:
+ - go test -v ./...
+ notifications:
+ slack:
+ secure: YyKza3/7/PKJ5b+zIffDS0WNCdW03zBWg1A/ABqIXcR+sqkYJcaKVOg/PpfmliV3DMTg5Hkbegx4DI+O/zjGMP4v0dPjxK7jS4fkHRdlh4nocJWoxWJvLMWnGy1HnxIBhEWBwWlsgyTMb4ujujzbCk+4M25xKP+WHP+cAQtfTxQF9beZOjTzWENaIoW5SweV0RrtKrLkDROol4XWoRZF2vtMfemu/ovEEZ+u9o793SNceYtYjjM2X2MtBWpb0xoktBo0yy12zbjKaPjId34zF6PoED4sxhqSsl7jTEP4H1WAEFBzbGGqR0ewpJ4dhzbL1g2SF8RKtAlpv7NjZ1504e2R+rnis7fLaSyy5ZlMYIyeEpnYYcw6bUtBlApsBuwjl51FGBpygKzznWRERl/poDJ27kluQmVBmoS6OHXRpQs6PV0YXrv9nC8iz3tG5zfPNJQ0PvVQi3j6poET5/fal1inq+/cFWnyDpByCKhcq3V0r9atYDzvn2pz7Ebxt3Xrlzf4c5cz6iQ7KP7CJ4UHs0F37Y31FBuxLx73eye7iHAiYJms/mjAM80ykOqk4aKY7/AHrDOzsHPP/A2VZP8KGOiK6PJ0MUM/KSzHovaS7dLEq/Z73c4SuXdQiST9AYLZF3anbmpu+5Aw4CRq6zE6g3xUS55drgja5YF4nI/ujWI=
- go:
- - 1.3
- - tip
-
- script:
- - go test -v ./... | 14 | 1.75 | 8 | 6 |
113b3f689ea6fc5ef9510c53ff5f74266d90faae | jekyll/trips/index.md | jekyll/trips/index.md | ---
title: Trips
layout: page
---
<dl>
<dt><a href="{{ site.baseurl }}{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
<dd>I spent two weeks in September 2018 making the pilgrimage to Bonneville and exploring the Southwest.</dd>
</dl>
| ---
title: Trips
layout: page
---
<dl>
<dt><a href="{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
<dd>I spent two weeks in September 2018 making the pilgrimage to Bonneville and exploring the Southwest.</dd>
</dl>
| Fix link to trip page | Fix link to trip page
| Markdown | mit | blalor/blalor.github.io,blalor/blalor.github.io | markdown | ## Code Before:
---
title: Trips
layout: page
---
<dl>
<dt><a href="{{ site.baseurl }}{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
<dd>I spent two weeks in September 2018 making the pilgrimage to Bonneville and exploring the Southwest.</dd>
</dl>
## Instruction:
Fix link to trip page
## Code After:
---
title: Trips
layout: page
---
<dl>
<dt><a href="{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
<dd>I spent two weeks in September 2018 making the pilgrimage to Bonneville and exploring the Southwest.</dd>
</dl>
| ---
title: Trips
layout: page
---
<dl>
- <dt><a href="{{ site.baseurl }}{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
? ------------------
+ <dt><a href="{% link trips/summer-2018.md %}">Summer 2018 🏍</a></dt>
<dd>I spent two weeks in September 2018 making the pilgrimage to Bonneville and exploring the Southwest.</dd>
</dl> | 2 | 0.222222 | 1 | 1 |
44b41cc6acb176b9f354f81a4cefdd8e92fb9f63 | launch-your-portfolio.md | launch-your-portfolio.md | ---
layout: slide-deck
title: "Launch your portfolio"
desc: "Look at how to launch your portfolio on your domain to replace the coming soon page."
slides:
- type: super-big-text
content: |
**Launch your portfolio**
- content: |
## Move the CNAME
*It’s so much easier than you’re expecting!*
1. Go to [GitHub.com](https://github.com/)
2. Go to your “coming soon“ repo’s “Settings”
3. Delete the domain & save
4. Go to your “portfolio” repo’s “Settings”
5. Add the domain & save
---
| ---
layout: slide-deck
title: "Launch your portfolio"
desc: "Look at how to launch your portfolio on your domain to replace the coming soon page."
slides:
- type: super-big-text
content: |
**Launch your portfolio**
- type: two-col
col1: |
## Disable coming soon
1. Go to [GitHub.com](https://github.com/)
2. Go to your “coming soon“ repo’s “Settings”
3. Delete the domain & save
col2: |
## Enable portfolio
1. Change the `baseurl` inside `_config.yml`:
<br>`baseurl: ""`
2. Commit and push
3. Go to your portfolio repo’s “Settings”
4. Add your domain & save
5. Press the “Pull” button on the GitHub app
---
| Clarify the portfolio launch and add the missing baseurl details | Clarify the portfolio launch and add the missing baseurl details
| Markdown | unlicense | acgd-webdev-4/syllabus,acgd-webdev-5/curriculum | markdown | ## Code Before:
---
layout: slide-deck
title: "Launch your portfolio"
desc: "Look at how to launch your portfolio on your domain to replace the coming soon page."
slides:
- type: super-big-text
content: |
**Launch your portfolio**
- content: |
## Move the CNAME
*It’s so much easier than you’re expecting!*
1. Go to [GitHub.com](https://github.com/)
2. Go to your “coming soon“ repo’s “Settings”
3. Delete the domain & save
4. Go to your “portfolio” repo’s “Settings”
5. Add the domain & save
---
## Instruction:
Clarify the portfolio launch and add the missing baseurl details
## Code After:
---
layout: slide-deck
title: "Launch your portfolio"
desc: "Look at how to launch your portfolio on your domain to replace the coming soon page."
slides:
- type: super-big-text
content: |
**Launch your portfolio**
- type: two-col
col1: |
## Disable coming soon
1. Go to [GitHub.com](https://github.com/)
2. Go to your “coming soon“ repo’s “Settings”
3. Delete the domain & save
col2: |
## Enable portfolio
1. Change the `baseurl` inside `_config.yml`:
<br>`baseurl: ""`
2. Commit and push
3. Go to your portfolio repo’s “Settings”
4. Add your domain & save
5. Press the “Pull” button on the GitHub app
---
| ---
layout: slide-deck
title: "Launch your portfolio"
desc: "Look at how to launch your portfolio on your domain to replace the coming soon page."
slides:
- type: super-big-text
content: |
**Launch your portfolio**
+ - type: two-col
+ col1: |
+ ## Disable coming soon
- - content: |
- ## Move the CNAME
-
- *It’s so much easier than you’re expecting!*
1. Go to [GitHub.com](https://github.com/)
2. Go to your “coming soon“ repo’s “Settings”
3. Delete the domain & save
+ col2: |
+ ## Enable portfolio
+
+ 1. Change the `baseurl` inside `_config.yml`:
+ <br>`baseurl: ""`
+ 2. Commit and push
- 4. Go to your “portfolio” repo’s “Settings”
? ^ - -
+ 3. Go to your portfolio repo’s “Settings”
? ^
- 5. Add the domain & save
? ^ ^^^
+ 4. Add your domain & save
? ^ ^^^^
+ 5. Press the “Pull” button on the GitHub app
+
--- | 19 | 0.904762 | 13 | 6 |
011649fb36188c5e517544eefe9a5bf001c628af | sass/bass/modules/generic/_bass.modules.generic.buttons.scss | sass/bass/modules/generic/_bass.modules.generic.buttons.scss | %button
{
@include adjust-font-size-to(type-scale(base), 2);
padding-left: h-rhythm(0.5);
padding-right: h-rhythm(0.5);
display: block;
border: none;
cursor: pointer;
position: relative;
text-decoration: none;
text-align: center;
-webkit-appearance: none;
-webkit-border-radius:0;
color: $ui-color;
background-color: $ui-background-color;
&:hover,
&:focus
{
background-color: $ui-background-color-hover;
}
&.disabled
{
opacity: $disabled-opacity;
cursor: not-allowed;
}
.Icon
{
@include adjust-font-size-to(type-scale(base), 2);
}
}
button
{
@extend %button;
} | %button
{
@include adjust-font-size-to(type-scale(base), 2);
padding-left: h-rhythm(0.5);
padding-right: h-rhythm(0.5);
border: none;
cursor: pointer;
position: relative;
text-decoration: none;
text-align: center;
-webkit-appearance: none;
-webkit-border-radius:0;
color: $ui-color;
background-color: $ui-background-color;
&:hover,
&:focus
{
background-color: $ui-background-color-hover;
}
&.disabled
{
opacity: $disabled-opacity;
cursor: not-allowed;
}
.Icon
{
@include adjust-font-size-to(type-scale(base), 2);
}
}
button
{
@extend %button;
} | Remove block styling for button | Remove block styling for button
| SCSS | mit | Undistraction/bass,Undistraction/bass,Undistraction/bass | scss | ## Code Before:
%button
{
@include adjust-font-size-to(type-scale(base), 2);
padding-left: h-rhythm(0.5);
padding-right: h-rhythm(0.5);
display: block;
border: none;
cursor: pointer;
position: relative;
text-decoration: none;
text-align: center;
-webkit-appearance: none;
-webkit-border-radius:0;
color: $ui-color;
background-color: $ui-background-color;
&:hover,
&:focus
{
background-color: $ui-background-color-hover;
}
&.disabled
{
opacity: $disabled-opacity;
cursor: not-allowed;
}
.Icon
{
@include adjust-font-size-to(type-scale(base), 2);
}
}
button
{
@extend %button;
}
## Instruction:
Remove block styling for button
## Code After:
%button
{
@include adjust-font-size-to(type-scale(base), 2);
padding-left: h-rhythm(0.5);
padding-right: h-rhythm(0.5);
border: none;
cursor: pointer;
position: relative;
text-decoration: none;
text-align: center;
-webkit-appearance: none;
-webkit-border-radius:0;
color: $ui-color;
background-color: $ui-background-color;
&:hover,
&:focus
{
background-color: $ui-background-color-hover;
}
&.disabled
{
opacity: $disabled-opacity;
cursor: not-allowed;
}
.Icon
{
@include adjust-font-size-to(type-scale(base), 2);
}
}
button
{
@extend %button;
} | %button
{
@include adjust-font-size-to(type-scale(base), 2);
padding-left: h-rhythm(0.5);
padding-right: h-rhythm(0.5);
- display: block;
border: none;
cursor: pointer;
position: relative;
text-decoration: none;
text-align: center;
-webkit-appearance: none;
-webkit-border-radius:0;
color: $ui-color;
background-color: $ui-background-color;
&:hover,
&:focus
{
background-color: $ui-background-color-hover;
}
&.disabled
{
opacity: $disabled-opacity;
cursor: not-allowed;
}
.Icon
{
@include adjust-font-size-to(type-scale(base), 2);
}
}
button
{
@extend %button;
} | 1 | 0.025641 | 0 | 1 |
790ebf82d9b854d47a2aad27cdaee8025f549f9e | README.md | README.md | Geometrify written in Rust
[](https://travis-ci.org/theunknownxy/geometrify-rs)
| Geometrify written in Rust
| Move build status behind title. | Move build status behind title. | Markdown | mpl-2.0 | theunknownxy/geometrify-rs,theunknownxy/geometrify-rs | markdown | ## Code Before:
Geometrify written in Rust
[](https://travis-ci.org/theunknownxy/geometrify-rs)
## Instruction:
Move build status behind title.
## Code After:
Geometrify written in Rust
| Geometrify written in Rust
-
-
- [](https://travis-ci.org/theunknownxy/geometrify-rs) | 3 | 0.75 | 0 | 3 |
49971dbc5d444adbd86cb816450549945237379e | NestedMatcher/UrlMatcher.php | NestedMatcher/UrlMatcher.php | <?php
namespace Symfony\Cmf\Component\Routing\NestedMatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\UrlMatcher as SymfonyUrlMatcher;
use Symfony\Component\HttpFoundation\Request;
/**
* Extended UrlMatcher to provide an additional interface and enhanced features.
*
* @author Crell
*/
class UrlMatcher extends SymfonyUrlMatcher implements FinalMatcherInterface
{
/**
* {@inheritdoc}
*/
public function finalMatch(RouteCollection $collection, Request $request)
{
$this->routes = $collection;
$this->match($request->getPathInfo());
}
/**
* {@inheritdoc}
*/
protected function getAttributes(Route $route)
{
$args = func_get_args();
array_shift($args);
// TODO: where does the $name come from?
$args[] = array('_name' => $name, '_route' => $route);
return $this->mergeDefaults(call_user_func_array('array_replace', $args), $route->getDefaults());
}
}
| <?php
namespace Symfony\Cmf\Component\Routing\NestedMatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\UrlMatcher as SymfonyUrlMatcher;
use Symfony\Component\HttpFoundation\Request;
/**
* Extended UrlMatcher to provide an additional interface and enhanced features.
*
* @author Crell
*/
class UrlMatcher extends SymfonyUrlMatcher implements FinalMatcherInterface
{
/**
* {@inheritdoc}
*/
public function finalMatch(RouteCollection $collection, Request $request)
{
$this->routes = $collection;
$this->match($request->getPathInfo());
}
/**
* {@inheritdoc}
*/
protected function getAttributes(Route $route, $name, $attributes)
{
$attributes['_name'] = $name;
$attributes['_route'] = $route;
return $this->mergeDefaults($attributes, $route->getDefaults());
}
}
| Update getAttributes() override to keep up with the PR for Symfony Routing. | Update getAttributes() override to keep up with the PR for Symfony Routing.
| PHP | mit | aheinz-sg/Routing,pk16011990/Routing,ZnanyLekarz/Routing,sustmi/Routing,timplunkett/Routing,peterkokot/Routing | php | ## Code Before:
<?php
namespace Symfony\Cmf\Component\Routing\NestedMatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\UrlMatcher as SymfonyUrlMatcher;
use Symfony\Component\HttpFoundation\Request;
/**
* Extended UrlMatcher to provide an additional interface and enhanced features.
*
* @author Crell
*/
class UrlMatcher extends SymfonyUrlMatcher implements FinalMatcherInterface
{
/**
* {@inheritdoc}
*/
public function finalMatch(RouteCollection $collection, Request $request)
{
$this->routes = $collection;
$this->match($request->getPathInfo());
}
/**
* {@inheritdoc}
*/
protected function getAttributes(Route $route)
{
$args = func_get_args();
array_shift($args);
// TODO: where does the $name come from?
$args[] = array('_name' => $name, '_route' => $route);
return $this->mergeDefaults(call_user_func_array('array_replace', $args), $route->getDefaults());
}
}
## Instruction:
Update getAttributes() override to keep up with the PR for Symfony Routing.
## Code After:
<?php
namespace Symfony\Cmf\Component\Routing\NestedMatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\UrlMatcher as SymfonyUrlMatcher;
use Symfony\Component\HttpFoundation\Request;
/**
* Extended UrlMatcher to provide an additional interface and enhanced features.
*
* @author Crell
*/
class UrlMatcher extends SymfonyUrlMatcher implements FinalMatcherInterface
{
/**
* {@inheritdoc}
*/
public function finalMatch(RouteCollection $collection, Request $request)
{
$this->routes = $collection;
$this->match($request->getPathInfo());
}
/**
* {@inheritdoc}
*/
protected function getAttributes(Route $route, $name, $attributes)
{
$attributes['_name'] = $name;
$attributes['_route'] = $route;
return $this->mergeDefaults($attributes, $route->getDefaults());
}
}
| <?php
namespace Symfony\Cmf\Component\Routing\NestedMatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\UrlMatcher as SymfonyUrlMatcher;
use Symfony\Component\HttpFoundation\Request;
/**
* Extended UrlMatcher to provide an additional interface and enhanced features.
*
* @author Crell
*/
class UrlMatcher extends SymfonyUrlMatcher implements FinalMatcherInterface
{
/**
* {@inheritdoc}
*/
public function finalMatch(RouteCollection $collection, Request $request)
{
$this->routes = $collection;
$this->match($request->getPathInfo());
}
/**
* {@inheritdoc}
*/
- protected function getAttributes(Route $route)
+ protected function getAttributes(Route $route, $name, $attributes)
? ++++++++++++++++++++
{
+ $attributes['_name'] = $name;
+ $attributes['_route'] = $route;
+ return $this->mergeDefaults($attributes, $route->getDefaults());
- $args = func_get_args();
- array_shift($args);
- // TODO: where does the $name come from?
- $args[] = array('_name' => $name, '_route' => $route);
-
- return $this->mergeDefaults(call_user_func_array('array_replace', $args), $route->getDefaults());
}
} | 11 | 0.289474 | 4 | 7 |
cd7f3442c513cf48c82652fd18c5dd0927ac0b06 | library/socket/ipsocket/getaddress_spec.rb | library/socket/ipsocket/getaddress_spec.rb | require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe "Socket::IPSocket#getaddress" do
it "returns the IP address of hostname" do
addr_local = IPSocket.getaddress(SocketSpecs.hostname)
["127.0.0.1", "::1"].include?(addr_local).should == true
end
it "returns the IP address when passed an IP" do
IPSocket.getaddress("127.0.0.1").should == "127.0.0.1"
IPSocket.getaddress("0.0.0.0").should == "0.0.0.0"
end
it "raises an error on unknown hostnames" do
lambda { IPSocket.getaddress("imfakeidontexistanditrynottobeslow.com") }.should raise_error(SocketError)
end
end
| require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe "Socket::IPSocket#getaddress" do
it "returns the IP address of hostname" do
addr_local = IPSocket.getaddress(SocketSpecs.hostname)
["127.0.0.1", "::1"].include?(addr_local).should == true
end
it "returns the IP address when passed an IP" do
IPSocket.getaddress("127.0.0.1").should == "127.0.0.1"
IPSocket.getaddress("0.0.0.0").should == "0.0.0.0"
end
it "raises an error on unknown hostnames" do
lambda {
IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
}.should raise_error(SocketError)
end
end
| Use a controlled name for testing unknown hostnames | Use a controlled name for testing unknown hostnames
Some ISP intercept unknown domains under .com/.org/.net, so using
somerandomname.com can easily fail.
They don't seem to intercept unknown hostnames under normal domains
though, so I've change us to use rubyspecdoesntexist.fallingsnow.net
because I control fallingsnow.net and I know that there will never be a
DNS entry for this host.
| Ruby | mit | sferik/rubyspec,ruby/rubyspec,benlovell/rubyspec,sferik/rubyspec,atambo/rubyspec,wied03/rubyspec,tinco/rubyspec,xaviershay/rubyspec,ruby/spec,kachick/rubyspec,calavera/rubyspec,freerange/rubyspec,bjeanes/rubyspec,benburkert/rubyspec,DawidJanczak/rubyspec,neomadara/rubyspec,lucaspinto/rubyspec,no6v/rubyspec,alexch/rubyspec,iainbeeston/rubyspec,rkh/rubyspec,iliabylich/rubyspec,mbj/rubyspec,BanzaiMan/rubyspec,alindeman/rubyspec,JuanitoFatas/rubyspec,enricosada/rubyspec,yaauie/rubyspec,saturnflyer/rubyspec,xaviershay/rubyspec,alex/rubyspec,jvshahid/rubyspec,atambo/rubyspec,bl4ckdu5t/rubyspec,ruby/spec,scooter-dangle/rubyspec,jabley/rubyspec,metadave/rubyspec,askl56/rubyspec,tinco/rubyspec,neomadara/rubyspec,amarshall/rubyspec,DavidEGrayson/rubyspec,qmx/rubyspec,bomatson/rubyspec,benburkert/rubyspec,griff/rubyspec,bjeanes/rubyspec,teleological/rubyspec,nobu/rubyspec,jstepien/rubyspec,iliabylich/rubyspec,flavio/rubyspec,iainbeeston/rubyspec,qmx/rubyspec,teleological/rubyspec,agrimm/rubyspec,ericmeyer/rubyspec,julik/rubyspec,Zoxc/rubyspec,freerange/rubyspec,roshats/rubyspec,oggy/rubyspec,DavidEGrayson/rubyspec,yous/rubyspec,BanzaiMan/rubyspec,jstepien/rubyspec,roshats/rubyspec,mrkn/rubyspec,jannishuebl/rubyspec,sgarciac/spec,timfel/rubyspec,bl4ckdu5t/rubyspec,no6v/rubyspec,kachick/rubyspec,Zoxc/rubyspec,jabley/rubyspec,oggy/rubyspec,JuanitoFatas/rubyspec,Aesthetikx/rubyspec,nobu/rubyspec,timfel/rubyspec,nobu/rubyspec,DawidJanczak/rubyspec,nevir/rubyspec,griff/rubyspec,yaauie/rubyspec,rdp/rubyspec,calavera/rubyspec,jannishuebl/rubyspec,alindeman/rubyspec,chesterbr/rubyspec,kachick/rubyspec,flavio/rubyspec,agrimm/rubyspec,alex/rubyspec,rkh/rubyspec,shirosaki/rubyspec,kidaa/rubyspec,kidaa/rubyspec,bomatson/rubyspec,benlovell/rubyspec,yous/rubyspec,markburns/rubyspec,marcandre/rubyspec,enricosada/rubyspec,yb66/rubyspec,wied03/rubyspec,mbj/rubyspec,jvshahid/rubyspec,Aesthetikx/rubyspec,julik/rubyspec,terceiro/rubyspec,godfat/rubyspec,terceiro/rubyspec,metadave/rubyspec,shirosaki/rubyspec,marcandre/rubyspec,ruby/rubyspec,ericmeyer/rubyspec,markburns/rubyspec,alexch/rubyspec,eregon/rubyspec,MagLev/rubyspec,eregon/rubyspec,saturnflyer/rubyspec,eregon/rubyspec,wied03/rubyspec,josedonizetti/rubyspec,ruby/spec,nevir/rubyspec,amarshall/rubyspec,rdp/rubyspec,MagLev/rubyspec,sgarciac/spec,lucaspinto/rubyspec,mrkn/rubyspec,josedonizetti/rubyspec,yb66/rubyspec,scooter-dangle/rubyspec,chesterbr/rubyspec,godfat/rubyspec,sgarciac/spec,askl56/rubyspec | ruby | ## Code Before:
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe "Socket::IPSocket#getaddress" do
it "returns the IP address of hostname" do
addr_local = IPSocket.getaddress(SocketSpecs.hostname)
["127.0.0.1", "::1"].include?(addr_local).should == true
end
it "returns the IP address when passed an IP" do
IPSocket.getaddress("127.0.0.1").should == "127.0.0.1"
IPSocket.getaddress("0.0.0.0").should == "0.0.0.0"
end
it "raises an error on unknown hostnames" do
lambda { IPSocket.getaddress("imfakeidontexistanditrynottobeslow.com") }.should raise_error(SocketError)
end
end
## Instruction:
Use a controlled name for testing unknown hostnames
Some ISP intercept unknown domains under .com/.org/.net, so using
somerandomname.com can easily fail.
They don't seem to intercept unknown hostnames under normal domains
though, so I've change us to use rubyspecdoesntexist.fallingsnow.net
because I control fallingsnow.net and I know that there will never be a
DNS entry for this host.
## Code After:
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe "Socket::IPSocket#getaddress" do
it "returns the IP address of hostname" do
addr_local = IPSocket.getaddress(SocketSpecs.hostname)
["127.0.0.1", "::1"].include?(addr_local).should == true
end
it "returns the IP address when passed an IP" do
IPSocket.getaddress("127.0.0.1").should == "127.0.0.1"
IPSocket.getaddress("0.0.0.0").should == "0.0.0.0"
end
it "raises an error on unknown hostnames" do
lambda {
IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
}.should raise_error(SocketError)
end
end
| require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)
describe "Socket::IPSocket#getaddress" do
it "returns the IP address of hostname" do
addr_local = IPSocket.getaddress(SocketSpecs.hostname)
["127.0.0.1", "::1"].include?(addr_local).should == true
end
it "returns the IP address when passed an IP" do
IPSocket.getaddress("127.0.0.1").should == "127.0.0.1"
IPSocket.getaddress("0.0.0.0").should == "0.0.0.0"
end
it "raises an error on unknown hostnames" do
- lambda { IPSocket.getaddress("imfakeidontexistanditrynottobeslow.com") }.should raise_error(SocketError)
+ lambda {
+ IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net")
+ }.should raise_error(SocketError)
end
end | 4 | 0.2 | 3 | 1 |
1d195eaa8954dd35a86c585d6d946ca6b5f495a3 | package.json | package.json | {
"name": "id-area-keys",
"description": "OpenStreetMap area tags extracted from the iD editor presets",
"version": "2.9.0",
"main": "index.js",
"module": "index.mjs",
"license": "ISC",
"author": "Bryan Housel <bryan@mapbox.com>",
"repository": "osmlab/id-area-keys",
"keywords": [
"OpenStreetMap",
"area",
"tags"
],
"devDependencies": {
"iD": "git://github.com/openstreetmap/iD.git#v2.9.0",
"json-stable-stringify": "~1.0.1",
"lodash.reject": "~4.6.0",
"rollup": "~0.60.0",
"rollup-plugin-json": "^3.0.0",
"tap": "^12.0.0"
},
"scripts": {
"prepublish": "npm run build",
"build": "node build.js && rollup -c",
"test": "npm run build && tap test/*.js"
}
}
| {
"name": "id-area-keys",
"description": "OpenStreetMap area tags extracted from the iD editor presets",
"version": "2.9.0",
"main": "index.js",
"module": "index.mjs",
"license": "ISC",
"author": "Bryan Housel <bryan@mapbox.com>",
"repository": "osmlab/id-area-keys",
"keywords": [
"OpenStreetMap",
"area",
"tags"
],
"devDependencies": {
"iD": "git://github.com/openstreetmap/iD.git#v2.9.0",
"json-stable-stringify": "~1.0.1",
"lodash.reject": "~4.6.0",
"rollup": "~0.63.0",
"rollup-plugin-json": "^3.0.0",
"tap": "^12.0.0"
},
"scripts": {
"build": "node build.js && rollup -c",
"test": "npm run build && tap test/*.js"
}
}
| Update to rollup v0.63, remove deprecated `prepublish` step | Update to rollup v0.63, remove deprecated `prepublish` step
| JSON | isc | osmlab/id-area-keys | json | ## Code Before:
{
"name": "id-area-keys",
"description": "OpenStreetMap area tags extracted from the iD editor presets",
"version": "2.9.0",
"main": "index.js",
"module": "index.mjs",
"license": "ISC",
"author": "Bryan Housel <bryan@mapbox.com>",
"repository": "osmlab/id-area-keys",
"keywords": [
"OpenStreetMap",
"area",
"tags"
],
"devDependencies": {
"iD": "git://github.com/openstreetmap/iD.git#v2.9.0",
"json-stable-stringify": "~1.0.1",
"lodash.reject": "~4.6.0",
"rollup": "~0.60.0",
"rollup-plugin-json": "^3.0.0",
"tap": "^12.0.0"
},
"scripts": {
"prepublish": "npm run build",
"build": "node build.js && rollup -c",
"test": "npm run build && tap test/*.js"
}
}
## Instruction:
Update to rollup v0.63, remove deprecated `prepublish` step
## Code After:
{
"name": "id-area-keys",
"description": "OpenStreetMap area tags extracted from the iD editor presets",
"version": "2.9.0",
"main": "index.js",
"module": "index.mjs",
"license": "ISC",
"author": "Bryan Housel <bryan@mapbox.com>",
"repository": "osmlab/id-area-keys",
"keywords": [
"OpenStreetMap",
"area",
"tags"
],
"devDependencies": {
"iD": "git://github.com/openstreetmap/iD.git#v2.9.0",
"json-stable-stringify": "~1.0.1",
"lodash.reject": "~4.6.0",
"rollup": "~0.63.0",
"rollup-plugin-json": "^3.0.0",
"tap": "^12.0.0"
},
"scripts": {
"build": "node build.js && rollup -c",
"test": "npm run build && tap test/*.js"
}
}
| {
"name": "id-area-keys",
"description": "OpenStreetMap area tags extracted from the iD editor presets",
"version": "2.9.0",
"main": "index.js",
"module": "index.mjs",
"license": "ISC",
"author": "Bryan Housel <bryan@mapbox.com>",
"repository": "osmlab/id-area-keys",
"keywords": [
"OpenStreetMap",
"area",
"tags"
],
"devDependencies": {
"iD": "git://github.com/openstreetmap/iD.git#v2.9.0",
"json-stable-stringify": "~1.0.1",
"lodash.reject": "~4.6.0",
- "rollup": "~0.60.0",
? ^
+ "rollup": "~0.63.0",
? ^
"rollup-plugin-json": "^3.0.0",
"tap": "^12.0.0"
},
"scripts": {
- "prepublish": "npm run build",
"build": "node build.js && rollup -c",
"test": "npm run build && tap test/*.js"
}
} | 3 | 0.107143 | 1 | 2 |
3033637f3d3da4c9793ca41538a994a02da1215e | config.d/zsh/zshenv.d/30-application.d/node.zsh | config.d/zsh/zshenv.d/30-application.d/node.zsh | export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export NDENV_ROOT=$USER_BIN_HOME/lib/ndenv
# This could be problematic... either don't ever use system node/npm or have it
# store its packages alongside those of the same version of node installed
# through ndenv. ndenv sets the prefix to the same as below for its versions of
# node/npm, and I can't leave it alone for system node because only root has
# writing rights to the default npm prefix location
# Need to figure out a way to check if the current version was installed by the
# system or not. If it was installed by the system set the variable to one
# directory, otherwise to another.
# e.g. $NDENV_ROOT/versions/node-version/ndenv-or-sys
# Easiest thing is probably to never use system node.
export NPM_CONFIG_PREFIX=$NDENV_ROOT/versions/$(node --version)
export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/node/npm/bin
|
export NDENV_ROOT=$USER_BIN_HOME/lib/ndenv
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/node/npm/bin
| Remove unnecessary npm environment variable | Remove unnecessary npm environment variable
| Shell | mit | pedromaltez/dotfiles,pedromaltez/dotfiles | shell | ## Code Before:
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export NDENV_ROOT=$USER_BIN_HOME/lib/ndenv
# This could be problematic... either don't ever use system node/npm or have it
# store its packages alongside those of the same version of node installed
# through ndenv. ndenv sets the prefix to the same as below for its versions of
# node/npm, and I can't leave it alone for system node because only root has
# writing rights to the default npm prefix location
# Need to figure out a way to check if the current version was installed by the
# system or not. If it was installed by the system set the variable to one
# directory, otherwise to another.
# e.g. $NDENV_ROOT/versions/node-version/ndenv-or-sys
# Easiest thing is probably to never use system node.
export NPM_CONFIG_PREFIX=$NDENV_ROOT/versions/$(node --version)
export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/node/npm/bin
## Instruction:
Remove unnecessary npm environment variable
## Code After:
export NDENV_ROOT=$USER_BIN_HOME/lib/ndenv
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/node/npm/bin
| - export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
export NDENV_ROOT=$USER_BIN_HOME/lib/ndenv
+ export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
- # This could be problematic... either don't ever use system node/npm or have it
- # store its packages alongside those of the same version of node installed
- # through ndenv. ndenv sets the prefix to the same as below for its versions of
- # node/npm, and I can't leave it alone for system node because only root has
- # writing rights to the default npm prefix location
- # Need to figure out a way to check if the current version was installed by the
- # system or not. If it was installed by the system set the variable to one
- # directory, otherwise to another.
- # e.g. $NDENV_ROOT/versions/node-version/ndenv-or-sys
- # Easiest thing is probably to never use system node.
-
- export NPM_CONFIG_PREFIX=$NDENV_ROOT/versions/$(node --version)
-
export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/node/npm/bin | 15 | 0.833333 | 1 | 14 |
93d9ae1275aa6f40f3ad4a63b6919eb3eaaf6cf8 | nimble/sources/elementary.py | nimble/sources/elementary.py | from __future__ import absolute_import
from ..composition import SeekableSource
import numpy as np
class IntegerIdentitySource(SeekableSource):
"""Return the integer used as position argument."""
def __init__(self, size=np.iinfo(np.uint32).max, **kwargs):
self.parallel_possible = True
self.cached = True
self._shape = 1,
self._size = size
super(IntegerIdentitySource, self).__init__(name=u"IntegerIdentitySource", **kwargs)
def _get_data_at(self, position):
return np.array([position])
@property
def dtype(self):
return np.uint32
| from __future__ import absolute_import
from ..composition import SeekableSource
import numpy as np
class IntegerIdentitySource(SeekableSource):
"""Return the integer used as position argument."""
def __init__(self, size=np.iinfo(np.uint32).max, **kwargs):
self.parallel_possible = True
self.cached = True
self._shape = 1,
self._dtype = np.uint32
self._size = size
super(IntegerIdentitySource, self).__init__(name=u"IntegerIdentitySource", **kwargs)
def _get_data_at(self, position):
return np.array([position], dtype=self._dtype)
@property
def dtype(self):
return self._dtype
| Set identity integer source data type | Set identity integer source data type
| Python | mit | risteon/nimble | python | ## Code Before:
from __future__ import absolute_import
from ..composition import SeekableSource
import numpy as np
class IntegerIdentitySource(SeekableSource):
"""Return the integer used as position argument."""
def __init__(self, size=np.iinfo(np.uint32).max, **kwargs):
self.parallel_possible = True
self.cached = True
self._shape = 1,
self._size = size
super(IntegerIdentitySource, self).__init__(name=u"IntegerIdentitySource", **kwargs)
def _get_data_at(self, position):
return np.array([position])
@property
def dtype(self):
return np.uint32
## Instruction:
Set identity integer source data type
## Code After:
from __future__ import absolute_import
from ..composition import SeekableSource
import numpy as np
class IntegerIdentitySource(SeekableSource):
"""Return the integer used as position argument."""
def __init__(self, size=np.iinfo(np.uint32).max, **kwargs):
self.parallel_possible = True
self.cached = True
self._shape = 1,
self._dtype = np.uint32
self._size = size
super(IntegerIdentitySource, self).__init__(name=u"IntegerIdentitySource", **kwargs)
def _get_data_at(self, position):
return np.array([position], dtype=self._dtype)
@property
def dtype(self):
return self._dtype
| from __future__ import absolute_import
from ..composition import SeekableSource
import numpy as np
class IntegerIdentitySource(SeekableSource):
"""Return the integer used as position argument."""
def __init__(self, size=np.iinfo(np.uint32).max, **kwargs):
self.parallel_possible = True
self.cached = True
self._shape = 1,
+ self._dtype = np.uint32
self._size = size
super(IntegerIdentitySource, self).__init__(name=u"IntegerIdentitySource", **kwargs)
def _get_data_at(self, position):
- return np.array([position])
+ return np.array([position], dtype=self._dtype)
? +++++++++++++++++++
@property
def dtype(self):
- return np.uint32
+ return self._dtype | 5 | 0.217391 | 3 | 2 |
8dfe751d5529fbc192a281ce20ef8478bf40e741 | tutorial01/main.go | tutorial01/main.go | package main
import (
"fmt"
"hge"
)
var h *hge.HGE
func FrameFunc() int {
if h.Input_GetKeyState(hge.K_ESCAPE) {
return 1
}
return 0
}
func main() {
h = hge.Create(hge.VERSION)
defer h.Release()
h.System_SetState(hge.FRAMEFUNC, FrameFunc)
h.System_SetState(hge.TITLE, "HGE Tutorial 01 - Minimal HGE application")
h.System_SetState(hge.WINDOWED, true)
h.System_SetState(hge.USESOUND, false)
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
if h.System_Initiate() {
defer h.System_Shutdown()
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
h.System_Start()
} else {
fmt.Println("Error: ", h.System_GetErrorMessage())
}
h.System_Log("Test")
}
| package main
import (
"fmt"
"hge"
)
var h *hge.HGE
func FrameFunc() int {
if h.Input_GetKeyState(hge.K_ESCAPE) {
return 1
}
return 0
}
func main() {
h = hge.Create(hge.VERSION)
defer h.Release()
h.System_SetState(hge.LOGFILE, "tutorial01.log")
h.System_SetState(hge.FRAMEFUNC, FrameFunc)
h.System_SetState(hge.TITLE, "HGE Tutorial 01 - Minimal HGE application")
h.System_SetState(hge.WINDOWED, true)
h.System_SetState(hge.USESOUND, false)
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
if h.System_Initiate() {
defer h.System_Shutdown()
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
h.System_Start()
} else {
fmt.Println("Error: ", h.System_GetErrorMessage())
}
h.System_Log("Test")
}
| Add a logfile for tutorial01 | Add a logfile for tutorial01
| Go | bsd-2-clause | losinggeneration/hge,losinggeneration/hge-go,losinggeneration/hge-go,losinggeneration/hge | go | ## Code Before:
package main
import (
"fmt"
"hge"
)
var h *hge.HGE
func FrameFunc() int {
if h.Input_GetKeyState(hge.K_ESCAPE) {
return 1
}
return 0
}
func main() {
h = hge.Create(hge.VERSION)
defer h.Release()
h.System_SetState(hge.FRAMEFUNC, FrameFunc)
h.System_SetState(hge.TITLE, "HGE Tutorial 01 - Minimal HGE application")
h.System_SetState(hge.WINDOWED, true)
h.System_SetState(hge.USESOUND, false)
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
if h.System_Initiate() {
defer h.System_Shutdown()
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
h.System_Start()
} else {
fmt.Println("Error: ", h.System_GetErrorMessage())
}
h.System_Log("Test")
}
## Instruction:
Add a logfile for tutorial01
## Code After:
package main
import (
"fmt"
"hge"
)
var h *hge.HGE
func FrameFunc() int {
if h.Input_GetKeyState(hge.K_ESCAPE) {
return 1
}
return 0
}
func main() {
h = hge.Create(hge.VERSION)
defer h.Release()
h.System_SetState(hge.LOGFILE, "tutorial01.log")
h.System_SetState(hge.FRAMEFUNC, FrameFunc)
h.System_SetState(hge.TITLE, "HGE Tutorial 01 - Minimal HGE application")
h.System_SetState(hge.WINDOWED, true)
h.System_SetState(hge.USESOUND, false)
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
if h.System_Initiate() {
defer h.System_Shutdown()
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
h.System_Start()
} else {
fmt.Println("Error: ", h.System_GetErrorMessage())
}
h.System_Log("Test")
}
| package main
import (
"fmt"
"hge"
)
var h *hge.HGE
func FrameFunc() int {
if h.Input_GetKeyState(hge.K_ESCAPE) {
return 1
}
return 0
}
func main() {
h = hge.Create(hge.VERSION)
defer h.Release()
+ h.System_SetState(hge.LOGFILE, "tutorial01.log")
h.System_SetState(hge.FRAMEFUNC, FrameFunc)
h.System_SetState(hge.TITLE, "HGE Tutorial 01 - Minimal HGE application")
h.System_SetState(hge.WINDOWED, true)
h.System_SetState(hge.USESOUND, false)
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
if h.System_Initiate() {
defer h.System_Shutdown()
h.System_Log("Test")
h.System_Log("Test vararg: %s %d", "test", 15)
h.System_Start()
} else {
fmt.Println("Error: ", h.System_GetErrorMessage())
}
h.System_Log("Test")
} | 1 | 0.025 | 1 | 0 |
d80959b44888e15accfcc1fab86e61fbca65f66d | test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java | test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java | /**
* Copyright (c) 2012 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.generator.genmodel.test.util;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
/**
*
* @author andreas muelder - Initial contribution and API
*
*/
public class SGenTestRuntimeModule extends SGenRuntimeModule {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return SGenTestScopeProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SGenUserHelpDocumentationProvider.class;
}
}
| /**
* Copyright (c) 2012 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.generator.genmodel.test.util;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.impl.Linker;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
/**
*
* @author andreas muelder - Initial contribution and API
*
*/
public class SGenTestRuntimeModule extends SGenRuntimeModule {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return SGenTestScopeProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SGenUserHelpDocumentationProvider.class;
}
@Override
public Class<? extends ILinker> bindILinker() {
return Linker.class;
}
}
| Use Linker instead of LazyLinker | SGenJavaValidatorTest: Use Linker instead of LazyLinker | Java | epl-1.0 | Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts,Yakindu/statecharts | java | ## Code Before:
/**
* Copyright (c) 2012 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.generator.genmodel.test.util;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
/**
*
* @author andreas muelder - Initial contribution and API
*
*/
public class SGenTestRuntimeModule extends SGenRuntimeModule {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return SGenTestScopeProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SGenUserHelpDocumentationProvider.class;
}
}
## Instruction:
SGenJavaValidatorTest: Use Linker instead of LazyLinker
## Code After:
/**
* Copyright (c) 2012 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.generator.genmodel.test.util;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.impl.Linker;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
/**
*
* @author andreas muelder - Initial contribution and API
*
*/
public class SGenTestRuntimeModule extends SGenRuntimeModule {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return SGenTestScopeProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SGenUserHelpDocumentationProvider.class;
}
@Override
public Class<? extends ILinker> bindILinker() {
return Linker.class;
}
}
| /**
* Copyright (c) 2012 committers of YAKINDU and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Contributors:
* committers of YAKINDU - initial API and implementation
*
*/
package org.yakindu.sct.generator.genmodel.test.util;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
+ import org.eclipse.xtext.linking.ILinker;
+ import org.eclipse.xtext.linking.impl.Linker;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
/**
*
* @author andreas muelder - Initial contribution and API
*
*/
public class SGenTestRuntimeModule extends SGenRuntimeModule {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return SGenTestScopeProvider.class;
}
public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
return SGenUserHelpDocumentationProvider.class;
}
+
+ @Override
+ public Class<? extends ILinker> bindILinker() {
+ return Linker.class;
+ }
} | 7 | 0.212121 | 7 | 0 |
8f91c8626ec4c6f2bf0e4c46ac8ffac10242a0f4 | .travis.yml | .travis.yml | language: rust
cache: cargo
before_script:
- cargo install -f rustfmt
- export PATH=$PATH:$HOME/.cargo/bin
rust:
- stable
- beta
- nightly
env:
- NOTHING=INTERESTING
matrix:
include:
- rust: nightly
env: RUSTFMT=YESPLEASE
before_script: cargo install rustfmt-nightly --force
script: cargo fmt --all -- --write-mode diff
allow_failures:
- rust: nightly
env: NOTHING=INTERESTING
script:
- cargo test --all
services:
- docker
| language: rust
cache: cargo
rust:
- stable
- beta
- nightly
env:
- RUN=TEST
script:
- cargo test --all
services:
- docker
matrix:
include:
- rust: nightly
env: RUN=RUSTFMT
before_script: rustup component add rustfmt-preview
script: cargo fmt --all -- --write-mode diff
allow_failures:
- rust: nightly
env: RUN=TEST
| Use rustfmt-preview to not recompile rustfmt each time | Use rustfmt-preview to not recompile rustfmt each time
| YAML | agpl-3.0 | pbougue/mimirsbrunn,CanalTP/mimirsbrunn,pbougue/mimirsbrunn,CanalTP/mimirsbrunn | yaml | ## Code Before:
language: rust
cache: cargo
before_script:
- cargo install -f rustfmt
- export PATH=$PATH:$HOME/.cargo/bin
rust:
- stable
- beta
- nightly
env:
- NOTHING=INTERESTING
matrix:
include:
- rust: nightly
env: RUSTFMT=YESPLEASE
before_script: cargo install rustfmt-nightly --force
script: cargo fmt --all -- --write-mode diff
allow_failures:
- rust: nightly
env: NOTHING=INTERESTING
script:
- cargo test --all
services:
- docker
## Instruction:
Use rustfmt-preview to not recompile rustfmt each time
## Code After:
language: rust
cache: cargo
rust:
- stable
- beta
- nightly
env:
- RUN=TEST
script:
- cargo test --all
services:
- docker
matrix:
include:
- rust: nightly
env: RUN=RUSTFMT
before_script: rustup component add rustfmt-preview
script: cargo fmt --all -- --write-mode diff
allow_failures:
- rust: nightly
env: RUN=TEST
| language: rust
cache: cargo
- before_script:
- - cargo install -f rustfmt
- - export PATH=$PATH:$HOME/.cargo/bin
rust:
- stable
- beta
- nightly
env:
- - NOTHING=INTERESTING
+ - RUN=TEST
+ script:
+ - cargo test --all
+ services:
+ - docker
matrix:
include:
- rust: nightly
- env: RUSTFMT=YESPLEASE
- before_script: cargo install rustfmt-nightly --force
+ env: RUN=RUSTFMT
+ before_script: rustup component add rustfmt-preview
script: cargo fmt --all -- --write-mode diff
allow_failures:
- rust: nightly
+ env: RUN=TEST
- env: NOTHING=INTERESTING
-
- script:
- - cargo test --all
-
- services:
- - docker | 21 | 0.807692 | 8 | 13 |
3c86cbbb35bd8bbf2af5b0312626c8f2050b81e5 | app/views/sessions/index.haml | app/views/sessions/index.haml | Welcome to the Glowfic Constellation. Admire the tiny, tiny words.
%p
There is a (work in progress) community
= link_to 'guide to Glowfic.', 'https://docs.google.com/document/d/1_4Z2zdRKaSwZPm3S0X14DYoo7w46U_MZ4En6oOediNQ/edit'
%p
Join our community on:
%ul
%li= link_to "Alicorn's forum", 'http://alicorn.elcenia.com/board/index.php', target: '_blank'
%li= link_to "IRC", 'https://client00.chat.mibbit.com/?channel=%23glowfic&server=irc.psigenix.net', target: '_blank'
%li= link_to "Discord", 'https://discord.gg/Ss6fRFj', target: '_blank'
%li= link_to "Tumblr", 'http://alicorn.elcenia.com/board/viewtopic.php?f=10&t=615', target: '_blank'
| Welcome to the Glowfic Constellation. Admire the tiny, tiny words.
%p
There is a (work in progress) community
= link_to 'guide to Glowfic.', 'https://docs.google.com/document/d/1_4Z2zdRKaSwZPm3S0X14DYoo7w46U_MZ4En6oOediNQ/edit'
%p
Join our community on:
%ul
%li= link_to "Alicorn's forum", 'http://alicorn.elcenia.com/board/index.php', target: '_blank'
%li= link_to "IRC", 'https://client00.chat.mibbit.com/?channel=%23glowfic&server=irc.psigenix.net', target: '_blank'
%li= link_to "Discord", 'https://discord.gg/Ss6fRFj', target: '_blank'
| Remove Tumblr information from the home page until a more public-facing list has been curated | Remove Tumblr information from the home page until a more public-facing list has been curated
| Haml | mit | Marri/glowfic,Marri/glowfic,Marri/glowfic,Marri/glowfic | haml | ## Code Before:
Welcome to the Glowfic Constellation. Admire the tiny, tiny words.
%p
There is a (work in progress) community
= link_to 'guide to Glowfic.', 'https://docs.google.com/document/d/1_4Z2zdRKaSwZPm3S0X14DYoo7w46U_MZ4En6oOediNQ/edit'
%p
Join our community on:
%ul
%li= link_to "Alicorn's forum", 'http://alicorn.elcenia.com/board/index.php', target: '_blank'
%li= link_to "IRC", 'https://client00.chat.mibbit.com/?channel=%23glowfic&server=irc.psigenix.net', target: '_blank'
%li= link_to "Discord", 'https://discord.gg/Ss6fRFj', target: '_blank'
%li= link_to "Tumblr", 'http://alicorn.elcenia.com/board/viewtopic.php?f=10&t=615', target: '_blank'
## Instruction:
Remove Tumblr information from the home page until a more public-facing list has been curated
## Code After:
Welcome to the Glowfic Constellation. Admire the tiny, tiny words.
%p
There is a (work in progress) community
= link_to 'guide to Glowfic.', 'https://docs.google.com/document/d/1_4Z2zdRKaSwZPm3S0X14DYoo7w46U_MZ4En6oOediNQ/edit'
%p
Join our community on:
%ul
%li= link_to "Alicorn's forum", 'http://alicorn.elcenia.com/board/index.php', target: '_blank'
%li= link_to "IRC", 'https://client00.chat.mibbit.com/?channel=%23glowfic&server=irc.psigenix.net', target: '_blank'
%li= link_to "Discord", 'https://discord.gg/Ss6fRFj', target: '_blank'
| Welcome to the Glowfic Constellation. Admire the tiny, tiny words.
%p
There is a (work in progress) community
= link_to 'guide to Glowfic.', 'https://docs.google.com/document/d/1_4Z2zdRKaSwZPm3S0X14DYoo7w46U_MZ4En6oOediNQ/edit'
%p
Join our community on:
%ul
%li= link_to "Alicorn's forum", 'http://alicorn.elcenia.com/board/index.php', target: '_blank'
%li= link_to "IRC", 'https://client00.chat.mibbit.com/?channel=%23glowfic&server=irc.psigenix.net', target: '_blank'
%li= link_to "Discord", 'https://discord.gg/Ss6fRFj', target: '_blank'
- %li= link_to "Tumblr", 'http://alicorn.elcenia.com/board/viewtopic.php?f=10&t=615', target: '_blank' | 1 | 0.076923 | 0 | 1 |
e7f91050d80e93b93a6312afb2bb7c6d450b9796 | lib/cowsay.rb | lib/cowsay.rb | require 'cowsay/version'
require 'cowsay/character'
module ::Cowsay
module_function # all instance methods are available on the module (class) level
def random_character
random_class = Character.const_get(character_classes[rand(character_classes.length)])
random_class.new
end
def character_classes
@character_classes ||= Character.constants - [:Base, :Template]
end
def say(message)
random_character.say(message)
end
end
| require 'cowsay/version'
require 'cowsay/character'
module ::Cowsay
module_function # all instance methods are available on the module (class) level
def random_character
random_class = Character.const_get(character_classes[rand(character_classes.length)])
random_class.new
end
def character_classes
@character_classes ||= Character.constants.map { |c| c.to_sym } - [:Base, :Template]
end
def say(message)
random_character.say(message)
end
end
| Make character_classes compatible with Ruby 1.8. | Make character_classes compatible with Ruby 1.8.
| Ruby | mit | johnnyt/cowsay,gaissa/cowsay,kjhenner/cowsay | ruby | ## Code Before:
require 'cowsay/version'
require 'cowsay/character'
module ::Cowsay
module_function # all instance methods are available on the module (class) level
def random_character
random_class = Character.const_get(character_classes[rand(character_classes.length)])
random_class.new
end
def character_classes
@character_classes ||= Character.constants - [:Base, :Template]
end
def say(message)
random_character.say(message)
end
end
## Instruction:
Make character_classes compatible with Ruby 1.8.
## Code After:
require 'cowsay/version'
require 'cowsay/character'
module ::Cowsay
module_function # all instance methods are available on the module (class) level
def random_character
random_class = Character.const_get(character_classes[rand(character_classes.length)])
random_class.new
end
def character_classes
@character_classes ||= Character.constants.map { |c| c.to_sym } - [:Base, :Template]
end
def say(message)
random_character.say(message)
end
end
| require 'cowsay/version'
require 'cowsay/character'
module ::Cowsay
module_function # all instance methods are available on the module (class) level
def random_character
random_class = Character.const_get(character_classes[rand(character_classes.length)])
random_class.new
end
def character_classes
- @character_classes ||= Character.constants - [:Base, :Template]
+ @character_classes ||= Character.constants.map { |c| c.to_sym } - [:Base, :Template]
? +++++++++++++++++++++
end
def say(message)
random_character.say(message)
end
end | 2 | 0.105263 | 1 | 1 |
8b318204c488b18ed1e6f437b99da852b9e1f36a | _posts/2015-09-15-reset-wifi.md | _posts/2015-09-15-reset-wifi.md | ---
layout: post
title: Reset wifi, the tiny bash script
date: 2015-09-09
summary: Because I need to do it 12 times a day
categories: node-steam Steam Steam-guard javascript node
---
## The rationale
Because the HR wifi periodically stops giving me internet.
## The code
{% highlight bash %}
#!/bin/bash
# Reset network manager (for use when connection is poor)
nmcli n off
sleep 1
nmcli n on
{% endhighlight %}
| ---
layout: post
title: Reset wifi, the tiny bash script
date: 2015-09-09
summary: Because I need to do it 12 times a day
categories: node-steam Steam Steam-guard javascript node
---
## The rationale
Because the HR wifi periodically stops giving me internet.
## The code
{% highlight bash %}
#!/bin/bash
# Reset network manager (for use when connection is poor)
nmcli n off
sleep 1
nmcli n on
{% endhighlight %}
## Star it on github
[You know you want to](https://github.com/RandomSeeded/Reset-Wifi)
| Add github link to reset wifi post | Add github link to reset wifi post
| Markdown | mit | RandomSeeded/pixyll,RandomSeeded/pixyll | markdown | ## Code Before:
---
layout: post
title: Reset wifi, the tiny bash script
date: 2015-09-09
summary: Because I need to do it 12 times a day
categories: node-steam Steam Steam-guard javascript node
---
## The rationale
Because the HR wifi periodically stops giving me internet.
## The code
{% highlight bash %}
#!/bin/bash
# Reset network manager (for use when connection is poor)
nmcli n off
sleep 1
nmcli n on
{% endhighlight %}
## Instruction:
Add github link to reset wifi post
## Code After:
---
layout: post
title: Reset wifi, the tiny bash script
date: 2015-09-09
summary: Because I need to do it 12 times a day
categories: node-steam Steam Steam-guard javascript node
---
## The rationale
Because the HR wifi periodically stops giving me internet.
## The code
{% highlight bash %}
#!/bin/bash
# Reset network manager (for use when connection is poor)
nmcli n off
sleep 1
nmcli n on
{% endhighlight %}
## Star it on github
[You know you want to](https://github.com/RandomSeeded/Reset-Wifi)
| ---
layout: post
title: Reset wifi, the tiny bash script
date: 2015-09-09
summary: Because I need to do it 12 times a day
categories: node-steam Steam Steam-guard javascript node
---
## The rationale
Because the HR wifi periodically stops giving me internet.
## The code
{% highlight bash %}
#!/bin/bash
# Reset network manager (for use when connection is poor)
nmcli n off
sleep 1
nmcli n on
{% endhighlight %}
+ ## Star it on github
+ [You know you want to](https://github.com/RandomSeeded/Reset-Wifi)
+ | 3 | 0.130435 | 3 | 0 |
789df73613ab879281b0cc722985d649163a0e9e | docs/sparkcore-blink.md | docs/sparkcore-blink.md |
Schematics:
* sparkcore_blink.fzz
* sparkcore_led_temperature.fzz
Reference: <http://docs.spark.io/start/>
Plug your Spark Core into one USB port of your laptop. The Core should start blinking blue.
If not, press and hold the MODE button until it starts blinking blue.
If this does not happen, apply the "Factory Reset" procedure.
See <http://docs.spark.io/connect/##connecting-your-core-connect-over-usb>
On the controlling laptop, look at Device Manager to identify the COMxx listed as "Spark Core with Wifi and Arduino Compatibility" - in our case this is COM23
Start > PuTTY
Configure for COMxx:115200,8,n,1
Type "W" to configure WiFi
* SSID: xxx
* Security: xxx
* Password: xxx
The RGB led should eventually start breathing cyan, which means the Core is connected.
Launch the Spark App on your iPhone, then select your Core and try to
* D0: digitalOut (this is the green LED added on the breadboard)
* D7: digitalOut (this is the on-board blue LED)
* A0: analogRead (this is the LM37)
<!-- EOF -->
|
Schematics:
* sparkcore_blink.fzz
* sparkcore_led_temperature.fzz
Reference: <http://docs.spark.io/start/>
Plug your Spark Core into one USB port of your laptop. The Core should start blinking blue.
If not, press and hold the MODE button until it starts blinking blue.
If this does not happen, apply the "Factory Reset" procedure.
See <http://docs.spark.io/connect/##connecting-your-core-connect-over-usb>
On the controlling laptop, look at Device Manager to identify the COMxx listed as "Spark Core with Wifi and Arduino Compatibility" - in our case this is COM23
Start > PuTTY
Configure for COMxx:115200,8,n,1
Type "W" to configure WiFi
* SSID: xxx
* Security 0=unsecured, 1=WEP, 2=WPA, 3=WPA2: xxx
* Password: xxx
The RGB led should eventually start breathing cyan, which means the Core is connected.
Launch the Spark App on your iPhone, then select your Core and try to
* D0: digitalOut (this is the green LED added on the breadboard)
* D7: digitalOut (this is the on-board blue LED)
* A0: analogRead (this is the LM37)
<!-- EOF -->
| Complete message when requested about WiFi security mode | Complete message when requested about WiFi security mode
Signed-off-by: Gianpaolo Macario <f8885408b8c3d931b330bae3c3a28a3af912c463@gmail.com>
| Markdown | mpl-2.0 | gmacario/learning-arduino | markdown | ## Code Before:
Schematics:
* sparkcore_blink.fzz
* sparkcore_led_temperature.fzz
Reference: <http://docs.spark.io/start/>
Plug your Spark Core into one USB port of your laptop. The Core should start blinking blue.
If not, press and hold the MODE button until it starts blinking blue.
If this does not happen, apply the "Factory Reset" procedure.
See <http://docs.spark.io/connect/##connecting-your-core-connect-over-usb>
On the controlling laptop, look at Device Manager to identify the COMxx listed as "Spark Core with Wifi and Arduino Compatibility" - in our case this is COM23
Start > PuTTY
Configure for COMxx:115200,8,n,1
Type "W" to configure WiFi
* SSID: xxx
* Security: xxx
* Password: xxx
The RGB led should eventually start breathing cyan, which means the Core is connected.
Launch the Spark App on your iPhone, then select your Core and try to
* D0: digitalOut (this is the green LED added on the breadboard)
* D7: digitalOut (this is the on-board blue LED)
* A0: analogRead (this is the LM37)
<!-- EOF -->
## Instruction:
Complete message when requested about WiFi security mode
Signed-off-by: Gianpaolo Macario <f8885408b8c3d931b330bae3c3a28a3af912c463@gmail.com>
## Code After:
Schematics:
* sparkcore_blink.fzz
* sparkcore_led_temperature.fzz
Reference: <http://docs.spark.io/start/>
Plug your Spark Core into one USB port of your laptop. The Core should start blinking blue.
If not, press and hold the MODE button until it starts blinking blue.
If this does not happen, apply the "Factory Reset" procedure.
See <http://docs.spark.io/connect/##connecting-your-core-connect-over-usb>
On the controlling laptop, look at Device Manager to identify the COMxx listed as "Spark Core with Wifi and Arduino Compatibility" - in our case this is COM23
Start > PuTTY
Configure for COMxx:115200,8,n,1
Type "W" to configure WiFi
* SSID: xxx
* Security 0=unsecured, 1=WEP, 2=WPA, 3=WPA2: xxx
* Password: xxx
The RGB led should eventually start breathing cyan, which means the Core is connected.
Launch the Spark App on your iPhone, then select your Core and try to
* D0: digitalOut (this is the green LED added on the breadboard)
* D7: digitalOut (this is the on-board blue LED)
* A0: analogRead (this is the LM37)
<!-- EOF -->
|
Schematics:
* sparkcore_blink.fzz
* sparkcore_led_temperature.fzz
Reference: <http://docs.spark.io/start/>
Plug your Spark Core into one USB port of your laptop. The Core should start blinking blue.
If not, press and hold the MODE button until it starts blinking blue.
If this does not happen, apply the "Factory Reset" procedure.
See <http://docs.spark.io/connect/##connecting-your-core-connect-over-usb>
On the controlling laptop, look at Device Manager to identify the COMxx listed as "Spark Core with Wifi and Arduino Compatibility" - in our case this is COM23
Start > PuTTY
Configure for COMxx:115200,8,n,1
Type "W" to configure WiFi
* SSID: xxx
- * Security: xxx
+ * Security 0=unsecured, 1=WEP, 2=WPA, 3=WPA2: xxx
* Password: xxx
The RGB led should eventually start breathing cyan, which means the Core is connected.
Launch the Spark App on your iPhone, then select your Core and try to
* D0: digitalOut (this is the green LED added on the breadboard)
* D7: digitalOut (this is the on-board blue LED)
* A0: analogRead (this is the LM37)
<!-- EOF --> | 2 | 0.057143 | 1 | 1 |
d075cfdab7de33ec0d6cb89745bad1225dfc92aa | production/roles/celos/tasks/main.yaml | production/roles/celos/tasks/main.yaml | ---
- name: Install cron entry
lineinfile: dest=/etc/crontab state=present
line="* * * * * {{celos_user}} curl -X POST localhost:8080/celos/scheduler"
regexp="celos/scheduler"
sudo: yes
tags: cron
- name: Prepare configuration dir
shell: sudo mkdir -p {{celos_workflows_dir}} && sudo chown {{celos_user}} {{celos_workflows_dir}}
- name: Prepare database dir
shell: sudo mkdir -p {{celos_db_dir}} && sudo chown {{celos_user}} {{celos_db_dir}}
- name: Prepare log dir
shell: sudo mkdir -p {{celos_log_dir}} && sudo chown {{celos_user}} {{celos_log_dir}}
| ---
- name: Install cron entry for scheduler
lineinfile: dest=/etc/crontab state=present
line="* * * * * {{celos_user}} curl -X POST localhost:8080/celos/scheduler"
regexp="celos/scheduler"
sudo: yes
tags: cron
- name: Install cron entry to refresh Kerberos ticket every hour
lineinfile: dest=/etc/crontab state=present
line="0 * * * * {{celos_user}} kinit -k -t /home/celos/celos.keytab celos@COLLECTIVE-MEDIA.NET"
regexp="celos@COLLECTIVE-MEDIA.NET"
sudo: yes
tags: cron
- name: Prepare configuration dir
shell: sudo mkdir -p {{celos_workflows_dir}} && sudo chown {{celos_user}} {{celos_workflows_dir}}
- name: Prepare database dir
shell: sudo mkdir -p {{celos_db_dir}} && sudo chown {{celos_user}} {{celos_db_dir}}
- name: Prepare log dir
shell: sudo mkdir -p {{celos_log_dir}} && sudo chown {{celos_user}} {{celos_log_dir}}
| Install cron entry to refresh Kerberos ticket every hour. | Install cron entry to refresh Kerberos ticket every hour.
| YAML | apache-2.0 | collectivemedia/celos,collectivemedia/celos,collectivemedia/celos | yaml | ## Code Before:
---
- name: Install cron entry
lineinfile: dest=/etc/crontab state=present
line="* * * * * {{celos_user}} curl -X POST localhost:8080/celos/scheduler"
regexp="celos/scheduler"
sudo: yes
tags: cron
- name: Prepare configuration dir
shell: sudo mkdir -p {{celos_workflows_dir}} && sudo chown {{celos_user}} {{celos_workflows_dir}}
- name: Prepare database dir
shell: sudo mkdir -p {{celos_db_dir}} && sudo chown {{celos_user}} {{celos_db_dir}}
- name: Prepare log dir
shell: sudo mkdir -p {{celos_log_dir}} && sudo chown {{celos_user}} {{celos_log_dir}}
## Instruction:
Install cron entry to refresh Kerberos ticket every hour.
## Code After:
---
- name: Install cron entry for scheduler
lineinfile: dest=/etc/crontab state=present
line="* * * * * {{celos_user}} curl -X POST localhost:8080/celos/scheduler"
regexp="celos/scheduler"
sudo: yes
tags: cron
- name: Install cron entry to refresh Kerberos ticket every hour
lineinfile: dest=/etc/crontab state=present
line="0 * * * * {{celos_user}} kinit -k -t /home/celos/celos.keytab celos@COLLECTIVE-MEDIA.NET"
regexp="celos@COLLECTIVE-MEDIA.NET"
sudo: yes
tags: cron
- name: Prepare configuration dir
shell: sudo mkdir -p {{celos_workflows_dir}} && sudo chown {{celos_user}} {{celos_workflows_dir}}
- name: Prepare database dir
shell: sudo mkdir -p {{celos_db_dir}} && sudo chown {{celos_user}} {{celos_db_dir}}
- name: Prepare log dir
shell: sudo mkdir -p {{celos_log_dir}} && sudo chown {{celos_user}} {{celos_log_dir}}
| ---
- - name: Install cron entry
+ - name: Install cron entry for scheduler
? ++++++++++++++
lineinfile: dest=/etc/crontab state=present
line="* * * * * {{celos_user}} curl -X POST localhost:8080/celos/scheduler"
regexp="celos/scheduler"
+ sudo: yes
+ tags: cron
+
+ - name: Install cron entry to refresh Kerberos ticket every hour
+ lineinfile: dest=/etc/crontab state=present
+ line="0 * * * * {{celos_user}} kinit -k -t /home/celos/celos.keytab celos@COLLECTIVE-MEDIA.NET"
+ regexp="celos@COLLECTIVE-MEDIA.NET"
sudo: yes
tags: cron
- name: Prepare configuration dir
shell: sudo mkdir -p {{celos_workflows_dir}} && sudo chown {{celos_user}} {{celos_workflows_dir}}
- name: Prepare database dir
shell: sudo mkdir -p {{celos_db_dir}} && sudo chown {{celos_user}} {{celos_db_dir}}
- name: Prepare log dir
shell: sudo mkdir -p {{celos_log_dir}} && sudo chown {{celos_user}} {{celos_log_dir}} | 9 | 0.529412 | 8 | 1 |
34a6a1ad69faf1a581cdba64cf7fd36f7f55f49e | pkg/cmd/list_test.go | pkg/cmd/list_test.go | package cmd
import (
"bytes"
// "io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
}
func TestListWrongNumberArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{"invalid_arg"}, buf)
if err == nil {
t.Error("Expected error result with no arguments")
}
expected := "Wrong number of arguments."
if err.Error() != expected {
t.Errorf("Expected: %s Actual: %s", expected, err.Error())
}
}
| package cmd
import (
"bytes"
"io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
// Setup
originalBasePath := basePath
dir, _ := ioutil.TempDir("", "test")
basePath = dir
// Test
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
// Teardown
basePath = originalBasePath
}
func TestListWrongNumberArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{"invalid_arg"}, buf)
if err == nil {
t.Error("Expected error result with no arguments")
}
expected := "Wrong number of arguments."
if err.Error() != expected {
t.Errorf("Expected: %s Actual: %s", expected, err.Error())
}
}
| Add temporary basePath for tests. | Add temporary basePath for tests.
| Go | apache-2.0 | ClusterHQ/dvol,ClusterHQ/dvol,ClusterHQ/dvol | go | ## Code Before:
package cmd
import (
"bytes"
// "io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
}
func TestListWrongNumberArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{"invalid_arg"}, buf)
if err == nil {
t.Error("Expected error result with no arguments")
}
expected := "Wrong number of arguments."
if err.Error() != expected {
t.Errorf("Expected: %s Actual: %s", expected, err.Error())
}
}
## Instruction:
Add temporary basePath for tests.
## Code After:
package cmd
import (
"bytes"
"io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
// Setup
originalBasePath := basePath
dir, _ := ioutil.TempDir("", "test")
basePath = dir
// Test
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
// Teardown
basePath = originalBasePath
}
func TestListWrongNumberArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{"invalid_arg"}, buf)
if err == nil {
t.Error("Expected error result with no arguments")
}
expected := "Wrong number of arguments."
if err.Error() != expected {
t.Errorf("Expected: %s Actual: %s", expected, err.Error())
}
}
| package cmd
import (
"bytes"
- // "io/ioutil"
? ---
+ "io/ioutil"
"testing"
)
func TestListNoArgs(t *testing.T) {
+ // Setup
+ originalBasePath := basePath
+ dir, _ := ioutil.TempDir("", "test")
+ basePath = dir
+
+ // Test
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{}, buf)
if err != nil {
t.Error("Unexpected error result with no arguments")
}
+
+ // Teardown
+ basePath = originalBasePath
}
func TestListWrongNumberArgs(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdList(buf)
err := listVolumes(cmd, []string{"invalid_arg"}, buf)
if err == nil {
t.Error("Expected error result with no arguments")
}
expected := "Wrong number of arguments."
if err.Error() != expected {
t.Errorf("Expected: %s Actual: %s", expected, err.Error())
}
} | 11 | 0.37931 | 10 | 1 |
7c6fb3a8b81fdd3c04cf8ccda8ea19c61b51c12b | .travis.yml | .travis.yml | language: go
sudo: false
go:
- 1.1.2
- 1.2.2
- 1.3.3
- 1.4.2
- 1.5.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify/assert
script:
- go test -v .
- make test-cover-builder
- $HOME/gopath/bin/goveralls -coverprofile=/tmp/art_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
| language: go
sudo: false
go:
- 1.2.2
- 1.3.3
- 1.4.2
- 1.5.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify/assert
script:
- make
- make test-cover-builder
- $HOME/gopath/bin/goveralls -coverprofile=/tmp/art_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
| Remove support of go1.1.x (no cover feature) | Remove support of go1.1.x (no cover feature)
| YAML | mit | plar/go-adaptive-radix-tree | yaml | ## Code Before:
language: go
sudo: false
go:
- 1.1.2
- 1.2.2
- 1.3.3
- 1.4.2
- 1.5.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify/assert
script:
- go test -v .
- make test-cover-builder
- $HOME/gopath/bin/goveralls -coverprofile=/tmp/art_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
## Instruction:
Remove support of go1.1.x (no cover feature)
## Code After:
language: go
sudo: false
go:
- 1.2.2
- 1.3.3
- 1.4.2
- 1.5.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify/assert
script:
- make
- make test-cover-builder
- $HOME/gopath/bin/goveralls -coverprofile=/tmp/art_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
| language: go
sudo: false
go:
- - 1.1.2
- 1.2.2
- 1.3.3
- 1.4.2
- 1.5.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify/assert
script:
- - go test -v .
+ - make
- make test-cover-builder
- $HOME/gopath/bin/goveralls -coverprofile=/tmp/art_coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN | 3 | 0.125 | 1 | 2 |
b4cb026951f88aa8cf45f8ac4916625de492df7e | README.md | README.md | GIT
====
[](https://travis-ci.org/adrianclay/php-git)
Usage
-----
First register your repository path against a hostname.
```php
StreamWrapper::registerRepository( $pathToRepository, $hostname );
```
That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.
```php
$filePath = "git://branch@hostname/path/under/version/control";
```
Example extracting all files within the src folder pointed to by the master branch:
```php
use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://master@adrianclay.php-git/src' ) );
array(9) {
[0] =>
string(10) "Commit.php"
[1] =>
string(8) "Head.php"
[2] =>
string(10) "Object.php"
[3] =>
string(14) "Repository.php"
[4] =>
string(7) "SHA.php"
[5] =>
string(16) "SHAReference.php"
[6] =>
string(17) "StreamWrapper.php"
[7] =>
string(4) "Tree"
[8] =>
string(8) "Tree.php"
}
``` | GIT
====
[](https://github.com/adrianclay/php-git/actions/workflows/php.yml)
Usage
-----
First register your repository path against a hostname.
```php
StreamWrapper::registerRepository( $pathToRepository, $hostname );
```
That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.
```php
$filePath = "git://branch@hostname/path/under/version/control";
```
Example extracting all files within the src folder pointed to by the master branch:
```php
use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://master@adrianclay.php-git/src' ) );
array(9) {
[0] =>
string(10) "Commit.php"
[1] =>
string(8) "Head.php"
[2] =>
string(10) "Object.php"
[3] =>
string(14) "Repository.php"
[4] =>
string(7) "SHA.php"
[5] =>
string(16) "SHAReference.php"
[6] =>
string(17) "StreamWrapper.php"
[7] =>
string(4) "Tree"
[8] =>
string(8) "Tree.php"
}
``` | Replace TravisCI build badge with GitHub Actions | Replace TravisCI build badge with GitHub Actions
| Markdown | mit | adrianclay/php-git | markdown | ## Code Before:
GIT
====
[](https://travis-ci.org/adrianclay/php-git)
Usage
-----
First register your repository path against a hostname.
```php
StreamWrapper::registerRepository( $pathToRepository, $hostname );
```
That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.
```php
$filePath = "git://branch@hostname/path/under/version/control";
```
Example extracting all files within the src folder pointed to by the master branch:
```php
use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://master@adrianclay.php-git/src' ) );
array(9) {
[0] =>
string(10) "Commit.php"
[1] =>
string(8) "Head.php"
[2] =>
string(10) "Object.php"
[3] =>
string(14) "Repository.php"
[4] =>
string(7) "SHA.php"
[5] =>
string(16) "SHAReference.php"
[6] =>
string(17) "StreamWrapper.php"
[7] =>
string(4) "Tree"
[8] =>
string(8) "Tree.php"
}
```
## Instruction:
Replace TravisCI build badge with GitHub Actions
## Code After:
GIT
====
[](https://github.com/adrianclay/php-git/actions/workflows/php.yml)
Usage
-----
First register your repository path against a hostname.
```php
StreamWrapper::registerRepository( $pathToRepository, $hostname );
```
That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.
```php
$filePath = "git://branch@hostname/path/under/version/control";
```
Example extracting all files within the src folder pointed to by the master branch:
```php
use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://master@adrianclay.php-git/src' ) );
array(9) {
[0] =>
string(10) "Commit.php"
[1] =>
string(8) "Head.php"
[2] =>
string(10) "Object.php"
[3] =>
string(14) "Repository.php"
[4] =>
string(7) "SHA.php"
[5] =>
string(16) "SHAReference.php"
[6] =>
string(17) "StreamWrapper.php"
[7] =>
string(4) "Tree"
[8] =>
string(8) "Tree.php"
}
``` | GIT
====
- [](https://travis-ci.org/adrianclay/php-git)
+ [](https://github.com/adrianclay/php-git/actions/workflows/php.yml)
Usage
-----
First register your repository path against a hostname.
```php
StreamWrapper::registerRepository( $pathToRepository, $hostname );
```
That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.
```php
$filePath = "git://branch@hostname/path/under/version/control";
```
Example extracting all files within the src folder pointed to by the master branch:
```php
use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://master@adrianclay.php-git/src' ) );
array(9) {
[0] =>
string(10) "Commit.php"
[1] =>
string(8) "Head.php"
[2] =>
string(10) "Object.php"
[3] =>
string(14) "Repository.php"
[4] =>
string(7) "SHA.php"
[5] =>
string(16) "SHAReference.php"
[6] =>
string(17) "StreamWrapper.php"
[7] =>
string(4) "Tree"
[8] =>
string(8) "Tree.php"
}
``` | 2 | 0.040816 | 1 | 1 |
5e827764a42453535efc51186e1554a2749d8139 | bower.json | bower.json | {
"name": "juicy-html",
"description": "Custom Element that lets you load HTML partials into your Web Components",
"version": "1.0.0-pre.1",
"homepage": "https://github.com/Juicy/juicy-html",
"authors": [
"Joachim Wester <joachimwester@me.com>",
"Marcin Warpechowski <marcin@nextgen.pl>",
"Tomek Wytrebowicz <tomalecpub@gmail.com>"
],
"main": "juicy-html.html",
"license": "https://github.com/Juicy/juicy-html/blob/master/LICENSE",
"keywords": [
"partials",
"html",
"include",
"web-components"
],
"ignore": [
"examples"
],
"dependencies": {
},
"devDependencies": {
"polymer": "Polymer/polymer#~1.1.0",
"paper-menu": "PolymerElements/paper-menu",
"paper-menu-button": "PolymerElements/paper-menu-button"
}
}
| {
"name": "juicy-html",
"description": "Custom Element that lets you load HTML partials into your Web Components",
"version": "1.0.0-pre.1",
"homepage": "https://github.com/Juicy/juicy-html",
"authors": [
"Joachim Wester <joachimwester@me.com>",
"Marcin Warpechowski <marcin@nextgen.pl>",
"Tomek Wytrebowicz <tomalecpub@gmail.com>"
],
"main": "juicy-html.html",
"license": "https://github.com/Juicy/juicy-html/blob/master/LICENSE",
"keywords": [
"partials",
"html",
"include",
"web-components"
],
"ignore": [
"examples"
],
"dependencies": {
},
"devDependencies": {
"polymer": "Polymer/polymer#~1.1.0"
}
}
| Remove not used paper elements from devDependencies | Remove not used paper elements from devDependencies
| JSON | mit | Juicy/juicy-html,Juicy/juicy-html | json | ## Code Before:
{
"name": "juicy-html",
"description": "Custom Element that lets you load HTML partials into your Web Components",
"version": "1.0.0-pre.1",
"homepage": "https://github.com/Juicy/juicy-html",
"authors": [
"Joachim Wester <joachimwester@me.com>",
"Marcin Warpechowski <marcin@nextgen.pl>",
"Tomek Wytrebowicz <tomalecpub@gmail.com>"
],
"main": "juicy-html.html",
"license": "https://github.com/Juicy/juicy-html/blob/master/LICENSE",
"keywords": [
"partials",
"html",
"include",
"web-components"
],
"ignore": [
"examples"
],
"dependencies": {
},
"devDependencies": {
"polymer": "Polymer/polymer#~1.1.0",
"paper-menu": "PolymerElements/paper-menu",
"paper-menu-button": "PolymerElements/paper-menu-button"
}
}
## Instruction:
Remove not used paper elements from devDependencies
## Code After:
{
"name": "juicy-html",
"description": "Custom Element that lets you load HTML partials into your Web Components",
"version": "1.0.0-pre.1",
"homepage": "https://github.com/Juicy/juicy-html",
"authors": [
"Joachim Wester <joachimwester@me.com>",
"Marcin Warpechowski <marcin@nextgen.pl>",
"Tomek Wytrebowicz <tomalecpub@gmail.com>"
],
"main": "juicy-html.html",
"license": "https://github.com/Juicy/juicy-html/blob/master/LICENSE",
"keywords": [
"partials",
"html",
"include",
"web-components"
],
"ignore": [
"examples"
],
"dependencies": {
},
"devDependencies": {
"polymer": "Polymer/polymer#~1.1.0"
}
}
| {
"name": "juicy-html",
"description": "Custom Element that lets you load HTML partials into your Web Components",
"version": "1.0.0-pre.1",
"homepage": "https://github.com/Juicy/juicy-html",
"authors": [
"Joachim Wester <joachimwester@me.com>",
"Marcin Warpechowski <marcin@nextgen.pl>",
"Tomek Wytrebowicz <tomalecpub@gmail.com>"
],
"main": "juicy-html.html",
"license": "https://github.com/Juicy/juicy-html/blob/master/LICENSE",
"keywords": [
"partials",
"html",
"include",
"web-components"
],
"ignore": [
"examples"
],
"dependencies": {
},
"devDependencies": {
- "polymer": "Polymer/polymer#~1.1.0",
? -
+ "polymer": "Polymer/polymer#~1.1.0"
- "paper-menu": "PolymerElements/paper-menu",
- "paper-menu-button": "PolymerElements/paper-menu-button"
}
} | 4 | 0.137931 | 1 | 3 |
5e7e8339cb755972d7006db34d29ae4360e98e1a | .travis.yml | .travis.yml | language: ruby
rvm:
- 2.0.0
install:
- sudo apt-get -qq install libcairo2-dev libpango1.0-0
| language: ruby
rvm:
- 2.0.0
before_install:
- sudo apt-get -qq install libcairo2-dev libpango1.0-dev
| Switch to `before_install` and `libpango1.0-dev` | Switch to `before_install` and `libpango1.0-dev`
| YAML | mit | tmbeihl/mathematical,tmbeihl/mathematical,gjtorikian/mathematical,tmbeihl/mathematical,gjtorikian/mathematical,gjtorikian/mathematical | yaml | ## Code Before:
language: ruby
rvm:
- 2.0.0
install:
- sudo apt-get -qq install libcairo2-dev libpango1.0-0
## Instruction:
Switch to `before_install` and `libpango1.0-dev`
## Code After:
language: ruby
rvm:
- 2.0.0
before_install:
- sudo apt-get -qq install libcairo2-dev libpango1.0-dev
| language: ruby
rvm:
- 2.0.0
- install:
+ before_install:
- - sudo apt-get -qq install libcairo2-dev libpango1.0-0
? ^
+ - sudo apt-get -qq install libcairo2-dev libpango1.0-dev
? ^^^
| 4 | 0.666667 | 2 | 2 |
b3dff09961f71a5e7902336fed09963d1a91d086 | README.md | README.md | <center>
<img src="files/static/app-icon.png" width=144>
</center>
# `hstspreload.appspot.com`
[](https://travis-ci.org/chromium/hstspreload.appspot.com)
This folder contains the source for `v2` of [hstspreload.appspot.com](https://hstspreload.appspot.com/).
See the [`app-engine` branch](https://github.com/chromium/hstspreload.appspot.com/tree/app-engine) for the `v1` code currently running on https://hstspreload.appspot.com/
## Disclaimer
This project is used by the Chromium team to maintain the HSTS preload list. This is not an official Google product. | <center>
<img src="files/static/app-icon.png" width=144>
</center>
# `hstspreload.appspot.com`
[](https://travis-ci.org/chromium/hstspreload.appspot.com)
This folder contains the source for `v2` of [hstspreload.appspot.com](https://hstspreload.appspot.com/).
See the [`app-engine` branch](https://github.com/chromium/hstspreload.appspot.com/tree/app-engine) for the `v1` code currently running on https://hstspreload.appspot.com/
## Disclaimer
This project is used by the Chromium team to maintain the HSTS preload list. This is not an official Google product.
| Fix build status image branch. | Fix build status image branch.
| Markdown | bsd-3-clause | chromium/hstspreload.org,chromium/hstspreload.org,chromium/hstspreload.org,chromium/hstspreload.org | markdown | ## Code Before:
<center>
<img src="files/static/app-icon.png" width=144>
</center>
# `hstspreload.appspot.com`
[](https://travis-ci.org/chromium/hstspreload.appspot.com)
This folder contains the source for `v2` of [hstspreload.appspot.com](https://hstspreload.appspot.com/).
See the [`app-engine` branch](https://github.com/chromium/hstspreload.appspot.com/tree/app-engine) for the `v1` code currently running on https://hstspreload.appspot.com/
## Disclaimer
This project is used by the Chromium team to maintain the HSTS preload list. This is not an official Google product.
## Instruction:
Fix build status image branch.
## Code After:
<center>
<img src="files/static/app-icon.png" width=144>
</center>
# `hstspreload.appspot.com`
[](https://travis-ci.org/chromium/hstspreload.appspot.com)
This folder contains the source for `v2` of [hstspreload.appspot.com](https://hstspreload.appspot.com/).
See the [`app-engine` branch](https://github.com/chromium/hstspreload.appspot.com/tree/app-engine) for the `v1` code currently running on https://hstspreload.appspot.com/
## Disclaimer
This project is used by the Chromium team to maintain the HSTS preload list. This is not an official Google product.
| <center>
<img src="files/static/app-icon.png" width=144>
</center>
# `hstspreload.appspot.com`
- [](https://travis-ci.org/chromium/hstspreload.appspot.com)
? ^^^ ^ ---------
+ [](https://travis-ci.org/chromium/hstspreload.appspot.com)
? ^ ^
This folder contains the source for `v2` of [hstspreload.appspot.com](https://hstspreload.appspot.com/).
See the [`app-engine` branch](https://github.com/chromium/hstspreload.appspot.com/tree/app-engine) for the `v1` code currently running on https://hstspreload.appspot.com/
## Disclaimer
This project is used by the Chromium team to maintain the HSTS preload list. This is not an official Google product. | 2 | 0.133333 | 1 | 1 |
2abb29960dd07af580a4da5a0652a34cab1a5e34 | server/api/account/dal.js | server/api/account/dal.js |
var config = require('tresdb-config');
var db = require('tresdb-db');
var bcrypt = require('bcryptjs');
exports.createUser = function (username, email, password, callback) {
// Create non-admin active user. Does not check if user exists.
//
// Parameters:
// username
// string
// email
// string
// password
// string
// callback
// function (err)
var users = db.collection('users');
var r = config.bcrypt.rounds;
bcrypt.hash(password, r, function (berr, pwdHash) {
if (berr) {
return callback(berr);
}
users.insert({
name: username,
email: email,
hash: pwdHash,
admin: false,
status: 'active', // 'deactivated'
}, function (qerr) {
if (qerr) {
return callback(qerr);
}
// User inserted successfully
return callback();
});
});
};
|
var config = require('tresdb-config');
var db = require('tresdb-db');
var bcrypt = require('bcryptjs');
exports.createUser = function (username, email, password, callback) {
// Create non-admin active user. Does not check if user exists.
//
// Parameters:
// username
// string
// email
// string
// password
// string
// callback
// function (err)
var users = db.collection('users');
var r = config.bcrypt.rounds;
bcrypt.hash(password, r, function (berr, pwdHash) {
if (berr) {
return callback(berr);
}
users.insert({
name: username,
email: email,
hash: pwdHash,
admin: false,
status: 'active', // options. 'active' | 'deactivated',
createdAt: (new Date()).toISOString(),
loginAt: (new Date()).toISOString(),
}, function (qerr) {
if (qerr) {
return callback(qerr);
}
// User inserted successfully
return callback();
});
});
};
| Create new users with createdAt and loginAt props | Create new users with createdAt and loginAt props
| JavaScript | mit | axelpale/tresdb,axelpale/tresdb | javascript | ## Code Before:
var config = require('tresdb-config');
var db = require('tresdb-db');
var bcrypt = require('bcryptjs');
exports.createUser = function (username, email, password, callback) {
// Create non-admin active user. Does not check if user exists.
//
// Parameters:
// username
// string
// email
// string
// password
// string
// callback
// function (err)
var users = db.collection('users');
var r = config.bcrypt.rounds;
bcrypt.hash(password, r, function (berr, pwdHash) {
if (berr) {
return callback(berr);
}
users.insert({
name: username,
email: email,
hash: pwdHash,
admin: false,
status: 'active', // 'deactivated'
}, function (qerr) {
if (qerr) {
return callback(qerr);
}
// User inserted successfully
return callback();
});
});
};
## Instruction:
Create new users with createdAt and loginAt props
## Code After:
var config = require('tresdb-config');
var db = require('tresdb-db');
var bcrypt = require('bcryptjs');
exports.createUser = function (username, email, password, callback) {
// Create non-admin active user. Does not check if user exists.
//
// Parameters:
// username
// string
// email
// string
// password
// string
// callback
// function (err)
var users = db.collection('users');
var r = config.bcrypt.rounds;
bcrypt.hash(password, r, function (berr, pwdHash) {
if (berr) {
return callback(berr);
}
users.insert({
name: username,
email: email,
hash: pwdHash,
admin: false,
status: 'active', // options. 'active' | 'deactivated',
createdAt: (new Date()).toISOString(),
loginAt: (new Date()).toISOString(),
}, function (qerr) {
if (qerr) {
return callback(qerr);
}
// User inserted successfully
return callback();
});
});
};
|
var config = require('tresdb-config');
var db = require('tresdb-db');
var bcrypt = require('bcryptjs');
exports.createUser = function (username, email, password, callback) {
// Create non-admin active user. Does not check if user exists.
//
// Parameters:
// username
// string
// email
// string
// password
// string
// callback
// function (err)
var users = db.collection('users');
var r = config.bcrypt.rounds;
bcrypt.hash(password, r, function (berr, pwdHash) {
-
if (berr) {
return callback(berr);
}
users.insert({
name: username,
email: email,
hash: pwdHash,
admin: false,
- status: 'active', // 'deactivated'
+ status: 'active', // options. 'active' | 'deactivated',
? ++++++++++++++++++++ +
+ createdAt: (new Date()).toISOString(),
+ loginAt: (new Date()).toISOString(),
}, function (qerr) {
-
if (qerr) {
return callback(qerr);
}
-
// User inserted successfully
return callback();
});
});
}; | 7 | 0.155556 | 3 | 4 |
e077872cfadc49704abf9f48b21627ae97442b7c | composer.json | composer.json | {
"name": "thefold/wordpress-dispatcher",
"description": "Create URL endpoints within WordPress",
"license": "MIT",
"authors": [
{
"name": "Tim Field",
"email": "tim@thefold.co.nz"
}
],
"require": {
"php": ">=5.4"
},
"autoload": {
"psr-4": {
"TheFold\\WordPress\\":"/"
}
}
}
| {
"name": "thefold/wordpress-dispatcher",
"description": "Create URL endpoints within WordPress",
"type": "wordpress-plugin",
"license": "MIT",
"authors": [
{
"name": "Tim Field",
"email": "tim@thefold.co.nz"
}
],
"require": {
"php": ">=5.4"
},
"autoload": {
"psr-4": {
"TheFold\\WordPress\\":"/"
}
}
}
| Define type, so compose installs in plugin dir | Define type, so compose installs in plugin dir
| JSON | mit | tim-field/wordpress-dispatcher,timbofield/wordpress-dispatcher | json | ## Code Before:
{
"name": "thefold/wordpress-dispatcher",
"description": "Create URL endpoints within WordPress",
"license": "MIT",
"authors": [
{
"name": "Tim Field",
"email": "tim@thefold.co.nz"
}
],
"require": {
"php": ">=5.4"
},
"autoload": {
"psr-4": {
"TheFold\\WordPress\\":"/"
}
}
}
## Instruction:
Define type, so compose installs in plugin dir
## Code After:
{
"name": "thefold/wordpress-dispatcher",
"description": "Create URL endpoints within WordPress",
"type": "wordpress-plugin",
"license": "MIT",
"authors": [
{
"name": "Tim Field",
"email": "tim@thefold.co.nz"
}
],
"require": {
"php": ">=5.4"
},
"autoload": {
"psr-4": {
"TheFold\\WordPress\\":"/"
}
}
}
| {
"name": "thefold/wordpress-dispatcher",
"description": "Create URL endpoints within WordPress",
+ "type": "wordpress-plugin",
"license": "MIT",
"authors": [
{
"name": "Tim Field",
"email": "tim@thefold.co.nz"
}
],
"require": {
"php": ">=5.4"
},
"autoload": {
"psr-4": {
"TheFold\\WordPress\\":"/"
}
}
} | 1 | 0.052632 | 1 | 0 |
55bdbdb19069301bfa2a30e19d39f9329a772e84 | src/js/disability-benefits/components/ClaimsDecision.jsx | src/js/disability-benefits/components/ClaimsDecision.jsx | import React from 'react';
class ClaimsDecision extends React.Component {
render() {
return (
<div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon">
<h4>Your claim decision is ready</h4>
<p>VA sent you a claim decision by U.S mail. Please allow up to 8 business days for it to arrive.</p>
<p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p>
<p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p>
</div>
);
}
}
export default ClaimsDecision;
| import React from 'react';
class ClaimsDecision extends React.Component {
render() {
return (
<div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon">
<h4>Your claim decision is ready</h4>
<p>We sent you a packet by U.S. mail that includes details of the decision or award. Please allow 7 business days for your packet to arrive before contacting a VA call center.</p>
<p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p>
<p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p>
</div>
);
}
}
export default ClaimsDecision;
| Update content for your claim decision is ready alert | Update content for your claim decision is ready alert
| JSX | cc0-1.0 | department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website | jsx | ## Code Before:
import React from 'react';
class ClaimsDecision extends React.Component {
render() {
return (
<div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon">
<h4>Your claim decision is ready</h4>
<p>VA sent you a claim decision by U.S mail. Please allow up to 8 business days for it to arrive.</p>
<p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p>
<p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p>
</div>
);
}
}
export default ClaimsDecision;
## Instruction:
Update content for your claim decision is ready alert
## Code After:
import React from 'react';
class ClaimsDecision extends React.Component {
render() {
return (
<div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon">
<h4>Your claim decision is ready</h4>
<p>We sent you a packet by U.S. mail that includes details of the decision or award. Please allow 7 business days for your packet to arrive before contacting a VA call center.</p>
<p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p>
<p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p>
</div>
);
}
}
export default ClaimsDecision;
| import React from 'react';
class ClaimsDecision extends React.Component {
render() {
return (
<div className="claim-decision-is-ready usa-alert usa-alert-info claims-no-icon">
<h4>Your claim decision is ready</h4>
- <p>VA sent you a claim decision by U.S mail. Please allow up to 8 business days for it to arrive.</p>
+ <p>We sent you a packet by U.S. mail that includes details of the decision or award. Please allow 7 business days for your packet to arrive before contacting a VA call center.</p>
<p>Do you disagree with your claim decision? <a href="/disability-benefits/claims-appeal">File an appeal</a></p>
<p>If you have new evidence to support your claim and have no yet appealed, you can ask VA to <a href="/disability-benefits/claims-process/claim-types/reopened-claim">Reopen your claim</a></p>
</div>
);
}
}
export default ClaimsDecision; | 2 | 0.125 | 1 | 1 |
e913d8f4ff560136c78e9a1c36df791055fa6b4d | app/scripts/directives/errorDetail.js | app/scripts/directives/errorDetail.js | 'use strict';
/**
* @ngdoc directive
* @name hmdaPilotApp.directive:ErrorDetail
* @description
* # Error Summary directive
* Directive for displaying the details of a single edit error
*/
module.exports = /*@ngInject*/ function () {
return {
restrict: 'E',
templateUrl: 'partials/errorDetail.html',
scope: {
error: '='
},
link: function(scope) {
scope.pageSize = scope.pageSize || 10;
scope.currentPage = scope.currentPage || 1;
if (angular.equals({}, scope.error)) {
scope.error = null;
}
scope.start = function() {
return (scope.currentPage-1) * scope.pageSize + 1;
};
scope.end = function() {
var end = scope.currentPage * scope.pageSize;
return end > scope.total() ? scope.total() : end;
};
scope.total = function() {
return scope.error.errors.length;
};
scope.totalPages = function() {
return parseInt(scope.total() / scope.pageSize) || 1;
};
scope.hasPrev = function() {
return scope.currentPage > 1;
};
scope.onPrev = function() {
scope.currentPage--;
};
scope.hasNext = function() {
return scope.currentPage < scope.totalPages();
};
scope.onNext = function() {
scope.currentPage++;
};
scope.setCurrentPage = function(page) {
scope.currentPage = page;
};
}
};
};
| 'use strict';
/**
* @ngdoc directive
* @name hmdaPilotApp.directive:ErrorDetail
* @description
* # Error Summary directive
* Directive for displaying the details of a single edit error
*/
module.exports = /*@ngInject*/ function () {
return {
restrict: 'E',
templateUrl: 'partials/errorDetail.html',
scope: {
error: '='
},
link: function(scope) {
scope.pageSize = scope.pageSize || 10;
scope.currentPage = scope.currentPage || 1;
if (angular.equals({}, scope.error)) {
scope.error = null;
}
scope.start = function() {
return (scope.currentPage-1) * scope.pageSize + 1;
};
scope.end = function() {
var end = scope.currentPage * scope.pageSize;
return end > scope.total() ? scope.total() : end;
};
scope.total = function() {
return scope.error.errors.length;
};
scope.totalPages = function() {
return Math.ceil(scope.total() / scope.pageSize);
};
scope.hasPrev = function() {
return scope.currentPage > 1;
};
scope.onPrev = function() {
scope.currentPage--;
};
scope.hasNext = function() {
return scope.currentPage < scope.totalPages();
};
scope.onNext = function() {
scope.currentPage++;
};
scope.setCurrentPage = function(page) {
scope.currentPage = page;
};
}
};
};
| Use Math.ceil() to return the correct number of pages | Use Math.ceil() to return the correct number of pages
| JavaScript | cc0-1.0 | LinuxBozo/hmda-pilot,LinuxBozo/hmda-pilot,cfpb/hmda-pilot,cfpb/hmda-pilot,cfpb/hmda-pilot,LinuxBozo/hmda-pilot | javascript | ## Code Before:
'use strict';
/**
* @ngdoc directive
* @name hmdaPilotApp.directive:ErrorDetail
* @description
* # Error Summary directive
* Directive for displaying the details of a single edit error
*/
module.exports = /*@ngInject*/ function () {
return {
restrict: 'E',
templateUrl: 'partials/errorDetail.html',
scope: {
error: '='
},
link: function(scope) {
scope.pageSize = scope.pageSize || 10;
scope.currentPage = scope.currentPage || 1;
if (angular.equals({}, scope.error)) {
scope.error = null;
}
scope.start = function() {
return (scope.currentPage-1) * scope.pageSize + 1;
};
scope.end = function() {
var end = scope.currentPage * scope.pageSize;
return end > scope.total() ? scope.total() : end;
};
scope.total = function() {
return scope.error.errors.length;
};
scope.totalPages = function() {
return parseInt(scope.total() / scope.pageSize) || 1;
};
scope.hasPrev = function() {
return scope.currentPage > 1;
};
scope.onPrev = function() {
scope.currentPage--;
};
scope.hasNext = function() {
return scope.currentPage < scope.totalPages();
};
scope.onNext = function() {
scope.currentPage++;
};
scope.setCurrentPage = function(page) {
scope.currentPage = page;
};
}
};
};
## Instruction:
Use Math.ceil() to return the correct number of pages
## Code After:
'use strict';
/**
* @ngdoc directive
* @name hmdaPilotApp.directive:ErrorDetail
* @description
* # Error Summary directive
* Directive for displaying the details of a single edit error
*/
module.exports = /*@ngInject*/ function () {
return {
restrict: 'E',
templateUrl: 'partials/errorDetail.html',
scope: {
error: '='
},
link: function(scope) {
scope.pageSize = scope.pageSize || 10;
scope.currentPage = scope.currentPage || 1;
if (angular.equals({}, scope.error)) {
scope.error = null;
}
scope.start = function() {
return (scope.currentPage-1) * scope.pageSize + 1;
};
scope.end = function() {
var end = scope.currentPage * scope.pageSize;
return end > scope.total() ? scope.total() : end;
};
scope.total = function() {
return scope.error.errors.length;
};
scope.totalPages = function() {
return Math.ceil(scope.total() / scope.pageSize);
};
scope.hasPrev = function() {
return scope.currentPage > 1;
};
scope.onPrev = function() {
scope.currentPage--;
};
scope.hasNext = function() {
return scope.currentPage < scope.totalPages();
};
scope.onNext = function() {
scope.currentPage++;
};
scope.setCurrentPage = function(page) {
scope.currentPage = page;
};
}
};
};
| 'use strict';
/**
* @ngdoc directive
* @name hmdaPilotApp.directive:ErrorDetail
* @description
* # Error Summary directive
* Directive for displaying the details of a single edit error
*/
module.exports = /*@ngInject*/ function () {
return {
restrict: 'E',
templateUrl: 'partials/errorDetail.html',
scope: {
error: '='
},
link: function(scope) {
scope.pageSize = scope.pageSize || 10;
scope.currentPage = scope.currentPage || 1;
if (angular.equals({}, scope.error)) {
scope.error = null;
}
scope.start = function() {
return (scope.currentPage-1) * scope.pageSize + 1;
};
scope.end = function() {
var end = scope.currentPage * scope.pageSize;
return end > scope.total() ? scope.total() : end;
};
scope.total = function() {
return scope.error.errors.length;
};
scope.totalPages = function() {
- return parseInt(scope.total() / scope.pageSize) || 1;
? ^ ^^ ^^^ -----
+ return Math.ceil(scope.total() / scope.pageSize);
? ^ ^^^^ ^^
};
scope.hasPrev = function() {
return scope.currentPage > 1;
};
scope.onPrev = function() {
scope.currentPage--;
};
scope.hasNext = function() {
return scope.currentPage < scope.totalPages();
};
scope.onNext = function() {
scope.currentPage++;
};
scope.setCurrentPage = function(page) {
scope.currentPage = page;
};
}
};
}; | 2 | 0.03125 | 1 | 1 |
c74a294ddb360a017ccfdb97bb617501b6f2cb68 | requirements.txt | requirements.txt | pip==7.1.0
Django==1.8.3
Markdown==2.6.2
celery==3.1.18
django-celery==3.1.16
celery_haystack
django-celery-email==1.1.2
django-haystack==2.4.0
django-taggit==0.16.2
pytz==2015.4
requests==2.7.0
django-floppyforms==1.5.1
django-overextends==0.4.0
python-magic==0.4.6
django-tastypie==0.12.2
python-mimeparse>=0.1.4
-e git://github.com/stefanw/django-tastypie-swagger.git@python-3#egg=django_tastypie_swagger
-e git://github.com/jezdez/django-configurations.git@master#egg=configurations
django-storages==1.1.8
dj-database-url==0.3.0
django-cache-url==1.0.0
django-compressor==1.5
django-contrib-comments==1.6.1
unicodecsv==0.13.0
pysolr==3.3.2
honcho==0.6.6
lxml==3.4.4
psycopg2==2.6.1
django-tinymce==2.0.2
anyjson==0.3.3
gunicorn==19.3.0
| pip==7.1.0
Django==1.8.3
Markdown==2.6.2
celery==3.1.18
django-celery==3.1.16
celery_haystack
django-celery-email==1.1.2
django-haystack==2.4.0
django-taggit==0.16.2
pytz==2015.4
requests==2.7.0
django-floppyforms==1.5.1
django-overextends==0.4.0
python-magic==0.4.6
django-tastypie==0.12.2
python-mimeparse>=0.1.4
-e git://github.com/stefanw/django-tastypie-swagger.git@python-3#egg=django_tastypie_swagger
-e git://github.com/jezdez/django-configurations.git@master#egg=configurations
django-storages==1.1.8
dj-database-url==0.3.0
django-cache-url==1.0.0
-e git://github.com/stefanw/django-compressor.git@patch-1#egg=compressor
django-contrib-comments==1.6.1
unicodecsv==0.13.0
pysolr==3.3.2
honcho==0.6.6
lxml==3.4.4
psycopg2==2.6.1
django-tinymce==2.0.2
anyjson==0.3.3
gunicorn==19.3.0
| Add django compressor branch requirement to work with overextend | Add django compressor branch requirement to work with overextend
| Text | mit | okfse/fragdenstaat_de,catcosmo/fragdenstaat_de,okfse/fragdenstaat_de,okfse/fragastaten_se,catcosmo/fragdenstaat_de,okfse/fragastaten_se | text | ## Code Before:
pip==7.1.0
Django==1.8.3
Markdown==2.6.2
celery==3.1.18
django-celery==3.1.16
celery_haystack
django-celery-email==1.1.2
django-haystack==2.4.0
django-taggit==0.16.2
pytz==2015.4
requests==2.7.0
django-floppyforms==1.5.1
django-overextends==0.4.0
python-magic==0.4.6
django-tastypie==0.12.2
python-mimeparse>=0.1.4
-e git://github.com/stefanw/django-tastypie-swagger.git@python-3#egg=django_tastypie_swagger
-e git://github.com/jezdez/django-configurations.git@master#egg=configurations
django-storages==1.1.8
dj-database-url==0.3.0
django-cache-url==1.0.0
django-compressor==1.5
django-contrib-comments==1.6.1
unicodecsv==0.13.0
pysolr==3.3.2
honcho==0.6.6
lxml==3.4.4
psycopg2==2.6.1
django-tinymce==2.0.2
anyjson==0.3.3
gunicorn==19.3.0
## Instruction:
Add django compressor branch requirement to work with overextend
## Code After:
pip==7.1.0
Django==1.8.3
Markdown==2.6.2
celery==3.1.18
django-celery==3.1.16
celery_haystack
django-celery-email==1.1.2
django-haystack==2.4.0
django-taggit==0.16.2
pytz==2015.4
requests==2.7.0
django-floppyforms==1.5.1
django-overextends==0.4.0
python-magic==0.4.6
django-tastypie==0.12.2
python-mimeparse>=0.1.4
-e git://github.com/stefanw/django-tastypie-swagger.git@python-3#egg=django_tastypie_swagger
-e git://github.com/jezdez/django-configurations.git@master#egg=configurations
django-storages==1.1.8
dj-database-url==0.3.0
django-cache-url==1.0.0
-e git://github.com/stefanw/django-compressor.git@patch-1#egg=compressor
django-contrib-comments==1.6.1
unicodecsv==0.13.0
pysolr==3.3.2
honcho==0.6.6
lxml==3.4.4
psycopg2==2.6.1
django-tinymce==2.0.2
anyjson==0.3.3
gunicorn==19.3.0
| pip==7.1.0
Django==1.8.3
Markdown==2.6.2
celery==3.1.18
django-celery==3.1.16
celery_haystack
django-celery-email==1.1.2
django-haystack==2.4.0
django-taggit==0.16.2
pytz==2015.4
requests==2.7.0
django-floppyforms==1.5.1
django-overextends==0.4.0
python-magic==0.4.6
django-tastypie==0.12.2
python-mimeparse>=0.1.4
-e git://github.com/stefanw/django-tastypie-swagger.git@python-3#egg=django_tastypie_swagger
-e git://github.com/jezdez/django-configurations.git@master#egg=configurations
django-storages==1.1.8
dj-database-url==0.3.0
django-cache-url==1.0.0
- django-compressor==1.5
+ -e git://github.com/stefanw/django-compressor.git@patch-1#egg=compressor
django-contrib-comments==1.6.1
unicodecsv==0.13.0
pysolr==3.3.2
honcho==0.6.6
lxml==3.4.4
psycopg2==2.6.1
django-tinymce==2.0.2
anyjson==0.3.3
gunicorn==19.3.0 | 2 | 0.064516 | 1 | 1 |
d285e178a91ca70686af714f0d1b4590a56a8328 | tools/snippet-testing/language_handler/curl_language_handler.rb | tools/snippet-testing/language_handler/curl_language_handler.rb | require 'open3'
require 'json'
require_relative 'base_language_handler'
module LanguageHandler
class CurlLanguageHandler < BaseLanguageHandler
private
def execute(file)
execute_with_suppressed_output("sh #{file}")
end
def lang_cname
'curl'
end
def execute_with_suppressed_output(command)
stdout, _, status = Open3.capture3(command)
exit_code = status.exitstatus
if exit_code == 0
begin
JSON.parse(stdout)
rescue JSON::ParserError
exit_code = 1
end
end
success = exit_code == 0
puts success ? "success [#{lang_cname}]".green : "failure [#{lang_cname}]".red
success
end
def text_with_specific_replacements(file_content)
text_without_gt_lt_symbols(text_without_bash_symbol(file_content))
end
def text_without_gt_lt_symbols(file_content)
file_content.gsub(/[<>]{1}/, '')
end
def text_without_bash_symbol(file_content)
file_content.gsub(/^\$\s/, '')
end
end
end
| require 'open3'
require 'json'
require_relative 'base_language_handler'
module LanguageHandler
class CurlLanguageHandler < BaseLanguageHandler
private
def execute(file)
execute_with_suppressed_output("sh #{file}")
end
def lang_cname
'curl'
end
def execute_with_suppressed_output(command)
stdout, _, status = Open3.capture3(command)
exit_code = status.exitstatus
if exit_code == 0
splitted_responses(stdout).each do |response|
begin
JSON.parse(response)
rescue JSON::ParserError
exit_code = 1
break
end
end
end
success = exit_code == 0
puts success ? "success [#{lang_cname}]".green : "failure [#{lang_cname}]".red
success
end
def splitted_responses(output)
responses = output.split('}{')
return responses if responses.count == 1
first_response = [responses.first + '}']
last_response = ['{' + responses.last]
middle_responses = responses[1..-2].map { |response| "{#{response}}" }
first_response + middle_responses + last_response
end
def text_with_specific_replacements(file_content)
text_without_gt_lt_symbols(text_without_bash_symbol(file_content))
end
def text_without_gt_lt_symbols(file_content)
file_content.gsub(/[<>]{1}/, '')
end
def text_without_bash_symbol(file_content)
file_content.gsub(/^\$\s/, '')
end
end
end
| Fix multiple curl commands testing | Fix multiple curl commands testing
| Ruby | mit | teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | ruby | ## Code Before:
require 'open3'
require 'json'
require_relative 'base_language_handler'
module LanguageHandler
class CurlLanguageHandler < BaseLanguageHandler
private
def execute(file)
execute_with_suppressed_output("sh #{file}")
end
def lang_cname
'curl'
end
def execute_with_suppressed_output(command)
stdout, _, status = Open3.capture3(command)
exit_code = status.exitstatus
if exit_code == 0
begin
JSON.parse(stdout)
rescue JSON::ParserError
exit_code = 1
end
end
success = exit_code == 0
puts success ? "success [#{lang_cname}]".green : "failure [#{lang_cname}]".red
success
end
def text_with_specific_replacements(file_content)
text_without_gt_lt_symbols(text_without_bash_symbol(file_content))
end
def text_without_gt_lt_symbols(file_content)
file_content.gsub(/[<>]{1}/, '')
end
def text_without_bash_symbol(file_content)
file_content.gsub(/^\$\s/, '')
end
end
end
## Instruction:
Fix multiple curl commands testing
## Code After:
require 'open3'
require 'json'
require_relative 'base_language_handler'
module LanguageHandler
class CurlLanguageHandler < BaseLanguageHandler
private
def execute(file)
execute_with_suppressed_output("sh #{file}")
end
def lang_cname
'curl'
end
def execute_with_suppressed_output(command)
stdout, _, status = Open3.capture3(command)
exit_code = status.exitstatus
if exit_code == 0
splitted_responses(stdout).each do |response|
begin
JSON.parse(response)
rescue JSON::ParserError
exit_code = 1
break
end
end
end
success = exit_code == 0
puts success ? "success [#{lang_cname}]".green : "failure [#{lang_cname}]".red
success
end
def splitted_responses(output)
responses = output.split('}{')
return responses if responses.count == 1
first_response = [responses.first + '}']
last_response = ['{' + responses.last]
middle_responses = responses[1..-2].map { |response| "{#{response}}" }
first_response + middle_responses + last_response
end
def text_with_specific_replacements(file_content)
text_without_gt_lt_symbols(text_without_bash_symbol(file_content))
end
def text_without_gt_lt_symbols(file_content)
file_content.gsub(/[<>]{1}/, '')
end
def text_without_bash_symbol(file_content)
file_content.gsub(/^\$\s/, '')
end
end
end
| require 'open3'
require 'json'
require_relative 'base_language_handler'
module LanguageHandler
class CurlLanguageHandler < BaseLanguageHandler
private
def execute(file)
execute_with_suppressed_output("sh #{file}")
end
def lang_cname
'curl'
end
def execute_with_suppressed_output(command)
stdout, _, status = Open3.capture3(command)
exit_code = status.exitstatus
if exit_code == 0
+ splitted_responses(stdout).each do |response|
- begin
+ begin
? ++
- JSON.parse(stdout)
? ^^ ^^
+ JSON.parse(response)
? ++ ++ ^ ^^^
- rescue JSON::ParserError
+ rescue JSON::ParserError
? ++
- exit_code = 1
+ exit_code = 1
? ++
+ break
+ end
end
end
success = exit_code == 0
puts success ? "success [#{lang_cname}]".green : "failure [#{lang_cname}]".red
success
+ end
+
+ def splitted_responses(output)
+ responses = output.split('}{')
+ return responses if responses.count == 1
+
+ first_response = [responses.first + '}']
+ last_response = ['{' + responses.last]
+ middle_responses = responses[1..-2].map { |response| "{#{response}}" }
+
+ first_response + middle_responses + last_response
end
def text_with_specific_replacements(file_content)
text_without_gt_lt_symbols(text_without_bash_symbol(file_content))
end
def text_without_gt_lt_symbols(file_content)
file_content.gsub(/[<>]{1}/, '')
end
def text_without_bash_symbol(file_content)
file_content.gsub(/^\$\s/, '')
end
end
end | 22 | 0.5 | 18 | 4 |
28df39ee92c9aac7b4432dc984c245b5dddac85b | lib/json_limit_backtrace.rb | lib/json_limit_backtrace.rb |
class JsonLimitBacktrace < SemanticLogger::Formatters::Json
def exception
return unless log.exception
super
# limits the stack trace length to 10 lines
hash[:exception][:stack_trace] = hash[:exception][:stack_trace].take 10
end
end
|
class JsonLimitBacktrace < SemanticLogger::Formatters::Json
def exception
return unless log.exception
super
# limits the stack trace length to 10 lines
hash[:exception][:stack_trace] = hash[:exception][:stack_trace].take 10
hash[:message] = hash[:exception][:message]
end
end
| Add exception message to log message field | Add exception message to log message field
| Ruby | mit | MindLeaps/tracker,MindLeaps/tracker,MindLeaps/tracker,MindLeaps/tracker,MindLeaps/tracker | ruby | ## Code Before:
class JsonLimitBacktrace < SemanticLogger::Formatters::Json
def exception
return unless log.exception
super
# limits the stack trace length to 10 lines
hash[:exception][:stack_trace] = hash[:exception][:stack_trace].take 10
end
end
## Instruction:
Add exception message to log message field
## Code After:
class JsonLimitBacktrace < SemanticLogger::Formatters::Json
def exception
return unless log.exception
super
# limits the stack trace length to 10 lines
hash[:exception][:stack_trace] = hash[:exception][:stack_trace].take 10
hash[:message] = hash[:exception][:message]
end
end
|
class JsonLimitBacktrace < SemanticLogger::Formatters::Json
def exception
return unless log.exception
super
# limits the stack trace length to 10 lines
hash[:exception][:stack_trace] = hash[:exception][:stack_trace].take 10
+ hash[:message] = hash[:exception][:message]
end
end | 1 | 0.111111 | 1 | 0 |
624c42af71b2c5114c73c4ff1ec46514703c6b97 | src/SFA.DAS.EmployerApprenticeshipsService.Web/App_Data/Users/user_data.json | src/SFA.DAS.EmployerApprenticeshipsService.Web/App_Data/Users/user_data.json | {
"AvailableUsers": [
{
"UserId": "DF11DAEB-CA1B-47DC-AAD8-F7F37B7F4EAC",
"FirstName": "Dan",
"LastName": "Ashton",
"Email": "daniel.ashton@test.local"
},
{
"UserId": "A0BBC02B-39A0-4DEC-8018-1A3A98A18A37",
"FirstName": "Ian",
"LastName": "Russell",
"Email": "ian.russell@test.local"
},
{
"UserId": "758943A5-86AA-4579-86AF-FB3D4A05850B",
"FirstName": "Floyd",
"LastName": "Price",
"Email": "floyd.price@test.local"
},
{
"UserId": "E2A913BC-3AC0-42AE-B1D7-827FEFA76F9A",
"FirstName": "Mark",
"LastName": "Gwilliam",
"Email": "mark.gwilliam@test.local"
},
{
"UserId": "1786D990-37FC-45FA-B6F3-D12A1A948704",
"FirstName": "Simon",
"LastName": "Bull",
"Email": "simon.bull@test.local"
}
]
}
| {
"UserList": [
{
"UserId": "DF11DAEB-CA1B-47DC-AAD8-F7F37B7F4EAC",
"FirstName": "Dan",
"LastName": "Ashton",
"Email": "daniel.ashton@test.local"
},
{
"UserId": "A0BBC02B-39A0-4DEC-8018-1A3A98A18A37",
"FirstName": "Ian",
"LastName": "Russell",
"Email": "ian.russell@test.local"
},
{
"UserId": "758943A5-86AA-4579-86AF-FB3D4A05850B",
"FirstName": "Floyd",
"LastName": "Price",
"Email": "floyd.price@test.local"
},
{
"UserId": "E2A913BC-3AC0-42AE-B1D7-827FEFA76F9A",
"FirstName": "Mark",
"LastName": "Gwilliam",
"Email": "mark.gwilliam@test.local"
},
{
"UserId": "1786D990-37FC-45FA-B6F3-D12A1A948704",
"FirstName": "Simon",
"LastName": "Bull",
"Email": "simon.bull@test.local"
}
]
}
| Update to JSON document to reflect the data structure defined in the web app | Update to JSON document to reflect the data structure defined in the web app
| JSON | mit | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | json | ## Code Before:
{
"AvailableUsers": [
{
"UserId": "DF11DAEB-CA1B-47DC-AAD8-F7F37B7F4EAC",
"FirstName": "Dan",
"LastName": "Ashton",
"Email": "daniel.ashton@test.local"
},
{
"UserId": "A0BBC02B-39A0-4DEC-8018-1A3A98A18A37",
"FirstName": "Ian",
"LastName": "Russell",
"Email": "ian.russell@test.local"
},
{
"UserId": "758943A5-86AA-4579-86AF-FB3D4A05850B",
"FirstName": "Floyd",
"LastName": "Price",
"Email": "floyd.price@test.local"
},
{
"UserId": "E2A913BC-3AC0-42AE-B1D7-827FEFA76F9A",
"FirstName": "Mark",
"LastName": "Gwilliam",
"Email": "mark.gwilliam@test.local"
},
{
"UserId": "1786D990-37FC-45FA-B6F3-D12A1A948704",
"FirstName": "Simon",
"LastName": "Bull",
"Email": "simon.bull@test.local"
}
]
}
## Instruction:
Update to JSON document to reflect the data structure defined in the web app
## Code After:
{
"UserList": [
{
"UserId": "DF11DAEB-CA1B-47DC-AAD8-F7F37B7F4EAC",
"FirstName": "Dan",
"LastName": "Ashton",
"Email": "daniel.ashton@test.local"
},
{
"UserId": "A0BBC02B-39A0-4DEC-8018-1A3A98A18A37",
"FirstName": "Ian",
"LastName": "Russell",
"Email": "ian.russell@test.local"
},
{
"UserId": "758943A5-86AA-4579-86AF-FB3D4A05850B",
"FirstName": "Floyd",
"LastName": "Price",
"Email": "floyd.price@test.local"
},
{
"UserId": "E2A913BC-3AC0-42AE-B1D7-827FEFA76F9A",
"FirstName": "Mark",
"LastName": "Gwilliam",
"Email": "mark.gwilliam@test.local"
},
{
"UserId": "1786D990-37FC-45FA-B6F3-D12A1A948704",
"FirstName": "Simon",
"LastName": "Bull",
"Email": "simon.bull@test.local"
}
]
}
| {
- "AvailableUsers": [
+ "UserList": [
{
"UserId": "DF11DAEB-CA1B-47DC-AAD8-F7F37B7F4EAC",
"FirstName": "Dan",
"LastName": "Ashton",
"Email": "daniel.ashton@test.local"
},
{
"UserId": "A0BBC02B-39A0-4DEC-8018-1A3A98A18A37",
"FirstName": "Ian",
"LastName": "Russell",
"Email": "ian.russell@test.local"
},
{
"UserId": "758943A5-86AA-4579-86AF-FB3D4A05850B",
"FirstName": "Floyd",
"LastName": "Price",
"Email": "floyd.price@test.local"
},
{
"UserId": "E2A913BC-3AC0-42AE-B1D7-827FEFA76F9A",
"FirstName": "Mark",
"LastName": "Gwilliam",
"Email": "mark.gwilliam@test.local"
},
{
"UserId": "1786D990-37FC-45FA-B6F3-D12A1A948704",
"FirstName": "Simon",
"LastName": "Bull",
"Email": "simon.bull@test.local"
}
]
}
| 2 | 0.057143 | 1 | 1 |
2641376590232526984f116c75d875f346276c96 | gitconfig.erb | gitconfig.erb | [color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = Matias Grunberg
email = matias@yellowspot.com.ar
[core]
excludesfile = /home/matias/.gitignore
editor = vim
[alias]
co = checkout
nff = merge --no-ff
[mergetool]
keepBackup = false
[rerere]
enabled = 1
[push]
default = tracking
[merge]
tool = meld
| [color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = Matias Grunberg
email = matias@yellowspot.com.ar
[core]
excludesfile = /home/matias/.gitignore
editor = vim
[alias]
co = checkout
nff = merge --no-ff
lg = log --oneline --decorate --all --graph
[mergetool]
keepBackup = false
[rerere]
enabled = 1
[push]
default = tracking
[merge]
tool = meld
| Add lg alias to git | Add lg alias to git
| HTML+ERB | mit | mgrunberg/dotfiles,mgrunberg/dotfiles,mgrunberg/dotfiles | html+erb | ## Code Before:
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = Matias Grunberg
email = matias@yellowspot.com.ar
[core]
excludesfile = /home/matias/.gitignore
editor = vim
[alias]
co = checkout
nff = merge --no-ff
[mergetool]
keepBackup = false
[rerere]
enabled = 1
[push]
default = tracking
[merge]
tool = meld
## Instruction:
Add lg alias to git
## Code After:
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = Matias Grunberg
email = matias@yellowspot.com.ar
[core]
excludesfile = /home/matias/.gitignore
editor = vim
[alias]
co = checkout
nff = merge --no-ff
lg = log --oneline --decorate --all --graph
[mergetool]
keepBackup = false
[rerere]
enabled = 1
[push]
default = tracking
[merge]
tool = meld
| [color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[user]
name = Matias Grunberg
email = matias@yellowspot.com.ar
[core]
excludesfile = /home/matias/.gitignore
editor = vim
[alias]
co = checkout
nff = merge --no-ff
+ lg = log --oneline --decorate --all --graph
[mergetool]
keepBackup = false
[rerere]
enabled = 1
[push]
default = tracking
[merge]
tool = meld | 1 | 0.022727 | 1 | 0 |
5db4d3ae4901701e616a16cc1c985e7a58d209bc | padStart.polyfill.js | padStart.polyfill.js | (function() {
'use strict';
if ('padStart' in String.prototype) return;
String.prototype.padStart = function(len, str) {
len = parseInt(len); if (isNaN(len)) len = 0;
str = str === undefined ? '\u0020' : String(str);
if (len <= this.length || str.length === 0) return String(this);
var buffer = new Array(len-this.length);
for (var i = 0; i < buffer.length; i++) buffer[i] = str[i%str.length];
return buffer.join('').concat(this);
};
})();
| (function() {
'use strict';
if ('padStart' in String.prototype) return;
String.prototype.padStart = function(len, str) {
len = parseInt(len); if (isNaN(len)) len = 0;
str = str === undefined ? '\u0020' : String(str);
if (len <= this.length || str.length === 0) return String(this);
var buffer = new Array(len-this.length); str = str.split('');
for (var i = 0; i < buffer.length; i++) buffer[i] = str[i%str.length];
return buffer.join('').concat(this);
};
})();
| Add support for older browsers | Add support for older browsers
| JavaScript | apache-2.0 | RockoDev/String.prototype.padStart | javascript | ## Code Before:
(function() {
'use strict';
if ('padStart' in String.prototype) return;
String.prototype.padStart = function(len, str) {
len = parseInt(len); if (isNaN(len)) len = 0;
str = str === undefined ? '\u0020' : String(str);
if (len <= this.length || str.length === 0) return String(this);
var buffer = new Array(len-this.length);
for (var i = 0; i < buffer.length; i++) buffer[i] = str[i%str.length];
return buffer.join('').concat(this);
};
})();
## Instruction:
Add support for older browsers
## Code After:
(function() {
'use strict';
if ('padStart' in String.prototype) return;
String.prototype.padStart = function(len, str) {
len = parseInt(len); if (isNaN(len)) len = 0;
str = str === undefined ? '\u0020' : String(str);
if (len <= this.length || str.length === 0) return String(this);
var buffer = new Array(len-this.length); str = str.split('');
for (var i = 0; i < buffer.length; i++) buffer[i] = str[i%str.length];
return buffer.join('').concat(this);
};
})();
| (function() {
'use strict';
if ('padStart' in String.prototype) return;
String.prototype.padStart = function(len, str) {
len = parseInt(len); if (isNaN(len)) len = 0;
str = str === undefined ? '\u0020' : String(str);
if (len <= this.length || str.length === 0) return String(this);
- var buffer = new Array(len-this.length);
+ var buffer = new Array(len-this.length); str = str.split('');
? +++++++++++++++++++++
for (var i = 0; i < buffer.length; i++) buffer[i] = str[i%str.length];
return buffer.join('').concat(this);
};
})(); | 2 | 0.166667 | 1 | 1 |
f877941bd77a587dce661213b6736cdedfa15b08 | _drafts/passionate-programmer.md | _drafts/passionate-programmer.md | ---
tags: book
title: The Passionate Programmer by Chad Fowler
---
I bought [The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/) (2nd edition), *Creating a Remarkable Career in Software Development* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2019. I'm so glad I've read it now, because I'm working on a blog post with related topic, career development.
| ---
tags: book
title: The Passionate Programmer by Chad Fowler
---
I bought *[The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/)* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2020.
I've read the 2nd edition with subtitle *Creating a Remarkable Career in Software Development*. As far as I understood it, the first edition of the book was called *My Job Went to India* with subtitle *And All I Got Was This Lousy Book*.
Both books have pretty good rating at Goodreads. [The Passionate Programmer](https://www.goodreads.com/book/show/6399113-the-passionate-programmer) 3.95 (4,003 ratings) and [My Job Went to India](https://www.goodreads.com/book/show/4103.My_Job_Went_to_India) 3.96 (188 ratings). Surprisingly, both books have a decent number of low ratings and reviews.
I'm so glad I've read the book now, because I'm working on a blog post with related topic, career development. This book will teach you how to build your career as you would build a product or a company. *You* are in charge of your career, *you* should develop it. Assess your current situation, assess the market, make a plan, build your career, invest some time and effort in marketing.
A few of the advice from the book that really resonated with me.
Tip 4. Be the Worst
"Always be the worst guy in every band you're in."
Tip 7. Be a Generalist
Tip 8. Be a Specialist
Tip 13. Find a Mentor
Tip 14. Be a Mentor
Tip 40. Build Your Brand
Tip 41. Release Your Code
Tip 53. Go Independent
| Update passionate programmer draft post | Update passionate programmer draft post
| Markdown | mit | zeljkofilipin/filipin,zeljkofilipin/filipin | markdown | ## Code Before:
---
tags: book
title: The Passionate Programmer by Chad Fowler
---
I bought [The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/) (2nd edition), *Creating a Remarkable Career in Software Development* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2019. I'm so glad I've read it now, because I'm working on a blog post with related topic, career development.
## Instruction:
Update passionate programmer draft post
## Code After:
---
tags: book
title: The Passionate Programmer by Chad Fowler
---
I bought *[The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/)* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2020.
I've read the 2nd edition with subtitle *Creating a Remarkable Career in Software Development*. As far as I understood it, the first edition of the book was called *My Job Went to India* with subtitle *And All I Got Was This Lousy Book*.
Both books have pretty good rating at Goodreads. [The Passionate Programmer](https://www.goodreads.com/book/show/6399113-the-passionate-programmer) 3.95 (4,003 ratings) and [My Job Went to India](https://www.goodreads.com/book/show/4103.My_Job_Went_to_India) 3.96 (188 ratings). Surprisingly, both books have a decent number of low ratings and reviews.
I'm so glad I've read the book now, because I'm working on a blog post with related topic, career development. This book will teach you how to build your career as you would build a product or a company. *You* are in charge of your career, *you* should develop it. Assess your current situation, assess the market, make a plan, build your career, invest some time and effort in marketing.
A few of the advice from the book that really resonated with me.
Tip 4. Be the Worst
"Always be the worst guy in every band you're in."
Tip 7. Be a Generalist
Tip 8. Be a Specialist
Tip 13. Find a Mentor
Tip 14. Be a Mentor
Tip 40. Build Your Brand
Tip 41. Release Your Code
Tip 53. Go Independent
| ---
tags: book
title: The Passionate Programmer by Chad Fowler
---
- I bought [The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/) (2nd edition), *Creating a Remarkable Career in Software Development* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2019. I'm so glad I've read it now, because I'm working on a blog post with related topic, career development.
+ I bought *[The Passionate Programmer](https://pragprog.com/titles/cfcar2/the-passionate-programmer-2nd-edition/)* by Chad Fowler during December 2019 sale. It spent a lot of time in my to-read stack. I've finally read it in November 2020.
+
+ I've read the 2nd edition with subtitle *Creating a Remarkable Career in Software Development*. As far as I understood it, the first edition of the book was called *My Job Went to India* with subtitle *And All I Got Was This Lousy Book*.
+
+ Both books have pretty good rating at Goodreads. [The Passionate Programmer](https://www.goodreads.com/book/show/6399113-the-passionate-programmer) 3.95 (4,003 ratings) and [My Job Went to India](https://www.goodreads.com/book/show/4103.My_Job_Went_to_India) 3.96 (188 ratings). Surprisingly, both books have a decent number of low ratings and reviews.
+
+ I'm so glad I've read the book now, because I'm working on a blog post with related topic, career development. This book will teach you how to build your career as you would build a product or a company. *You* are in charge of your career, *you* should develop it. Assess your current situation, assess the market, make a plan, build your career, invest some time and effort in marketing.
+
+ A few of the advice from the book that really resonated with me.
+
+ Tip 4. Be the Worst
+
+ "Always be the worst guy in every band you're in."
+
+ Tip 7. Be a Generalist
+ Tip 8. Be a Specialist
+ Tip 13. Find a Mentor
+ Tip 14. Be a Mentor
+ Tip 40. Build Your Brand
+ Tip 41. Release Your Code
+ Tip 53. Go Independent | 22 | 4.4 | 21 | 1 |
af376f20041bd3aa143ef23265849a9b40ce72fa | app/serializers/api/v1/historical_emissions/record_serializer.rb | app/serializers/api/v1/historical_emissions/record_serializer.rb | module Api
module V1
module HistoricalEmissions
class RecordSerializer < ActiveModel::Serializer
belongs_to :location
belongs_to :gas
belongs_to :data_source, key: :source
belongs_to :sector
attribute :emissions
attribute :gwp
def location
object.location.wri_standard_name
end
def gas
object.gas.name
end
def data_source
object.data_source.name
end
def sector
object.sector.name
end
def gwp
object.gwp.name
end
def emissions
date_before = @instance_options[:params]['date_before']&.to_i
date_after = @instance_options[:params]['date_after']&.to_i
object.emissions.select do |em|
(date_before ? em['year'] <= date_before : true) &&
(date_after ? em['year'] >= date_after : true)
end
end
end
end
end
end
| module Api
module V1
module HistoricalEmissions
class RecordSerializer < ActiveModel::Serializer
belongs_to :location
belongs_to :iso_code3
belongs_to :gas
belongs_to :data_source, key: :source
belongs_to :sector
attribute :emissions
attribute :gwp
def location
object.location.wri_standard_name
end
def iso_code3
object.location.iso_code3
end
def gas
object.gas.name
end
def data_source
object.data_source.name
end
def sector
object.sector.name
end
def gwp
object.gwp.name
end
def emissions
date_before = @instance_options[:params]['date_before']&.to_i
date_after = @instance_options[:params]['date_after']&.to_i
object.emissions.select do |em|
(date_before ? em['year'] <= date_before : true) &&
(date_after ? em['year'] >= date_after : true)
end
end
end
end
end
end
| Include iso_code3 in emissions request | Include iso_code3 in emissions request
| Ruby | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ruby | ## Code Before:
module Api
module V1
module HistoricalEmissions
class RecordSerializer < ActiveModel::Serializer
belongs_to :location
belongs_to :gas
belongs_to :data_source, key: :source
belongs_to :sector
attribute :emissions
attribute :gwp
def location
object.location.wri_standard_name
end
def gas
object.gas.name
end
def data_source
object.data_source.name
end
def sector
object.sector.name
end
def gwp
object.gwp.name
end
def emissions
date_before = @instance_options[:params]['date_before']&.to_i
date_after = @instance_options[:params]['date_after']&.to_i
object.emissions.select do |em|
(date_before ? em['year'] <= date_before : true) &&
(date_after ? em['year'] >= date_after : true)
end
end
end
end
end
end
## Instruction:
Include iso_code3 in emissions request
## Code After:
module Api
module V1
module HistoricalEmissions
class RecordSerializer < ActiveModel::Serializer
belongs_to :location
belongs_to :iso_code3
belongs_to :gas
belongs_to :data_source, key: :source
belongs_to :sector
attribute :emissions
attribute :gwp
def location
object.location.wri_standard_name
end
def iso_code3
object.location.iso_code3
end
def gas
object.gas.name
end
def data_source
object.data_source.name
end
def sector
object.sector.name
end
def gwp
object.gwp.name
end
def emissions
date_before = @instance_options[:params]['date_before']&.to_i
date_after = @instance_options[:params]['date_after']&.to_i
object.emissions.select do |em|
(date_before ? em['year'] <= date_before : true) &&
(date_after ? em['year'] >= date_after : true)
end
end
end
end
end
end
| module Api
module V1
module HistoricalEmissions
class RecordSerializer < ActiveModel::Serializer
belongs_to :location
+ belongs_to :iso_code3
belongs_to :gas
belongs_to :data_source, key: :source
belongs_to :sector
attribute :emissions
attribute :gwp
def location
object.location.wri_standard_name
+ end
+
+ def iso_code3
+ object.location.iso_code3
end
def gas
object.gas.name
end
def data_source
object.data_source.name
end
def sector
object.sector.name
end
def gwp
object.gwp.name
end
def emissions
date_before = @instance_options[:params]['date_before']&.to_i
date_after = @instance_options[:params]['date_after']&.to_i
object.emissions.select do |em|
(date_before ? em['year'] <= date_before : true) &&
(date_after ? em['year'] >= date_after : true)
end
end
end
end
end
end | 5 | 0.113636 | 5 | 0 |
97881a571fe60033810cc7864126b041bd82f3d1 | client/src/store/reducers/auth.js | client/src/store/reducers/auth.js | // our packages
import * as ActionTypes from '../actionTypes';
const initialState = () => ({
token: localStorage.getItem('user.token'),
user: JSON.parse(localStorage.getItem('user.data')),
});
export const auth = (state = initialState(), action) => {
switch (action.type) {
case ActionTypes.REGISTER_SUCCESS:
return {
redirectToLogin: true,
};
case ActionTypes.LOGIN_SUCCESS:
localStorage.setItem('user.token', action.payload.token);
localStorage.setItem('user.data', JSON.stringify(action.payload.user));
return {
...action.payload,
};
case ActionTypes.LOGIN_ERROR:
case ActionTypes.REGISTER_ERROR:
return {
...state,
error: action.payload.error,
};
case ActionTypes.CLOSE_SESSION:
localStorage.removeItem('user.token');
localStorage.removeItem('user.data');
return initialState();
case ActionTypes.UPDATE_PROFILE_SUCCESS:
return {
...state,
user: action.payload,
};
default:
return state;
}
};
| // our packages
import * as ActionTypes from '../actionTypes';
const initialState = () => ({
token: localStorage.getItem('user.token'),
user: JSON.parse(localStorage.getItem('user.data')),
});
export const auth = (state = initialState(), action) => {
switch (action.type) {
case ActionTypes.REGISTER_SUCCESS:
return {
redirectToLogin: true,
};
case ActionTypes.LOGIN_SUCCESS:
localStorage.setItem('user.token', action.payload.token);
localStorage.setItem('user.data', JSON.stringify(action.payload.user));
return {
...action.payload,
};
case ActionTypes.LOGIN_ERROR:
case ActionTypes.REGISTER_ERROR:
return {
...state,
error: action.payload.error,
};
case ActionTypes.CLOSE_SESSION:
localStorage.removeItem('user.token');
localStorage.removeItem('user.data');
return initialState();
case ActionTypes.UPDATE_PROFILE_SUCCESS:
localStorage.setItem('user.data', JSON.stringify(action.payload));
return {
...state,
user: action.payload,
};
default:
return state;
}
};
| Refresh the localstorage when edit profile. Can refresh page | Refresh the localstorage when edit profile. Can refresh page
| JavaScript | mit | DAWZayas/Klayas,DAWZayas/Klayas | javascript | ## Code Before:
// our packages
import * as ActionTypes from '../actionTypes';
const initialState = () => ({
token: localStorage.getItem('user.token'),
user: JSON.parse(localStorage.getItem('user.data')),
});
export const auth = (state = initialState(), action) => {
switch (action.type) {
case ActionTypes.REGISTER_SUCCESS:
return {
redirectToLogin: true,
};
case ActionTypes.LOGIN_SUCCESS:
localStorage.setItem('user.token', action.payload.token);
localStorage.setItem('user.data', JSON.stringify(action.payload.user));
return {
...action.payload,
};
case ActionTypes.LOGIN_ERROR:
case ActionTypes.REGISTER_ERROR:
return {
...state,
error: action.payload.error,
};
case ActionTypes.CLOSE_SESSION:
localStorage.removeItem('user.token');
localStorage.removeItem('user.data');
return initialState();
case ActionTypes.UPDATE_PROFILE_SUCCESS:
return {
...state,
user: action.payload,
};
default:
return state;
}
};
## Instruction:
Refresh the localstorage when edit profile. Can refresh page
## Code After:
// our packages
import * as ActionTypes from '../actionTypes';
const initialState = () => ({
token: localStorage.getItem('user.token'),
user: JSON.parse(localStorage.getItem('user.data')),
});
export const auth = (state = initialState(), action) => {
switch (action.type) {
case ActionTypes.REGISTER_SUCCESS:
return {
redirectToLogin: true,
};
case ActionTypes.LOGIN_SUCCESS:
localStorage.setItem('user.token', action.payload.token);
localStorage.setItem('user.data', JSON.stringify(action.payload.user));
return {
...action.payload,
};
case ActionTypes.LOGIN_ERROR:
case ActionTypes.REGISTER_ERROR:
return {
...state,
error: action.payload.error,
};
case ActionTypes.CLOSE_SESSION:
localStorage.removeItem('user.token');
localStorage.removeItem('user.data');
return initialState();
case ActionTypes.UPDATE_PROFILE_SUCCESS:
localStorage.setItem('user.data', JSON.stringify(action.payload));
return {
...state,
user: action.payload,
};
default:
return state;
}
};
| // our packages
import * as ActionTypes from '../actionTypes';
const initialState = () => ({
token: localStorage.getItem('user.token'),
user: JSON.parse(localStorage.getItem('user.data')),
});
export const auth = (state = initialState(), action) => {
switch (action.type) {
case ActionTypes.REGISTER_SUCCESS:
return {
redirectToLogin: true,
};
case ActionTypes.LOGIN_SUCCESS:
localStorage.setItem('user.token', action.payload.token);
localStorage.setItem('user.data', JSON.stringify(action.payload.user));
return {
...action.payload,
};
case ActionTypes.LOGIN_ERROR:
case ActionTypes.REGISTER_ERROR:
return {
...state,
error: action.payload.error,
};
case ActionTypes.CLOSE_SESSION:
localStorage.removeItem('user.token');
localStorage.removeItem('user.data');
return initialState();
case ActionTypes.UPDATE_PROFILE_SUCCESS:
+ localStorage.setItem('user.data', JSON.stringify(action.payload));
return {
...state,
user: action.payload,
};
default:
return state;
}
}; | 1 | 0.025641 | 1 | 0 |
ff1cf1827b78bb9d26ad89e844e2fdf56b7e5124 | tests/Cache/MemcacheCacheLiveTest.php | tests/Cache/MemcacheCacheLiveTest.php | <?php
class MemcacheCacheLiveTest extends BaseCacheTest
{
public function setUp()
{
parent::setUp();
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$memcache->flush();
$this->cache = new Geek\Cache\MemcacheCache( $memcache );
}
}
| <?php
class MemcacheCacheLiveTest extends BaseCacheTest
{
public function setUp()
{
parent::setUp();
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$memcache->flush();
$this->cache = new Geek\Cache\MemcacheCache( $memcache );
}
/**
* @group slowTests
*/
public function testTtlInteger()
{
$this->cache->put( self::KEY, self::VALUE, 1 );
$this->assertEquals( self::VALUE, $this->cache->get( self::KEY ) );
usleep( 2100000 );
$this->assertFalse( $this->cache->get( self::KEY ) );
}
}
| Test for ttl invalidation for Memcache live | Test for ttl invalidation for Memcache live
| PHP | mit | karptonite/geekcache | php | ## Code Before:
<?php
class MemcacheCacheLiveTest extends BaseCacheTest
{
public function setUp()
{
parent::setUp();
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$memcache->flush();
$this->cache = new Geek\Cache\MemcacheCache( $memcache );
}
}
## Instruction:
Test for ttl invalidation for Memcache live
## Code After:
<?php
class MemcacheCacheLiveTest extends BaseCacheTest
{
public function setUp()
{
parent::setUp();
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$memcache->flush();
$this->cache = new Geek\Cache\MemcacheCache( $memcache );
}
/**
* @group slowTests
*/
public function testTtlInteger()
{
$this->cache->put( self::KEY, self::VALUE, 1 );
$this->assertEquals( self::VALUE, $this->cache->get( self::KEY ) );
usleep( 2100000 );
$this->assertFalse( $this->cache->get( self::KEY ) );
}
}
| <?php
class MemcacheCacheLiveTest extends BaseCacheTest
{
public function setUp()
{
parent::setUp();
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$memcache->flush();
$this->cache = new Geek\Cache\MemcacheCache( $memcache );
}
+
+ /**
+ * @group slowTests
+ */
+ public function testTtlInteger()
+ {
+ $this->cache->put( self::KEY, self::VALUE, 1 );
+ $this->assertEquals( self::VALUE, $this->cache->get( self::KEY ) );
+ usleep( 2100000 );
+ $this->assertFalse( $this->cache->get( self::KEY ) );
+ }
} | 11 | 0.846154 | 11 | 0 |
3c2fee94f983e75d538ce264340996b55f61bd2c | src/modules/frei0r/CMakeLists.txt | src/modules/frei0r/CMakeLists.txt | add_library(mltfrei0r MODULE
factory.c
filter_cairoblend_mode.c
filter_frei0r.c
frei0r_helper.c
producer_frei0r.c
transition_frei0r.c
)
target_compile_options(mltfrei0r PRIVATE ${MLT_COMPILE_OPTIONS})
if(APPLE AND RELOCATABLE)
target_compile_definitions(mltfrei0r PRIVATE RELOCATABLE)
endif()
target_link_libraries(mltfrei0r PRIVATE mlt m ${CMAKE_DL_LIBS})
set_target_properties(mltfrei0r PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")
install(TARGETS mltfrei0r LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
install(FILES
filter_cairoblend_mode.yml
resolution_scale.yml
param_name_map.yaml
blacklist.txt not_thread_safe.txt
DESTINATION ${MLT_INSTALL_DATA_DIR}/frei0r
)
| add_library(mltfrei0r MODULE
factory.c
filter_cairoblend_mode.c
filter_frei0r.c
frei0r_helper.c
producer_frei0r.c
transition_frei0r.c
)
target_compile_options(mltfrei0r PRIVATE ${MLT_COMPILE_OPTIONS})
target_include_directories(mltfrei0r PRIVATE ${FREI0R_INCLUDE_DIRS})
if(APPLE AND RELOCATABLE)
target_compile_definitions(mltfrei0r PRIVATE RELOCATABLE)
endif()
target_link_libraries(mltfrei0r PRIVATE mlt m ${CMAKE_DL_LIBS})
set_target_properties(mltfrei0r PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")
install(TARGETS mltfrei0r LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
install(FILES
filter_cairoblend_mode.yml
resolution_scale.yml
param_name_map.yaml
blacklist.txt not_thread_safe.txt
DESTINATION ${MLT_INSTALL_DATA_DIR}/frei0r
)
| Fix building frei0r module in KDE Craft | Fix building frei0r module in KDE Craft
| Text | lgpl-2.1 | mltframework/mlt,mltframework/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,j-b-m/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,mltframework/mlt,j-b-m/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,j-b-m/mlt | text | ## Code Before:
add_library(mltfrei0r MODULE
factory.c
filter_cairoblend_mode.c
filter_frei0r.c
frei0r_helper.c
producer_frei0r.c
transition_frei0r.c
)
target_compile_options(mltfrei0r PRIVATE ${MLT_COMPILE_OPTIONS})
if(APPLE AND RELOCATABLE)
target_compile_definitions(mltfrei0r PRIVATE RELOCATABLE)
endif()
target_link_libraries(mltfrei0r PRIVATE mlt m ${CMAKE_DL_LIBS})
set_target_properties(mltfrei0r PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")
install(TARGETS mltfrei0r LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
install(FILES
filter_cairoblend_mode.yml
resolution_scale.yml
param_name_map.yaml
blacklist.txt not_thread_safe.txt
DESTINATION ${MLT_INSTALL_DATA_DIR}/frei0r
)
## Instruction:
Fix building frei0r module in KDE Craft
## Code After:
add_library(mltfrei0r MODULE
factory.c
filter_cairoblend_mode.c
filter_frei0r.c
frei0r_helper.c
producer_frei0r.c
transition_frei0r.c
)
target_compile_options(mltfrei0r PRIVATE ${MLT_COMPILE_OPTIONS})
target_include_directories(mltfrei0r PRIVATE ${FREI0R_INCLUDE_DIRS})
if(APPLE AND RELOCATABLE)
target_compile_definitions(mltfrei0r PRIVATE RELOCATABLE)
endif()
target_link_libraries(mltfrei0r PRIVATE mlt m ${CMAKE_DL_LIBS})
set_target_properties(mltfrei0r PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")
install(TARGETS mltfrei0r LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
install(FILES
filter_cairoblend_mode.yml
resolution_scale.yml
param_name_map.yaml
blacklist.txt not_thread_safe.txt
DESTINATION ${MLT_INSTALL_DATA_DIR}/frei0r
)
| add_library(mltfrei0r MODULE
factory.c
filter_cairoblend_mode.c
filter_frei0r.c
frei0r_helper.c
producer_frei0r.c
transition_frei0r.c
)
target_compile_options(mltfrei0r PRIVATE ${MLT_COMPILE_OPTIONS})
+ target_include_directories(mltfrei0r PRIVATE ${FREI0R_INCLUDE_DIRS})
if(APPLE AND RELOCATABLE)
target_compile_definitions(mltfrei0r PRIVATE RELOCATABLE)
endif()
target_link_libraries(mltfrei0r PRIVATE mlt m ${CMAKE_DL_LIBS})
set_target_properties(mltfrei0r PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")
install(TARGETS mltfrei0r LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
install(FILES
filter_cairoblend_mode.yml
resolution_scale.yml
param_name_map.yaml
blacklist.txt not_thread_safe.txt
DESTINATION ${MLT_INSTALL_DATA_DIR}/frei0r
) | 1 | 0.037037 | 1 | 0 |
6d46e224ea22d8c34f361290da4efb349ee9aa59 | templates/api_define.rb | templates/api_define.rb | require 'aliyun/openapi'
module Aliyun::Openapi
Core::ApiDSL.define('openapi').<%= @product %>(version: '<%= @version %>').<%=@api_name%>.end_point do |end_point|
<% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include? k} %>
end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %>
<% end %>
end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
<% if @api_detail['isvProtocol']['pattern'] %>
end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
<% end %>
end
end | require 'aliyun/openapi'
module Aliyun::Openapi
Core::ApiDSL.define('openapi').<%= @product %>(version: '<%= @version %>').<%=@api_name%>.end_point do |end_point|
<% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include?(k) || v.empty? } %>
end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %><% end %>
# end point methods
end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
<% if @api_detail['isvProtocol']['pattern'] %>
# pattern to build url combine with params
end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
<% end %>
end
end
| Format api end point and remove empty params such as value switch | Format api end point and remove empty params such as value switch
| Ruby | apache-2.0 | aliyun-beta/aliyun-openapi-ruby-sdk | ruby | ## Code Before:
require 'aliyun/openapi'
module Aliyun::Openapi
Core::ApiDSL.define('openapi').<%= @product %>(version: '<%= @version %>').<%=@api_name%>.end_point do |end_point|
<% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include? k} %>
end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %>
<% end %>
end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
<% if @api_detail['isvProtocol']['pattern'] %>
end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
<% end %>
end
end
## Instruction:
Format api end point and remove empty params such as value switch
## Code After:
require 'aliyun/openapi'
module Aliyun::Openapi
Core::ApiDSL.define('openapi').<%= @product %>(version: '<%= @version %>').<%=@api_name%>.end_point do |end_point|
<% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include?(k) || v.empty? } %>
end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %><% end %>
# end point methods
end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
<% if @api_detail['isvProtocol']['pattern'] %>
# pattern to build url combine with params
end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
<% end %>
end
end
| require 'aliyun/openapi'
module Aliyun::Openapi
Core::ApiDSL.define('openapi').<%= @product %>(version: '<%= @version %>').<%=@api_name%>.end_point do |end_point|
- <% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include? k} %>
? -------- ^
+ <% @api_params.each do |param| %><% rest_param = param.reject {|k,v| ['tagName', 'type', 'required'].include?(k) || v.empty? } %>
? +++ ^^^^^^^^^^^^
- end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %>
? -
+ end_point.param <%= ":'#{param['tagName']}', :#{param['type']}, #{param['required']}, #{rest_param}" %><% end %>
? +++++++++
- <% end %>
+ # end point methods
- end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
? -
+ end_point.methods = <%= @api_detail['isvProtocol']['method'].split('|').to_s %>
- <% if @api_detail['isvProtocol']['pattern'] %>
? -
+ <% if @api_detail['isvProtocol']['pattern'] %>
+ # pattern to build url combine with params
- end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
? -
+ end_point.pattern = "<%= @api_detail['isvProtocol']['pattern'] %>"
- <% end %>
? -
+ <% end %>
end
end | 15 | 1.153846 | 8 | 7 |
0b03cd74c2f9f02fb27d82132504e54b75e65c61 | app/shared/modals/reservation-success/reservationSuccessModalSelector.js | app/shared/modals/reservation-success/reservationSuccessModalSelector.js | import { createSelector } from 'reselect';
import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';
const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;
const reservationSuccessModalSelector = createSelector(
resourcesSelector,
toShowSelector,
modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
(
resources,
reservationsToShow,
show
) => ({
reservationsToShow,
resources,
show,
})
);
export default reservationSuccessModalSelector;
| import { createStructuredSelector } from 'reselect';
import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';
const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;
const reservationSuccessModalSelector = createStructuredSelector({
reservationsToShow: toShowSelector,
resources: resourcesSelector,
show: modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
});
export default reservationSuccessModalSelector;
| Use structured selector in SuccessModalSelector | Use structured selector in SuccessModalSelector
Refs #473.
| JavaScript | mit | fastmonkeys/respa-ui | javascript | ## Code Before:
import { createSelector } from 'reselect';
import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';
const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;
const reservationSuccessModalSelector = createSelector(
resourcesSelector,
toShowSelector,
modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
(
resources,
reservationsToShow,
show
) => ({
reservationsToShow,
resources,
show,
})
);
export default reservationSuccessModalSelector;
## Instruction:
Use structured selector in SuccessModalSelector
Refs #473.
## Code After:
import { createStructuredSelector } from 'reselect';
import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';
const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;
const reservationSuccessModalSelector = createStructuredSelector({
reservationsToShow: toShowSelector,
resources: resourcesSelector,
show: modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
});
export default reservationSuccessModalSelector;
| - import { createSelector } from 'reselect';
+ import { createStructuredSelector } from 'reselect';
? ++++++++++
import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';
const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;
- const reservationSuccessModalSelector = createSelector(
+ const reservationSuccessModalSelector = createStructuredSelector({
? ++++++++++ +
+ reservationsToShow: toShowSelector,
- resourcesSelector,
+ resources: resourcesSelector,
? +++++++++++
- toShowSelector,
- modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
+ show: modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
? ++++++
- (
- resources,
- reservationsToShow,
- show
- ) => ({
- reservationsToShow,
- resources,
- show,
- })
- );
+ });
? +
export default reservationSuccessModalSelector; | 21 | 0.875 | 6 | 15 |
0ec2c192a3f8428bb487add6a70aef100f02c036 | segpy/portability.py | segpy/portability.py | import os
import sys
EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else ''
if sys.version_info >= (3, 0):
long_int = int
else:
long_int = long
if sys.version_info >= (3, 0):
def byte_string(integers):
return bytes(integers)
else:
def byte_string(integers):
return EMPTY_BYTE_STRING.join(chr(i) for i in integers)
if sys.version_info >= (3, 0):
import reprlib
reprlib = reprlib # Keep the static analyzer happy
else:
import repr as reprlib
if sys.version_info >= (3, 0):
izip = zip
from itertools import zip_longest as izip_longest
else:
from itertools import (izip, izip_longest)
izip = izip # Keep the static analyzer happy
izip_longest = izip_longest # Keep the static analyzer happy
if sys.version_info >= (3, 0):
def four_bytes(byte_str):
a, b, c, d = byte_str[:4]
return a, b, c, d
else:
def four_bytes(byte_str):
a = ord(byte_str[0])
b = ord(byte_str[1])
c = ord(byte_str[2])
d = ord(byte_str[3])
return a, b, c, d
if sys.version_info >= (3, 0):
unicode = str
else:
unicode = unicode
| import os
import sys
EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else ''
if sys.version_info >= (3, 0):
def byte_string(integers):
return bytes(integers)
else:
def byte_string(integers):
return EMPTY_BYTE_STRING.join(chr(i) for i in integers)
if sys.version_info >= (3, 0):
import reprlib
reprlib = reprlib # Keep the static analyzer happy
else:
import repr as reprlib
if sys.version_info >= (3, 0):
izip = zip
from itertools import zip_longest as izip_longest
else:
from itertools import (izip, izip_longest)
izip = izip # Keep the static analyzer happy
izip_longest = izip_longest # Keep the static analyzer happy
if sys.version_info >= (3, 0):
def four_bytes(byte_str):
a, b, c, d = byte_str[:4]
return a, b, c, d
else:
def four_bytes(byte_str):
a = ord(byte_str[0])
b = ord(byte_str[1])
c = ord(byte_str[2])
d = ord(byte_str[3])
return a, b, c, d
if sys.version_info >= (3, 0):
unicode = str
else:
unicode = unicode
| Remove Python 2.7 crutch for int/long | Remove Python 2.7 crutch for int/long
| Python | agpl-3.0 | hohogpb/segpy,abingham/segpy,kjellkongsvik/segpy,Kramer477/segpy,kwinkunks/segpy,stevejpurves/segpy,asbjorn/segpy | python | ## Code Before:
import os
import sys
EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else ''
if sys.version_info >= (3, 0):
long_int = int
else:
long_int = long
if sys.version_info >= (3, 0):
def byte_string(integers):
return bytes(integers)
else:
def byte_string(integers):
return EMPTY_BYTE_STRING.join(chr(i) for i in integers)
if sys.version_info >= (3, 0):
import reprlib
reprlib = reprlib # Keep the static analyzer happy
else:
import repr as reprlib
if sys.version_info >= (3, 0):
izip = zip
from itertools import zip_longest as izip_longest
else:
from itertools import (izip, izip_longest)
izip = izip # Keep the static analyzer happy
izip_longest = izip_longest # Keep the static analyzer happy
if sys.version_info >= (3, 0):
def four_bytes(byte_str):
a, b, c, d = byte_str[:4]
return a, b, c, d
else:
def four_bytes(byte_str):
a = ord(byte_str[0])
b = ord(byte_str[1])
c = ord(byte_str[2])
d = ord(byte_str[3])
return a, b, c, d
if sys.version_info >= (3, 0):
unicode = str
else:
unicode = unicode
## Instruction:
Remove Python 2.7 crutch for int/long
## Code After:
import os
import sys
EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else ''
if sys.version_info >= (3, 0):
def byte_string(integers):
return bytes(integers)
else:
def byte_string(integers):
return EMPTY_BYTE_STRING.join(chr(i) for i in integers)
if sys.version_info >= (3, 0):
import reprlib
reprlib = reprlib # Keep the static analyzer happy
else:
import repr as reprlib
if sys.version_info >= (3, 0):
izip = zip
from itertools import zip_longest as izip_longest
else:
from itertools import (izip, izip_longest)
izip = izip # Keep the static analyzer happy
izip_longest = izip_longest # Keep the static analyzer happy
if sys.version_info >= (3, 0):
def four_bytes(byte_str):
a, b, c, d = byte_str[:4]
return a, b, c, d
else:
def four_bytes(byte_str):
a = ord(byte_str[0])
b = ord(byte_str[1])
c = ord(byte_str[2])
d = ord(byte_str[3])
return a, b, c, d
if sys.version_info >= (3, 0):
unicode = str
else:
unicode = unicode
| import os
import sys
EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else ''
-
-
- if sys.version_info >= (3, 0):
- long_int = int
- else:
- long_int = long
if sys.version_info >= (3, 0):
def byte_string(integers):
return bytes(integers)
else:
def byte_string(integers):
return EMPTY_BYTE_STRING.join(chr(i) for i in integers)
if sys.version_info >= (3, 0):
import reprlib
reprlib = reprlib # Keep the static analyzer happy
else:
import repr as reprlib
if sys.version_info >= (3, 0):
izip = zip
from itertools import zip_longest as izip_longest
else:
from itertools import (izip, izip_longest)
izip = izip # Keep the static analyzer happy
izip_longest = izip_longest # Keep the static analyzer happy
if sys.version_info >= (3, 0):
def four_bytes(byte_str):
a, b, c, d = byte_str[:4]
return a, b, c, d
else:
def four_bytes(byte_str):
a = ord(byte_str[0])
b = ord(byte_str[1])
c = ord(byte_str[2])
d = ord(byte_str[3])
return a, b, c, d
if sys.version_info >= (3, 0):
unicode = str
else:
unicode = unicode
| 6 | 0.109091 | 0 | 6 |
b02fc632f312e66bbc38403d36e7c52b1efaaa1d | lib/buildr_plus/roles/replicant_qa_support.rb | lib/buildr_plus/roles/replicant_qa_support.rb |
BuildrPlus::Roles.role(:replicant_qa_support, :requires => [:role_replicant_shared]) do
project.publish = BuildrPlus::Artifacts.replicant_client?
if BuildrPlus::FeatureManager.activated?(:domgen)
generators = []
generators += [:imit_client_test_qa_external, :imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
generators += project.additional_domgen_generators
Domgen::Build.define_generate_task(generators, :buildr_project => project) do |t|
t.filter = project.domgen_filter
end
end
compile.with BuildrPlus::Libs.replicant_client_qa_support
BuildrPlus::Roles.merge_projects_with_role(project.compile, :replicant_shared)
package(:jar)
package(:sources)
end
|
BuildrPlus::Roles.role(:replicant_qa_support, :requires => [:role_replicant_shared]) do
project.publish = BuildrPlus::Artifacts.replicant_client?
if BuildrPlus::FeatureManager.activated?(:domgen)
generators = []
generators += [:imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
generators += project.additional_domgen_generators
Domgen::Build.define_generate_task(generators, :buildr_project => project) do |t|
t.filter = project.domgen_filter
end
end
compile.with BuildrPlus::Libs.replicant_client_qa_support
BuildrPlus::Roles.merge_projects_with_role(project.compile, :replicant_shared)
package(:jar)
package(:sources)
end
| Stop duplicate generation of code | Stop duplicate generation of code
| Ruby | apache-2.0 | realityforge/buildr_plus | ruby | ## Code Before:
BuildrPlus::Roles.role(:replicant_qa_support, :requires => [:role_replicant_shared]) do
project.publish = BuildrPlus::Artifacts.replicant_client?
if BuildrPlus::FeatureManager.activated?(:domgen)
generators = []
generators += [:imit_client_test_qa_external, :imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
generators += project.additional_domgen_generators
Domgen::Build.define_generate_task(generators, :buildr_project => project) do |t|
t.filter = project.domgen_filter
end
end
compile.with BuildrPlus::Libs.replicant_client_qa_support
BuildrPlus::Roles.merge_projects_with_role(project.compile, :replicant_shared)
package(:jar)
package(:sources)
end
## Instruction:
Stop duplicate generation of code
## Code After:
BuildrPlus::Roles.role(:replicant_qa_support, :requires => [:role_replicant_shared]) do
project.publish = BuildrPlus::Artifacts.replicant_client?
if BuildrPlus::FeatureManager.activated?(:domgen)
generators = []
generators += [:imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
generators += project.additional_domgen_generators
Domgen::Build.define_generate_task(generators, :buildr_project => project) do |t|
t.filter = project.domgen_filter
end
end
compile.with BuildrPlus::Libs.replicant_client_qa_support
BuildrPlus::Roles.merge_projects_with_role(project.compile, :replicant_shared)
package(:jar)
package(:sources)
end
|
BuildrPlus::Roles.role(:replicant_qa_support, :requires => [:role_replicant_shared]) do
project.publish = BuildrPlus::Artifacts.replicant_client?
if BuildrPlus::FeatureManager.activated?(:domgen)
generators = []
- generators += [:imit_client_test_qa_external, :imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
? -------------------------------
+ generators += [:imit_client_main_qa_external] if BuildrPlus::FeatureManager.activated?(:replicant)
generators += project.additional_domgen_generators
Domgen::Build.define_generate_task(generators, :buildr_project => project) do |t|
t.filter = project.domgen_filter
end
end
compile.with BuildrPlus::Libs.replicant_client_qa_support
BuildrPlus::Roles.merge_projects_with_role(project.compile, :replicant_shared)
package(:jar)
package(:sources)
end | 2 | 0.095238 | 1 | 1 |
fcdf09ac0c1e201c6f3156f7823b8c48a8205ae1 | test/UserTest.js | test/UserTest.js | var Connection = require('../models/Connection');
var User = require('../models/User');
exports.userRegistersConnections = function(test) {
test.expect(8);
var conn1 = new Connection({});
var conn2 = new Connection({});
var conn3 = new Connection({});
var user1 = new User("test1");
var user2 = new User("test2");
user1.add(conn1);
user1.add(conn2);
user1.add(conn3);
test.equal(user1.connections.count(), 3, "3 connections added");
user1.add(conn1);
test.equal(user1.connections.count(), 3, "Conn1 only added once");
user1.remove(conn1);
test.equal(user1.connections.count(), 2, "Conn1 removed");
test.equal(user1.connections.has(conn2.id), true, "Conn1 removed, 2 still there");
test.equal(user1.connections.has(conn3.id), true, "Conn1 removed, 3 still there");
user2.add(conn1);
user2.add(conn2);
conn1.close();
test.equal(user1.connections.count(), 2, "closed conn removed");
conn2.close();
conn3.close();
console.log(user1.connections.count());
test.equal(user1.connections.count(), 0, "all closed conn removed");
test.equal(user2.connections.count(), 0, "all closed conn removed");
test.done();
};
| var Connection = require('../models/Connection');
var User = require('../models/User');
exports.userRegistersConnections = function(test) {
test.expect(6);
var conn1 = new Connection({});
var conn2 = new Connection({});
var conn3 = new Connection({});
var user1 = new User("test1");
var user2 = new User("test2");
user1.add(conn1);
user1.add(conn2);
user1.add(conn3);
test.equal(user1.connections.count(), 3, "3 connections added");
user1.add(conn1);
test.equal(user1.connections.count(), 3, "Conn1 only added once");
user1.remove(conn1);
test.equal(user1.connections.count(), 2, "Conn1 removed");
test.equal(user1.connections.has(conn2.id), true, "Conn1 removed, 2 still there");
test.equal(user1.connections.has(conn3.id), true, "Conn1 removed, 3 still there");
user2.add(conn1);
user2.add(conn2);
/* user does not listen to CLOSE of connections, needs to be done by usermanager */
test.done();
};
| Remove unit tests that were based on previous functionality | Remove unit tests that were based on previous functionality
| JavaScript | mit | TURTED/TURTED_node | javascript | ## Code Before:
var Connection = require('../models/Connection');
var User = require('../models/User');
exports.userRegistersConnections = function(test) {
test.expect(8);
var conn1 = new Connection({});
var conn2 = new Connection({});
var conn3 = new Connection({});
var user1 = new User("test1");
var user2 = new User("test2");
user1.add(conn1);
user1.add(conn2);
user1.add(conn3);
test.equal(user1.connections.count(), 3, "3 connections added");
user1.add(conn1);
test.equal(user1.connections.count(), 3, "Conn1 only added once");
user1.remove(conn1);
test.equal(user1.connections.count(), 2, "Conn1 removed");
test.equal(user1.connections.has(conn2.id), true, "Conn1 removed, 2 still there");
test.equal(user1.connections.has(conn3.id), true, "Conn1 removed, 3 still there");
user2.add(conn1);
user2.add(conn2);
conn1.close();
test.equal(user1.connections.count(), 2, "closed conn removed");
conn2.close();
conn3.close();
console.log(user1.connections.count());
test.equal(user1.connections.count(), 0, "all closed conn removed");
test.equal(user2.connections.count(), 0, "all closed conn removed");
test.done();
};
## Instruction:
Remove unit tests that were based on previous functionality
## Code After:
var Connection = require('../models/Connection');
var User = require('../models/User');
exports.userRegistersConnections = function(test) {
test.expect(6);
var conn1 = new Connection({});
var conn2 = new Connection({});
var conn3 = new Connection({});
var user1 = new User("test1");
var user2 = new User("test2");
user1.add(conn1);
user1.add(conn2);
user1.add(conn3);
test.equal(user1.connections.count(), 3, "3 connections added");
user1.add(conn1);
test.equal(user1.connections.count(), 3, "Conn1 only added once");
user1.remove(conn1);
test.equal(user1.connections.count(), 2, "Conn1 removed");
test.equal(user1.connections.has(conn2.id), true, "Conn1 removed, 2 still there");
test.equal(user1.connections.has(conn3.id), true, "Conn1 removed, 3 still there");
user2.add(conn1);
user2.add(conn2);
/* user does not listen to CLOSE of connections, needs to be done by usermanager */
test.done();
};
| var Connection = require('../models/Connection');
var User = require('../models/User');
exports.userRegistersConnections = function(test) {
- test.expect(8);
? ^
+ test.expect(6);
? ^
var conn1 = new Connection({});
var conn2 = new Connection({});
var conn3 = new Connection({});
var user1 = new User("test1");
var user2 = new User("test2");
user1.add(conn1);
user1.add(conn2);
user1.add(conn3);
test.equal(user1.connections.count(), 3, "3 connections added");
user1.add(conn1);
test.equal(user1.connections.count(), 3, "Conn1 only added once");
user1.remove(conn1);
test.equal(user1.connections.count(), 2, "Conn1 removed");
test.equal(user1.connections.has(conn2.id), true, "Conn1 removed, 2 still there");
test.equal(user1.connections.has(conn3.id), true, "Conn1 removed, 3 still there");
user2.add(conn1);
user2.add(conn2);
+ /* user does not listen to CLOSE of connections, needs to be done by usermanager */
- conn1.close();
- test.equal(user1.connections.count(), 2, "closed conn removed");
-
- conn2.close();
- conn3.close();
- console.log(user1.connections.count());
- test.equal(user1.connections.count(), 0, "all closed conn removed");
- test.equal(user2.connections.count(), 0, "all closed conn removed");
-
test.done();
}; | 12 | 0.315789 | 2 | 10 |
2d0649a903cb076ce56dce581384be52442bdfcb | bash/aliases.bash | bash/aliases.bash | alias sudo="sudo "
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Git
alias g="git"
alias G="git"
# Vim
alias v="vim"
alias vv="vim ."
# Archives
alias mktar="tar -pvczf"
alias untar="tar -zxvf"
# Remove all items from the dock
alias cleardock="defaults write com.apple.dock persistent-apps -array \"\" && killall Dock"
| alias sudo="sudo "
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Git
alias g="git"
alias G="git"
# Vim
alias v="vim"
alias vv="vim ."
# Archives
alias mktar="tar -pvczf"
alias untar="tar -zxvf"
# Remove all items from the dock
alias cleardock="defaults write com.apple.dock persistent-apps -array \"\" && killall Dock"
alias fd="fd --hidden"
| Add fd alias to include hidden files | Add fd alias to include hidden files
| Shell | mit | keith/dotfiles,keith/dotfiles,keith/dotfiles,keith/dotfiles,keith/dotfiles,keith/dotfiles | shell | ## Code Before:
alias sudo="sudo "
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Git
alias g="git"
alias G="git"
# Vim
alias v="vim"
alias vv="vim ."
# Archives
alias mktar="tar -pvczf"
alias untar="tar -zxvf"
# Remove all items from the dock
alias cleardock="defaults write com.apple.dock persistent-apps -array \"\" && killall Dock"
## Instruction:
Add fd alias to include hidden files
## Code After:
alias sudo="sudo "
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Git
alias g="git"
alias G="git"
# Vim
alias v="vim"
alias vv="vim ."
# Archives
alias mktar="tar -pvczf"
alias untar="tar -zxvf"
# Remove all items from the dock
alias cleardock="defaults write com.apple.dock persistent-apps -array \"\" && killall Dock"
alias fd="fd --hidden"
| alias sudo="sudo "
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Git
alias g="git"
alias G="git"
# Vim
alias v="vim"
alias vv="vim ."
# Archives
alias mktar="tar -pvczf"
alias untar="tar -zxvf"
# Remove all items from the dock
alias cleardock="defaults write com.apple.dock persistent-apps -array \"\" && killall Dock"
+
+ alias fd="fd --hidden" | 2 | 0.090909 | 2 | 0 |
ba17d882e72582d5396fa3a3dfb6292656f63b30 | lib/index.js | lib/index.js | 'use strict';
// VARIABLES //
var FLOAT32_VIEW = new Float32Array( 1 );
var UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );
// 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000
var PINF = 0x7f800000;
// Set the ArrayBuffer bit sequence:
UINT32_VIEW[ 0 ] = PINF;
// EXPORTS //
module.exports = FLOAT32_VIEW[ 0 ];
| 'use strict';
// VARIABLES //
var FLOAT32_VIEW = new Float32Array( 1 );
var UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );
// 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000 (see IEEE 754-2008)
var PINF = 0x7f800000;
// Set the ArrayBuffer bit sequence:
UINT32_VIEW[ 0 ] = PINF;
// EXPORTS //
module.exports = FLOAT32_VIEW[ 0 ];
| Add code comment re: IEEE 754-2008 | Add code comment re: IEEE 754-2008
| JavaScript | mit | const-io/pinf-float32 | javascript | ## Code Before:
'use strict';
// VARIABLES //
var FLOAT32_VIEW = new Float32Array( 1 );
var UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );
// 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000
var PINF = 0x7f800000;
// Set the ArrayBuffer bit sequence:
UINT32_VIEW[ 0 ] = PINF;
// EXPORTS //
module.exports = FLOAT32_VIEW[ 0 ];
## Instruction:
Add code comment re: IEEE 754-2008
## Code After:
'use strict';
// VARIABLES //
var FLOAT32_VIEW = new Float32Array( 1 );
var UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );
// 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000 (see IEEE 754-2008)
var PINF = 0x7f800000;
// Set the ArrayBuffer bit sequence:
UINT32_VIEW[ 0 ] = PINF;
// EXPORTS //
module.exports = FLOAT32_VIEW[ 0 ];
| 'use strict';
// VARIABLES //
var FLOAT32_VIEW = new Float32Array( 1 );
var UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );
- // 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000
+ // 0 11111111 00000000000000000000000 => 2139095040 => 0x7f800000 (see IEEE 754-2008)
? ++++++++++++++++++++
var PINF = 0x7f800000;
// Set the ArrayBuffer bit sequence:
UINT32_VIEW[ 0 ] = PINF;
// EXPORTS //
module.exports = FLOAT32_VIEW[ 0 ]; | 2 | 0.117647 | 1 | 1 |
fca363dec1ff73e34e25084322d5a31dd6fbc1ee | simplestatistics/statistics/coefficient_of_variation.py | simplestatistics/statistics/coefficient_of_variation.py | from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data):
"""
The `coefficient_of_variation`_ is the ratio of the standard deviation to the mean
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data: A list of numerical objects.
Returns:
A float object.
Examples:
>>> coefficient_of_variation([1, 2, 3])
0.5
>>> coefficient_of_variation([1, 2, 3, 4])
0.5163977794943222
>>> coefficient_of_variation([-1, 0, 1, 2, 3, 4])
1.247219128924647
"""
return standard_deviation(data) / mean(data)
| from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data, sample = True):
"""
The `coefficient of variation`_ is the ratio of the standard deviation to the mean.
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data: A list of numerical objects.
Returns:
A float object.
Examples:
>>> coefficient_of_variation([1, 2, 3])
0.5
>>> ss.coefficient_of_variation([1, 2, 3], False)
0.408248290463863
>>> coefficient_of_variation([1, 2, 3, 4])
0.5163977794943222
>>> coefficient_of_variation([-1, 0, 1, 2, 3, 4])
1.247219128924647
"""
return standard_deviation(data, sample) / mean(data)
| Add sample param to CV function | Add sample param to CV function
Boolean param to make possible to calculate coefficient of variation
for population (default is sample).
| Python | unknown | tmcw/simple-statistics-py,sheriferson/simplestatistics,sheriferson/simple-statistics-py | python | ## Code Before:
from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data):
"""
The `coefficient_of_variation`_ is the ratio of the standard deviation to the mean
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data: A list of numerical objects.
Returns:
A float object.
Examples:
>>> coefficient_of_variation([1, 2, 3])
0.5
>>> coefficient_of_variation([1, 2, 3, 4])
0.5163977794943222
>>> coefficient_of_variation([-1, 0, 1, 2, 3, 4])
1.247219128924647
"""
return standard_deviation(data) / mean(data)
## Instruction:
Add sample param to CV function
Boolean param to make possible to calculate coefficient of variation
for population (default is sample).
## Code After:
from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data, sample = True):
"""
The `coefficient of variation`_ is the ratio of the standard deviation to the mean.
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data: A list of numerical objects.
Returns:
A float object.
Examples:
>>> coefficient_of_variation([1, 2, 3])
0.5
>>> ss.coefficient_of_variation([1, 2, 3], False)
0.408248290463863
>>> coefficient_of_variation([1, 2, 3, 4])
0.5163977794943222
>>> coefficient_of_variation([-1, 0, 1, 2, 3, 4])
1.247219128924647
"""
return standard_deviation(data, sample) / mean(data)
| from .standard_deviation import standard_deviation
from .mean import mean
- def coefficient_of_variation(data):
+ def coefficient_of_variation(data, sample = True):
? +++++++++++++++
"""
- The `coefficient_of_variation`_ is the ratio of the standard deviation to the mean
? ^ ^
+ The `coefficient of variation`_ is the ratio of the standard deviation to the mean.
? ^ ^ +
+
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data: A list of numerical objects.
Returns:
A float object.
Examples:
>>> coefficient_of_variation([1, 2, 3])
0.5
+ >>> ss.coefficient_of_variation([1, 2, 3], False)
+ 0.408248290463863
>>> coefficient_of_variation([1, 2, 3, 4])
0.5163977794943222
>>> coefficient_of_variation([-1, 0, 1, 2, 3, 4])
1.247219128924647
"""
- return standard_deviation(data) / mean(data)
+ return standard_deviation(data, sample) / mean(data)
? ++++++++
- | 10 | 0.454545 | 6 | 4 |
d9c35d9b639df186c2046459db565c86964cc87b | test/hypem-resolver-test.js | test/hypem-resolver-test.js | // Copyright 2015 Fabian Dietenberger
var should = require('chai').should(),
hypemResolver = require('../hypem-resolver');
describe('Use the hypem link to get the songs url', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getUrl('adad');
soundcloudUrl.should.be.a('string');
done();
})
});
}); | // Copyright 2015 Fabian Dietenberger
var should = require('chai').should(),
hypemResolver = require('../hypem-resolver');
var grizHypemId = "2c87x",
grizHypemUrl = "http://hypem.com/track/2c87x",
grizSoundcloudUrl = "https://soundcloud.com/griz/summer-97-ft-muzzy-bearr";
describe('Get the songs URL with the hypem URL', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getByUrl(grizHypemUrl);
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
})
});
});
describe('Get the songs URL with the hypem URL async', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
hypemResolver.getByUrlAsync(grizHypemUrl, function (soundcloudUrl) {
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
});
})
});
});
describe('Get the songs URL with the hypem ID', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getById(grizHypemId);
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
})
});
});
describe('Get the songs URL with the hypem ID async', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
hypemResolver.getByIdAsync(grizHypemId, function (soundcloudUrl) {
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
});
})
});
}); | Add tests for the async methods | Add tests for the async methods
| JavaScript | mit | feedm3/hypem-resolver | javascript | ## Code Before:
// Copyright 2015 Fabian Dietenberger
var should = require('chai').should(),
hypemResolver = require('../hypem-resolver');
describe('Use the hypem link to get the songs url', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getUrl('adad');
soundcloudUrl.should.be.a('string');
done();
})
});
});
## Instruction:
Add tests for the async methods
## Code After:
// Copyright 2015 Fabian Dietenberger
var should = require('chai').should(),
hypemResolver = require('../hypem-resolver');
var grizHypemId = "2c87x",
grizHypemUrl = "http://hypem.com/track/2c87x",
grizSoundcloudUrl = "https://soundcloud.com/griz/summer-97-ft-muzzy-bearr";
describe('Get the songs URL with the hypem URL', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getByUrl(grizHypemUrl);
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
})
});
});
describe('Get the songs URL with the hypem URL async', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
hypemResolver.getByUrlAsync(grizHypemUrl, function (soundcloudUrl) {
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
});
})
});
});
describe('Get the songs URL with the hypem ID', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
var soundcloudUrl = hypemResolver.getById(grizHypemId);
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
})
});
});
describe('Get the songs URL with the hypem ID async', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
hypemResolver.getByIdAsync(grizHypemId, function (soundcloudUrl) {
soundcloudUrl.should.be.a('string');
soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
});
})
});
}); | // Copyright 2015 Fabian Dietenberger
var should = require('chai').should(),
hypemResolver = require('../hypem-resolver');
- describe('Use the hypem link to get the songs url', function () {
+ var grizHypemId = "2c87x",
+ grizHypemUrl = "http://hypem.com/track/2c87x",
+ grizSoundcloudUrl = "https://soundcloud.com/griz/summer-97-ft-muzzy-bearr";
+
+
+ describe('Get the songs URL with the hypem URL', function () {
describe('if the song is hosted on soundcloud', function () {
it('should return a soundcloud url', function (done) {
- var soundcloudUrl = hypemResolver.getUrl('adad');
? ^^^^^^
+ var soundcloudUrl = hypemResolver.getByUrl(grizHypemUrl);
? ++ ^^^^^^^^^^^^
soundcloudUrl.should.be.a('string');
+ soundcloudUrl.should.equal(grizSoundcloudUrl);
done();
})
});
});
+
+ describe('Get the songs URL with the hypem URL async', function () {
+ describe('if the song is hosted on soundcloud', function () {
+ it('should return a soundcloud url', function (done) {
+ hypemResolver.getByUrlAsync(grizHypemUrl, function (soundcloudUrl) {
+ soundcloudUrl.should.be.a('string');
+ soundcloudUrl.should.equal(grizSoundcloudUrl);
+ done();
+ });
+ })
+ });
+ });
+
+ describe('Get the songs URL with the hypem ID', function () {
+ describe('if the song is hosted on soundcloud', function () {
+ it('should return a soundcloud url', function (done) {
+ var soundcloudUrl = hypemResolver.getById(grizHypemId);
+ soundcloudUrl.should.be.a('string');
+ soundcloudUrl.should.equal(grizSoundcloudUrl);
+ done();
+ })
+ });
+ });
+
+ describe('Get the songs URL with the hypem ID async', function () {
+ describe('if the song is hosted on soundcloud', function () {
+ it('should return a soundcloud url', function (done) {
+ hypemResolver.getByIdAsync(grizHypemId, function (soundcloudUrl) {
+ soundcloudUrl.should.be.a('string');
+ soundcloudUrl.should.equal(grizSoundcloudUrl);
+ done();
+ });
+ })
+ });
+ }); | 45 | 3.214286 | 43 | 2 |
b5e2eb38a41e6d425c6b409cea35b852b3e9ec84 | lib/connect-csrf-lite.js | lib/connect-csrf-lite.js | var assert = require('assert');
var connect = require('connect');
var csrf = require('csrf-lite');
var extend = require('obj-extend');
module.exports = function (options) {
options = extend({
tokenKey: 'csrfToken',
dataKey: 'body'
}, options);
return function connectCsrf (req, res, next) {
// Grab the token off the request object or create one
var token = req[options.tokenKey] = req[options.tokenKey] || csrf();
// Create a helper function to print a csrf form input
req.csrfInput = res.locals.csrfInput = function () {
return csrf.html(token);
};
// CSRF validation
// https://github.com/senchalabs/connect/blob/2.12.0/lib/middleware/csrf.js#L76
if (!req.method.match(/^(GET|HEAD|OPTIONS)$/)) {
var data = req[options.dataKey] || {};
var valid = csrf.validate(data, token);
if (!valid) {
return next(connect.utils.error(403));
}
}
next();
};
};
| var assert = require('assert');
var connect = require('connect');
var csrf = require('csrf-lite');
var extend = require('obj-extend');
module.exports = function (options) {
options = extend({
tokenKey: 'csrfToken',
dataKey: 'body'
}, options);
return function connectCsrf (req, res, next) {
// Grab the token off the request object or create one
var token = req[options.tokenKey];
if (token === undefined) {
token = csrf();
req[options.tokenKey] = token;
}
// Create a helper function to print a csrf form input
req.csrfInput = res.locals.csrfInput = function () {
return csrf.html(token);
};
// CSRF validation
// https://github.com/senchalabs/connect/blob/2.12.0/lib/middleware/csrf.js#L76
if (!req.method.match(/^(GET|HEAD|OPTIONS)$/)) {
var data = req[options.dataKey] || {};
var valid = csrf.validate(data, token);
if (!valid) {
return next(connect.utils.error(403));
}
}
next();
};
};
| Make token creation a little easier to read | Make token creation a little easier to read
| JavaScript | mit | uber/connect-csrf-lite | javascript | ## Code Before:
var assert = require('assert');
var connect = require('connect');
var csrf = require('csrf-lite');
var extend = require('obj-extend');
module.exports = function (options) {
options = extend({
tokenKey: 'csrfToken',
dataKey: 'body'
}, options);
return function connectCsrf (req, res, next) {
// Grab the token off the request object or create one
var token = req[options.tokenKey] = req[options.tokenKey] || csrf();
// Create a helper function to print a csrf form input
req.csrfInput = res.locals.csrfInput = function () {
return csrf.html(token);
};
// CSRF validation
// https://github.com/senchalabs/connect/blob/2.12.0/lib/middleware/csrf.js#L76
if (!req.method.match(/^(GET|HEAD|OPTIONS)$/)) {
var data = req[options.dataKey] || {};
var valid = csrf.validate(data, token);
if (!valid) {
return next(connect.utils.error(403));
}
}
next();
};
};
## Instruction:
Make token creation a little easier to read
## Code After:
var assert = require('assert');
var connect = require('connect');
var csrf = require('csrf-lite');
var extend = require('obj-extend');
module.exports = function (options) {
options = extend({
tokenKey: 'csrfToken',
dataKey: 'body'
}, options);
return function connectCsrf (req, res, next) {
// Grab the token off the request object or create one
var token = req[options.tokenKey];
if (token === undefined) {
token = csrf();
req[options.tokenKey] = token;
}
// Create a helper function to print a csrf form input
req.csrfInput = res.locals.csrfInput = function () {
return csrf.html(token);
};
// CSRF validation
// https://github.com/senchalabs/connect/blob/2.12.0/lib/middleware/csrf.js#L76
if (!req.method.match(/^(GET|HEAD|OPTIONS)$/)) {
var data = req[options.dataKey] || {};
var valid = csrf.validate(data, token);
if (!valid) {
return next(connect.utils.error(403));
}
}
next();
};
};
| var assert = require('assert');
var connect = require('connect');
var csrf = require('csrf-lite');
var extend = require('obj-extend');
module.exports = function (options) {
options = extend({
tokenKey: 'csrfToken',
dataKey: 'body'
}, options);
return function connectCsrf (req, res, next) {
// Grab the token off the request object or create one
- var token = req[options.tokenKey] = req[options.tokenKey] || csrf();
+ var token = req[options.tokenKey];
+ if (token === undefined) {
+ token = csrf();
+ req[options.tokenKey] = token;
+ }
// Create a helper function to print a csrf form input
req.csrfInput = res.locals.csrfInput = function () {
return csrf.html(token);
};
// CSRF validation
// https://github.com/senchalabs/connect/blob/2.12.0/lib/middleware/csrf.js#L76
if (!req.method.match(/^(GET|HEAD|OPTIONS)$/)) {
var data = req[options.dataKey] || {};
var valid = csrf.validate(data, token);
if (!valid) {
return next(connect.utils.error(403));
}
}
next();
};
}; | 6 | 0.181818 | 5 | 1 |
bb8d8358a7a1bffa0f376c68d07139b3a7f0f245 | .travis.yml | .travis.yml | language: java
jdk:
- oraclejdk8
- oraclejdk7
- oraclejdk6
- oraclejdk5
- openjdk8
- openjdk7
- openjdk6
- openjdk5
install: mvn install -DskipTests=true -B
script: mvn test -B
after_success:
- mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura
| language: java
jdk:
- oraclejdk7
- oraclejdk6
- oraclejdk5
- openjdk7
- openjdk6
- openjdk5
install: mvn install -DskipTests=true -B
script: mvn test -B
after_success:
- mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura
| Revert "added jdk 8 (oraclejdk and openjdk)" | Revert "added jdk 8 (oraclejdk and openjdk)"
This reverts commit 99f038f2bac3325ee262f9b4d642be18abdd08ce.
| YAML | bsd-3-clause | FrimaStudio/owner,gintau/owner,jghoman/owner,lviggiano/owner,kevin-canadian/owner,rrialq/owner,rrialq/owner,jghoman/owner,StFS/owner,kevin-canadian/owner,lviggiano/owner,jghoman/owner,lightglitch/owner,lightglitch/owner,StFS/owner,kevin-canadian/owner,lviggiano/owner,StFS/owner,gintau/owner,gintau/owner,lightglitch/owner,FrimaStudio/owner,rrialq/owner,FrimaStudio/owner | yaml | ## Code Before:
language: java
jdk:
- oraclejdk8
- oraclejdk7
- oraclejdk6
- oraclejdk5
- openjdk8
- openjdk7
- openjdk6
- openjdk5
install: mvn install -DskipTests=true -B
script: mvn test -B
after_success:
- mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura
## Instruction:
Revert "added jdk 8 (oraclejdk and openjdk)"
This reverts commit 99f038f2bac3325ee262f9b4d642be18abdd08ce.
## Code After:
language: java
jdk:
- oraclejdk7
- oraclejdk6
- oraclejdk5
- openjdk7
- openjdk6
- openjdk5
install: mvn install -DskipTests=true -B
script: mvn test -B
after_success:
- mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura
| language: java
jdk:
- - oraclejdk8
- oraclejdk7
- oraclejdk6
- oraclejdk5
- - openjdk8
- openjdk7
- openjdk6
- openjdk5
install: mvn install -DskipTests=true -B
script: mvn test -B
after_success:
- mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:cobertura | 2 | 0.133333 | 0 | 2 |
7e4fc8857284c539ce91dd53f11b460a6c9b1633 | scrapi/settings/local-dist.py | scrapi/settings/local-dist.py | RAW_PROCESSING = ['cassandra']
NORMALIZED_PROCESSING = ['elasticsearch', 'cassandra']
| RAW_PROCESSING = ['postgres']
NORMALIZED_PROCESSING = ['elasticsearch', 'postgres']
RESPONSE_PROCESSOR = 'postgres'
| Fix local dist to see if that fixes things | Fix local dist to see if that fixes things
| Python | apache-2.0 | erinspace/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi | python | ## Code Before:
RAW_PROCESSING = ['cassandra']
NORMALIZED_PROCESSING = ['elasticsearch', 'cassandra']
## Instruction:
Fix local dist to see if that fixes things
## Code After:
RAW_PROCESSING = ['postgres']
NORMALIZED_PROCESSING = ['elasticsearch', 'postgres']
RESPONSE_PROCESSOR = 'postgres'
| - RAW_PROCESSING = ['cassandra']
? ^^ -----
+ RAW_PROCESSING = ['postgres']
? ^^ ++++
- NORMALIZED_PROCESSING = ['elasticsearch', 'cassandra']
? ^^ -----
+ NORMALIZED_PROCESSING = ['elasticsearch', 'postgres']
? ^^ ++++
+ RESPONSE_PROCESSOR = 'postgres' | 5 | 2.5 | 3 | 2 |
ac823baeb46b190f2faaa3b837de79a938458c8f | app/views/layouts/_head.html.erb | app/views/layouts/_head.html.erb | <title>Aqueous | Groove Rock <%= "| #{@title}" if @title %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords" content="Aqueous, Band, Aqueous Band, Buffalo, New York, Rock, Jamband, Progessive" />
<meta name="description" content="Groovy rock band that uses gratifying harmonies and multiple soundscapes to build an intense bond with the crowd through an improvisational foundation." />
<meta property="og:site_name" content="Aqueous">
<%= tag :meta, property: "og:url", content: request.url %>
<%= tag :meta, property: "og:title", content: @title || "Aqueous - Groove Rock" %>
<%= tag :meta, property: "og:image", content: @og_image || "https://s3.amazonaws.com/files.aqueousband.net/images/bestinshow_albumart.jpg" %>
<%= tag :meta, property: "og:description", content: @og_description if @og_description %>
<%= tag :meta, property: "og:updated_time", content: @og_updated_time.to_i if @og_updated_time %>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
| <title>Aqueous | Groove Rock <%= "| #{@title}" if @title %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords" content="Aqueous, Band, Aqueous Band, Buffalo, New York, Rock, Jamband, Progessive" />
<meta name="description" content="Groovy rock band that uses gratifying harmonies and multiple soundscapes to build an intense bond with the crowd through an improvisational foundation." />
<meta property="og:site_name" content="Aqueous">
<%= tag :meta, property: "og:url", content: request.url %>
<%= tag :meta, property: "og:title", content: @title || "Aqueous - Groove Rock" %>
<%= tag :meta, property: "og:image", content: @og_image || asset_url('photos/fall2016.jpg') %>
<%= tag :meta, property: "og:description", content: @og_description if @og_description %>
<%= tag :meta, property: "og:updated_time", content: @og_updated_time.to_i if @og_updated_time %>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
| Change the og:image to the band photo | Change the og:image to the band photo
| HTML+ERB | mit | qrush/skyway,qrush/skyway,qrush/skyway,qrush/skyway | html+erb | ## Code Before:
<title>Aqueous | Groove Rock <%= "| #{@title}" if @title %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords" content="Aqueous, Band, Aqueous Band, Buffalo, New York, Rock, Jamband, Progessive" />
<meta name="description" content="Groovy rock band that uses gratifying harmonies and multiple soundscapes to build an intense bond with the crowd through an improvisational foundation." />
<meta property="og:site_name" content="Aqueous">
<%= tag :meta, property: "og:url", content: request.url %>
<%= tag :meta, property: "og:title", content: @title || "Aqueous - Groove Rock" %>
<%= tag :meta, property: "og:image", content: @og_image || "https://s3.amazonaws.com/files.aqueousband.net/images/bestinshow_albumart.jpg" %>
<%= tag :meta, property: "og:description", content: @og_description if @og_description %>
<%= tag :meta, property: "og:updated_time", content: @og_updated_time.to_i if @og_updated_time %>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
## Instruction:
Change the og:image to the band photo
## Code After:
<title>Aqueous | Groove Rock <%= "| #{@title}" if @title %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords" content="Aqueous, Band, Aqueous Band, Buffalo, New York, Rock, Jamband, Progessive" />
<meta name="description" content="Groovy rock band that uses gratifying harmonies and multiple soundscapes to build an intense bond with the crowd through an improvisational foundation." />
<meta property="og:site_name" content="Aqueous">
<%= tag :meta, property: "og:url", content: request.url %>
<%= tag :meta, property: "og:title", content: @title || "Aqueous - Groove Rock" %>
<%= tag :meta, property: "og:image", content: @og_image || asset_url('photos/fall2016.jpg') %>
<%= tag :meta, property: "og:description", content: @og_description if @og_description %>
<%= tag :meta, property: "og:updated_time", content: @og_updated_time.to_i if @og_updated_time %>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
| <title>Aqueous | Groove Rock <%= "| #{@title}" if @title %></title>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords" content="Aqueous, Band, Aqueous Band, Buffalo, New York, Rock, Jamband, Progessive" />
<meta name="description" content="Groovy rock band that uses gratifying harmonies and multiple soundscapes to build an intense bond with the crowd through an improvisational foundation." />
<meta property="og:site_name" content="Aqueous">
<%= tag :meta, property: "og:url", content: request.url %>
<%= tag :meta, property: "og:title", content: @title || "Aqueous - Groove Rock" %>
- <%= tag :meta, property: "og:image", content: @og_image || "https://s3.amazonaws.com/files.aqueousband.net/images/bestinshow_albumart.jpg" %>
+ <%= tag :meta, property: "og:image", content: @og_image || asset_url('photos/fall2016.jpg') %>
<%= tag :meta, property: "og:description", content: @og_description if @og_description %>
<%= tag :meta, property: "og:updated_time", content: @og_updated_time.to_i if @og_updated_time %>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'> | 2 | 0.142857 | 1 | 1 |
3ea1c6b718e19d99d123feb734ca5f1a44174bf9 | Lib/test/test_fcntl.py | Lib/test/test_fcntl.py | import struct
import fcntl
import FCNTL
import os
from test_support import verbose
filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
rv = fcntl.fcntl(f.fileno(), FCNTL.O_NDELAY, 1)
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose:
print 'struct.pack: ', lockdata
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
if verbose:
print 'String from fcntl with F_SETLKW: ', rv
f.close()
os.unlink(filename)
| import struct
import fcntl
import FCNTL
import os
from test_support import verbose
filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY)
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose:
print 'struct.pack: ', `lockdata`
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
if verbose:
print 'String from fcntl with F_SETLKW: ', `rv`
f.close()
os.unlink(filename)
| Fix the NDELAY test; avoid outputting binary garbage. | Fix the NDELAY test; avoid outputting binary garbage.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | python | ## Code Before:
import struct
import fcntl
import FCNTL
import os
from test_support import verbose
filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
rv = fcntl.fcntl(f.fileno(), FCNTL.O_NDELAY, 1)
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose:
print 'struct.pack: ', lockdata
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
if verbose:
print 'String from fcntl with F_SETLKW: ', rv
f.close()
os.unlink(filename)
## Instruction:
Fix the NDELAY test; avoid outputting binary garbage.
## Code After:
import struct
import fcntl
import FCNTL
import os
from test_support import verbose
filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY)
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose:
print 'struct.pack: ', `lockdata`
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
if verbose:
print 'String from fcntl with F_SETLKW: ', `rv`
f.close()
os.unlink(filename)
| import struct
import fcntl
import FCNTL
import os
from test_support import verbose
filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
- rv = fcntl.fcntl(f.fileno(), FCNTL.O_NDELAY, 1)
? ^ ---
+ rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY)
? ^ ++++++++++++++
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose:
- print 'struct.pack: ', lockdata
+ print 'struct.pack: ', `lockdata`
? + +
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
if verbose:
- print 'String from fcntl with F_SETLKW: ', rv
+ print 'String from fcntl with F_SETLKW: ', `rv`
? + +
f.close()
os.unlink(filename) | 6 | 0.25 | 3 | 3 |
957526247245289e194cd0237cb6a4de19b84314 | dev-requirements.txt | dev-requirements.txt | -e .
# Install our development requirements
check-manifest
invoke
tox
wheel
| -e .
# Install our development requirements
check-manifest
invoke
mock
pretend
tox
wheel
| Add missing deps for running tests | Add missing deps for running tests
| Text | apache-2.0 | techtonik/warehouse,techtonik/warehouse | text | ## Code Before:
-e .
# Install our development requirements
check-manifest
invoke
tox
wheel
## Instruction:
Add missing deps for running tests
## Code After:
-e .
# Install our development requirements
check-manifest
invoke
mock
pretend
tox
wheel
| -e .
# Install our development requirements
check-manifest
invoke
+ mock
+ pretend
tox
wheel | 2 | 0.285714 | 2 | 0 |
eda451f314c077fb163df82ad4743de432098b23 | t/register/proof.js | t/register/proof.js | module.exports = require('proof')(function () {
var register = require('../../register')
var stream = require('stream')
var path = require('path')
return {
once: function (step, directory, argv, stdin) {
step(function () {
register.once(__dirname, directory, argv, stdin, step())
}, function (request, server) {
var stdout = new stream.PassThrough
stdout.setEncoding('utf8')
step(function () {
request.pipe(stdout)
request.on('end', step(-1))
if (!server.closed) server.on('close', step(-1))
}, function () {
return {
statusCode: request.statusCode,
headers: request.headers,
body: stdout.read()
}
})
})
}
}
})
| module.exports = require('proof')(function () {
var register = require('../../register')
var stream = require('stream')
var path = require('path')
var once = require('../../once')
return {
once: function (step, path, parameters, stdin) {
return once(__dirname + '/' + path, parameters, stdin, step())
}
}
})
| Use module `once` method in test harness. | Use module `once` method in test harness.
Closes #67.
| JavaScript | mit | bigeasy/register,bigeasy/register | javascript | ## Code Before:
module.exports = require('proof')(function () {
var register = require('../../register')
var stream = require('stream')
var path = require('path')
return {
once: function (step, directory, argv, stdin) {
step(function () {
register.once(__dirname, directory, argv, stdin, step())
}, function (request, server) {
var stdout = new stream.PassThrough
stdout.setEncoding('utf8')
step(function () {
request.pipe(stdout)
request.on('end', step(-1))
if (!server.closed) server.on('close', step(-1))
}, function () {
return {
statusCode: request.statusCode,
headers: request.headers,
body: stdout.read()
}
})
})
}
}
})
## Instruction:
Use module `once` method in test harness.
Closes #67.
## Code After:
module.exports = require('proof')(function () {
var register = require('../../register')
var stream = require('stream')
var path = require('path')
var once = require('../../once')
return {
once: function (step, path, parameters, stdin) {
return once(__dirname + '/' + path, parameters, stdin, step())
}
}
})
| module.exports = require('proof')(function () {
var register = require('../../register')
var stream = require('stream')
var path = require('path')
+ var once = require('../../once')
return {
- once: function (step, directory, argv, stdin) {
? ^^^^^ ^^^ ^^
+ once: function (step, path, parameters, stdin) {
? ^^ ^ + ^^^^^^^
+ return once(__dirname + '/' + path, parameters, stdin, step())
- step(function () {
- register.once(__dirname, directory, argv, stdin, step())
- }, function (request, server) {
- var stdout = new stream.PassThrough
- stdout.setEncoding('utf8')
- step(function () {
- request.pipe(stdout)
- request.on('end', step(-1))
- if (!server.closed) server.on('close', step(-1))
- }, function () {
- return {
- statusCode: request.statusCode,
- headers: request.headers,
- body: stdout.read()
- }
- })
- })
}
}
}) | 21 | 0.807692 | 3 | 18 |
7c7e32d7a725d8a5b7496f896eb4649491da3735 | models/collector_profile.coffee | models/collector_profile.coffee | _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"
defaults:
session_id: SESSION_ID
fetch: (options = {}) ->
options.data = _.extend options.data or {}, @pick('anonymous_session_id'), session_id: SESSION_ID
super options
instantiate: (options = {}) ->
{ success, error } = options
options = _.omit options, 'success', 'error'
Q.promise (resolve, reject) =>
@fetch _.extend {}, options,
success: ->
resolve arguments...
success? arguments...
error: =>
@save {},
success: ->
resolve arguments...
success? arguments...
error: ->
reject arguments...
error? arguments...
| _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"
validHashFields: [
'owner'
'institutional_affiliations'
'confirmed_buyer_at'
'collector_level'
]
fetch: (options = {}) ->
options.data = _.extend options.data or {}, @pick('anonymous_session_id'), session_id: SESSION_ID
super options
instantiate: (options = {}) ->
{ success, error } = options
options = _.omit options, 'success', 'error'
Q.promise (resolve, reject) =>
@fetch _.extend {}, options,
success: ->
resolve arguments...
success? arguments...
error: =>
@save {},
success: ->
resolve arguments...
success? arguments...
error: ->
reject arguments...
error? arguments...
| Remove defaults; add an Array of valid hash fields as a hack around a broken API | Remove defaults; add an Array of valid hash fields as a hack around a broken API
| CoffeeScript | mit | xtina-starr/force,erikdstock/force,cavvia/force-1,artsy/force,izakp/force,damassi/force,oxaudo/force,kanaabe/force,xtina-starr/force,TribeMedia/force-public,anandaroop/force,eessex/force,izakp/force,anandaroop/force,joeyAghion/force,artsy/force-public,mzikherman/force,eessex/force,joeyAghion/force,kanaabe/force,mzikherman/force,anandaroop/force,yuki24/force,mzikherman/force,damassi/force,izakp/force,izakp/force,eessex/force,cavvia/force-1,damassi/force,yuki24/force,artsy/force,yuki24/force,dblock/force,anandaroop/force,damassi/force,oxaudo/force,artsy/force-public,cavvia/force-1,eessex/force,kanaabe/force,mzikherman/force,yuki24/force,erikdstock/force,oxaudo/force,TribeMedia/force-public,oxaudo/force,erikdstock/force,kanaabe/force,xtina-starr/force,joeyAghion/force,dblock/force,cavvia/force-1,artsy/force,kanaabe/force,xtina-starr/force,joeyAghion/force,erikdstock/force,artsy/force,dblock/force | coffeescript | ## Code Before:
_ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"
defaults:
session_id: SESSION_ID
fetch: (options = {}) ->
options.data = _.extend options.data or {}, @pick('anonymous_session_id'), session_id: SESSION_ID
super options
instantiate: (options = {}) ->
{ success, error } = options
options = _.omit options, 'success', 'error'
Q.promise (resolve, reject) =>
@fetch _.extend {}, options,
success: ->
resolve arguments...
success? arguments...
error: =>
@save {},
success: ->
resolve arguments...
success? arguments...
error: ->
reject arguments...
error? arguments...
## Instruction:
Remove defaults; add an Array of valid hash fields as a hack around a broken API
## Code After:
_ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"
validHashFields: [
'owner'
'institutional_affiliations'
'confirmed_buyer_at'
'collector_level'
]
fetch: (options = {}) ->
options.data = _.extend options.data or {}, @pick('anonymous_session_id'), session_id: SESSION_ID
super options
instantiate: (options = {}) ->
{ success, error } = options
options = _.omit options, 'success', 'error'
Q.promise (resolve, reject) =>
@fetch _.extend {}, options,
success: ->
resolve arguments...
success? arguments...
error: =>
@save {},
success: ->
resolve arguments...
success? arguments...
error: ->
reject arguments...
error? arguments...
| _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"
- defaults:
- session_id: SESSION_ID
+ validHashFields: [
+ 'owner'
+ 'institutional_affiliations'
+ 'confirmed_buyer_at'
+ 'collector_level'
+ ]
fetch: (options = {}) ->
options.data = _.extend options.data or {}, @pick('anonymous_session_id'), session_id: SESSION_ID
super options
instantiate: (options = {}) ->
{ success, error } = options
options = _.omit options, 'success', 'error'
Q.promise (resolve, reject) =>
@fetch _.extend {}, options,
success: ->
resolve arguments...
success? arguments...
error: =>
@save {},
success: ->
resolve arguments...
success? arguments...
error: ->
reject arguments...
error? arguments... | 8 | 0.235294 | 6 | 2 |
d4948f7a98d0bd4dd9c4868764f3cbee3a75f799 | src/pages/dataTableUtilities/index.js | src/pages/dataTableUtilities/index.js | /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export { DataTablePageReducer } from './reducer';
export { COLUMN_TYPES, COLUMN_NAMES, COLUMN_KEYS } from './constants';
export { recordKeyExtractor, getItemLayout } from './utilities';
export { PageActions } from './actions';
/* eslint-disable import/first */
import getColumns from './getColumns';
import getPageInfoColumns from './getPageInfoColumns';
import getPageInitialiser from './getPageInitialiser';
import { getPageDispatchers } from './getPageDispatchers';
export { getColumns, getPageInfoColumns, getPageInitialiser, getPageDispatchers };
| /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export { DataTablePageReducer } from './reducer';
export { COLUMN_TYPES, COLUMN_NAMES, COLUMN_KEYS } from './constants';
export { recordKeyExtractor, getItemLayout } from './utilities';
export { PageActions, DATA_SET, ACTIONS } from './actions';
/* eslint-disable import/first */
import getColumns from './getColumns';
import getPageInfoColumns from './getPageInfoColumns';
import getPageInitialiser from './getPageInitialiser';
import { getPageDispatchers } from './getPageDispatchers';
export { getColumns, getPageInfoColumns, getPageInitialiser, getPageDispatchers };
| Add export of action constants | Add export of action constants
| JavaScript | mit | sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile | javascript | ## Code Before:
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export { DataTablePageReducer } from './reducer';
export { COLUMN_TYPES, COLUMN_NAMES, COLUMN_KEYS } from './constants';
export { recordKeyExtractor, getItemLayout } from './utilities';
export { PageActions } from './actions';
/* eslint-disable import/first */
import getColumns from './getColumns';
import getPageInfoColumns from './getPageInfoColumns';
import getPageInitialiser from './getPageInitialiser';
import { getPageDispatchers } from './getPageDispatchers';
export { getColumns, getPageInfoColumns, getPageInitialiser, getPageDispatchers };
## Instruction:
Add export of action constants
## Code After:
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export { DataTablePageReducer } from './reducer';
export { COLUMN_TYPES, COLUMN_NAMES, COLUMN_KEYS } from './constants';
export { recordKeyExtractor, getItemLayout } from './utilities';
export { PageActions, DATA_SET, ACTIONS } from './actions';
/* eslint-disable import/first */
import getColumns from './getColumns';
import getPageInfoColumns from './getPageInfoColumns';
import getPageInitialiser from './getPageInitialiser';
import { getPageDispatchers } from './getPageDispatchers';
export { getColumns, getPageInfoColumns, getPageInitialiser, getPageDispatchers };
| /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export { DataTablePageReducer } from './reducer';
export { COLUMN_TYPES, COLUMN_NAMES, COLUMN_KEYS } from './constants';
export { recordKeyExtractor, getItemLayout } from './utilities';
- export { PageActions } from './actions';
+ export { PageActions, DATA_SET, ACTIONS } from './actions';
? +++++++++++++++++++
/* eslint-disable import/first */
import getColumns from './getColumns';
import getPageInfoColumns from './getPageInfoColumns';
import getPageInitialiser from './getPageInitialiser';
import { getPageDispatchers } from './getPageDispatchers';
export { getColumns, getPageInfoColumns, getPageInitialiser, getPageDispatchers }; | 2 | 0.125 | 1 | 1 |
a28cc7c87a8b52df7eb6cebe8530a7a328c8cd5f | scripts/resources/hiera.yaml | scripts/resources/hiera.yaml | ---
:backends:
- json
:hierarchy:
- defaults
- clientcert/%{::clientcert}
- environment/%{::environment}
- global
:json:
:datadir: /etc/puppet/hiera/data
| ---
:backends:
- json
:hierarchy:
- clientcert/%{::clientcert}
- environment/%{::environment}
- defaults
:json:
:datadir: /etc/puppet/hiera/data
| Remove global, move default to end - to act as default | Remove global, move default to end - to act as default
| YAML | mit | vrenetic/puppet-packages,cargomedia/puppet-packages,njam/puppet-packages,tomaszdurka/puppet-packages,ppp0/puppet-packages,cargomedia/puppet-packages,tomaszdurka/puppet-packages,vrenetic/puppet-packages,vrenetic/puppet-packages,ppp0/puppet-packages,tomaszdurka/puppet-packages,tomaszdurka/puppet-packages,ppp0/puppet-packages,njam/puppet-packages,njam/puppet-packages,zazabe/puppet-packages,feedlabs/puppet-packages,cargomedia/puppet-packages,cargomedia/puppet-packages,zazabe/puppet-packages,zazabe/puppet-packages,tomaszdurka/puppet-packages,njam/puppet-packages,ppp0/puppet-packages,ppp0/puppet-packages,zazabe/puppet-packages,feedlabs/puppet-packages,vrenetic/puppet-packages,njam/puppet-packages,feedlabs/puppet-packages,vrenetic/puppet-packages,feedlabs/puppet-packages,feedlabs/puppet-packages,vrenetic/puppet-packages,tomaszdurka/puppet-packages,cargomedia/puppet-packages,zazabe/puppet-packages | yaml | ## Code Before:
---
:backends:
- json
:hierarchy:
- defaults
- clientcert/%{::clientcert}
- environment/%{::environment}
- global
:json:
:datadir: /etc/puppet/hiera/data
## Instruction:
Remove global, move default to end - to act as default
## Code After:
---
:backends:
- json
:hierarchy:
- clientcert/%{::clientcert}
- environment/%{::environment}
- defaults
:json:
:datadir: /etc/puppet/hiera/data
| ---
:backends:
- json
:hierarchy:
- - defaults
- clientcert/%{::clientcert}
- environment/%{::environment}
- - global
+ - defaults
:json:
:datadir: /etc/puppet/hiera/data | 3 | 0.272727 | 1 | 2 |
638201a3b3065ea398ca9449a8da83131266ddb9 | two-way-binding/index.js | two-way-binding/index.js | var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rulesSize = rules.length; // Save original size for reset
app.get('/api', function(req, res) {
res.json(rules);
});
app.post('/api', jsonParser, function(req, res) {
console.log(req.body);
if(req.body.reset)
rules = rules.slice(0, rulesSize);
else
rules.push({ rulename: req.body.newRule });
// Return new rules set
res.json(rules);
});
app.get('/:file', function(req, res) {
fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
});
var port = process.env.NODE_PORT || 3100;
console.log(`Listening on port ${port}`);
app.listen(port);
| var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rulesSize = rules.length; // Save original size for reset
// Static file serving.
app.use(express.static(__dirname + '/public'));
app.get('/api', function(req, res) {
res.json(rules);
});
app.post('/api', jsonParser, function(req, res) {
console.log(req.body);
if(req.body.reset)
rules = rules.slice(0, rulesSize);
else if(req.body.remove)
rules.splice(req.body.remove, 1);
else
rules.push({ rulename: req.body.newRule });
// Return new rules set
res.json(rules);
});
// app.get('/:file', function(req, res) {
// fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
// });
var port = process.env.NODE_PORT || 3100;
console.log(`Listening on port ${port}`);
app.listen(port);
| Move to static file serving from ./public. | Move to static file serving from ./public.
Add possibility to remove rules.
| JavaScript | mit | JulianNicholls/Understanding-AngularJS,JulianNicholls/Understanding-AngularJS,JulianNicholls/Understanding-AngularJS | javascript | ## Code Before:
var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rulesSize = rules.length; // Save original size for reset
app.get('/api', function(req, res) {
res.json(rules);
});
app.post('/api', jsonParser, function(req, res) {
console.log(req.body);
if(req.body.reset)
rules = rules.slice(0, rulesSize);
else
rules.push({ rulename: req.body.newRule });
// Return new rules set
res.json(rules);
});
app.get('/:file', function(req, res) {
fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
});
var port = process.env.NODE_PORT || 3100;
console.log(`Listening on port ${port}`);
app.listen(port);
## Instruction:
Move to static file serving from ./public.
Add possibility to remove rules.
## Code After:
var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rulesSize = rules.length; // Save original size for reset
// Static file serving.
app.use(express.static(__dirname + '/public'));
app.get('/api', function(req, res) {
res.json(rules);
});
app.post('/api', jsonParser, function(req, res) {
console.log(req.body);
if(req.body.reset)
rules = rules.slice(0, rulesSize);
else if(req.body.remove)
rules.splice(req.body.remove, 1);
else
rules.push({ rulename: req.body.newRule });
// Return new rules set
res.json(rules);
});
// app.get('/:file', function(req, res) {
// fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
// });
var port = process.env.NODE_PORT || 3100;
console.log(`Listening on port ${port}`);
app.listen(port);
| var express = require('express');
var fs = require('fs');
var parser = require('body-parser');
var app = express();
var jsonParser = parser.json();
var rules = [
{ rulename: 'must be 5 characters' },
{ rulename: 'must not be used elsewhere' },
{ rulename: 'must be really cool' }
];
var rulesSize = rules.length; // Save original size for reset
+ // Static file serving.
+ app.use(express.static(__dirname + '/public'));
+
app.get('/api', function(req, res) {
res.json(rules);
});
app.post('/api', jsonParser, function(req, res) {
console.log(req.body);
if(req.body.reset)
rules = rules.slice(0, rulesSize);
+ else if(req.body.remove)
+ rules.splice(req.body.remove, 1);
else
rules.push({ rulename: req.body.newRule });
// Return new rules set
res.json(rules);
});
- app.get('/:file', function(req, res) {
+ // app.get('/:file', function(req, res) {
? +++
- fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
+ // fs.createReadStream(`${__dirname}/${req.params.file}`).pipe(res)
? +++
- });
+ // });
var port = process.env.NODE_PORT || 3100;
console.log(`Listening on port ${port}`);
app.listen(port); | 11 | 0.289474 | 8 | 3 |
1ef0afbf3a5f524247ba4a918b65adf3fb6289ef | lib/kosmos/packages/kerbal_engineer_redux.rb | lib/kosmos/packages/kerbal_engineer_redux.rb | class KerbalEngineerRedux < Kosmos::Package
title 'Kerbal Engineer Redux'
url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux'
def install
merge_directory 'Engineer', into: 'GameData'
end
end
| class KerbalEngineerRedux < Kosmos::Package
title 'Kerbal Engineer Redux'
aliases 'ker'
url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux'
def install
merge_directory 'Engineer', into: 'GameData'
end
end
class KerbalEngineerReduxPatch < Kosmos::Package
title 'Kerbal Engineer Redux - Patch for KSP 0.23.5'
aliases 'ker patch', 'kerbal engineer redux patch'
url 'https://www.dropbox.com/s/2b1d225vunp55ko/kerdlls.zip'
def install
merge_directory '.', into: 'GameData/Engineer'
end
end
| Add patches and aliases for Kerbal Engineer Redux. | Add patches and aliases for Kerbal Engineer Redux.
| Ruby | mit | kmc/kmc,kmc/kmc,kmc/kmc | ruby | ## Code Before:
class KerbalEngineerRedux < Kosmos::Package
title 'Kerbal Engineer Redux'
url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux'
def install
merge_directory 'Engineer', into: 'GameData'
end
end
## Instruction:
Add patches and aliases for Kerbal Engineer Redux.
## Code After:
class KerbalEngineerRedux < Kosmos::Package
title 'Kerbal Engineer Redux'
aliases 'ker'
url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux'
def install
merge_directory 'Engineer', into: 'GameData'
end
end
class KerbalEngineerReduxPatch < Kosmos::Package
title 'Kerbal Engineer Redux - Patch for KSP 0.23.5'
aliases 'ker patch', 'kerbal engineer redux patch'
url 'https://www.dropbox.com/s/2b1d225vunp55ko/kerdlls.zip'
def install
merge_directory '.', into: 'GameData/Engineer'
end
end
| class KerbalEngineerRedux < Kosmos::Package
title 'Kerbal Engineer Redux'
+ aliases 'ker'
url 'http://kerbal.curseforge.com/plugins/220285-kerbal-engineer-redux'
def install
merge_directory 'Engineer', into: 'GameData'
end
end
+
+ class KerbalEngineerReduxPatch < Kosmos::Package
+ title 'Kerbal Engineer Redux - Patch for KSP 0.23.5'
+ aliases 'ker patch', 'kerbal engineer redux patch'
+ url 'https://www.dropbox.com/s/2b1d225vunp55ko/kerdlls.zip'
+
+ def install
+ merge_directory '.', into: 'GameData/Engineer'
+ end
+ end | 11 | 1.375 | 11 | 0 |
66610b87a481a0df964155f08cae49546d974a95 | README.md | README.md | Noise
=====
Nested Object Inverted Search Engine
This is a native library meant to be linked into other projects and will
expose a C API.
It's a full text index and query system that understands the semi structured
nature of JSON, and will allow:
* Stemmed word/fuzzy match
* Case sensitive exact word and sentence match
* Arbitrary boolean nesting
* Greater than/less Than matching
Installation
------------
### Dependencies
* [RocksDB](http://rocksdb.org/)
* [capnp-tool](https://capnproto.org/capnp-tool.html)
### Build
cargo build
### Running tests
cargo test
Contributing
------------
### Commit messages
Commit messages are important as soon as you need to dig into the history
of certain parts of the system. Hence please follow the guidelines of
[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
License
-------
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
| Noise
=====
Nested Object Inverted Search Engine
This is a native library meant to be linked into other projects and will
expose a C API.
It's a full text index and query system that understands the semi structured
nature of JSON, and will allow:
* Stemmed word/fuzzy match
* Case sensitive exact word and sentence match
* Arbitrary boolean nesting
* Greater than/less Than matching
[Query Langauge Reference here](https://github.com/pipedown/noise/blob/master/query_language_reference.md)
Installation
------------
### Dependencies
* [RocksDB](http://rocksdb.org/)
* [capnp-tool](https://capnproto.org/capnp-tool.html)
### Build
cargo build
### Running tests
cargo test
Contributing
------------
### Commit messages
Commit messages are important as soon as you need to dig into the history
of certain parts of the system. Hence please follow the guidelines of
[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
License
-------
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
| Add link to query language reference | Add link to query language reference | Markdown | apache-2.0 | pipedown/noise,pipedown/noise | markdown | ## Code Before:
Noise
=====
Nested Object Inverted Search Engine
This is a native library meant to be linked into other projects and will
expose a C API.
It's a full text index and query system that understands the semi structured
nature of JSON, and will allow:
* Stemmed word/fuzzy match
* Case sensitive exact word and sentence match
* Arbitrary boolean nesting
* Greater than/less Than matching
Installation
------------
### Dependencies
* [RocksDB](http://rocksdb.org/)
* [capnp-tool](https://capnproto.org/capnp-tool.html)
### Build
cargo build
### Running tests
cargo test
Contributing
------------
### Commit messages
Commit messages are important as soon as you need to dig into the history
of certain parts of the system. Hence please follow the guidelines of
[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
License
-------
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
## Instruction:
Add link to query language reference
## Code After:
Noise
=====
Nested Object Inverted Search Engine
This is a native library meant to be linked into other projects and will
expose a C API.
It's a full text index and query system that understands the semi structured
nature of JSON, and will allow:
* Stemmed word/fuzzy match
* Case sensitive exact word and sentence match
* Arbitrary boolean nesting
* Greater than/less Than matching
[Query Langauge Reference here](https://github.com/pipedown/noise/blob/master/query_language_reference.md)
Installation
------------
### Dependencies
* [RocksDB](http://rocksdb.org/)
* [capnp-tool](https://capnproto.org/capnp-tool.html)
### Build
cargo build
### Running tests
cargo test
Contributing
------------
### Commit messages
Commit messages are important as soon as you need to dig into the history
of certain parts of the system. Hence please follow the guidelines of
[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
License
-------
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
| Noise
=====
Nested Object Inverted Search Engine
This is a native library meant to be linked into other projects and will
expose a C API.
It's a full text index and query system that understands the semi structured
nature of JSON, and will allow:
* Stemmed word/fuzzy match
* Case sensitive exact word and sentence match
* Arbitrary boolean nesting
* Greater than/less Than matching
+
+ [Query Langauge Reference here](https://github.com/pipedown/noise/blob/master/query_language_reference.md)
Installation
------------
### Dependencies
* [RocksDB](http://rocksdb.org/)
* [capnp-tool](https://capnproto.org/capnp-tool.html)
### Build
cargo build
### Running tests
cargo test
Contributing
------------
### Commit messages
Commit messages are important as soon as you need to dig into the history
of certain parts of the system. Hence please follow the guidelines of
[How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
License
-------
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
| 2 | 0.031746 | 2 | 0 |
f1eab62f841fe7237f96ccd986cdfef98d4ac577 | src/assets/stylesheets/_site.scss | src/assets/stylesheets/_site.scss | /* ==========================================================================
Site
========================================================================== */
.site__logo {
margin: 4em 2em 6em 2em;
line-height: 1;
font-family: $monospace;
a {
color: #000;
text-decoration: none;
}
}
.site__footer {
position: relative;
padding: 2em;
font-family: $monospace;
font-size: 0.8em;
.copyright {
font-size: 0.8em;
}
}
| /* ==========================================================================
Site
========================================================================== */
.site__logo {
margin: 4em 1em 6em 1em;
line-height: 1;
font-family: $monospace;
@include breakpoint($small) {
margin-left: 2em;
margin-right: 2em;
}
a {
color: #000;
text-decoration: none;
}
}
.site__footer {
position: relative;
padding: 2em;
font-family: $monospace;
font-size: 0.8em;
.copyright {
font-size: 0.8em;
}
}
| Make site logo margins consistent with page wrap | Make site logo margins consistent with page wrap
| SCSS | mit | mmistakes/made-mistakes-jekyll,mmistakes/made-mistakes-jekyll,mmistakes/made-mistakes-jekyll | scss | ## Code Before:
/* ==========================================================================
Site
========================================================================== */
.site__logo {
margin: 4em 2em 6em 2em;
line-height: 1;
font-family: $monospace;
a {
color: #000;
text-decoration: none;
}
}
.site__footer {
position: relative;
padding: 2em;
font-family: $monospace;
font-size: 0.8em;
.copyright {
font-size: 0.8em;
}
}
## Instruction:
Make site logo margins consistent with page wrap
## Code After:
/* ==========================================================================
Site
========================================================================== */
.site__logo {
margin: 4em 1em 6em 1em;
line-height: 1;
font-family: $monospace;
@include breakpoint($small) {
margin-left: 2em;
margin-right: 2em;
}
a {
color: #000;
text-decoration: none;
}
}
.site__footer {
position: relative;
padding: 2em;
font-family: $monospace;
font-size: 0.8em;
.copyright {
font-size: 0.8em;
}
}
| /* ==========================================================================
Site
========================================================================== */
.site__logo {
- margin: 4em 2em 6em 2em;
? ^ ^
+ margin: 4em 1em 6em 1em;
? ^ ^
line-height: 1;
font-family: $monospace;
+
+ @include breakpoint($small) {
+ margin-left: 2em;
+ margin-right: 2em;
+ }
a {
color: #000;
text-decoration: none;
}
}
.site__footer {
position: relative;
padding: 2em;
font-family: $monospace;
font-size: 0.8em;
.copyright {
font-size: 0.8em;
}
} | 7 | 0.28 | 6 | 1 |
6331141d3055c99f755d6d99426614d4201bfd9b | lib/cb/utils/validator.rb | lib/cb/utils/validator.rb | require 'json'
require 'xmlsimple'
module Cb
module ResponseValidator
def self.validate(response)
if response.blank? || response.response.body.blank?
return self.get_empty_json_hash
end
if response.code != 200
# we only handle json or xml responses - html means something bad happened
is_html = response.response.body.include?('<!DOCTYPE html')
return self.get_empty_json_hash if is_html
end
begin
json = JSON.parse(response.response.body)
json.keys.any? ? json : self.get_empty_json_hash
rescue JSON::ParserError
self.handle_parser_error(response.response.body)
end
end
def self.handle_parser_error(response)
# if it's not JSON, try XML
begin
xml = XmlSimple.xml_in(response)
rescue ArgumentError, REXML::ParseException
xml = nil
end
if xml.nil?
# if i wasn't xml either, give up and return an empty json hash
return self.get_empty_json_hash
else
# if it was, return a hash from the xml UNLESS it was a generic
xml_hash = XmlSimple.xml_in(response)
if xml_hash.has_key?('Errors')
return self.get_empty_json_hash
else
return xml_hash
end
end
end
def self.get_empty_json_hash
Hash.new
end
end
end
| require 'json'
require 'nori'
module Cb
module ResponseValidator
class << self
def validate(response)
if response.nil? || response.response.body.nil?
return get_empty_json_hash
end
if response.code != 200
# we only handle json or xml responses - html means something bad happened
is_html = response.response.body.include?('<!DOCTYPE html')
return get_empty_json_hash if is_html
end
return get_empty_json_hash if response.response.body.nil?
# Try to parse response as JSON. Otherwise, return HTTParty-parsed XML
begin
json = JSON.parse(response.response.body)
json.keys.any? ? json : get_empty_json_hash
rescue JSON::ParserError
handle_parser_error(response.response.body)
end
end
def handle_parser_error(response_body)
begin
response_hash = XmlSimple.xml_in(response_body)
# Unless there was an error, return a hash from the xml
if response_hash.respond_to?(:has_key?) && response_hash.has_key?('Errors')
return get_empty_json_hash
else
return response_hash
end
rescue ArgumentError, REXML::ParseException
get_empty_json_hash
end
end
def get_empty_json_hash
Hash.new
end
def nori
@nori ||= Nori.new
end
end
# private_class_method :handle_parser_error, :get_empty_json_hash
end
end
| Remove Nokogiri usage from validated response | Remove Nokogiri usage from validated response
| Ruby | apache-2.0 | cbdr/ruby-cb-api,careerbuilder/ruby-cb-api | ruby | ## Code Before:
require 'json'
require 'xmlsimple'
module Cb
module ResponseValidator
def self.validate(response)
if response.blank? || response.response.body.blank?
return self.get_empty_json_hash
end
if response.code != 200
# we only handle json or xml responses - html means something bad happened
is_html = response.response.body.include?('<!DOCTYPE html')
return self.get_empty_json_hash if is_html
end
begin
json = JSON.parse(response.response.body)
json.keys.any? ? json : self.get_empty_json_hash
rescue JSON::ParserError
self.handle_parser_error(response.response.body)
end
end
def self.handle_parser_error(response)
# if it's not JSON, try XML
begin
xml = XmlSimple.xml_in(response)
rescue ArgumentError, REXML::ParseException
xml = nil
end
if xml.nil?
# if i wasn't xml either, give up and return an empty json hash
return self.get_empty_json_hash
else
# if it was, return a hash from the xml UNLESS it was a generic
xml_hash = XmlSimple.xml_in(response)
if xml_hash.has_key?('Errors')
return self.get_empty_json_hash
else
return xml_hash
end
end
end
def self.get_empty_json_hash
Hash.new
end
end
end
## Instruction:
Remove Nokogiri usage from validated response
## Code After:
require 'json'
require 'nori'
module Cb
module ResponseValidator
class << self
def validate(response)
if response.nil? || response.response.body.nil?
return get_empty_json_hash
end
if response.code != 200
# we only handle json or xml responses - html means something bad happened
is_html = response.response.body.include?('<!DOCTYPE html')
return get_empty_json_hash if is_html
end
return get_empty_json_hash if response.response.body.nil?
# Try to parse response as JSON. Otherwise, return HTTParty-parsed XML
begin
json = JSON.parse(response.response.body)
json.keys.any? ? json : get_empty_json_hash
rescue JSON::ParserError
handle_parser_error(response.response.body)
end
end
def handle_parser_error(response_body)
begin
response_hash = XmlSimple.xml_in(response_body)
# Unless there was an error, return a hash from the xml
if response_hash.respond_to?(:has_key?) && response_hash.has_key?('Errors')
return get_empty_json_hash
else
return response_hash
end
rescue ArgumentError, REXML::ParseException
get_empty_json_hash
end
end
def get_empty_json_hash
Hash.new
end
def nori
@nori ||= Nori.new
end
end
# private_class_method :handle_parser_error, :get_empty_json_hash
end
end
| require 'json'
- require 'xmlsimple'
+ require 'nori'
module Cb
module ResponseValidator
+
+ class << self
+ def validate(response)
+ if response.nil? || response.response.body.nil?
+ return get_empty_json_hash
+ end
- def self.validate(response)
- if response.blank? || response.response.body.blank?
+ if response.code != 200
+ # we only handle json or xml responses - html means something bad happened
+ is_html = response.response.body.include?('<!DOCTYPE html')
- return self.get_empty_json_hash
? -----
+ return get_empty_json_hash if is_html
? ++ +++++++++++
+ end
+
+ return get_empty_json_hash if response.response.body.nil?
+
+ # Try to parse response as JSON. Otherwise, return HTTParty-parsed XML
+ begin
+ json = JSON.parse(response.response.body)
+ json.keys.any? ? json : get_empty_json_hash
+ rescue JSON::ParserError
+ handle_parser_error(response.response.body)
+ end
end
- if response.code != 200
- # we only handle json or xml responses - html means something bad happened
- is_html = response.response.body.include?('<!DOCTYPE html')
+ def handle_parser_error(response_body)
+ begin
+ response_hash = XmlSimple.xml_in(response_body)
+ # Unless there was an error, return a hash from the xml
+ if response_hash.respond_to?(:has_key?) && response_hash.has_key?('Errors')
- return self.get_empty_json_hash if is_html
? ----- -----------
+ return get_empty_json_hash
? ++++
+ else
+ return response_hash
+ end
+ rescue ArgumentError, REXML::ParseException
+ get_empty_json_hash
+ end
end
+ def get_empty_json_hash
+ Hash.new
- begin
? - --
+ end
? +
+
+ def nori
+ @nori ||= Nori.new
- json = JSON.parse(response.response.body)
- json.keys.any? ? json : self.get_empty_json_hash
- rescue JSON::ParserError
- self.handle_parser_error(response.response.body)
end
end
+
+ # private_class_method :handle_parser_error, :get_empty_json_hash
-
- def self.handle_parser_error(response)
- # if it's not JSON, try XML
- begin
- xml = XmlSimple.xml_in(response)
- rescue ArgumentError, REXML::ParseException
- xml = nil
- end
-
- if xml.nil?
- # if i wasn't xml either, give up and return an empty json hash
- return self.get_empty_json_hash
- else
- # if it was, return a hash from the xml UNLESS it was a generic
- xml_hash = XmlSimple.xml_in(response)
- if xml_hash.has_key?('Errors')
- return self.get_empty_json_hash
- else
- return xml_hash
- end
- end
- end
-
- def self.get_empty_json_hash
- Hash.new
- end
end
end | 81 | 1.557692 | 42 | 39 |
d04e7eb4fa671badb1e9ab2a92529bec26094ae0 | config/database.docker.yml | config/database.docker.yml | production:
adapter: mysql2
database: app_autolab_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
host: db
| development: &common
adapter: mysql2
database: app_autolab_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
host: db
production:
<<: *common
| Add development and production database configurations | Add development and production database configurations
| YAML | apache-2.0 | autolab/Autolab,yunfanye/Autolab,cagdasbas/Autolab,cg2v/Autolab,kk262777/Autolab,autolab/Autolab,kk262777/Autolab,cagdasbas/Autolab,AEgan/Autolab,cg2v/Autolab,yunfanye/Autolab,cg2v/Autolab,kk262777/Autolab,AEgan/Autolab,cg2v/Autolab,AEgan/Autolab,cagdasbas/Autolab,autolab/Autolab,AEgan/Autolab,yunfanye/Autolab,AEgan/Autolab,cg2v/Autolab,AEgan/Autolab,cagdasbas/Autolab,cagdasbas/Autolab,autolab/Autolab,cagdasbas/Autolab,autolab/Autolab,kk262777/Autolab,yunfanye/Autolab,cg2v/Autolab,kk262777/Autolab,yunfanye/Autolab,autolab/Autolab,kk262777/Autolab,yunfanye/Autolab | yaml | ## Code Before:
production:
adapter: mysql2
database: app_autolab_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
host: db
## Instruction:
Add development and production database configurations
## Code After:
development: &common
adapter: mysql2
database: app_autolab_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
host: db
production:
<<: *common
| - production:
+ development: &common
adapter: mysql2
database: app_autolab_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
host: db
+
+ production:
+ <<: *common | 5 | 0.625 | 4 | 1 |
0691752171385afb3a2f5403a1268a2d09b6ffc1 | package.json | package.json | {
"name": "web-scrapper",
"version": "0.0.1",
"description": "A Flipkart and Snapdeal scraper",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Rohit Prasad",
"private": true,
"dependencies": {
"casper": "latest",
"express": "latest",
"request": "latest"
}
}
| {
"name": "web-scrapper",
"version": "0.0.1",
"description": "A Flipkart and Snapdeal scraper",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Rohit Prasad",
"private": true,
"dependencies": {
"casper": "0.1.1",
"express": "4.13.4",
"request": "2.69.0"
}
}
| Update dependencies' version from latest to exact version | Update dependencies' version from latest to exact version
| JSON | mit | rohitrp/flip-snap-scraper,rohitrp/flip-snap-scraper | json | ## Code Before:
{
"name": "web-scrapper",
"version": "0.0.1",
"description": "A Flipkart and Snapdeal scraper",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Rohit Prasad",
"private": true,
"dependencies": {
"casper": "latest",
"express": "latest",
"request": "latest"
}
}
## Instruction:
Update dependencies' version from latest to exact version
## Code After:
{
"name": "web-scrapper",
"version": "0.0.1",
"description": "A Flipkart and Snapdeal scraper",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Rohit Prasad",
"private": true,
"dependencies": {
"casper": "0.1.1",
"express": "4.13.4",
"request": "2.69.0"
}
}
| {
"name": "web-scrapper",
"version": "0.0.1",
"description": "A Flipkart and Snapdeal scraper",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"author": "Rohit Prasad",
"private": true,
"dependencies": {
- "casper": "latest",
? ^^^^^^
+ "casper": "0.1.1",
? ^^^^^
- "express": "latest",
? ^^^^^^
+ "express": "4.13.4",
? ^^^^^^
- "request": "latest"
+ "request": "2.69.0"
}
} | 6 | 0.375 | 3 | 3 |
f3e611c9e373a0147be472cb7913f3604baf2a08 | log.c | log.c |
static bool flushAfterLog = false;
void proxyLogSetFlush(bool enabled)
{
flushAfterLog = enabled;
}
void proxyLog(const char* format, ...)
{
va_list args;
va_start(args, format);
printTimeString();
printf(" ");
vprintf(format, args);
printf("\n");
if (flushAfterLog)
{
fflush(stdout);
}
va_end(args);
}
|
static bool flushAfterLog = false;
void proxyLogSetFlush(bool enabled)
{
flushAfterLog = enabled;
}
void proxyLog(const char* format, ...)
{
va_list args;
va_start(args, format);
printTimeString();
putchar(' ');
vprintf(format, args);
putchar('\n');
if (flushAfterLog)
{
fflush(stdout);
}
va_end(args);
}
| Use putchar instead of printf. | Use putchar instead of printf.
| C | mit | aaronriekenberg/openbsd_cproxy,aaronriekenberg/openbsd_cproxy | c | ## Code Before:
static bool flushAfterLog = false;
void proxyLogSetFlush(bool enabled)
{
flushAfterLog = enabled;
}
void proxyLog(const char* format, ...)
{
va_list args;
va_start(args, format);
printTimeString();
printf(" ");
vprintf(format, args);
printf("\n");
if (flushAfterLog)
{
fflush(stdout);
}
va_end(args);
}
## Instruction:
Use putchar instead of printf.
## Code After:
static bool flushAfterLog = false;
void proxyLogSetFlush(bool enabled)
{
flushAfterLog = enabled;
}
void proxyLog(const char* format, ...)
{
va_list args;
va_start(args, format);
printTimeString();
putchar(' ');
vprintf(format, args);
putchar('\n');
if (flushAfterLog)
{
fflush(stdout);
}
va_end(args);
}
|
static bool flushAfterLog = false;
void proxyLogSetFlush(bool enabled)
{
flushAfterLog = enabled;
}
void proxyLog(const char* format, ...)
{
va_list args;
va_start(args, format);
printTimeString();
- printf(" ");
+ putchar(' ');
vprintf(format, args);
- printf("\n");
+ putchar('\n');
if (flushAfterLog)
{
fflush(stdout);
}
va_end(args);
} | 4 | 0.153846 | 2 | 2 |
a6cc7143d835a81ca6735320c1f050b31c7cd009 | app/scripts/components/entities/PlayerClone.coffee | app/scripts/components/entities/PlayerClone.coffee | Crafty.c 'PlayerClone',
init: ->
@requires 'Enemy, playerShip'
playerClone: (attr = {}) ->
@attr _.defaults(attr, h: 45, w: 71, health: 900)
@origin 'center'
@flipX()
@colorOverride '#808080', 'partial'
@enemy()
this
| Crafty.c 'PlayerClone',
init: ->
@requires 'Enemy, playerShip'
playerClone: (attr = {}) ->
@attr _.defaults(attr,
h: 45,
w: 71,
health: 900,
weaponOrigin: [5, 30]
)
@origin 'center'
@flipX()
@colorOverride '#808080', 'partial'
@enemy()
this
| Improve weapon position player clone | Improve weapon position player clone
| CoffeeScript | mit | matthijsgroen/game-play,matthijsgroen/game-play,matthijsgroen/game-play | coffeescript | ## Code Before:
Crafty.c 'PlayerClone',
init: ->
@requires 'Enemy, playerShip'
playerClone: (attr = {}) ->
@attr _.defaults(attr, h: 45, w: 71, health: 900)
@origin 'center'
@flipX()
@colorOverride '#808080', 'partial'
@enemy()
this
## Instruction:
Improve weapon position player clone
## Code After:
Crafty.c 'PlayerClone',
init: ->
@requires 'Enemy, playerShip'
playerClone: (attr = {}) ->
@attr _.defaults(attr,
h: 45,
w: 71,
health: 900,
weaponOrigin: [5, 30]
)
@origin 'center'
@flipX()
@colorOverride '#808080', 'partial'
@enemy()
this
| Crafty.c 'PlayerClone',
init: ->
@requires 'Enemy, playerShip'
playerClone: (attr = {}) ->
- @attr _.defaults(attr, h: 45, w: 71, health: 900)
+ @attr _.defaults(attr,
+ h: 45,
+ w: 71,
+ health: 900,
+ weaponOrigin: [5, 30]
+ )
@origin 'center'
@flipX()
@colorOverride '#808080', 'partial'
@enemy()
this
| 7 | 0.538462 | 6 | 1 |
8a8d0404ce817ec490cf7995468ce5ffba8fc3ea | client.go | client.go | package livestatus
import (
"net"
)
const bufferSize = 1024
// Client represents a Livestatus client instance.
type Client struct {
network string
address string
dialer *net.Dialer
conn net.Conn
}
// NewClient creates a new Livestatus client instance.
func NewClient(network, address string) *Client {
return NewClientWithDialer(network, address, new(net.Dialer))
}
// NewClientWithDialer creates a new Livestatus client instance using a provided network dialer.
func NewClientWithDialer(network, address string, dialer *net.Dialer) *Client {
return &Client{
network: network,
address: address,
dialer: dialer,
}
}
// Close closes any remaining connection.
func (c *Client) Close() {
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
}
// Exec executes a given Livestatus query.
func (c *Client) Exec(r Request) (*Response, error) {
var err error
// Initialize connection if none available
if c.conn == nil {
c.conn, err = c.dialer.Dial(c.network, c.address)
if err != nil {
return nil, err
}
if !r.keepAlive() {
defer c.Close()
}
}
return r.handle(c.conn)
}
| package livestatus
import (
"net"
)
const bufferSize = 1024
// Client represents a Livestatus client instance.
type Client struct {
network string
address string
dialer *net.Dialer
conn net.Conn
}
// NewClient creates a new Livestatus client instance.
func NewClient(network, address string) *Client {
return NewClientWithDialer(network, address, new(net.Dialer))
}
// NewClientWithDialer creates a new Livestatus client instance using a provided network dialer.
func NewClientWithDialer(network, address string, dialer *net.Dialer) *Client {
return &Client{
network: network,
address: address,
dialer: dialer,
}
}
// Close closes any remaining connection.
func (c *Client) Close() {
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
}
// Exec executes a given Livestatus query.
func (c *Client) Exec(r Request) (*Response, error) {
var err error
// Initialize connection if none available
if c.conn == nil {
c.conn, err = c.dialer.Dial(c.network, c.address)
if err != nil {
return nil, err
}
if r.keepAlive() {
c.conn.(*net.TCPConn).SetKeepAlive(true)
} else {
defer c.Close()
}
}
return r.handle(c.conn)
}
| Add missing keepalive on TCP connection | Add missing keepalive on TCP connection
| Go | bsd-3-clause | vbatoufflet/go-livestatus | go | ## Code Before:
package livestatus
import (
"net"
)
const bufferSize = 1024
// Client represents a Livestatus client instance.
type Client struct {
network string
address string
dialer *net.Dialer
conn net.Conn
}
// NewClient creates a new Livestatus client instance.
func NewClient(network, address string) *Client {
return NewClientWithDialer(network, address, new(net.Dialer))
}
// NewClientWithDialer creates a new Livestatus client instance using a provided network dialer.
func NewClientWithDialer(network, address string, dialer *net.Dialer) *Client {
return &Client{
network: network,
address: address,
dialer: dialer,
}
}
// Close closes any remaining connection.
func (c *Client) Close() {
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
}
// Exec executes a given Livestatus query.
func (c *Client) Exec(r Request) (*Response, error) {
var err error
// Initialize connection if none available
if c.conn == nil {
c.conn, err = c.dialer.Dial(c.network, c.address)
if err != nil {
return nil, err
}
if !r.keepAlive() {
defer c.Close()
}
}
return r.handle(c.conn)
}
## Instruction:
Add missing keepalive on TCP connection
## Code After:
package livestatus
import (
"net"
)
const bufferSize = 1024
// Client represents a Livestatus client instance.
type Client struct {
network string
address string
dialer *net.Dialer
conn net.Conn
}
// NewClient creates a new Livestatus client instance.
func NewClient(network, address string) *Client {
return NewClientWithDialer(network, address, new(net.Dialer))
}
// NewClientWithDialer creates a new Livestatus client instance using a provided network dialer.
func NewClientWithDialer(network, address string, dialer *net.Dialer) *Client {
return &Client{
network: network,
address: address,
dialer: dialer,
}
}
// Close closes any remaining connection.
func (c *Client) Close() {
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
}
// Exec executes a given Livestatus query.
func (c *Client) Exec(r Request) (*Response, error) {
var err error
// Initialize connection if none available
if c.conn == nil {
c.conn, err = c.dialer.Dial(c.network, c.address)
if err != nil {
return nil, err
}
if r.keepAlive() {
c.conn.(*net.TCPConn).SetKeepAlive(true)
} else {
defer c.Close()
}
}
return r.handle(c.conn)
}
| package livestatus
import (
"net"
)
const bufferSize = 1024
// Client represents a Livestatus client instance.
type Client struct {
network string
address string
dialer *net.Dialer
conn net.Conn
}
// NewClient creates a new Livestatus client instance.
func NewClient(network, address string) *Client {
return NewClientWithDialer(network, address, new(net.Dialer))
}
// NewClientWithDialer creates a new Livestatus client instance using a provided network dialer.
func NewClientWithDialer(network, address string, dialer *net.Dialer) *Client {
return &Client{
network: network,
address: address,
dialer: dialer,
}
}
// Close closes any remaining connection.
func (c *Client) Close() {
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
}
// Exec executes a given Livestatus query.
func (c *Client) Exec(r Request) (*Response, error) {
var err error
// Initialize connection if none available
if c.conn == nil {
c.conn, err = c.dialer.Dial(c.network, c.address)
if err != nil {
return nil, err
}
- if !r.keepAlive() {
? -
+ if r.keepAlive() {
+ c.conn.(*net.TCPConn).SetKeepAlive(true)
+ } else {
defer c.Close()
}
}
return r.handle(c.conn)
} | 4 | 0.071429 | 3 | 1 |
ddee2072598459877b3d34fc9f910dff494538b4 | pkgs/development/libraries/libsass/default.nix | pkgs/development/libraries/libsass/default.nix | { stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libsass";
version = "3.6.2";
src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
sha256 = "0z09nv08vcajvv70h8355zsnqw1w8d0hwiizym3ax1zvzkdx7941";
# Remove unicode file names which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalisation.
extraPostFetch = ''
rm -r $out/test/e2e/unicode-pwd
'';
};
preConfigure = ''
export LIBSASS_VERSION=${version}
'';
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; {
description = "A C/C++ implementation of a Sass compiler";
homepage = https://github.com/sass/libsass;
license = licenses.mit;
maintainers = with maintainers; [ codyopel offline ];
platforms = platforms.unix;
};
}
| { stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libsass";
version = "3.6.1";
src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
sha256 = "1599j2lbsygy3883x9si7rbad1pkjhl6y72aimaapcv90ga5kxkm";
# Remove unicode file names which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalisation.
extraPostFetch = ''
rm -r $out/test/e2e/unicode-pwd
'';
};
preConfigure = ''
export LIBSASS_VERSION=${version}
'';
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; {
description = "A C/C++ implementation of a Sass compiler";
homepage = https://github.com/sass/libsass;
license = licenses.mit;
maintainers = with maintainers; [ codyopel offline ];
platforms = platforms.unix;
};
}
| Revert "libsass: 3.6.1 -> 3.6.2" | Revert "libsass: 3.6.1 -> 3.6.2"
This hangs when generating gtk3 templates.
https://github.com/sass/libsass/issues/3006
This reverts commit e4b4ff8099685dea7e82ae6ccd3899337a121632.
| Nix | mit | NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs | nix | ## Code Before:
{ stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libsass";
version = "3.6.2";
src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
sha256 = "0z09nv08vcajvv70h8355zsnqw1w8d0hwiizym3ax1zvzkdx7941";
# Remove unicode file names which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalisation.
extraPostFetch = ''
rm -r $out/test/e2e/unicode-pwd
'';
};
preConfigure = ''
export LIBSASS_VERSION=${version}
'';
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; {
description = "A C/C++ implementation of a Sass compiler";
homepage = https://github.com/sass/libsass;
license = licenses.mit;
maintainers = with maintainers; [ codyopel offline ];
platforms = platforms.unix;
};
}
## Instruction:
Revert "libsass: 3.6.1 -> 3.6.2"
This hangs when generating gtk3 templates.
https://github.com/sass/libsass/issues/3006
This reverts commit e4b4ff8099685dea7e82ae6ccd3899337a121632.
## Code After:
{ stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libsass";
version = "3.6.1";
src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
sha256 = "1599j2lbsygy3883x9si7rbad1pkjhl6y72aimaapcv90ga5kxkm";
# Remove unicode file names which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalisation.
extraPostFetch = ''
rm -r $out/test/e2e/unicode-pwd
'';
};
preConfigure = ''
export LIBSASS_VERSION=${version}
'';
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; {
description = "A C/C++ implementation of a Sass compiler";
homepage = https://github.com/sass/libsass;
license = licenses.mit;
maintainers = with maintainers; [ codyopel offline ];
platforms = platforms.unix;
};
}
| { stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libsass";
- version = "3.6.2";
? ^
+ version = "3.6.1";
? ^
src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
- sha256 = "0z09nv08vcajvv70h8355zsnqw1w8d0hwiizym3ax1zvzkdx7941";
+ sha256 = "1599j2lbsygy3883x9si7rbad1pkjhl6y72aimaapcv90ga5kxkm";
# Remove unicode file names which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalisation.
extraPostFetch = ''
rm -r $out/test/e2e/unicode-pwd
'';
};
preConfigure = ''
export LIBSASS_VERSION=${version}
'';
nativeBuildInputs = [ autoreconfHook ];
meta = with stdenv.lib; {
description = "A C/C++ implementation of a Sass compiler";
homepage = https://github.com/sass/libsass;
license = licenses.mit;
maintainers = with maintainers; [ codyopel offline ];
platforms = platforms.unix;
};
} | 4 | 0.125 | 2 | 2 |
4fad93bfef651edde8061b5d66ca8fb1e19b63a2 | roles/frontend/tasks/csp.yml | roles/frontend/tasks/csp.yml | ---
- name: CSP
set_fact:
csp_rules:
default-src:
- "'self'"
script-src:
- "'self'"
- "'unsafe-inline'"
- "'unsafe-eval'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://cdnjs.cloudflare.com
img-src:
- "'self'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://maps.gstatic.com
- https://csi.gstatic.com
style-src:
- "'self'"
- "'unsafe-inline'"
- https://fonts.googleapis.com
- https://cdnjs.cloudflare.com
font-src:
- "'self'"
- https://fonts.googleapis.com
- https://fonts.gstatic.com
- https://cdnjs.cloudflare.com
frame-src:
- https://www.youtube.com
child-src:
- https://www.youtube.com
object-src:
- "'none'"
connect-src:
- "'self'"
| ---
- name: CSP
set_fact:
csp_rules:
default-src:
- "'self'"
script-src:
- "'self'"
- "'unsafe-inline'"
- "'unsafe-eval'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://cdnjs.cloudflare.com
img-src:
- "'self'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://maps.gstatic.com
- https://csi.gstatic.com
- https://www.datocms-assets.com
style-src:
- "'self'"
- "'unsafe-inline'"
- https://fonts.googleapis.com
- https://cdnjs.cloudflare.com
font-src:
- "'self'"
- https://fonts.googleapis.com
- https://fonts.gstatic.com
- https://cdnjs.cloudflare.com
frame-src:
- https://www.youtube.com
child-src:
- https://www.youtube.com
object-src:
- "'none'"
connect-src:
- "'self'"
| Add dato server to CSP | Add dato server to CSP
| YAML | mit | TheGreenVintage/thegreenvintage.website.infrastructure | yaml | ## Code Before:
---
- name: CSP
set_fact:
csp_rules:
default-src:
- "'self'"
script-src:
- "'self'"
- "'unsafe-inline'"
- "'unsafe-eval'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://cdnjs.cloudflare.com
img-src:
- "'self'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://maps.gstatic.com
- https://csi.gstatic.com
style-src:
- "'self'"
- "'unsafe-inline'"
- https://fonts.googleapis.com
- https://cdnjs.cloudflare.com
font-src:
- "'self'"
- https://fonts.googleapis.com
- https://fonts.gstatic.com
- https://cdnjs.cloudflare.com
frame-src:
- https://www.youtube.com
child-src:
- https://www.youtube.com
object-src:
- "'none'"
connect-src:
- "'self'"
## Instruction:
Add dato server to CSP
## Code After:
---
- name: CSP
set_fact:
csp_rules:
default-src:
- "'self'"
script-src:
- "'self'"
- "'unsafe-inline'"
- "'unsafe-eval'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://cdnjs.cloudflare.com
img-src:
- "'self'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://maps.gstatic.com
- https://csi.gstatic.com
- https://www.datocms-assets.com
style-src:
- "'self'"
- "'unsafe-inline'"
- https://fonts.googleapis.com
- https://cdnjs.cloudflare.com
font-src:
- "'self'"
- https://fonts.googleapis.com
- https://fonts.gstatic.com
- https://cdnjs.cloudflare.com
frame-src:
- https://www.youtube.com
child-src:
- https://www.youtube.com
object-src:
- "'none'"
connect-src:
- "'self'"
| ---
- name: CSP
set_fact:
csp_rules:
default-src:
- "'self'"
script-src:
- "'self'"
- "'unsafe-inline'"
- "'unsafe-eval'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://cdnjs.cloudflare.com
img-src:
- "'self'"
- https://www.google-analytics.com
- https://maps.googleapis.com
- https://maps.gstatic.com
- https://csi.gstatic.com
+ - https://www.datocms-assets.com
style-src:
- "'self'"
- "'unsafe-inline'"
- https://fonts.googleapis.com
- https://cdnjs.cloudflare.com
font-src:
- "'self'"
- https://fonts.googleapis.com
- https://fonts.gstatic.com
- https://cdnjs.cloudflare.com
frame-src:
- https://www.youtube.com
child-src:
- https://www.youtube.com
object-src:
- "'none'"
connect-src:
- "'self'" | 1 | 0.026316 | 1 | 0 |
f3820218203f859ab3e4f302cc5dae91baaf523c | lib/hooks/copy.js | lib/hooks/copy.js | module.exports = function ( opt )
{
opt = opt || {};
var vfs = require('vinyl-fs'),
Promise = require('promise');
// Hook function
return function ( context )
{
var targetPath = opt.targetPath || context.targetPath;
// Package hook function
return function ( pkg, globs )
{
// Promise
return new Promise(function ( resolve, reject )
{
context.invokedPromise.then(function ( )
{
console.log(pkg);
vfs.src(globs, {cwd: pkg.exportsAbsolutePath})
.pipe(vfs.dest(targetPath))
.on('end', resolve)
.on('error', reject);
},
reject);
});
}
};
} | module.exports = function ( opt )
{
opt = opt || {};
var vfs = require('vinyl-fs'),
Promise = require('promise');
// Hook function
return function ( context )
{
var targetPath = opt.targetPath || context.targetPath;
// Package hook function
return function ( pkg, globs )
{
// Promise
return new Promise(function ( resolve, reject )
{
context.invokedPromise.then(function ( )
{
vfs.src(globs, {cwd: pkg.exportsAbsolutePath})
.pipe(vfs.dest(targetPath))
.on('end', resolve)
.on('error', reject);
});
});
}
};
} | Remove debug logging and rejection on invoke promise rejection | Remove debug logging and rejection on invoke promise rejection
| JavaScript | mit | pavetra/packetizer | javascript | ## Code Before:
module.exports = function ( opt )
{
opt = opt || {};
var vfs = require('vinyl-fs'),
Promise = require('promise');
// Hook function
return function ( context )
{
var targetPath = opt.targetPath || context.targetPath;
// Package hook function
return function ( pkg, globs )
{
// Promise
return new Promise(function ( resolve, reject )
{
context.invokedPromise.then(function ( )
{
console.log(pkg);
vfs.src(globs, {cwd: pkg.exportsAbsolutePath})
.pipe(vfs.dest(targetPath))
.on('end', resolve)
.on('error', reject);
},
reject);
});
}
};
}
## Instruction:
Remove debug logging and rejection on invoke promise rejection
## Code After:
module.exports = function ( opt )
{
opt = opt || {};
var vfs = require('vinyl-fs'),
Promise = require('promise');
// Hook function
return function ( context )
{
var targetPath = opt.targetPath || context.targetPath;
// Package hook function
return function ( pkg, globs )
{
// Promise
return new Promise(function ( resolve, reject )
{
context.invokedPromise.then(function ( )
{
vfs.src(globs, {cwd: pkg.exportsAbsolutePath})
.pipe(vfs.dest(targetPath))
.on('end', resolve)
.on('error', reject);
});
});
}
};
} | module.exports = function ( opt )
{
opt = opt || {};
var vfs = require('vinyl-fs'),
Promise = require('promise');
// Hook function
return function ( context )
{
var targetPath = opt.targetPath || context.targetPath;
// Package hook function
return function ( pkg, globs )
{
// Promise
return new Promise(function ( resolve, reject )
{
context.invokedPromise.then(function ( )
{
- console.log(pkg);
vfs.src(globs, {cwd: pkg.exportsAbsolutePath})
.pipe(vfs.dest(targetPath))
.on('end', resolve)
.on('error', reject);
- },
? ^
+ });
? ^^
- reject);
});
}
};
} | 4 | 0.129032 | 1 | 3 |
00383460da8fa380c65dd658fb8d1a12192f3e24 | common-jwt/src/main/resources/sg/ncl/common/jwt/jwt.yml | common-jwt/src/main/resources/sg/ncl/common/jwt/jwt.yml | ncl:
jwt:
# please set value for the variable (${jwt.apiKey}) externally (e.g., environment variables, properties file)
apiKey: ${jwt.apiKey}
| ncl:
jwt:
# please set value for the variable (${jwt.apiKey}) externally (e.g., environment variables, properties file)
apiKey: ${jwt.apiKey}
signing-algorithm: HS512
| Set default signing algorithm HS512 (DEV-99) | Set default signing algorithm HS512 (DEV-99)
| YAML | apache-2.0 | nus-ncl/services-in-one,nus-ncl/services-in-one | yaml | ## Code Before:
ncl:
jwt:
# please set value for the variable (${jwt.apiKey}) externally (e.g., environment variables, properties file)
apiKey: ${jwt.apiKey}
## Instruction:
Set default signing algorithm HS512 (DEV-99)
## Code After:
ncl:
jwt:
# please set value for the variable (${jwt.apiKey}) externally (e.g., environment variables, properties file)
apiKey: ${jwt.apiKey}
signing-algorithm: HS512
| ncl:
jwt:
# please set value for the variable (${jwt.apiKey}) externally (e.g., environment variables, properties file)
apiKey: ${jwt.apiKey}
+ signing-algorithm: HS512 | 1 | 0.25 | 1 | 0 |
92cef1fd7a5b418c5d5d5f0f24d1265ef03acd6b | tests/cli.js | tests/cli.js | var assert = require('assert'),
should = require('should'),
childProcess = require('child_process');
describe('CLI', function () {
describe('#help', function () {
it('should return help instructions', function (done) {
var command = 'sass-lint -h';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
assert(stdout.indexOf('Usage') > 0);
done(null);
});
});
});
describe('#version', function () {
it('should return a version', function (done) {
var command = 'sass-lint -V';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
done(null);
});
});
});
});
| var assert = require('assert'),
should = require('should'),
childProcess = require('child_process');
describe('cli', function () {
it('should return help instructions', function (done) {
var command = 'sass-lint -h';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
assert(stdout.indexOf('Usage') > 0);
done(null);
});
});
it('should return a version', function (done) {
var command = 'sass-lint -V';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
done(null);
});
});
});
| Improve naming of CLI tests | :art: Improve naming of CLI tests
| JavaScript | mit | sasstools/sass-lint,Snugug/sass-lint,skovhus/sass-lint,flacerdk/sass-lint,sktt/sass-lint,bgriffith/sass-lint,zaplab/sass-lint,ngryman/sass-lint,benthemonkey/sass-lint,srowhani/sass-lint,srowhani/sass-lint,sasstools/sass-lint,DanPurdy/sass-lint,joshuacc/sass-lint,alansouzati/sass-lint,MethodGrab/sass-lint,donabrams/sass-lint,Dru89/sass-lint,zallek/sass-lint | javascript | ## Code Before:
var assert = require('assert'),
should = require('should'),
childProcess = require('child_process');
describe('CLI', function () {
describe('#help', function () {
it('should return help instructions', function (done) {
var command = 'sass-lint -h';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
assert(stdout.indexOf('Usage') > 0);
done(null);
});
});
});
describe('#version', function () {
it('should return a version', function (done) {
var command = 'sass-lint -V';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
done(null);
});
});
});
});
## Instruction:
:art: Improve naming of CLI tests
## Code After:
var assert = require('assert'),
should = require('should'),
childProcess = require('child_process');
describe('cli', function () {
it('should return help instructions', function (done) {
var command = 'sass-lint -h';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
assert(stdout.indexOf('Usage') > 0);
done(null);
});
});
it('should return a version', function (done) {
var command = 'sass-lint -V';
childProcess.exec(command, function (err, stdout) {
if (err) {
return done(err);
}
should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
done(null);
});
});
});
| var assert = require('assert'),
should = require('should'),
childProcess = require('child_process');
- describe('CLI', function () {
? ^^^
+ describe('cli', function () {
? ^^^
- describe('#help', function () {
- it('should return help instructions', function (done) {
? --
+ it('should return help instructions', function (done) {
+ var command = 'sass-lint -h';
- var command = 'sass-lint -h';
+ childProcess.exec(command, function (err, stdout) {
+ if (err) {
+ return done(err);
+ }
+ assert(stdout.indexOf('Usage') > 0);
- childProcess.exec(command, function (err, stdout) {
- if (err) {
- return done(err);
- }
- assert(stdout.indexOf('Usage') > 0);
+ done(null);
+ });
- done(null);
- });
-
- });
});
- describe('#version', function () {
- it('should return a version', function (done) {
? --
+ it('should return a version', function (done) {
+ var command = 'sass-lint -V';
- var command = 'sass-lint -V';
+ childProcess.exec(command, function (err, stdout) {
+ if (err) {
+ return done(err);
+ }
+ should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
- childProcess.exec(command, function (err, stdout) {
- if (err) {
- return done(err);
- }
- should(stdout).match(/^[0-9]+.[0-9]+(.[0-9]+)?/);
+ done(null);
+ });
- done(null);
- });
-
- });
});
}); | 44 | 1.047619 | 19 | 25 |
aae84224b5a2d1689b1739da319d140474702c96 | zuice/bindings.py | zuice/bindings.py | class Bindings(object):
def __init__(self):
self._bindings = {}
def bind(self, key):
if key in self:
raise AlreadyBoundException("Cannot rebind key: %s" % key)
return Binder(key, self._bindings)
def copy(self):
copy = Bindings()
copy._bindings = self._bindings.copy()
return copy
def update(self, bindings):
for key in bindings._bindings:
if key in self._bindings:
raise AlreadyBoundException("Key already bound: %s" % key)
self._bindings.update(bindings._bindings)
def __contains__(self, key):
return key in self._bindings
def __getitem__(self, key):
return self._bindings[key]
class Binder(object):
def __init__(self, key, bindings):
self._bound = False
self._key = key
self._bindings = bindings
def to_instance(self, instance):
self.to_provider(lambda: instance)
def to_key(self, key):
if key is self._key:
raise TypeError("Cannot bind a key to itself")
self.to_provider(lambda injector: injector.get(key))
def to_type(self, key):
return self.to_key(key)
def to_provider(self, provider):
if self._bound:
raise AlreadyBoundException()
self._bound = True
self._bindings[self._key] = provider
class AlreadyBoundException(Exception):
pass
| class Bindings(object):
def __init__(self):
self._bindings = {}
def bind(self, key, provider=None):
if key in self:
raise AlreadyBoundException("Cannot rebind key: %s" % key)
if provider is None:
return Binder(key, self)
else:
self._bindings[key] = provider
def copy(self):
copy = Bindings()
copy._bindings = self._bindings.copy()
return copy
def update(self, bindings):
for key in bindings._bindings:
if key in self._bindings:
raise AlreadyBoundException("Key already bound: %s" % key)
self._bindings.update(bindings._bindings)
def __contains__(self, key):
return key in self._bindings
def __getitem__(self, key):
return self._bindings[key]
class Binder(object):
def __init__(self, key, bindings):
self._key = key
self._bindings = bindings
def to_instance(self, instance):
self.to_provider(lambda: instance)
def to_key(self, key):
if key is self._key:
raise TypeError("Cannot bind a key to itself")
self.to_provider(lambda injector: injector.get(key))
def to_type(self, key):
return self.to_key(key)
def to_provider(self, provider):
self._bindings.bind(self._key, provider)
class AlreadyBoundException(Exception):
pass
| Simplify detection of keys already bound | Simplify detection of keys already bound
| Python | bsd-2-clause | mwilliamson/zuice | python | ## Code Before:
class Bindings(object):
def __init__(self):
self._bindings = {}
def bind(self, key):
if key in self:
raise AlreadyBoundException("Cannot rebind key: %s" % key)
return Binder(key, self._bindings)
def copy(self):
copy = Bindings()
copy._bindings = self._bindings.copy()
return copy
def update(self, bindings):
for key in bindings._bindings:
if key in self._bindings:
raise AlreadyBoundException("Key already bound: %s" % key)
self._bindings.update(bindings._bindings)
def __contains__(self, key):
return key in self._bindings
def __getitem__(self, key):
return self._bindings[key]
class Binder(object):
def __init__(self, key, bindings):
self._bound = False
self._key = key
self._bindings = bindings
def to_instance(self, instance):
self.to_provider(lambda: instance)
def to_key(self, key):
if key is self._key:
raise TypeError("Cannot bind a key to itself")
self.to_provider(lambda injector: injector.get(key))
def to_type(self, key):
return self.to_key(key)
def to_provider(self, provider):
if self._bound:
raise AlreadyBoundException()
self._bound = True
self._bindings[self._key] = provider
class AlreadyBoundException(Exception):
pass
## Instruction:
Simplify detection of keys already bound
## Code After:
class Bindings(object):
def __init__(self):
self._bindings = {}
def bind(self, key, provider=None):
if key in self:
raise AlreadyBoundException("Cannot rebind key: %s" % key)
if provider is None:
return Binder(key, self)
else:
self._bindings[key] = provider
def copy(self):
copy = Bindings()
copy._bindings = self._bindings.copy()
return copy
def update(self, bindings):
for key in bindings._bindings:
if key in self._bindings:
raise AlreadyBoundException("Key already bound: %s" % key)
self._bindings.update(bindings._bindings)
def __contains__(self, key):
return key in self._bindings
def __getitem__(self, key):
return self._bindings[key]
class Binder(object):
def __init__(self, key, bindings):
self._key = key
self._bindings = bindings
def to_instance(self, instance):
self.to_provider(lambda: instance)
def to_key(self, key):
if key is self._key:
raise TypeError("Cannot bind a key to itself")
self.to_provider(lambda injector: injector.get(key))
def to_type(self, key):
return self.to_key(key)
def to_provider(self, provider):
self._bindings.bind(self._key, provider)
class AlreadyBoundException(Exception):
pass
| class Bindings(object):
def __init__(self):
self._bindings = {}
- def bind(self, key):
+ def bind(self, key, provider=None):
? +++++++++++++++
if key in self:
raise AlreadyBoundException("Cannot rebind key: %s" % key)
+
+ if provider is None:
- return Binder(key, self._bindings)
? ----------
+ return Binder(key, self)
? ++++
+ else:
+ self._bindings[key] = provider
def copy(self):
copy = Bindings()
copy._bindings = self._bindings.copy()
return copy
def update(self, bindings):
for key in bindings._bindings:
if key in self._bindings:
raise AlreadyBoundException("Key already bound: %s" % key)
self._bindings.update(bindings._bindings)
def __contains__(self, key):
return key in self._bindings
def __getitem__(self, key):
return self._bindings[key]
class Binder(object):
def __init__(self, key, bindings):
- self._bound = False
self._key = key
self._bindings = bindings
def to_instance(self, instance):
self.to_provider(lambda: instance)
def to_key(self, key):
if key is self._key:
raise TypeError("Cannot bind a key to itself")
self.to_provider(lambda injector: injector.get(key))
def to_type(self, key):
return self.to_key(key)
def to_provider(self, provider):
- if self._bound:
- raise AlreadyBoundException()
- self._bound = True
- self._bindings[self._key] = provider
? ^ ^^^
+ self._bindings.bind(self._key, provider)
? ^^^^^^ ^ +
class AlreadyBoundException(Exception):
pass | 14 | 0.27451 | 7 | 7 |
f8d8150499b05a96618c067a3c99f8d76004d5bc | index.js | index.js | var $ = require('dom')
module.exports = Button
function Button(ele, opts) {
if (!(this instanceof Button))
return new Button(ele, opts)
this.opts = {
loadingText: opts.loadingText || 'loading...'
}
this.ele = $(ele)
this.isLoading = false
}
Button.prototype.setState = function(state) {
var d = 'disabled'
var val = this.isInput(this.ele) ? 'val' : 'html'
state = state + 'Text'
var state_ = state + '-text'
if (this.ele.data('reset-text') == null)
this.ele.data('reset-text', this.ele[val]())
if (this.ele.data(state_) == null) {
this.ele[val](this.options[state_])
} else {
this.ele[val](this.ele.data(state_))
}
}
Button.prototype.isInput = function(el) {
if (!el) return false
var tag = el.tagName && el.tagName.toLowerCase()
return tag && tag === 'input'
}
| var $ = require('dom')
module.exports = Button
function Button(ele, opts) {
if (!(this instanceof Button))
return new Button(ele, opts)
if ('string' === typeof opts) {
opts = {
loadingText: opts
}
}
opts = opts || {}
this.opts = {
loadingText: opts.loadingText || 'loading...'
}
this.ele = $(ele)
this.isLoading = false
}
Button.prototype.setState = function(state) {
var d = 'disabled'
var val = this.isInput(this.ele) ? 'val' : 'html'
state = state + 'Text'
var state_ = state + '-text'
if (this.ele.data('reset-text') == null)
this.ele.data('reset-text', this.ele[val]())
if (this.ele.data(state_) == null) {
this.ele[val](this.options[state_])
} else {
this.ele[val](this.ele.data(state_))
}
}
Button.prototype.isInput = function(el) {
if (!el) return false
var tag = el.tagName && el.tagName.toLowerCase()
return tag && tag === 'input'
}
| Allow either a string or object for opts | Allow either a string or object for opts
If string, set this.opts.loadingText to string
| JavaScript | mit | evanlucas/bootstrip-button | javascript | ## Code Before:
var $ = require('dom')
module.exports = Button
function Button(ele, opts) {
if (!(this instanceof Button))
return new Button(ele, opts)
this.opts = {
loadingText: opts.loadingText || 'loading...'
}
this.ele = $(ele)
this.isLoading = false
}
Button.prototype.setState = function(state) {
var d = 'disabled'
var val = this.isInput(this.ele) ? 'val' : 'html'
state = state + 'Text'
var state_ = state + '-text'
if (this.ele.data('reset-text') == null)
this.ele.data('reset-text', this.ele[val]())
if (this.ele.data(state_) == null) {
this.ele[val](this.options[state_])
} else {
this.ele[val](this.ele.data(state_))
}
}
Button.prototype.isInput = function(el) {
if (!el) return false
var tag = el.tagName && el.tagName.toLowerCase()
return tag && tag === 'input'
}
## Instruction:
Allow either a string or object for opts
If string, set this.opts.loadingText to string
## Code After:
var $ = require('dom')
module.exports = Button
function Button(ele, opts) {
if (!(this instanceof Button))
return new Button(ele, opts)
if ('string' === typeof opts) {
opts = {
loadingText: opts
}
}
opts = opts || {}
this.opts = {
loadingText: opts.loadingText || 'loading...'
}
this.ele = $(ele)
this.isLoading = false
}
Button.prototype.setState = function(state) {
var d = 'disabled'
var val = this.isInput(this.ele) ? 'val' : 'html'
state = state + 'Text'
var state_ = state + '-text'
if (this.ele.data('reset-text') == null)
this.ele.data('reset-text', this.ele[val]())
if (this.ele.data(state_) == null) {
this.ele[val](this.options[state_])
} else {
this.ele[val](this.ele.data(state_))
}
}
Button.prototype.isInput = function(el) {
if (!el) return false
var tag = el.tagName && el.tagName.toLowerCase()
return tag && tag === 'input'
}
| var $ = require('dom')
module.exports = Button
function Button(ele, opts) {
if (!(this instanceof Button))
return new Button(ele, opts)
+ if ('string' === typeof opts) {
+ opts = {
+ loadingText: opts
+ }
+ }
+ opts = opts || {}
this.opts = {
loadingText: opts.loadingText || 'loading...'
}
this.ele = $(ele)
this.isLoading = false
}
Button.prototype.setState = function(state) {
var d = 'disabled'
var val = this.isInput(this.ele) ? 'val' : 'html'
state = state + 'Text'
var state_ = state + '-text'
if (this.ele.data('reset-text') == null)
this.ele.data('reset-text', this.ele[val]())
if (this.ele.data(state_) == null) {
this.ele[val](this.options[state_])
} else {
this.ele[val](this.ele.data(state_))
}
}
Button.prototype.isInput = function(el) {
if (!el) return false
var tag = el.tagName && el.tagName.toLowerCase()
return tag && tag === 'input'
} | 6 | 0.171429 | 6 | 0 |
12334d71769733b9357f42719edb0c8f1a5bf5da | src/app/components/DropdownCover/styles.less | src/app/components/DropdownCover/styles.less | @import (reference) '~app/less/variables';
@import (reference) '~app/less/themes/themeify';
.DropdownCover {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: @z-index-overlay;
.themeify({
background-color: @theme-overlay-color;
});
}
| @import (reference) '~app/less/variables';
@import (reference) '~app/less/themes/themeify';
.DropdownCover {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
cursor: pointer;
z-index: @z-index-overlay;
.themeify({
background-color: @theme-overlay-color;
});
}
| Make dropdowns close on IOS when clicking outside the menu | Make dropdowns close on IOS when clicking outside the menu
Thanks Apple. This is silly, but described by links like
http://stackoverflow.com/questions/3705937/
in which setting `cursor: pointer;`to the DropdownCover
tricks mobile safari into handling the click event...
you know, because it's not a touch event. | Less | mit | ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile | less | ## Code Before:
@import (reference) '~app/less/variables';
@import (reference) '~app/less/themes/themeify';
.DropdownCover {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: @z-index-overlay;
.themeify({
background-color: @theme-overlay-color;
});
}
## Instruction:
Make dropdowns close on IOS when clicking outside the menu
Thanks Apple. This is silly, but described by links like
http://stackoverflow.com/questions/3705937/
in which setting `cursor: pointer;`to the DropdownCover
tricks mobile safari into handling the click event...
you know, because it's not a touch event.
## Code After:
@import (reference) '~app/less/variables';
@import (reference) '~app/less/themes/themeify';
.DropdownCover {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
cursor: pointer;
z-index: @z-index-overlay;
.themeify({
background-color: @theme-overlay-color;
});
}
| @import (reference) '~app/less/variables';
@import (reference) '~app/less/themes/themeify';
.DropdownCover {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
+ cursor: pointer;
z-index: @z-index-overlay;
.themeify({
background-color: @theme-overlay-color;
});
} | 1 | 0.066667 | 1 | 0 |
f6ab394201007fd147ab201f9ff2dcf2db9b759d | Install-CommonDev.ps1 | Install-CommonDev.ps1 | if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
{
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
## Development Tools - Common
cinst papercut
## cinst redis
## cinst jenkins
## cinst rabbitmq
## cinst MongoVUE
## Development Tools - Android
## cinst android-sdk
## cinst python3
## cinst ruby
## cinst python | if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
{
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
## Development Tools - Common
cinst papercut
## cinst redis
## cinst jenkins
## cinst rabbitmq
## cinst mongodb
## cinst MongoVUE
## Development Tools - Java
cinst java.jdk
## cinst Grails
## Development Tools - Ruby
## cinst ruby
## Development Tools - Android
## cinst android-sdk
## Development Tools - Python
## cinst python3
## cinst python
## cinst easy.install | Add java and python dev tools section | Add java and python dev tools section
| PowerShell | mit | mattgwagner/New-Machine,mattgwagner/New-Machine,mattgwagner/New-Machine,mattgwagner/New-Machine | powershell | ## Code Before:
if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
{
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
## Development Tools - Common
cinst papercut
## cinst redis
## cinst jenkins
## cinst rabbitmq
## cinst MongoVUE
## Development Tools - Android
## cinst android-sdk
## cinst python3
## cinst ruby
## cinst python
## Instruction:
Add java and python dev tools section
## Code After:
if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
{
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
## Development Tools - Common
cinst papercut
## cinst redis
## cinst jenkins
## cinst rabbitmq
## cinst mongodb
## cinst MongoVUE
## Development Tools - Java
cinst java.jdk
## cinst Grails
## Development Tools - Ruby
## cinst ruby
## Development Tools - Android
## cinst android-sdk
## Development Tools - Python
## cinst python3
## cinst python
## cinst easy.install | if(-not $env:ChocolateyInstall -or -not (Test-Path "$env:ChocolateyInstall"))
{
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
}
## Development Tools - Common
cinst papercut
## cinst redis
## cinst jenkins
## cinst rabbitmq
+ ## cinst mongodb
+
## cinst MongoVUE
+
+ ## Development Tools - Java
+
+ cinst java.jdk
+
+ ## cinst Grails
+
+ ## Development Tools - Ruby
+
+ ## cinst ruby
## Development Tools - Android
## cinst android-sdk
+ ## Development Tools - Python
+
## cinst python3
- ## cinst ruby
+ ## cinst python
- ## cinst python
+ ## cinst easy.install | 18 | 0.692308 | 16 | 2 |
8b4705fea6297a23f708c59cbce3c8a3115128c0 | db/migrate/20150411000035_fix_identities.rb | db/migrate/20150411000035_fix_identities.rb | class FixIdentities < ActiveRecord::Migration
def up
# Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab
# configuration. So if the database said 'provider: ldap' but the first
# LDAP server was called 'ldapmain', then we would try to interpret
# 'provider: ldap' as if it said 'provider: ldapmain'. This migration (and
# accompanying changes in the GitLab LDAP code) get rid of this complicated
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
new_provider = Gitlab.config.ldap.servers.first.last['provider_name']
# Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
if defined?(LdapGroupLink)
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
def down
end
end
| class FixIdentities < ActiveRecord::Migration
def up
# Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab
# configuration. So if the database said 'provider: ldap' but the first
# LDAP server was called 'ldapmain', then we would try to interpret
# 'provider: ldap' as if it said 'provider: ldapmain'. This migration (and
# accompanying changes in the GitLab LDAP code) get rid of this complicated
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
new_provider = if Gitlab.config.ldap.enabled
first_ldap_server = Gitlab.config.ldap.servers.values.first
first_ldap_server['provider_name']
else
'ldapmain'
end
# Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
if defined?(LdapGroupLink)
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
def down
end
end
| Make migration work if LDAP is disabled | Make migration work if LDAP is disabled
| Ruby | mit | hzy001/gitlabhq,Soullivaneuh/gitlabhq,szechyjs/gitlabhq,michaKFromParis/sparkslab,michaKFromParis/gitlabhq,mente/gitlabhq,WSDC-NITWarangal/gitlabhq,ksoichiro/gitlabhq,rumpelsepp/gitlabhq,fscherwi/gitlabhq,dplarson/gitlabhq,fearenales/gitlabhq,WSDC-NITWarangal/gitlabhq,mrb/gitlabhq,per-garden/gitlabhq,stoplightio/gitlabhq,darkrasid/gitlabhq,martijnvermaat/gitlabhq,htve/GitlabForChinese,eliasp/gitlabhq,sonalkr132/gitlabhq,dplarson/gitlabhq,yonglehou/gitlabhq,Burick/gitlabhq,axilleas/gitlabhq,fendoudeqingchunhh/gitlabhq,Burick/gitlabhq,aaronsnyder/gitlabhq,ordiychen/gitlabhq,gopeter/gitlabhq,pjknkda/gitlabhq,flashbuckets/gitlabhq,cncodog/gitlab,tk23/gitlabhq,manfer/gitlabhq,yama07/gitlabhq,Exeia/gitlabhq,stoplightio/gitlabhq,t-zuehlsdorff/gitlabhq,manfer/gitlabhq,Exeia/gitlabhq,ferdinandrosario/gitlabhq,OlegGirko/gitlab-ce,fantasywind/gitlabhq,LUMC/gitlabhq,mmkassem/gitlabhq,dvrylc/gitlabhq,lvfeng1130/gitlabhq,cncodog/gitlab,gorgee/gitlabhq,icedwater/gitlabhq,michaKFromParis/gitlabhqold,whluwit/gitlabhq,vjustov/gitlabhq,bozaro/gitlabhq,rhels/gitlabhq,MauriceMohlek/gitlabhq,axilleas/gitlabhq,ayufan/gitlabhq,cncodog/gitlab,allistera/gitlabhq,whluwit/gitlabhq,hacsoc/gitlabhq,hzy001/gitlabhq,stanhu/gitlabhq,kitech/gitlabhq,DanielZhangQingLong/gitlabhq,ayufan/gitlabhq,yatish27/gitlabhq,nmav/gitlabhq,bbodenmiller/gitlabhq,per-garden/gitlabhq,ngpestelos/gitlabhq,williamherry/gitlabhq,duduribeiro/gitlabhq,bozaro/gitlabhq,jirutka/gitlabhq,MauriceMohlek/gitlabhq,chadyred/gitlabhq,yonglehou/gitlabhq,Tyrael/gitlabhq,icedwater/gitlabhq,OtkurBiz/gitlabhq,yama07/gitlabhq,fpgentil/gitlabhq,SVArago/gitlabhq,michaKFromParis/gitlabhqold,daiyu/gitlab-zh,mavimo/gitlabhq,ferdinandrosario/gitlabhq,childbamboo/gitlabhq,nmav/gitlabhq,copystudy/gitlabhq,ayufan/gitlabhq,fscherwi/gitlabhq,childbamboo/gitlabhq,copystudy/gitlabhq,screenpages/gitlabhq,wangcan2014/gitlabhq,screenpages/gitlabhq,aaronsnyder/gitlabhq,LytayTOUCH/gitlabhq,fendoudeqingchunhh/gitlabhq,tempbottle/gitlabhq,ordiychen/gitlabhq,nmav/gitlabhq,fgbreel/gitlabhq,ferdinandrosario/gitlabhq,Burick/gitlabhq,Devin001/gitlabhq,hacsoc/gitlabhq,zrbsprite/gitlabhq,allistera/gitlabhq,DanielZhangQingLong/gitlabhq,dvrylc/gitlabhq,ferdinandrosario/gitlabhq,joalmeid/gitlabhq,ordiychen/gitlabhq,H3Chief/gitlabhq,szechyjs/gitlabhq,htve/GitlabForChinese,youprofit/gitlabhq,aaronsnyder/gitlabhq,allistera/gitlabhq,martinma4/gitlabhq,per-garden/gitlabhq,yatish27/gitlabhq,eliasp/gitlabhq,jrjang/gitlab-ce,LUMC/gitlabhq,zBMNForks/gitlabhq,delkyd/gitlabhq,sue445/gitlabhq,duduribeiro/gitlabhq,tempbottle/gitlabhq,louahola/gitlabhq,liyakun/gitlabhq,iiet/iiet-git,luzhongyang/gitlabhq,Exeia/gitlabhq,julianengel/gitlabhq,dreampet/gitlab,delkyd/gitlabhq,nmav/gitlabhq,SVArago/gitlabhq,jaepyoung/gitlabhq,luzhongyang/gitlabhq,sakishum/gitlabhq,louahola/gitlabhq,folpindo/gitlabhq,mr-dxdy/gitlabhq,fearenales/gitlabhq,SVArago/gitlabhq,liyakun/gitlabhq,dvrylc/gitlabhq,icedwater/gitlabhq,Razer6/gitlabhq,screenpages/gitlabhq,NKMR6194/gitlabhq,salipro4ever/gitlabhq,cui-liqiang/gitlab-ce,mrb/gitlabhq,szechyjs/gitlabhq,tim-hoff/gitlabhq,LytayTOUCH/gitlabhq,jaepyoung/gitlabhq,pulkit21/gitlabhq,bbodenmiller/gitlabhq,folpindo/gitlabhq,jirutka/gitlabhq,koreamic/gitlabhq,zrbsprite/gitlabhq,liyakun/gitlabhq,stoplightio/gitlabhq,yuyue2013/ss,stanhu/gitlabhq,larryli/gitlabhq,Soullivaneuh/gitlabhq,DanielZhangQingLong/gitlabhq,aaronsnyder/gitlabhq,liyakun/gitlabhq,yuyue2013/ss,jirutka/gitlabhq,cinderblock/gitlabhq,zBMNForks/gitlabhq,allysonbarros/gitlabhq,szechyjs/gitlabhq,mente/gitlabhq,martinma4/gitlabhq,kemenaran/gitlabhq,daiyu/gitlab-zh,louahola/gitlabhq,martijnvermaat/gitlabhq,k4zzk/gitlabhq,Tyrael/gitlabhq,sakishum/gitlabhq,tempbottle/gitlabhq,t-zuehlsdorff/gitlabhq,jvanbaarsen/gitlabhq,jrjang/gitlab-ce,tk23/gitlabhq,rumpelsepp/gitlabhq,vjustov/gitlabhq,nguyen-tien-mulodo/gitlabhq,Razer6/gitlabhq,fearenales/gitlabhq,jirutka/gitlabhq,nguyen-tien-mulodo/gitlabhq,salipro4ever/gitlabhq,Devin001/gitlabhq,yfaizal/gitlabhq,MauriceMohlek/gitlabhq,copystudy/gitlabhq,since2014/gitlabhq,cui-liqiang/gitlab-ce,rhels/gitlabhq,tk23/gitlabhq,flashbuckets/gitlabhq,michaKFromParis/gitlabhq,flashbuckets/gitlabhq,TheWatcher/gitlabhq,darkrasid/gitlabhq,joalmeid/gitlabhq,dreampet/gitlab,manfer/gitlabhq,gopeter/gitlabhq,yama07/gitlabhq,chenrui2014/gitlabhq,johnmyqin/gitlabhq,yfaizal/gitlabhq,kemenaran/gitlabhq,OtkurBiz/gitlabhq,fpgentil/gitlabhq,openwide-java/gitlabhq,fantasywind/gitlabhq,childbamboo/gitlabhq,Telekom-PD/gitlabhq,kemenaran/gitlabhq,daiyu/gitlab-zh,martinma4/gitlabhq,fantasywind/gitlabhq,koreamic/gitlabhq,rebecamendez/gitlabhq,since2014/gitlabhq,julianengel/gitlabhq,OlegGirko/gitlab-ce,stanhu/gitlabhq,fgbreel/gitlabhq,pjknkda/gitlabhq,ttasanen/gitlabhq,wangcan2014/gitlabhq,ngpestelos/gitlabhq,louahola/gitlabhq,rebecamendez/gitlabhq,rhels/gitlabhq,ikappas/gitlabhq,Telekom-PD/gitlabhq,openwide-java/gitlabhq,mr-dxdy/gitlabhq,pjknkda/gitlabhq,zBMNForks/gitlabhq,Datacom/gitlabhq,allysonbarros/gitlabhq,hq804116393/gitlabhq,youprofit/gitlabhq,initiummedia/gitlabhq,jvanbaarsen/gitlabhq,dukex/gitlabhq,williamherry/gitlabhq,kemenaran/gitlabhq,H3Chief/gitlabhq,zrbsprite/gitlabhq,ttasanen/gitlabhq,bbodenmiller/gitlabhq,bigsurge/gitlabhq,shinexiao/gitlabhq,it33/gitlabhq,williamherry/gitlabhq,rebecamendez/gitlabhq,hacsoc/gitlabhq,mrb/gitlabhq,michaKFromParis/gitlabhq,fpgentil/gitlabhq,rhels/gitlabhq,chenrui2014/gitlabhq,darkrasid/gitlabhq,SVArago/gitlabhq,sakishum/gitlabhq,cinderblock/gitlabhq,nguyen-tien-mulodo/gitlabhq,OtkurBiz/gitlabhq,openwide-java/gitlabhq,NKMR6194/gitlabhq,fscherwi/gitlabhq,k4zzk/gitlabhq,chenrui2014/gitlabhq,fpgentil/gitlabhq,hacsoc/gitlabhq,mente/gitlabhq,LUMC/gitlabhq,allysonbarros/gitlabhq,fgbreel/gitlabhq,mavimo/gitlabhq,michaKFromParis/sparkslab,k4zzk/gitlabhq,fscherwi/gitlabhq,sekcheong/gitlabhq,koreamic/gitlabhq,dwrensha/gitlabhq,pjknkda/gitlabhq,martinma4/gitlabhq,DanielZhangQingLong/gitlabhq,fgbreel/gitlabhq,chadyred/gitlabhq,it33/gitlabhq,per-garden/gitlabhq,Devin001/gitlabhq,TheWatcher/gitlabhq,jrjang/gitlab-ce,tk23/gitlabhq,mr-dxdy/gitlabhq,duduribeiro/gitlabhq,duduribeiro/gitlabhq,chenrui2014/gitlabhq,darkrasid/gitlabhq,sekcheong/gitlabhq,iiet/iiet-git,michaKFromParis/sparkslab,daiyu/gitlab-zh,theonlydoo/gitlabhq,fendoudeqingchunhh/gitlabhq,zBMNForks/gitlabhq,cncodog/gitlab,dwrensha/gitlabhq,Burick/gitlabhq,ngpestelos/gitlabhq,gorgee/gitlabhq,LytayTOUCH/gitlabhq,stoplightio/gitlabhq,sekcheong/gitlabhq,shinexiao/gitlabhq,hq804116393/gitlabhq,t-zuehlsdorff/gitlabhq,yfaizal/gitlabhq,revaret/gitlabhq,revaret/gitlabhq,Razer6/gitlabhq,salipro4ever/gitlabhq,Devin001/gitlabhq,kitech/gitlabhq,sonalkr132/gitlabhq,julianengel/gitlabhq,htve/GitlabForChinese,hq804116393/gitlabhq,joalmeid/gitlabhq,mr-dxdy/gitlabhq,youprofit/gitlabhq,gopeter/gitlabhq,hq804116393/gitlabhq,wangcan2014/gitlabhq,NKMR6194/gitlabhq,whluwit/gitlabhq,ksoichiro/gitlabhq,Soullivaneuh/gitlabhq,sonalkr132/gitlabhq,dukex/gitlabhq,theodi/gitlabhq,since2014/gitlabhq,vjustov/gitlabhq,OlegGirko/gitlab-ce,jvanbaarsen/gitlabhq,fearenales/gitlabhq,shinexiao/gitlabhq,openwide-java/gitlabhq,ikappas/gitlabhq,jrjang/gitlabhq,k4zzk/gitlabhq,jrjang/gitlabhq,tim-hoff/gitlabhq,kitech/gitlabhq,tim-hoff/gitlabhq,theodi/gitlabhq,initiummedia/gitlabhq,jrjang/gitlabhq,pulkit21/gitlabhq,hzy001/gitlabhq,pulkit21/gitlabhq,sue445/gitlabhq,Datacom/gitlabhq,it33/gitlabhq,tempbottle/gitlabhq,theonlydoo/gitlabhq,allistera/gitlabhq,ksoichiro/gitlabhq,axilleas/gitlabhq,luzhongyang/gitlabhq,Razer6/gitlabhq,johnmyqin/gitlabhq,dukex/gitlabhq,folpindo/gitlabhq,cinderblock/gitlabhq,mrb/gitlabhq,shinexiao/gitlabhq,Soullivaneuh/gitlabhq,sue445/gitlabhq,MauriceMohlek/gitlabhq,michaKFromParis/gitlabhqold,jvanbaarsen/gitlabhq,pulkit21/gitlabhq,childbamboo/gitlabhq,ttasanen/gitlabhq,yama07/gitlabhq,jaepyoung/gitlabhq,mmkassem/gitlabhq,Telekom-PD/gitlabhq,WSDC-NITWarangal/gitlabhq,ayufan/gitlabhq,michaKFromParis/gitlabhq,sekcheong/gitlabhq,since2014/gitlabhq,TheWatcher/gitlabhq,ikappas/gitlabhq,rebecamendez/gitlabhq,H3Chief/gitlabhq,screenpages/gitlabhq,TheWatcher/gitlabhq,Exeia/gitlabhq,LUMC/gitlabhq,yuyue2013/ss,martijnvermaat/gitlabhq,dwrensha/gitlabhq,revaret/gitlabhq,gorgee/gitlabhq,mente/gitlabhq,Tyrael/gitlabhq,LytayTOUCH/gitlabhq,theodi/gitlabhq,revaret/gitlabhq,koreamic/gitlabhq,luzhongyang/gitlabhq,dreampet/gitlab,NKMR6194/gitlabhq,Datacom/gitlabhq,manfer/gitlabhq,dvrylc/gitlabhq,dukex/gitlabhq,jrjang/gitlabhq,joalmeid/gitlabhq,yuyue2013/ss,initiummedia/gitlabhq,zrbsprite/gitlabhq,rumpelsepp/gitlabhq,gopeter/gitlabhq,mavimo/gitlabhq,kitech/gitlabhq,it33/gitlabhq,yonglehou/gitlabhq,Tyrael/gitlabhq,bigsurge/gitlabhq,sue445/gitlabhq,mmkassem/gitlabhq,lvfeng1130/gitlabhq,michaKFromParis/sparkslab,htve/GitlabForChinese,whluwit/gitlabhq,yatish27/gitlabhq,yfaizal/gitlabhq,ksoichiro/gitlabhq,delkyd/gitlabhq,mavimo/gitlabhq,eliasp/gitlabhq,dplarson/gitlabhq,jrjang/gitlab-ce,williamherry/gitlabhq,theonlydoo/gitlabhq,gorgee/gitlabhq,johnmyqin/gitlabhq,sonalkr132/gitlabhq,bozaro/gitlabhq,stanhu/gitlabhq,sakishum/gitlabhq,johnmyqin/gitlabhq,michaKFromParis/gitlabhqold,iiet/iiet-git,wangcan2014/gitlabhq,julianengel/gitlabhq,rumpelsepp/gitlabhq,dplarson/gitlabhq,mmkassem/gitlabhq,cinderblock/gitlabhq,fantasywind/gitlabhq,bbodenmiller/gitlabhq,ikappas/gitlabhq,t-zuehlsdorff/gitlabhq,martijnvermaat/gitlabhq,eliasp/gitlabhq,ngpestelos/gitlabhq,jaepyoung/gitlabhq,delkyd/gitlabhq,theodi/gitlabhq,cui-liqiang/gitlab-ce,OlegGirko/gitlab-ce,yatish27/gitlabhq,ordiychen/gitlabhq,larryli/gitlabhq,folpindo/gitlabhq,salipro4ever/gitlabhq,lvfeng1130/gitlabhq,dreampet/gitlab,initiummedia/gitlabhq,axilleas/gitlabhq,icedwater/gitlabhq,allysonbarros/gitlabhq,hzy001/gitlabhq,vjustov/gitlabhq,copystudy/gitlabhq,chadyred/gitlabhq,bigsurge/gitlabhq,OtkurBiz/gitlabhq,youprofit/gitlabhq,yonglehou/gitlabhq,theonlydoo/gitlabhq,dwrensha/gitlabhq,fendoudeqingchunhh/gitlabhq,iiet/iiet-git,tim-hoff/gitlabhq,chadyred/gitlabhq,lvfeng1130/gitlabhq,bigsurge/gitlabhq,WSDC-NITWarangal/gitlabhq,Datacom/gitlabhq,ttasanen/gitlabhq,H3Chief/gitlabhq,cui-liqiang/gitlab-ce,nguyen-tien-mulodo/gitlabhq,larryli/gitlabhq,larryli/gitlabhq,bozaro/gitlabhq,Telekom-PD/gitlabhq,flashbuckets/gitlabhq | ruby | ## Code Before:
class FixIdentities < ActiveRecord::Migration
def up
# Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab
# configuration. So if the database said 'provider: ldap' but the first
# LDAP server was called 'ldapmain', then we would try to interpret
# 'provider: ldap' as if it said 'provider: ldapmain'. This migration (and
# accompanying changes in the GitLab LDAP code) get rid of this complicated
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
new_provider = Gitlab.config.ldap.servers.first.last['provider_name']
# Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
if defined?(LdapGroupLink)
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
def down
end
end
## Instruction:
Make migration work if LDAP is disabled
## Code After:
class FixIdentities < ActiveRecord::Migration
def up
# Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab
# configuration. So if the database said 'provider: ldap' but the first
# LDAP server was called 'ldapmain', then we would try to interpret
# 'provider: ldap' as if it said 'provider: ldapmain'. This migration (and
# accompanying changes in the GitLab LDAP code) get rid of this complicated
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
new_provider = if Gitlab.config.ldap.enabled
first_ldap_server = Gitlab.config.ldap.servers.values.first
first_ldap_server['provider_name']
else
'ldapmain'
end
# Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
if defined?(LdapGroupLink)
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
def down
end
end
| class FixIdentities < ActiveRecord::Migration
def up
# Up until now, legacy 'ldap' references in the database were charitably
# interpreted to point to the first LDAP server specified in the GitLab
# configuration. So if the database said 'provider: ldap' but the first
# LDAP server was called 'ldapmain', then we would try to interpret
# 'provider: ldap' as if it said 'provider: ldapmain'. This migration (and
# accompanying changes in the GitLab LDAP code) get rid of this complicated
# behavior. Any database references to 'provider: ldap' get rewritten to
# whatever the code would have interpreted it as, i.e. as a reference to
# the first LDAP server specified in gitlab.yml / gitlab.rb.
- new_provider = Gitlab.config.ldap.servers.first.last['provider_name']
+ new_provider = if Gitlab.config.ldap.enabled
+ first_ldap_server = Gitlab.config.ldap.servers.values.first
+ first_ldap_server['provider_name']
+ else
+ 'ldapmain'
+ end
- # Delete duplicate identities
? ^
+ # Delete duplicate identities
? ^^
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
if defined?(LdapGroupLink)
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
def down
end
end | 9 | 0.333333 | 7 | 2 |
1361a487707f745acf4d38c670f0015820905b2d | .circleci/config.yml | .circleci/config.yml | version: 2
jobs:
build:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python2.7
command: |
./waf configure
./waf --check
- run:
name: build with python2.7
command: |
./waf build
./waf install
| version: 2
jobs:
gcc_5_python27:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python2.7
command: |
python ./waf configure
python ./waf --check
- run:
name: build with python2.7
command: |
python ./waf build
python ./waf install
gcc_5_python34:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python3.4
command: |
apt update -y
apt install -y python3
python3 ./waf configure
python3 ./waf --check
- run:
name: build with python3.4
command: |
python3 ./waf build
python3 ./waf install
workflows:
version: 2
build_and_test:
jobs:
- gcc_5_python27
- gcc_5_python34
| Add the job to build pficommon using python3 | Add the job to build pficommon using python3
| YAML | bsd-3-clause | retrieva/pficommon,pfi/pficommon,pfi/pficommon,retrieva/pficommon,pfi/pficommon,retrieva/pficommon,retrieva/pficommon,pfi/pficommon,retrieva/pficommon | yaml | ## Code Before:
version: 2
jobs:
build:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python2.7
command: |
./waf configure
./waf --check
- run:
name: build with python2.7
command: |
./waf build
./waf install
## Instruction:
Add the job to build pficommon using python3
## Code After:
version: 2
jobs:
gcc_5_python27:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python2.7
command: |
python ./waf configure
python ./waf --check
- run:
name: build with python2.7
command: |
python ./waf build
python ./waf install
gcc_5_python34:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python3.4
command: |
apt update -y
apt install -y python3
python3 ./waf configure
python3 ./waf --check
- run:
name: build with python3.4
command: |
python3 ./waf build
python3 ./waf install
workflows:
version: 2
build_and_test:
jobs:
- gcc_5_python27
- gcc_5_python34
| version: 2
jobs:
- build:
+ gcc_5_python27:
docker:
- image: gcc:5
steps:
- checkout
- run:
name: test with python2.7
command: |
- ./waf configure
+ python ./waf configure
? +++++++
- ./waf --check
+ python ./waf --check
? +++++++
- run:
name: build with python2.7
command: |
- ./waf build
+ python ./waf build
? +++++++
- ./waf install
+ python ./waf install
? +++++++
+ gcc_5_python34:
+ docker:
+ - image: gcc:5
+ steps:
+ - checkout
+ - run:
+ name: test with python3.4
+ command: |
+ apt update -y
+ apt install -y python3
+ python3 ./waf configure
+ python3 ./waf --check
+ - run:
+ name: build with python3.4
+ command: |
+ python3 ./waf build
+ python3 ./waf install
+
+ workflows:
+ version: 2
+ build_and_test:
+ jobs:
+ - gcc_5_python27
+ - gcc_5_python34 | 34 | 2 | 29 | 5 |
e0c685d096bac50e01946d43ab1c7c034ae68d98 | src/config/globalSettings.js | src/config/globalSettings.js | /**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration:500,
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'compose',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
| /**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
boardOuterMargin: 30,
boardPostMargin: 25,
// The following settings can't be changed explcitly.
// Needs to be kept in sync with src/styles/base/variables
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration: 500,
homeViewID: 'HomeView',
contentViewID: 'ContentView',
settingsViewID: 'SettingsView',
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'ios-plus-outline',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
| Add view ID's and board layout options | feat(appSettings): Add view ID's and board layout options
| JavaScript | mit | AdamSalma/Lurka,AdamSalma/Lurka | javascript | ## Code Before:
/**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration:500,
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'compose',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
## Instruction:
feat(appSettings): Add view ID's and board layout options
## Code After:
/**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
boardOuterMargin: 30,
boardPostMargin: 25,
// The following settings can't be changed explcitly.
// Needs to be kept in sync with src/styles/base/variables
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration: 500,
homeViewID: 'HomeView',
contentViewID: 'ContentView',
settingsViewID: 'SettingsView',
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'ios-plus-outline',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
| /**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
+ boardOuterMargin: 30,
+ boardPostMargin: 25,
+
+ // The following settings can't be changed explcitly.
+ // Needs to be kept in sync with src/styles/base/variables
headerHeight: 60,
drawerWidth: 250,
- drawerAnimationDuration:500,
+ drawerAnimationDuration: 500,
? +
+
+ homeViewID: 'HomeView',
+ contentViewID: 'ContentView',
+ settingsViewID: 'SettingsView',
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
- navbarCompose: 'compose',
? ^^^^
+ navbarCompose: 'ios-plus-outline',
? ^ ++++++++++++
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
} | 13 | 0.52 | 11 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.