commit stringlengths 40 40 | old_file stringlengths 4 237 | new_file stringlengths 4 237 | old_contents stringlengths 1 4.24k | new_contents stringlengths 5 4.84k | subject stringlengths 15 778 | message stringlengths 16 6.86k | lang stringlengths 1 30 | license stringclasses 13 values | repos stringlengths 5 116k | config stringlengths 1 30 | content stringlengths 105 8.72k |
|---|---|---|---|---|---|---|---|---|---|---|---|
62b79de5c0de81c02955b53c5574b861dfeeb478 | lib/necromancer/converter.rb | lib/necromancer/converter.rb |
module Necromancer
# Abstract converter used internally as a base for other converters
#
# @api private
class Converter
def initialize(source = nil, target = nil)
@source = source if source
@target = target if target
end
# Run converter
#
# @api private
def call(*)
fail NotImplementedError
end
# Creates anonymous converter
#
# @api private
def self.create(&block)
Class.new(self) do
define_method(:initialize) { |*a| block.call(self, *a) }
define_method(:call) { |value| convert.call(value) }
end.new
end
attr_accessor :source
attr_accessor :target
attr_accessor :convert
end # Converter
end # Necromancer
|
module Necromancer
# Abstract converter used internally as a base for other converters
#
# @api private
class Converter
def initialize(source = nil, target = nil)
@source = source if source
@target = target if target
end
# Run converter
#
# @api private
def call(*)
fail NotImplementedError
end
# Creates anonymous converter
#
# @api private
def self.create(&block)
Class.new(self) do
define_method(:initialize) { |*a| block.call(self, *a) }
define_method(:call) { |value| convert.call(value) }
end.new
end
# Fail with conversion type error
#
# @param [Object] value
# the value that cannot be converted
#
# @api private
def fail_conversion_type(value)
fail ConversionTypeError, "#{value} could not be converted " \
"from `#{source}` into `#{target}`"
end
attr_accessor :source
attr_accessor :target
attr_accessor :convert
end # Converter
end # Necromancer
| Add common type conversion error method. | Add common type conversion error method.
| Ruby | mit | peter-murach/necromancer | ruby | ## Code Before:
module Necromancer
# Abstract converter used internally as a base for other converters
#
# @api private
class Converter
def initialize(source = nil, target = nil)
@source = source if source
@target = target if target
end
# Run converter
#
# @api private
def call(*)
fail NotImplementedError
end
# Creates anonymous converter
#
# @api private
def self.create(&block)
Class.new(self) do
define_method(:initialize) { |*a| block.call(self, *a) }
define_method(:call) { |value| convert.call(value) }
end.new
end
attr_accessor :source
attr_accessor :target
attr_accessor :convert
end # Converter
end # Necromancer
## Instruction:
Add common type conversion error method.
## Code After:
module Necromancer
# Abstract converter used internally as a base for other converters
#
# @api private
class Converter
def initialize(source = nil, target = nil)
@source = source if source
@target = target if target
end
# Run converter
#
# @api private
def call(*)
fail NotImplementedError
end
# Creates anonymous converter
#
# @api private
def self.create(&block)
Class.new(self) do
define_method(:initialize) { |*a| block.call(self, *a) }
define_method(:call) { |value| convert.call(value) }
end.new
end
# Fail with conversion type error
#
# @param [Object] value
# the value that cannot be converted
#
# @api private
def fail_conversion_type(value)
fail ConversionTypeError, "#{value} could not be converted " \
"from `#{source}` into `#{target}`"
end
attr_accessor :source
attr_accessor :target
attr_accessor :convert
end # Converter
end # Necromancer
|
3dfaa91ff7f36d74126fffd9913161f5f531ffe2 | condarecipe/meta.yaml | condarecipe/meta.yaml | package:
name: coffee
version: 0.1.0
source:
path: ..
requirements:
build:
- python
- networkx
run:
- python
- numpy
- networkx
test:
requires:
- pytest
- flake8
commands:
- py.test {{ os.path.join(environ.get('SRC_DIR'), 'tests') }} -v
- flake8 {{ environ.get('SRC_DIR') }}
about:
home: http://www.firedrakeproject.org
license: BSD 3-clause
summary: COFFEE - COmpiler For Fast Expression Evaluation
| package:
name: coffee
version: {{ environ.get('GIT_DESCRIBE_TAG','') }}
source:
path: ..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
build:
- python
- networkx
run:
- python
- numpy
- networkx
test:
requires:
- pytest
- flake8
commands:
- py.test {{ os.path.join(environ.get('SRC_DIR'), 'tests') }} -v
- flake8 {{ environ.get('SRC_DIR') }}
about:
home: http://www.firedrakeproject.org
license: BSD 3-clause
summary: COFFEE - COmpiler For Fast Expression Evaluation
| Use git describe for version and build number | Use git describe for version and build number
| YAML | bsd-3-clause | gmarkall/COFFEE,gmarkall/COFFEE | yaml | ## Code Before:
package:
name: coffee
version: 0.1.0
source:
path: ..
requirements:
build:
- python
- networkx
run:
- python
- numpy
- networkx
test:
requires:
- pytest
- flake8
commands:
- py.test {{ os.path.join(environ.get('SRC_DIR'), 'tests') }} -v
- flake8 {{ environ.get('SRC_DIR') }}
about:
home: http://www.firedrakeproject.org
license: BSD 3-clause
summary: COFFEE - COmpiler For Fast Expression Evaluation
## Instruction:
Use git describe for version and build number
## Code After:
package:
name: coffee
version: {{ environ.get('GIT_DESCRIBE_TAG','') }}
source:
path: ..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
build:
- python
- networkx
run:
- python
- numpy
- networkx
test:
requires:
- pytest
- flake8
commands:
- py.test {{ os.path.join(environ.get('SRC_DIR'), 'tests') }} -v
- flake8 {{ environ.get('SRC_DIR') }}
about:
home: http://www.firedrakeproject.org
license: BSD 3-clause
summary: COFFEE - COmpiler For Fast Expression Evaluation
|
81ba5b6f75ca7e54aee15432077d40d7095b247f | CMakeLists.txt | CMakeLists.txt | cmake_minimum_required(VERSION 2.6)
project(mnf C CXX)
#BLAS library
if (USE_MKL_LIBRARIES)
set(CMAKE_BLAS_LIBS_INIT mkl_intel_lp64 mkl_intel_thread mkl_core iomp5)
else()
find_package(BLAS REQUIRED)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
#mnf library
add_library(mnf SHARED src/mnf_c.cpp src/mnf_linebyline.cpp src/readimage.cpp)
#mnf executable
add_executable(mnf-bin src/main.cpp src/readimage.cpp)
set_target_properties(mnf-bin PROPERTIES OUTPUT_NAME mnf) #set mnf-bin binary name to mnf
target_link_libraries(mnf-bin mnf ${CMAKE_BLAS_LIBS_INIT} lapacke)
#install libraries, binaries and header files
install(TARGETS mnf DESTINATION lib)
install(TARGETS mnf-bin DESTINATION bin)
install(FILES include/mnf_linebyline.h include/mnf.h DESTINATION include)
| cmake_minimum_required(VERSION 2.6)
project(mnf C CXX)
#BLAS library
if (USE_MKL_LIBRARIES)
set(BLAS_LIBRARIES mkl_intel_lp64 mkl_intel_thread mkl_core iomp5)
else()
find_package(BLAS REQUIRED)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
#mnf library
add_library(mnf SHARED src/mnf_c.cpp src/mnf_linebyline.cpp src/readimage.cpp)
#mnf executable
add_executable(mnf-bin src/main.cpp src/readimage.cpp)
set_target_properties(mnf-bin PROPERTIES OUTPUT_NAME mnf) #set mnf-bin binary name to mnf
target_link_libraries(mnf-bin mnf ${BLAS_LIBRARIES} lapacke)
#install libraries, binaries and header files
install(TARGETS mnf DESTINATION lib)
install(TARGETS mnf-bin DESTINATION bin)
install(FILES include/mnf_linebyline.h include/mnf.h DESTINATION include)
| Use correct library variable from findBLAS. | Use correct library variable from findBLAS.
| Text | mit | ntnu-bioopt/mnf | text | ## Code Before:
cmake_minimum_required(VERSION 2.6)
project(mnf C CXX)
#BLAS library
if (USE_MKL_LIBRARIES)
set(CMAKE_BLAS_LIBS_INIT mkl_intel_lp64 mkl_intel_thread mkl_core iomp5)
else()
find_package(BLAS REQUIRED)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
#mnf library
add_library(mnf SHARED src/mnf_c.cpp src/mnf_linebyline.cpp src/readimage.cpp)
#mnf executable
add_executable(mnf-bin src/main.cpp src/readimage.cpp)
set_target_properties(mnf-bin PROPERTIES OUTPUT_NAME mnf) #set mnf-bin binary name to mnf
target_link_libraries(mnf-bin mnf ${CMAKE_BLAS_LIBS_INIT} lapacke)
#install libraries, binaries and header files
install(TARGETS mnf DESTINATION lib)
install(TARGETS mnf-bin DESTINATION bin)
install(FILES include/mnf_linebyline.h include/mnf.h DESTINATION include)
## Instruction:
Use correct library variable from findBLAS.
## Code After:
cmake_minimum_required(VERSION 2.6)
project(mnf C CXX)
#BLAS library
if (USE_MKL_LIBRARIES)
set(BLAS_LIBRARIES mkl_intel_lp64 mkl_intel_thread mkl_core iomp5)
else()
find_package(BLAS REQUIRED)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
#mnf library
add_library(mnf SHARED src/mnf_c.cpp src/mnf_linebyline.cpp src/readimage.cpp)
#mnf executable
add_executable(mnf-bin src/main.cpp src/readimage.cpp)
set_target_properties(mnf-bin PROPERTIES OUTPUT_NAME mnf) #set mnf-bin binary name to mnf
target_link_libraries(mnf-bin mnf ${BLAS_LIBRARIES} lapacke)
#install libraries, binaries and header files
install(TARGETS mnf DESTINATION lib)
install(TARGETS mnf-bin DESTINATION bin)
install(FILES include/mnf_linebyline.h include/mnf.h DESTINATION include)
|
316877b437008d8e7572ffec2ba74c5d370fe38a | .travis.yml | .travis.yml | language: python
python:
- "3.6"
- "3.5"
- "3.4"
- "3.3"
- "2.7"
- "2.6"
services:
- redis-server
env:
- TEST_HIREDIS=0
- TEST_HIREDIS=1
install:
- pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi"
- "if [[ $TEST_HIREDIS == '1' ]]; then pip install hiredis; fi"
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg .; else python setup.py test; fi"
matrix:
include:
- python: "2.7"
env: TEST_PEP8=1
- python: "3.6"
env: TEST_PEP8=1
| language: python
cache: pip
python:
- "3.6"
- "3.5"
- "3.4"
- "3.3"
- "2.7"
- "2.6"
services:
- redis-server
env:
- TEST_HIREDIS=0
- TEST_HIREDIS=1
install:
- pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi"
- "if [[ $TEST_HIREDIS == '1' ]]; then pip install hiredis; fi"
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg .; else python setup.py test; fi"
matrix:
include:
- python: "2.7"
env: TEST_PEP8=1
- python: "3.6"
env: TEST_PEP8=1
| Enable pip cache in Travis CI | Enable pip cache in Travis CI
Can speed up builds and reduce load on PyPI servers.
For more information, see:
https://docs.travis-ci.com/user/caching/#pip-cache
| YAML | mit | andymccurdy/redis-py,andymccurdy/redis-py,redis/redis-py,mozillazg/redis-py-doc,alisaifee/redis-py,andymccurdy/redis-py,5977862/redis-py,5977862/redis-py,redis/redis-py,alisaifee/redis-py,mozillazg/redis-py-doc,5977862/redis-py | yaml | ## Code Before:
language: python
python:
- "3.6"
- "3.5"
- "3.4"
- "3.3"
- "2.7"
- "2.6"
services:
- redis-server
env:
- TEST_HIREDIS=0
- TEST_HIREDIS=1
install:
- pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi"
- "if [[ $TEST_HIREDIS == '1' ]]; then pip install hiredis; fi"
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg .; else python setup.py test; fi"
matrix:
include:
- python: "2.7"
env: TEST_PEP8=1
- python: "3.6"
env: TEST_PEP8=1
## Instruction:
Enable pip cache in Travis CI
Can speed up builds and reduce load on PyPI servers.
For more information, see:
https://docs.travis-ci.com/user/caching/#pip-cache
## Code After:
language: python
cache: pip
python:
- "3.6"
- "3.5"
- "3.4"
- "3.3"
- "2.7"
- "2.6"
services:
- redis-server
env:
- TEST_HIREDIS=0
- TEST_HIREDIS=1
install:
- pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi"
- "if [[ $TEST_HIREDIS == '1' ]]; then pip install hiredis; fi"
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg .; else python setup.py test; fi"
matrix:
include:
- python: "2.7"
env: TEST_PEP8=1
- python: "3.6"
env: TEST_PEP8=1
|
ed781120958633b55223525533b287964393dc49 | plugins/wired.js | plugins/wired.js | var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Wired',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];
hoverZoom.urlReplace(res,
'img',
/-\d+x\d+\./,
'.'
);
hoverZoom.urlReplace(res,
'img[src*="/thumbs/"]',
'thumbs/thumbs_',
''
);
hoverZoom.urlReplace(res,
'img[src*="_w"]',
/_wd?\./,
'_bg.'
);
callback($(res));
}
});
| var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Wired',
version:'0.2',
prepareImgLinks:function (callback) {
var res = [];
hoverZoom.urlReplace(res,
'img',
/-\d+x\d+\./,
'.'
);
hoverZoom.urlReplace(res,
'img[src*="/thumbs/"]',
'thumbs/thumbs_',
''
);
hoverZoom.urlReplace(res,
'img[src*="_w"]',
/_wd?\./,
'_bg.'
);
$('img[src]').each(function() {
var url = this.src;
try {
// decode ASCII characters, for instance: '%2C' -> ','
// NB: this operation mustbe try/catched because url might not be well-formed
var fullsizeUrl = decodeURIComponent(url);
fullsizeUrl = fullsizeUrl.replace(/\/1:1(,.*?)?\//, '/').replace(/\/16:9(,.*?)?\//, '/').replace(/\/[wW]_?\d+(,.*?)?\//, '/').replace(/\/[hH]_?\d+(,.*?)?\//, '/').replace(/\/[qQ]_?\d+(,.*?)?\//, '/').replace(/\/q_auto(,.*?)?\//, '/').replace(/\/c_limit(,.*?)?\//, '/').replace(/\/c_scale(,.*?)?\//, '/').replace(/\/c_fill(,.*?)?\//, '/').replace(/\/f_auto(,.*?)?\//, '/');
if (fullsizeUrl != url) {
var link = $(this);
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.unshift(fullsizeUrl);
res.push(link);
}
}
}
catch(e) {}
});
callback($(res), this.name);
}
});
| Update for plug-in : WiReD | Update for plug-in : WiReD
| JavaScript | mit | extesy/hoverzoom,extesy/hoverzoom | javascript | ## Code Before:
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Wired',
version:'0.1',
prepareImgLinks:function (callback) {
var res = [];
hoverZoom.urlReplace(res,
'img',
/-\d+x\d+\./,
'.'
);
hoverZoom.urlReplace(res,
'img[src*="/thumbs/"]',
'thumbs/thumbs_',
''
);
hoverZoom.urlReplace(res,
'img[src*="_w"]',
/_wd?\./,
'_bg.'
);
callback($(res));
}
});
## Instruction:
Update for plug-in : WiReD
## Code After:
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Wired',
version:'0.2',
prepareImgLinks:function (callback) {
var res = [];
hoverZoom.urlReplace(res,
'img',
/-\d+x\d+\./,
'.'
);
hoverZoom.urlReplace(res,
'img[src*="/thumbs/"]',
'thumbs/thumbs_',
''
);
hoverZoom.urlReplace(res,
'img[src*="_w"]',
/_wd?\./,
'_bg.'
);
$('img[src]').each(function() {
var url = this.src;
try {
// decode ASCII characters, for instance: '%2C' -> ','
// NB: this operation mustbe try/catched because url might not be well-formed
var fullsizeUrl = decodeURIComponent(url);
fullsizeUrl = fullsizeUrl.replace(/\/1:1(,.*?)?\//, '/').replace(/\/16:9(,.*?)?\//, '/').replace(/\/[wW]_?\d+(,.*?)?\//, '/').replace(/\/[hH]_?\d+(,.*?)?\//, '/').replace(/\/[qQ]_?\d+(,.*?)?\//, '/').replace(/\/q_auto(,.*?)?\//, '/').replace(/\/c_limit(,.*?)?\//, '/').replace(/\/c_scale(,.*?)?\//, '/').replace(/\/c_fill(,.*?)?\//, '/').replace(/\/f_auto(,.*?)?\//, '/');
if (fullsizeUrl != url) {
var link = $(this);
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.unshift(fullsizeUrl);
res.push(link);
}
}
}
catch(e) {}
});
callback($(res), this.name);
}
});
|
b8e5128a0c199a3709c269647f6d1647d2ce54b8 | src/neural_networks/read_data.jl | src/neural_networks/read_data.jl |
function read_data(x::String, mode::String)
num_features = num_labels = 0
if x == "scene"
num_features = 294
num_labels = 6
end
if x == "yeast"
num_features = 103
num_labels = 14
end
if x == "emotions"
num_features = 72
num_labels = 6
end
if mode == "train"
suffix = "-train.csv"
else
suffix = "-test.csv"
end
path = string("data/", x, "/", x, suffix)
file = readdlm(path, ',')
n = size(file, 1)
features = file[1:n, 1:num_features]
labels = fil[1:n, (num_features + 1):(num_features+num_labels))
return (features, labels)
end
|
function read_data(x::String, mode::String)
num_features = num_labels = 0
if x == "scene"
num_features = 294
num_labels = 6
elseif x == "yeast"
num_features = 103
num_labels = 14
elseif x == "emotions"
num_features = 72
num_labels = 6
else
error("Unknown dataset")
end
if mode == "train"
suffix = "train"
else
suffix = "test"
end
path = joinpath("data", x, string(x, "-", suffix, ".csv"))
file = readdlm(path, ',')
n = size(file, 1)
features = file[1:n, 1:num_features]
labels = file[1:n, (num_features + 1):(num_features + num_labels)]
return (features, labels)
end
| Read data from a file | Read data from a file
| Julia | agpl-3.0 | jperla/MultiLabelNeuralNetwork.jl | julia | ## Code Before:
function read_data(x::String, mode::String)
num_features = num_labels = 0
if x == "scene"
num_features = 294
num_labels = 6
end
if x == "yeast"
num_features = 103
num_labels = 14
end
if x == "emotions"
num_features = 72
num_labels = 6
end
if mode == "train"
suffix = "-train.csv"
else
suffix = "-test.csv"
end
path = string("data/", x, "/", x, suffix)
file = readdlm(path, ',')
n = size(file, 1)
features = file[1:n, 1:num_features]
labels = fil[1:n, (num_features + 1):(num_features+num_labels))
return (features, labels)
end
## Instruction:
Read data from a file
## Code After:
function read_data(x::String, mode::String)
num_features = num_labels = 0
if x == "scene"
num_features = 294
num_labels = 6
elseif x == "yeast"
num_features = 103
num_labels = 14
elseif x == "emotions"
num_features = 72
num_labels = 6
else
error("Unknown dataset")
end
if mode == "train"
suffix = "train"
else
suffix = "test"
end
path = joinpath("data", x, string(x, "-", suffix, ".csv"))
file = readdlm(path, ',')
n = size(file, 1)
features = file[1:n, 1:num_features]
labels = file[1:n, (num_features + 1):(num_features + num_labels)]
return (features, labels)
end
|
4987275ab868aa98359d6583c7817c4adf09000b | zipeggs.py | zipeggs.py | import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildout.UserError('Invalid Source')
def zipit(self):
target = self.options['target']
if not os.path.exists(target):
os.mkdir(target)
path = self.options['source']
for dirs in os.listdir(path):
try:
source = os.path.join(path, dirs)
dist = "%s/%s" % (target, dirs)
print "%s > %s" % (source, dist)
shutil.make_archive(dist, "zip", source)
os.rename(dist+".zip", dist)
except OSError:
print "ignore %s" % dirs
return []
def install(self):
return self.zipit()
def update(self):
return self.zipit()
| import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildout.UserError('Invalid Source')
def zipit(self):
target_dir = self.options['target']
if not os.path.exists(target_dir):
os.mkdir(target_dir)
source_dir = self.options['source']
for entry in os.listdir(source_dir):
try:
source = os.path.join(source_dir, entry)
target = "%s/%s" % (target_dir, entry)
print "%s > %s" % (source, target)
shutil.make_archive(target, "zip", source)
os.rename(target+".zip", target)
except OSError:
print "ignore %s" % entry
return []
def install(self):
return self.zipit()
def update(self):
return self.zipit()
| Improve variable names for clarity | Improve variable names for clarity
| Python | apache-2.0 | tamizhgeek/zipeggs | python | ## Code Before:
import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildout.UserError('Invalid Source')
def zipit(self):
target = self.options['target']
if not os.path.exists(target):
os.mkdir(target)
path = self.options['source']
for dirs in os.listdir(path):
try:
source = os.path.join(path, dirs)
dist = "%s/%s" % (target, dirs)
print "%s > %s" % (source, dist)
shutil.make_archive(dist, "zip", source)
os.rename(dist+".zip", dist)
except OSError:
print "ignore %s" % dirs
return []
def install(self):
return self.zipit()
def update(self):
return self.zipit()
## Instruction:
Improve variable names for clarity
## Code After:
import logging, os, zc.buildout, sys, shutil
class ZipEggs:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
if options['target'] is None:
raise zc.buildout.UserError('Invalid Target')
if options['source'] is None:
raise zc.buildout.UserError('Invalid Source')
def zipit(self):
target_dir = self.options['target']
if not os.path.exists(target_dir):
os.mkdir(target_dir)
source_dir = self.options['source']
for entry in os.listdir(source_dir):
try:
source = os.path.join(source_dir, entry)
target = "%s/%s" % (target_dir, entry)
print "%s > %s" % (source, target)
shutil.make_archive(target, "zip", source)
os.rename(target+".zip", target)
except OSError:
print "ignore %s" % entry
return []
def install(self):
return self.zipit()
def update(self):
return self.zipit()
|
348348f94c879b44fb4c300466be370670f4445a | calculators/cha2ds2/cha2ds2.rb | calculators/cha2ds2/cha2ds2.rb | name :cha2ds2
require_helpers :get_field_as_integer, :get_field_as_sex, :get_field_as_bool
execute do
age = get_field_as_integer :age
sex = get_field_as_sex :sex
congestive_heart_failure_history = get_field_as_bool :congestive_heart_failure_history
hypertension_history = get_field_as_bool :hypertension_history
stroke_history = get_field_as_bool :stroke_history
vascular_disease_history = get_field_as_bool :vascular_disease_history
diabetes = get_field_as_bool :diabetes
score = 0
score += 1 if (age > 65) && (age < 74)
score += 2 if (age >= 75)
score += 1 if sex == :female
score += 1 if congestive_heart_failure_history
score += 1 if hypertension_history
score += 2 if stroke_history
score += 1 if vascular_disease_history
score += 1 if diabetes
{
cha2ds2_vasc_score: score
}
end
| name :cha2ds2
require_helpers :get_field_as_integer, :get_field_as_sex, :get_field_as_bool
execute do
age = get_field_as_integer :age
sex = get_field_as_sex :sex
congestive_heart_failure_history = get_field_as_bool :congestive_heart_failure_history
hypertension_history = get_field_as_bool :hypertension_history
stroke_history = get_field_as_bool :stroke_history
vascular_disease_history = get_field_as_bool :vascular_disease_history
diabetes = get_field_as_bool :diabetes
score = 0
score += 1 if (age > 65) && (age < 74)
score += 2 if (age >= 75)
score += 1 if sex == :female
score += 1 if congestive_heart_failure_history
score += 1 if hypertension_history
score += 2 if stroke_history
score += 1 if vascular_disease_history
score += 1 if diabetes
{
value: score
}
end
| Change response to match others | Change response to match others
| Ruby | agpl-3.0 | open-health-hub/clinical_calculator_api,open-health-hub/clinical_calculator_api | ruby | ## Code Before:
name :cha2ds2
require_helpers :get_field_as_integer, :get_field_as_sex, :get_field_as_bool
execute do
age = get_field_as_integer :age
sex = get_field_as_sex :sex
congestive_heart_failure_history = get_field_as_bool :congestive_heart_failure_history
hypertension_history = get_field_as_bool :hypertension_history
stroke_history = get_field_as_bool :stroke_history
vascular_disease_history = get_field_as_bool :vascular_disease_history
diabetes = get_field_as_bool :diabetes
score = 0
score += 1 if (age > 65) && (age < 74)
score += 2 if (age >= 75)
score += 1 if sex == :female
score += 1 if congestive_heart_failure_history
score += 1 if hypertension_history
score += 2 if stroke_history
score += 1 if vascular_disease_history
score += 1 if diabetes
{
cha2ds2_vasc_score: score
}
end
## Instruction:
Change response to match others
## Code After:
name :cha2ds2
require_helpers :get_field_as_integer, :get_field_as_sex, :get_field_as_bool
execute do
age = get_field_as_integer :age
sex = get_field_as_sex :sex
congestive_heart_failure_history = get_field_as_bool :congestive_heart_failure_history
hypertension_history = get_field_as_bool :hypertension_history
stroke_history = get_field_as_bool :stroke_history
vascular_disease_history = get_field_as_bool :vascular_disease_history
diabetes = get_field_as_bool :diabetes
score = 0
score += 1 if (age > 65) && (age < 74)
score += 2 if (age >= 75)
score += 1 if sex == :female
score += 1 if congestive_heart_failure_history
score += 1 if hypertension_history
score += 2 if stroke_history
score += 1 if vascular_disease_history
score += 1 if diabetes
{
value: score
}
end
|
8d1d8488977a79ff96ee4f587fd42d2ca443408e | script/run_all_tests.sh | script/run_all_tests.sh |
BD=/home/lodo
# Chatty
set -x
# Exit on error
set -e
export HOME=$BD
cp config/database.yml.example config/database.yml
bundle install
rake test
|
BD=/home/lodo
# Chatty
set -x
# Exit on error
set -e
export HOME=$BD
cp config/database.yml.example config/database.yml
bundle install
rake db:create
rake db:migrate
rake test
| Update Hudson script with db creation commands | Update Hudson script with db creation commands
| Shell | mit | dodo-as/dodo,lodo/lodo,lodo/lodo,dodo-as/dodo,dodo-as/dodo,lodo/lodo | shell | ## Code Before:
BD=/home/lodo
# Chatty
set -x
# Exit on error
set -e
export HOME=$BD
cp config/database.yml.example config/database.yml
bundle install
rake test
## Instruction:
Update Hudson script with db creation commands
## Code After:
BD=/home/lodo
# Chatty
set -x
# Exit on error
set -e
export HOME=$BD
cp config/database.yml.example config/database.yml
bundle install
rake db:create
rake db:migrate
rake test
|
a15d2956cfd48e0d46d5d4cf567af05641b4c8e6 | yunity/api/utils.py | yunity/api/utils.py | from django.http import JsonResponse
class ApiBase(object):
@classmethod
def success(cls, data, status=200):
"""
:type data: dict
:type status: int
:rtype JsonResponse
"""
return JsonResponse(data, status=status)
@classmethod
def error(cls, error, status=400):
"""
:type error: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'error': error}, status=status)
| from functools import wraps
from json import loads as load_json
from django.http import JsonResponse
class ApiBase(object):
@classmethod
def validation_failure(cls, message, status=400):
"""
:type message: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'validation_failure': message}, status=status)
@classmethod
def success(cls, data, status=200):
"""
:type data: dict
:type status: int
:rtype JsonResponse
"""
return JsonResponse(data, status=status)
@classmethod
def error(cls, error, status=400):
"""
:type error: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'error': error}, status=status)
def json_request(expected_keys=None):
"""Decorator to validate that a request is in JSON and (optionally) has some specific keys in the JSON object.
"""
expected_keys = expected_keys or []
def decorator(func):
@wraps(func)
def wrapper(cls, request, *args, **kwargs):
data = load_json(request.body.decode('utf8'))
for expected_key in expected_keys:
value = data.get(expected_key)
if not value:
return ApiBase.validation_failure('missing key: {}'.format(expected_key))
return func(cls, data, request, *args, **kwargs)
return wrapper
return decorator
| Implement JSON request validation decorator | Implement JSON request validation decorator
with @NerdyProjects
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | python | ## Code Before:
from django.http import JsonResponse
class ApiBase(object):
@classmethod
def success(cls, data, status=200):
"""
:type data: dict
:type status: int
:rtype JsonResponse
"""
return JsonResponse(data, status=status)
@classmethod
def error(cls, error, status=400):
"""
:type error: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'error': error}, status=status)
## Instruction:
Implement JSON request validation decorator
with @NerdyProjects
## Code After:
from functools import wraps
from json import loads as load_json
from django.http import JsonResponse
class ApiBase(object):
@classmethod
def validation_failure(cls, message, status=400):
"""
:type message: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'validation_failure': message}, status=status)
@classmethod
def success(cls, data, status=200):
"""
:type data: dict
:type status: int
:rtype JsonResponse
"""
return JsonResponse(data, status=status)
@classmethod
def error(cls, error, status=400):
"""
:type error: str
:type status: int
:rtype JsonResponse
"""
return JsonResponse({'error': error}, status=status)
def json_request(expected_keys=None):
"""Decorator to validate that a request is in JSON and (optionally) has some specific keys in the JSON object.
"""
expected_keys = expected_keys or []
def decorator(func):
@wraps(func)
def wrapper(cls, request, *args, **kwargs):
data = load_json(request.body.decode('utf8'))
for expected_key in expected_keys:
value = data.get(expected_key)
if not value:
return ApiBase.validation_failure('missing key: {}'.format(expected_key))
return func(cls, data, request, *args, **kwargs)
return wrapper
return decorator
|
21cfd61642adadef6a611a9c7120c6469febef80 | static/src/utils/requests.js | static/src/utils/requests.js | export const loadJSON = (url, postData = undefined) => new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(postData ? 'post' : 'get', url, true);
xhr.responseType = 'json';
xhr.onload = () => {
const { status } = xhr;
if (status === 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
};
xhr.onerror = () => reject();
if (postData) {
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send(JSON.stringify(postData));
} else {
xhr.send();
}
});
| export const loadJSON = (url, postData) => new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(postData ? 'post' : 'get', url, true);
xhr.responseType = 'json';
xhr.onload = () => {
const { status } = xhr;
if (status === 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
};
xhr.onerror = () => reject();
if (postData) {
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send(JSON.stringify(postData));
} else {
xhr.send();
}
});
| Remove undefined default parameter value | Remove undefined default parameter value
| JavaScript | mit | ffont/freesound-explorer,ffont/freesound-explorer,ffont/freesound-explorer | javascript | ## Code Before:
export const loadJSON = (url, postData = undefined) => new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(postData ? 'post' : 'get', url, true);
xhr.responseType = 'json';
xhr.onload = () => {
const { status } = xhr;
if (status === 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
};
xhr.onerror = () => reject();
if (postData) {
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send(JSON.stringify(postData));
} else {
xhr.send();
}
});
## Instruction:
Remove undefined default parameter value
## Code After:
export const loadJSON = (url, postData) => new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(postData ? 'post' : 'get', url, true);
xhr.responseType = 'json';
xhr.onload = () => {
const { status } = xhr;
if (status === 200) {
resolve(xhr.response);
} else {
reject(xhr.response);
}
};
xhr.onerror = () => reject();
if (postData) {
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send(JSON.stringify(postData));
} else {
xhr.send();
}
});
|
ef114c5eaec1d95a30e1c3d04302d03a2b887fe9 | transition.js | transition.js | /* ========================================================================
* Bootstrap: transition.js v3.3.4
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
return false;
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
return this
}
$(function () {
$.support.transition = false;
})
}(jQuery);
| /* ========================================================================
* Bootstrap: transition.js v3.3.4
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
// no - we do not support transitions
return false;
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
return this
}
$(function () {
// explicit false
$.support.transition = false;
})
}(jQuery);
| Add explicit comments on animation support | Add explicit comments on animation support
| JavaScript | unlicense | peterblazejewicz/mashup,peterblazejewicz/mashup | javascript | ## Code Before:
/* ========================================================================
* Bootstrap: transition.js v3.3.4
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
return false;
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
return this
}
$(function () {
$.support.transition = false;
})
}(jQuery);
## Instruction:
Add explicit comments on animation support
## Code After:
/* ========================================================================
* Bootstrap: transition.js v3.3.4
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
// no - we do not support transitions
return false;
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
return this
}
$(function () {
// explicit false
$.support.transition = false;
})
}(jQuery);
|
91219045c62314951bb1be25ad46c24c6479fc1b | kolibri/core/assets/src/api-resources/membership.js | kolibri/core/assets/src/api-resources/membership.js | const Resource = require('../api-resource').Resource;
class MembershipResource extends Resource {
static resourceName() {
return 'membership';
}
}
module.exports = MembershipResource;
| const Resource = require('../api-resource').Resource;
/**
* @example <caption>Get all memberships for a given user</caption>
* MembershipResource.getCollection({ user_id: userId })
*/
class MembershipResource extends Resource {
static resourceName() {
return 'membership';
}
}
module.exports = MembershipResource;
| Add JSDoc comment for MembershipResource usage | Add JSDoc comment for MembershipResource usage
| JavaScript | mit | DXCanas/kolibri,christianmemije/kolibri,lyw07/kolibri,rtibbles/kolibri,MingDai/kolibri,MingDai/kolibri,MingDai/kolibri,benjaoming/kolibri,mrpau/kolibri,rtibbles/kolibri,lyw07/kolibri,lyw07/kolibri,benjaoming/kolibri,rtibbles/kolibri,learningequality/kolibri,DXCanas/kolibri,christianmemije/kolibri,learningequality/kolibri,learningequality/kolibri,jonboiser/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,rtibbles/kolibri,jonboiser/kolibri,mrpau/kolibri,lyw07/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,MingDai/kolibri,christianmemije/kolibri,DXCanas/kolibri,jonboiser/kolibri,DXCanas/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,christianmemije/kolibri,jonboiser/kolibri,benjaoming/kolibri,benjaoming/kolibri | javascript | ## Code Before:
const Resource = require('../api-resource').Resource;
class MembershipResource extends Resource {
static resourceName() {
return 'membership';
}
}
module.exports = MembershipResource;
## Instruction:
Add JSDoc comment for MembershipResource usage
## Code After:
const Resource = require('../api-resource').Resource;
/**
* @example <caption>Get all memberships for a given user</caption>
* MembershipResource.getCollection({ user_id: userId })
*/
class MembershipResource extends Resource {
static resourceName() {
return 'membership';
}
}
module.exports = MembershipResource;
|
3ca1bdf725b35dd9cd32c0491f47ae10f2b9a2d2 | proguard.sbt | proguard.sbt | import com.typesafe.sbt.SbtProguard.ProguardKeys._
proguardSettings
javaOptions in (Proguard, proguard) := Seq("-Xmx4G")
ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings")
ProguardKeys.options in Proguard += """
-dontoptimize
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepnames public class ** { *; }
-keep public enum com.amazonaws.RequestClientOptions$Marker** {
**[] $VALUES;
public *;
}
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep public class org.apache.commons.logging.impl.LogFactoryImpl
-keep public class org.apache.commons.logging.impl.Jdk14Logger { *** <init>(...); }
-keep public class net.shiroka.tools.ofx.aws.Lambda { *; }
"""
ProguardKeys.merge in Proguard := true
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.discard("META-INF/.*".r)
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.append("reference.conf")
ProguardKeys.options in Proguard += ProguardOptions.keepMain("net.shiroka.tools.ofx.*")
scalacOptions += "-target:jvm-1.7"
| import com.typesafe.sbt.SbtProguard.ProguardKeys._
proguardSettings
javaOptions in (Proguard, proguard) := Seq("-Xmx4G")
ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings")
ProguardKeys.options in Proguard += """
-dontoptimize
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepnames class ** { *; }
-keepnames enum ** { *; }
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep public enum com.amazonaws.RequestClientOptions$Marker** {
**[] $VALUES;
public *;
}
-keep public class org.apache.commons.logging.impl.LogFactoryImpl
-keep public class org.apache.commons.logging.impl.Jdk14Logger { *** <init>(...); }
-keep public class net.shiroka.tools.ofx.aws.Lambda { *; }
"""
ProguardKeys.merge in Proguard := true
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.discard("META-INF/.*".r)
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.append("reference.conf")
ProguardKeys.options in Proguard += ProguardOptions.keepMain("net.shiroka.tools.ofx.*")
scalacOptions += "-target:jvm-1.7"
| Add -keepnames on enum and private ones | Add -keepnames on enum and private ones
| Scala | mit | ikuo/ofx-tools | scala | ## Code Before:
import com.typesafe.sbt.SbtProguard.ProguardKeys._
proguardSettings
javaOptions in (Proguard, proguard) := Seq("-Xmx4G")
ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings")
ProguardKeys.options in Proguard += """
-dontoptimize
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepnames public class ** { *; }
-keep public enum com.amazonaws.RequestClientOptions$Marker** {
**[] $VALUES;
public *;
}
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep public class org.apache.commons.logging.impl.LogFactoryImpl
-keep public class org.apache.commons.logging.impl.Jdk14Logger { *** <init>(...); }
-keep public class net.shiroka.tools.ofx.aws.Lambda { *; }
"""
ProguardKeys.merge in Proguard := true
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.discard("META-INF/.*".r)
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.append("reference.conf")
ProguardKeys.options in Proguard += ProguardOptions.keepMain("net.shiroka.tools.ofx.*")
scalacOptions += "-target:jvm-1.7"
## Instruction:
Add -keepnames on enum and private ones
## Code After:
import com.typesafe.sbt.SbtProguard.ProguardKeys._
proguardSettings
javaOptions in (Proguard, proguard) := Seq("-Xmx4G")
ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings")
ProguardKeys.options in Proguard += """
-dontoptimize
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepnames class ** { *; }
-keepnames enum ** { *; }
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep public enum com.amazonaws.RequestClientOptions$Marker** {
**[] $VALUES;
public *;
}
-keep public class org.apache.commons.logging.impl.LogFactoryImpl
-keep public class org.apache.commons.logging.impl.Jdk14Logger { *** <init>(...); }
-keep public class net.shiroka.tools.ofx.aws.Lambda { *; }
"""
ProguardKeys.merge in Proguard := true
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.discard("META-INF/.*".r)
ProguardKeys.mergeStrategies in Proguard += ProguardMerge.append("reference.conf")
ProguardKeys.options in Proguard += ProguardOptions.keepMain("net.shiroka.tools.ofx.*")
scalacOptions += "-target:jvm-1.7"
|
c01b693e655ce146e8be281b2dda93a64a7d4bca | src/Propellor/Property/LightDM.hs | src/Propellor/Property/LightDM.hs | {-# LANGUAGE FlexibleInstances #-}
-- | Maintainer: Sean Whitton <spwhitton@spwhitton.name>
module Propellor.Property.LightDM where
import Propellor.Base
import qualified Propellor.Property.ConfFile as ConfFile
-- | Configures LightDM to skip the login screen and autologin as a user.
autoLogin :: User -> Property NoInfo
autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniSetting`
("SeatDefaults", "autologin-user", u)
`describe` "lightdm autologin"
| {-# LANGUAGE FlexibleInstances #-}
-- | Maintainer: Sean Whitton <spwhitton@spwhitton.name>
module Propellor.Property.LightDM where
import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.ConfFile as ConfFile
installed :: Property NoInfo
installed = Apt.installed ["lightdm"]
-- | Configures LightDM to skip the login screen and autologin as a user.
autoLogin :: User -> Property NoInfo
autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniSetting`
("SeatDefaults", "autologin-user", u)
`describe` "lightdm autologin"
| Add convenience .installed for lightdm. | Add convenience .installed for lightdm.
Signed-off-by: Jelmer Vernooij <9648816b5a0c45426c88e14104568baf9283dd28@jelmer.uk>
| Haskell | bsd-2-clause | ArchiveTeam/glowing-computing-machine | haskell | ## Code Before:
{-# LANGUAGE FlexibleInstances #-}
-- | Maintainer: Sean Whitton <spwhitton@spwhitton.name>
module Propellor.Property.LightDM where
import Propellor.Base
import qualified Propellor.Property.ConfFile as ConfFile
-- | Configures LightDM to skip the login screen and autologin as a user.
autoLogin :: User -> Property NoInfo
autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniSetting`
("SeatDefaults", "autologin-user", u)
`describe` "lightdm autologin"
## Instruction:
Add convenience .installed for lightdm.
Signed-off-by: Jelmer Vernooij <9648816b5a0c45426c88e14104568baf9283dd28@jelmer.uk>
## Code After:
{-# LANGUAGE FlexibleInstances #-}
-- | Maintainer: Sean Whitton <spwhitton@spwhitton.name>
module Propellor.Property.LightDM where
import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.ConfFile as ConfFile
installed :: Property NoInfo
installed = Apt.installed ["lightdm"]
-- | Configures LightDM to skip the login screen and autologin as a user.
autoLogin :: User -> Property NoInfo
autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniSetting`
("SeatDefaults", "autologin-user", u)
`describe` "lightdm autologin"
|
1e4bb9457bb7947f75b16faf5aa3c91cb3242914 | rails/spec/helpers/divisions_helper_spec.rb | rails/spec/helpers/divisions_helper_spec.rb | require 'spec_helper'
describe DivisionsHelper do
# TODO Enable this test
# describe '#formatted_motion_text' do
# subject { formatted_motion_text division }
# let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") }
# it { should eq("\n<p>A bill [No. 2] and votes</p>") }
# end
end
| require 'spec_helper'
describe DivisionsHelper do
describe '#formatted_motion_text' do
subject { formatted_motion_text division }
let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") }
it { should eq("<p>A bill [No. 2] and votes</p>\n") }
end
end
| Enable test now this is working since we switched to Marker | Enable test now this is working since we switched to Marker
| Ruby | agpl-3.0 | mysociety/publicwhip,mysociety/publicwhip,mysociety/publicwhip | ruby | ## Code Before:
require 'spec_helper'
describe DivisionsHelper do
# TODO Enable this test
# describe '#formatted_motion_text' do
# subject { formatted_motion_text division }
# let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") }
# it { should eq("\n<p>A bill [No. 2] and votes</p>") }
# end
end
## Instruction:
Enable test now this is working since we switched to Marker
## Code After:
require 'spec_helper'
describe DivisionsHelper do
describe '#formatted_motion_text' do
subject { formatted_motion_text division }
let(:division) { mock_model(Division, motion: "A bill [No. 2] and votes") }
it { should eq("<p>A bill [No. 2] and votes</p>\n") }
end
end
|
795426bd94d165fdf310b164c550d4996bc37beb | app/assets/stylesheets/_variables.scss | app/assets/stylesheets/_variables.scss | // these variables override bootstrap defaults
$baseFontFamily: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
$textColor: #333; | // these variables override bootstrap defaults
$baseFontFamily: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
$textColor: #333;
@mixin font-family-sans-serif() {
font-family: $baseFontFamily;
} | Apply font changes throughout the text fields. This fixes a bug in the bootstrap gem. | Apply font changes throughout the text fields. This fixes a bug in the bootstrap gem.
| SCSS | agpl-3.0 | digitalnatives/jobsworth,rafaspinola/jobsworth,rafaspinola/jobsworth,digitalnatives/jobsworth,digitalnatives/jobsworth,webstream-io/jobsworth,xuewenfei/jobsworth,xuewenfei/jobsworth,xuewenfei/jobsworth,ari/jobsworth,rafaspinola/jobsworth,webstream-io/jobsworth,ari/jobsworth,ari/jobsworth,xuewenfei/jobsworth,rafaspinola/jobsworth,webstream-io/jobsworth,digitalnatives/jobsworth,ari/jobsworth,webstream-io/jobsworth,digitalnatives/jobsworth | scss | ## Code Before:
// these variables override bootstrap defaults
$baseFontFamily: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
$textColor: #333;
## Instruction:
Apply font changes throughout the text fields. This fixes a bug in the bootstrap gem.
## Code After:
// these variables override bootstrap defaults
$baseFontFamily: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
$textColor: #333;
@mixin font-family-sans-serif() {
font-family: $baseFontFamily;
} |
f076226b3f7f3ebd11ab43993e9c19d1468355fd | app/views/project_activities/_index.html.erb | app/views/project_activities/_index.html.erb | <h5 class="text-center"><%= t("projects.index.activity_tab") %></h5>
<hr>
<ul class="no-style double-line content-activities">
<% if @activities.size == 0 then %>
<li><em><%= t 'projects.index.no_activities' %></em></li>
<% else %>
<% @activities.each do |activity| %>
<li><span class="text-muted"><%= l activity.created_at, format: :full %></span>
<br><span><%= activity_truncate(activity.message) %></span>
</li>
<% end %>
<% end %>
</ul>
| <h5 class="text-center"><%= t("projects.index.activity_tab") %></h5>
<hr>
<ul class="no-style double-line content-activities">
<% if @activities.size == 0 then %>
<li><em><%= t 'projects.index.no_activities' %></em></li>
<% else %>
<% @activities.each do |activity| %>
<li><span class="text-muted"><%= l activity.created_at, format: :full %></span>
<br>
<span>
<%= activity_truncate(activity.message) %>
<% if activity.my_module %>
[<%=t 'Module' %>:
<% if activity.my_module.name.length >
Constants::NAME_TRUNCATION_LENGTH %>
<%= truncate(activity.my_module.name,
lenght: Constants::NAME_TRUNCATION_LENGTH) %>
<% else %>
<%= activity.my_module.name %>
<% end %>]
<% end %>
</span>
</li>
<% end %>
<% end %>
</ul>
| Add task name to project activity | Add task name to project activity [SCI-275]
| HTML+ERB | mpl-2.0 | mlorb/scinote-web,mlorb/scinote-web,Ducz0r/scinote-web,Ducz0r/scinote-web,mlorb/scinote-web,Ducz0r/scinote-web | html+erb | ## Code Before:
<h5 class="text-center"><%= t("projects.index.activity_tab") %></h5>
<hr>
<ul class="no-style double-line content-activities">
<% if @activities.size == 0 then %>
<li><em><%= t 'projects.index.no_activities' %></em></li>
<% else %>
<% @activities.each do |activity| %>
<li><span class="text-muted"><%= l activity.created_at, format: :full %></span>
<br><span><%= activity_truncate(activity.message) %></span>
</li>
<% end %>
<% end %>
</ul>
## Instruction:
Add task name to project activity [SCI-275]
## Code After:
<h5 class="text-center"><%= t("projects.index.activity_tab") %></h5>
<hr>
<ul class="no-style double-line content-activities">
<% if @activities.size == 0 then %>
<li><em><%= t 'projects.index.no_activities' %></em></li>
<% else %>
<% @activities.each do |activity| %>
<li><span class="text-muted"><%= l activity.created_at, format: :full %></span>
<br>
<span>
<%= activity_truncate(activity.message) %>
<% if activity.my_module %>
[<%=t 'Module' %>:
<% if activity.my_module.name.length >
Constants::NAME_TRUNCATION_LENGTH %>
<%= truncate(activity.my_module.name,
lenght: Constants::NAME_TRUNCATION_LENGTH) %>
<% else %>
<%= activity.my_module.name %>
<% end %>]
<% end %>
</span>
</li>
<% end %>
<% end %>
</ul>
|
d88c1221e2d07b300f29ef2605acea18c9e7fbf2 | test/tiny.py | test/tiny.py | from mpipe import OrderedStage, Pipeline
def increment(value):
return value + 1
def double(value):
return value * 2
stage1 = OrderedStage(increment, 3)
stage2 = OrderedStage(double, 3)
stage1.link(stage2)
pipe = Pipeline(stage1)
for number in range(10):
pipe.put(number)
pipe.put(None)
for result in pipe.results():
print(result)
| from mpipe import OrderedStage, Pipeline
def increment(value):
return value + 1
def double(value):
return value * 2
stage1 = OrderedStage(increment, 3)
stage2 = OrderedStage(double, 3)
pipe = Pipeline(stage1.link(stage2))
for number in range(10):
pipe.put(number)
pipe.put(None)
for result in pipe.results():
print(result)
| Use multi-link pipeline construction syntax. | Use multi-link pipeline construction syntax.
| Python | mit | vmlaker/mpipe | python | ## Code Before:
from mpipe import OrderedStage, Pipeline
def increment(value):
return value + 1
def double(value):
return value * 2
stage1 = OrderedStage(increment, 3)
stage2 = OrderedStage(double, 3)
stage1.link(stage2)
pipe = Pipeline(stage1)
for number in range(10):
pipe.put(number)
pipe.put(None)
for result in pipe.results():
print(result)
## Instruction:
Use multi-link pipeline construction syntax.
## Code After:
from mpipe import OrderedStage, Pipeline
def increment(value):
return value + 1
def double(value):
return value * 2
stage1 = OrderedStage(increment, 3)
stage2 = OrderedStage(double, 3)
pipe = Pipeline(stage1.link(stage2))
for number in range(10):
pipe.put(number)
pipe.put(None)
for result in pipe.results():
print(result)
|
73bb9dc0a280dadde0929aa64c5ea87b5d42b9ff | src/Concise/Console/Command.php | src/Concise/Console/Command.php | <?php
namespace Concise\Console;
use Concise\Console\TestRunner\DefaultTestRunner;
use Concise\Console\ResultPrinter\ResultPrinterProxy;
use Concise\Console\ResultPrinter\DefaultResultPrinter;
use Concise\Console\ResultPrinter\CIResultPrinter;
class Command extends \PHPUnit_TextUI_Command
{
protected $ci = false;
protected function createRunner()
{
$resultPrinter = $this->getResultPrinter();
if (array_key_exists('verbose', $this->arguments) && $this->arguments['verbose']) {
$resultPrinter->setVerbose(true);
}
$testRunner = new DefaultTestRunner();
$testRunner->setPrinter(new ResultPrinterProxy($resultPrinter));
return $testRunner;
}
public function getResultPrinter()
{
if ($this->ci) {
return new CIResultPrinter();
}
return new DefaultResultPrinter();
}
/**
* @codeCoverageIgnore
*/
protected function handleArguments(array $argv)
{
$this->longOptions['test-colors'] = null;
$this->longOptions['ci'] = null;
parent::handleArguments($argv);
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--test-colors':
$testColors = new TestColors(new DefaultTheme());
echo $testColors->renderAll();
exit(0);
break;
case '--ci':
$this->ci = true;
break;
}
}
}
}
| <?php
namespace Concise\Console;
use Concise\Console\TestRunner\DefaultTestRunner;
use Concise\Console\ResultPrinter\ResultPrinterProxy;
use Concise\Console\ResultPrinter\DefaultResultPrinter;
use Concise\Console\ResultPrinter\CIResultPrinter;
class Command extends \PHPUnit_TextUI_Command
{
protected $ci = false;
protected function createRunner()
{
$resultPrinter = $this->getResultPrinter();
if (array_key_exists('verbose', $this->arguments) && $this->arguments['verbose']) {
$resultPrinter->setVerbose(true);
}
$testRunner = new DefaultTestRunner();
$testRunner->setPrinter(new ResultPrinterProxy($resultPrinter));
return $testRunner;
}
public function getResultPrinter()
{
if ($this->ci || `tput colors` < 2) {
return new CIResultPrinter();
}
return new DefaultResultPrinter();
}
/**
* @codeCoverageIgnore
*/
protected function handleArguments(array $argv)
{
$this->longOptions['test-colors'] = null;
$this->longOptions['ci'] = null;
parent::handleArguments($argv);
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--test-colors':
$testColors = new TestColors(new DefaultTheme());
echo $testColors->renderAll();
exit(0);
break;
case '--ci':
$this->ci = true;
break;
}
}
}
}
| Use CI mode automatically if colours are not supported | Use CI mode automatically if colours are not supported
| PHP | mit | elliotchance/concise,elliotchance/concise | php | ## Code Before:
<?php
namespace Concise\Console;
use Concise\Console\TestRunner\DefaultTestRunner;
use Concise\Console\ResultPrinter\ResultPrinterProxy;
use Concise\Console\ResultPrinter\DefaultResultPrinter;
use Concise\Console\ResultPrinter\CIResultPrinter;
class Command extends \PHPUnit_TextUI_Command
{
protected $ci = false;
protected function createRunner()
{
$resultPrinter = $this->getResultPrinter();
if (array_key_exists('verbose', $this->arguments) && $this->arguments['verbose']) {
$resultPrinter->setVerbose(true);
}
$testRunner = new DefaultTestRunner();
$testRunner->setPrinter(new ResultPrinterProxy($resultPrinter));
return $testRunner;
}
public function getResultPrinter()
{
if ($this->ci) {
return new CIResultPrinter();
}
return new DefaultResultPrinter();
}
/**
* @codeCoverageIgnore
*/
protected function handleArguments(array $argv)
{
$this->longOptions['test-colors'] = null;
$this->longOptions['ci'] = null;
parent::handleArguments($argv);
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--test-colors':
$testColors = new TestColors(new DefaultTheme());
echo $testColors->renderAll();
exit(0);
break;
case '--ci':
$this->ci = true;
break;
}
}
}
}
## Instruction:
Use CI mode automatically if colours are not supported
## Code After:
<?php
namespace Concise\Console;
use Concise\Console\TestRunner\DefaultTestRunner;
use Concise\Console\ResultPrinter\ResultPrinterProxy;
use Concise\Console\ResultPrinter\DefaultResultPrinter;
use Concise\Console\ResultPrinter\CIResultPrinter;
class Command extends \PHPUnit_TextUI_Command
{
protected $ci = false;
protected function createRunner()
{
$resultPrinter = $this->getResultPrinter();
if (array_key_exists('verbose', $this->arguments) && $this->arguments['verbose']) {
$resultPrinter->setVerbose(true);
}
$testRunner = new DefaultTestRunner();
$testRunner->setPrinter(new ResultPrinterProxy($resultPrinter));
return $testRunner;
}
public function getResultPrinter()
{
if ($this->ci || `tput colors` < 2) {
return new CIResultPrinter();
}
return new DefaultResultPrinter();
}
/**
* @codeCoverageIgnore
*/
protected function handleArguments(array $argv)
{
$this->longOptions['test-colors'] = null;
$this->longOptions['ci'] = null;
parent::handleArguments($argv);
foreach ($this->options[0] as $option) {
switch ($option[0]) {
case '--test-colors':
$testColors = new TestColors(new DefaultTheme());
echo $testColors->renderAll();
exit(0);
break;
case '--ci':
$this->ci = true;
break;
}
}
}
}
|
48d7bb6353dec050b3020e54028984eea4d350d1 | README.md | README.md |
Package nanomsg adds language bindings for nanomsg in Go. nanomsg is a
high-performance implementation of several "scalability protocols". See
http://nanomsg.org/ for more information.
This is a work in progress. nanomsg is still in a beta stage. Expect its
API, or this binding, to change.
## Installing
### Using *go get*
$ go get github.com/op/go-nanomsg
After this command *go-nanomsg* is ready to use. Its source will be in:
$GOROOT/src/pkg/github.com/op/go-nanomsg
You can use `go get -u -a` to update all installed packages.
## Documentation
For docs, see http://godoc.org/github.com/op/go-nanomsg or run:
$ go doc github.com/op/go-nanomsg
## Alternatives
There is now also an implementation of nanomsg in pure Go. See
https://github.com/gdamore/mangos for more details.
|
Package nanomsg adds language bindings for nanomsg in Go. nanomsg is a
high-performance implementation of several "scalability protocols". See
http://nanomsg.org/ for more information.
This is a work in progress. nanomsg is still in a beta stage. Expect its
API, or this binding, to change.
## Installing
This is a cgo based library and requires the nanomsg library to build. Install
it either from [source](http://nanomsg.org/download.html) or use your package
manager of choice. 0.9 or later is required.
### Using *go get*
$ go get github.com/op/go-nanomsg
After this command *go-nanomsg* is ready to use. Its source will be in:
$GOROOT/src/pkg/github.com/op/go-nanomsg
You can use `go get -u -a` to update all installed packages.
## Documentation
For docs, see http://godoc.org/github.com/op/go-nanomsg or run:
$ go doc github.com/op/go-nanomsg
## Alternatives
There is now also an implementation of nanomsg in pure Go. See
https://github.com/gdamore/mangos for more details.
| Add short prerequisite information to install | Add short prerequisite information to install
Closes #14.
| Markdown | mit | op/go-nanomsg | markdown | ## Code Before:
Package nanomsg adds language bindings for nanomsg in Go. nanomsg is a
high-performance implementation of several "scalability protocols". See
http://nanomsg.org/ for more information.
This is a work in progress. nanomsg is still in a beta stage. Expect its
API, or this binding, to change.
## Installing
### Using *go get*
$ go get github.com/op/go-nanomsg
After this command *go-nanomsg* is ready to use. Its source will be in:
$GOROOT/src/pkg/github.com/op/go-nanomsg
You can use `go get -u -a` to update all installed packages.
## Documentation
For docs, see http://godoc.org/github.com/op/go-nanomsg or run:
$ go doc github.com/op/go-nanomsg
## Alternatives
There is now also an implementation of nanomsg in pure Go. See
https://github.com/gdamore/mangos for more details.
## Instruction:
Add short prerequisite information to install
Closes #14.
## Code After:
Package nanomsg adds language bindings for nanomsg in Go. nanomsg is a
high-performance implementation of several "scalability protocols". See
http://nanomsg.org/ for more information.
This is a work in progress. nanomsg is still in a beta stage. Expect its
API, or this binding, to change.
## Installing
This is a cgo based library and requires the nanomsg library to build. Install
it either from [source](http://nanomsg.org/download.html) or use your package
manager of choice. 0.9 or later is required.
### Using *go get*
$ go get github.com/op/go-nanomsg
After this command *go-nanomsg* is ready to use. Its source will be in:
$GOROOT/src/pkg/github.com/op/go-nanomsg
You can use `go get -u -a` to update all installed packages.
## Documentation
For docs, see http://godoc.org/github.com/op/go-nanomsg or run:
$ go doc github.com/op/go-nanomsg
## Alternatives
There is now also an implementation of nanomsg in pure Go. See
https://github.com/gdamore/mangos for more details.
|
0b078257b39db2ceddfb1f1a44f66aab40eac386 | containers/Pollard.js | containers/Pollard.js | import React, { Component } from 'react';
import SetPage from '../components/SetPage';
export default class Pollard extends Component {
render() {
return (
<div className="container">
{ this.props.children }
</div>
);
}
}
| import React, { Component } from 'react';
import { Link } from 'react-router';
import SetPage from '../components/SetPage';
export default class Pollard extends Component {
render() {
return (
<div className="container">
<ul>
<li><Link to="/setlist" activeClassName="active">Setlist</Link></li>
</ul>
{ this.props.children }
</div>
);
}
}
| Add routing link on / | Add routing link on /
| JavaScript | mit | freeformpdx/pollard,spencerliechty/pollard,freeformpdx/pollard,spencerliechty/pollard,spncrlkt/pollard,spncrlkt/pollard,spncrlkt/pollard,spencerliechty/pollard,freeformpdx/pollard | javascript | ## Code Before:
import React, { Component } from 'react';
import SetPage from '../components/SetPage';
export default class Pollard extends Component {
render() {
return (
<div className="container">
{ this.props.children }
</div>
);
}
}
## Instruction:
Add routing link on /
## Code After:
import React, { Component } from 'react';
import { Link } from 'react-router';
import SetPage from '../components/SetPage';
export default class Pollard extends Component {
render() {
return (
<div className="container">
<ul>
<li><Link to="/setlist" activeClassName="active">Setlist</Link></li>
</ul>
{ this.props.children }
</div>
);
}
}
|
d25b15a7142016eddfb275555e53e0c4bd90f606 | README.md | README.md |
`ipa` is a CLI utility for managing your $PATH vars
### Installing IPA
curl https://raw.github.com/mattswe/ipa/master/install.sh | sh
### Output look like:
```shell
/home/matt/.rvm/gems/ruby-1.9.2-p290/bin
/home/matt/.rvm/gems/ruby-1.9.2-p290@global/bin
/home/matt/.rvm/rubies/ruby-1.9.2-p290/bin
/home/matt/.rvm/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
```
### Slogans.
"IPA: THE IDEMPOTENT PATH APPEND-ER"
"IPA: INDIA PALE ALE"
"IPA: INSCRUTABLE PORTLY APE"
"IPA: INSTRUCTION IN THE 'PRETTY ARTS'"
|
`ipa` is a CLI utility for managing your $PATH vars
### Installing IPA
curl https://raw.github.com/mattswe/ipa/master/install.sh | sh
### Commands
List your $PATH
$ bash ipa
[1] /Users/matt/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin
[2] /Users/matt/.rvm/gems/ruby-1.9.2-p290@global/bin
[3] /Users/matt/.rvm/rubies/ruby-1.9.2-p290/bin
[4] /Users/matt/.rvm/bin
[5] /usr/bin
[6] /bin
[7] /usr/sbin
[8] /sbin
[9] /usr/local/bin
[10] /usr/X11/bin
Add to $PATH
- Warns if already exists
- Tab-completion addition
Delete from $PATH
- Delete by path, or by number
### Slogans.
"IPA: THE IDEMPOTENT PATH APPEND-ER"
"IPA: INDIA PALE ALE"
"IPA: INSCRUTABLE PORTLY APE"
"IPA: INSTRUCTION IN THE 'PRETTY ARTS'"
| Create "commands" section in readme | Create "commands" section in readme
| Markdown | mit | sweenzor/ipa | markdown | ## Code Before:
`ipa` is a CLI utility for managing your $PATH vars
### Installing IPA
curl https://raw.github.com/mattswe/ipa/master/install.sh | sh
### Output look like:
```shell
/home/matt/.rvm/gems/ruby-1.9.2-p290/bin
/home/matt/.rvm/gems/ruby-1.9.2-p290@global/bin
/home/matt/.rvm/rubies/ruby-1.9.2-p290/bin
/home/matt/.rvm/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
```
### Slogans.
"IPA: THE IDEMPOTENT PATH APPEND-ER"
"IPA: INDIA PALE ALE"
"IPA: INSCRUTABLE PORTLY APE"
"IPA: INSTRUCTION IN THE 'PRETTY ARTS'"
## Instruction:
Create "commands" section in readme
## Code After:
`ipa` is a CLI utility for managing your $PATH vars
### Installing IPA
curl https://raw.github.com/mattswe/ipa/master/install.sh | sh
### Commands
List your $PATH
$ bash ipa
[1] /Users/matt/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin
[2] /Users/matt/.rvm/gems/ruby-1.9.2-p290@global/bin
[3] /Users/matt/.rvm/rubies/ruby-1.9.2-p290/bin
[4] /Users/matt/.rvm/bin
[5] /usr/bin
[6] /bin
[7] /usr/sbin
[8] /sbin
[9] /usr/local/bin
[10] /usr/X11/bin
Add to $PATH
- Warns if already exists
- Tab-completion addition
Delete from $PATH
- Delete by path, or by number
### Slogans.
"IPA: THE IDEMPOTENT PATH APPEND-ER"
"IPA: INDIA PALE ALE"
"IPA: INSCRUTABLE PORTLY APE"
"IPA: INSTRUCTION IN THE 'PRETTY ARTS'"
|
240731f4cb90649f80a783162c776bfa3aca4981 | _config.yml | _config.yml | title: Dev.Opera
url: http://dev.opera.com/
permalink: /:categories/:title/
future: false
markdown: kramdown
kramdown:
auto_ids: true
transliterated_header_ids: true
include:
- '.htaccess'
exclude:
- 'node_modules'
- 'Gruntfile.js'
- 'package.json'
- 'install.sh'
- 'README.md'
- 'LICENSE.md'
- 'CONTRIBUTING.md'
- '*.scss'
| title: Dev.Opera
url: http://dev.opera.com/
permalink: /:categories/:title/
future: false
markdown: kramdown
kramdown:
auto_ids: true
transliterated_header_ids: true
include:
- '.htaccess'
exclude:
- 'node_modules'
- 'Gruntfile.js'
- 'package.json'
- 'install.sh'
- 'README.md'
- 'LICENSE.md'
- 'CONTRIBUTING.md'
- '*.scss'
defaults:
- scope:
path: 'articles'
type: 'post'
values:
category: 'articles'
language: 'en'
- scope:
path: 'blog'
type: 'post'
values:
category: 'blog'
language: 'en'
- scope:
path: 'tv'
type: 'post'
values:
category: 'tv'
language: 'en'
| Set of default values for entries based on location | Set of default values for entries based on location
| YAML | apache-2.0 | initaldk/devopera,michaelstewart/devopera,kenarai/devopera,payeldillip/devopera,Mtmotahar/devopera,payeldillip/devopera,kenarai/devopera,andreasbovens/devopera,shwetank/devopera,operasoftware/devopera,cvan/devopera,operasoftware/devopera,operasoftware/devopera,paulirish/devopera,initaldk/devopera,andreasbovens/devopera,erikmaarten/devopera,simevidas/devopera,initaldk/devopera,Mtmotahar/devopera,erikmaarten/devopera,paulirish/devopera,michaelstewart/devopera,simevidas/devopera,Jasenpan1987/devopera,michaelstewart/devopera,payeldillip/devopera,payeldillip/devopera,cvan/devopera,paulirish/devopera,kenarai/devopera,kenarai/devopera,andreasbovens/devopera,SelenIT/devopera,Jasenpan1987/devopera,SelenIT/devopera,paulirish/devopera,erikmaarten/devopera,simevidas/devopera,initaldk/devopera,Jasenpan1987/devopera,SelenIT/devopera,SelenIT/devopera,Mtmotahar/devopera,simevidas/devopera,shwetank/devopera,michaelstewart/devopera,Mtmotahar/devopera,operasoftware/devopera,cvan/devopera,shwetank/devopera,cvan/devopera,Jasenpan1987/devopera,erikmaarten/devopera | yaml | ## Code Before:
title: Dev.Opera
url: http://dev.opera.com/
permalink: /:categories/:title/
future: false
markdown: kramdown
kramdown:
auto_ids: true
transliterated_header_ids: true
include:
- '.htaccess'
exclude:
- 'node_modules'
- 'Gruntfile.js'
- 'package.json'
- 'install.sh'
- 'README.md'
- 'LICENSE.md'
- 'CONTRIBUTING.md'
- '*.scss'
## Instruction:
Set of default values for entries based on location
## Code After:
title: Dev.Opera
url: http://dev.opera.com/
permalink: /:categories/:title/
future: false
markdown: kramdown
kramdown:
auto_ids: true
transliterated_header_ids: true
include:
- '.htaccess'
exclude:
- 'node_modules'
- 'Gruntfile.js'
- 'package.json'
- 'install.sh'
- 'README.md'
- 'LICENSE.md'
- 'CONTRIBUTING.md'
- '*.scss'
defaults:
- scope:
path: 'articles'
type: 'post'
values:
category: 'articles'
language: 'en'
- scope:
path: 'blog'
type: 'post'
values:
category: 'blog'
language: 'en'
- scope:
path: 'tv'
type: 'post'
values:
category: 'tv'
language: 'en'
|
c8cd27b615ad9f8b3e4a03d1c1b4a6d2951a9f37 | mendel/angular/src/app/components/category-filter-bar/category-filter-bar.html | mendel/angular/src/app/components/category-filter-bar/category-filter-bar.html | <div id="am-category-filter-bar" class="show-for-medium">
<div class="row collapse">
<div id="inputWrapper" class="small-12 columns">
<!-- Category Filter Input -->
<input ng-model="categoryFilterBar.input" ng-model-options="{ debounce: 100 }" type="text" focus-if="categoryFilterBar.focusInput" ng-disabled="categoryFilterBar.disabled">
<!-- Matching Categories -->
<div class="matches" ng-if="categoryFilterBar.matches">
<!-- Category Tiles -->
<div ng-repeat="category in categoryFilterBar.matches">
<!-- Category Tile -->
<div class="tile" ng-click="categoryFilterBar.handle($event)">
<input ng-model="category.selected" type="checkbox" name="category-tile-{{ category.id }}">
<label ng-mouseover="categoryFilterBar.helpCategory = category" id="match-category-tile-{{ $index }}" ng-class="{ 'hovered' : categoryFilterBar.focusIndex == $index }" for="category-tile-{{ category.id }}">{{ category.name }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
| <div id="am-category-filter-bar" class="show-for-medium">
<div class="row collapse">
<div id="inputWrapper" class="small-12 columns">
<!-- Category Filter Input (Class "mousetrap" tells hotkeys directive to allow hotkey input on this ) -->
<input class="mousetrap" ng-model="categoryFilterBar.input" ng-model-options="{ debounce: 100 }" type="text" focus-if="categoryFilterBar.focusInput" ng-disabled="categoryFilterBar.disabled">
<!-- Matching Categories -->
<div class="matches" ng-if="categoryFilterBar.matches">
<!-- Category Tiles -->
<div ng-repeat="category in categoryFilterBar.matches">
<!-- Category Tile -->
<div class="tile" ng-click="categoryFilterBar.handle($event)">
<input ng-model="category.selected" type="checkbox" name="category-tile-{{ category.id }}">
<label ng-mouseover="categoryFilterBar.helpCategory = category" id="match-category-tile-{{ $index }}" ng-class="{ 'hovered' : categoryFilterBar.focusIndex == $index }" for="category-tile-{{ category.id }}">{{ category.name }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
| Enable hotkeys only on category filter bar input | Enable hotkeys only on category filter bar input
| HTML | agpl-3.0 | Architizer/mendel,Architizer/mendel,Architizer/mendel,Architizer/mendel | html | ## Code Before:
<div id="am-category-filter-bar" class="show-for-medium">
<div class="row collapse">
<div id="inputWrapper" class="small-12 columns">
<!-- Category Filter Input -->
<input ng-model="categoryFilterBar.input" ng-model-options="{ debounce: 100 }" type="text" focus-if="categoryFilterBar.focusInput" ng-disabled="categoryFilterBar.disabled">
<!-- Matching Categories -->
<div class="matches" ng-if="categoryFilterBar.matches">
<!-- Category Tiles -->
<div ng-repeat="category in categoryFilterBar.matches">
<!-- Category Tile -->
<div class="tile" ng-click="categoryFilterBar.handle($event)">
<input ng-model="category.selected" type="checkbox" name="category-tile-{{ category.id }}">
<label ng-mouseover="categoryFilterBar.helpCategory = category" id="match-category-tile-{{ $index }}" ng-class="{ 'hovered' : categoryFilterBar.focusIndex == $index }" for="category-tile-{{ category.id }}">{{ category.name }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
## Instruction:
Enable hotkeys only on category filter bar input
## Code After:
<div id="am-category-filter-bar" class="show-for-medium">
<div class="row collapse">
<div id="inputWrapper" class="small-12 columns">
<!-- Category Filter Input (Class "mousetrap" tells hotkeys directive to allow hotkey input on this ) -->
<input class="mousetrap" ng-model="categoryFilterBar.input" ng-model-options="{ debounce: 100 }" type="text" focus-if="categoryFilterBar.focusInput" ng-disabled="categoryFilterBar.disabled">
<!-- Matching Categories -->
<div class="matches" ng-if="categoryFilterBar.matches">
<!-- Category Tiles -->
<div ng-repeat="category in categoryFilterBar.matches">
<!-- Category Tile -->
<div class="tile" ng-click="categoryFilterBar.handle($event)">
<input ng-model="category.selected" type="checkbox" name="category-tile-{{ category.id }}">
<label ng-mouseover="categoryFilterBar.helpCategory = category" id="match-category-tile-{{ $index }}" ng-class="{ 'hovered' : categoryFilterBar.focusIndex == $index }" for="category-tile-{{ category.id }}">{{ category.name }}</label>
</div>
</div>
</div>
</div>
</div>
</div>
|
98c8075b9b665ecfc7848a4d6fd588349398dd6b | _posts/2015-10-18-moving.md | _posts/2015-10-18-moving.md | ---
layout: post
title: Moving Hosting
date: 2015-10-18
summary: It's time
categories:
---
Heyo, quick announcement that this site will be moving hosting from the [Nearly Free Speech Network](https://www.nearlyfreespeech.net/) to a custom solution hosted at [Digital Ocean](https://www.digitalocean.com/). What follows is an imaginary Q&A.
###Q: Why?
Because there's an increasing amount of content that I would like to share on this blog that doesn't meet the constraints of the Nearly Free Speech Network. Games, tools, demonstrations of technologies, and more. This is why the planned part-2 to my [article on sockets](/2015/09/25/sockets/) still has not arrived. I could continually link to a separate site which hosted all these projects, but I'd rather not. Simply put, the NFSN is for static content, and this is no longer going to be a fully static site.
###Q: What does this mean for me?
A continuing temporary slow-down in content while I make the move. Following the move, cool things which wouldn't currently be possible.
###Q: What does this mean for you?
Work.
Test
| ---
layout: post
title: Moving Hosting
date: 2015-10-18
summary: It's time
categories:
---
Heyo, quick announcement that this site will be moving hosting from the [Nearly Free Speech Network](https://www.nearlyfreespeech.net/) to a custom solution hosted at [Digital Ocean](https://www.digitalocean.com/). What follows is an imaginary Q&A.
###Q: Why?
Because there's an increasing amount of content that I would like to share on this blog that doesn't meet the constraints of the Nearly Free Speech Network. Games, tools, demonstrations of technologies, and more. This is why the planned part-2 to my [article on sockets](/2015/09/25/sockets/) still has not arrived. I could continually link to a separate site which hosted all these projects, but I'd rather not. Simply put, the NFSN is for static content, and this is no longer going to be a fully static site.
###Q: What does this mean for me?
A continuing temporary slow-down in content while I make the move. Following the move, cool things which wouldn't currently be possible.
###Q: What does this mean for you?
Work.
Update: migration is now complete
| Update post migration to digital ocean complete | Update post migration to digital ocean complete
| Markdown | mit | RandomSeeded/pixyll,RandomSeeded/pixyll | markdown | ## Code Before:
---
layout: post
title: Moving Hosting
date: 2015-10-18
summary: It's time
categories:
---
Heyo, quick announcement that this site will be moving hosting from the [Nearly Free Speech Network](https://www.nearlyfreespeech.net/) to a custom solution hosted at [Digital Ocean](https://www.digitalocean.com/). What follows is an imaginary Q&A.
###Q: Why?
Because there's an increasing amount of content that I would like to share on this blog that doesn't meet the constraints of the Nearly Free Speech Network. Games, tools, demonstrations of technologies, and more. This is why the planned part-2 to my [article on sockets](/2015/09/25/sockets/) still has not arrived. I could continually link to a separate site which hosted all these projects, but I'd rather not. Simply put, the NFSN is for static content, and this is no longer going to be a fully static site.
###Q: What does this mean for me?
A continuing temporary slow-down in content while I make the move. Following the move, cool things which wouldn't currently be possible.
###Q: What does this mean for you?
Work.
Test
## Instruction:
Update post migration to digital ocean complete
## Code After:
---
layout: post
title: Moving Hosting
date: 2015-10-18
summary: It's time
categories:
---
Heyo, quick announcement that this site will be moving hosting from the [Nearly Free Speech Network](https://www.nearlyfreespeech.net/) to a custom solution hosted at [Digital Ocean](https://www.digitalocean.com/). What follows is an imaginary Q&A.
###Q: Why?
Because there's an increasing amount of content that I would like to share on this blog that doesn't meet the constraints of the Nearly Free Speech Network. Games, tools, demonstrations of technologies, and more. This is why the planned part-2 to my [article on sockets](/2015/09/25/sockets/) still has not arrived. I could continually link to a separate site which hosted all these projects, but I'd rather not. Simply put, the NFSN is for static content, and this is no longer going to be a fully static site.
###Q: What does this mean for me?
A continuing temporary slow-down in content while I make the move. Following the move, cool things which wouldn't currently be possible.
###Q: What does this mean for you?
Work.
Update: migration is now complete
|
597a941ad2ec9359988674338a489dcb68a296cc | exercises/templates/exercises/list_exercises.html | exercises/templates/exercises/list_exercises.html | {% extends "base.html" %}
{% block content %}
{% for page in page_list %}
<p><a href="{% url exercises:show page.pk %}">{{ page }}</a></p>
{% endfor %}
{% endblock %}
| {% extends "base.html" %}
{% block content %}
<a href="{% url exercises:add %}">Lisää harjoitus</a>
{% for page in page_list %}
<p><a href="{% url exercises:show page.pk %}">{{ page }}</a></p>
{% endfor %}
{% endblock %}
| Add link for adding new exercises | Add link for adding new exercises
| HTML | agpl-3.0 | jluttine/django-modelanswers,jluttine/django-modelanswers | html | ## Code Before:
{% extends "base.html" %}
{% block content %}
{% for page in page_list %}
<p><a href="{% url exercises:show page.pk %}">{{ page }}</a></p>
{% endfor %}
{% endblock %}
## Instruction:
Add link for adding new exercises
## Code After:
{% extends "base.html" %}
{% block content %}
<a href="{% url exercises:add %}">Lisää harjoitus</a>
{% for page in page_list %}
<p><a href="{% url exercises:show page.pk %}">{{ page }}</a></p>
{% endfor %}
{% endblock %}
|
8876cd7f6f3c8735291d9583f70cd9dfd1c7443a | .travis.yml | .travis.yml | language: go
go:
- tip
install:
- make get-deps
script:
- make check
| language: go
before_install:
- sudo apt-get update -q
- sudo apt-get install libvips-dev
go:
- tip
install:
- make get-deps
script:
- make check
| Install libvips, as required by the vips package | Install libvips, as required by the vips package
| YAML | bsd-3-clause | espebra/filebin,espebra/filebin,espebra/filebin,espebra/filebin | yaml | ## Code Before:
language: go
go:
- tip
install:
- make get-deps
script:
- make check
## Instruction:
Install libvips, as required by the vips package
## Code After:
language: go
before_install:
- sudo apt-get update -q
- sudo apt-get install libvips-dev
go:
- tip
install:
- make get-deps
script:
- make check
|
88ba9b2b2af325d5a74959e997451230c0bbc9f1 | DependencyInjection/Compiler/ValidationPass.php | DependencyInjection/Compiler/ValidationPass.php | <?php
/*
* This file is part of the TecnoCreaciones package.
*
* (c) www.tecnocreaciones.com.ve
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tecnocreaciones\Bundle\AjaxFOSUserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Description of ValidationPass
*
* @author Carlos Mendoza <inhack20@tecnocreaciones.com>
*/
class ValidationPass implements CompilerPassInterface
{
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
if (!$container->hasParameter('fos_user.registration.confirmation.enabled')) {
return;
}
if($container->getParameter('fos_user.registration.confirmation.enabled') == true){
$definition = $container->getDefinition('fos_user.listener.email_confirmation');
$definition
->setClass('Tecnocreaciones\Bundle\AjaxFOSUserBundle\EventListener\EmailConfirmationListener')
->addMethodCall('setTranslator',array($container->getDefinition('translator.default')))
;
}
}
}
| <?php
/*
* This file is part of the TecnoCreaciones package.
*
* (c) www.tecnocreaciones.com.ve
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tecnocreaciones\Bundle\AjaxFOSUserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Description of ValidationPass
*
* @author Carlos Mendoza <inhack20@tecnocreaciones.com>
*/
class ValidationPass implements CompilerPassInterface
{
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
if (!$container->hasParameter('fos_user.registration.confirmation.enabled')) {
return;
}
if($container->getParameter('fos_user.registration.confirmation.enabled') == true){
//Backward compatibility with Fos User 1.3
if(class_exists('FOS\UserBundle\FOSUserEvents')){
$definition = $container->getDefinition('fos_user.listener.email_confirmation');
$definition
->setClass('Tecnocreaciones\Bundle\AjaxFOSUserBundle\EventListener\EmailConfirmationListener')
->addMethodCall('setTranslator',array($container->getDefinition('translator.default')))
;
}
}
}
}
| Fix bug de compatibilidad con FOSUser 1.3 | Fix bug de compatibilidad con FOSUser 1.3 | PHP | mit | Tecnocreaciones/AjaxFOSUserBundle | php | ## Code Before:
<?php
/*
* This file is part of the TecnoCreaciones package.
*
* (c) www.tecnocreaciones.com.ve
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tecnocreaciones\Bundle\AjaxFOSUserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Description of ValidationPass
*
* @author Carlos Mendoza <inhack20@tecnocreaciones.com>
*/
class ValidationPass implements CompilerPassInterface
{
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
if (!$container->hasParameter('fos_user.registration.confirmation.enabled')) {
return;
}
if($container->getParameter('fos_user.registration.confirmation.enabled') == true){
$definition = $container->getDefinition('fos_user.listener.email_confirmation');
$definition
->setClass('Tecnocreaciones\Bundle\AjaxFOSUserBundle\EventListener\EmailConfirmationListener')
->addMethodCall('setTranslator',array($container->getDefinition('translator.default')))
;
}
}
}
## Instruction:
Fix bug de compatibilidad con FOSUser 1.3
## Code After:
<?php
/*
* This file is part of the TecnoCreaciones package.
*
* (c) www.tecnocreaciones.com.ve
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tecnocreaciones\Bundle\AjaxFOSUserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Description of ValidationPass
*
* @author Carlos Mendoza <inhack20@tecnocreaciones.com>
*/
class ValidationPass implements CompilerPassInterface
{
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
if (!$container->hasParameter('fos_user.registration.confirmation.enabled')) {
return;
}
if($container->getParameter('fos_user.registration.confirmation.enabled') == true){
//Backward compatibility with Fos User 1.3
if(class_exists('FOS\UserBundle\FOSUserEvents')){
$definition = $container->getDefinition('fos_user.listener.email_confirmation');
$definition
->setClass('Tecnocreaciones\Bundle\AjaxFOSUserBundle\EventListener\EmailConfirmationListener')
->addMethodCall('setTranslator',array($container->getDefinition('translator.default')))
;
}
}
}
}
|
165ef87f9fd4f11f4d37505990b531d1b3dee428 | source/kepo.ts | source/kepo.ts | // The currently-pressed key codes from oldest to newest
const pressedKeyCodes: number[] = []
export const pressedKeyCodesFromOldestToNewest =
pressedKeyCodes as ReadonlyArray<number>
export function isKeyPressed(keyCode: number): boolean {
return pressedKeyCodes.includes(keyCode)
}
export function areAllKeysPressed(...keyCodes: number[]): boolean {
return keyCodes.every(k => isKeyPressed(k))
}
export function mostRecentlyPressedKey(...keyCodes: number[]): number | undefined {
return last(
keyCodes.length
? pressedKeyCodes.filter(p => keyCodes.includes(p))
: pressedKeyCodes
)
}
document.addEventListener('keydown', event => {
if (!isKeyPressed(event.keyCode)) {
pressedKeyCodes.push(event.keyCode)
}
})
document.addEventListener('keyup', event => {
if (isKeyPressed(event.keyCode)) {
pressedKeyCodes.splice(pressedKeyCodes.indexOf(event.keyCode), 1)
}
})
function last<T>(items: ReadonlyArray<T>): T | undefined {
return items[items.length - 1];
}
| // The currently-pressed key codes from oldest to newest
const pressedKeyCodes: number[] = []
export const pressedKeyCodesFromOldestToNewest =
pressedKeyCodes as ReadonlyArray<number>
export function isKeyPressed(keyCode: number): boolean {
return pressedKeyCodes.includes(keyCode)
}
export function areAllKeysPressed(...keyCodes: number[]): boolean {
return keyCodes.every(k => isKeyPressed(k))
}
export function mostRecentlyPressedKey(...keyCodes: number[]): number | undefined {
return last(
keyCodes.length
? pressedKeyCodes.filter(p => keyCodes.includes(p))
: pressedKeyCodes
)
}
document.addEventListener('keydown', event => {
if (!isKeyPressed(event.keyCode)) {
pressedKeyCodes.push(event.keyCode)
}
})
document.addEventListener('keyup', event => {
if (isKeyPressed(event.keyCode)) {
pressedKeyCodes.splice(pressedKeyCodes.indexOf(event.keyCode), 1)
}
})
window.addEventListener('blur', () => {
pressedKeyCodes.splice(0)
})
function last<T>(items: ReadonlyArray<T>): T | undefined {
return items[items.length - 1];
}
| Clear all pressed keys when tab loses focus | Clear all pressed keys when tab loses focus
| TypeScript | mit | start/kepo,start/kepo,start/kepo | typescript | ## Code Before:
// The currently-pressed key codes from oldest to newest
const pressedKeyCodes: number[] = []
export const pressedKeyCodesFromOldestToNewest =
pressedKeyCodes as ReadonlyArray<number>
export function isKeyPressed(keyCode: number): boolean {
return pressedKeyCodes.includes(keyCode)
}
export function areAllKeysPressed(...keyCodes: number[]): boolean {
return keyCodes.every(k => isKeyPressed(k))
}
export function mostRecentlyPressedKey(...keyCodes: number[]): number | undefined {
return last(
keyCodes.length
? pressedKeyCodes.filter(p => keyCodes.includes(p))
: pressedKeyCodes
)
}
document.addEventListener('keydown', event => {
if (!isKeyPressed(event.keyCode)) {
pressedKeyCodes.push(event.keyCode)
}
})
document.addEventListener('keyup', event => {
if (isKeyPressed(event.keyCode)) {
pressedKeyCodes.splice(pressedKeyCodes.indexOf(event.keyCode), 1)
}
})
function last<T>(items: ReadonlyArray<T>): T | undefined {
return items[items.length - 1];
}
## Instruction:
Clear all pressed keys when tab loses focus
## Code After:
// The currently-pressed key codes from oldest to newest
const pressedKeyCodes: number[] = []
export const pressedKeyCodesFromOldestToNewest =
pressedKeyCodes as ReadonlyArray<number>
export function isKeyPressed(keyCode: number): boolean {
return pressedKeyCodes.includes(keyCode)
}
export function areAllKeysPressed(...keyCodes: number[]): boolean {
return keyCodes.every(k => isKeyPressed(k))
}
export function mostRecentlyPressedKey(...keyCodes: number[]): number | undefined {
return last(
keyCodes.length
? pressedKeyCodes.filter(p => keyCodes.includes(p))
: pressedKeyCodes
)
}
document.addEventListener('keydown', event => {
if (!isKeyPressed(event.keyCode)) {
pressedKeyCodes.push(event.keyCode)
}
})
document.addEventListener('keyup', event => {
if (isKeyPressed(event.keyCode)) {
pressedKeyCodes.splice(pressedKeyCodes.indexOf(event.keyCode), 1)
}
})
window.addEventListener('blur', () => {
pressedKeyCodes.splice(0)
})
function last<T>(items: ReadonlyArray<T>): T | undefined {
return items[items.length - 1];
}
|
4837ed0c149073bc970f46e9aa0c36f896559e3a | src/Growl.php | src/Growl.php | <?php
namespace BryanCrowe\Growl;
use BryanCrowe\Growl\Builder\BuilderAbstract;
class Growl
{
/**
* The Builder to use for building the command.
*
* @var BuilderAbstract
*/
protected $builder;
/**
* An array of options to use for building commands.
*
* @var array
*/
protected $options = array();
/**
* Constructor.
*
* Accepts a Builder object to be used in building the command.
*
* @param BuilderAbstract $builder
*
* @return void
*/
public function __construct(BuilderAbstract $builder)
{
$this->builder = $builder;
}
/**
* Executes the built command.
*
* @return string
*/
public function execute()
{
$command = $this->builder->build($this->options);
return exec($command);
}
/**
* Implement the __call magic method to provide an expressive way of setting
* options for commands.
*
* @param string $name The name of the method called.
* @param array $args An array of the supplied arguments.
*
* @return $this
*/
public function __call($name, $args)
{
$this->options[$name] = $args[0];
return $this;
}
}
| <?php
namespace BryanCrowe\Growl;
use BryanCrowe\Growl\Builder\BuilderAbstract;
class Growl
{
/**
* The Builder to use for building the command.
*
* @var BuilderAbstract
*/
protected $builder;
/**
* An array of options to use for building commands.
*
* @var array
*/
protected $options = array();
/**
* Constructor.
*
* Accepts a Builder object to be used in building the command.
*
* @param BuilderAbstract $builder
*
* @return void
*/
public function __construct(BuilderAbstract $builder)
{
$this->builder = $builder;
}
/**
* Executes the built command.
*
* @return string
*/
public function execute()
{
$command = $this->builder->build($this->options);
return exec($command);
}
/**
* Set options for Builders with a key/value.
*
* @param string $key The key.
* @param array $value The value of the key.
*
* @return $this
*/
public function set($key, $value)
{
$this->options[$key] = $value;
return $this;
}
}
| Use set() method instead of __call magic method | Use set() method instead of __call magic method
| PHP | mit | bcrowe/growl | php | ## Code Before:
<?php
namespace BryanCrowe\Growl;
use BryanCrowe\Growl\Builder\BuilderAbstract;
class Growl
{
/**
* The Builder to use for building the command.
*
* @var BuilderAbstract
*/
protected $builder;
/**
* An array of options to use for building commands.
*
* @var array
*/
protected $options = array();
/**
* Constructor.
*
* Accepts a Builder object to be used in building the command.
*
* @param BuilderAbstract $builder
*
* @return void
*/
public function __construct(BuilderAbstract $builder)
{
$this->builder = $builder;
}
/**
* Executes the built command.
*
* @return string
*/
public function execute()
{
$command = $this->builder->build($this->options);
return exec($command);
}
/**
* Implement the __call magic method to provide an expressive way of setting
* options for commands.
*
* @param string $name The name of the method called.
* @param array $args An array of the supplied arguments.
*
* @return $this
*/
public function __call($name, $args)
{
$this->options[$name] = $args[0];
return $this;
}
}
## Instruction:
Use set() method instead of __call magic method
## Code After:
<?php
namespace BryanCrowe\Growl;
use BryanCrowe\Growl\Builder\BuilderAbstract;
class Growl
{
/**
* The Builder to use for building the command.
*
* @var BuilderAbstract
*/
protected $builder;
/**
* An array of options to use for building commands.
*
* @var array
*/
protected $options = array();
/**
* Constructor.
*
* Accepts a Builder object to be used in building the command.
*
* @param BuilderAbstract $builder
*
* @return void
*/
public function __construct(BuilderAbstract $builder)
{
$this->builder = $builder;
}
/**
* Executes the built command.
*
* @return string
*/
public function execute()
{
$command = $this->builder->build($this->options);
return exec($command);
}
/**
* Set options for Builders with a key/value.
*
* @param string $key The key.
* @param array $value The value of the key.
*
* @return $this
*/
public function set($key, $value)
{
$this->options[$key] = $value;
return $this;
}
}
|
0ee382387ff83da0c740dbc05c1a567b4f60cde1 | server/server.js | server/server.js | import express from 'express';
import logger from 'morgan';
import validator from 'express-validator';
import bodyParser from 'body-parser';
import verifyToken from './middlewares/auth';
import valueChecker from './middlewares/valueChecker';
import router from './routes/router';
const app = express();
const port = process.env.PORT || 8000;
app.use(logger('dev'));
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(validator());
app.use('/api/v1', verifyToken);
app.use(valueChecker);
app.use(router);
app.use('*', (req, res) => res.redirect(302, '/'));
app.listen(port);
export default app;
| import express from 'express';
import logger from 'morgan';
import validator from 'express-validator';
import bodyParser from 'body-parser';
import verifyToken from './middlewares/verifyToken';
import valueChecker from './middlewares/valueChecker';
import router from './routes/router';
const app = express();
const port = process.env.PORT || 8000;
app.use(logger('dev'));
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(validator());
app.use('/api/v1', verifyToken);
app.use(valueChecker);
app.use(router);
app.use('*', (req, res) => res.redirect(302, '/'));
app.listen(port);
export default app;
| Modify the imported module filename | Modify the imported module filename
| JavaScript | mit | vynessa/dman,vynessa/dman | javascript | ## Code Before:
import express from 'express';
import logger from 'morgan';
import validator from 'express-validator';
import bodyParser from 'body-parser';
import verifyToken from './middlewares/auth';
import valueChecker from './middlewares/valueChecker';
import router from './routes/router';
const app = express();
const port = process.env.PORT || 8000;
app.use(logger('dev'));
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(validator());
app.use('/api/v1', verifyToken);
app.use(valueChecker);
app.use(router);
app.use('*', (req, res) => res.redirect(302, '/'));
app.listen(port);
export default app;
## Instruction:
Modify the imported module filename
## Code After:
import express from 'express';
import logger from 'morgan';
import validator from 'express-validator';
import bodyParser from 'body-parser';
import verifyToken from './middlewares/verifyToken';
import valueChecker from './middlewares/valueChecker';
import router from './routes/router';
const app = express();
const port = process.env.PORT || 8000;
app.use(logger('dev'));
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(validator());
app.use('/api/v1', verifyToken);
app.use(valueChecker);
app.use(router);
app.use('*', (req, res) => res.redirect(302, '/'));
app.listen(port);
export default app;
|
99b668594582882bb1fbca3b3793ff452edac2c1 | updatebot/__init__.py | updatebot/__init__.py |
from updatebot.bot import Bot
from updatebot.current import Bot as CurrentBot
from updatebot.native import Bot as NativeBot
from updatebot.config import UpdateBotConfig
|
from updatebot.bot import Bot
from updatebot.current import Bot as CurrentBot
from updatebot.config import UpdateBotConfig
| Remove import of missing module | Remove import of missing module
| Python | apache-2.0 | sassoftware/mirrorball,sassoftware/mirrorball | python | ## Code Before:
from updatebot.bot import Bot
from updatebot.current import Bot as CurrentBot
from updatebot.native import Bot as NativeBot
from updatebot.config import UpdateBotConfig
## Instruction:
Remove import of missing module
## Code After:
from updatebot.bot import Bot
from updatebot.current import Bot as CurrentBot
from updatebot.config import UpdateBotConfig
|
d67099ce7d30e31b98251f7386b33caaa5199a01 | censusreporter/config/prod/wsgi.py | censusreporter/config/prod/wsgi.py | import os
from django.core.wsgi import get_wsgi_application
import newrelic.agent
newrelic.agent.initialize('/var/www-data/censusreporter/conf/newrelic.ini')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings")
application = get_wsgi_application()
| import os
from django.core.wsgi import get_wsgi_application
import newrelic.agent
newrelic.agent.initialize(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../../conf/newrelic.ini'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings")
application = get_wsgi_application()
| Correct location of newrelic config | Correct location of newrelic config
| Python | mit | sseguku/simplecensusug,Code4SA/censusreporter,Code4SA/censusreporter,Code4SA/censusreporter,sseguku/simplecensusug,4bic/censusreporter,sseguku/simplecensusug,4bic/censusreporter,Code4SA/censusreporter,4bic/censusreporter | python | ## Code Before:
import os
from django.core.wsgi import get_wsgi_application
import newrelic.agent
newrelic.agent.initialize('/var/www-data/censusreporter/conf/newrelic.ini')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings")
application = get_wsgi_application()
## Instruction:
Correct location of newrelic config
## Code After:
import os
from django.core.wsgi import get_wsgi_application
import newrelic.agent
newrelic.agent.initialize(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../../conf/newrelic.ini'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings")
application = get_wsgi_application()
|
1145e239195e74803f9727d31132a9bb94f32144 | content/posts/draft-ansible.md | content/posts/draft-ansible.md | title: Liberating effect of Ansible
## Outline of a future article
- No fear. Certainty.
- Idempotent behavior
- Version control. Infractructure as a code
- Consumer approach to servers
- Metaphor: moving into an apartment vs the hotel room (hotel rider list for
a celebrity)
- Cheap test deployment to a hourly billed cloud instance
- Not sure about Ansible Galaxy, you would still need to read it all to trust.
And minor tweaks are almost always required.
| title: Liberating effect of Ansible
## Outline of a future article
- No fear. Certainty.
- Idempotent behavior
- Version control. Infractructure as a code
- Consumer approach to servers
- Metaphor: moving into an apartment vs the hotel room (hotel rider list for
a celebrity)
- Why copy shell and cli configs? You ain't gonna use them
- Cheap test deployment to a hourly billed cloud instance
- Not sure about Ansible Galaxy, you would still need to read it all to trust.
And minor tweaks are almost always required.
| Add note on shell settings | Add note on shell settings
| Markdown | apache-2.0 | sio/potyarkin.ml,sio/potyarkin.ml | markdown | ## Code Before:
title: Liberating effect of Ansible
## Outline of a future article
- No fear. Certainty.
- Idempotent behavior
- Version control. Infractructure as a code
- Consumer approach to servers
- Metaphor: moving into an apartment vs the hotel room (hotel rider list for
a celebrity)
- Cheap test deployment to a hourly billed cloud instance
- Not sure about Ansible Galaxy, you would still need to read it all to trust.
And minor tweaks are almost always required.
## Instruction:
Add note on shell settings
## Code After:
title: Liberating effect of Ansible
## Outline of a future article
- No fear. Certainty.
- Idempotent behavior
- Version control. Infractructure as a code
- Consumer approach to servers
- Metaphor: moving into an apartment vs the hotel room (hotel rider list for
a celebrity)
- Why copy shell and cli configs? You ain't gonna use them
- Cheap test deployment to a hourly billed cloud instance
- Not sure about Ansible Galaxy, you would still need to read it all to trust.
And minor tweaks are almost always required.
|
d8b33c96b69f0e9cc7f315b341a29d6d2bdfa2a6 | Keter/TempFolder.hs | Keter/TempFolder.hs | {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Keter.TempFolder
( TempFolder
, setup
, getFolder
) where
import Keter.Prelude
import Data.Word (Word)
import Keter.Postgres (Appname)
import qualified Data.IORef as I
import System.Posix.Files.ByteString (setOwnerAndGroup)
import System.Posix.Types (UserID, GroupID)
import qualified Filesystem.Path.CurrentOS as F
data TempFolder = TempFolder
{ tfRoot :: FilePath
, tfCounter :: IORef Word
}
setup :: FilePath -> KIO (Either SomeException TempFolder)
setup fp = liftIO $ do
e <- isDirectory fp
when e $ removeTree fp
createTree fp
c <- I.newIORef minBound
return $ TempFolder fp c
getFolder :: Maybe (UserID, GroupID) -> TempFolder -> Appname -> KIO (Either SomeException FilePath)
getFolder muid TempFolder {..} appname = do
!i <- atomicModifyIORef tfCounter $ \i -> (succ i, i)
let fp = tfRoot </> fromText (appname ++ "-" ++ show i)
liftIO $ do
createTree fp
case muid of
Nothing -> return ()
Just (uid, gid) -> setOwnerAndGroup (F.encode fp) uid gid
return fp
| {-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Keter.TempFolder
( TempFolder
, setup
, getFolder
) where
import Keter.Prelude
import Data.Word (Word)
import Keter.Postgres (Appname)
import qualified Data.IORef as I
import System.Posix.Files (setOwnerAndGroup)
import System.Posix.Types (UserID, GroupID)
import qualified Filesystem.Path.CurrentOS as F
data TempFolder = TempFolder
{ tfRoot :: FilePath
, tfCounter :: IORef Word
}
setup :: FilePath -> KIO (Either SomeException TempFolder)
setup fp = liftIO $ do
e <- isDirectory fp
when e $ removeTree fp
createTree fp
c <- I.newIORef minBound
return $ TempFolder fp c
getFolder :: Maybe (UserID, GroupID) -> TempFolder -> Appname -> KIO (Either SomeException FilePath)
getFolder muid TempFolder {..} appname = do
!i <- atomicModifyIORef tfCounter $ \i -> (succ i, i)
let fp = tfRoot </> fromText (appname ++ "-" ++ show i)
liftIO $ do
createTree fp
case muid of
Nothing -> return ()
Just (uid, gid) -> setOwnerAndGroup (F.encodeString fp) uid gid
return fp
| Remove another usage of encode | Remove another usage of encode
| Haskell | mit | andrewthad/keter,ajnsit/keter,tolysz/keter,ajnsit/keter,snoyberg/keter,andrewthad/keter,creichert/keter,mwotton/keter,telser/keter,snoyberg/keter,tolysz/keter,bermanjosh/keter,mwotton/keter,creichert/keter,bermanjosh/keter,telser/keter | haskell | ## Code Before:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Keter.TempFolder
( TempFolder
, setup
, getFolder
) where
import Keter.Prelude
import Data.Word (Word)
import Keter.Postgres (Appname)
import qualified Data.IORef as I
import System.Posix.Files.ByteString (setOwnerAndGroup)
import System.Posix.Types (UserID, GroupID)
import qualified Filesystem.Path.CurrentOS as F
data TempFolder = TempFolder
{ tfRoot :: FilePath
, tfCounter :: IORef Word
}
setup :: FilePath -> KIO (Either SomeException TempFolder)
setup fp = liftIO $ do
e <- isDirectory fp
when e $ removeTree fp
createTree fp
c <- I.newIORef minBound
return $ TempFolder fp c
getFolder :: Maybe (UserID, GroupID) -> TempFolder -> Appname -> KIO (Either SomeException FilePath)
getFolder muid TempFolder {..} appname = do
!i <- atomicModifyIORef tfCounter $ \i -> (succ i, i)
let fp = tfRoot </> fromText (appname ++ "-" ++ show i)
liftIO $ do
createTree fp
case muid of
Nothing -> return ()
Just (uid, gid) -> setOwnerAndGroup (F.encode fp) uid gid
return fp
## Instruction:
Remove another usage of encode
## Code After:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Keter.TempFolder
( TempFolder
, setup
, getFolder
) where
import Keter.Prelude
import Data.Word (Word)
import Keter.Postgres (Appname)
import qualified Data.IORef as I
import System.Posix.Files (setOwnerAndGroup)
import System.Posix.Types (UserID, GroupID)
import qualified Filesystem.Path.CurrentOS as F
data TempFolder = TempFolder
{ tfRoot :: FilePath
, tfCounter :: IORef Word
}
setup :: FilePath -> KIO (Either SomeException TempFolder)
setup fp = liftIO $ do
e <- isDirectory fp
when e $ removeTree fp
createTree fp
c <- I.newIORef minBound
return $ TempFolder fp c
getFolder :: Maybe (UserID, GroupID) -> TempFolder -> Appname -> KIO (Either SomeException FilePath)
getFolder muid TempFolder {..} appname = do
!i <- atomicModifyIORef tfCounter $ \i -> (succ i, i)
let fp = tfRoot </> fromText (appname ++ "-" ++ show i)
liftIO $ do
createTree fp
case muid of
Nothing -> return ()
Just (uid, gid) -> setOwnerAndGroup (F.encodeString fp) uid gid
return fp
|
b26337f0ce61d4b4cc5b4e413c6bac6500db44c8 | app/models/experience.rb | app/models/experience.rb | class Experience < ActiveRecord::Base
extend FriendlyId
has_many :cocktails, dependent: :destroy
accepts_nested_attributes_for :cocktails, reject_if: lambda { |cocktail| cocktail[:substance].blank? && cocktail[:dosage].blank? }
friendly_id :title, use: :slugged
is_impressionable
validates :title, :pseudonym, :body, presence: true
default_scope { order('created_at DESC') }
scope :approved, -> { where(is_approved: true) }
# XXX: a poor's man (and a poor's mind) search engine.
def self.search(query)
@results = []
["%#{query}", "%#{query}%", "#{query}%"].each do |query|
["title", "pseudonym"].each do |field|
candidates = Experience.approved.where("LOWER(#{field}) LIKE ?", query)
candidates.each { |candidate| @results << candidate } unless candidates.empty?
end
end
@results.uniq
end
# will_paginate per-page limit
def self.per_page
15
end
def approve
self.is_approved = true
save
end
end
| class Experience < ActiveRecord::Base
extend FriendlyId
has_many :cocktails, dependent: :destroy
accepts_nested_attributes_for :cocktails, reject_if: :cocktails_is_incomplete
friendly_id :title, use: :slugged
is_impressionable
validates :title, :pseudonym, :body, presence: true
default_scope { order('created_at DESC') }
scope :approved, -> { where(is_approved: true) }
# XXX: a poor's man (and a poor's mind) search engine.
def self.search(query)
@results = []
["%#{query}", "%#{query}%", "#{query}%"].each do |query|
["title", "pseudonym"].each do |field|
candidates = Experience.approved.where("LOWER(#{field}) LIKE ?", query)
candidates.each { |candidate| @results << candidate } unless candidates.empty?
end
end
@results.uniq
end
# will_paginate per-page limit
def self.per_page
15
end
def approve
self.is_approved = true
save
end
def cocktails_is_incomplete(cocktail)
cocktail[:substance].blank? && cocktail[:dosage].blank?
end
end
| Move condition to method for improved readability. | Move condition to method for improved readability.
| Ruby | mit | horacio/psychlopedia,horacio/psychlopedia,horacio/psychlopedia,horacio/psychlopedia | ruby | ## Code Before:
class Experience < ActiveRecord::Base
extend FriendlyId
has_many :cocktails, dependent: :destroy
accepts_nested_attributes_for :cocktails, reject_if: lambda { |cocktail| cocktail[:substance].blank? && cocktail[:dosage].blank? }
friendly_id :title, use: :slugged
is_impressionable
validates :title, :pseudonym, :body, presence: true
default_scope { order('created_at DESC') }
scope :approved, -> { where(is_approved: true) }
# XXX: a poor's man (and a poor's mind) search engine.
def self.search(query)
@results = []
["%#{query}", "%#{query}%", "#{query}%"].each do |query|
["title", "pseudonym"].each do |field|
candidates = Experience.approved.where("LOWER(#{field}) LIKE ?", query)
candidates.each { |candidate| @results << candidate } unless candidates.empty?
end
end
@results.uniq
end
# will_paginate per-page limit
def self.per_page
15
end
def approve
self.is_approved = true
save
end
end
## Instruction:
Move condition to method for improved readability.
## Code After:
class Experience < ActiveRecord::Base
extend FriendlyId
has_many :cocktails, dependent: :destroy
accepts_nested_attributes_for :cocktails, reject_if: :cocktails_is_incomplete
friendly_id :title, use: :slugged
is_impressionable
validates :title, :pseudonym, :body, presence: true
default_scope { order('created_at DESC') }
scope :approved, -> { where(is_approved: true) }
# XXX: a poor's man (and a poor's mind) search engine.
def self.search(query)
@results = []
["%#{query}", "%#{query}%", "#{query}%"].each do |query|
["title", "pseudonym"].each do |field|
candidates = Experience.approved.where("LOWER(#{field}) LIKE ?", query)
candidates.each { |candidate| @results << candidate } unless candidates.empty?
end
end
@results.uniq
end
# will_paginate per-page limit
def self.per_page
15
end
def approve
self.is_approved = true
save
end
def cocktails_is_incomplete(cocktail)
cocktail[:substance].blank? && cocktail[:dosage].blank?
end
end
|
4b954f98d657c0eda2049dce6a3e648b2ce9f80b | src/box2dbaseitem.cpp | src/box2dbaseitem.cpp |
float Box2DBaseItem::m_scaleRatio = 32.0f;
Box2DBaseItem::Box2DBaseItem(GameScene *parent )
: GameItem(parent)
, m_initialized(false)
, m_synchronizing(false)
, m_synchronize(true)
{
}
bool Box2DBaseItem::initialized() const
{
return m_initialized;
}
/*
* Shamelessly stolen from qml-box2d project at gitorious
*
* https://gitorious.org/qml-box2d/qml-box2d
*/
void Box2DBaseItem::synchronize()
{
if (m_synchronize && m_initialized) {
m_synchronizing = true;
const QPointF newPoint = b2Util::qTopLeft(b2TransformOrigin(), boundingRect(), m_scaleRatio);
const float32 angle = b2Angle();
const qreal newRotation = -(angle * 360.0) / (2 * b2_pi);
if (!qFuzzyCompare(x(), newPoint.x()) || !qFuzzyCompare(y(), newPoint.y()))
setPos(newPoint);
if (!qFuzzyCompare(rotation(), newRotation))
setRotation(newRotation);
m_synchronizing = false;
}
}
|
float Box2DBaseItem::m_scaleRatio = 32.0f;
Box2DBaseItem::Box2DBaseItem(GameScene *parent )
: GameItem(parent)
, m_initialized(false)
, m_synchronizing(false)
, m_synchronize(true)
{
}
bool Box2DBaseItem::initialized() const
{
return m_initialized;
}
/*
* Shamelessly stolen from qml-box2d project at gitorious
*
* https://gitorious.org/qml-box2d/qml-box2d
*/
void Box2DBaseItem::synchronize()
{
if (m_synchronize && m_initialized) {
m_synchronizing = true;
const QPointF newPoint = b2Util::qTopLeft(b2TransformOrigin(), boundingRect(), m_scaleRatio);
const qreal newRotation = b2Util::qAngle(b2Angle());
if (!qFuzzyCompare(x(), newPoint.x()) || !qFuzzyCompare(y(), newPoint.y()))
setPos(newPoint);
if (!qFuzzyCompare(rotation(), newRotation))
setRotation(newRotation);
m_synchronizing = false;
}
}
| Use helper function to get the new rotation | Use helper function to get the new rotation
| C++ | mit | paulovap/Bacon2D,kenvandine/Bacon2D,paulovap/Bacon2D,arcrowel/Bacon2D,kenvandine/Bacon2D,arcrowel/Bacon2D | c++ | ## Code Before:
float Box2DBaseItem::m_scaleRatio = 32.0f;
Box2DBaseItem::Box2DBaseItem(GameScene *parent )
: GameItem(parent)
, m_initialized(false)
, m_synchronizing(false)
, m_synchronize(true)
{
}
bool Box2DBaseItem::initialized() const
{
return m_initialized;
}
/*
* Shamelessly stolen from qml-box2d project at gitorious
*
* https://gitorious.org/qml-box2d/qml-box2d
*/
void Box2DBaseItem::synchronize()
{
if (m_synchronize && m_initialized) {
m_synchronizing = true;
const QPointF newPoint = b2Util::qTopLeft(b2TransformOrigin(), boundingRect(), m_scaleRatio);
const float32 angle = b2Angle();
const qreal newRotation = -(angle * 360.0) / (2 * b2_pi);
if (!qFuzzyCompare(x(), newPoint.x()) || !qFuzzyCompare(y(), newPoint.y()))
setPos(newPoint);
if (!qFuzzyCompare(rotation(), newRotation))
setRotation(newRotation);
m_synchronizing = false;
}
}
## Instruction:
Use helper function to get the new rotation
## Code After:
float Box2DBaseItem::m_scaleRatio = 32.0f;
Box2DBaseItem::Box2DBaseItem(GameScene *parent )
: GameItem(parent)
, m_initialized(false)
, m_synchronizing(false)
, m_synchronize(true)
{
}
bool Box2DBaseItem::initialized() const
{
return m_initialized;
}
/*
* Shamelessly stolen from qml-box2d project at gitorious
*
* https://gitorious.org/qml-box2d/qml-box2d
*/
void Box2DBaseItem::synchronize()
{
if (m_synchronize && m_initialized) {
m_synchronizing = true;
const QPointF newPoint = b2Util::qTopLeft(b2TransformOrigin(), boundingRect(), m_scaleRatio);
const qreal newRotation = b2Util::qAngle(b2Angle());
if (!qFuzzyCompare(x(), newPoint.x()) || !qFuzzyCompare(y(), newPoint.y()))
setPos(newPoint);
if (!qFuzzyCompare(rotation(), newRotation))
setRotation(newRotation);
m_synchronizing = false;
}
}
|
89a800b0bfb582aafd0b6c2fd9a859e5111ebd24 | README.md | README.md | fish
====
Fish functions and configs
### Installation
```shell
git clone https://github.com/gustavowt/fish ~/.config/fish
```
### Alias
```shell
alias rake='bundle exec rake'
alias spec='bundle exec spec'
alias rspec='bundle exec rspec'
alias brails='bundle exec rails'
alias rtest='env SPEC=true ruby -Itest'
```
| fish
====
Fish functions and configs
### Installation
```shell
git clone https://github.com/gustavowt/fish ~/.config/fish
```
### Alias
#### Rails
```shell
alias rake='bundle exec rake'
alias spec='bundle exec spec'
alias rspec='bundle exec rspec'
alias brails='bundle exec rails'
alias rtest='env SPEC=true ruby -Itest'
```
#### SHELL
```shell
alias clear_drive='rm -rf .fseventsd ._.Trashes .Trashes .Spotlight-V100'
```
| Add shell section and rails title | Add shell section and rails title
| Markdown | mit | gustavowt/fish,gustavowt/fish | markdown | ## Code Before:
fish
====
Fish functions and configs
### Installation
```shell
git clone https://github.com/gustavowt/fish ~/.config/fish
```
### Alias
```shell
alias rake='bundle exec rake'
alias spec='bundle exec spec'
alias rspec='bundle exec rspec'
alias brails='bundle exec rails'
alias rtest='env SPEC=true ruby -Itest'
```
## Instruction:
Add shell section and rails title
## Code After:
fish
====
Fish functions and configs
### Installation
```shell
git clone https://github.com/gustavowt/fish ~/.config/fish
```
### Alias
#### Rails
```shell
alias rake='bundle exec rake'
alias spec='bundle exec spec'
alias rspec='bundle exec rspec'
alias brails='bundle exec rails'
alias rtest='env SPEC=true ruby -Itest'
```
#### SHELL
```shell
alias clear_drive='rm -rf .fseventsd ._.Trashes .Trashes .Spotlight-V100'
```
|
4089b913035698bf23bd8d876144b0f0fe826b60 | src/modules/articles/components/extensions/MediaExtension.tsx | src/modules/articles/components/extensions/MediaExtension.tsx | import * as React from 'react';
import { IExtensionProps } from './extensions';
import { ArticleMedia } from '../ArticleMedia';
interface IParsedProps {
mediumIds: string[]
}
export const MediaExtension: React.FunctionComponent<IExtensionProps> = ({ props, article }) => {
const parsedProps = props as IParsedProps;
//makes a copy so media filtering doesn't affect other components
article = Object.assign({}, article);
if (parsedProps.mediumIds && article.media) {
article.media = article.media.filter(m => parsedProps.mediumIds.indexOf(m.id) >= 0);
return <ArticleMedia article={article} media={article.media} />
}
else return null;
} | import * as React from 'react';
import { IExtensionProps } from './extensions';
import { ArticleMedia } from '../ArticleMedia';
interface IParsedProps {
mediumIds: string[]
}
export const MediaExtension: React.FunctionComponent<IExtensionProps> = ({ props, article }) => {
const parsedProps = props as IParsedProps;
//makes a copy so media filtering doesn't affect other components
article = {...article};
if (parsedProps.mediumIds && parsedProps.mediumIds.filter && article.media) {
//Set used in case many media present to avoid quadratic complexity.
const selectedMedia = new Set(parsedProps.mediumIds);
article.media = article.media.filter(m => selectedMedia.has(m.id));
return <ArticleMedia article={article} media={article.media} />
}
else return null;
} | Use set for filtering media. | Use set for filtering media.
| TypeScript | mit | stuyspec/client-app | typescript | ## Code Before:
import * as React from 'react';
import { IExtensionProps } from './extensions';
import { ArticleMedia } from '../ArticleMedia';
interface IParsedProps {
mediumIds: string[]
}
export const MediaExtension: React.FunctionComponent<IExtensionProps> = ({ props, article }) => {
const parsedProps = props as IParsedProps;
//makes a copy so media filtering doesn't affect other components
article = Object.assign({}, article);
if (parsedProps.mediumIds && article.media) {
article.media = article.media.filter(m => parsedProps.mediumIds.indexOf(m.id) >= 0);
return <ArticleMedia article={article} media={article.media} />
}
else return null;
}
## Instruction:
Use set for filtering media.
## Code After:
import * as React from 'react';
import { IExtensionProps } from './extensions';
import { ArticleMedia } from '../ArticleMedia';
interface IParsedProps {
mediumIds: string[]
}
export const MediaExtension: React.FunctionComponent<IExtensionProps> = ({ props, article }) => {
const parsedProps = props as IParsedProps;
//makes a copy so media filtering doesn't affect other components
article = {...article};
if (parsedProps.mediumIds && parsedProps.mediumIds.filter && article.media) {
//Set used in case many media present to avoid quadratic complexity.
const selectedMedia = new Set(parsedProps.mediumIds);
article.media = article.media.filter(m => selectedMedia.has(m.id));
return <ArticleMedia article={article} media={article.media} />
}
else return null;
} |
03d53d7265e2f1a708d7e560f6a2d0e1a5fa0b6b | app/controllers/static.go | app/controllers/static.go | package controllers
import (
"github.com/julienschmidt/httprouter"
"github.com/raggaer/castro/app/util"
"net/http"
)
func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Get extension identifier
id := ps.ByName("id")
// Check if static file exists
dir, exists := util.ExtensionStatic.FileExists(id)
if !exists {
w.WriteHeader(404)
return
}
// Open desired file
f, err := dir.Open(ps.ByName("filepath"))
if err != nil {
w.WriteHeader(404)
return
}
// Close file handle
defer f.Close()
// Get file information
fi, err := f.Stat()
if err != nil {
w.WriteHeader(404)
return
}
// Check if file is directory
if fi.IsDir() {
w.WriteHeader(404)
return
}
// Serve file
http.ServeContent(w, req, ps.ByName("filepath"), fi.ModTime(), f)
}
| package controllers
import (
"github.com/julienschmidt/httprouter"
"github.com/raggaer/castro/app/util"
"net/http"
)
func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Get extension identifier
id := ps.ByName("id")
// Check if static file exists
dir, exists := util.ExtensionStatic.FileExists(id)
if !exists {
w.WriteHeader(404)
return
}
// Open desired file
f, err := dir.Open(ps.ByName("filepath"))
if err != nil {
w.WriteHeader(404)
return
}
// Close file handle
defer f.Close()
// Get file information
fi, err := f.Stat()
if err != nil {
w.WriteHeader(404)
return
}
// Check if file is directory
if fi.IsDir() {
w.WriteHeader(404)
return
}
// Serve file
http.ServeContent(w, req, fi.Name(), fi.ModTime(), f)
}
| Use proper filename for http.ServeContent | Use proper filename for http.ServeContent
| Go | mit | Raggaer/castro,Raggaer/castro,Raggaer/castro | go | ## Code Before:
package controllers
import (
"github.com/julienschmidt/httprouter"
"github.com/raggaer/castro/app/util"
"net/http"
)
func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Get extension identifier
id := ps.ByName("id")
// Check if static file exists
dir, exists := util.ExtensionStatic.FileExists(id)
if !exists {
w.WriteHeader(404)
return
}
// Open desired file
f, err := dir.Open(ps.ByName("filepath"))
if err != nil {
w.WriteHeader(404)
return
}
// Close file handle
defer f.Close()
// Get file information
fi, err := f.Stat()
if err != nil {
w.WriteHeader(404)
return
}
// Check if file is directory
if fi.IsDir() {
w.WriteHeader(404)
return
}
// Serve file
http.ServeContent(w, req, ps.ByName("filepath"), fi.ModTime(), f)
}
## Instruction:
Use proper filename for http.ServeContent
## Code After:
package controllers
import (
"github.com/julienschmidt/httprouter"
"github.com/raggaer/castro/app/util"
"net/http"
)
func ExtensionStatic(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
// Get extension identifier
id := ps.ByName("id")
// Check if static file exists
dir, exists := util.ExtensionStatic.FileExists(id)
if !exists {
w.WriteHeader(404)
return
}
// Open desired file
f, err := dir.Open(ps.ByName("filepath"))
if err != nil {
w.WriteHeader(404)
return
}
// Close file handle
defer f.Close()
// Get file information
fi, err := f.Stat()
if err != nil {
w.WriteHeader(404)
return
}
// Check if file is directory
if fi.IsDir() {
w.WriteHeader(404)
return
}
// Serve file
http.ServeContent(w, req, fi.Name(), fi.ModTime(), f)
}
|
38f243aac7f6f53d38deb54d919b229783ee9dfd | tech/it/ai/computer-vision.md | tech/it/ai/computer-vision.md |
In 2D, using distances from 3 different known points to allocate an
unknown point.
- Let the distances be d1, d2, d3
- Draw 3 circles with the centers at the three known points, and the
radii are d1, d2, d3 appropriately.
- These three circle will meet at the unknown point.
## Triangulation
In 2D, using 2 known angles and a known baseline to calculate the
distance to an unknown point.
- Looking at ee16a final summary in Notability
# Epipolar geometry
- Essential matrix (E): is a metric object pertaining to **calibrated** camera.
- Fundamental matrix (F): more general and fundamental terms of projective geometry
- Relationship between E and F: E = (K')^TFK
+ K' and K are intrinsic calibration matrices of the two images involved.
|
In 2D, using distances from 3 different known points to allocate an
unknown point.
- Let the distances be d1, d2, d3
- Draw 3 circles with the centers at the three known points, and the
radii are d1, d2, d3 appropriately.
- These three circle will meet at the unknown point.
## Triangulation
In 2D, using 2 known angles and a known baseline to calculate the
distance to an unknown point.
- Looking at ee16a final summary in Notability
- Looking at ee127 hw4 question 1
# Epipolar geometry
- Essential matrix (E): is a metric object pertaining to **calibrated** camera.
- Fundamental matrix (F): more general and fundamental terms of projective geometry
- Relationship between E and F: E = (K')^TFK
+ K' and K are intrinsic calibration matrices of the two images involved.
| Add ee127 hw4 question 1 for triangulation | Add ee127 hw4 question 1 for triangulation
| Markdown | mit | samtron1412/docs | markdown | ## Code Before:
In 2D, using distances from 3 different known points to allocate an
unknown point.
- Let the distances be d1, d2, d3
- Draw 3 circles with the centers at the three known points, and the
radii are d1, d2, d3 appropriately.
- These three circle will meet at the unknown point.
## Triangulation
In 2D, using 2 known angles and a known baseline to calculate the
distance to an unknown point.
- Looking at ee16a final summary in Notability
# Epipolar geometry
- Essential matrix (E): is a metric object pertaining to **calibrated** camera.
- Fundamental matrix (F): more general and fundamental terms of projective geometry
- Relationship between E and F: E = (K')^TFK
+ K' and K are intrinsic calibration matrices of the two images involved.
## Instruction:
Add ee127 hw4 question 1 for triangulation
## Code After:
In 2D, using distances from 3 different known points to allocate an
unknown point.
- Let the distances be d1, d2, d3
- Draw 3 circles with the centers at the three known points, and the
radii are d1, d2, d3 appropriately.
- These three circle will meet at the unknown point.
## Triangulation
In 2D, using 2 known angles and a known baseline to calculate the
distance to an unknown point.
- Looking at ee16a final summary in Notability
- Looking at ee127 hw4 question 1
# Epipolar geometry
- Essential matrix (E): is a metric object pertaining to **calibrated** camera.
- Fundamental matrix (F): more general and fundamental terms of projective geometry
- Relationship between E and F: E = (K')^TFK
+ K' and K are intrinsic calibration matrices of the two images involved.
|
14b04b085f0688c37580b7622ef36b062e4d0bcf | app/routes/ember-cli.js | app/routes/ember-cli.js | import Route from '@ember/routing/route';
export default Route.extend({
titleToken() {
return 'Ember CLI';
}
});
| import Route from '@ember/routing/route';
export default Route.extend({
title() {
return 'Ember CLI - Ember API Documentation';
}
});
| Update to return the title Function | Update to return the title Function | JavaScript | mit | ember-learn/ember-api-docs,ember-learn/ember-api-docs | javascript | ## Code Before:
import Route from '@ember/routing/route';
export default Route.extend({
titleToken() {
return 'Ember CLI';
}
});
## Instruction:
Update to return the title Function
## Code After:
import Route from '@ember/routing/route';
export default Route.extend({
title() {
return 'Ember CLI - Ember API Documentation';
}
});
|
735b05cf0afe8aff15925202b65834d9d81e6498 | Settings/Controls/Control.h | Settings/Controls/Control.h |
class Control {
public:
Control();
Control(int id, HWND parent);
~Control();
RECT Dimensions();
void Enable();
void Disable();
bool Enabled();
void Enabled(bool enabled);
std::wstring Text();
int TextAsInt();
bool Text(std::wstring text);
bool Text(int value);
void WindowExStyle();
void WindowExStyle(long exStyle);
void AddWindowExStyle(long exStyle);
void RemoveWindowExStyle(long exStyle);
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
virtual DLGPROC Command(unsigned short nCode);
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr);
protected:
int _id;
HWND _hWnd;
HWND _parent;
protected:
static const int MAX_EDITSTR = 0x4000;
}; |
class Control {
public:
Control();
Control(int id, HWND parent);
~Control();
virtual RECT Dimensions();
virtual void Enable();
virtual void Disable();
virtual bool Enabled();
virtual void Enabled(bool enabled);
virtual std::wstring Text();
virtual int TextAsInt();
virtual bool Text(std::wstring text);
virtual bool Text(int value);
void WindowExStyle();
void WindowExStyle(long exStyle);
void AddWindowExStyle(long exStyle);
void RemoveWindowExStyle(long exStyle);
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
virtual DLGPROC Command(unsigned short nCode);
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr);
protected:
int _id;
HWND _hWnd;
HWND _parent;
protected:
static const int MAX_EDITSTR = 0x4000;
}; | Allow some control methods to be overridden | Allow some control methods to be overridden
| C | bsd-2-clause | malensek/3RVX,Soulflare3/3RVX,Soulflare3/3RVX,malensek/3RVX,Soulflare3/3RVX,malensek/3RVX | c | ## Code Before:
class Control {
public:
Control();
Control(int id, HWND parent);
~Control();
RECT Dimensions();
void Enable();
void Disable();
bool Enabled();
void Enabled(bool enabled);
std::wstring Text();
int TextAsInt();
bool Text(std::wstring text);
bool Text(int value);
void WindowExStyle();
void WindowExStyle(long exStyle);
void AddWindowExStyle(long exStyle);
void RemoveWindowExStyle(long exStyle);
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
virtual DLGPROC Command(unsigned short nCode);
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr);
protected:
int _id;
HWND _hWnd;
HWND _parent;
protected:
static const int MAX_EDITSTR = 0x4000;
};
## Instruction:
Allow some control methods to be overridden
## Code After:
class Control {
public:
Control();
Control(int id, HWND parent);
~Control();
virtual RECT Dimensions();
virtual void Enable();
virtual void Disable();
virtual bool Enabled();
virtual void Enabled(bool enabled);
virtual std::wstring Text();
virtual int TextAsInt();
virtual bool Text(std::wstring text);
virtual bool Text(int value);
void WindowExStyle();
void WindowExStyle(long exStyle);
void AddWindowExStyle(long exStyle);
void RemoveWindowExStyle(long exStyle);
/// <summary>Handles WM_COMMAND messages.</summary>
/// <param name="nCode">Control-defined notification code</param>
virtual DLGPROC Command(unsigned short nCode);
/// <summary>Handles WM_NOTIFY messages.</summary>
/// <param name="nHdr">Notification header structure</param>
virtual DLGPROC Notification(NMHDR *nHdr);
protected:
int _id;
HWND _hWnd;
HWND _parent;
protected:
static const int MAX_EDITSTR = 0x4000;
}; |
849be203e3aa5edcfbff7520ee6b1a1529126963 | wcfsetup/install/files/acp/templates/__pageAddContent.tpl | wcfsetup/install/files/acp/templates/__pageAddContent.tpl | <textarea name="content[{@$languageID}]" id="content{@$languageID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $pageType == 'text'}
{capture assign='wysiwygSelector'}content{@$languageID}{/capture}
{include file='wysiwyg' wysiwygSelector=$wysiwygSelector}
{elseif $pageType == 'html'}
{capture assign='codemirrorSelector'}#content{@$languageID}{/capture}
{include file='codemirror' codemirrorMode='htmlmixed' codemirrorSelector=$codemirrorSelector}
{elseif $pageType == 'tpl'}
{capture assign='codemirrorSelector'}#content{@$languageID}{/capture}
{include file='codemirror' codemirrorMode='smartymixed' codemirrorSelector=$codemirrorSelector}
{/if} | <textarea name="content[{@$languageID}]" id="content{@$languageID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $pageType == 'text'}
{include file='wysiwyg' wysiwygSelector='content'|concat:$languageID}
{elseif $pageType == 'html'}
{include file='codemirror' codemirrorMode='htmlmixed' codemirrorSelector='#content'|concat:$languageID}
{elseif $pageType == 'tpl'}
{include file='codemirror' codemirrorMode='smartymixed' codemirrorSelector='#content'|concat:$languageID}
{/if}
| Use of `concat` instead of `{capture}` | Use of `concat` instead of `{capture}`
| Smarty | lgpl-2.1 | 0xLeon/WCF,WoltLab/WCF,0xLeon/WCF,joshuaruesweg/WCF,Morik/WCF,Morik/WCF,WoltLab/WCF,MenesesEvandro/WCF,0xLeon/WCF,WoltLab/WCF,Cyperghost/WCF,SoftCreatR/WCF,Cyperghost/WCF,MenesesEvandro/WCF,Cyperghost/WCF,SoftCreatR/WCF,Morik/WCF,Cyperghost/WCF,WoltLab/WCF,Morik/WCF,Cyperghost/WCF,joshuaruesweg/WCF,joshuaruesweg/WCF,SoftCreatR/WCF,SoftCreatR/WCF | smarty | ## Code Before:
<textarea name="content[{@$languageID}]" id="content{@$languageID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $pageType == 'text'}
{capture assign='wysiwygSelector'}content{@$languageID}{/capture}
{include file='wysiwyg' wysiwygSelector=$wysiwygSelector}
{elseif $pageType == 'html'}
{capture assign='codemirrorSelector'}#content{@$languageID}{/capture}
{include file='codemirror' codemirrorMode='htmlmixed' codemirrorSelector=$codemirrorSelector}
{elseif $pageType == 'tpl'}
{capture assign='codemirrorSelector'}#content{@$languageID}{/capture}
{include file='codemirror' codemirrorMode='smartymixed' codemirrorSelector=$codemirrorSelector}
{/if}
## Instruction:
Use of `concat` instead of `{capture}`
## Code After:
<textarea name="content[{@$languageID}]" id="content{@$languageID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $pageType == 'text'}
{include file='wysiwyg' wysiwygSelector='content'|concat:$languageID}
{elseif $pageType == 'html'}
{include file='codemirror' codemirrorMode='htmlmixed' codemirrorSelector='#content'|concat:$languageID}
{elseif $pageType == 'tpl'}
{include file='codemirror' codemirrorMode='smartymixed' codemirrorSelector='#content'|concat:$languageID}
{/if}
|
a77c26556aa015cc2ec8038cbd82bb6f938d3236 | app/models/resource.rb | app/models/resource.rb | class Resource < ApplicationRecord
belongs_to :user
has_many :resource_languages
has_many :languages, through: :resource_languages
has_many :resource_tags
has_many :tags, through: :resource_tags
has_many :comments
validates :title, presence: true
validates :url, presence: true
validates :url, uniqueness: true
scope :by_language, -> {includes(:language).order("languages.name ASC")}
scope :favorited, -> {where(favorited: true)}
accepts_nested_attributes_for :tags
def user_name
self.user.username
end
def language_name
self.language.name
end
def add_user(current_user)
self.user = current_user
end
def topics_attributes=(topics_attributes)
topics_attributes.values.each do |topic_attribute|
self.topics.find_or_initialize_by(topic_attribute) if topic_attribute[:name].present?
end
end
end
| class Resource < ApplicationRecord
belongs_to :user
has_many :resource_languages
has_many :languages, through: :resource_languages
has_many :resource_tags
has_many :tags, through: :resource_tags
has_many :comments
validates :title, presence: true
validates :url, presence: true
validates :url, uniqueness: true
scope :by_language, -> {includes(:language).order("languages.name ASC")}
scope :favorited, -> {where(favorited: true)}
accepts_nested_attributes_for :tags
accepts_nested_attributes_for :languages
def user_name
self.user.username
end
def language_name
self.language.name
end
def add_user(current_user)
self.user = current_user
end
def topics_attributes=(topics_attributes)
topics_attributes.values.each do |topic_attribute|
self.topics.find_or_initialize_by(topic_attribute) if topic_attribute[:name].present?
end
end
end
| Allow nested attributes for languages in Resource model. | Allow nested attributes for languages in Resource model.
| Ruby | mit | abonner1/code_learning_resources_manager,abonner1/sorter,abonner1/code_learning_resources_manager,abonner1/sorter,abonner1/sorter,abonner1/code_learning_resources_manager | ruby | ## Code Before:
class Resource < ApplicationRecord
belongs_to :user
has_many :resource_languages
has_many :languages, through: :resource_languages
has_many :resource_tags
has_many :tags, through: :resource_tags
has_many :comments
validates :title, presence: true
validates :url, presence: true
validates :url, uniqueness: true
scope :by_language, -> {includes(:language).order("languages.name ASC")}
scope :favorited, -> {where(favorited: true)}
accepts_nested_attributes_for :tags
def user_name
self.user.username
end
def language_name
self.language.name
end
def add_user(current_user)
self.user = current_user
end
def topics_attributes=(topics_attributes)
topics_attributes.values.each do |topic_attribute|
self.topics.find_or_initialize_by(topic_attribute) if topic_attribute[:name].present?
end
end
end
## Instruction:
Allow nested attributes for languages in Resource model.
## Code After:
class Resource < ApplicationRecord
belongs_to :user
has_many :resource_languages
has_many :languages, through: :resource_languages
has_many :resource_tags
has_many :tags, through: :resource_tags
has_many :comments
validates :title, presence: true
validates :url, presence: true
validates :url, uniqueness: true
scope :by_language, -> {includes(:language).order("languages.name ASC")}
scope :favorited, -> {where(favorited: true)}
accepts_nested_attributes_for :tags
accepts_nested_attributes_for :languages
def user_name
self.user.username
end
def language_name
self.language.name
end
def add_user(current_user)
self.user = current_user
end
def topics_attributes=(topics_attributes)
topics_attributes.values.each do |topic_attribute|
self.topics.find_or_initialize_by(topic_attribute) if topic_attribute[:name].present?
end
end
end
|
67a140cb6d4ad6452c72e1fb4c9996652f39e50f | lib/puppet/reports/scribe.rb | lib/puppet/reports/scribe.rb | require 'puppet'
require 'puppet/reportallthethings/scribe_reporter'
Puppet::Reports.register_report(:scribe) do
def process
scribe = Puppet::ReportAllTheThings::ScribeReporter.new
scribe.log(generate)
end
def generate
JSON.pretty_generate(self.report_all_the_things)
end
end
| require 'puppet'
require 'puppet/reportallthethings/scribe_reporter'
Puppet::Reports.register_report(:scribe) do
def process
scribe = Puppet::ReportAllTheThings::ScribeReporter.new
scribe.log(generate)
end
def generate
JSON.pretty_generate(Puppet::ReportAllTheThings::Helper.report_all_the_things(self))
end
end
| Update to use new method | Update to use new method
| Ruby | apache-2.0 | danzilio/puppet-scribe_reporter | ruby | ## Code Before:
require 'puppet'
require 'puppet/reportallthethings/scribe_reporter'
Puppet::Reports.register_report(:scribe) do
def process
scribe = Puppet::ReportAllTheThings::ScribeReporter.new
scribe.log(generate)
end
def generate
JSON.pretty_generate(self.report_all_the_things)
end
end
## Instruction:
Update to use new method
## Code After:
require 'puppet'
require 'puppet/reportallthethings/scribe_reporter'
Puppet::Reports.register_report(:scribe) do
def process
scribe = Puppet::ReportAllTheThings::ScribeReporter.new
scribe.log(generate)
end
def generate
JSON.pretty_generate(Puppet::ReportAllTheThings::Helper.report_all_the_things(self))
end
end
|
de8dc5afa701557f33148ac3839cb15f6a881571 | cmake/VorbisConfig.cmake.in | cmake/VorbisConfig.cmake.in | @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Ogg REQUIRED)
include(${CMAKE_CURRENT_LIST_DIR}/vorbis-targets.cmake)
set(Vorbis_Vorbis_FOUND 1)
set(Vorbis_Enc_FOUND 0)
set(Vorbis_File_FOUND 0)
if(TARGET Vorbis::vorbisenc)
set(Vorbis_Enc_FOUND TRUE)
endif()
if(TARGET Vorbis::vorbisfile)
set(Vorbis_File_FOUND TRUE)
endif()
check_required_components(Vorbis)
| @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Ogg REQUIRED)
include(${CMAKE_CURRENT_LIST_DIR}/VorbisTargets.cmake)
set(Vorbis_Vorbis_FOUND 1)
set(Vorbis_Enc_FOUND 0)
set(Vorbis_File_FOUND 0)
if(TARGET Vorbis::vorbisenc)
set(Vorbis_Enc_FOUND TRUE)
endif()
if(TARGET Vorbis::vorbisfile)
set(Vorbis_File_FOUND TRUE)
endif()
check_required_components(Vorbis Enc File)
| Fix CMake config-file package generation | Fix CMake config-file package generation
| unknown | bsd-3-clause | ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis,ShiftMediaProject/vorbis | unknown | ## Code Before:
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Ogg REQUIRED)
include(${CMAKE_CURRENT_LIST_DIR}/vorbis-targets.cmake)
set(Vorbis_Vorbis_FOUND 1)
set(Vorbis_Enc_FOUND 0)
set(Vorbis_File_FOUND 0)
if(TARGET Vorbis::vorbisenc)
set(Vorbis_Enc_FOUND TRUE)
endif()
if(TARGET Vorbis::vorbisfile)
set(Vorbis_File_FOUND TRUE)
endif()
check_required_components(Vorbis)
## Instruction:
Fix CMake config-file package generation
## Code After:
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Ogg REQUIRED)
include(${CMAKE_CURRENT_LIST_DIR}/VorbisTargets.cmake)
set(Vorbis_Vorbis_FOUND 1)
set(Vorbis_Enc_FOUND 0)
set(Vorbis_File_FOUND 0)
if(TARGET Vorbis::vorbisenc)
set(Vorbis_Enc_FOUND TRUE)
endif()
if(TARGET Vorbis::vorbisfile)
set(Vorbis_File_FOUND TRUE)
endif()
check_required_components(Vorbis Enc File)
|
268df4ffa1f25f603a8faf59627a4fc1a79e69dd | Jappy.activity/Makefile | Jappy.activity/Makefile | library:
rapydscript compile -b lib/jappy.pyj > lib/baselib.js
| library:
rapydscript compile -b lib/jappy.pyj > lib/baselib.js
tags:
cat code_editor.tag.html | riot --stdin --config js/riot.config.js --stdout > js/codeeditor.js
cat toolbar.tag.html | riot --stdin --config js/riot.config.js --stdout > js/toolbar.js
| Add riot compile command to Makefile. | Add riot compile command to Makefile.
| unknown | agpl-3.0 | somosazucar/Jappy,somosazucar/Jappy,somosazucar/Jappy | unknown | ## Code Before:
library:
rapydscript compile -b lib/jappy.pyj > lib/baselib.js
## Instruction:
Add riot compile command to Makefile.
## Code After:
library:
rapydscript compile -b lib/jappy.pyj > lib/baselib.js
tags:
cat code_editor.tag.html | riot --stdin --config js/riot.config.js --stdout > js/codeeditor.js
cat toolbar.tag.html | riot --stdin --config js/riot.config.js --stdout > js/toolbar.js
|
2d1bd23a872645053b8e19bdf8b656b8ca872c4b | index.js | index.js | require('babel/register');
require('dotenv').load();
var startServer = require('./app');
var port = process.env['PORT'] || 3000;
startServer(port);
| require('babel/register');
if (process.env.NODE_ENV !== 'production') {
require('dotenv').load();
}
var startServer = require('./app');
var port = process.env.PORT || 3000;
startServer(port);
| Handle case where dotenv is not included in production. | Handle case where dotenv is not included in production.
| JavaScript | mit | keokilee/hitraffic-api,hitraffic/api-server | javascript | ## Code Before:
require('babel/register');
require('dotenv').load();
var startServer = require('./app');
var port = process.env['PORT'] || 3000;
startServer(port);
## Instruction:
Handle case where dotenv is not included in production.
## Code After:
require('babel/register');
if (process.env.NODE_ENV !== 'production') {
require('dotenv').load();
}
var startServer = require('./app');
var port = process.env.PORT || 3000;
startServer(port);
|
49f15bf17ce82a431edd15521a148b883e0144e7 | Changelog.md | Changelog.md | - Adds Deals
- Adds Forms
- Adds Groups
- Adds Users
- Adds Tracks
- Adds Campaigns
# 0.1.10
- Added tagging of lists and contacts
- Internally: Upgraded gems and RSpec syntax
- Internally: Added rubocop
| - Allow ActiveCampaign::Client.new to accept a Hash
# 0.1.11
- Adds Deals
- Adds Forms
- Adds Groups
- Adds Users
- Adds Tracks
- Adds Campaigns
# 0.1.10
- Added tagging of lists and contacts
- Internally: Upgraded gems and RSpec syntax
- Internally: Added rubocop
| Add changelog for previous release [no ci] | Add changelog for previous release [no ci]
| Markdown | mit | jonesmac/active_campaign,mhenrixon/active_campaign,mhenrixon/active_campaign | markdown | ## Code Before:
- Adds Deals
- Adds Forms
- Adds Groups
- Adds Users
- Adds Tracks
- Adds Campaigns
# 0.1.10
- Added tagging of lists and contacts
- Internally: Upgraded gems and RSpec syntax
- Internally: Added rubocop
## Instruction:
Add changelog for previous release [no ci]
## Code After:
- Allow ActiveCampaign::Client.new to accept a Hash
# 0.1.11
- Adds Deals
- Adds Forms
- Adds Groups
- Adds Users
- Adds Tracks
- Adds Campaigns
# 0.1.10
- Added tagging of lists and contacts
- Internally: Upgraded gems and RSpec syntax
- Internally: Added rubocop
|
cc76b7658a62528137f14733731b6b3f3a541384 | booster_bdd/features/steps/stackAnalyses.py | booster_bdd/features/steps/stackAnalyses.py | from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not
@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):
global sa
sa = StackAnalyses()
spaceName = helpers.getSpaceName()
codebaseUrl = sa.getCodebaseUrl()
stackAnalysesKey = sa.getReportKey(codebaseUrl)
helpers.setStackReportKey(stackAnalysesKey)
stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")
@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
spaceName = helpers.getSpaceName()
stackAnalysesKey = helpers.getStackReportKey()
reportText = sa.getStackReport(stackAnalysesKey)
reportText | should_not.be_none().desc("Obtained Stack Analyses Report")
| from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not
@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):
sa = StackAnalyses()
spaceName = helpers.getSpaceName()
codebaseUrl = sa.getCodebaseUrl()
stackAnalysesKey = sa.getReportKey(codebaseUrl)
helpers.setStackReportKey(stackAnalysesKey)
stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")
context.sa = sa
@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
spaceName = helpers.getSpaceName()
stackAnalysesKey = helpers.getStackReportKey()
reportText = context.sa.getStackReport(stackAnalysesKey)
reportText | should_not.be_none().desc("Obtained Stack Analyses Report")
| Store stack analysis in the context | Store stack analysis in the context
| Python | apache-2.0 | ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test | python | ## Code Before:
from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not
@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):
global sa
sa = StackAnalyses()
spaceName = helpers.getSpaceName()
codebaseUrl = sa.getCodebaseUrl()
stackAnalysesKey = sa.getReportKey(codebaseUrl)
helpers.setStackReportKey(stackAnalysesKey)
stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")
@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
spaceName = helpers.getSpaceName()
stackAnalysesKey = helpers.getStackReportKey()
reportText = sa.getStackReport(stackAnalysesKey)
reportText | should_not.be_none().desc("Obtained Stack Analyses Report")
## Instruction:
Store stack analysis in the context
## Code After:
from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not
@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):
sa = StackAnalyses()
spaceName = helpers.getSpaceName()
codebaseUrl = sa.getCodebaseUrl()
stackAnalysesKey = sa.getReportKey(codebaseUrl)
helpers.setStackReportKey(stackAnalysesKey)
stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")
context.sa = sa
@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
spaceName = helpers.getSpaceName()
stackAnalysesKey = helpers.getStackReportKey()
reportText = context.sa.getStackReport(stackAnalysesKey)
reportText | should_not.be_none().desc("Obtained Stack Analyses Report")
|
18f76ae20eaeeec485729888e2534e583a0ff9b5 | templates/CRM/Defaultdashlets/Form/DefaultDashlets.tpl | templates/CRM/Defaultdashlets/Form/DefaultDashlets.tpl | {* HEADER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
{foreach from=$groups item=group}
<h3>{$group.name}</h3>
{foreach from=$avalabledashlets item=avalabledashlet}
<input type="checkbox" value="1" name="defaultdashlets[{$group.id}][{$avalabledashlet.id}]" {if !empty($defaultdashlets[$group.id][$avalabledashlet.id])}checked{/if}> {$avalabledashlet.label}
{/foreach}
<br>
{/foreach}
{* FOOTER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
| {* HEADER *}
<div id="help">
Select the active dashlets for new users of each group. Groups must have <strong>Group Type</strong> set to <strong>Access Control</strong>. This activates dashlets for newly created users only. It will not alter existing users.
</div>
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
{foreach from=$groups item=group}
<h3>{$group.name}</h3>
{foreach from=$avalabledashlets item=avalabledashlet}
<input type="checkbox" value="1" name="defaultdashlets[{$group.id}][{$avalabledashlet.id}]" {if !empty($defaultdashlets[$group.id][$avalabledashlet.id])}checked{/if}> {$avalabledashlet.label}
{/foreach}
<br>
{/foreach}
{* FOOTER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
| Add help text to form | Add help text to form
| Smarty | agpl-3.0 | davidjosephhayes/CiviCRM-Default-Dashlets | smarty | ## Code Before:
{* HEADER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
{foreach from=$groups item=group}
<h3>{$group.name}</h3>
{foreach from=$avalabledashlets item=avalabledashlet}
<input type="checkbox" value="1" name="defaultdashlets[{$group.id}][{$avalabledashlet.id}]" {if !empty($defaultdashlets[$group.id][$avalabledashlet.id])}checked{/if}> {$avalabledashlet.label}
{/foreach}
<br>
{/foreach}
{* FOOTER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
## Instruction:
Add help text to form
## Code After:
{* HEADER *}
<div id="help">
Select the active dashlets for new users of each group. Groups must have <strong>Group Type</strong> set to <strong>Access Control</strong>. This activates dashlets for newly created users only. It will not alter existing users.
</div>
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
{foreach from=$groups item=group}
<h3>{$group.name}</h3>
{foreach from=$avalabledashlets item=avalabledashlet}
<input type="checkbox" value="1" name="defaultdashlets[{$group.id}][{$avalabledashlet.id}]" {if !empty($defaultdashlets[$group.id][$avalabledashlet.id])}checked{/if}> {$avalabledashlet.label}
{/foreach}
<br>
{/foreach}
{* FOOTER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
|
86840f62adc215fb481a28af61734ad16087719a | Resources/views/Test/index.html.twig | Resources/views/Test/index.html.twig | {% extends "::base.html.twig" %}
{% block body %}
{{ form(form) }}
{% endblock %} | {% extends "::base.html.twig" %}
{% block body %}
<h1>Extra Form Render</h1>
{{ form(form) }}
{% endblock %}
| Add a title for index view | Add a title for index view
| Twig | mit | IDCI-Consulting/ExtraFormBundle,IDCI-Consulting/ExtraFormBundle | twig | ## Code Before:
{% extends "::base.html.twig" %}
{% block body %}
{{ form(form) }}
{% endblock %}
## Instruction:
Add a title for index view
## Code After:
{% extends "::base.html.twig" %}
{% block body %}
<h1>Extra Form Render</h1>
{{ form(form) }}
{% endblock %}
|
df69791d2c9618076729fab010faf01802d816ec | src/api/images.js | src/api/images.js | import { Router } from 'express';
const router = new Router();
router.post("/", function (request, response) {
response.sendStatus(200);
});
| import { Router } from 'express';
const router = new Router();
router.post("/", function (request, response) {
response.sendStatus(200);
});
export default router;
| Add a missing export statement | Add a missing export statement
| JavaScript | mit | magnusbae/arcadian-rutabaga,magnusbae/arcadian-rutabaga | javascript | ## Code Before:
import { Router } from 'express';
const router = new Router();
router.post("/", function (request, response) {
response.sendStatus(200);
});
## Instruction:
Add a missing export statement
## Code After:
import { Router } from 'express';
const router = new Router();
router.post("/", function (request, response) {
response.sendStatus(200);
});
export default router;
|
8a202e489d34ad04dddfdc37d77e3dadcf34c12c | config.xml | config.xml | <?xml version="1.0" encoding="utf-8"?>
<widget id="io.cordova.hellocordova"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<!-- Global preferences -->
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="portrait" />
<!-- Android + iOS -->
<preference name="WebViewBounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- iOS -->
<preference name="BackupWebStorage" value="local" />
</widget>
| <?xml version="1.0" encoding="utf-8"?>
<widget id="io.cordova.hellocordova"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<!-- Global preferences -->
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="portrait" />
<!-- Android + iOS -->
<preference name="WebViewBounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- iOS -->
<preference name="BackupWebStorage" value="local" />
<!-- Android - Awesome: http://goo.gl/KYZQnx -->
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="16" />
</widget>
| Add some possibly not working stuff, meant to set Android version | Add some possibly not working stuff, meant to set Android version
| XML | mit | BrunoCartier/agenda-larochelle-app,BrunoCartier/agenda-larochelle-app | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<widget id="io.cordova.hellocordova"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<!-- Global preferences -->
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="portrait" />
<!-- Android + iOS -->
<preference name="WebViewBounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- iOS -->
<preference name="BackupWebStorage" value="local" />
</widget>
## Instruction:
Add some possibly not working stuff, meant to set Android version
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<widget id="io.cordova.hellocordova"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<!-- Global preferences -->
<preference name="Fullscreen" value="false" />
<preference name="Orientation" value="portrait" />
<!-- Android + iOS -->
<preference name="WebViewBounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- iOS -->
<preference name="BackupWebStorage" value="local" />
<!-- Android - Awesome: http://goo.gl/KYZQnx -->
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="16" />
</widget>
|
c08f3c55acf7568628725e94c8deb2547f54f97b | app/controllers/api/docs/branches.rb | app/controllers/api/docs/branches.rb | module Api
module Docs
class Branches
# :nocov:
include Swagger::Blocks
swagger_path '/branches' do
operation :get do
key :description, 'Return list of all Branches'
key :operationId, 'indexBranches'
key :tags, ['branches']
end
end
swagger_path '/branches/{id}' do
operation :get do
key :description, 'Return branch information'
key :operationId, 'findBranchById'
key :tags, ['branches']
parameter do
key :name, :id
key :in, :path
key :description, 'Branch ID. e.g. "1" for Sisyphus.'
key :required, true
key :type, :integer
key :format, :int64
end
end
end
# :nocov:
end
end
end
| module Api
module Docs
class Branches
# :nocov:
include Swagger::Blocks
swagger_schema :Branch do
key :required, [:id, :name, :order_id, :path, :created_at,
:updated_at, :count]
property :id do
key :type, :integer
key :format, :int64
key :description, 'Branch ID. e.g. "1" for "Sisyphus"'
end
property :name do
key :type, :string
key :description, 'Branch name. e.g. "Sisyphus"'
end
property :order_id do
key :type, :integer
key :format, :int64
key :description, 'Branch sort order id'
end
property :path do
key :type, :string
key :description, 'Branch path'
end
property :created_at do
key :type, :string
key :format, :'date-time'
key :description, 'Created at in ISO8601 format'
end
property :updated_at do
key :type, :string
key :format, :'date-time'
key :description, 'Updated at in ISO8601 format'
end
property :count do
key :type, :integer
key :format, :int64
key :description, 'Branch srpms count'
end
end
swagger_path '/branches' do
operation :get do
key :description, 'Return list of all Branches'
key :operationId, 'indexBranches'
key :tags, ['branches']
end
end
swagger_path '/branches/{id}' do
operation :get do
key :description, 'Return branch information'
key :operationId, 'findBranchById'
key :tags, ['branches']
parameter do
key :name, :id
key :in, :path
key :description, 'Branch ID. e.g. "1" for Sisyphus.'
key :required, true
key :type, :integer
key :format, :int64
end
end
end
# :nocov:
end
end
end
| Add swagger schema for Branch | Add swagger schema for Branch
| Ruby | mit | biow0lf/prometheus2.0,biow0lf/prometheus2.0,biow0lf/prometheus2.0,biow0lf/prometheus2.0 | ruby | ## Code Before:
module Api
module Docs
class Branches
# :nocov:
include Swagger::Blocks
swagger_path '/branches' do
operation :get do
key :description, 'Return list of all Branches'
key :operationId, 'indexBranches'
key :tags, ['branches']
end
end
swagger_path '/branches/{id}' do
operation :get do
key :description, 'Return branch information'
key :operationId, 'findBranchById'
key :tags, ['branches']
parameter do
key :name, :id
key :in, :path
key :description, 'Branch ID. e.g. "1" for Sisyphus.'
key :required, true
key :type, :integer
key :format, :int64
end
end
end
# :nocov:
end
end
end
## Instruction:
Add swagger schema for Branch
## Code After:
module Api
module Docs
class Branches
# :nocov:
include Swagger::Blocks
swagger_schema :Branch do
key :required, [:id, :name, :order_id, :path, :created_at,
:updated_at, :count]
property :id do
key :type, :integer
key :format, :int64
key :description, 'Branch ID. e.g. "1" for "Sisyphus"'
end
property :name do
key :type, :string
key :description, 'Branch name. e.g. "Sisyphus"'
end
property :order_id do
key :type, :integer
key :format, :int64
key :description, 'Branch sort order id'
end
property :path do
key :type, :string
key :description, 'Branch path'
end
property :created_at do
key :type, :string
key :format, :'date-time'
key :description, 'Created at in ISO8601 format'
end
property :updated_at do
key :type, :string
key :format, :'date-time'
key :description, 'Updated at in ISO8601 format'
end
property :count do
key :type, :integer
key :format, :int64
key :description, 'Branch srpms count'
end
end
swagger_path '/branches' do
operation :get do
key :description, 'Return list of all Branches'
key :operationId, 'indexBranches'
key :tags, ['branches']
end
end
swagger_path '/branches/{id}' do
operation :get do
key :description, 'Return branch information'
key :operationId, 'findBranchById'
key :tags, ['branches']
parameter do
key :name, :id
key :in, :path
key :description, 'Branch ID. e.g. "1" for Sisyphus.'
key :required, true
key :type, :integer
key :format, :int64
end
end
end
# :nocov:
end
end
end
|
660c5129375a60ac47e4caea0f876e7930d2ecad | community/modules/scripts/spack-install/scripts/install_spack_deps.yml | community/modules/scripts/spack-install/scripts/install_spack_deps.yml |
---
- name: Install dependencies for spack installation
hosts: localhost
tasks:
- name: Install pip3 and git
package:
name:
- python3-pip
- git
- name: Install google cloud storage
pip:
name: google-cloud-storage
executable: pip3
|
---
- name: Install dependencies for spack installation
become: yes
hosts: localhost
tasks:
- name: Install pip3 and git
ansible.builtin.package:
name:
- python3-pip
- git
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Install protobuf for old releases of Python
when: ansible_facts.packages["python3"][0].version is version("3.7", "<") and ansible_facts.packages["python3"][0].version is version("3.5", ">=")
ansible.builtin.pip:
name: protobuf
version: 3.19.4
executable: pip3
- name: Install google cloud storage
ansible.builtin.pip:
name: google-cloud-storage
executable: pip3
| Install compatible protobuf for older Python | Install compatible protobuf for older Python
The protobuf library is heavily used by other Google Cloud libraries.
We can use the Ansible fact for the Python 3 package version to ensure
that we are installing a compatible release of protobuf on systems
with out-of-date Python (e.g. CentOS 7 and the "HPC VM Image").
Resolves #368
| YAML | apache-2.0 | GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit,GoogleCloudPlatform/hpc-toolkit | yaml | ## Code Before:
---
- name: Install dependencies for spack installation
hosts: localhost
tasks:
- name: Install pip3 and git
package:
name:
- python3-pip
- git
- name: Install google cloud storage
pip:
name: google-cloud-storage
executable: pip3
## Instruction:
Install compatible protobuf for older Python
The protobuf library is heavily used by other Google Cloud libraries.
We can use the Ansible fact for the Python 3 package version to ensure
that we are installing a compatible release of protobuf on systems
with out-of-date Python (e.g. CentOS 7 and the "HPC VM Image").
Resolves #368
## Code After:
---
- name: Install dependencies for spack installation
become: yes
hosts: localhost
tasks:
- name: Install pip3 and git
ansible.builtin.package:
name:
- python3-pip
- git
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- name: Install protobuf for old releases of Python
when: ansible_facts.packages["python3"][0].version is version("3.7", "<") and ansible_facts.packages["python3"][0].version is version("3.5", ">=")
ansible.builtin.pip:
name: protobuf
version: 3.19.4
executable: pip3
- name: Install google cloud storage
ansible.builtin.pip:
name: google-cloud-storage
executable: pip3
|
638397d35dfe8d762ef5223b6de999b2cbcf868f | test/caesium/magicnonce/secretbox_test.clj | test/caesium/magicnonce/secretbox_test.clj | (ns caesium.magicnonce.secretbox-test
(:require [caesium.magicnonce.secretbox :as ms]
[caesium.crypto.secretbox :as s]
[caesium.crypto.secretbox-test :as st]
[clojure.test :refer [deftest is]]
[caesium.util :as u]))
(deftest xor-test
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])
out (byte-array [0 0 0])]
(is (identical? (#'ms/xor! out one two) out))
(is (u/array-eq (byte-array [1 1 1]) out)))
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])]
(is (identical? (#'ms/xor-inplace! one two) one))
(is (u/array-eq (byte-array [1 1 1]) one))))
(deftest secretbox-pfx-test
(let [nonce (byte-array (range s/noncebytes))
ctext (ms/secretbox-pfx st/ptext nonce st/secret-key)]
(is (= (+ s/noncebytes
(alength ^bytes st/ptext)
s/macbytes)
(alength ^bytes ctext)))))
| (ns caesium.magicnonce.secretbox-test
(:require [caesium.magicnonce.secretbox :as ms]
[caesium.crypto.secretbox :as s]
[caesium.crypto.secretbox-test :as st]
[clojure.test :refer [deftest is]]
[caesium.util :as u]))
(deftest xor-test
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])
out (byte-array [0 0 0])]
(is (identical? (#'ms/xor! out one two) out))
(is (u/array-eq (byte-array [1 1 1]) out)))
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])]
(is (identical? (#'ms/xor-inplace! one two) one))
(is (u/array-eq (byte-array [1 1 1]) one))))
(deftest secretbox-pfx-test
(let [nonce (byte-array (range s/noncebytes))
ctext (ms/secretbox-pfx st/ptext nonce st/secret-key)]
(is (= (+ s/noncebytes
(alength ^bytes st/ptext)
s/macbytes)
(alength ^bytes ctext)))
(is (= (range s/noncebytes)
(take s/noncebytes ctext)))))
| Test what the nonce is | Test what the nonce is
| Clojure | epl-1.0 | lvh/caesium | clojure | ## Code Before:
(ns caesium.magicnonce.secretbox-test
(:require [caesium.magicnonce.secretbox :as ms]
[caesium.crypto.secretbox :as s]
[caesium.crypto.secretbox-test :as st]
[clojure.test :refer [deftest is]]
[caesium.util :as u]))
(deftest xor-test
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])
out (byte-array [0 0 0])]
(is (identical? (#'ms/xor! out one two) out))
(is (u/array-eq (byte-array [1 1 1]) out)))
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])]
(is (identical? (#'ms/xor-inplace! one two) one))
(is (u/array-eq (byte-array [1 1 1]) one))))
(deftest secretbox-pfx-test
(let [nonce (byte-array (range s/noncebytes))
ctext (ms/secretbox-pfx st/ptext nonce st/secret-key)]
(is (= (+ s/noncebytes
(alength ^bytes st/ptext)
s/macbytes)
(alength ^bytes ctext)))))
## Instruction:
Test what the nonce is
## Code After:
(ns caesium.magicnonce.secretbox-test
(:require [caesium.magicnonce.secretbox :as ms]
[caesium.crypto.secretbox :as s]
[caesium.crypto.secretbox-test :as st]
[clojure.test :refer [deftest is]]
[caesium.util :as u]))
(deftest xor-test
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])
out (byte-array [0 0 0])]
(is (identical? (#'ms/xor! out one two) out))
(is (u/array-eq (byte-array [1 1 1]) out)))
(let [one (byte-array [1 0 1])
two (byte-array [0 1 0])]
(is (identical? (#'ms/xor-inplace! one two) one))
(is (u/array-eq (byte-array [1 1 1]) one))))
(deftest secretbox-pfx-test
(let [nonce (byte-array (range s/noncebytes))
ctext (ms/secretbox-pfx st/ptext nonce st/secret-key)]
(is (= (+ s/noncebytes
(alength ^bytes st/ptext)
s/macbytes)
(alength ^bytes ctext)))
(is (= (range s/noncebytes)
(take s/noncebytes ctext)))))
|
6269904bc9d5919d065c6d9077764ed01e01247e | .travis.yml | .travis.yml | language: php
php:
- 5.4
- 5.5
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --dev
before_install:
- sudo apt-get install -qq php5-gd
- sudo apt-get install -qq php5-imagick
- sudo apt-get install -qq libgraphicsmagick1-dev
- printf "\n" | pecl install -f gmagick-1.1.7RC2
script: phpunit -c tests/
| language: php
php:
- 5.4
- 5.5
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --dev
before_install:
- sudo apt-get install -qq php5-gd
- sudo apt-get install -qq imagemagick
- sudo apt-get install -qq php5-imagick
- sudo apt-get install -qq libgraphicsmagick1-dev
- printf "\n" | pecl install -f gmagick-1.1.7RC2
script: phpunit -c tests/
| Build failing; guess need to install Imagick | Build failing; guess need to install Imagick
| YAML | mit | bitheater/dummy-image | yaml | ## Code Before:
language: php
php:
- 5.4
- 5.5
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --dev
before_install:
- sudo apt-get install -qq php5-gd
- sudo apt-get install -qq php5-imagick
- sudo apt-get install -qq libgraphicsmagick1-dev
- printf "\n" | pecl install -f gmagick-1.1.7RC2
script: phpunit -c tests/
## Instruction:
Build failing; guess need to install Imagick
## Code After:
language: php
php:
- 5.4
- 5.5
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --dev
before_install:
- sudo apt-get install -qq php5-gd
- sudo apt-get install -qq imagemagick
- sudo apt-get install -qq php5-imagick
- sudo apt-get install -qq libgraphicsmagick1-dev
- printf "\n" | pecl install -f gmagick-1.1.7RC2
script: phpunit -c tests/
|
6f2992539c6e0b1391c4b6e2e8a0957b6a07cd79 | spec/workers/inbound_mail_processor_spec.rb | spec/workers/inbound_mail_processor_spec.rb | require "spec_helper"
describe InboundMailProcessor do
subject { InboundMailProcessor }
it "should be on the inbound mail queue" do
subject.queue.should == :inbound_mail
end
it "should respond to perform" do
subject.should respond_to(:perform)
end
context "thread reply mail" do
let(:thread) { FactoryGirl.create(:message_thread) }
let(:email_recipient) { "thread-#{thread.public_token}@cyclescape.org" }
let(:inbound_mail) { FactoryGirl.create(:inbound_mail, to: email_recipient) }
before do
subject.perform(inbound_mail.id)
end
it "should create a new message on the thread" do
thread.should have(1).message
end
it "should have the same text as the email" do
thread.messages.first.body.should == inbound_mail.message.body.to_s
end
it "should have be created by a new user with the email address" do
thread.messages.first.created_by.email.should == inbound_mail.message.from.first
end
end
end
| require "spec_helper"
describe InboundMailProcessor do
subject { InboundMailProcessor }
it "should be on the inbound mail queue" do
subject.queue.should == :inbound_mail
end
it "should respond to perform" do
subject.should respond_to(:perform)
end
context "thread reply mail" do
let(:thread) { FactoryGirl.create(:message_thread) }
let(:email_recipient) { "thread-#{thread.public_token}@cyclescape.org" }
let(:inbound_mail) { FactoryGirl.create(:inbound_mail, to: email_recipient) }
before do
subject.perform(inbound_mail.id)
end
it "should create a new message on the thread" do
thread.should have(1).message
end
it "should have the same text as the email" do
# There are weird newline issues here, each \r is duplicated in the model's response
thread.messages.first.body.gsub(/\n|\r/, '').should == inbound_mail.message.body.to_s.gsub(/\n|\r/, '')
end
it "should have be created by a new user with the email address" do
thread.messages.first.created_by.email.should == inbound_mail.message.from.first
end
end
end
| Patch test to workaround odd newline error in output, not worth debugging now. | Patch test to workaround odd newline error in output, not worth debugging now.
| Ruby | mit | cyclestreets/cyclescape,auto-mat/toolkit,auto-mat/toolkit,cyclestreets/cyclescape,cyclestreets/cyclescape | ruby | ## Code Before:
require "spec_helper"
describe InboundMailProcessor do
subject { InboundMailProcessor }
it "should be on the inbound mail queue" do
subject.queue.should == :inbound_mail
end
it "should respond to perform" do
subject.should respond_to(:perform)
end
context "thread reply mail" do
let(:thread) { FactoryGirl.create(:message_thread) }
let(:email_recipient) { "thread-#{thread.public_token}@cyclescape.org" }
let(:inbound_mail) { FactoryGirl.create(:inbound_mail, to: email_recipient) }
before do
subject.perform(inbound_mail.id)
end
it "should create a new message on the thread" do
thread.should have(1).message
end
it "should have the same text as the email" do
thread.messages.first.body.should == inbound_mail.message.body.to_s
end
it "should have be created by a new user with the email address" do
thread.messages.first.created_by.email.should == inbound_mail.message.from.first
end
end
end
## Instruction:
Patch test to workaround odd newline error in output, not worth debugging now.
## Code After:
require "spec_helper"
describe InboundMailProcessor do
subject { InboundMailProcessor }
it "should be on the inbound mail queue" do
subject.queue.should == :inbound_mail
end
it "should respond to perform" do
subject.should respond_to(:perform)
end
context "thread reply mail" do
let(:thread) { FactoryGirl.create(:message_thread) }
let(:email_recipient) { "thread-#{thread.public_token}@cyclescape.org" }
let(:inbound_mail) { FactoryGirl.create(:inbound_mail, to: email_recipient) }
before do
subject.perform(inbound_mail.id)
end
it "should create a new message on the thread" do
thread.should have(1).message
end
it "should have the same text as the email" do
# There are weird newline issues here, each \r is duplicated in the model's response
thread.messages.first.body.gsub(/\n|\r/, '').should == inbound_mail.message.body.to_s.gsub(/\n|\r/, '')
end
it "should have be created by a new user with the email address" do
thread.messages.first.created_by.email.should == inbound_mail.message.from.first
end
end
end
|
16f677095a4c73cfa056297cb3020e79fa16111b | README.md | README.md |
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
## Usage
var jsonpointer = require("jsonpointer");
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
var one = jsonpointer.get(obj, "/foo");
var two = jsonpointer.get(obj, "/bar/baz");
var three = jsonpointer.get(obj, "/qux/0");
var four = jsonpointer.get(obj, "/qux/1");
var five = jsonpointer.get(obj, "/qux/2");
var notfound = jsonpointer.get(obj, "/quo"); // returns null
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
## Testing
$ node test.js
All tests pass.
$
[](https://travis-ci.org/janl/node-jsonpointer)
## Author
(c) 2011 Jan Lehnardt <jan@apache.org>
## License
MIT License.
|
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
## Usage
var jsonpointer = require("jsonpointer");
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
var one = jsonpointer.get(obj, "/foo");
var two = jsonpointer.get(obj, "/bar/baz");
var three = jsonpointer.get(obj, "/qux/0");
var four = jsonpointer.get(obj, "/qux/1");
var five = jsonpointer.get(obj, "/qux/2");
var notfound = jsonpointer.get(obj, "/quo"); // returns null
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
## Testing
$ node test.js
All tests pass.
$
[](https://travis-ci.org/janl/node-jsonpointer)
## Author
(c) 2011-2015 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
## License
MIT License.
| Update copyright year, add Mark to authors | Update copyright year, add Mark to authors
| Markdown | mit | batfink/node-jsonpointer,janl/node-jsonpointer | markdown | ## Code Before:
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
## Usage
var jsonpointer = require("jsonpointer");
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
var one = jsonpointer.get(obj, "/foo");
var two = jsonpointer.get(obj, "/bar/baz");
var three = jsonpointer.get(obj, "/qux/0");
var four = jsonpointer.get(obj, "/qux/1");
var five = jsonpointer.get(obj, "/qux/2");
var notfound = jsonpointer.get(obj, "/quo"); // returns null
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
## Testing
$ node test.js
All tests pass.
$
[](https://travis-ci.org/janl/node-jsonpointer)
## Author
(c) 2011 Jan Lehnardt <jan@apache.org>
## License
MIT License.
## Instruction:
Update copyright year, add Mark to authors
## Code After:
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
## Usage
var jsonpointer = require("jsonpointer");
var obj = { foo: 1, bar: { baz: 2}, qux: [3, 4, 5]};
var one = jsonpointer.get(obj, "/foo");
var two = jsonpointer.get(obj, "/bar/baz");
var three = jsonpointer.get(obj, "/qux/0");
var four = jsonpointer.get(obj, "/qux/1");
var five = jsonpointer.get(obj, "/qux/2");
var notfound = jsonpointer.get(obj, "/quo"); // returns null
jsonpointer.set(obj, "/foo", 6); // obj.foo = 6;
## Testing
$ node test.js
All tests pass.
$
[](https://travis-ci.org/janl/node-jsonpointer)
## Author
(c) 2011-2015 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
## License
MIT License.
|
a3fb0390e5a60c94aab0bd43140bf6e1f3673489 | .travis.yml | .travis.yml | language: python
python: 2.7
sudo: false
cache: pip
install:
- pip install ansible
script:
- ansible-galaxy install --force -r requirements.yml -p vendor/roles
- ansible-playbook --syntax-check -i hosts/development dev.yml --ask-vault-pass < $ANSIBLE_VAULT_KEY
- ansible-playbook --syntax-check -i hosts/development server.yml --ask-vault-pass < $ANSIBLE_VAULT_KEY
| language: python
python: 2.7
sudo: false
cache: pip
install:
- pip install ansible
script:
- ansible-galaxy install --force -r requirements.yml -p vendor/roles
- ansible-playbook --syntax-check -i hosts/development dev.yml
- ansible-playbook --syntax-check -i hosts/development server.yml
| Revert "Trying to fix CI builds." | Revert "Trying to fix CI builds."
This reverts commit f47582bb798eb9327f864f74cf0b8b299ac6de2a.
| YAML | mit | proteusthemes/pt-ops,proteusthemes/pt-ops,proteusthemes/pt-ops | yaml | ## Code Before:
language: python
python: 2.7
sudo: false
cache: pip
install:
- pip install ansible
script:
- ansible-galaxy install --force -r requirements.yml -p vendor/roles
- ansible-playbook --syntax-check -i hosts/development dev.yml --ask-vault-pass < $ANSIBLE_VAULT_KEY
- ansible-playbook --syntax-check -i hosts/development server.yml --ask-vault-pass < $ANSIBLE_VAULT_KEY
## Instruction:
Revert "Trying to fix CI builds."
This reverts commit f47582bb798eb9327f864f74cf0b8b299ac6de2a.
## Code After:
language: python
python: 2.7
sudo: false
cache: pip
install:
- pip install ansible
script:
- ansible-galaxy install --force -r requirements.yml -p vendor/roles
- ansible-playbook --syntax-check -i hosts/development dev.yml
- ansible-playbook --syntax-check -i hosts/development server.yml
|
f89e9454e932dd22764fb497b3966262a260f138 | data/transition-sites/fera.yml | data/transition-sites/fera.yml | ---
site: fera
whitehall_slug: the-food-and-environment-research-agency
homepage: https://www.gov.uk/government/organisations/the-food-and-environment-research-agency
tna_timestamp: 20131103143441
host: www.fera.defra.gov.uk
homepage_furl: www.gov.uk/fera
aliases:
- fera.defra.gov.uk
options: --query-string id
extra_organisation_slugs:
- animal-and-plant-health-agency
| ---
site: fera
whitehall_slug: the-food-and-environment-research-agency
homepage: https://www.gov.uk/government/organisations/animal-and-plant-health-agency
tna_timestamp: 20131103143441
host: www.fera.defra.gov.uk
homepage_furl: www.gov.uk/apha
aliases:
- fera.defra.gov.uk
options: --query-string id
extra_organisation_slugs:
- animal-and-plant-health-agency
| Update FERA homepage to APHA | Update FERA homepage to APHA | YAML | mit | alphagov/transition-config,alphagov/transition-config | yaml | ## Code Before:
---
site: fera
whitehall_slug: the-food-and-environment-research-agency
homepage: https://www.gov.uk/government/organisations/the-food-and-environment-research-agency
tna_timestamp: 20131103143441
host: www.fera.defra.gov.uk
homepage_furl: www.gov.uk/fera
aliases:
- fera.defra.gov.uk
options: --query-string id
extra_organisation_slugs:
- animal-and-plant-health-agency
## Instruction:
Update FERA homepage to APHA
## Code After:
---
site: fera
whitehall_slug: the-food-and-environment-research-agency
homepage: https://www.gov.uk/government/organisations/animal-and-plant-health-agency
tna_timestamp: 20131103143441
host: www.fera.defra.gov.uk
homepage_furl: www.gov.uk/apha
aliases:
- fera.defra.gov.uk
options: --query-string id
extra_organisation_slugs:
- animal-and-plant-health-agency
|
e85e82ec6730a5a7b3729d3aa828e9e53f8a976c | docs/router.js | docs/router.js | /* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CONTRIBUTING.md';
Vue.use(Router);
const router = new Router({
routes: [
{
path: '/layouts/theming',
component: Theming,
},
{
path: '/',
component: Docs,
children: [
{
path: '/',
component: DocsPage,
props: { markdown: QuickStart },
},
{
path: '/contributing',
component: DocsPage,
props: { markdown: Contributing },
},
{
path: '/layouts',
component: Layouts,
},
{
path: '/:type/:componentName',
component: Component,
props: true,
},
],
},
],
linkExactActiveClass: 'active',
});
router.afterEach((to) => {
ga('set', 'page', to.path);
ga('send', 'pageview');
if (to.hash) {
const el = document.getElementById(to.hash.substr(1));
if (el) el.scrollIntoView();
}
});
export default router;
| /* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CONTRIBUTING.md';
Vue.use(Router);
const router = new Router({
routes: [
{
path: '/layouts/theming',
component: Theming,
},
{
path: '/',
component: Docs,
children: [
{
path: '/',
component: DocsPage,
props: { markdown: QuickStart },
},
{
path: '/contributing',
component: DocsPage,
props: { markdown: Contributing },
},
{
path: '/layouts',
component: Layouts,
},
{
path: '/:type/:componentName',
component: Component,
props: true,
},
],
},
],
linkExactActiveClass: 'active',
});
router.afterEach((to) => {
if (typeof ga === 'function') {
ga('set', 'page', to.path);
ga('send', 'pageview');
}
if (to.hash) {
const el = document.getElementById(to.hash.substr(1));
if (el) el.scrollIntoView();
}
});
export default router;
| Check if ga is a function | Check if ga is a function
| JavaScript | mit | Semantic-UI-Vue/Semantic-UI-Vue | javascript | ## Code Before:
/* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CONTRIBUTING.md';
Vue.use(Router);
const router = new Router({
routes: [
{
path: '/layouts/theming',
component: Theming,
},
{
path: '/',
component: Docs,
children: [
{
path: '/',
component: DocsPage,
props: { markdown: QuickStart },
},
{
path: '/contributing',
component: DocsPage,
props: { markdown: Contributing },
},
{
path: '/layouts',
component: Layouts,
},
{
path: '/:type/:componentName',
component: Component,
props: true,
},
],
},
],
linkExactActiveClass: 'active',
});
router.afterEach((to) => {
ga('set', 'page', to.path);
ga('send', 'pageview');
if (to.hash) {
const el = document.getElementById(to.hash.substr(1));
if (el) el.scrollIntoView();
}
});
export default router;
## Instruction:
Check if ga is a function
## Code After:
/* eslint-disable */
import Vue from 'vue';
import Router from 'vue-router';
import Component from './Component';
import Docs from './Docs';
import DocsPage from './DocsPage';
import Layouts from './Layouts';
import Theming from './Layouts/Theming';
import QuickStart from '../README.md';
import Contributing from '../CONTRIBUTING.md';
Vue.use(Router);
const router = new Router({
routes: [
{
path: '/layouts/theming',
component: Theming,
},
{
path: '/',
component: Docs,
children: [
{
path: '/',
component: DocsPage,
props: { markdown: QuickStart },
},
{
path: '/contributing',
component: DocsPage,
props: { markdown: Contributing },
},
{
path: '/layouts',
component: Layouts,
},
{
path: '/:type/:componentName',
component: Component,
props: true,
},
],
},
],
linkExactActiveClass: 'active',
});
router.afterEach((to) => {
if (typeof ga === 'function') {
ga('set', 'page', to.path);
ga('send', 'pageview');
}
if (to.hash) {
const el = document.getElementById(to.hash.substr(1));
if (el) el.scrollIntoView();
}
});
export default router;
|
d4fcd56ae6438e3b4645708b7c3c687456ef5aa2 | views/layouts/main.hbs | views/layouts/main.hbs | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CognacTime</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
</head>
<body>
<header>
<nav class="grey darken-4 grey-text text-lighten-1">
<div class="container">Navbar</div>
</nav>
</header>
<main class="container">
{{{body}}}
</main>
<footer></footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CognacTime</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<link rel="stylesheet" href="/static/css/cognactime.min.css">
</head>
<body>
<header>
<nav class="grey darken-4 grey-text text-lighten-1">
<div class="container">Navbar</div>
</nav>
</header>
<main class="container">
{{{body}}}
</main>
<footer></footer>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<script type="text/javascript" src="/static/js/cognactime.min.js"></script>
</body>
</html>
| Correct static files path and add jQuery (materialize dep) | Correct static files path and add jQuery (materialize dep)
| Handlebars | mit | myth/cognactime,myth/cognactime | handlebars | ## Code Before:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CognacTime</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
</head>
<body>
<header>
<nav class="grey darken-4 grey-text text-lighten-1">
<div class="container">Navbar</div>
</nav>
</header>
<main class="container">
{{{body}}}
</main>
<footer></footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
</body>
</html>
## Instruction:
Correct static files path and add jQuery (materialize dep)
## Code After:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CognacTime</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<link rel="stylesheet" href="/static/css/cognactime.min.css">
</head>
<body>
<header>
<nav class="grey darken-4 grey-text text-lighten-1">
<div class="container">Navbar</div>
</nav>
</header>
<main class="container">
{{{body}}}
</main>
<footer></footer>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<script type="text/javascript" src="/static/js/cognactime.min.js"></script>
</body>
</html>
|
c48be721085b0550724c4e234c081e421fcdfb75 | week-9/ruby/fibonacci.rb | week-9/ruby/fibonacci.rb |
def is_fibonacci?(num)
if num <= 9
true
elsif
end
end
# Refactored Solution
# Reflection |
def is_fibonacci?(num)
plus_four = Math.sqrt( (num * 5) ** 2 + 4)
minus_four = Math.sqrt( (num * 5) ** 2 - 4)
if plus_four.is_a?(Float) || minus_four.is_a?(Float)
return false
else
return true
end
end
# Refactored Solution
# Reflection | Add second trial to solution | Add second trial to solution
| Ruby | mit | Michael-Jas/phase-0,Michael-Jas/phase-0,Michael-Jas/phase-0 | ruby | ## Code Before:
def is_fibonacci?(num)
if num <= 9
true
elsif
end
end
# Refactored Solution
# Reflection
## Instruction:
Add second trial to solution
## Code After:
def is_fibonacci?(num)
plus_four = Math.sqrt( (num * 5) ** 2 + 4)
minus_four = Math.sqrt( (num * 5) ** 2 - 4)
if plus_four.is_a?(Float) || minus_four.is_a?(Float)
return false
else
return true
end
end
# Refactored Solution
# Reflection |
564d88a6d4fa4054e4eea865c6c34ed56dd6c361 | app/models/per_transcript_coverage.rb | app/models/per_transcript_coverage.rb | class PerTranscriptCoverage < ActiveRecord::Base
belongs_to :read_group, :inverse_of => :per_transcript_coverages
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages, :dependent => :destroy
validates_presence_of :read_group
validates_presence_of :bedgraph_file
end
| class PerTranscriptCoverage < ActiveRecord::Base
belongs_to :read_group, :inverse_of => :per_transcript_coverages
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages
validates_presence_of :read_group
validates_presence_of :bedgraph_file
end
| Fix bug which prevented deleting read group | Fix bug which prevented deleting read group
The bug was caused by extra ':dependent => :destroy' in
PerTranscriptCoverage model:
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages, :dependent => :destroy
Deleting read group caused deleting per_transcript_coverages, which
caused deleting bedgraph_file. This is incorrect, bc this
bedgraph_file could be associated with other existing read groups via
per_transcript_coverages.
Thanks to Brad for help with this and prev bugs that I introduced in
the last round of changes.
| Ruby | agpl-3.0 | nebiolabs/seq-results,nebiolabs/seq-results,nebiolabs/seq-results | ruby | ## Code Before:
class PerTranscriptCoverage < ActiveRecord::Base
belongs_to :read_group, :inverse_of => :per_transcript_coverages
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages, :dependent => :destroy
validates_presence_of :read_group
validates_presence_of :bedgraph_file
end
## Instruction:
Fix bug which prevented deleting read group
The bug was caused by extra ':dependent => :destroy' in
PerTranscriptCoverage model:
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages, :dependent => :destroy
Deleting read group caused deleting per_transcript_coverages, which
caused deleting bedgraph_file. This is incorrect, bc this
bedgraph_file could be associated with other existing read groups via
per_transcript_coverages.
Thanks to Brad for help with this and prev bugs that I introduced in
the last round of changes.
## Code After:
class PerTranscriptCoverage < ActiveRecord::Base
belongs_to :read_group, :inverse_of => :per_transcript_coverages
belongs_to :bedgraph_file, :inverse_of => :per_transcript_coverages
validates_presence_of :read_group
validates_presence_of :bedgraph_file
end
|
52541fa00111a6e857c614201c24c9bcf87920e4 | client/app/views/run.html | client/app/views/run.html | <div id="map"></div>
<div id='run' class="container">
<div class="botNav">
<a class="botLink left" href="#/" ng-click="stopGeoUpdater()"> Cancel </a>
<div class ="botLink" ng-click="startRun()" ng-show="!raceStarted"> Ready? </div>
<div class="botLink" ng-show="raceStarted"> Start! </div>
<div class="botLink right" ng-show="raceStarted"> {{ time }} <div>
</div>
</div>
| <div id="map"></div>
<div id='run' class="container">
<div class="botNav">
<a class="botLink left" href="#/" ng-click="stopGeoUpdater()"> Cancel </a>
<div class ="botLink start-race" ng-click="startRun()" ng-show="!raceStarted"> Ready? </div>
<div class="botLink" ng-show="raceStarted">G: {{ goldTime.format('mm:ss') }}, S: {{ silverTime.format('mm:ss') }}, B: {{ bronzeTime.format('mm:ss') }}</div>
<div class="botLink right" ng-show="raceStarted"> {{ timeUntilGold.format('mm:ss') }} <div>
</div>
</div>
| Add time until medal html/angular | Add time until medal html/angular
| HTML | mit | elliotaplant/Bolt,thomasRhoffmann/Bolt,boisterousSplash/Bolt,gm758/Bolt,thomasRhoffmann/Bolt,elliotaplant/Bolt,gm758/Bolt,boisterousSplash/Bolt | html | ## Code Before:
<div id="map"></div>
<div id='run' class="container">
<div class="botNav">
<a class="botLink left" href="#/" ng-click="stopGeoUpdater()"> Cancel </a>
<div class ="botLink" ng-click="startRun()" ng-show="!raceStarted"> Ready? </div>
<div class="botLink" ng-show="raceStarted"> Start! </div>
<div class="botLink right" ng-show="raceStarted"> {{ time }} <div>
</div>
</div>
## Instruction:
Add time until medal html/angular
## Code After:
<div id="map"></div>
<div id='run' class="container">
<div class="botNav">
<a class="botLink left" href="#/" ng-click="stopGeoUpdater()"> Cancel </a>
<div class ="botLink start-race" ng-click="startRun()" ng-show="!raceStarted"> Ready? </div>
<div class="botLink" ng-show="raceStarted">G: {{ goldTime.format('mm:ss') }}, S: {{ silverTime.format('mm:ss') }}, B: {{ bronzeTime.format('mm:ss') }}</div>
<div class="botLink right" ng-show="raceStarted"> {{ timeUntilGold.format('mm:ss') }} <div>
</div>
</div>
|
84c9b0a29e64ab99ce689c239da54aa538b24db4 | modules/interfaces/src/functional-group.ts | modules/interfaces/src/functional-group.ts | import { CustomCommandDefinition } from "./custom-command-definition";
import { CustomQueryDefinition } from "./custom-query-definition";
import { EntityDefinition } from "./entity-definition";
import { UserDefinition } from "./user-definition";
export type EntityDefinitions = {
[EntityName: string]: EntityDefinition;
};
export type CustomQueryDefinitions = {
[QueryName: string]: CustomQueryDefinition;
};
export type CustomCommandDefinitions = {
[CommandName: string]: CustomCommandDefinition;
};
export type UserDefinitions = {
[EntityName: string]: UserDefinition;
};
export type NormalizedFunctionalGroup = {
users: UserDefinitions;
nonUsers: EntityDefinitions;
customQueries: CustomQueryDefinitions;
customCommands: CustomCommandDefinitions;
};
export type FunctionalGroup = Partial<NormalizedFunctionalGroup>;
| import { CustomCommandDefinition } from "./custom-command-definition";
import { CustomQueryDefinition } from "./custom-query-definition";
import { EntityDefinition } from "./entity-definition";
import { UserDefinition } from "./user-definition";
import {
GeneralTypeMap,
UserEntityNameOf,
NonUserEntityNameOf,
CustomQueryNameOf,
CustomCommandNameOf
} from "./type-map";
export type EntityDefinitions = {
[EntityName: string]: EntityDefinition;
};
export type CustomQueryDefinitions = {
[QueryName: string]: CustomQueryDefinition;
};
export type CustomCommandDefinitions = {
[CommandName: string]: CustomCommandDefinition;
};
export type UserDefinitions = {
[EntityName: string]: UserDefinition;
};
export type GeneralNormalizedFunctionalGroup = {
users: UserDefinitions;
nonUsers: EntityDefinitions;
customQueries: CustomQueryDefinitions;
customCommands: CustomCommandDefinitions;
};
export interface NormalizedFunctionalGroup<TM extends GeneralTypeMap>
extends GeneralNormalizedFunctionalGroup {
users: { [AN in UserEntityNameOf<TM>]: UserDefinition };
nonUsers: { [EN in NonUserEntityNameOf<TM>]: EntityDefinition };
customQueries: { [QN in CustomQueryNameOf<TM>]: CustomQueryDefinition };
customCommands: { [CN in CustomCommandNameOf<TM>]: CustomCommandDefinition };
}
export type FunctionalGroup<TM extends GeneralTypeMap> = Partial<
NormalizedFunctionalGroup<TM>
>;
export type GeneralFunctionalGroup = Partial<GeneralNormalizedFunctionalGroup>;
| Make FunctionalGroup contain TypeMap type parameter | feat(interfaces): Make FunctionalGroup contain TypeMap type parameter
| TypeScript | apache-2.0 | phenyl-js/phenyl,phenyl-js/phenyl,phenyl-js/phenyl,phenyl-js/phenyl | typescript | ## Code Before:
import { CustomCommandDefinition } from "./custom-command-definition";
import { CustomQueryDefinition } from "./custom-query-definition";
import { EntityDefinition } from "./entity-definition";
import { UserDefinition } from "./user-definition";
export type EntityDefinitions = {
[EntityName: string]: EntityDefinition;
};
export type CustomQueryDefinitions = {
[QueryName: string]: CustomQueryDefinition;
};
export type CustomCommandDefinitions = {
[CommandName: string]: CustomCommandDefinition;
};
export type UserDefinitions = {
[EntityName: string]: UserDefinition;
};
export type NormalizedFunctionalGroup = {
users: UserDefinitions;
nonUsers: EntityDefinitions;
customQueries: CustomQueryDefinitions;
customCommands: CustomCommandDefinitions;
};
export type FunctionalGroup = Partial<NormalizedFunctionalGroup>;
## Instruction:
feat(interfaces): Make FunctionalGroup contain TypeMap type parameter
## Code After:
import { CustomCommandDefinition } from "./custom-command-definition";
import { CustomQueryDefinition } from "./custom-query-definition";
import { EntityDefinition } from "./entity-definition";
import { UserDefinition } from "./user-definition";
import {
GeneralTypeMap,
UserEntityNameOf,
NonUserEntityNameOf,
CustomQueryNameOf,
CustomCommandNameOf
} from "./type-map";
export type EntityDefinitions = {
[EntityName: string]: EntityDefinition;
};
export type CustomQueryDefinitions = {
[QueryName: string]: CustomQueryDefinition;
};
export type CustomCommandDefinitions = {
[CommandName: string]: CustomCommandDefinition;
};
export type UserDefinitions = {
[EntityName: string]: UserDefinition;
};
export type GeneralNormalizedFunctionalGroup = {
users: UserDefinitions;
nonUsers: EntityDefinitions;
customQueries: CustomQueryDefinitions;
customCommands: CustomCommandDefinitions;
};
export interface NormalizedFunctionalGroup<TM extends GeneralTypeMap>
extends GeneralNormalizedFunctionalGroup {
users: { [AN in UserEntityNameOf<TM>]: UserDefinition };
nonUsers: { [EN in NonUserEntityNameOf<TM>]: EntityDefinition };
customQueries: { [QN in CustomQueryNameOf<TM>]: CustomQueryDefinition };
customCommands: { [CN in CustomCommandNameOf<TM>]: CustomCommandDefinition };
}
export type FunctionalGroup<TM extends GeneralTypeMap> = Partial<
NormalizedFunctionalGroup<TM>
>;
export type GeneralFunctionalGroup = Partial<GeneralNormalizedFunctionalGroup>;
|
77138f52d63be6c58d94f5ba9e0928a12b15125b | vumi/application/__init__.py | vumi/application/__init__.py | """The vumi.application API."""
__all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager",
"MessageStore"]
from vumi.application.base import ApplicationWorker
from vumi.application.session import SessionManager
from vumi.application.tagpool import TagpoolManager
from vumi.application.message_store import MessageStore
| """The vumi.application API."""
__all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager",
"MessageStore", "HTTPRelayApplication"]
from vumi.application.base import ApplicationWorker
from vumi.application.session import SessionManager
from vumi.application.tagpool import TagpoolManager
from vumi.application.message_store import MessageStore
from vumi.application.http_relay import HTTPRelayApplication
| Add HTTPRelayApplication to vumi.application package API. | Add HTTPRelayApplication to vumi.application package API.
| Python | bsd-3-clause | harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi | python | ## Code Before:
"""The vumi.application API."""
__all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager",
"MessageStore"]
from vumi.application.base import ApplicationWorker
from vumi.application.session import SessionManager
from vumi.application.tagpool import TagpoolManager
from vumi.application.message_store import MessageStore
## Instruction:
Add HTTPRelayApplication to vumi.application package API.
## Code After:
"""The vumi.application API."""
__all__ = ["ApplicationWorker", "SessionManager", "TagpoolManager",
"MessageStore", "HTTPRelayApplication"]
from vumi.application.base import ApplicationWorker
from vumi.application.session import SessionManager
from vumi.application.tagpool import TagpoolManager
from vumi.application.message_store import MessageStore
from vumi.application.http_relay import HTTPRelayApplication
|
7c122559f5ff5a487e0b578fa7f7d526ddf790a8 | .github/workflows/main.yml | .github/workflows/main.yml | name: Update cache key
on:
push:
branches:
- release
pull_request:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout release
uses: actions/checkout@master
with:
ref: release
- name: Find and Replace
id: replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: "sha = '[^']*'"
replace: "sha = '${{ github.sha }}'"
- name: Check outputs and modified files
run: |
test "${{ steps.replace.outputs.modifiedFiles }}" == "1"
grep "sha" service-worker.js
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout release
git commit -m "[DEVOPS] Set CACHE_KEY" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: release
github_token: ${{ secrets.GITHUB_TOKEN }}
| name: Update cache key
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@master
with:
ref: master
- name: Find and Replace
id: replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: "sha = '[^']*'"
replace: "sha = '${{ github.sha }}'"
- name: Check outputs and modified files
run: |
test "${{ steps.replace.outputs.modifiedFiles }}" == "1"
grep "sha" service-worker.js
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout master
git commit -m "[DEVOPS] Set CACHE_KEY" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: master
github_token: ${{ secrets.GITHUB_TOKEN }}
| Fix GitHub Action to point to master branch | Fix GitHub Action to point to master branch
| YAML | mit | lalibi/aepp-presentation,lalibi/aepp-presentation,lalibi/aepp-presentation | yaml | ## Code Before:
name: Update cache key
on:
push:
branches:
- release
pull_request:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout release
uses: actions/checkout@master
with:
ref: release
- name: Find and Replace
id: replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: "sha = '[^']*'"
replace: "sha = '${{ github.sha }}'"
- name: Check outputs and modified files
run: |
test "${{ steps.replace.outputs.modifiedFiles }}" == "1"
grep "sha" service-worker.js
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout release
git commit -m "[DEVOPS] Set CACHE_KEY" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: release
github_token: ${{ secrets.GITHUB_TOKEN }}
## Instruction:
Fix GitHub Action to point to master branch
## Code After:
name: Update cache key
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@master
with:
ref: master
- name: Find and Replace
id: replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: "sha = '[^']*'"
replace: "sha = '${{ github.sha }}'"
- name: Check outputs and modified files
run: |
test "${{ steps.replace.outputs.modifiedFiles }}" == "1"
grep "sha" service-worker.js
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout master
git commit -m "[DEVOPS] Set CACHE_KEY" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: master
github_token: ${{ secrets.GITHUB_TOKEN }}
|
82217bab5263984c3507a68c1b94f9d315bafc63 | src/masterfile/__init__.py | src/masterfile/__init__.py |
from __future__ import absolute_import
from ._metadata import version as __version__, author as __author__, email as __email__
|
from __future__ import absolute_import
from ._metadata import version as __version__, author as __author__, email as __email__
__package_version__ = 'masterfile {}'.format(__version__)
| Add __package_version__ for version description | Add __package_version__ for version description
Example: "masterfile 0.1.0dev" | Python | mit | njvack/masterfile | python | ## Code Before:
from __future__ import absolute_import
from ._metadata import version as __version__, author as __author__, email as __email__
## Instruction:
Add __package_version__ for version description
Example: "masterfile 0.1.0dev"
## Code After:
from __future__ import absolute_import
from ._metadata import version as __version__, author as __author__, email as __email__
__package_version__ = 'masterfile {}'.format(__version__)
|
a288b6ae6ab8364c271e5eff8eb7a13a62c1decc | lib/aozorasearch/web/views/_search_form.haml | lib/aozorasearch/web/views/_search_form.haml | %form{action: url("/search", false, true), method: :get}
%input{type: "textarea", name: "word", size: 20, value: params[:word]}
- params.each do |key, value|
- next if key == "word"
%input{type: "hidden", name: key, value: value}
%input{type: "submit", value: "検索"}
%input{type: "checkbox", name: "reset_params", value: "1"} 絞り込み条件をリセット
| %form{action: url("/search", false, true), method: :get}
%input{type: "textarea", name: "word", size: 20, value: params[:word]}
- params.each do |key, value|
- next if key == "word"
%input{type: "hidden", name: key, value: value}
%input{type: "submit", value: "検索"}
- unless params_to_description.empty?
%input{type: "checkbox", name: "reset_params", value: "1"} 絞り込み条件をリセット
| Hide reset checkbox if not drilldowned | Hide reset checkbox if not drilldowned
| Haml | lgpl-2.1 | myokoym/aozorasearch,myokoym/aozorasearch | haml | ## Code Before:
%form{action: url("/search", false, true), method: :get}
%input{type: "textarea", name: "word", size: 20, value: params[:word]}
- params.each do |key, value|
- next if key == "word"
%input{type: "hidden", name: key, value: value}
%input{type: "submit", value: "検索"}
%input{type: "checkbox", name: "reset_params", value: "1"} 絞り込み条件をリセット
## Instruction:
Hide reset checkbox if not drilldowned
## Code After:
%form{action: url("/search", false, true), method: :get}
%input{type: "textarea", name: "word", size: 20, value: params[:word]}
- params.each do |key, value|
- next if key == "word"
%input{type: "hidden", name: key, value: value}
%input{type: "submit", value: "検索"}
- unless params_to_description.empty?
%input{type: "checkbox", name: "reset_params", value: "1"} 絞り込み条件をリセット
|
20df58bb9e605ecc53848ade31a3acb98118f00b | scripts/extract_clips_from_hdf5_file.py | scripts/extract_clips_from_hdf5_file.py | from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
if i == CLIP_COUNT:
break
samples, sample_rate = read_clip(clip_group, clip_id)
print(clip_id, len(samples), samples.dtype, sample_rate)
write_wave_file(clip_id, samples, sample_rate)
def read_clip(clip_group, clip_id):
clip = clip_group[clip_id]
samples = clip[:]
sample_rate = clip.attrs['sample_rate']
return samples, sample_rate
def write_wave_file(i, samples, sample_rate):
file_name = f'{i}.wav'
file_path = DIR_PATH / file_name
with wave.open(str(file_path), 'wb') as file_:
file_.setparams((1, 2, sample_rate, len(samples), 'NONE', ''))
file_.writeframes(samples.tobytes())
if __name__ == '__main__':
main()
| from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
if i == CLIP_COUNT:
break
samples, attributes = read_clip(clip_group, clip_id)
show_clip(clip_id, samples, attributes)
write_wave_file(clip_id, samples, attributes['sample_rate'])
def read_clip(clip_group, clip_id):
clip = clip_group[clip_id]
samples = clip[:]
attributes = dict((name, value) for name, value in clip.attrs.items())
return samples, attributes
def show_clip(clip_id, samples, attributes):
print(f'clip {clip_id}:')
print(f' length: {len(samples)}')
print(' attributes:')
for key in sorted(attributes.keys()):
value = attributes[key]
print(f' {key}: {value}')
print()
def write_wave_file(i, samples, sample_rate):
file_name = f'{i}.wav'
file_path = DIR_PATH / file_name
with wave.open(str(file_path), 'wb') as file_:
file_.setparams((1, 2, sample_rate, len(samples), 'NONE', ''))
file_.writeframes(samples.tobytes())
if __name__ == '__main__':
main()
| Add attribute display to clip extraction script. | Add attribute display to clip extraction script.
| Python | mit | HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper | python | ## Code Before:
from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
if i == CLIP_COUNT:
break
samples, sample_rate = read_clip(clip_group, clip_id)
print(clip_id, len(samples), samples.dtype, sample_rate)
write_wave_file(clip_id, samples, sample_rate)
def read_clip(clip_group, clip_id):
clip = clip_group[clip_id]
samples = clip[:]
sample_rate = clip.attrs['sample_rate']
return samples, sample_rate
def write_wave_file(i, samples, sample_rate):
file_name = f'{i}.wav'
file_path = DIR_PATH / file_name
with wave.open(str(file_path), 'wb') as file_:
file_.setparams((1, 2, sample_rate, len(samples), 'NONE', ''))
file_.writeframes(samples.tobytes())
if __name__ == '__main__':
main()
## Instruction:
Add attribute display to clip extraction script.
## Code After:
from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
if i == CLIP_COUNT:
break
samples, attributes = read_clip(clip_group, clip_id)
show_clip(clip_id, samples, attributes)
write_wave_file(clip_id, samples, attributes['sample_rate'])
def read_clip(clip_group, clip_id):
clip = clip_group[clip_id]
samples = clip[:]
attributes = dict((name, value) for name, value in clip.attrs.items())
return samples, attributes
def show_clip(clip_id, samples, attributes):
print(f'clip {clip_id}:')
print(f' length: {len(samples)}')
print(' attributes:')
for key in sorted(attributes.keys()):
value = attributes[key]
print(f' {key}: {value}')
print()
def write_wave_file(i, samples, sample_rate):
file_name = f'{i}.wav'
file_path = DIR_PATH / file_name
with wave.open(str(file_path), 'wb') as file_:
file_.setparams((1, 2, sample_rate, len(samples), 'NONE', ''))
file_.writeframes(samples.tobytes())
if __name__ == '__main__':
main()
|
b62415c19459d9e5819b82f464731b166157811d | gym/envs/tests/test_registration.py | gym/envs/tests/test_registration.py | from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPole-v0')
assert spec.id == 'CartPole-v0'
def test_missing_lookup():
registry = registration.EnvRegistry()
registry.register(id='Test-v0', entry_point=None)
registry.register(id='Test-v15', entry_point=None)
registry.register(id='Test-v9', entry_point=None)
registry.register(id='Other-v100', entry_point=None)
try:
registry.spec('Test-v1')
except error.UnregisteredEnv:
pass
else:
assert False
def test_malformed_lookup():
registry = registration.EnvRegistry()
try:
registry.spec(u'“Breakout-v0”')
except error.Error as e:
assert 'malformed environment ID' in e.message, 'Unexpected message: {}'.format(e)
else:
assert False
| from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPole-v0')
assert spec.id == 'CartPole-v0'
def test_missing_lookup():
registry = registration.EnvRegistry()
registry.register(id='Test-v0', entry_point=None)
registry.register(id='Test-v15', entry_point=None)
registry.register(id='Test-v9', entry_point=None)
registry.register(id='Other-v100', entry_point=None)
try:
registry.spec('Test-v1')
except error.UnregisteredEnv:
pass
else:
assert False
def test_malformed_lookup():
registry = registration.EnvRegistry()
try:
registry.spec(u'“Breakout-v0”')
except error.Error as e:
assert 'malformed environment ID' in '{}'.format(e), 'Unexpected message: {}'.format(e)
else:
assert False
| Fix exception message formatting in Python3 | Fix exception message formatting in Python3
| Python | mit | d1hotpep/openai_gym,machinaut/gym,machinaut/gym,d1hotpep/openai_gym,dianchen96/gym,Farama-Foundation/Gymnasium,dianchen96/gym,Farama-Foundation/Gymnasium | python | ## Code Before:
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPole-v0')
assert spec.id == 'CartPole-v0'
def test_missing_lookup():
registry = registration.EnvRegistry()
registry.register(id='Test-v0', entry_point=None)
registry.register(id='Test-v15', entry_point=None)
registry.register(id='Test-v9', entry_point=None)
registry.register(id='Other-v100', entry_point=None)
try:
registry.spec('Test-v1')
except error.UnregisteredEnv:
pass
else:
assert False
def test_malformed_lookup():
registry = registration.EnvRegistry()
try:
registry.spec(u'“Breakout-v0”')
except error.Error as e:
assert 'malformed environment ID' in e.message, 'Unexpected message: {}'.format(e)
else:
assert False
## Instruction:
Fix exception message formatting in Python3
## Code After:
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPole-v0')
assert spec.id == 'CartPole-v0'
def test_missing_lookup():
registry = registration.EnvRegistry()
registry.register(id='Test-v0', entry_point=None)
registry.register(id='Test-v15', entry_point=None)
registry.register(id='Test-v9', entry_point=None)
registry.register(id='Other-v100', entry_point=None)
try:
registry.spec('Test-v1')
except error.UnregisteredEnv:
pass
else:
assert False
def test_malformed_lookup():
registry = registration.EnvRegistry()
try:
registry.spec(u'“Breakout-v0”')
except error.Error as e:
assert 'malformed environment ID' in '{}'.format(e), 'Unexpected message: {}'.format(e)
else:
assert False
|
842b25d6c2440a5e128eb0ce6bc1b1e6746e0679 | .travis.yml | .travis.yml | language: php
php:
- "7.2"
- "7.1"
- "7.0"
- "5.6"
install:
- export SONARSCANNER_VERSION=3.2.0.1227
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- unzip sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- composer install
script:
- vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml
- sonar-scanner-$SONARSCANNER_VERSION-linux/bin/sonar-scanner -Dsonar.login=$SONAR_LOGIN
| language: php
php:
- "7.2"
- "7.1"
- "7.0"
- "5.6"
install:
- export SONARSCANNER_VERSION=3.2.0.1227
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- unzip sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- composer install
script:
- vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml
- sonar-scanner-$SONARSCANNER_VERSION-linux/bin/sonar-scanner -Dsonar.login=$SONAR_LOGIN -Dsonar.branch.name=$TRAVIS_BRANCH -Dsonar.branch.target=master
| Add the branch to the SonarScanner | Add the branch to the SonarScanner
| YAML | mit | byjg/SingletonPatternPHP | yaml | ## Code Before:
language: php
php:
- "7.2"
- "7.1"
- "7.0"
- "5.6"
install:
- export SONARSCANNER_VERSION=3.2.0.1227
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- unzip sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- composer install
script:
- vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml
- sonar-scanner-$SONARSCANNER_VERSION-linux/bin/sonar-scanner -Dsonar.login=$SONAR_LOGIN
## Instruction:
Add the branch to the SonarScanner
## Code After:
language: php
php:
- "7.2"
- "7.1"
- "7.0"
- "5.6"
install:
- export SONARSCANNER_VERSION=3.2.0.1227
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- unzip sonar-scanner-cli-$SONARSCANNER_VERSION-linux.zip
- composer install
script:
- vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml
- sonar-scanner-$SONARSCANNER_VERSION-linux/bin/sonar-scanner -Dsonar.login=$SONAR_LOGIN -Dsonar.branch.name=$TRAVIS_BRANCH -Dsonar.branch.target=master
|
6406ee8e3472adb0cf34b884abdef0b75dcdfda8 | components/03-components/pusher/pusher.config.yml | components/03-components/pusher/pusher.config.yml | notes: |
Push an element to the right if the space allows it, otherwise display it below.
status: wip
variants:
- name: middle
notes: Vertically align content in the middle.
context:
modifier: pusher--middle
- name: bottom
notes: Vertically align content to the bottom.
context:
modifier: pusher--bottom
- name: vertical
notes: >
Push an element to the bottom of its container. This requires the later height to be bigger than its content.
In this example, you can see a good combination with the `grid grid--even` component.
| notes: |
Push an element to the right if the space allows it, otherwise display it below.
variants:
- name: middle
notes: Vertically align content in the middle.
context:
modifier: pusher--middle
- name: bottom
notes: Vertically align content to the bottom.
context:
modifier: pusher--bottom
- name: vertical
notes: >
Push an element to the bottom of its container. This requires the later height to be bigger than its content.
In this example, you can see a good combination with the `grid grid--even` component.
| Move pusher component status to ready | Move pusher component status to ready
| YAML | mit | liip/kanbasu,liip/kanbasu | yaml | ## Code Before:
notes: |
Push an element to the right if the space allows it, otherwise display it below.
status: wip
variants:
- name: middle
notes: Vertically align content in the middle.
context:
modifier: pusher--middle
- name: bottom
notes: Vertically align content to the bottom.
context:
modifier: pusher--bottom
- name: vertical
notes: >
Push an element to the bottom of its container. This requires the later height to be bigger than its content.
In this example, you can see a good combination with the `grid grid--even` component.
## Instruction:
Move pusher component status to ready
## Code After:
notes: |
Push an element to the right if the space allows it, otherwise display it below.
variants:
- name: middle
notes: Vertically align content in the middle.
context:
modifier: pusher--middle
- name: bottom
notes: Vertically align content to the bottom.
context:
modifier: pusher--bottom
- name: vertical
notes: >
Push an element to the bottom of its container. This requires the later height to be bigger than its content.
In this example, you can see a good combination with the `grid grid--even` component.
|
e58688d87ba1c4af718ea3e427d94f68c3df3b16 | qipipe/interfaces/__init__.py | qipipe/interfaces/__init__.py | from .compress import Compress
from .copy import Copy
from .fix_dicom import FixDicom
from .group_dicom import GroupDicom
from .map_ctp import MapCTP
from .move import Move
from .glue import Glue
from .uncompress import Uncompress
from .xnat_upload import XNATUpload
from .xnat_download import XNATDownload
| from .compress import Compress
from .copy import Copy
from .fix_dicom import FixDicom
from .group_dicom import GroupDicom
from .map_ctp import MapCTP
from .move import Move
from .unpack import Unpack
from .uncompress import Uncompress
from .xnat_upload import XNATUpload
from .xnat_download import XNATDownload
from .fastfit import Fastfit
from .mri_volcluster import MriVolCluster
| Replace Glue interface by more restrictive Unpack. | Replace Glue interface by more restrictive Unpack.
| Python | bsd-2-clause | ohsu-qin/qipipe | python | ## Code Before:
from .compress import Compress
from .copy import Copy
from .fix_dicom import FixDicom
from .group_dicom import GroupDicom
from .map_ctp import MapCTP
from .move import Move
from .glue import Glue
from .uncompress import Uncompress
from .xnat_upload import XNATUpload
from .xnat_download import XNATDownload
## Instruction:
Replace Glue interface by more restrictive Unpack.
## Code After:
from .compress import Compress
from .copy import Copy
from .fix_dicom import FixDicom
from .group_dicom import GroupDicom
from .map_ctp import MapCTP
from .move import Move
from .unpack import Unpack
from .uncompress import Uncompress
from .xnat_upload import XNATUpload
from .xnat_download import XNATDownload
from .fastfit import Fastfit
from .mri_volcluster import MriVolCluster
|
ea548476e58136b4b300ae7916f0acb21f7f59fe | client/views/activities/new/newActivity.js | client/views/activities/new/newActivity.js | import 'select2';
import 'select2/dist/css/select2.css';
import 'select2-bootstrap-theme/dist/select2-bootstrap.css';
Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.newActivity.helpers({
select2Options () {
// Get placeholder text localization
const placeholderText = TAPi18n.__('newActivity-residentSelect-placeholder');
const options = {
closeOnSelect: false,
placeholder: placeholderText,
};
return options;
},
'today': function () {
// Default date today, as a string
return Date();
},
});
| import 'select2';
import 'select2/dist/css/select2.css';
Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.newActivity.helpers({
select2Options () {
// Get placeholder text localization
const placeholderText = TAPi18n.__('newActivity-residentSelect-placeholder');
const options = {
closeOnSelect: false,
placeholder: placeholderText,
};
return options;
},
'today': function () {
// Default date today, as a string
return Date();
},
});
| Remove style that was breaking deployment | Remove style that was breaking deployment
| JavaScript | agpl-3.0 | GeriLife/wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing | javascript | ## Code Before:
import 'select2';
import 'select2/dist/css/select2.css';
import 'select2-bootstrap-theme/dist/select2-bootstrap.css';
Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.newActivity.helpers({
select2Options () {
// Get placeholder text localization
const placeholderText = TAPi18n.__('newActivity-residentSelect-placeholder');
const options = {
closeOnSelect: false,
placeholder: placeholderText,
};
return options;
},
'today': function () {
// Default date today, as a string
return Date();
},
});
## Instruction:
Remove style that was breaking deployment
## Code After:
import 'select2';
import 'select2/dist/css/select2.css';
Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.newActivity.helpers({
select2Options () {
// Get placeholder text localization
const placeholderText = TAPi18n.__('newActivity-residentSelect-placeholder');
const options = {
closeOnSelect: false,
placeholder: placeholderText,
};
return options;
},
'today': function () {
// Default date today, as a string
return Date();
},
});
|
87f0a20fe145b2ac65ab7e6cbfbc90b4cd0c49c3 | src/main/java/vg/civcraft/mc/civmodcore/chatDialog/ChatListener.java | src/main/java/vg/civcraft/mc/civmodcore/chatDialog/ChatListener.java | package vg.civcraft.mc.civmodcore.chatDialog;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;
public class ChatListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void tabComplete(TabCompleteEvent e) {
if (!(e.getSender() instanceof Player)) {
return;
}
Dialog dia = DialogManager.getDialog((Player) e.getSender());
if (dia != null) {
String[] split = e.getBuffer().split(" ");
e.setCompletions(dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split));
}
}
@EventHandler
public void logoff(PlayerQuitEvent e) {
DialogManager.forceEndDialog(e.getPlayer());
}
}
| package vg.civcraft.mc.civmodcore.chatDialog;
import java.util.Collections;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;
public class ChatListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void tabComplete(TabCompleteEvent e) {
if (!(e.getSender() instanceof Player)) {
return;
}
Dialog dia = DialogManager.getDialog((Player) e.getSender());
if (dia != null) {
String[] split = e.getBuffer().split(" ");
List <String> complet = dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split);
if (complet == null) {
complet = Collections.emptyList();
}
e.setCompletions(complet);
}
}
@EventHandler
public void logoff(PlayerQuitEvent e) {
DialogManager.forceEndDialog(e.getPlayer());
}
}
| FIx exception in dialog tab completion | FIx exception in dialog tab completion
| Java | bsd-3-clause | psygate/CivModCore,psygate/CivModCore | java | ## Code Before:
package vg.civcraft.mc.civmodcore.chatDialog;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;
public class ChatListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void tabComplete(TabCompleteEvent e) {
if (!(e.getSender() instanceof Player)) {
return;
}
Dialog dia = DialogManager.getDialog((Player) e.getSender());
if (dia != null) {
String[] split = e.getBuffer().split(" ");
e.setCompletions(dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split));
}
}
@EventHandler
public void logoff(PlayerQuitEvent e) {
DialogManager.forceEndDialog(e.getPlayer());
}
}
## Instruction:
FIx exception in dialog tab completion
## Code After:
package vg.civcraft.mc.civmodcore.chatDialog;
import java.util.Collections;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;
public class ChatListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void tabComplete(TabCompleteEvent e) {
if (!(e.getSender() instanceof Player)) {
return;
}
Dialog dia = DialogManager.getDialog((Player) e.getSender());
if (dia != null) {
String[] split = e.getBuffer().split(" ");
List <String> complet = dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split);
if (complet == null) {
complet = Collections.emptyList();
}
e.setCompletions(complet);
}
}
@EventHandler
public void logoff(PlayerQuitEvent e) {
DialogManager.forceEndDialog(e.getPlayer());
}
}
|
f6f502a491b77b74f45a3e8aa00814bb02c419bf | benchmark.js | benchmark.js |
var rimraf = require('rimraf')
var fs = require('fs')
var childProcess = require('child_process')
var walkSync = require('./')
rimraf.sync('benchmark.tmp')
function createDirWithFiles(dir) {
fs.mkdirSync(dir)
for (var i = 0; i < 1000; i++) {
fs.writeFileSync(dir + '/' + i, 'foo')
}
}
createDirWithFiles('benchmark.tmp')
for (var i = 0; i < 100; i++) {
createDirWithFiles('benchmark.tmp/dir' + i)
}
childProcess.spawnSync('sync')
console.time('walkSync')
walkSync('benchmark.tmp')
console.timeEnd('walkSync')
console.time('walkSync with **/* glob')
walkSync('benchmark.tmp', ['**/*'])
console.timeEnd('walkSync with **/* glob')
console.time('walkSync with **/*DOESNOTMATCH glob')
walkSync('benchmark.tmp', ['**/*DOESNOTMATCH'])
console.timeEnd('walkSync with **/*DOESNOTMATCH glob')
console.time('walkSync with DOESNOTMATCH*/** glob')
walkSync('benchmark.tmp', ['DOESNOTMATCH*/**'])
console.timeEnd('walkSync with DOESNOTMATCH*/** glob')
rimraf.sync('benchmark.tmp')
|
var rimraf = require('rimraf')
var fs = require('fs')
var childProcess = require('child_process')
var walkSync = require('./')
rimraf.sync('benchmark.tmp')
var directories = 100, files = 1000
function createDirWithFiles(dir) {
fs.mkdirSync(dir)
for (var i = 0; i < files; i++) {
fs.writeFileSync(dir + '/' + i, 'foo')
}
}
console.log('Creating ' + (directories * files) + ' files across ' + directories + ' directories')
createDirWithFiles('benchmark.tmp')
for (var i = 0; i < directories - 1; i++) {
createDirWithFiles('benchmark.tmp/dir' + i)
}
childProcess.spawnSync('sync')
console.time('walkSync')
walkSync('benchmark.tmp')
console.timeEnd('walkSync')
console.time('walkSync with **/* glob')
walkSync('benchmark.tmp', ['**/*'])
console.timeEnd('walkSync with **/* glob')
console.time('walkSync with **/*DOESNOTMATCH glob')
walkSync('benchmark.tmp', ['**/*DOESNOTMATCH'])
console.timeEnd('walkSync with **/*DOESNOTMATCH glob')
console.time('walkSync with DOESNOTMATCH*/** glob')
walkSync('benchmark.tmp', ['DOESNOTMATCH*/**'])
console.timeEnd('walkSync with DOESNOTMATCH*/** glob')
rimraf.sync('benchmark.tmp')
| Print what we're doing, and make executable | Print what we're doing, and make executable
| JavaScript | mit | joliss/node-walk-sync,joliss/node-walk-sync | javascript | ## Code Before:
var rimraf = require('rimraf')
var fs = require('fs')
var childProcess = require('child_process')
var walkSync = require('./')
rimraf.sync('benchmark.tmp')
function createDirWithFiles(dir) {
fs.mkdirSync(dir)
for (var i = 0; i < 1000; i++) {
fs.writeFileSync(dir + '/' + i, 'foo')
}
}
createDirWithFiles('benchmark.tmp')
for (var i = 0; i < 100; i++) {
createDirWithFiles('benchmark.tmp/dir' + i)
}
childProcess.spawnSync('sync')
console.time('walkSync')
walkSync('benchmark.tmp')
console.timeEnd('walkSync')
console.time('walkSync with **/* glob')
walkSync('benchmark.tmp', ['**/*'])
console.timeEnd('walkSync with **/* glob')
console.time('walkSync with **/*DOESNOTMATCH glob')
walkSync('benchmark.tmp', ['**/*DOESNOTMATCH'])
console.timeEnd('walkSync with **/*DOESNOTMATCH glob')
console.time('walkSync with DOESNOTMATCH*/** glob')
walkSync('benchmark.tmp', ['DOESNOTMATCH*/**'])
console.timeEnd('walkSync with DOESNOTMATCH*/** glob')
rimraf.sync('benchmark.tmp')
## Instruction:
Print what we're doing, and make executable
## Code After:
var rimraf = require('rimraf')
var fs = require('fs')
var childProcess = require('child_process')
var walkSync = require('./')
rimraf.sync('benchmark.tmp')
var directories = 100, files = 1000
function createDirWithFiles(dir) {
fs.mkdirSync(dir)
for (var i = 0; i < files; i++) {
fs.writeFileSync(dir + '/' + i, 'foo')
}
}
console.log('Creating ' + (directories * files) + ' files across ' + directories + ' directories')
createDirWithFiles('benchmark.tmp')
for (var i = 0; i < directories - 1; i++) {
createDirWithFiles('benchmark.tmp/dir' + i)
}
childProcess.spawnSync('sync')
console.time('walkSync')
walkSync('benchmark.tmp')
console.timeEnd('walkSync')
console.time('walkSync with **/* glob')
walkSync('benchmark.tmp', ['**/*'])
console.timeEnd('walkSync with **/* glob')
console.time('walkSync with **/*DOESNOTMATCH glob')
walkSync('benchmark.tmp', ['**/*DOESNOTMATCH'])
console.timeEnd('walkSync with **/*DOESNOTMATCH glob')
console.time('walkSync with DOESNOTMATCH*/** glob')
walkSync('benchmark.tmp', ['DOESNOTMATCH*/**'])
console.timeEnd('walkSync with DOESNOTMATCH*/** glob')
rimraf.sync('benchmark.tmp')
|
f34d4111332727c7b236125dc0bb5b56f41a6e77 | .github/workflows/release.yml | .github/workflows/release.yml | name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2.7.0
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
| name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2.7.0
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.GORELEASER_HOMEBREW_TAP_TOKEN }}
| Fix name of encrypted variable | Fix name of encrypted variable
Variables can't start with GITHUB_ | YAML | bsd-3-clause | vektra/mockery,vektra/mockery | yaml | ## Code Before:
name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2.7.0
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
## Instruction:
Fix name of encrypted variable
Variables can't start with GITHUB_
## Code After:
name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2.7.0
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.GORELEASER_HOMEBREW_TAP_TOKEN }}
|
6f04caa18e10470209b248c4a29c400a4a52bd5d | .travis.yml | .travis.yml | language: go
go:
- 1.2
- 1.3
- 1.4
- tip
script:
- go get -d -v ./...
- go test -v ./...
| language: go
go:
- 1.6
- 1.7
- 1.8
- tip
script:
- go test -v ./...
| Test with new go versions | Test with new go versions | YAML | mit | frozzare/go-assert | yaml | ## Code Before:
language: go
go:
- 1.2
- 1.3
- 1.4
- tip
script:
- go get -d -v ./...
- go test -v ./...
## Instruction:
Test with new go versions
## Code After:
language: go
go:
- 1.6
- 1.7
- 1.8
- tip
script:
- go test -v ./...
|
943adb86719cd2e6edf2a3503fe43d9ab0370fbc | lib/geokit/inflectors.rb | lib/geokit/inflectors.rb | module Geokit
module Inflector
require "cgi"
extend self
def titleize(word)
humanize(underscore(word)).gsub(/\b([a-z])/u) { Regexp.last_match(1).capitalize }
end
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, "/").
gsub(/([A-Z]+)([A-Z][a-z])/u, '\1_\2').
gsub(/([a-z\d])([A-Z])/u, '\1_\2').
tr("-", "_").
downcase
end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
end
def url_escape(s)
CGI.escape(s)
end
def camelize(str)
str.split("_").map(&:capitalize).join
end
end
end
| require "cgi"
module Geokit
module Inflector
module_function
def titleize(word)
humanize(underscore(word)).gsub(/\b([a-z])/u) { Regexp.last_match(1).capitalize }
end
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, "/").
gsub(/([A-Z]+)([A-Z][a-z])/u, '\1_\2').
gsub(/([a-z\d])([A-Z])/u, '\1_\2').
tr("-", "_").
downcase
end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
end
def url_escape(s)
CGI.escape(s)
end
def camelize(str)
str.split("_").map(&:capitalize).join
end
end
end
| Use module_function instead of extend self | Use module_function instead of extend self
| Ruby | mit | lsaffie/geokit,sferik/geokit,nicnilov/geokit,suranyami/geokit,malmckay/geokit,internmatch/geokit,geokit/geokit | ruby | ## Code Before:
module Geokit
module Inflector
require "cgi"
extend self
def titleize(word)
humanize(underscore(word)).gsub(/\b([a-z])/u) { Regexp.last_match(1).capitalize }
end
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, "/").
gsub(/([A-Z]+)([A-Z][a-z])/u, '\1_\2').
gsub(/([a-z\d])([A-Z])/u, '\1_\2').
tr("-", "_").
downcase
end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
end
def url_escape(s)
CGI.escape(s)
end
def camelize(str)
str.split("_").map(&:capitalize).join
end
end
end
## Instruction:
Use module_function instead of extend self
## Code After:
require "cgi"
module Geokit
module Inflector
module_function
def titleize(word)
humanize(underscore(word)).gsub(/\b([a-z])/u) { Regexp.last_match(1).capitalize }
end
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, "/").
gsub(/([A-Z]+)([A-Z][a-z])/u, '\1_\2').
gsub(/([a-z\d])([A-Z])/u, '\1_\2').
tr("-", "_").
downcase
end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
end
def url_escape(s)
CGI.escape(s)
end
def camelize(str)
str.split("_").map(&:capitalize).join
end
end
end
|
b42913c198823b1dcfb1f8eca9b63e62836c9e6d | app/Model/User.php | app/Model/User.php | <?php
App::uses('AppModel', 'Model');
class User extends AppModel {
public function getInfo()
{
return $this->find('all');
}
}
| <?php
App::uses('AppModel', 'Model');
App::uses('AuthComponent', 'Controller/Component');
class User extends AppModel {
//make password encription before save to database
public function beforeSave($options = array())
{
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
}
return true;
}
//find all of data of users table
public function getInfo()
{
return $this->find('all');
}
}
| Encrypt password what submitted index.ctp form. its make a filter to execute before data save to database | Encrypt password what submitted index.ctp form. its make a filter to execute before data save to database
| PHP | mit | mahedi2014/cakephp-basic,mahedi2014/cakephp-basic,mahedi2014/cakephp-basic,mahedi2014/cakephp-basic | php | ## Code Before:
<?php
App::uses('AppModel', 'Model');
class User extends AppModel {
public function getInfo()
{
return $this->find('all');
}
}
## Instruction:
Encrypt password what submitted index.ctp form. its make a filter to execute before data save to database
## Code After:
<?php
App::uses('AppModel', 'Model');
App::uses('AuthComponent', 'Controller/Component');
class User extends AppModel {
//make password encription before save to database
public function beforeSave($options = array())
{
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
}
return true;
}
//find all of data of users table
public function getInfo()
{
return $this->find('all');
}
}
|
06b5f648687a2bf5ace2563b20d5a6bf0477b4fe | meta/README.md | meta/README.md |
This directory contains metadata for the RISC-V Instruction Set
|File|Description|
|:---|:----------|
|`codecs` |Instruction encodings|
|`compression` |Compressed instruction metadata|
|`constraints` |Constraint definitions|
|`csrs` |CPU Specific Registers|
|`descriptions`|Instruction long descriptions|
|`enums` |Enumerated types|
|`extensions` |Instruction set extensions|
|`formats` |Disassembly formats|
|`instructions`|Instruction pseudo code|
|`opcodes` |Opcode encoding information|
|`operands` |Bit encodings of operands|
|`registers` |Registers and their ABI names|
|`types` |Instruction types| |
This directory contains metadata for the RISC-V Instruction Set
|File|Description|
|:---|:----------|
|`codecs` |Instruction encodings|
|`compression` |Compressed instruction metadata|
|`constraints` |Constraint definitions|
|`csrs` |Control and status registers|
|`descriptions`|Instruction long descriptions|
|`enums` |Enumerated types|
|`extensions` |Instruction set extensions|
|`formats` |Disassembly formats|
|`instructions`|Instruction pseudo code|
|`opcodes` |Opcode encoding information|
|`operands` |Bit encodings of operands|
|`registers` |Registers and their ABI names|
|`types` |Instruction types| | Update description for control and status registers | Update description for control and status registers
| Markdown | mit | rv8-io/rv8,rv8-io/rv8,rv8-io/rv8 | markdown | ## Code Before:
This directory contains metadata for the RISC-V Instruction Set
|File|Description|
|:---|:----------|
|`codecs` |Instruction encodings|
|`compression` |Compressed instruction metadata|
|`constraints` |Constraint definitions|
|`csrs` |CPU Specific Registers|
|`descriptions`|Instruction long descriptions|
|`enums` |Enumerated types|
|`extensions` |Instruction set extensions|
|`formats` |Disassembly formats|
|`instructions`|Instruction pseudo code|
|`opcodes` |Opcode encoding information|
|`operands` |Bit encodings of operands|
|`registers` |Registers and their ABI names|
|`types` |Instruction types|
## Instruction:
Update description for control and status registers
## Code After:
This directory contains metadata for the RISC-V Instruction Set
|File|Description|
|:---|:----------|
|`codecs` |Instruction encodings|
|`compression` |Compressed instruction metadata|
|`constraints` |Constraint definitions|
|`csrs` |Control and status registers|
|`descriptions`|Instruction long descriptions|
|`enums` |Enumerated types|
|`extensions` |Instruction set extensions|
|`formats` |Disassembly formats|
|`instructions`|Instruction pseudo code|
|`opcodes` |Opcode encoding information|
|`operands` |Bit encodings of operands|
|`registers` |Registers and their ABI names|
|`types` |Instruction types| |
046f626f9454750c15216cb4c818055305f03b1e | css/components/documents-list-table.css | css/components/documents-list-table.css | .documents-list-table {
max-height: 242px;
overflow: hidden;
overflow-y: scroll;
border: 1px solid var(--light-medium-background);
}
.documents-list-table .submitted-user-data-table {
width:99.99%; /* Hack to help make the right border of responsive table visible */
}
| .documents-list-table {
max-height: 242px;
overflow: hidden;
overflow-y: scroll;
border: 1px solid var(--light-medium-background);
}
.documents-list-table .submitted-user-data-table {
width:99.99%; /* Hack to help make the right border of responsive table visible */
}
@media only screen and (max-width: var(--mobile-width)) {
.documents-list-table {
max-height: none;
}
} | Make document list not scrollable zone on mobile | Make document list not scrollable zone on mobile
| CSS | mit | egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations | css | ## Code Before:
.documents-list-table {
max-height: 242px;
overflow: hidden;
overflow-y: scroll;
border: 1px solid var(--light-medium-background);
}
.documents-list-table .submitted-user-data-table {
width:99.99%; /* Hack to help make the right border of responsive table visible */
}
## Instruction:
Make document list not scrollable zone on mobile
## Code After:
.documents-list-table {
max-height: 242px;
overflow: hidden;
overflow-y: scroll;
border: 1px solid var(--light-medium-background);
}
.documents-list-table .submitted-user-data-table {
width:99.99%; /* Hack to help make the right border of responsive table visible */
}
@media only screen and (max-width: var(--mobile-width)) {
.documents-list-table {
max-height: none;
}
} |
dc0bbece26fba533ec5f4d6f790990143f80933a | Pod/Classes/RxMapViewReactiveDataSource.swift | Pod/Classes/RxMapViewReactiveDataSource.swift | //
// RxMapViewReactiveDataSource.swift
// RxMKMapView
//
// Created by Mikko Välimäki on 09/08/2017.
// Copyright © 2017 RxSwiftCommunity. All rights reserved.
//
import Foundation
import MapKit
import RxSwift
import RxCocoa
public class RxMapViewReactiveDataSource<S: MKAnnotation>
: RxMapViewDataSourceType {
public typealias Element = S
var currentAnnotations: [S] = []
public func mapView(_ mapView: MKMapView, observedEvent: Event<[S]>) {
UIBindingObserver(UIElement: self) { (animator, newAnnotations) in
DispatchQueue.main.async {
let diff = Diff.calculateFrom(
previous: self.currentAnnotations,
next: newAnnotations)
self.currentAnnotations = newAnnotations
mapView.addAnnotations(diff.added)
mapView.removeAnnotations(diff.removed)
}
}.on(observedEvent)
}
}
| //
// RxMapViewReactiveDataSource.swift
// RxMKMapView
//
// Created by Mikko Välimäki on 09/08/2017.
// Copyright © 2017 RxSwiftCommunity. All rights reserved.
//
import Foundation
import MapKit
import RxSwift
import RxCocoa
public class RxMapViewReactiveDataSource<S: MKAnnotation>
: RxMapViewDataSourceType {
public typealias Element = S
var currentAnnotations: [S] = []
public func mapView(_ mapView: MKMapView, observedEvent: Event<[S]>) {
Binder(self) { (animator, newAnnotations) in
DispatchQueue.main.async {
let diff = Diff.calculateFrom(
previous: self.currentAnnotations,
next: newAnnotations)
self.currentAnnotations = newAnnotations
mapView.addAnnotations(diff.added)
mapView.removeAnnotations(diff.removed)
}
}.on(observedEvent)
}
}
| Update use of deprecated binder | Update use of deprecated binder
| Swift | mit | RxSwiftCommunity/RxMKMapView,RxSwiftCommunity/RxMKMapView,RxSwiftCommunity/RxMKMapView | swift | ## Code Before:
//
// RxMapViewReactiveDataSource.swift
// RxMKMapView
//
// Created by Mikko Välimäki on 09/08/2017.
// Copyright © 2017 RxSwiftCommunity. All rights reserved.
//
import Foundation
import MapKit
import RxSwift
import RxCocoa
public class RxMapViewReactiveDataSource<S: MKAnnotation>
: RxMapViewDataSourceType {
public typealias Element = S
var currentAnnotations: [S] = []
public func mapView(_ mapView: MKMapView, observedEvent: Event<[S]>) {
UIBindingObserver(UIElement: self) { (animator, newAnnotations) in
DispatchQueue.main.async {
let diff = Diff.calculateFrom(
previous: self.currentAnnotations,
next: newAnnotations)
self.currentAnnotations = newAnnotations
mapView.addAnnotations(diff.added)
mapView.removeAnnotations(diff.removed)
}
}.on(observedEvent)
}
}
## Instruction:
Update use of deprecated binder
## Code After:
//
// RxMapViewReactiveDataSource.swift
// RxMKMapView
//
// Created by Mikko Välimäki on 09/08/2017.
// Copyright © 2017 RxSwiftCommunity. All rights reserved.
//
import Foundation
import MapKit
import RxSwift
import RxCocoa
public class RxMapViewReactiveDataSource<S: MKAnnotation>
: RxMapViewDataSourceType {
public typealias Element = S
var currentAnnotations: [S] = []
public func mapView(_ mapView: MKMapView, observedEvent: Event<[S]>) {
Binder(self) { (animator, newAnnotations) in
DispatchQueue.main.async {
let diff = Diff.calculateFrom(
previous: self.currentAnnotations,
next: newAnnotations)
self.currentAnnotations = newAnnotations
mapView.addAnnotations(diff.added)
mapView.removeAnnotations(diff.removed)
}
}.on(observedEvent)
}
}
|
a02a8dbe3845885604db0a3498049e71ddf89cc1 | windows-install.ps1 | windows-install.ps1 | iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
| Set-ExecutionPolicy Unrestricted
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install conemu
choco install msys2
| Add conemu and msys2 via chocolatey | Add conemu and msys2 via chocolatey
| PowerShell | mit | ctfhacker/ctfhacker.github.io,thebarbershopper/thebarbershopper.github.io,ctfhacker/ctfhacker.github.io,thebarbershopper/thebarbershopper.github.io,ctfhacker/ctfhacker.github.io,thebarbershopper/thebarbershopper.github.io,ctfhacker/ctfhacker.github.io,thebarbershopper/thebarbershopper.github.io | powershell | ## Code Before:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
## Instruction:
Add conemu and msys2 via chocolatey
## Code After:
Set-ExecutionPolicy Unrestricted
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install conemu
choco install msys2
|
6cc801b99cbadb45cb774bc1cff7fbea09461e5c | src/SavedSearches/Command/SavedSearchCommand.php | src/SavedSearches/Command/SavedSearchCommand.php | <?php
namespace CultuurNet\UDB3\SavedSearches\Command;
use CultuurNet\UDB3\ValueObject\SapiVersion;
use ValueObjects\StringLiteral\StringLiteral;
abstract class SavedSearchCommand
{
/**
* @var SapiVersion
*/
protected $sapiVersion;
/**
* @var StringLiteral
*/
protected $userId;
/**
* @param SapiVersion $sapiVersion
* @param StringLiteral $userId
*/
public function __construct(
SapiVersion $sapiVersion,
StringLiteral $userId
) {
$this->sapiVersion = $sapiVersion;
$this->userId = $userId;
}
/**
* @return SapiVersion
*/
public function getSapiVersion(): SapiVersion
{
return $this->sapiVersion;
}
/**
* @return StringLiteral
*/
public function getUserId()
{
return $this->userId;
}
}
| <?php
namespace CultuurNet\UDB3\SavedSearches\Command;
use CultuurNet\UDB3\ValueObject\SapiVersion;
use ValueObjects\StringLiteral\StringLiteral;
abstract class SavedSearchCommand
{
/**
* @var string
*/
protected $sapiVersion;
/**
* @var StringLiteral
*/
protected $userId;
/**
* @param SapiVersion $sapiVersion
* @param StringLiteral $userId
*/
public function __construct(
SapiVersion $sapiVersion,
StringLiteral $userId
) {
$this->sapiVersion = $sapiVersion->toNative();
$this->userId = $userId;
}
/**
* @return SapiVersion
*/
public function getSapiVersion(): SapiVersion
{
return SapiVersion::fromNative($this->sapiVersion);
}
/**
* @return StringLiteral
*/
public function getUserId()
{
return $this->userId;
}
}
| Fix exception about enums that can't be serialized, ensure native sapiVersion is serialized instead | III-2779: Fix exception about enums that can't be serialized, ensure native sapiVersion is serialized instead
| PHP | apache-2.0 | cultuurnet/udb3-php | php | ## Code Before:
<?php
namespace CultuurNet\UDB3\SavedSearches\Command;
use CultuurNet\UDB3\ValueObject\SapiVersion;
use ValueObjects\StringLiteral\StringLiteral;
abstract class SavedSearchCommand
{
/**
* @var SapiVersion
*/
protected $sapiVersion;
/**
* @var StringLiteral
*/
protected $userId;
/**
* @param SapiVersion $sapiVersion
* @param StringLiteral $userId
*/
public function __construct(
SapiVersion $sapiVersion,
StringLiteral $userId
) {
$this->sapiVersion = $sapiVersion;
$this->userId = $userId;
}
/**
* @return SapiVersion
*/
public function getSapiVersion(): SapiVersion
{
return $this->sapiVersion;
}
/**
* @return StringLiteral
*/
public function getUserId()
{
return $this->userId;
}
}
## Instruction:
III-2779: Fix exception about enums that can't be serialized, ensure native sapiVersion is serialized instead
## Code After:
<?php
namespace CultuurNet\UDB3\SavedSearches\Command;
use CultuurNet\UDB3\ValueObject\SapiVersion;
use ValueObjects\StringLiteral\StringLiteral;
abstract class SavedSearchCommand
{
/**
* @var string
*/
protected $sapiVersion;
/**
* @var StringLiteral
*/
protected $userId;
/**
* @param SapiVersion $sapiVersion
* @param StringLiteral $userId
*/
public function __construct(
SapiVersion $sapiVersion,
StringLiteral $userId
) {
$this->sapiVersion = $sapiVersion->toNative();
$this->userId = $userId;
}
/**
* @return SapiVersion
*/
public function getSapiVersion(): SapiVersion
{
return SapiVersion::fromNative($this->sapiVersion);
}
/**
* @return StringLiteral
*/
public function getUserId()
{
return $this->userId;
}
}
|
a00f3a2b745d7e1c09e862048ff09215d8046929 | appveyor.yml | appveyor.yml | image: Visual Studio 2017
version: '1.6.0.{build}'
init:
- git config --global core.autocrlf true
build_script:
- ps: .\build.ps1 -Target Test --BuildVersion=$($env:appveyor_build_version)
test: off
artifacts:
- path: BuildArtifacts\*.nupkg
name: NuGet package
cache:
- packages -> **\packages.config
- tools -> build.cake
skip_commits:
files:
- license.txt
- readme.md
- how-to-build.md
# here we are going to override common configuration
for:
# master branch
-
branches:
only:
- master
build_script:
- ps: .\build.ps1 -Target Publish --BuildVersion=$($env:appveyor_build_version)
deploy:
provider: NuGet
api_key:
secure: feaZhwWZx/Din7m6hadxDNQDT7Jv7Kcx4vLMXecUNIjNj7f3FAPLCBM6uY81C1ZS
artifact: /NuGet/ | image: Visual Studio 2017
version: '1.6.0.{build}'
init:
- git config --global core.autocrlf true
build_script:
- ps: .\build.ps1 -Target Test --BuildVersion=$($env:appveyor_build_version)
test: off
artifacts:
- path: BuildArtifacts\*.nupkg
name: NuGet package
cache:
- packages -> **\packages.config
- tools -> build.cake
skip_commits:
files:
- license.txt
- readme.md
- how-to-build.md
# here we are going to override common configuration
for:
# master branch
-
branches:
only:
- master
build_script:
- ps: .\build.ps1 -Target Publish --BuildVersion=$($env:appveyor_build_version)
deploy:
- provider: NuGet
artifact: /NuGet/
api_key:
secure: c+mL8DX3ln4s/VMJ8jYBuaV/HAwexKKQZLKVBF9w7q+iONNow5WH4gn1AglAS/wX | Update the nuget api key | Update the nuget api key
| YAML | apache-2.0 | dotless/dotless,dotless/dotless | yaml | ## Code Before:
image: Visual Studio 2017
version: '1.6.0.{build}'
init:
- git config --global core.autocrlf true
build_script:
- ps: .\build.ps1 -Target Test --BuildVersion=$($env:appveyor_build_version)
test: off
artifacts:
- path: BuildArtifacts\*.nupkg
name: NuGet package
cache:
- packages -> **\packages.config
- tools -> build.cake
skip_commits:
files:
- license.txt
- readme.md
- how-to-build.md
# here we are going to override common configuration
for:
# master branch
-
branches:
only:
- master
build_script:
- ps: .\build.ps1 -Target Publish --BuildVersion=$($env:appveyor_build_version)
deploy:
provider: NuGet
api_key:
secure: feaZhwWZx/Din7m6hadxDNQDT7Jv7Kcx4vLMXecUNIjNj7f3FAPLCBM6uY81C1ZS
artifact: /NuGet/
## Instruction:
Update the nuget api key
## Code After:
image: Visual Studio 2017
version: '1.6.0.{build}'
init:
- git config --global core.autocrlf true
build_script:
- ps: .\build.ps1 -Target Test --BuildVersion=$($env:appveyor_build_version)
test: off
artifacts:
- path: BuildArtifacts\*.nupkg
name: NuGet package
cache:
- packages -> **\packages.config
- tools -> build.cake
skip_commits:
files:
- license.txt
- readme.md
- how-to-build.md
# here we are going to override common configuration
for:
# master branch
-
branches:
only:
- master
build_script:
- ps: .\build.ps1 -Target Publish --BuildVersion=$($env:appveyor_build_version)
deploy:
- provider: NuGet
artifact: /NuGet/
api_key:
secure: c+mL8DX3ln4s/VMJ8jYBuaV/HAwexKKQZLKVBF9w7q+iONNow5WH4gn1AglAS/wX |
2d639bc28048c7cfe0005c3deedce3c5d43bbf7f | shackle.js | shackle.js | /**
* Shackle allows you to bind a form control or
* fieldset's enabled/disabled state to the checked/unchecked
* state of a radio button or checkbox.
* Simply Include Shackle and call:
* Shackle.pair(id-of-enabling-element, id-of-affected-element);
*/
var Shackle = (function(document, window) {
//Make any change to the state of the enabling
//control cause the other controls to syncronize
//their state
var pair = function(enableId, controlId) {
console.log(enableId, controlId);
var enable = document.getElementById(enableId);
console.log(enable);
var control = document.getElementById(controlId);
console.log(control);
enable.addEventListener('click',
_sync.bind(null, enable, control),
false);
_sync(enable, control);
};
//Synchronize the current state of the enabling control
//to the enabled/disabled control(s)
var _sync = function(enable, control) {
if(enable.checked) {
control.disabled = false;
} else {
control.disabled = true;
}
};
return {
pair: pair
};
})(document, window);
| /**
* Shackle allows you to bind a form control or
* fieldset's enabled/disabled state to the checked/unchecked
* state of a radio button or checkbox.
* Simply Include Shackle and call:
* Shackle.pair(id-of-enabling-element, id-of-affected-element);
*/
var Shackle = (function(document, window) {
//Make any change to the state of the enabling
//control cause the other controls to syncronize
//their state
var pair = function(enableId, controlId, hideControls) {
if (hideControls == undefined) {
hideControls = false;
}
console.log(enableId, controlId);
var enable = document.getElementById(enableId);
console.log(enable);
var control = document.getElementById(controlId);
console.log(control);
enable.addEventListener('click',
_sync.bind(null, enable, control, hideControls),
false);
_sync(enable, control, hideControls);
};
//Synchronize the current state of the enabling control
//to the enabled/disabled control(s)
var _sync = function(enable, control, hideControls) {
if(enable.checked) {
control.disabled = false;
if (hideControls) {
control.hidden = false;
}
} else {
control.disabled = true;
if (hideControls) {
control.hidden = true;
}
}
};
return {
pair: pair
};
})(document, window);
| Update API to optionally hide disabled controls. | Update API to optionally hide disabled controls. | JavaScript | mit | whereswaldon/shackle | javascript | ## Code Before:
/**
* Shackle allows you to bind a form control or
* fieldset's enabled/disabled state to the checked/unchecked
* state of a radio button or checkbox.
* Simply Include Shackle and call:
* Shackle.pair(id-of-enabling-element, id-of-affected-element);
*/
var Shackle = (function(document, window) {
//Make any change to the state of the enabling
//control cause the other controls to syncronize
//their state
var pair = function(enableId, controlId) {
console.log(enableId, controlId);
var enable = document.getElementById(enableId);
console.log(enable);
var control = document.getElementById(controlId);
console.log(control);
enable.addEventListener('click',
_sync.bind(null, enable, control),
false);
_sync(enable, control);
};
//Synchronize the current state of the enabling control
//to the enabled/disabled control(s)
var _sync = function(enable, control) {
if(enable.checked) {
control.disabled = false;
} else {
control.disabled = true;
}
};
return {
pair: pair
};
})(document, window);
## Instruction:
Update API to optionally hide disabled controls.
## Code After:
/**
* Shackle allows you to bind a form control or
* fieldset's enabled/disabled state to the checked/unchecked
* state of a radio button or checkbox.
* Simply Include Shackle and call:
* Shackle.pair(id-of-enabling-element, id-of-affected-element);
*/
var Shackle = (function(document, window) {
//Make any change to the state of the enabling
//control cause the other controls to syncronize
//their state
var pair = function(enableId, controlId, hideControls) {
if (hideControls == undefined) {
hideControls = false;
}
console.log(enableId, controlId);
var enable = document.getElementById(enableId);
console.log(enable);
var control = document.getElementById(controlId);
console.log(control);
enable.addEventListener('click',
_sync.bind(null, enable, control, hideControls),
false);
_sync(enable, control, hideControls);
};
//Synchronize the current state of the enabling control
//to the enabled/disabled control(s)
var _sync = function(enable, control, hideControls) {
if(enable.checked) {
control.disabled = false;
if (hideControls) {
control.hidden = false;
}
} else {
control.disabled = true;
if (hideControls) {
control.hidden = true;
}
}
};
return {
pair: pair
};
})(document, window);
|
e90960c4197d50562881f707c338ccc96869112e | selenium-test.xml | selenium-test.xml | <project name="eagle-test" default="selenese" basedir=".">
<property file="build.properties" />
<property file="test.properties" />
<target name="selenese"/>
<taskdef resource="selenium-ant.properties">
<classpath>
<pathelement location="${source.nondeploy.lib.dir}/selenium-server.jar"/>
</classpath>
</taskdef>
<selenese
suite="test\selenium\ispyTestSuite.html"
browser="${browser}"
results="${result_file}"
multiWindow="false"
timeoutInSeconds="120"
port="${server_port}"
startURL="${test_url}" />
</project>
| <project name="ispy-test" default="selenese" basedir=".">
<property file="build.properties" />
<property file="test.properties" />
<target name="selenese"/>
<taskdef resource="selenium-ant.properties">
<classpath>
<pathelement location="${source.nondeploy.lib.dir}/selenium-server.jar"/>
</classpath>
</taskdef>
<selenese
suite="test\selenium\QA_ispyTestSuite.html"
browser="${qa_browser}"
results="${result_file}"
multiWindow="false"
timeoutInSeconds="120"
port="${qa_server_port}"
startURL="${qa_test_url}" />
</project>
| Rename the build target to "ispy-test" instead of "eagle-test" | Rename the build target to "ispy-test" instead of "eagle-test"
SVN-Revision: 4546
| XML | bsd-3-clause | NCIP/i-spy,NCIP/i-spy | xml | ## Code Before:
<project name="eagle-test" default="selenese" basedir=".">
<property file="build.properties" />
<property file="test.properties" />
<target name="selenese"/>
<taskdef resource="selenium-ant.properties">
<classpath>
<pathelement location="${source.nondeploy.lib.dir}/selenium-server.jar"/>
</classpath>
</taskdef>
<selenese
suite="test\selenium\ispyTestSuite.html"
browser="${browser}"
results="${result_file}"
multiWindow="false"
timeoutInSeconds="120"
port="${server_port}"
startURL="${test_url}" />
</project>
## Instruction:
Rename the build target to "ispy-test" instead of "eagle-test"
SVN-Revision: 4546
## Code After:
<project name="ispy-test" default="selenese" basedir=".">
<property file="build.properties" />
<property file="test.properties" />
<target name="selenese"/>
<taskdef resource="selenium-ant.properties">
<classpath>
<pathelement location="${source.nondeploy.lib.dir}/selenium-server.jar"/>
</classpath>
</taskdef>
<selenese
suite="test\selenium\QA_ispyTestSuite.html"
browser="${qa_browser}"
results="${result_file}"
multiWindow="false"
timeoutInSeconds="120"
port="${qa_server_port}"
startURL="${qa_test_url}" />
</project>
|
7d46a482f56d01c72aac4aff92c0383b87366118 | scripts/clear_imported_torrents.sh | scripts/clear_imported_torrents.sh |
cd /Users/lopopolo/Downloads
rm *.torrent.imported
|
cd /Users/lopopolo/Downloads
shopt -s nullglob
found=0
for i in *.torrent.imported; do
found=1
done
shopt -u nullglob
[ $found -eq 1 ] && rm *.torrent.imported
| Check to see if there are any imported torrents before removing them | Check to see if there are any imported torrents before removing them
| Shell | mit | lopopolo/dotfiles,lopopolo/dotfiles | shell | ## Code Before:
cd /Users/lopopolo/Downloads
rm *.torrent.imported
## Instruction:
Check to see if there are any imported torrents before removing them
## Code After:
cd /Users/lopopolo/Downloads
shopt -s nullglob
found=0
for i in *.torrent.imported; do
found=1
done
shopt -u nullglob
[ $found -eq 1 ] && rm *.torrent.imported
|
321eb6fa1bd4d0e68f2cbc170ab999b9364a9f6f | .github/workflows/main.yml | .github/workflows/main.yml | on:
push:
branches:
- main
pull_request:
branches:
- main
name: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-restore --verbosity normal
| on:
push:
branches:
- main
pull_request:
branches:
- main
name: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: dotnet restore LineBot.sln
- name: Build
run: dotnet build LineBot.sln --no-restore --configuration Release
- name: Test
run: dotnet test LineBot.sln --no-restore --verbosity normal
| Include solution file in the commands. | Include solution file in the commands.
| YAML | apache-2.0 | dlemstra/line-bot-sdk-dotnet,dlemstra/line-bot-sdk-dotnet | yaml | ## Code Before:
on:
push:
branches:
- main
pull_request:
branches:
- main
name: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-restore --verbosity normal
## Instruction:
Include solution file in the commands.
## Code After:
on:
push:
branches:
- main
pull_request:
branches:
- main
name: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: dotnet restore LineBot.sln
- name: Build
run: dotnet build LineBot.sln --no-restore --configuration Release
- name: Test
run: dotnet test LineBot.sln --no-restore --verbosity normal
|
1bef8134eeef563e14b3dbef53a0989c2eb9ecf1 | test/blackbox-tests/test-cases/optional-executable/run.t | test/blackbox-tests/test-cases/optional-executable/run.t | Test optional executable
$ dune build @install
$ dune build @run-x
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @run-x
[1]
| Test optional executable
$ dune build @install
$ dune build @all
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @all
[1]
$ dune build @run-x
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @run-x
[1]
| Add a test with for optional executable | Add a test with for optional executable
Signed-off-by: François Bobot <8530d62b7eab3cddb9a9239fb10975bf18a1335a@cea.fr>
| Perl | apache-2.0 | janestreet/jbuilder,dra27/jbuilder,janestreet/jbuilder,janestreet/jbuilder,dra27/jbuilder,dra27/jbuilder,dra27/jbuilder,janestreet/jbuilder,dra27/jbuilder,janestreet/jbuilder,dra27/jbuilder,janestreet/jbuilder | perl | ## Code Before:
Test optional executable
$ dune build @install
$ dune build @run-x
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @run-x
[1]
## Instruction:
Add a test with for optional executable
Signed-off-by: François Bobot <8530d62b7eab3cddb9a9239fb10975bf18a1335a@cea.fr>
## Code After:
Test optional executable
$ dune build @install
$ dune build @all
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @all
[1]
$ dune build @run-x
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
Hint: try: dune external-lib-deps --missing @run-x
[1]
|
620f0adbfd1c6577c39df07d0202f90404663353 | metadata/de.arnefeil.bewegungsmelder.txt | metadata/de.arnefeil.bewegungsmelder.txt | Categories:Time
License:GPLv3
Web Site:http://arnef.github.io/bewegungsmelder-android
Source Code:https://github.com/arnef/bewegungsmelder-android
Issue Tracker:https://github.com/arnef/bewegungsmelder-android/issues
Auto Name:Bewegungsmelder
Summary:Get event information for Hamburg, Germany
Description:
Companion app for [http://bewegungsmelder.nadir.org/ Bewegungsmelder], a
website focusing on converts and other events around Hamburg, Germany.
.
Repo Type:git
Repo:https://github.com/arnef/bewegungsmelder-android
Build:2.0.2,140629
disable=res issues
commit=9d21132dd0452cc155dfbe9fe7a25439293f7deb
target=android-21
Maintainer Notes:
Specifies target=android-20 (Kitkat for Wachtes), bumping instead.
Doesn't compile, see https://github.com/arnef/bewegungsmelder-android/issues/7.
.
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:2.0.2
Current Version Code:140629
| Categories:Time
License:GPLv3
Web Site:http://arnef.github.io/bewegungsmelder-android
Source Code:https://github.com/arnef/bewegungsmelder-android
Issue Tracker:https://github.com/arnef/bewegungsmelder-android/issues
Auto Name:Bewegungsmelder
Summary:Get event information for Hamburg, Germany
Description:
Companion app for [http://bewegungsmelder.nadir.org/ Bewegungsmelder], a
website focusing on converts and other events around Hamburg, Germany.
.
Repo Type:git
Repo:https://github.com/segoh/bewegungsmelder-android
Build:2.0.0,140102
commit=e58eb7f9b30ccac0f47c3a374240545629ff584c
gradle=yes
Build:2.0.2,140629
disable=res issues
commit=9d21132dd0452cc155dfbe9fe7a25439293f7deb
target=android-21
Maintainer Notes:
Specifies target=android-20 (Kitkat for Wachtes), bumping instead.
Doesn't compile, see https://github.com/arnef/bewegungsmelder-android/issues/7.
Switch back to https://github.com/arnef/bewegungsmelder-android after
issues has been fixed.
.
Auto Update Mode:None
Update Check Mode:None
Current Version:2.0.2
Current Version Code:140629
| Update Bewegungsmelder to 2.0.0 (140102) | Update Bewegungsmelder to 2.0.0 (140102)
| Text | agpl-3.0 | f-droid/fdroiddata,f-droid/fdroid-data,f-droid/fdroiddata | text | ## Code Before:
Categories:Time
License:GPLv3
Web Site:http://arnef.github.io/bewegungsmelder-android
Source Code:https://github.com/arnef/bewegungsmelder-android
Issue Tracker:https://github.com/arnef/bewegungsmelder-android/issues
Auto Name:Bewegungsmelder
Summary:Get event information for Hamburg, Germany
Description:
Companion app for [http://bewegungsmelder.nadir.org/ Bewegungsmelder], a
website focusing on converts and other events around Hamburg, Germany.
.
Repo Type:git
Repo:https://github.com/arnef/bewegungsmelder-android
Build:2.0.2,140629
disable=res issues
commit=9d21132dd0452cc155dfbe9fe7a25439293f7deb
target=android-21
Maintainer Notes:
Specifies target=android-20 (Kitkat for Wachtes), bumping instead.
Doesn't compile, see https://github.com/arnef/bewegungsmelder-android/issues/7.
.
Auto Update Mode:None
Update Check Mode:RepoManifest
Current Version:2.0.2
Current Version Code:140629
## Instruction:
Update Bewegungsmelder to 2.0.0 (140102)
## Code After:
Categories:Time
License:GPLv3
Web Site:http://arnef.github.io/bewegungsmelder-android
Source Code:https://github.com/arnef/bewegungsmelder-android
Issue Tracker:https://github.com/arnef/bewegungsmelder-android/issues
Auto Name:Bewegungsmelder
Summary:Get event information for Hamburg, Germany
Description:
Companion app for [http://bewegungsmelder.nadir.org/ Bewegungsmelder], a
website focusing on converts and other events around Hamburg, Germany.
.
Repo Type:git
Repo:https://github.com/segoh/bewegungsmelder-android
Build:2.0.0,140102
commit=e58eb7f9b30ccac0f47c3a374240545629ff584c
gradle=yes
Build:2.0.2,140629
disable=res issues
commit=9d21132dd0452cc155dfbe9fe7a25439293f7deb
target=android-21
Maintainer Notes:
Specifies target=android-20 (Kitkat for Wachtes), bumping instead.
Doesn't compile, see https://github.com/arnef/bewegungsmelder-android/issues/7.
Switch back to https://github.com/arnef/bewegungsmelder-android after
issues has been fixed.
.
Auto Update Mode:None
Update Check Mode:None
Current Version:2.0.2
Current Version Code:140629
|
f47ffd72949e331cd2d6ad836c4f539b5a591b69 | 3rdparty/profiler/Cargo.toml | 3rdparty/profiler/Cargo.toml | [package]
name = "exonum_profiler"
version = "0.1.0"
authors = ["Ty Overby <ty@pre-alpha.com>", "The Exonum Team <exonum@bitfury.com>"]
repository = "https://github.com/exonum/exonum"
[dependencies]
lazy_static = "0.2.1"
thread-id = "2.0.0"
ctrlc = "3.0.1"
[features]
nomock = []
| [package]
name = "exonum_profiler"
version = "0.1.0"
authors = ["Ty Overby <ty@pre-alpha.com>", "The Exonum Team <exonum@bitfury.com>"]
repository = "https://github.com/exonum/exonum"
description = "A profiling / flamegraph library."
license = "Apache-2.0"
[dependencies]
lazy_static = "0.2.1"
thread-id = "2.0.0"
ctrlc = "3.0.1"
[features]
nomock = []
| Add description and license for profiler metadata | Add description and license for profiler metadata
| TOML | apache-2.0 | alekseysidorov/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,exonum/exonum,exonum/exonum,alekseysidorov/exonum | toml | ## Code Before:
[package]
name = "exonum_profiler"
version = "0.1.0"
authors = ["Ty Overby <ty@pre-alpha.com>", "The Exonum Team <exonum@bitfury.com>"]
repository = "https://github.com/exonum/exonum"
[dependencies]
lazy_static = "0.2.1"
thread-id = "2.0.0"
ctrlc = "3.0.1"
[features]
nomock = []
## Instruction:
Add description and license for profiler metadata
## Code After:
[package]
name = "exonum_profiler"
version = "0.1.0"
authors = ["Ty Overby <ty@pre-alpha.com>", "The Exonum Team <exonum@bitfury.com>"]
repository = "https://github.com/exonum/exonum"
description = "A profiling / flamegraph library."
license = "Apache-2.0"
[dependencies]
lazy_static = "0.2.1"
thread-id = "2.0.0"
ctrlc = "3.0.1"
[features]
nomock = []
|
ed258427cf88c895a0d7d0200fc106f8f3526dd2 | openmole/plugins/org.openmole.plugin.tool.pattern/src/main/scala/org/openmole/plugin/tool/pattern/While.scala | openmole/plugins/org.openmole.plugin.tool.pattern/src/main/scala/org/openmole/plugin/tool/pattern/While.scala | package org.openmole.plugin.tool.pattern
import org.openmole.core.workflow.dsl._
import org.openmole.core.workflow.mole._
import org.openmole.core.workflow.puzzle._
import org.openmole.core.workflow.task._
import org.openmole.core.workflow.transition._
import org.openmole.core.context._
import org.openmole.core.expansion._
object While {
def apply(
puzzle: Puzzle,
condition: Condition,
counter: OptionalArgument[Val[Long]] = None
): Puzzle =
counter.option match {
case None ⇒
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- (last, !condition)) & (puzzle -- (Slot(puzzle.first), condition))
case Some(counter) ⇒
val firstTask = EmptyTask() set (
counter := 0L
)
val incrementTask =
ClosureTask("IncrementTask") { (ctx, _, _) ⇒
ctx + (counter → (ctx(counter) + 1))
} set (
(inputs, outputs) += counter
)
val increment = MasterCapsule(incrementTask, persist = Seq(counter), strain = true)
val last = Capsule(EmptyTask(), strain = true)
(firstTask -- puzzle -- increment -- (last, !condition)) & (increment -- (Slot(puzzle.first), condition))
}
}
| package org.openmole.plugin.tool.pattern
import org.openmole.core.workflow.dsl._
import org.openmole.core.workflow.mole._
import org.openmole.core.workflow.puzzle._
import org.openmole.core.workflow.task._
import org.openmole.core.workflow.transition._
import org.openmole.core.context._
import org.openmole.core.expansion._
object While {
def apply(
puzzle: Puzzle,
condition: Condition,
counter: OptionalArgument[Val[Long]] = None
): Puzzle =
counter.option match {
case None ⇒
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- (last, !condition)) & (puzzle -- (Slot(puzzle.first), condition))
case Some(counter) ⇒
val incrementTask =
ClosureTask("IncrementTask") { (ctx, _, _) ⇒
ctx + (counter → (ctx(counter) + 1))
} set (
(inputs, outputs) += counter,
counter := 0L
)
val increment = MasterCapsule(incrementTask, persist = Seq(counter), strain = true)
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- increment -- (last, !condition)) & (increment -- (Slot(puzzle.first), condition))
}
}
| Revert "[Plugin] fix: provide the counter value to the puzzle." | Revert "[Plugin] fix: provide the counter value to the puzzle."
This reverts commit 295e8bfd80829bfbc3e3e667c2a2aab42b28fee9.
| Scala | agpl-3.0 | openmole/openmole,openmole/openmole,openmole/openmole,openmole/openmole,openmole/openmole | scala | ## Code Before:
package org.openmole.plugin.tool.pattern
import org.openmole.core.workflow.dsl._
import org.openmole.core.workflow.mole._
import org.openmole.core.workflow.puzzle._
import org.openmole.core.workflow.task._
import org.openmole.core.workflow.transition._
import org.openmole.core.context._
import org.openmole.core.expansion._
object While {
def apply(
puzzle: Puzzle,
condition: Condition,
counter: OptionalArgument[Val[Long]] = None
): Puzzle =
counter.option match {
case None ⇒
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- (last, !condition)) & (puzzle -- (Slot(puzzle.first), condition))
case Some(counter) ⇒
val firstTask = EmptyTask() set (
counter := 0L
)
val incrementTask =
ClosureTask("IncrementTask") { (ctx, _, _) ⇒
ctx + (counter → (ctx(counter) + 1))
} set (
(inputs, outputs) += counter
)
val increment = MasterCapsule(incrementTask, persist = Seq(counter), strain = true)
val last = Capsule(EmptyTask(), strain = true)
(firstTask -- puzzle -- increment -- (last, !condition)) & (increment -- (Slot(puzzle.first), condition))
}
}
## Instruction:
Revert "[Plugin] fix: provide the counter value to the puzzle."
This reverts commit 295e8bfd80829bfbc3e3e667c2a2aab42b28fee9.
## Code After:
package org.openmole.plugin.tool.pattern
import org.openmole.core.workflow.dsl._
import org.openmole.core.workflow.mole._
import org.openmole.core.workflow.puzzle._
import org.openmole.core.workflow.task._
import org.openmole.core.workflow.transition._
import org.openmole.core.context._
import org.openmole.core.expansion._
object While {
def apply(
puzzle: Puzzle,
condition: Condition,
counter: OptionalArgument[Val[Long]] = None
): Puzzle =
counter.option match {
case None ⇒
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- (last, !condition)) & (puzzle -- (Slot(puzzle.first), condition))
case Some(counter) ⇒
val incrementTask =
ClosureTask("IncrementTask") { (ctx, _, _) ⇒
ctx + (counter → (ctx(counter) + 1))
} set (
(inputs, outputs) += counter,
counter := 0L
)
val increment = MasterCapsule(incrementTask, persist = Seq(counter), strain = true)
val last = Capsule(EmptyTask(), strain = true)
(puzzle -- increment -- (last, !condition)) & (increment -- (Slot(puzzle.first), condition))
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.