commit stringlengths 40 40 | old_file stringlengths 4 184 | new_file stringlengths 4 184 | old_contents stringlengths 1 3.6k | new_contents stringlengths 5 3.38k | subject stringlengths 15 778 | message stringlengths 16 6.74k | lang stringclasses 201 values | license stringclasses 13 values | repos stringlengths 6 116k | config stringclasses 201 values | content stringlengths 137 7.24k | diff stringlengths 26 5.55k | diff_length int64 1 123 | relative_diff_length float64 0.01 89 | n_lines_added int64 0 108 | n_lines_deleted int64 0 106 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bf974c8a71d5317c35837a8f7266b996353b8461 | lib/gettext_i18n_rails/haml_parser.rb | lib/gettext_i18n_rails/haml_parser.rb | require 'gettext/utils'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
end
module GettextI18nRails
module HamlParser
module_function
def target?(file)
File.extname(file) == '.haml'
end
def parse(file, msgids = [])
return msgids unless load_haml
require 'gettext_i18n_rails/ruby_gettext_extractor'
text = IO.readlines(file).join
#first pass with real haml
haml = Haml::Engine.new(text)
code = haml.precompiled.split(/$/)
GetText::RubyParser.parse_lines(file, code, msgids)
end
def load_haml
return true if @haml_loaded
begin
require "#{RAILS_ROOT}/vendor/plugins/haml/lib/haml"
rescue LoadError
begin
require 'haml' # From gem
rescue LoadError
puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
return false
end
end
@haml_loaded = true
end
end
end
GetText::RGetText.add_parser(GettextI18nRails::HamlParser) | require 'gettext/utils'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
end
module GettextI18nRails
module HamlParser
module_function
def target?(file)
File.extname(file) == '.haml'
end
def parse(file, msgids = [])
return msgids unless load_haml
require 'gettext_i18n_rails/ruby_gettext_extractor'
text = IO.readlines(file).join
haml = Haml::Engine.new(text)
code = haml.precompiled
return RubyGettextExtractor.parse_string(code, file, msgids)
end
def load_haml
return true if @haml_loaded
begin
require "#{RAILS_ROOT}/vendor/plugins/haml/lib/haml"
rescue LoadError
begin
require 'haml' # From gem
rescue LoadError
puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
return false
end
end
@haml_loaded = true
end
end
end
GetText::RGetText.add_parser(GettextI18nRails::HamlParser) | Use RubyGettextExtractor for Haml files | Use RubyGettextExtractor for Haml files
Signed-off-by: Michael Grosser <0de5a769f358d30e797c5fa02faa5d5330048565@gmail.com> | Ruby | mit | shkm/gettext_i18n_rails,martinpovolny/gettext_i18n_rails,ritxi/gettext_i18n_rails,grosser/gettext_i18n_rails | ruby | ## Code Before:
require 'gettext/utils'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
end
module GettextI18nRails
module HamlParser
module_function
def target?(file)
File.extname(file) == '.haml'
end
def parse(file, msgids = [])
return msgids unless load_haml
require 'gettext_i18n_rails/ruby_gettext_extractor'
text = IO.readlines(file).join
#first pass with real haml
haml = Haml::Engine.new(text)
code = haml.precompiled.split(/$/)
GetText::RubyParser.parse_lines(file, code, msgids)
end
def load_haml
return true if @haml_loaded
begin
require "#{RAILS_ROOT}/vendor/plugins/haml/lib/haml"
rescue LoadError
begin
require 'haml' # From gem
rescue LoadError
puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
return false
end
end
@haml_loaded = true
end
end
end
GetText::RGetText.add_parser(GettextI18nRails::HamlParser)
## Instruction:
Use RubyGettextExtractor for Haml files
Signed-off-by: Michael Grosser <0de5a769f358d30e797c5fa02faa5d5330048565@gmail.com>
## Code After:
require 'gettext/utils'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
end
module GettextI18nRails
module HamlParser
module_function
def target?(file)
File.extname(file) == '.haml'
end
def parse(file, msgids = [])
return msgids unless load_haml
require 'gettext_i18n_rails/ruby_gettext_extractor'
text = IO.readlines(file).join
haml = Haml::Engine.new(text)
code = haml.precompiled
return RubyGettextExtractor.parse_string(code, file, msgids)
end
def load_haml
return true if @haml_loaded
begin
require "#{RAILS_ROOT}/vendor/plugins/haml/lib/haml"
rescue LoadError
begin
require 'haml' # From gem
rescue LoadError
puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
return false
end
end
@haml_loaded = true
end
end
end
GetText::RGetText.add_parser(GettextI18nRails::HamlParser) | require 'gettext/utils'
begin
require 'gettext/tools/rgettext'
rescue LoadError #version prior to 2.0
require 'gettext/rgettext'
end
module GettextI18nRails
module HamlParser
module_function
def target?(file)
File.extname(file) == '.haml'
end
def parse(file, msgids = [])
return msgids unless load_haml
require 'gettext_i18n_rails/ruby_gettext_extractor'
text = IO.readlines(file).join
- #first pass with real haml
haml = Haml::Engine.new(text)
- code = haml.precompiled.split(/$/)
? -----------
+ code = haml.precompiled
- GetText::RubyParser.parse_lines(file, code, msgids)
+ return RubyGettextExtractor.parse_string(code, file, msgids)
end
def load_haml
return true if @haml_loaded
begin
require "#{RAILS_ROOT}/vendor/plugins/haml/lib/haml"
rescue LoadError
begin
require 'haml' # From gem
rescue LoadError
puts "A haml file was found, but haml library could not be found, so nothing will be parsed..."
return false
end
end
@haml_loaded = true
end
end
end
GetText::RGetText.add_parser(GettextI18nRails::HamlParser) | 5 | 0.113636 | 2 | 3 |
71ba6209cc79f70784914079c00401fef49983ac | package.json | package.json | {
"name": "openprovider",
"version": "0.0.1",
"description": "Openprovider api client",
"main": "index.js",
"keywords": [
"openprovider"
],
"author": "Tim Neutkens",
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.1",
"superagent": "^1.7.2",
"superagent-promise": "^1.1.0",
"xml2js": "^0.4.16"
},
"devDependencies": {
"eslint": "^2.1.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-standard": "^1.3.2",
"standard": "^6.0.5"
}
}
| {
"name": "openprovider",
"version": "1.0.0",
"description": "Openprovider api client",
"main": "index.js",
"keywords": [
"openprovider"
],
"author": "Tim Neutkens",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/timneutkens/openprovider-js"
},
"dependencies": {
"bluebird": "^3.3.1",
"superagent": "^1.7.2",
"superagent-promise": "^1.1.0",
"xml2js": "^0.4.16"
},
"devDependencies": {
"eslint": "^2.1.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-standard": "^1.3.2",
"standard": "^6.0.5"
}
}
| Change to stable version number | Change to stable version number
| JSON | mit | timneutkens/openprovider-js | json | ## Code Before:
{
"name": "openprovider",
"version": "0.0.1",
"description": "Openprovider api client",
"main": "index.js",
"keywords": [
"openprovider"
],
"author": "Tim Neutkens",
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.1",
"superagent": "^1.7.2",
"superagent-promise": "^1.1.0",
"xml2js": "^0.4.16"
},
"devDependencies": {
"eslint": "^2.1.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-standard": "^1.3.2",
"standard": "^6.0.5"
}
}
## Instruction:
Change to stable version number
## Code After:
{
"name": "openprovider",
"version": "1.0.0",
"description": "Openprovider api client",
"main": "index.js",
"keywords": [
"openprovider"
],
"author": "Tim Neutkens",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/timneutkens/openprovider-js"
},
"dependencies": {
"bluebird": "^3.3.1",
"superagent": "^1.7.2",
"superagent-promise": "^1.1.0",
"xml2js": "^0.4.16"
},
"devDependencies": {
"eslint": "^2.1.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-standard": "^1.3.2",
"standard": "^6.0.5"
}
}
| {
"name": "openprovider",
- "version": "0.0.1",
? --
+ "version": "1.0.0",
? ++
"description": "Openprovider api client",
"main": "index.js",
"keywords": [
"openprovider"
],
"author": "Tim Neutkens",
"license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/timneutkens/openprovider-js"
+ },
"dependencies": {
"bluebird": "^3.3.1",
"superagent": "^1.7.2",
"superagent-promise": "^1.1.0",
"xml2js": "^0.4.16"
},
"devDependencies": {
"eslint": "^2.1.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-standard": "^1.3.2",
"standard": "^6.0.5"
}
} | 6 | 0.26087 | 5 | 1 |
76291530aa97365b744d30ee73707994fdb88ca9 | docs/source/release-history.rst | docs/source/release-history.rst | ===============
Release History
===============
Initial Release (YYYY-MM-DD)
----------------------------
| ===============
Release History
===============
Unreleased
----------
1.0.0 (2019-08-02)
------------------
This tag marks the state of amostra when development was effectively suspended
in December 2016. Amostra is now poised for new active development that may
involve breaking changes and will be released as 2.x.
| Add 1.0.0 to release history. | Add 1.0.0 to release history.
| reStructuredText | bsd-3-clause | NSLS-II/amostra | restructuredtext | ## Code Before:
===============
Release History
===============
Initial Release (YYYY-MM-DD)
----------------------------
## Instruction:
Add 1.0.0 to release history.
## Code After:
===============
Release History
===============
Unreleased
----------
1.0.0 (2019-08-02)
------------------
This tag marks the state of amostra when development was effectively suspended
in December 2016. Amostra is now poised for new active development that may
involve breaking changes and will be released as 2.x.
| ===============
Release History
===============
- Initial Release (YYYY-MM-DD)
+ Unreleased
+ ----------
+
+ 1.0.0 (2019-08-02)
- ----------------------------
? ----------
+ ------------------
+
+ This tag marks the state of amostra when development was effectively suspended
+ in December 2016. Amostra is now poised for new active development that may
+ involve breaking changes and will be released as 2.x. | 11 | 1.833333 | 9 | 2 |
56a20c802a0f4ec9e815cc8a41eca88913b286fb | app/controllers/ajo_register/passwords_controller.rb | app/controllers/ajo_register/passwords_controller.rb | require_dependency "ajo_register/application_controller"
class AjoRegister::PasswordsController < Devise::PasswordsController
def new
super
end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
else
redirect_to request.fullpath
end
end
def destroy
super
end
def edit
super
end
def update
super
end
end | require_dependency "ajo_register/application_controller"
class AjoRegister::PasswordsController < Devise::PasswordsController
def new
super
end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
else
redirect_to :back
end
end
def destroy
super
end
def edit
super
end
def update
super
end
end | Add after sign up path | Add after sign up path
| Ruby | mit | andrewajo/AjoRegister,andrewajo/AjoRegister | ruby | ## Code Before:
require_dependency "ajo_register/application_controller"
class AjoRegister::PasswordsController < Devise::PasswordsController
def new
super
end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
else
redirect_to request.fullpath
end
end
def destroy
super
end
def edit
super
end
def update
super
end
end
## Instruction:
Add after sign up path
## Code After:
require_dependency "ajo_register/application_controller"
class AjoRegister::PasswordsController < Devise::PasswordsController
def new
super
end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
else
redirect_to :back
end
end
def destroy
super
end
def edit
super
end
def update
super
end
end | require_dependency "ajo_register/application_controller"
class AjoRegister::PasswordsController < Devise::PasswordsController
def new
super
end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
if successfully_sent?(resource)
respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
else
- redirect_to request.fullpath
+ redirect_to :back
end
end
def destroy
super
end
def edit
super
end
def update
super
end
end | 2 | 0.066667 | 1 | 1 |
288e172ded3d9142fd841f7e0692a07cbc940bd4 | app/Http/Controllers/PagesController.php | app/Http/Controllers/PagesController.php | <?php
/**
* Copyright (c) Unknown Worlds Entertainment, 2016.
* Created by Lukas Nowaczek <lukas@unknownworlds.com> <@lnowaczek>
* Visit http://unknownworlds.com/
* This file is a part of proprietary software.
*/
namespace App\Http\Controllers;
class PagesController extends BaseApiController {
public function __construct() {
}
public function index( $name ) {
return view( 'pages/' . $name );
}
}
| <?php
/**
* Copyright (c) Unknown Worlds Entertainment, 2016.
* Created by Lukas Nowaczek <lukas@unknownworlds.com> <@lnowaczek>
* Visit http://unknownworlds.com/
* This file is a part of proprietary software.
*/
namespace App\Http\Controllers;
class PagesController extends BaseApiController
{
public function __construct()
{
}
public function index($name)
{
if (!file_exists(resource_path('views/pages/' . $name . '.blade.php')))
abort(404);
return view('pages/' . $name);
}
}
| Return 404 for non-existent pages | Return 404 for non-existent pages
| PHP | mit | unknownworlds/translate,unknownworlds/translate,unknownworlds/translate,unknownworlds/translate | php | ## Code Before:
<?php
/**
* Copyright (c) Unknown Worlds Entertainment, 2016.
* Created by Lukas Nowaczek <lukas@unknownworlds.com> <@lnowaczek>
* Visit http://unknownworlds.com/
* This file is a part of proprietary software.
*/
namespace App\Http\Controllers;
class PagesController extends BaseApiController {
public function __construct() {
}
public function index( $name ) {
return view( 'pages/' . $name );
}
}
## Instruction:
Return 404 for non-existent pages
## Code After:
<?php
/**
* Copyright (c) Unknown Worlds Entertainment, 2016.
* Created by Lukas Nowaczek <lukas@unknownworlds.com> <@lnowaczek>
* Visit http://unknownworlds.com/
* This file is a part of proprietary software.
*/
namespace App\Http\Controllers;
class PagesController extends BaseApiController
{
public function __construct()
{
}
public function index($name)
{
if (!file_exists(resource_path('views/pages/' . $name . '.blade.php')))
abort(404);
return view('pages/' . $name);
}
}
| <?php
/**
- * Copyright (c) Unknown Worlds Entertainment, 2016.
? -
+ * Copyright (c) Unknown Worlds Entertainment, 2016.
* Created by Lukas Nowaczek <lukas@unknownworlds.com> <@lnowaczek>
* Visit http://unknownworlds.com/
- * This file is a part of proprietary software.
? -
+ * This file is a part of proprietary software.
*/
namespace App\Http\Controllers;
- class PagesController extends BaseApiController {
? --
+ class PagesController extends BaseApiController
+ {
- public function __construct() {
? ^ --
+ public function __construct()
? ^^^^
- }
+ {
+ }
- public function index( $name ) {
? ^ - - --
+ public function index($name)
? ^^^^
+ {
+ if (!file_exists(resource_path('views/pages/' . $name . '.blade.php')))
+ abort(404);
+
- return view( 'pages/' . $name );
? ^^ - -
+ return view('pages/' . $name);
? ^^^^^^^^
- }
+ }
} | 22 | 1.1 | 14 | 8 |
c78a315b7be34dba7314fb803edc4f13e1f2491c | packages/core/src/styles/Popover.scss | packages/core/src/styles/Popover.scss | @import "./mixins";
$component-name: #{$prefix}-popover;
.#{$component-name} {
background-color: $c-popover-background;
min-width: rem($popover-min-width);
max-width: rem($popover-max-width);
max-height: rem($popover-max-height);
padding-bottom: rem($popover-bottom-padding);
border-radius: $popover-border-radius;
filter: drop-shadow($popover-drop-shadow);
position: relative;
z-index: z(popover);
overflow-x: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
// Elements
&__arrow {
width: 0;
height: 0;
display: block;
border-color: transparent;
border-style: solid;
border-width: $popover-arrow-size;
position: absolute;
left: 50%;
margin-left: -$popover-arrow-size;
}
// Position
&--bottom {
.#{$component-name}__arrow {
top: -$popover-arrow-size;
border-top-width: 0;
border-bottom-color: $c-popover-background;
}
}
&--top {
.#{$component-name}__arrow {
bottom: -$popover-arrow-size;
border-bottom-width: 0;
border-top-color: $c-popover-background;
}
}
}
| @import "./mixins";
$component-name: #{$prefix}-popover;
.#{$component-name} {
background-color: $c-popover-background;
min-width: rem($popover-min-width);
max-width: rem($popover-max-width);
padding-bottom: rem($popover-bottom-padding);
border-radius: $popover-border-radius;
filter: drop-shadow($popover-drop-shadow);
position: relative;
z-index: z(popover);
// Elements
&__arrow {
width: 0;
height: 0;
display: block;
border-color: transparent;
border-style: solid;
border-width: $popover-arrow-size;
position: absolute;
left: 50%;
margin-left: -$popover-arrow-size;
}
&__container {
max-height: rem($popover-max-height);
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
// Position
&--bottom {
.#{$component-name}__arrow {
top: -$popover-arrow-size;
border-top-width: 0;
border-bottom-color: $c-popover-background;
}
}
&--top {
.#{$component-name}__arrow {
bottom: -$popover-arrow-size;
border-bottom-width: 0;
border-top-color: $c-popover-background;
}
}
}
| Fix popover should only scroll inside container | Fix popover should only scroll inside container
| SCSS | apache-2.0 | iCHEF/gypcrete,iCHEF/gypcrete | scss | ## Code Before:
@import "./mixins";
$component-name: #{$prefix}-popover;
.#{$component-name} {
background-color: $c-popover-background;
min-width: rem($popover-min-width);
max-width: rem($popover-max-width);
max-height: rem($popover-max-height);
padding-bottom: rem($popover-bottom-padding);
border-radius: $popover-border-radius;
filter: drop-shadow($popover-drop-shadow);
position: relative;
z-index: z(popover);
overflow-x: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
// Elements
&__arrow {
width: 0;
height: 0;
display: block;
border-color: transparent;
border-style: solid;
border-width: $popover-arrow-size;
position: absolute;
left: 50%;
margin-left: -$popover-arrow-size;
}
// Position
&--bottom {
.#{$component-name}__arrow {
top: -$popover-arrow-size;
border-top-width: 0;
border-bottom-color: $c-popover-background;
}
}
&--top {
.#{$component-name}__arrow {
bottom: -$popover-arrow-size;
border-bottom-width: 0;
border-top-color: $c-popover-background;
}
}
}
## Instruction:
Fix popover should only scroll inside container
## Code After:
@import "./mixins";
$component-name: #{$prefix}-popover;
.#{$component-name} {
background-color: $c-popover-background;
min-width: rem($popover-min-width);
max-width: rem($popover-max-width);
padding-bottom: rem($popover-bottom-padding);
border-radius: $popover-border-radius;
filter: drop-shadow($popover-drop-shadow);
position: relative;
z-index: z(popover);
// Elements
&__arrow {
width: 0;
height: 0;
display: block;
border-color: transparent;
border-style: solid;
border-width: $popover-arrow-size;
position: absolute;
left: 50%;
margin-left: -$popover-arrow-size;
}
&__container {
max-height: rem($popover-max-height);
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
// Position
&--bottom {
.#{$component-name}__arrow {
top: -$popover-arrow-size;
border-top-width: 0;
border-bottom-color: $c-popover-background;
}
}
&--top {
.#{$component-name}__arrow {
bottom: -$popover-arrow-size;
border-bottom-width: 0;
border-top-color: $c-popover-background;
}
}
}
| @import "./mixins";
$component-name: #{$prefix}-popover;
.#{$component-name} {
background-color: $c-popover-background;
min-width: rem($popover-min-width);
max-width: rem($popover-max-width);
- max-height: rem($popover-max-height);
padding-bottom: rem($popover-bottom-padding);
border-radius: $popover-border-radius;
filter: drop-shadow($popover-drop-shadow);
position: relative;
z-index: z(popover);
- overflow-x: 0;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
// Elements
&__arrow {
width: 0;
height: 0;
display: block;
border-color: transparent;
border-style: solid;
border-width: $popover-arrow-size;
position: absolute;
left: 50%;
margin-left: -$popover-arrow-size;
+ }
+
+ &__container {
+ max-height: rem($popover-max-height);
+ overflow-x: hidden;
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
}
// Position
&--bottom {
.#{$component-name}__arrow {
top: -$popover-arrow-size;
border-top-width: 0;
border-bottom-color: $c-popover-background;
}
}
&--top {
.#{$component-name}__arrow {
bottom: -$popover-arrow-size;
border-bottom-width: 0;
border-top-color: $c-popover-background;
}
}
} | 11 | 0.234043 | 7 | 4 |
84d20874e675c254d6a6b94d810fcd4aaf4abdc2 | test-helpers/factories/user.js | test-helpers/factories/user.js | import uuid from 'uuid';
import bcrypt from 'bcrypt';
import { Factory } from 'rosie';
import faker from 'faker';
import { bookshelf } from '../db';
const User = bookshelf.model('User');
const UserFactory = new Factory()
.attr('id', () => uuid.v4())
.attr('created_at', () => faker.date.recent())
.attr('updated_at', () => faker.date.recent())
.attr('username', () => faker.internet.userName().toLowerCase())
.attr('email', () => faker.internet.email())
.attr('password', () => faker.internet.password())
.attr('hashed_password', ['password'], password => bcrypt.hashSync(password, 10))
.attr('email_check_hash', '')
.attr('more', {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
first_login: false
});
export default UserFactory;
export async function createUser(attrs = {}) {
const userAttrs = UserFactory.build(attrs);
const user = await User.create(userAttrs);
await user.save({ email_check_hash: null }, { method: 'update' });
user.attributes.password = userAttrs.password;
return user;
}
| import { omit } from 'lodash';
import uuid from 'uuid';
import bcrypt from 'bcrypt';
import { Factory } from 'rosie';
import faker from 'faker';
import { bookshelf } from '../db';
const User = bookshelf.model('User');
const UserFactory = new Factory()
.attr('id', () => uuid.v4())
.attr('created_at', () => faker.date.recent())
.attr('updated_at', () => faker.date.recent())
.attr('username', () => faker.internet.userName().toLowerCase())
.attr('email', () => faker.internet.email())
.attr('password', () => faker.internet.password())
.attr('hashed_password', ['password'], password => bcrypt.hashSync(password, 10))
.attr('email_check_hash', () => Math.random().toString())
.attr('more', {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
first_login: false
});
export default UserFactory;
export async function createUser(attrs = {}) {
const userAttrs = UserFactory.build(attrs);
const user = await new User(omit(userAttrs, 'password')).save(null, { method: 'insert' });
await user.save({ email_check_hash: attrs.email_check_hash || null }, { method: 'update' });
user.attributes.password = userAttrs.password;
return user;
}
| Add ability to specify email_check_hash for createUser | Add ability to specify email_check_hash for createUser
| JavaScript | agpl-3.0 | Lokiedu/libertysoil-site,Lokiedu/libertysoil-site | javascript | ## Code Before:
import uuid from 'uuid';
import bcrypt from 'bcrypt';
import { Factory } from 'rosie';
import faker from 'faker';
import { bookshelf } from '../db';
const User = bookshelf.model('User');
const UserFactory = new Factory()
.attr('id', () => uuid.v4())
.attr('created_at', () => faker.date.recent())
.attr('updated_at', () => faker.date.recent())
.attr('username', () => faker.internet.userName().toLowerCase())
.attr('email', () => faker.internet.email())
.attr('password', () => faker.internet.password())
.attr('hashed_password', ['password'], password => bcrypt.hashSync(password, 10))
.attr('email_check_hash', '')
.attr('more', {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
first_login: false
});
export default UserFactory;
export async function createUser(attrs = {}) {
const userAttrs = UserFactory.build(attrs);
const user = await User.create(userAttrs);
await user.save({ email_check_hash: null }, { method: 'update' });
user.attributes.password = userAttrs.password;
return user;
}
## Instruction:
Add ability to specify email_check_hash for createUser
## Code After:
import { omit } from 'lodash';
import uuid from 'uuid';
import bcrypt from 'bcrypt';
import { Factory } from 'rosie';
import faker from 'faker';
import { bookshelf } from '../db';
const User = bookshelf.model('User');
const UserFactory = new Factory()
.attr('id', () => uuid.v4())
.attr('created_at', () => faker.date.recent())
.attr('updated_at', () => faker.date.recent())
.attr('username', () => faker.internet.userName().toLowerCase())
.attr('email', () => faker.internet.email())
.attr('password', () => faker.internet.password())
.attr('hashed_password', ['password'], password => bcrypt.hashSync(password, 10))
.attr('email_check_hash', () => Math.random().toString())
.attr('more', {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
first_login: false
});
export default UserFactory;
export async function createUser(attrs = {}) {
const userAttrs = UserFactory.build(attrs);
const user = await new User(omit(userAttrs, 'password')).save(null, { method: 'insert' });
await user.save({ email_check_hash: attrs.email_check_hash || null }, { method: 'update' });
user.attributes.password = userAttrs.password;
return user;
}
| + import { omit } from 'lodash';
import uuid from 'uuid';
import bcrypt from 'bcrypt';
import { Factory } from 'rosie';
import faker from 'faker';
import { bookshelf } from '../db';
const User = bookshelf.model('User');
const UserFactory = new Factory()
.attr('id', () => uuid.v4())
.attr('created_at', () => faker.date.recent())
.attr('updated_at', () => faker.date.recent())
.attr('username', () => faker.internet.userName().toLowerCase())
.attr('email', () => faker.internet.email())
.attr('password', () => faker.internet.password())
.attr('hashed_password', ['password'], password => bcrypt.hashSync(password, 10))
- .attr('email_check_hash', '')
+ .attr('email_check_hash', () => Math.random().toString())
.attr('more', {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
first_login: false
});
export default UserFactory;
export async function createUser(attrs = {}) {
const userAttrs = UserFactory.build(attrs);
- const user = await User.create(userAttrs);
+ const user = await new User(omit(userAttrs, 'password')).save(null, { method: 'insert' });
- await user.save({ email_check_hash: null }, { method: 'update' });
+ await user.save({ email_check_hash: attrs.email_check_hash || null }, { method: 'update' });
? ++++++++++++++++++++++++++
user.attributes.password = userAttrs.password;
return user;
} | 7 | 0.2 | 4 | 3 |
0ef42cef4caafd4694291fa5ec87486c18ba9a30 | server.js | server.js | var app = require('./server/server-config.js');
var models = require('./server/db/orm-model.js');
var models = models();
var User = models.User;
var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set('port', process.env.PORT || 4568);
app.listen(app.get('port'));
//will replace this with db
var storage = {};
app.post('/', function(req, res) {
storage[req.body.user_id] = req.body;
console.log(storage);
//User.findOrCreate({where: {userId: req.body.user_id.slice(7)})
User.upsert({
userId: req.body.user_id.slice(7),
email: req.body.email,
picture: req.body.picture,
name: req.body.name,
nickname:req.body.nickname});
res.sendStatus(200);
});
app.get('/', function(req, res){
console.log(storage);
res.sendStatus(200);
});
console.log('Server listening on port ', app.get('port')); | var app = require('./server/server-config.js');
var models = require('./server/db/orm-model.js');
var models = models();
var User = models.User;
var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set('port', process.env.PORT || 4568);
app.listen(app.get('port'));
//will replace this with db
var storage = {};
app.post('/', function(req, res) {
//User.findOrCreate({where: {userId: req.body.user_id.slice(7)})
User.upsert({
userId: req.body.user_id.slice(7),
email: req.body.email,
picture: req.body.picture,
name: req.body.name,
nickname:req.body.nickname});
res.sendStatus(200);
});
app.get('/', function(req, res){
res.sendStatus(200);
});
console.log('Server listening on port ', app.get('port')); | Remove uneccesary console.log and storage. | Remove uneccesary console.log and storage.
| JavaScript | mit | hmfoster/beards-of-zeus,hmfoster/beards-of-zeus,marqshort/beards-of-zeus,hmfoster/beards-of-zeus,beards-of-zeus/beards-of-zeus,beards-of-zeus/beards-of-zeus,marqshort/beards-of-zeus,kevinwchiang/beards-of-zeus,marqshort/beards-of-zeus,beards-of-zeus/beards-of-zeus,kevinwchiang/beards-of-zeus,kevinwchiang/beards-of-zeus | javascript | ## Code Before:
var app = require('./server/server-config.js');
var models = require('./server/db/orm-model.js');
var models = models();
var User = models.User;
var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set('port', process.env.PORT || 4568);
app.listen(app.get('port'));
//will replace this with db
var storage = {};
app.post('/', function(req, res) {
storage[req.body.user_id] = req.body;
console.log(storage);
//User.findOrCreate({where: {userId: req.body.user_id.slice(7)})
User.upsert({
userId: req.body.user_id.slice(7),
email: req.body.email,
picture: req.body.picture,
name: req.body.name,
nickname:req.body.nickname});
res.sendStatus(200);
});
app.get('/', function(req, res){
console.log(storage);
res.sendStatus(200);
});
console.log('Server listening on port ', app.get('port'));
## Instruction:
Remove uneccesary console.log and storage.
## Code After:
var app = require('./server/server-config.js');
var models = require('./server/db/orm-model.js');
var models = models();
var User = models.User;
var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set('port', process.env.PORT || 4568);
app.listen(app.get('port'));
//will replace this with db
var storage = {};
app.post('/', function(req, res) {
//User.findOrCreate({where: {userId: req.body.user_id.slice(7)})
User.upsert({
userId: req.body.user_id.slice(7),
email: req.body.email,
picture: req.body.picture,
name: req.body.name,
nickname:req.body.nickname});
res.sendStatus(200);
});
app.get('/', function(req, res){
res.sendStatus(200);
});
console.log('Server listening on port ', app.get('port')); | var app = require('./server/server-config.js');
var models = require('./server/db/orm-model.js');
var models = models();
var User = models.User;
var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set('port', process.env.PORT || 4568);
app.listen(app.get('port'));
//will replace this with db
var storage = {};
app.post('/', function(req, res) {
- storage[req.body.user_id] = req.body;
- console.log(storage);
//User.findOrCreate({where: {userId: req.body.user_id.slice(7)})
User.upsert({
userId: req.body.user_id.slice(7),
email: req.body.email,
picture: req.body.picture,
name: req.body.name,
nickname:req.body.nickname});
res.sendStatus(200);
});
app.get('/', function(req, res){
- console.log(storage);
res.sendStatus(200);
});
console.log('Server listening on port ', app.get('port')); | 3 | 0.081081 | 0 | 3 |
662101e89943fe62b7036894140272e2f9ea4f78 | ibmcnx/test/test.py | ibmcnx/test/test.py | import ibmcnx.test.loadFunction
loadFilesService()
FilesPolicyService.browse( "title", "true", 1, 25 )
| import ibmcnx.test.loadFunction
ibmcnx.test.loadFunction.loadFilesService()
FilesPolicyService.browse( "title", "true", 1, 25 )
| Customize scripts to work with menu | Customize scripts to work with menu
| Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | python | ## Code Before:
import ibmcnx.test.loadFunction
loadFilesService()
FilesPolicyService.browse( "title", "true", 1, 25 )
## Instruction:
Customize scripts to work with menu
## Code After:
import ibmcnx.test.loadFunction
ibmcnx.test.loadFunction.loadFilesService()
FilesPolicyService.browse( "title", "true", 1, 25 )
| import ibmcnx.test.loadFunction
- loadFilesService()
+ ibmcnx.test.loadFunction.loadFilesService()
FilesPolicyService.browse( "title", "true", 1, 25 ) | 2 | 0.4 | 1 | 1 |
6a1ada0ceab00726f3bcbb3b4728a72b2f7eeec2 | guides/faq.md | guides/faq.md | ---
layout: guide
doc_stub: false
search: true
title: FAQ
other: true
desc: How to do common tasks
---
Returning Route URLs
====================
With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can add the Rails route helpers to the execution context as shown below.
Example
-------
```ruby
class Types::UserType < Types::BaseObject
field :profile_url, String, null: false
def profile_url
context[:routes].user_url(object)
end
end
# Add the url helpers to `context`:
MySchema.execute(
params[:query],
variables: params[:variables],
context: {
routes: Rails.application.routes.url_helpers,
# ...
},
)
```
| ---
layout: guide
doc_stub: false
search: true
title: FAQ
other: true
desc: How to do common tasks
---
Returning Route URLs
====================
With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can pass the request to your context, so that the helpers are able to build full URLs based on the incoming host, port and protocol.
Example
-------
```ruby
class Types::UserType < Types::BaseObject
include ActionController::UrlFor
include Rails.application.routes.url_helpers
# Needed by ActionController::UrlFor to extract the host, port, protocol etc. from the current request
def request
context[:request]
end
# Needed by Rails.application.routes.url_helpers, it will then use the url_options defined by ActionController::UrlFor
def default_url_options
{}
end
field :profile_url, String, null: false
def profile_url
user_url(object)
end
end
# In your GraphQL controller, add the request to `context`:
MySchema.execute(
params[:query],
variables: params[:variables],
context: {
request: request
},
)
```
Returning ActiveStorage blob URLs
=================================
If you are using ActiveStorage and need to return a URL to an attachment blob, you will find that using `Rails.application.routes.url_helpers.rails_blob_url` alone will throw an exception since Rails won't know what host, port or protocol to use in it.
You can include `ActiveStorage::SetCurrent` in your GraphQL controller to pass on this information into your resolvers.
Example
=======
```ruby
class GraphqlController < ApplicationController
include ActiveStorage::SetCurrent
...
end
class Types::UserType < Types::BaseObject
field :picture_url, String, null: false
def picture_url
Rails.application.routes.url_helpers.rails_blob_url(
object.picture,
protocol: ActiveStorage::Current.url_options[:protocol],
host: ActiveStorage::Current.url_options[:host],
port: ActiveStorage::Current.url_options[:port]
)
end
end
```
| Add example of using url_helpers in resolvers | Add example of using url_helpers in resolvers
A problem I’ve been struggling with is generating URLs within the resolvers using the current host and port. A common solution is to set `Rails.application.routes.default_url_options`, but this is static and with my current setup I need to be able to return the host actually used within the request (My development environment runs over both http and https, so I can’t just hardcode localhost:3000).
A solution I’ve found is to pass the controller’s request into the context, and use the `ActionController::UrlFor` concern.
And likewise for Active Storage, `ActiveStorage::SetCurrent` works similarly.
I thought it might be useful to share this with anyone else running into this use case. | Markdown | mit | nevesenin/graphql-ruby,rmosolgo/graphql-ruby,nevesenin/graphql-ruby,nevesenin/graphql-ruby,rmosolgo/graphql-ruby,rmosolgo/graphql-ruby,nevesenin/graphql-ruby,rmosolgo/graphql-ruby | markdown | ## Code Before:
---
layout: guide
doc_stub: false
search: true
title: FAQ
other: true
desc: How to do common tasks
---
Returning Route URLs
====================
With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can add the Rails route helpers to the execution context as shown below.
Example
-------
```ruby
class Types::UserType < Types::BaseObject
field :profile_url, String, null: false
def profile_url
context[:routes].user_url(object)
end
end
# Add the url helpers to `context`:
MySchema.execute(
params[:query],
variables: params[:variables],
context: {
routes: Rails.application.routes.url_helpers,
# ...
},
)
```
## Instruction:
Add example of using url_helpers in resolvers
A problem I’ve been struggling with is generating URLs within the resolvers using the current host and port. A common solution is to set `Rails.application.routes.default_url_options`, but this is static and with my current setup I need to be able to return the host actually used within the request (My development environment runs over both http and https, so I can’t just hardcode localhost:3000).
A solution I’ve found is to pass the controller’s request into the context, and use the `ActionController::UrlFor` concern.
And likewise for Active Storage, `ActiveStorage::SetCurrent` works similarly.
I thought it might be useful to share this with anyone else running into this use case.
## Code After:
---
layout: guide
doc_stub: false
search: true
title: FAQ
other: true
desc: How to do common tasks
---
Returning Route URLs
====================
With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can pass the request to your context, so that the helpers are able to build full URLs based on the incoming host, port and protocol.
Example
-------
```ruby
class Types::UserType < Types::BaseObject
include ActionController::UrlFor
include Rails.application.routes.url_helpers
# Needed by ActionController::UrlFor to extract the host, port, protocol etc. from the current request
def request
context[:request]
end
# Needed by Rails.application.routes.url_helpers, it will then use the url_options defined by ActionController::UrlFor
def default_url_options
{}
end
field :profile_url, String, null: false
def profile_url
user_url(object)
end
end
# In your GraphQL controller, add the request to `context`:
MySchema.execute(
params[:query],
variables: params[:variables],
context: {
request: request
},
)
```
Returning ActiveStorage blob URLs
=================================
If you are using ActiveStorage and need to return a URL to an attachment blob, you will find that using `Rails.application.routes.url_helpers.rails_blob_url` alone will throw an exception since Rails won't know what host, port or protocol to use in it.
You can include `ActiveStorage::SetCurrent` in your GraphQL controller to pass on this information into your resolvers.
Example
=======
```ruby
class GraphqlController < ApplicationController
include ActiveStorage::SetCurrent
...
end
class Types::UserType < Types::BaseObject
field :picture_url, String, null: false
def picture_url
Rails.application.routes.url_helpers.rails_blob_url(
object.picture,
protocol: ActiveStorage::Current.url_options[:protocol],
host: ActiveStorage::Current.url_options[:host],
port: ActiveStorage::Current.url_options[:port]
)
end
end
```
| ---
layout: guide
doc_stub: false
search: true
title: FAQ
other: true
desc: How to do common tasks
---
Returning Route URLs
====================
- With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can add the Rails route helpers to the execution context as shown below.
? ----------------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
+ With GraphQL there is less of a need to include resource URLs to other REST resources, however sometimes you want to use Rails routing to include a URL as one of your fields. A common use case would be to build HTML format URLs to render a link in your React UI. In that case you can pass the request to your context, so that the helpers are able to build full URLs based on the incoming host, port and protocol.
? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example
-------
```ruby
class Types::UserType < Types::BaseObject
+ include ActionController::UrlFor
+ include Rails.application.routes.url_helpers
+ # Needed by ActionController::UrlFor to extract the host, port, protocol etc. from the current request
+ def request
+ context[:request]
+ end
+ # Needed by Rails.application.routes.url_helpers, it will then use the url_options defined by ActionController::UrlFor
+ def default_url_options
+ {}
+ end
+
field :profile_url, String, null: false
def profile_url
- context[:routes].user_url(object)
+ user_url(object)
end
end
- # Add the url helpers to `context`:
+ # In your GraphQL controller, add the request to `context`:
MySchema.execute(
params[:query],
variables: params[:variables],
context: {
+ request: request
- routes: Rails.application.routes.url_helpers,
- # ...
},
)
```
+
+ Returning ActiveStorage blob URLs
+ =================================
+ If you are using ActiveStorage and need to return a URL to an attachment blob, you will find that using `Rails.application.routes.url_helpers.rails_blob_url` alone will throw an exception since Rails won't know what host, port or protocol to use in it.
+ You can include `ActiveStorage::SetCurrent` in your GraphQL controller to pass on this information into your resolvers.
+
+ Example
+ =======
+
+ ```ruby
+ class GraphqlController < ApplicationController
+ include ActiveStorage::SetCurrent
+ ...
+ end
+
+ class Types::UserType < Types::BaseObject
+ field :picture_url, String, null: false
+ def picture_url
+ Rails.application.routes.url_helpers.rails_blob_url(
+ object.picture,
+ protocol: ActiveStorage::Current.url_options[:protocol],
+ host: ActiveStorage::Current.url_options[:host],
+ port: ActiveStorage::Current.url_options[:port]
+ )
+ end
+ end
+ ``` | 47 | 1.382353 | 42 | 5 |
9acd67777acea3d237631ed67ea162c0ba0a6640 | lib/palette-element.coffee | lib/palette-element.coffee | class PaletteElement extends HTMLElement
getModel: -> @palette
setModel: (@palette) ->
module.exports = PaletteElement =
document.registerElement 'pigments-palette', {
prototype: PaletteElement.prototype
}
PaletteElement.registerViewProvider = (modelClass) ->
atom.views.addViewProvider modelClass, (model) ->
element = new PaletteElement
element.setModel(model)
element
| class PaletteElement extends HTMLElement
getTitle: -> 'Palette'
getURI: -> 'pigments://palette'
getIconName: -> "pigments"
getModel: -> @palette
setModel: (@palette) ->
module.exports = PaletteElement =
document.registerElement 'pigments-palette', {
prototype: PaletteElement.prototype
}
PaletteElement.registerViewProvider = (modelClass) ->
atom.views.addViewProvider modelClass, (model) ->
element = new PaletteElement
element.setModel(model)
element
| Add tab meta methods on palette element | Add tab meta methods on palette element
| CoffeeScript | mit | peter1000/atom-pigments,peter1000/atom-pigments | coffeescript | ## Code Before:
class PaletteElement extends HTMLElement
getModel: -> @palette
setModel: (@palette) ->
module.exports = PaletteElement =
document.registerElement 'pigments-palette', {
prototype: PaletteElement.prototype
}
PaletteElement.registerViewProvider = (modelClass) ->
atom.views.addViewProvider modelClass, (model) ->
element = new PaletteElement
element.setModel(model)
element
## Instruction:
Add tab meta methods on palette element
## Code After:
class PaletteElement extends HTMLElement
getTitle: -> 'Palette'
getURI: -> 'pigments://palette'
getIconName: -> "pigments"
getModel: -> @palette
setModel: (@palette) ->
module.exports = PaletteElement =
document.registerElement 'pigments-palette', {
prototype: PaletteElement.prototype
}
PaletteElement.registerViewProvider = (modelClass) ->
atom.views.addViewProvider modelClass, (model) ->
element = new PaletteElement
element.setModel(model)
element
| class PaletteElement extends HTMLElement
+
+ getTitle: -> 'Palette'
+
+ getURI: -> 'pigments://palette'
+
+ getIconName: -> "pigments"
+
getModel: -> @palette
setModel: (@palette) ->
module.exports = PaletteElement =
document.registerElement 'pigments-palette', {
prototype: PaletteElement.prototype
}
PaletteElement.registerViewProvider = (modelClass) ->
atom.views.addViewProvider modelClass, (model) ->
element = new PaletteElement
element.setModel(model)
element | 7 | 0.466667 | 7 | 0 |
51348b767fa659eb43e9e4568db2b22508c1e28a | requirements-test.txt | requirements-test.txt | -r requirements.txt
mock==1.0.1
responses
pytest
pytest-cov
pytest-sugar
pytest-catchlog
| -r requirements.txt
mock==1.0.1
responses
pytest~=3.4.0
pytest-cov
pytest-sugar
| Remove pytest-caplog from requirements and update the required pytest version. pytest-caplog is now part of pytest core. | Remove pytest-caplog from requirements and update the required pytest
version. pytest-caplog is now part of pytest core.
| Text | bsd-3-clause | koordinates/python-client,koordinates/python-client | text | ## Code Before:
-r requirements.txt
mock==1.0.1
responses
pytest
pytest-cov
pytest-sugar
pytest-catchlog
## Instruction:
Remove pytest-caplog from requirements and update the required pytest
version. pytest-caplog is now part of pytest core.
## Code After:
-r requirements.txt
mock==1.0.1
responses
pytest~=3.4.0
pytest-cov
pytest-sugar
| -r requirements.txt
mock==1.0.1
responses
- pytest
+ pytest~=3.4.0
pytest-cov
pytest-sugar
- pytest-catchlog | 3 | 0.375 | 1 | 2 |
921d1ec6d3ff12a7afc8513166f30998c5a3587a | .travis.yml | .travis.yml | language: node_js
node_js:
- "6.0.0"
- "7"
- "8"
- "9"
- "--lts"
os:
- windows
- linux
- osx | language: node_js
node_js:
- "6.0.0"
- "--lts"
os:
- linux
- osx | Reduce the number of needed tests. | Reduce the number of needed tests.
| YAML | mit | bertolo1988/saco | yaml | ## Code Before:
language: node_js
node_js:
- "6.0.0"
- "7"
- "8"
- "9"
- "--lts"
os:
- windows
- linux
- osx
## Instruction:
Reduce the number of needed tests.
## Code After:
language: node_js
node_js:
- "6.0.0"
- "--lts"
os:
- linux
- osx | language: node_js
node_js:
- "6.0.0"
- - "7"
- - "8"
- - "9"
- "--lts"
os:
- - windows
- linux
- osx | 4 | 0.363636 | 0 | 4 |
12daca61e30314e9e57e663200b5cacbaf163568 | blocks/worldskills_skill/view.php | blocks/worldskills_skill/view.php |
<?php if ($skill): ?>
<?php foreach ($skill['photos'] as $photo): ?>
<img src="<?php echo h($photo['thumbnail']); ?>_small" class="img-responsive" alt="">
<?php break; ?>
<?php endforeach; ?>
<h1><?php echo h($skill['name']['text']); ?></h1>
<p><?php echo $skill['description']['text']; ?></p>
<?php else: ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty skill block.')?></div>
<?php endif; ?>
|
<?php if ($skill && isset($skill['name'])): ?>
<?php foreach ($skill['photos'] as $photo): ?>
<img src="<?php echo h($photo['thumbnail']); ?>_small" class="img-responsive" alt="">
<?php break; ?>
<?php endforeach; ?>
<h1><?php echo h($skill['name']['text']); ?></h1>
<p><?php echo $skill['description']['text']; ?></p>
<?php else: ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty skill block.')?></div>
<?php endif; ?>
| Check if Skill is found in Skill block | Check if Skill is found in Skill block
| PHP | mit | worldskills/concrete5-worldskills,worldskills/concrete5-worldskills | php | ## Code Before:
<?php if ($skill): ?>
<?php foreach ($skill['photos'] as $photo): ?>
<img src="<?php echo h($photo['thumbnail']); ?>_small" class="img-responsive" alt="">
<?php break; ?>
<?php endforeach; ?>
<h1><?php echo h($skill['name']['text']); ?></h1>
<p><?php echo $skill['description']['text']; ?></p>
<?php else: ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty skill block.')?></div>
<?php endif; ?>
## Instruction:
Check if Skill is found in Skill block
## Code After:
<?php if ($skill && isset($skill['name'])): ?>
<?php foreach ($skill['photos'] as $photo): ?>
<img src="<?php echo h($photo['thumbnail']); ?>_small" class="img-responsive" alt="">
<?php break; ?>
<?php endforeach; ?>
<h1><?php echo h($skill['name']['text']); ?></h1>
<p><?php echo $skill['description']['text']; ?></p>
<?php else: ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty skill block.')?></div>
<?php endif; ?>
|
- <?php if ($skill): ?>
+ <?php if ($skill && isset($skill['name'])): ?>
<?php foreach ($skill['photos'] as $photo): ?>
<img src="<?php echo h($photo['thumbnail']); ?>_small" class="img-responsive" alt="">
<?php break; ?>
<?php endforeach; ?>
<h1><?php echo h($skill['name']['text']); ?></h1>
<p><?php echo $skill['description']['text']; ?></p>
<?php else: ?>
<div class="ccm-edit-mode-disabled-item"><?php echo t('Empty skill block.')?></div>
<?php endif; ?> | 2 | 0.133333 | 1 | 1 |
280ce22dac57ada73f44792f94b8df5cb54b74b9 | web_modules/WayFinder/index.css | web_modules/WayFinder/index.css | .root {
padding: 1rem;
}
.items {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 1rem;
}
.item {
background: #475871;
margin-bottom: 1px;
width: 15rem;
&:first-child {
border-radius: 5px 5px 0 0;
}
&:last-child {
border-radius: 0 0 5px 5px;
}
}
.itemLink {
color: #faf8f5;
display: block;
font-size: 16px;
font-weight: bold;
line-height: 20px;
padding: 1.25rem 2rem;
text-align: center;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
@media (width > 720px) {
.items {
flex-direction: row;
}
.item {
margin-right: 1px;
width: auto;
&:first-child {
border-radius: 5px 0 0 5px;
}
&:last-child {
border-radius: 0 5px 5px 0;
}
}
}
| .root {
padding: 1rem;
}
.items {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 1rem;
}
.item {
background: #475871;
margin-bottom: 1px;
font-family: sans-serif;
width: 15rem;
&:first-child {
border-radius: 5px 5px 0 0;
}
&:last-child {
border-radius: 0 0 5px 5px;
}
}
:global(.fira-sans-loaded) .item {
font-family: "Fira Sans", sans-serif;
}
.itemLink {
color: #faf8f5;
display: block;
font-size: 16px;
line-height: 20px;
padding: 1.25rem 2rem;
text-align: center;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
@media (width > 720px) {
.items {
flex-direction: row;
}
.item {
margin-right: 1px;
width: auto;
&:first-child {
border-radius: 5px 0 0 5px;
}
&:last-child {
border-radius: 0 5px 5px 0;
}
}
}
| Use Fira Sans for WayFinder | Use Fira Sans for WayFinder
| CSS | mit | postcss/postcss.org,postcss/postcss.org | css | ## Code Before:
.root {
padding: 1rem;
}
.items {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 1rem;
}
.item {
background: #475871;
margin-bottom: 1px;
width: 15rem;
&:first-child {
border-radius: 5px 5px 0 0;
}
&:last-child {
border-radius: 0 0 5px 5px;
}
}
.itemLink {
color: #faf8f5;
display: block;
font-size: 16px;
font-weight: bold;
line-height: 20px;
padding: 1.25rem 2rem;
text-align: center;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
@media (width > 720px) {
.items {
flex-direction: row;
}
.item {
margin-right: 1px;
width: auto;
&:first-child {
border-radius: 5px 0 0 5px;
}
&:last-child {
border-radius: 0 5px 5px 0;
}
}
}
## Instruction:
Use Fira Sans for WayFinder
## Code After:
.root {
padding: 1rem;
}
.items {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 1rem;
}
.item {
background: #475871;
margin-bottom: 1px;
font-family: sans-serif;
width: 15rem;
&:first-child {
border-radius: 5px 5px 0 0;
}
&:last-child {
border-radius: 0 0 5px 5px;
}
}
:global(.fira-sans-loaded) .item {
font-family: "Fira Sans", sans-serif;
}
.itemLink {
color: #faf8f5;
display: block;
font-size: 16px;
line-height: 20px;
padding: 1.25rem 2rem;
text-align: center;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
@media (width > 720px) {
.items {
flex-direction: row;
}
.item {
margin-right: 1px;
width: auto;
&:first-child {
border-radius: 5px 0 0 5px;
}
&:last-child {
border-radius: 0 5px 5px 0;
}
}
}
| .root {
padding: 1rem;
}
.items {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 1rem;
}
.item {
background: #475871;
margin-bottom: 1px;
+ font-family: sans-serif;
width: 15rem;
&:first-child {
border-radius: 5px 5px 0 0;
}
&:last-child {
border-radius: 0 0 5px 5px;
}
}
+ :global(.fira-sans-loaded) .item {
+ font-family: "Fira Sans", sans-serif;
+ }
+
.itemLink {
color: #faf8f5;
display: block;
font-size: 16px;
- font-weight: bold;
line-height: 20px;
padding: 1.25rem 2rem;
text-align: center;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
@media (width > 720px) {
.items {
flex-direction: row;
}
.item {
margin-right: 1px;
width: auto;
&:first-child {
border-radius: 5px 0 0 5px;
}
&:last-child {
border-radius: 0 5px 5px 0;
}
}
} | 6 | 0.101695 | 5 | 1 |
5327f9050c9d48359f7b99e1fd11f1e0a69ef8d7 | .conda/meta.yaml | .conda/meta.yaml | package:
name: ndtypes
version: 0.2.0b1
requirements:
build:
- python >=3.6
run:
- python >=3.6
about:
home: https://github.com/plures/
license: BSD
| package:
name: ndtypes
version: 0.2.0b1
requirements:
build:
- python >=3.6
- bison # [not win]
- flex # [not win]
- m4 # [not win]
run:
- python >=3.6
about:
home: https://github.com/plures/
license: BSD
| Use conda-supplied bison, flex and m4 in order make sure these are CI-tested. | Use conda-supplied bison, flex and m4 in order make sure these are CI-tested.
| YAML | bsd-3-clause | plures/ndtypes,plures/ndtypes,skrah/ndtypes,plures/ndtypes,skrah/ndtypes,skrah/ndtypes,skrah/ndtypes,plures/ndtypes | yaml | ## Code Before:
package:
name: ndtypes
version: 0.2.0b1
requirements:
build:
- python >=3.6
run:
- python >=3.6
about:
home: https://github.com/plures/
license: BSD
## Instruction:
Use conda-supplied bison, flex and m4 in order make sure these are CI-tested.
## Code After:
package:
name: ndtypes
version: 0.2.0b1
requirements:
build:
- python >=3.6
- bison # [not win]
- flex # [not win]
- m4 # [not win]
run:
- python >=3.6
about:
home: https://github.com/plures/
license: BSD
| package:
name: ndtypes
version: 0.2.0b1
requirements:
build:
- python >=3.6
+ - bison # [not win]
+ - flex # [not win]
+ - m4 # [not win]
run:
- python >=3.6
about:
home: https://github.com/plures/
license: BSD | 3 | 0.230769 | 3 | 0 |
b86125accf7d91f61406596ed3309ea9d4cc2dc4 | stdlib/public/stubs/CMakeLists.txt | stdlib/public/stubs/CMakeLists.txt | set(swift_stubs_objc_sources)
set(swift_stubs_unicode_normalization_sources)
if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
set(swift_stubs_objc_sources
Availability.mm
DispatchShims.mm
FoundationHelpers.mm
OptionalBridgingHelper.mm
Reflection.mm
SwiftNativeNSXXXBase.mm.gyb)
set(LLVM_OPTIONAL_SOURCES
UnicodeNormalization.cpp)
else()
find_package(ICU REQUIRED COMPONENTS uc i18n)
set(swift_stubs_unicode_normalization_sources
UnicodeNormalization.cpp)
endif()
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
Assert.cpp
CommandLine.cpp
GlobalObjects.cpp
LibcShims.cpp
Stubs.cpp
UnicodeExtendedGraphemeClusters.cpp.gyb
${swift_stubs_objc_sources}
${swift_stubs_unicode_normalization_sources}
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS} -DswiftCore_EXPORTS
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
INSTALL_IN_COMPONENT stdlib)
| set(swift_stubs_sources
Assert.cpp
CommandLine.cpp
GlobalObjects.cpp
LibcShims.cpp
Stubs.cpp
UnicodeExtendedGraphemeClusters.cpp.gyb)
set(swift_stubs_objc_sources
Availability.mm
DispatchShims.mm
FoundationHelpers.mm
OptionalBridgingHelper.mm
Reflection.mm
SwiftNativeNSXXXBase.mm.gyb)
set(swift_stubs_unicode_normalization_sources
UnicodeNormalization.cpp)
set(LLVM_OPTIONAL_SOURCES
${swift_stubs_objc_sources}
${swift_stubs_unicode_normalization_sources})
set(swift_stubs_c_compile_flags ${SWIFT_RUNTIME_CORE_CXX_FLAGS})
list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
${swift_stubs_sources}
${swift_stubs_objc_sources}
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
TARGET_SDKS ALL_APPLE_PLATFORMS
INSTALL_IN_COMPONENT stdlib)
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
${swift_stubs_sources}
${swift_stubs_unicode_normalization_sources}
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX
INSTALL_IN_COMPONENT stdlib)
| Update CMake to use TARGET_SDKS (NFC) | [stubs] Update CMake to use TARGET_SDKS (NFC)
The `add_swift_library` CMake function takes an optional `TARGET_SDKS`
parameter. When used, only CMake targets for the specified SDKs are added.
Refactor `stdlib/public/stubs` to use this parameter. This also eliminates
logic that determines additional flags or source files to include based on
`SWIFT_HOST_VARIANT`, which makes it easier for hosts to add targets for
different platforms.
| Text | apache-2.0 | swiftix/swift,tjw/swift,glessard/swift,ben-ng/swift,xedin/swift,jmgc/swift,harlanhaskins/swift,glessard/swift,tkremenek/swift,brentdax/swift,xedin/swift,allevato/swift,practicalswift/swift,austinzheng/swift,felix91gr/swift,benlangmuir/swift,tjw/swift,austinzheng/swift,xwu/swift,karwa/swift,shajrawi/swift,zisko/swift,milseman/swift,return/swift,tjw/swift,sschiau/swift,Jnosh/swift,bitjammer/swift,manavgabhawala/swift,CodaFi/swift,jckarter/swift,djwbrown/swift,jckarter/swift,natecook1000/swift,ahoppen/swift,calebd/swift,calebd/swift,bitjammer/swift,stephentyrone/swift,tkremenek/swift,jtbandes/swift,rudkx/swift,parkera/swift,codestergit/swift,ahoppen/swift,danielmartin/swift,bitjammer/swift,gribozavr/swift,uasys/swift,jtbandes/swift,ahoppen/swift,aschwaighofer/swift,jmgc/swift,ahoppen/swift,aschwaighofer/swift,amraboelela/swift,gottesmm/swift,Jnosh/swift,apple/swift,gottesmm/swift,swiftix/swift,hooman/swift,sschiau/swift,gmilos/swift,felix91gr/swift,deyton/swift,modocache/swift,amraboelela/swift,OscarSwanros/swift,hooman/swift,stephentyrone/swift,airspeedswift/swift,shahmishal/swift,atrick/swift,felix91gr/swift,jopamer/swift,gregomni/swift,Jnosh/swift,kperryua/swift,practicalswift/swift,parkera/swift,ben-ng/swift,gribozavr/swift,harlanhaskins/swift,tardieu/swift,alblue/swift,ahoppen/swift,djwbrown/swift,jmgc/swift,return/swift,shahmishal/swift,milseman/swift,kperryua/swift,OscarSwanros/swift,devincoughlin/swift,alblue/swift,hughbe/swift,devincoughlin/swift,tinysun212/swift-windows,allevato/swift,jopamer/swift,natecook1000/swift,deyton/swift,therealbnut/swift,arvedviehweger/swift,natecook1000/swift,shahmishal/swift,jopamer/swift,JGiola/swift,xedin/swift,roambotics/swift,tardieu/swift,jckarter/swift,swiftix/swift,airspeedswift/swift,gottesmm/swift,kstaring/swift,return/swift,apple/swift,manavgabhawala/swift,jckarter/swift,tkremenek/swift,frootloops/swift,manavgabhawala/swift,deyton/swift,gregomni/swift,natecook1000/swift,apple/swift,gottesmm/swift,CodaFi/swift,brentdax/swift,lorentey/swift,felix91gr/swift,benlangmuir/swift,airspeedswift/swift,modocache/swift,tardieu/swift,atrick/swift,tardieu/swift,sschiau/swift,swiftix/swift,shajrawi/swift,austinzheng/swift,jopamer/swift,gribozavr/swift,practicalswift/swift,codestergit/swift,kstaring/swift,practicalswift/swift,austinzheng/swift,ben-ng/swift,practicalswift/swift,Jnosh/swift,shahmishal/swift,natecook1000/swift,therealbnut/swift,JGiola/swift,milseman/swift,OscarSwanros/swift,jtbandes/swift,xwu/swift,swiftix/swift,modocache/swift,manavgabhawala/swift,JaSpa/swift,JaSpa/swift,airspeedswift/swift,jopamer/swift,stephentyrone/swift,gribozavr/swift,JaSpa/swift,swiftix/swift,amraboelela/swift,therealbnut/swift,stephentyrone/swift,frootloops/swift,manavgabhawala/swift,tjw/swift,bitjammer/swift,harlanhaskins/swift,rudkx/swift,karwa/swift,shahmishal/swift,Jnosh/swift,gregomni/swift,return/swift,danielmartin/swift,jtbandes/swift,tinysun212/swift-windows,tardieu/swift,JaSpa/swift,practicalswift/swift,CodaFi/swift,return/swift,allevato/swift,milseman/swift,harlanhaskins/swift,harlanhaskins/swift,brentdax/swift,parkera/swift,alblue/swift,modocache/swift,calebd/swift,Jnosh/swift,austinzheng/swift,JGiola/swift,hooman/swift,uasys/swift,therealbnut/swift,amraboelela/swift,kstaring/swift,benlangmuir/swift,roambotics/swift,hughbe/swift,karwa/swift,austinzheng/swift,lorentey/swift,xedin/swift,huonw/swift,uasys/swift,zisko/swift,jckarter/swift,ben-ng/swift,devincoughlin/swift,nathawes/swift,ben-ng/swift,glessard/swift,hughbe/swift,uasys/swift,bitjammer/swift,allevato/swift,allevato/swift,harlanhaskins/swift,manavgabhawala/swift,karwa/swift,shajrawi/swift,rudkx/swift,alblue/swift,apple/swift,huonw/swift,brentdax/swift,atrick/swift,xedin/swift,kperryua/swift,karwa/swift,shahmishal/swift,JGiola/swift,gottesmm/swift,shajrawi/swift,gribozavr/swift,allevato/swift,atrick/swift,frootloops/swift,frootloops/swift,milseman/swift,sschiau/swift,deyton/swift,zisko/swift,parkera/swift,kstaring/swift,JaSpa/swift,felix91gr/swift,hughbe/swift,calebd/swift,austinzheng/swift,uasys/swift,huonw/swift,xwu/swift,arvedviehweger/swift,tkremenek/swift,huonw/swift,lorentey/swift,rudkx/swift,bitjammer/swift,CodaFi/swift,shajrawi/swift,kperryua/swift,danielmartin/swift,parkera/swift,kstaring/swift,tinysun212/swift-windows,gribozavr/swift,jmgc/swift,xedin/swift,kperryua/swift,arvedviehweger/swift,return/swift,roambotics/swift,tjw/swift,devincoughlin/swift,JGiola/swift,felix91gr/swift,devincoughlin/swift,xedin/swift,OscarSwanros/swift,djwbrown/swift,jtbandes/swift,airspeedswift/swift,modocache/swift,parkera/swift,gottesmm/swift,karwa/swift,practicalswift/swift,gmilos/swift,hooman/swift,tinysun212/swift-windows,zisko/swift,Jnosh/swift,glessard/swift,lorentey/swift,felix91gr/swift,apple/swift,frootloops/swift,benlangmuir/swift,sschiau/swift,gmilos/swift,milseman/swift,stephentyrone/swift,nathawes/swift,JaSpa/swift,jmgc/swift,return/swift,xwu/swift,tinysun212/swift-windows,roambotics/swift,airspeedswift/swift,therealbnut/swift,jtbandes/swift,CodaFi/swift,atrick/swift,deyton/swift,milseman/swift,swiftix/swift,tkremenek/swift,sschiau/swift,gregomni/swift,brentdax/swift,jckarter/swift,alblue/swift,codestergit/swift,zisko/swift,codestergit/swift,JGiola/swift,modocache/swift,amraboelela/swift,xwu/swift,alblue/swift,lorentey/swift,nathawes/swift,gmilos/swift,djwbrown/swift,ahoppen/swift,nathawes/swift,harlanhaskins/swift,danielmartin/swift,djwbrown/swift,hughbe/swift,tkremenek/swift,sschiau/swift,huonw/swift,tinysun212/swift-windows,nathawes/swift,parkera/swift,arvedviehweger/swift,huonw/swift,OscarSwanros/swift,aschwaighofer/swift,tjw/swift,CodaFi/swift,gmilos/swift,lorentey/swift,tardieu/swift,devincoughlin/swift,brentdax/swift,natecook1000/swift,kstaring/swift,modocache/swift,gmilos/swift,roambotics/swift,aschwaighofer/swift,shahmishal/swift,tinysun212/swift-windows,practicalswift/swift,shajrawi/swift,gregomni/swift,rudkx/swift,kperryua/swift,allevato/swift,jtbandes/swift,codestergit/swift,hughbe/swift,lorentey/swift,calebd/swift,OscarSwanros/swift,CodaFi/swift,danielmartin/swift,danielmartin/swift,alblue/swift,gribozavr/swift,ben-ng/swift,jmgc/swift,benlangmuir/swift,karwa/swift,devincoughlin/swift,kstaring/swift,zisko/swift,codestergit/swift,stephentyrone/swift,karwa/swift,arvedviehweger/swift,jopamer/swift,frootloops/swift,hooman/swift,kperryua/swift,natecook1000/swift,OscarSwanros/swift,glessard/swift,therealbnut/swift,airspeedswift/swift,aschwaighofer/swift,djwbrown/swift,frootloops/swift,jmgc/swift,bitjammer/swift,tjw/swift,djwbrown/swift,xwu/swift,glessard/swift,nathawes/swift,hooman/swift,shahmishal/swift,hughbe/swift,shajrawi/swift,manavgabhawala/swift,hooman/swift,gmilos/swift,jckarter/swift,sschiau/swift,codestergit/swift,rudkx/swift,tkremenek/swift,uasys/swift,arvedviehweger/swift,calebd/swift,gribozavr/swift,JaSpa/swift,huonw/swift,deyton/swift,jopamer/swift,roambotics/swift,gottesmm/swift,parkera/swift,calebd/swift,gregomni/swift,therealbnut/swift,amraboelela/swift,tardieu/swift,ben-ng/swift,apple/swift,aschwaighofer/swift,xedin/swift,amraboelela/swift,stephentyrone/swift,xwu/swift,nathawes/swift,devincoughlin/swift,danielmartin/swift,brentdax/swift,lorentey/swift,atrick/swift,zisko/swift,benlangmuir/swift,arvedviehweger/swift,uasys/swift,shajrawi/swift,deyton/swift,aschwaighofer/swift | text | ## Code Before:
set(swift_stubs_objc_sources)
set(swift_stubs_unicode_normalization_sources)
if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
set(swift_stubs_objc_sources
Availability.mm
DispatchShims.mm
FoundationHelpers.mm
OptionalBridgingHelper.mm
Reflection.mm
SwiftNativeNSXXXBase.mm.gyb)
set(LLVM_OPTIONAL_SOURCES
UnicodeNormalization.cpp)
else()
find_package(ICU REQUIRED COMPONENTS uc i18n)
set(swift_stubs_unicode_normalization_sources
UnicodeNormalization.cpp)
endif()
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
Assert.cpp
CommandLine.cpp
GlobalObjects.cpp
LibcShims.cpp
Stubs.cpp
UnicodeExtendedGraphemeClusters.cpp.gyb
${swift_stubs_objc_sources}
${swift_stubs_unicode_normalization_sources}
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS} -DswiftCore_EXPORTS
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
INSTALL_IN_COMPONENT stdlib)
## Instruction:
[stubs] Update CMake to use TARGET_SDKS (NFC)
The `add_swift_library` CMake function takes an optional `TARGET_SDKS`
parameter. When used, only CMake targets for the specified SDKs are added.
Refactor `stdlib/public/stubs` to use this parameter. This also eliminates
logic that determines additional flags or source files to include based on
`SWIFT_HOST_VARIANT`, which makes it easier for hosts to add targets for
different platforms.
## Code After:
set(swift_stubs_sources
Assert.cpp
CommandLine.cpp
GlobalObjects.cpp
LibcShims.cpp
Stubs.cpp
UnicodeExtendedGraphemeClusters.cpp.gyb)
set(swift_stubs_objc_sources
Availability.mm
DispatchShims.mm
FoundationHelpers.mm
OptionalBridgingHelper.mm
Reflection.mm
SwiftNativeNSXXXBase.mm.gyb)
set(swift_stubs_unicode_normalization_sources
UnicodeNormalization.cpp)
set(LLVM_OPTIONAL_SOURCES
${swift_stubs_objc_sources}
${swift_stubs_unicode_normalization_sources})
set(swift_stubs_c_compile_flags ${SWIFT_RUNTIME_CORE_CXX_FLAGS})
list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
${swift_stubs_sources}
${swift_stubs_objc_sources}
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
TARGET_SDKS ALL_APPLE_PLATFORMS
INSTALL_IN_COMPONENT stdlib)
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
${swift_stubs_sources}
${swift_stubs_unicode_normalization_sources}
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX
INSTALL_IN_COMPONENT stdlib)
| + set(swift_stubs_sources
+ Assert.cpp
+ CommandLine.cpp
+ GlobalObjects.cpp
+ LibcShims.cpp
+ Stubs.cpp
+ UnicodeExtendedGraphemeClusters.cpp.gyb)
- set(swift_stubs_objc_sources)
? -
+ set(swift_stubs_objc_sources
+ Availability.mm
+ DispatchShims.mm
+ FoundationHelpers.mm
+ OptionalBridgingHelper.mm
+ Reflection.mm
+ SwiftNativeNSXXXBase.mm.gyb)
- set(swift_stubs_unicode_normalization_sources)
? -
+ set(swift_stubs_unicode_normalization_sources
+ UnicodeNormalization.cpp)
+ set(LLVM_OPTIONAL_SOURCES
+ ${swift_stubs_objc_sources}
+ ${swift_stubs_unicode_normalization_sources})
+ set(swift_stubs_c_compile_flags ${SWIFT_RUNTIME_CORE_CXX_FLAGS})
+ list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
- if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
- set(swift_stubs_objc_sources
- Availability.mm
- DispatchShims.mm
- FoundationHelpers.mm
- OptionalBridgingHelper.mm
- Reflection.mm
- SwiftNativeNSXXXBase.mm.gyb)
- set(LLVM_OPTIONAL_SOURCES
- UnicodeNormalization.cpp)
- else()
- find_package(ICU REQUIRED COMPONENTS uc i18n)
- set(swift_stubs_unicode_normalization_sources
- UnicodeNormalization.cpp)
- endif()
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
+ ${swift_stubs_sources}
- Assert.cpp
- CommandLine.cpp
- GlobalObjects.cpp
- LibcShims.cpp
- Stubs.cpp
- UnicodeExtendedGraphemeClusters.cpp.gyb
${swift_stubs_objc_sources}
+ C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
- ${swift_stubs_unicode_normalization_sources}
- C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS} -DswiftCore_EXPORTS
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
+ TARGET_SDKS ALL_APPLE_PLATFORMS
INSTALL_IN_COMPONENT stdlib)
+ add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
+ ${swift_stubs_sources}
+ ${swift_stubs_unicode_normalization_sources}
+ C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
+ LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
+ LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
+ TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX
+ INSTALL_IN_COMPONENT stdlib)
+ | 58 | 1.8125 | 33 | 25 |
ad89489754920533a371c050c837431b96f081d5 | src/stories/index.js | src/stories/index.js | import React from 'react';
import { storiesOf } from '@kadira/storybook';
import AspectRatio from '../index';
import '../../aspect-ratio.css';
storiesOf('AspectRatio', module)
.add('Image', () => (
<div className="card">
<h2>Image with Aspect Ratio</h2>
<AspectRatio ratio="3/4" style={{ maxWidth: '400px' }}>
<img src="https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg" alt="demo" />
</AspectRatio>
</div>
))
.add('Background Image', () => (
<div className="card">
<h2>Background image with aspect ratio</h2>
<AspectRatio
ratio="3/4"
style={{
maxWidth: '300px',
backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
backgroundSize: 'cover',
}}
/>
</div>
))
.add('Iframe', () => (
<div className="card">
<h2>Iframe with aspect ratio</h2>
<AspectRatio ratio="560/315" style={{ maxWidth: '560px' }}>
<iframe src="https://www.youtube.com/embed/Bku71V5f66g" frameBorder="0" allowFullScreen />
</AspectRatio>
</div>
));
| import React from 'react';
import { storiesOf } from '@kadira/storybook';
import AspectRatio from '../index';
import '../../aspect-ratio.css';
storiesOf('AspectRatio', module)
.add('Image', () => (
<div className="card">
<h2>Image with Aspect Ratio</h2>
<AspectRatio ratio="3/4" style={{ maxWidth: '400px' }}>
<img src="https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg" alt="demo" />
</AspectRatio>
</div>
))
.add('Background Image', () => (
<div className="card">
<h2>Background image with aspect ratio</h2>
<AspectRatio
ratio="3/4"
style={{
maxWidth: '300px',
backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
backgroundSize: 'cover',
}}
/>
</div>
))
.add('Iframe', () => (
<div className="card">
<h2>Iframe with aspect ratio</h2>
<AspectRatio ratio="560/315" style={{ maxWidth: '560px' }}>
<iframe src="https://www.youtube.com/embed/Sv6dMFF_yts" frameBorder="0" allowFullScreen />
</AspectRatio>
</div>
));
| Update iframe url (the poor video was removed) | Update iframe url (the poor video was removed)
| JavaScript | mit | roderickhsiao/react-aspect-ratio,roderickhsiao/react-aspect-ratio,roderickhsiao/react-aspect-ratio,roderickhsiao/react-aspect-ratio | javascript | ## Code Before:
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import AspectRatio from '../index';
import '../../aspect-ratio.css';
storiesOf('AspectRatio', module)
.add('Image', () => (
<div className="card">
<h2>Image with Aspect Ratio</h2>
<AspectRatio ratio="3/4" style={{ maxWidth: '400px' }}>
<img src="https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg" alt="demo" />
</AspectRatio>
</div>
))
.add('Background Image', () => (
<div className="card">
<h2>Background image with aspect ratio</h2>
<AspectRatio
ratio="3/4"
style={{
maxWidth: '300px',
backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
backgroundSize: 'cover',
}}
/>
</div>
))
.add('Iframe', () => (
<div className="card">
<h2>Iframe with aspect ratio</h2>
<AspectRatio ratio="560/315" style={{ maxWidth: '560px' }}>
<iframe src="https://www.youtube.com/embed/Bku71V5f66g" frameBorder="0" allowFullScreen />
</AspectRatio>
</div>
));
## Instruction:
Update iframe url (the poor video was removed)
## Code After:
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import AspectRatio from '../index';
import '../../aspect-ratio.css';
storiesOf('AspectRatio', module)
.add('Image', () => (
<div className="card">
<h2>Image with Aspect Ratio</h2>
<AspectRatio ratio="3/4" style={{ maxWidth: '400px' }}>
<img src="https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg" alt="demo" />
</AspectRatio>
</div>
))
.add('Background Image', () => (
<div className="card">
<h2>Background image with aspect ratio</h2>
<AspectRatio
ratio="3/4"
style={{
maxWidth: '300px',
backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
backgroundSize: 'cover',
}}
/>
</div>
))
.add('Iframe', () => (
<div className="card">
<h2>Iframe with aspect ratio</h2>
<AspectRatio ratio="560/315" style={{ maxWidth: '560px' }}>
<iframe src="https://www.youtube.com/embed/Sv6dMFF_yts" frameBorder="0" allowFullScreen />
</AspectRatio>
</div>
));
| import React from 'react';
import { storiesOf } from '@kadira/storybook';
import AspectRatio from '../index';
import '../../aspect-ratio.css';
storiesOf('AspectRatio', module)
.add('Image', () => (
<div className="card">
<h2>Image with Aspect Ratio</h2>
<AspectRatio ratio="3/4" style={{ maxWidth: '400px' }}>
<img src="https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg" alt="demo" />
</AspectRatio>
</div>
))
.add('Background Image', () => (
<div className="card">
<h2>Background image with aspect ratio</h2>
<AspectRatio
ratio="3/4"
style={{
maxWidth: '300px',
backgroundImage: 'url(https://c1.staticflickr.com/4/3896/14550191836_cc0675d906.jpg)',
backgroundSize: 'cover',
}}
/>
</div>
))
.add('Iframe', () => (
<div className="card">
<h2>Iframe with aspect ratio</h2>
<AspectRatio ratio="560/315" style={{ maxWidth: '560px' }}>
- <iframe src="https://www.youtube.com/embed/Bku71V5f66g" frameBorder="0" allowFullScreen />
? ^^^^^^^^ ^^
+ <iframe src="https://www.youtube.com/embed/Sv6dMFF_yts" frameBorder="0" allowFullScreen />
? ^^ ^^^^^^^^
</AspectRatio>
</div>
)); | 2 | 0.055556 | 1 | 1 |
c908ee1ff46c10240346f041df84848c944bdc37 | share/spice/people_in_space/people_in_space.css | share/spice/people_in_space/people_in_space.css | .tile--people_in_space .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
width: 20px;
height: 20px;
padding: 6px;
background-color: #e8e8e8;
}
.tile--people_in_space .tile__body {
height: 10em;
}
| .tile--people_in_space .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
margin-left: 0.75em;
width: 20px;
height: 20px;
padding: 6px;
border-radius: 2px;
background-color: #e8e8e8;
}
.tile--people_in_space .tile__body {
height: 10em;
}
| Add margin and border-radius to flag. | PeopleInSpace: Add margin and border-radius to flag.
| CSS | apache-2.0 | cylgom/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,deserted/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,P71/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,echosa/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,imwally/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,loganom/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,lernae/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,levaly/zeroclickinfo-spice,loganom/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,echosa/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,deserted/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,lerna/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,sevki/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,imwally/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,stennie/zeroclickinfo-spice,lernae/zeroclickinfo-spice,sevki/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,stennie/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,deserted/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,mayo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,echosa/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,imwally/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lerna/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,soleo/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,levaly/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,soleo/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,lerna/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,deserted/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,P71/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,ppant/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,echosa/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,mayo/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,imwally/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,loganom/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,deserted/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,sevki/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,imwally/zeroclickinfo-spice,lerna/zeroclickinfo-spice,stennie/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,mayo/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,lernae/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,stennie/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,levaly/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,levaly/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,lerna/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,soleo/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,lernae/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,lernae/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,ppant/zeroclickinfo-spice,deserted/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,levaly/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,echosa/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,lernae/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,loganom/zeroclickinfo-spice,sevki/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,P71/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,soleo/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,soleo/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,soleo/zeroclickinfo-spice,levaly/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,ppant/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,ppant/zeroclickinfo-spice,P71/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice | css | ## Code Before:
.tile--people_in_space .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
width: 20px;
height: 20px;
padding: 6px;
background-color: #e8e8e8;
}
.tile--people_in_space .tile__body {
height: 10em;
}
## Instruction:
PeopleInSpace: Add margin and border-radius to flag.
## Code After:
.tile--people_in_space .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
margin-left: 0.75em;
width: 20px;
height: 20px;
padding: 6px;
border-radius: 2px;
background-color: #e8e8e8;
}
.tile--people_in_space .tile__body {
height: 10em;
}
| .tile--people_in_space .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
+ margin-left: 0.75em;
width: 20px;
height: 20px;
padding: 6px;
+ border-radius: 2px;
background-color: #e8e8e8;
}
.tile--people_in_space .tile__body {
height: 10em;
} | 2 | 0.153846 | 2 | 0 |
dd06d85b93ef0caca8884252f1a1c1d21f1a1d88 | sievehelp.js | sievehelp.js | // create div
var sievehelpdiv = d3.select(".title").append("div")
.attr("id", "sievehelpdiv")
.classed("hidden", true);
// add div content
sievehelpdiv.append("h1").text("This is a big title!");
// hit window is the 'help' text
// set its behavior for mouseover and mouseout
d3.select(".sievehelplink")
.on("mouseover", function() {sievehelpdiv.classed("hidden", false);})
.on("mouseout", function() {sievehelpdiv.classed("hidden", true);}); | // create div
var sievehelpdiv = d3.select(".title").append("div")
.attr("id", "sievehelpdiv")
.classed("hidden", true);
// add div content
sievehelpdiv.append("h1").text("How to use this tool");
sievehelpdiv.append("p").text("Select sites in the shaded area.");
// hit window is the 'help' text
// set its behavior for mouseover and mouseout
d3.select(".sievehelplink")
.on("mouseover", function() {sievehelpdiv.classed("hidden", false);})
.on("mouseout", function() {sievehelpdiv.classed("hidden", true);}); | Add slightly more relevant content to the help div | Add slightly more relevant content to the help div
| JavaScript | mit | gclenaghan/SIEVE,nkullman/SIEVE,gclenaghan/SIEVE,gclenaghan/SIEVE,nkullman/SIEVE,gclenaghan/SIEVE | javascript | ## Code Before:
// create div
var sievehelpdiv = d3.select(".title").append("div")
.attr("id", "sievehelpdiv")
.classed("hidden", true);
// add div content
sievehelpdiv.append("h1").text("This is a big title!");
// hit window is the 'help' text
// set its behavior for mouseover and mouseout
d3.select(".sievehelplink")
.on("mouseover", function() {sievehelpdiv.classed("hidden", false);})
.on("mouseout", function() {sievehelpdiv.classed("hidden", true);});
## Instruction:
Add slightly more relevant content to the help div
## Code After:
// create div
var sievehelpdiv = d3.select(".title").append("div")
.attr("id", "sievehelpdiv")
.classed("hidden", true);
// add div content
sievehelpdiv.append("h1").text("How to use this tool");
sievehelpdiv.append("p").text("Select sites in the shaded area.");
// hit window is the 'help' text
// set its behavior for mouseover and mouseout
d3.select(".sievehelplink")
.on("mouseover", function() {sievehelpdiv.classed("hidden", false);})
.on("mouseout", function() {sievehelpdiv.classed("hidden", true);}); | // create div
var sievehelpdiv = d3.select(".title").append("div")
.attr("id", "sievehelpdiv")
.classed("hidden", true);
// add div content
- sievehelpdiv.append("h1").text("This is a big title!");
+ sievehelpdiv.append("h1").text("How to use this tool");
+ sievehelpdiv.append("p").text("Select sites in the shaded area.");
// hit window is the 'help' text
// set its behavior for mouseover and mouseout
d3.select(".sievehelplink")
.on("mouseover", function() {sievehelpdiv.classed("hidden", false);})
.on("mouseout", function() {sievehelpdiv.classed("hidden", true);}); | 3 | 0.230769 | 2 | 1 |
e5f88d065601972bf1e7abebc69f9235b08d4c62 | easyium/__init__.py | easyium/__init__.py | __author__ = 'karl.gong'
try:
import appium
appium_installed = True
except ImportError:
appium_installed = False | from .webdriver import WebDriver, WebDriverType
from .staticelement import StaticElement
from .identifier import Identifier
from .waits.waiter import wait_for
__author__ = 'karl.gong'
try:
import appium
appium_installed = True
except ImportError:
appium_installed = False
| Add package "shortcuts" for classes&function | Add package "shortcuts" for classes&function
| Python | apache-2.0 | KarlGong/easyium-python,KarlGong/easyium | python | ## Code Before:
__author__ = 'karl.gong'
try:
import appium
appium_installed = True
except ImportError:
appium_installed = False
## Instruction:
Add package "shortcuts" for classes&function
## Code After:
from .webdriver import WebDriver, WebDriverType
from .staticelement import StaticElement
from .identifier import Identifier
from .waits.waiter import wait_for
__author__ = 'karl.gong'
try:
import appium
appium_installed = True
except ImportError:
appium_installed = False
| + from .webdriver import WebDriver, WebDriverType
+ from .staticelement import StaticElement
+ from .identifier import Identifier
+ from .waits.waiter import wait_for
+
__author__ = 'karl.gong'
try:
import appium
appium_installed = True
except ImportError:
appium_installed = False | 5 | 0.714286 | 5 | 0 |
4b9eec64fc4cfbc4487d955045956a901425c30e | examples/ex02multifile/ex02multifile.go | examples/ex02multifile/ex02multifile.go | package main
import (
"fmt"
sci "github.com/samuell/scipipe"
)
func main() {
// Init barReplacer task
barReplacer := sci.Sh("sed 's/foo/bar/g' {i:foo2} > {o:bar}")
// Init function for generating output file pattern
barReplacer.OutPathFuncs["bar"] = func() string {
return barReplacer.GetInPath("foo2") + ".bar"
}
// Set up tasks for execution
barReplacer.Init()
// Connect network
for _, name := range []string{"foo1", "foo2", "foo3"} {
barReplacer.InPorts["foo2"] <- sci.NewFileTarget(name + ".txt")
}
close(barReplacer.InPorts["foo2"])
for f := range barReplacer.OutPorts["bar"] {
fmt.Println("Processed file", f.GetPath(), "...")
}
}
| package main
import (
"fmt"
sci "github.com/samuell/scipipe"
)
func main() {
// Init barReplacer task
barReplacer := sci.Sh("sed 's/foo/bar/g' {i:foo2} > {o:bar}")
// Init function for generating output file pattern
barReplacer.OutPathFuncs["bar"] = func() string {
return barReplacer.GetInPath("foo2") + ".bar"
}
// Set up tasks for execution
barReplacer.Init()
// Manually send file targets on the inport of barReplacer
for _, name := range []string{"foo1", "foo2", "foo3"} {
barReplacer.InPorts["foo2"] <- sci.NewFileTarget(name + ".txt")
}
// We have to manually close the inport as well here, to
// signal that we are done sending targets (the tasks outport will
// then automatically be closed as well)
close(barReplacer.InPorts["foo2"])
for f := range barReplacer.OutPorts["bar"] {
fmt.Println("Finished processing file", f.GetPath(), "...")
}
}
| Improve comments in example 2 | Improve comments in example 2
| Go | mit | samuell/scipipe,scipipe/scipipe,scipipe/scipipe | go | ## Code Before:
package main
import (
"fmt"
sci "github.com/samuell/scipipe"
)
func main() {
// Init barReplacer task
barReplacer := sci.Sh("sed 's/foo/bar/g' {i:foo2} > {o:bar}")
// Init function for generating output file pattern
barReplacer.OutPathFuncs["bar"] = func() string {
return barReplacer.GetInPath("foo2") + ".bar"
}
// Set up tasks for execution
barReplacer.Init()
// Connect network
for _, name := range []string{"foo1", "foo2", "foo3"} {
barReplacer.InPorts["foo2"] <- sci.NewFileTarget(name + ".txt")
}
close(barReplacer.InPorts["foo2"])
for f := range barReplacer.OutPorts["bar"] {
fmt.Println("Processed file", f.GetPath(), "...")
}
}
## Instruction:
Improve comments in example 2
## Code After:
package main
import (
"fmt"
sci "github.com/samuell/scipipe"
)
func main() {
// Init barReplacer task
barReplacer := sci.Sh("sed 's/foo/bar/g' {i:foo2} > {o:bar}")
// Init function for generating output file pattern
barReplacer.OutPathFuncs["bar"] = func() string {
return barReplacer.GetInPath("foo2") + ".bar"
}
// Set up tasks for execution
barReplacer.Init()
// Manually send file targets on the inport of barReplacer
for _, name := range []string{"foo1", "foo2", "foo3"} {
barReplacer.InPorts["foo2"] <- sci.NewFileTarget(name + ".txt")
}
// We have to manually close the inport as well here, to
// signal that we are done sending targets (the tasks outport will
// then automatically be closed as well)
close(barReplacer.InPorts["foo2"])
for f := range barReplacer.OutPorts["bar"] {
fmt.Println("Finished processing file", f.GetPath(), "...")
}
}
| package main
import (
"fmt"
sci "github.com/samuell/scipipe"
)
func main() {
// Init barReplacer task
barReplacer := sci.Sh("sed 's/foo/bar/g' {i:foo2} > {o:bar}")
// Init function for generating output file pattern
barReplacer.OutPathFuncs["bar"] = func() string {
return barReplacer.GetInPath("foo2") + ".bar"
}
// Set up tasks for execution
barReplacer.Init()
- // Connect network
+ // Manually send file targets on the inport of barReplacer
for _, name := range []string{"foo1", "foo2", "foo3"} {
barReplacer.InPorts["foo2"] <- sci.NewFileTarget(name + ".txt")
}
+ // We have to manually close the inport as well here, to
+ // signal that we are done sending targets (the tasks outport will
+ // then automatically be closed as well)
close(barReplacer.InPorts["foo2"])
+
for f := range barReplacer.OutPorts["bar"] {
- fmt.Println("Processed file", f.GetPath(), "...")
? ^ ^^
+ fmt.Println("Finished processing file", f.GetPath(), "...")
? ^^^^^^^^^^ ^^^
}
} | 8 | 0.296296 | 6 | 2 |
2802b5ebcde2db43373dce74b51f9883e635c556 | notes/todo.md | notes/todo.md |
- [ ] Implement Peaks algorithm on an IEnumerable<T>
- [ ] Implement HaskPeak algorithm on an IEnumerable<T>
## Business
- [ ] Implement `BusinessCalendar.Enumerator` to enumerate the business days of a Business calendar.
- [ ] Change the signature of `IBusinessCalendar` to specialize `IEnumerable<Date>`.
- [x] Implement `Until`, `Since` and `Between` extensions to truncate a business calendar.
## Refactoring
- [x] Rename `UpgradingFileStreamSource` to `CachedFileStreamSource`.
## Optimizations
- [x] Optimize `HeaderedTextWriter` by overriding more method to give a chance of specialized methods on the underlying `TextWriter`.
## Tools
- [x] Consolidate nuget packages
- [x] Upgrade nuget packages
- [ ] Upgrade nuget packages for WmcSoft.VisualStudio
|
- [ ] Implement Peaks algorithm on an IEnumerable<T>
see https://stackoverflow.com/questions/5269000/finding-local-maxima-over-a-dynamic-range
https://www.filipekberg.se/2014/02/10/understanding-peak-finding/
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjcsdns_7nwAhUj8-AKHdLmDcQQFjAAegQIBBAD&url=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.37.1110%26rep%3Drep1%26type%3Dpdf&usg=AOvVaw0vLSGtjpoB_b88qRKB9e9B
- [ ] Implement HaskPeak algorithm on an IEnumerable<T>
## Business
- [ ] Implement `BusinessCalendar.Enumerator` to enumerate the business days of a Business calendar.
- [ ] Change the signature of `IBusinessCalendar` to specialize `IEnumerable<Date>`.
- [x] Implement `Until`, `Since` and `Between` extensions to truncate a business calendar.
## Refactoring
- [x] Rename `UpgradingFileStreamSource` to `CachedFileStreamSource`.
## Optimizations
- [x] Optimize `HeaderedTextWriter` by overriding more method to give a chance of specialized methods on the underlying `TextWriter`.
## Tools
- [x] Consolidate nuget packages
- [x] Upgrade nuget packages
- [ ] Upgrade nuget packages for WmcSoft.VisualStudio
| Add link to explain Peaks algorithm | Add link to explain Peaks algorithm
| Markdown | mit | vjacquet/WmcSoft | markdown | ## Code Before:
- [ ] Implement Peaks algorithm on an IEnumerable<T>
- [ ] Implement HaskPeak algorithm on an IEnumerable<T>
## Business
- [ ] Implement `BusinessCalendar.Enumerator` to enumerate the business days of a Business calendar.
- [ ] Change the signature of `IBusinessCalendar` to specialize `IEnumerable<Date>`.
- [x] Implement `Until`, `Since` and `Between` extensions to truncate a business calendar.
## Refactoring
- [x] Rename `UpgradingFileStreamSource` to `CachedFileStreamSource`.
## Optimizations
- [x] Optimize `HeaderedTextWriter` by overriding more method to give a chance of specialized methods on the underlying `TextWriter`.
## Tools
- [x] Consolidate nuget packages
- [x] Upgrade nuget packages
- [ ] Upgrade nuget packages for WmcSoft.VisualStudio
## Instruction:
Add link to explain Peaks algorithm
## Code After:
- [ ] Implement Peaks algorithm on an IEnumerable<T>
see https://stackoverflow.com/questions/5269000/finding-local-maxima-over-a-dynamic-range
https://www.filipekberg.se/2014/02/10/understanding-peak-finding/
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjcsdns_7nwAhUj8-AKHdLmDcQQFjAAegQIBBAD&url=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.37.1110%26rep%3Drep1%26type%3Dpdf&usg=AOvVaw0vLSGtjpoB_b88qRKB9e9B
- [ ] Implement HaskPeak algorithm on an IEnumerable<T>
## Business
- [ ] Implement `BusinessCalendar.Enumerator` to enumerate the business days of a Business calendar.
- [ ] Change the signature of `IBusinessCalendar` to specialize `IEnumerable<Date>`.
- [x] Implement `Until`, `Since` and `Between` extensions to truncate a business calendar.
## Refactoring
- [x] Rename `UpgradingFileStreamSource` to `CachedFileStreamSource`.
## Optimizations
- [x] Optimize `HeaderedTextWriter` by overriding more method to give a chance of specialized methods on the underlying `TextWriter`.
## Tools
- [x] Consolidate nuget packages
- [x] Upgrade nuget packages
- [ ] Upgrade nuget packages for WmcSoft.VisualStudio
|
- - [ ] Implement Peaks algorithm on an IEnumerable<T>
+ - [ ] Implement Peaks algorithm on an IEnumerable<T>
? +
+ see https://stackoverflow.com/questions/5269000/finding-local-maxima-over-a-dynamic-range
+ https://www.filipekberg.se/2014/02/10/understanding-peak-finding/
+ https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjcsdns_7nwAhUj8-AKHdLmDcQQFjAAegQIBBAD&url=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.37.1110%26rep%3Drep1%26type%3Dpdf&usg=AOvVaw0vLSGtjpoB_b88qRKB9e9B
- [ ] Implement HaskPeak algorithm on an IEnumerable<T>
## Business
- [ ] Implement `BusinessCalendar.Enumerator` to enumerate the business days of a Business calendar.
- [ ] Change the signature of `IBusinessCalendar` to specialize `IEnumerable<Date>`.
- [x] Implement `Until`, `Since` and `Between` extensions to truncate a business calendar.
## Refactoring
- [x] Rename `UpgradingFileStreamSource` to `CachedFileStreamSource`.
## Optimizations
- [x] Optimize `HeaderedTextWriter` by overriding more method to give a chance of specialized methods on the underlying `TextWriter`.
## Tools
- [x] Consolidate nuget packages
- [x] Upgrade nuget packages
- [ ] Upgrade nuget packages for WmcSoft.VisualStudio | 5 | 0.217391 | 4 | 1 |
0051d0e03b128b5e3d1e2a917d3cf0a7d95ecfbf | themes/standard_theme/english.lproj/menu_item_view.css | themes/standard_theme/english.lproj/menu_item_view.css | .sc-theme .sc-menu-item.focus a {
color: #fff;
background-color: #5A8EC6;
}
.sc-menu-item div.checkbox {
background-image: sc_static('icons/mini_454545');
background-position: -66px -147px;
}
.sc-menu-item.focus div.checkbox {
background-image: sc_static('icons/mini_ffffff');
margin: 3px 1px 3px 1px;
} | .sc-theme .sc-menu-item.focus a {
color: #fff;
background-color: #5A8EC6;
}
.sc-menu-item div.checkbox {
background-image: sc_static('icons/mini_454545');
background-position: -66px -147px;
}
.sc-menu-item.focus div.checkbox {
background-image: sc_static('icons/mini_ffffff');
}
.sc-theme .sc-menu-item .separator {
margin: 3px 1px 3px 1px;
} | Clean up CSS syntax error after merge. | Clean up CSS syntax error after merge.
| CSS | mit | Eloqua/sproutcore,Eloqua/sproutcore,Eloqua/sproutcore | css | ## Code Before:
.sc-theme .sc-menu-item.focus a {
color: #fff;
background-color: #5A8EC6;
}
.sc-menu-item div.checkbox {
background-image: sc_static('icons/mini_454545');
background-position: -66px -147px;
}
.sc-menu-item.focus div.checkbox {
background-image: sc_static('icons/mini_ffffff');
margin: 3px 1px 3px 1px;
}
## Instruction:
Clean up CSS syntax error after merge.
## Code After:
.sc-theme .sc-menu-item.focus a {
color: #fff;
background-color: #5A8EC6;
}
.sc-menu-item div.checkbox {
background-image: sc_static('icons/mini_454545');
background-position: -66px -147px;
}
.sc-menu-item.focus div.checkbox {
background-image: sc_static('icons/mini_ffffff');
}
.sc-theme .sc-menu-item .separator {
margin: 3px 1px 3px 1px;
} | .sc-theme .sc-menu-item.focus a {
color: #fff;
background-color: #5A8EC6;
}
.sc-menu-item div.checkbox {
background-image: sc_static('icons/mini_454545');
background-position: -66px -147px;
}
.sc-menu-item.focus div.checkbox {
background-image: sc_static('icons/mini_ffffff');
+ }
+
+ .sc-theme .sc-menu-item .separator {
margin: 3px 1px 3px 1px;
} | 3 | 0.214286 | 3 | 0 |
187b21e0c70cd78625ca8eaf1db16a57148f1948 | db/migration.sql | db/migration.sql | -- 2015-11-27
alter table bookmarks add column notes text;
| -- 2015-11-27
ALTER TABLE "bookmarks" ADD COLUMN `notes` TEXT;
| Change case of SQL statement to be more SQLey | Change case of SQL statement to be more SQLey
| SQL | apache-2.0 | nobbyknox/malachite,nobbyknox/malachite | sql | ## Code Before:
-- 2015-11-27
alter table bookmarks add column notes text;
## Instruction:
Change case of SQL statement to be more SQLey
## Code After:
-- 2015-11-27
ALTER TABLE "bookmarks" ADD COLUMN `notes` TEXT;
| -- 2015-11-27
- alter table bookmarks add column notes text;
+ ALTER TABLE "bookmarks" ADD COLUMN `notes` TEXT; | 2 | 1 | 1 | 1 |
af0dd5448d928033788061f6ab948f6f16416191 | README.rst | README.rst | graddfil/desktop-grabber-aggregator
-----------------------------------
|landscape_io| |codeclimate_com| |agpl-v3|
A reference implementation of graddfil desktop aggregator.
Handles buffering of data from grabbing modules and sending it to storage server.
This project is licensed under AGPLv3+.
.. |agpl-v3| image:: https://img.shields.io/badge/license-AGPLv3+-663366.svg
.. |landscape_io| image:: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master/landscape.svg?style=flat
:target: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master
:alt: Code Health
.. |codeclimate_com| image:: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator/badges/gpa.svg
:target: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator
:alt: Code Climate
| graddfril/desktop.grabber-aggregator-refimpl
-----------------------------------
|landscape_io| |codeclimate_com| |agpl-v3|
A reference implementation of graddfril desktop aggregator.
Handles buffering of data from grabbing modules and sending it to storage server.
This project is licensed under AGPLv3+.
.. |agpl-v3| image:: https://img.shields.io/badge/license-AGPLv3+-663366.svg
.. |landscape_io| image:: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master/landscape.svg?style=flat
:target: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master
:alt: Code Health
.. |codeclimate_com| image:: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl/badges/gpa.svg
:target: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl
:alt: Code Climate
| Update to reflect project rename | [readme] Update to reflect project rename
| reStructuredText | agpl-3.0 | graddfril/desktop.grabber-aggregator-refimpl | restructuredtext | ## Code Before:
graddfil/desktop-grabber-aggregator
-----------------------------------
|landscape_io| |codeclimate_com| |agpl-v3|
A reference implementation of graddfil desktop aggregator.
Handles buffering of data from grabbing modules and sending it to storage server.
This project is licensed under AGPLv3+.
.. |agpl-v3| image:: https://img.shields.io/badge/license-AGPLv3+-663366.svg
.. |landscape_io| image:: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master/landscape.svg?style=flat
:target: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master
:alt: Code Health
.. |codeclimate_com| image:: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator/badges/gpa.svg
:target: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator
:alt: Code Climate
## Instruction:
[readme] Update to reflect project rename
## Code After:
graddfril/desktop.grabber-aggregator-refimpl
-----------------------------------
|landscape_io| |codeclimate_com| |agpl-v3|
A reference implementation of graddfril desktop aggregator.
Handles buffering of data from grabbing modules and sending it to storage server.
This project is licensed under AGPLv3+.
.. |agpl-v3| image:: https://img.shields.io/badge/license-AGPLv3+-663366.svg
.. |landscape_io| image:: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master/landscape.svg?style=flat
:target: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master
:alt: Code Health
.. |codeclimate_com| image:: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl/badges/gpa.svg
:target: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl
:alt: Code Climate
| - graddfil/desktop-grabber-aggregator
? ^
+ graddfril/desktop.grabber-aggregator-refimpl
? + ^ ++++++++
-----------------------------------
|landscape_io| |codeclimate_com| |agpl-v3|
- A reference implementation of graddfil desktop aggregator.
+ A reference implementation of graddfril desktop aggregator.
? +
Handles buffering of data from grabbing modules and sending it to storage server.
This project is licensed under AGPLv3+.
.. |agpl-v3| image:: https://img.shields.io/badge/license-AGPLv3+-663366.svg
- .. |landscape_io| image:: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master/landscape.svg?style=flat
? ^
+ .. |landscape_io| image:: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master/landscape.svg?style=flat
? + ^ ++++++++
- :target: https://landscape.io/github/graddfil/desktop-grabber-aggregator/master
? ^
+ :target: https://landscape.io/github/graddfril/desktop.grabber-aggregator-refimpl/master
? + ^ ++++++++
:alt: Code Health
- .. |codeclimate_com| image:: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator/badges/gpa.svg
? ^
+ .. |codeclimate_com| image:: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl/badges/gpa.svg
? + ^ ++++++++
- :target: https://codeclimate.com/github/graddfil/desktop-grabber-aggregator
? ^
+ :target: https://codeclimate.com/github/graddfril/desktop.grabber-aggregator-refimpl
? + ^ ++++++++
:alt: Code Climate | 12 | 0.631579 | 6 | 6 |
17e052b40bd632a18f64861e03cfe2e3468c03be | js/bbc-radio.js | js/bbc-radio.js | (function (exports) {
'use strict';
var obj = {
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: function playlistUrl(el) {
console.log('playlistUrl( %o )', el);
return new Promise(function (resolve, reject) {
var url = el.getAttribute('data-player-html5-stream');
url ? resolve(url) : reject(url);
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForUrl: function (url) {
console.log('extractStreamForUrl( %o )', url);
return xhr.get(url);
},
parseStreamFromPls: function (data) {
return new Promise(function (resolve, reject) {
var matches = data.match(/File[\d]=(.*)/);
matches && matches.length > 1 ? resolve(matches[1]) : reject();
});
}
}
exports.radio = obj;
})(window.bbc = window.bbc || {})
| (function (exports) {
'use strict';
var obj = {
playlistFormat: 'http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/$station/format/pls.pls',
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: function playlistUrl(el) {
console.log('playlistUrl( %o )', el);
return new Promise(function (resolve, reject) {
var station = el.getAttribute('href').split('/').pop(),
playlistUrl;
if(station == '') {
reject(playlistUrl);
} else {
console.log('o', obj);
playlistUrl = obj.playlistFormat.replace('$station', station);
resolve(playlistUrl);
}
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForUrl: function (url) {
console.log('extractStreamForUrl( %o )', url);
return xhr.get(url);
},
parseStreamFromPls: function (data) {
return new Promise(function (resolve, reject) {
var matches = data.match(/File[\d]=(.*)/);
matches && matches.length > 1 ? resolve(matches[1]) : reject();
});
}
}
exports.radio = obj;
})(window.bbc = window.bbc || {})
| Use known playlist URL format to fetch streamable URL | Use known playlist URL format to fetch streamable URL
Signed-off-by: Andrew Nicolaou <867853b9f5173cd1402c104fc88b929245e71ca4@bbc.co.uk>
| JavaScript | apache-2.0 | mediascape/discovery-bbc-radio | javascript | ## Code Before:
(function (exports) {
'use strict';
var obj = {
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: function playlistUrl(el) {
console.log('playlistUrl( %o )', el);
return new Promise(function (resolve, reject) {
var url = el.getAttribute('data-player-html5-stream');
url ? resolve(url) : reject(url);
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForUrl: function (url) {
console.log('extractStreamForUrl( %o )', url);
return xhr.get(url);
},
parseStreamFromPls: function (data) {
return new Promise(function (resolve, reject) {
var matches = data.match(/File[\d]=(.*)/);
matches && matches.length > 1 ? resolve(matches[1]) : reject();
});
}
}
exports.radio = obj;
})(window.bbc = window.bbc || {})
## Instruction:
Use known playlist URL format to fetch streamable URL
Signed-off-by: Andrew Nicolaou <867853b9f5173cd1402c104fc88b929245e71ca4@bbc.co.uk>
## Code After:
(function (exports) {
'use strict';
var obj = {
playlistFormat: 'http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/$station/format/pls.pls',
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: function playlistUrl(el) {
console.log('playlistUrl( %o )', el);
return new Promise(function (resolve, reject) {
var station = el.getAttribute('href').split('/').pop(),
playlistUrl;
if(station == '') {
reject(playlistUrl);
} else {
console.log('o', obj);
playlistUrl = obj.playlistFormat.replace('$station', station);
resolve(playlistUrl);
}
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForUrl: function (url) {
console.log('extractStreamForUrl( %o )', url);
return xhr.get(url);
},
parseStreamFromPls: function (data) {
return new Promise(function (resolve, reject) {
var matches = data.match(/File[\d]=(.*)/);
matches && matches.length > 1 ? resolve(matches[1]) : reject();
});
}
}
exports.radio = obj;
})(window.bbc = window.bbc || {})
| (function (exports) {
'use strict';
var obj = {
+ playlistFormat: 'http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/$station/format/pls.pls',
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: function playlistUrl(el) {
console.log('playlistUrl( %o )', el);
return new Promise(function (resolve, reject) {
- var url = el.getAttribute('data-player-html5-stream');
- url ? resolve(url) : reject(url);
+ var station = el.getAttribute('href').split('/').pop(),
+ playlistUrl;
+
+ if(station == '') {
+ reject(playlistUrl);
+ } else {
+ console.log('o', obj);
+ playlistUrl = obj.playlistFormat.replace('$station', station);
+ resolve(playlistUrl);
+ }
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForUrl: function (url) {
console.log('extractStreamForUrl( %o )', url);
return xhr.get(url);
},
parseStreamFromPls: function (data) {
return new Promise(function (resolve, reject) {
var matches = data.match(/File[\d]=(.*)/);
matches && matches.length > 1 ? resolve(matches[1]) : reject();
});
}
}
exports.radio = obj;
})(window.bbc = window.bbc || {}) | 13 | 0.393939 | 11 | 2 |
452b67fa4fe5d9f34a98971e377bbaa1b978907b | superblock.py | superblock.py | import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def block_printer(filename, offset, block_count):
def nonprintable_replace(char):
if char not in string.printable:
return '.'
if char in '\n\r\t\x0b\x0c':
return '.'
return char
with open(filename, 'rb') as f:
f.seek(offset * BLOCKSIZE)
# Loop over blocks
for i in xrange(block_count):
# Loop over bytes
for j in xrange(BLOCKSIZE / 8):
part1 = f.read(4)
part2 = f.read(4)
print '{0:2}: {1} {2} {3}'.format(j+1, hexlify(part1), hexlify(part2), ''.join(map(nonprintable_replace, part1 + part2)))
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: superblock.py <filename>'
sys.exit(1)
filename = sys.argv[1]
print 'Printing superblock (bytes 1024-1535) of file %s.\n' % filename
print ''.center(5) + 'HEX'.center(18) + 'ASCII'.center(8)
block_printer(filename, 2, 1)
| import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def nonprintable_replace(char):
if char not in string.printable:
return '.'
if char in '\n\r\t\x0b\x0c':
return '.'
return char
def block_printer(filename, offset, block_count):
with open(filename, 'rb') as f:
f.seek(offset * BLOCKSIZE)
# Loop over blocks
for i in xrange(block_count):
# Loop over bytes
for j in xrange(BLOCKSIZE / 16):
word = f.read(4), f.read(4), f.read(4), f.read(4)
hex_string = ' '.join(map(hexlify, word))
ascii_string = ''.join(map(nonprintable_replace, ''.join(word)))
print '{0:2}: {1} {2}'.format(j + 1, hex_string, ascii_string)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: superblock.py <filename>'
sys.exit(1)
filename = sys.argv[1]
print '\nPrinting superblock (bytes 1024-1535) of file %s.\n' % filename
print ' ' * 5 + 'HEX'.center(35) + ' ' + 'ASCII'.center(16)
block_printer(filename, 2, 1)
| Print 16 bit per line | Print 16 bit per line
| Python | mit | dbrgn/superblock | python | ## Code Before:
import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def block_printer(filename, offset, block_count):
def nonprintable_replace(char):
if char not in string.printable:
return '.'
if char in '\n\r\t\x0b\x0c':
return '.'
return char
with open(filename, 'rb') as f:
f.seek(offset * BLOCKSIZE)
# Loop over blocks
for i in xrange(block_count):
# Loop over bytes
for j in xrange(BLOCKSIZE / 8):
part1 = f.read(4)
part2 = f.read(4)
print '{0:2}: {1} {2} {3}'.format(j+1, hexlify(part1), hexlify(part2), ''.join(map(nonprintable_replace, part1 + part2)))
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: superblock.py <filename>'
sys.exit(1)
filename = sys.argv[1]
print 'Printing superblock (bytes 1024-1535) of file %s.\n' % filename
print ''.center(5) + 'HEX'.center(18) + 'ASCII'.center(8)
block_printer(filename, 2, 1)
## Instruction:
Print 16 bit per line
## Code After:
import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def nonprintable_replace(char):
if char not in string.printable:
return '.'
if char in '\n\r\t\x0b\x0c':
return '.'
return char
def block_printer(filename, offset, block_count):
with open(filename, 'rb') as f:
f.seek(offset * BLOCKSIZE)
# Loop over blocks
for i in xrange(block_count):
# Loop over bytes
for j in xrange(BLOCKSIZE / 16):
word = f.read(4), f.read(4), f.read(4), f.read(4)
hex_string = ' '.join(map(hexlify, word))
ascii_string = ''.join(map(nonprintable_replace, ''.join(word)))
print '{0:2}: {1} {2}'.format(j + 1, hex_string, ascii_string)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: superblock.py <filename>'
sys.exit(1)
filename = sys.argv[1]
print '\nPrinting superblock (bytes 1024-1535) of file %s.\n' % filename
print ' ' * 5 + 'HEX'.center(35) + ' ' + 'ASCII'.center(16)
block_printer(filename, 2, 1)
| import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
+ def nonprintable_replace(char):
+ if char not in string.printable:
+ return '.'
+ if char in '\n\r\t\x0b\x0c':
+ return '.'
+ return char
+
+
def block_printer(filename, offset, block_count):
-
- def nonprintable_replace(char):
- if char not in string.printable:
- return '.'
- if char in '\n\r\t\x0b\x0c':
- return '.'
- return char
with open(filename, 'rb') as f:
f.seek(offset * BLOCKSIZE)
# Loop over blocks
for i in xrange(block_count):
# Loop over bytes
- for j in xrange(BLOCKSIZE / 8):
? ^
+ for j in xrange(BLOCKSIZE / 16):
? ^^
- part1 = f.read(4)
- part2 = f.read(4)
- print '{0:2}: {1} {2} {3}'.format(j+1, hexlify(part1), hexlify(part2), ''.join(map(nonprintable_replace, part1 + part2)))
+ word = f.read(4), f.read(4), f.read(4), f.read(4)
+ hex_string = ' '.join(map(hexlify, word))
+ ascii_string = ''.join(map(nonprintable_replace, ''.join(word)))
+ print '{0:2}: {1} {2}'.format(j + 1, hex_string, ascii_string)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: superblock.py <filename>'
sys.exit(1)
filename = sys.argv[1]
- print 'Printing superblock (bytes 1024-1535) of file %s.\n' % filename
+ print '\nPrinting superblock (bytes 1024-1535) of file %s.\n' % filename
? ++
- print ''.center(5) + 'HEX'.center(18) + 'ASCII'.center(8)
? ^^^^^^^^ - ^^ ^
+ print ' ' * 5 + 'HEX'.center(35) + ' ' + 'ASCII'.center(16)
? + ^^^ ^^ +++++++ ^^
block_printer(filename, 2, 1) | 28 | 0.7 | 15 | 13 |
2843cde02da09f7789f44731be8d7a36690c978f | README.md | README.md |
This project lets you run the [downloadable version](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) of [Amazon DynamoDB](https://aws.amazon.com/documentation/dynamodb/) in Docker.
See [hilverd/dynamodb](https://hub.docker.com/r/hilverd/dynamodb/) on Docker Hub.
## Usage
```
docker run -p 127.0.0.1:8000:8000 hilverd/dynamodb
```
To confirm things are working, open DynamoDB's [Web Shell](http://localhost:8000/shell/). To learn more, you can follow [Getting Started with Amazon DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html).
### Storing databases on the host
Databases are stored under `/databases` inside the container. You may want to mount a host directory to this location:
```
docker run -p 127.0.0.1:8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
```
### Custom options
By default, the `-sharedDb` option is set when you start a container. For other options, do
```
docker run --rm hilverd/dynamodb -help
```
|
This project lets you run the [downloadable version](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) of [Amazon DynamoDB](https://aws.amazon.com/documentation/dynamodb/) in Docker.
See [hilverd/dynamodb](https://hub.docker.com/r/hilverd/dynamodb/) on Docker Hub.
## Usage
```
docker run -p 8000:8000 hilverd/dynamodb
```
To confirm things are working, open DynamoDB's [Web Shell](http://localhost:8000/shell/). To learn more, you can follow [Getting Started with Amazon DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html).
### Storing databases on the host
Databases are stored under `/databases` inside the container. You may want to mount a host directory to this location:
```
docker run -p 8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
```
### Custom options
By default, the `-sharedDb` option is set when you start a container. For other options, do
```
docker run --rm hilverd/dynamodb -help
```
| Remove 127.0.0.1 from port mappings for simplicity | Remove 127.0.0.1 from port mappings for simplicity
| Markdown | mit | hilverd/dynamodb-docker | markdown | ## Code Before:
This project lets you run the [downloadable version](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) of [Amazon DynamoDB](https://aws.amazon.com/documentation/dynamodb/) in Docker.
See [hilverd/dynamodb](https://hub.docker.com/r/hilverd/dynamodb/) on Docker Hub.
## Usage
```
docker run -p 127.0.0.1:8000:8000 hilverd/dynamodb
```
To confirm things are working, open DynamoDB's [Web Shell](http://localhost:8000/shell/). To learn more, you can follow [Getting Started with Amazon DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html).
### Storing databases on the host
Databases are stored under `/databases` inside the container. You may want to mount a host directory to this location:
```
docker run -p 127.0.0.1:8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
```
### Custom options
By default, the `-sharedDb` option is set when you start a container. For other options, do
```
docker run --rm hilverd/dynamodb -help
```
## Instruction:
Remove 127.0.0.1 from port mappings for simplicity
## Code After:
This project lets you run the [downloadable version](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) of [Amazon DynamoDB](https://aws.amazon.com/documentation/dynamodb/) in Docker.
See [hilverd/dynamodb](https://hub.docker.com/r/hilverd/dynamodb/) on Docker Hub.
## Usage
```
docker run -p 8000:8000 hilverd/dynamodb
```
To confirm things are working, open DynamoDB's [Web Shell](http://localhost:8000/shell/). To learn more, you can follow [Getting Started with Amazon DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html).
### Storing databases on the host
Databases are stored under `/databases` inside the container. You may want to mount a host directory to this location:
```
docker run -p 8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
```
### Custom options
By default, the `-sharedDb` option is set when you start a container. For other options, do
```
docker run --rm hilverd/dynamodb -help
```
|
This project lets you run the [downloadable version](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) of [Amazon DynamoDB](https://aws.amazon.com/documentation/dynamodb/) in Docker.
See [hilverd/dynamodb](https://hub.docker.com/r/hilverd/dynamodb/) on Docker Hub.
## Usage
```
- docker run -p 127.0.0.1:8000:8000 hilverd/dynamodb
? ----------
+ docker run -p 8000:8000 hilverd/dynamodb
```
To confirm things are working, open DynamoDB's [Web Shell](http://localhost:8000/shell/). To learn more, you can follow [Getting Started with Amazon DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/Welcome.html).
### Storing databases on the host
Databases are stored under `/databases` inside the container. You may want to mount a host directory to this location:
```
- docker run -p 127.0.0.1:8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
? ----------
+ docker run -p 8000:8000 -v /path/to/my/dynamodb/databases:/databases hilverd/dynamodb
```
### Custom options
By default, the `-sharedDb` option is set when you start a container. For other options, do
```
docker run --rm hilverd/dynamodb -help
``` | 4 | 0.142857 | 2 | 2 |
37c5841c8d92254144b24dfff8cca8b2735f95aa | .storybook/webpack.config.js | .storybook/webpack.config.js | /* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]_[hash:base64:5]',
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [require('../src/theme')({ appendVariables: true })],
},
},
],
});
return baseConfig;
};
| /* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
// Replace storybook baseConfig rule.
baseConfig.module.rules.splice(0, 1, {
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['./babel.config.js'],
},
},
],
});
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]_[hash:base64:5]',
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [require('../src/theme')({ appendVariables: true })],
},
},
],
});
return baseConfig;
};
| Make Storybook work with babel 7 | Make Storybook work with babel 7
| JavaScript | unlicense | pascalduez/react-module-boilerplate | javascript | ## Code Before:
/* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]_[hash:base64:5]',
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [require('../src/theme')({ appendVariables: true })],
},
},
],
});
return baseConfig;
};
## Instruction:
Make Storybook work with babel 7
## Code After:
/* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
// Replace storybook baseConfig rule.
baseConfig.module.rules.splice(0, 1, {
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['./babel.config.js'],
},
},
],
});
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]_[hash:base64:5]',
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [require('../src/theme')({ appendVariables: true })],
},
},
],
});
return baseConfig;
};
| /* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
+ // Replace storybook baseConfig rule.
+ baseConfig.module.rules.splice(0, 1, {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: [
+ {
+ loader: 'babel-loader',
+ options: {
+ presets: ['./babel.config.js'],
+ },
+ },
+ ],
+ });
+
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]_[hash:base64:5]',
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [require('../src/theme')({ appendVariables: true })],
},
},
],
});
return baseConfig;
}; | 14 | 0.5 | 14 | 0 |
2e8a9a18687fb2f5ff1bfea2930e5eb8679b8c8d | components/main/kollos/CMakeLists.txt | components/main/kollos/CMakeLists.txt | CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
PROJECT(kollos C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
# ------------------
# Module search path
# ------------------
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
ENABLE_TESTING()
ADD_CUSTOM_COMMAND (
COMMENT "Writing grammar.lua"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMAND cp
${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
VERBATIM
)
add_custom_target(
grammar.lua ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMENT "Writing grammar.lua"
VERBATIM
)
file(COPY
"config.lua"
"development.lua"
"inspect.lua"
"location.lua"
"lo_g.lua"
"main.lua"
"matrix.lua"
"unindent.lua"
"util.lua"
"wrap.lua"
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)
# vim: expandtab shiftwidth=4:
| CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
PROJECT(kollos C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
# ------------------
# Module search path
# ------------------
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
ENABLE_TESTING()
ADD_CUSTOM_COMMAND (
COMMENT "Writing grammar.lua"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMAND ${lua_INTERP} ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
VERBATIM
)
add_custom_target(
grammar.lua ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMENT "Writing grammar.lua"
VERBATIM
)
file(COPY
"config.lua"
"development.lua"
"inspect.lua"
"location.lua"
"lo_g.lua"
"main.lua"
"matrix.lua"
"unindent.lua"
"util.lua"
"wrap.lua"
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)
# vim: expandtab shiftwidth=4:
| Work on pure Lua IF | Work on pure Lua IF
| Text | mit | jeffreykegler/kollos,jeffreykegler/kollos,pczarn/kollos,jeffreykegler/kollos,pczarn/kollos,pczarn/kollos,jeffreykegler/kollos,jeffreykegler/kollos,pczarn/kollos,pczarn/kollos | text | ## Code Before:
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
PROJECT(kollos C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
# ------------------
# Module search path
# ------------------
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
ENABLE_TESTING()
ADD_CUSTOM_COMMAND (
COMMENT "Writing grammar.lua"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMAND cp
${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
VERBATIM
)
add_custom_target(
grammar.lua ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMENT "Writing grammar.lua"
VERBATIM
)
file(COPY
"config.lua"
"development.lua"
"inspect.lua"
"location.lua"
"lo_g.lua"
"main.lua"
"matrix.lua"
"unindent.lua"
"util.lua"
"wrap.lua"
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)
# vim: expandtab shiftwidth=4:
## Instruction:
Work on pure Lua IF
## Code After:
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
PROJECT(kollos C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
# ------------------
# Module search path
# ------------------
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
ENABLE_TESTING()
ADD_CUSTOM_COMMAND (
COMMENT "Writing grammar.lua"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMAND ${lua_INTERP} ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
VERBATIM
)
add_custom_target(
grammar.lua ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMENT "Writing grammar.lua"
VERBATIM
)
file(COPY
"config.lua"
"development.lua"
"inspect.lua"
"location.lua"
"lo_g.lua"
"main.lua"
"matrix.lua"
"unindent.lua"
"util.lua"
"wrap.lua"
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)
# vim: expandtab shiftwidth=4:
| CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
PROJECT(kollos C)
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(SEND_ERROR "In-source builds are not allowed.")
endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
# ------------------
# Module search path
# ------------------
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
ENABLE_TESTING()
ADD_CUSTOM_COMMAND (
COMMENT "Writing grammar.lua"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
- COMMAND cp
+ COMMAND ${lua_INTERP} ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar.lua.md
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/luatangle
VERBATIM
)
add_custom_target(
grammar.lua ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grammar.lua
COMMENT "Writing grammar.lua"
VERBATIM
)
file(COPY
"config.lua"
"development.lua"
"inspect.lua"
"location.lua"
"lo_g.lua"
"main.lua"
"matrix.lua"
"unindent.lua"
"util.lua"
"wrap.lua"
DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
)
# vim: expandtab shiftwidth=4: | 3 | 0.06383 | 2 | 1 |
32de607ff649ff1d66dfa2cd8cce4f61741a707d | extension/js/agent/patches/util/addCidToComponent.js | extension/js/agent/patches/util/addCidToComponent.js | ;(function(Agent) {
/**
Some backbone and marionette objects don't have cids (gasp)
When that happens we go in and add this property __marionette_inspector__cid
with a stupid long and obscure name. We use Object.defineProperty so that we
can effectively hide the property with enumerable and writable set to false.
*/
Agent.addCidToComponent = function(object) {
Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
}
}(Agent)); | ;(function(Agent) {
/**
Some backbone and marionette objects don't have cids (gasp)
When that happens we go in and add this property __marionette_inspector__cid
with a stupid long and obscure name. We use Object.defineProperty so that we
can effectively hide the property with enumerable and writable set to false.
*/
Agent.addCidToComponent = function(object) {
if (!object.cid) Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
}
}(Agent)); | Check cid before setting hidden cid property | Check cid before setting hidden cid property
| JavaScript | mit | marionettejs/marionette.inspector,marionettejs/marionette.inspector,marionettejs/marionette.inspector | javascript | ## Code Before:
;(function(Agent) {
/**
Some backbone and marionette objects don't have cids (gasp)
When that happens we go in and add this property __marionette_inspector__cid
with a stupid long and obscure name. We use Object.defineProperty so that we
can effectively hide the property with enumerable and writable set to false.
*/
Agent.addCidToComponent = function(object) {
Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
}
}(Agent));
## Instruction:
Check cid before setting hidden cid property
## Code After:
;(function(Agent) {
/**
Some backbone and marionette objects don't have cids (gasp)
When that happens we go in and add this property __marionette_inspector__cid
with a stupid long and obscure name. We use Object.defineProperty so that we
can effectively hide the property with enumerable and writable set to false.
*/
Agent.addCidToComponent = function(object) {
if (!object.cid) Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
}
}(Agent)); | ;(function(Agent) {
/**
Some backbone and marionette objects don't have cids (gasp)
When that happens we go in and add this property __marionette_inspector__cid
with a stupid long and obscure name. We use Object.defineProperty so that we
can effectively hide the property with enumerable and writable set to false.
*/
Agent.addCidToComponent = function(object) {
- Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
+ if (!object.cid) Agent.setHiddenProperty(object, 'cid', _.uniqueId('c'));
? +++++++++++++++++
}
}(Agent)); | 2 | 0.142857 | 1 | 1 |
a9d1ef4fdad0ff8252454a50e76b5fc93aab449a | lib/nehm/playlist_manager.rb | lib/nehm/playlist_manager.rb | module Nehm
module PlaylistManager
def self.playlist
@temp_playlist || default_user_playlist || music_master_library
end
def self.set_playlist
loop do
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
# If entered nothing, unset iTunes playlist
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
break
end
if AppleScript.list_of_playlists.include? playlist
Cfg[:playlist] = playlist
puts Paint["Default iTunes playlist set up to #{playlist}", :green]
break
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
end
end
end
def self.temp_playlist=(playlist)
if AppleScript.list_of_playlists.include? playlist
@temp_playlist = Playlist.new(playlist)
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
exit
end
end
module_function
def default_user_playlist
Playlist.new(Cfg[:playlist]) unless Cfg[:playlist].nil?
end
def music_master_library
Playlist.new(AppleScript.music_master_library)
end
end
end
| module Nehm
module PlaylistManager
def self.playlist
@temp_playlist || default_user_playlist || music_master_library unless OS.linux?
end
def self.set_playlist
loop do
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
# If entered nothing, unset iTunes playlist
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
break
end
if AppleScript.list_of_playlists.include? playlist
Cfg[:playlist] = playlist
puts Paint["Default iTunes playlist set up to #{playlist}", :green]
break
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
end
end
end
def self.temp_playlist=(playlist)
if AppleScript.list_of_playlists.include? playlist
@temp_playlist = Playlist.new(playlist)
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
exit
end
end
module_function
def default_user_playlist
Playlist.new(Cfg[:playlist]) unless Cfg[:playlist].nil?
end
def music_master_library
Playlist.new(AppleScript.music_master_library)
end
end
end
| Add check for OS in PlaylistManager.playlist | Add check for OS in PlaylistManager.playlist
| Ruby | mit | bogem/nehm | ruby | ## Code Before:
module Nehm
module PlaylistManager
def self.playlist
@temp_playlist || default_user_playlist || music_master_library
end
def self.set_playlist
loop do
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
# If entered nothing, unset iTunes playlist
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
break
end
if AppleScript.list_of_playlists.include? playlist
Cfg[:playlist] = playlist
puts Paint["Default iTunes playlist set up to #{playlist}", :green]
break
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
end
end
end
def self.temp_playlist=(playlist)
if AppleScript.list_of_playlists.include? playlist
@temp_playlist = Playlist.new(playlist)
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
exit
end
end
module_function
def default_user_playlist
Playlist.new(Cfg[:playlist]) unless Cfg[:playlist].nil?
end
def music_master_library
Playlist.new(AppleScript.music_master_library)
end
end
end
## Instruction:
Add check for OS in PlaylistManager.playlist
## Code After:
module Nehm
module PlaylistManager
def self.playlist
@temp_playlist || default_user_playlist || music_master_library unless OS.linux?
end
def self.set_playlist
loop do
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
# If entered nothing, unset iTunes playlist
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
break
end
if AppleScript.list_of_playlists.include? playlist
Cfg[:playlist] = playlist
puts Paint["Default iTunes playlist set up to #{playlist}", :green]
break
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
end
end
end
def self.temp_playlist=(playlist)
if AppleScript.list_of_playlists.include? playlist
@temp_playlist = Playlist.new(playlist)
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
exit
end
end
module_function
def default_user_playlist
Playlist.new(Cfg[:playlist]) unless Cfg[:playlist].nil?
end
def music_master_library
Playlist.new(AppleScript.music_master_library)
end
end
end
| module Nehm
module PlaylistManager
def self.playlist
- @temp_playlist || default_user_playlist || music_master_library
+ @temp_playlist || default_user_playlist || music_master_library unless OS.linux?
? +++++++++++++++++
end
def self.set_playlist
loop do
playlist = HighLine.new.ask('Enter name of default iTunes playlist to which you want add tracks (press Enter to set it to default iTunes Music library)')
- # If entered nothing, unset iTunes playlist
? -
+ # If entered nothing, unset iTunes playlist
if playlist == ''
Cfg[:playlist] = nil
puts Paint['Default iTunes playlist unset', :green]
break
end
if AppleScript.list_of_playlists.include? playlist
Cfg[:playlist] = playlist
puts Paint["Default iTunes playlist set up to #{playlist}", :green]
break
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
end
end
end
def self.temp_playlist=(playlist)
if AppleScript.list_of_playlists.include? playlist
@temp_playlist = Playlist.new(playlist)
else
puts Paint['Invalid playlist name. Please enter correct name', :red]
exit
end
end
module_function
def default_user_playlist
Playlist.new(Cfg[:playlist]) unless Cfg[:playlist].nil?
end
def music_master_library
Playlist.new(AppleScript.music_master_library)
end
end
end | 4 | 0.085106 | 2 | 2 |
96c0b5121349254c9466e745fc33655b4ebc4c34 | doc/tunnels.rst | doc/tunnels.rst | Tunnels
=======
Tunnels are the lowest-level API, used for invoking commands on an individual
host or container. For a higher-level API that allows invoking commands in
parallel across a range of hosts, see :doc:`groups`.
An established tunnel can be used to invoke commands and receive results.
.. currentmodule:: chopsticks.tunnel
SSH
'''
.. autoclass:: SSHTunnel
.. automethod:: call
.. autoclass:: Tunnel
Docker
''''''
.. autoclass:: Docker
Subprocess
''''''''''
.. autoclass:: Local
Writing new tunnels
-------------------
It is possible to write a new tunnel driver for any system that allows you to
execute a ``python`` binary with direct relay of ``stdin`` and ``stdout``
pipes. To do this, simply subclass ``chopsticks.group.SubprocessTunnel``. Note
that all tunnel instances must have a ``host`` attibute which is used as the
key for the result in the :class:`GroupResult` dictionary when executing tasks
in a :class:`Group`.
So, strictly, these requirements apply:
* The tunnel setup machinery should not write to ``stdout`` - else you will
have to identify and consume this output.
* The tunnel setup machinery should not read from ``stdin`` - else you will
have to feed the required input.
* Both ``stdin`` and ``stdout`` must be binary-safe pipes.
The tunnel machinery may write to ``stderr``; this output will be presented to
the user.
| Tunnels
=======
Tunnels are the lowest-level API, used for invoking commands on an individual
host or container. For a higher-level API that allows invoking commands in
parallel across a range of hosts, see :doc:`groups`.
An established tunnel can be used to invoke commands and receive results.
.. currentmodule:: chopsticks.tunnel
SSH
'''
.. autoclass:: SSHTunnel
.. automethod:: call
.. automethod:: fetch
.. autoclass:: Tunnel
Docker
''''''
.. autoclass:: Docker
Subprocess
''''''''''
.. autoclass:: Local
Writing new tunnels
-------------------
It is possible to write a new tunnel driver for any system that allows you to
execute a ``python`` binary with direct relay of ``stdin`` and ``stdout``
pipes. To do this, simply subclass ``chopsticks.group.SubprocessTunnel``. Note
that all tunnel instances must have a ``host`` attibute which is used as the
key for the result in the :class:`GroupResult` dictionary when executing tasks
in a :class:`Group`.
So, strictly, these requirements apply:
* The tunnel setup machinery should not write to ``stdout`` - else you will
have to identify and consume this output.
* The tunnel setup machinery should not read from ``stdin`` - else you will
have to feed the required input.
* Both ``stdin`` and ``stdout`` must be binary-safe pipes.
The tunnel machinery may write to ``stderr``; this output will be presented to
the user.
| Add Tunnel.fetch to the docs | Add Tunnel.fetch to the docs
| reStructuredText | apache-2.0 | lordmauve/chopsticks,lordmauve/chopsticks | restructuredtext | ## Code Before:
Tunnels
=======
Tunnels are the lowest-level API, used for invoking commands on an individual
host or container. For a higher-level API that allows invoking commands in
parallel across a range of hosts, see :doc:`groups`.
An established tunnel can be used to invoke commands and receive results.
.. currentmodule:: chopsticks.tunnel
SSH
'''
.. autoclass:: SSHTunnel
.. automethod:: call
.. autoclass:: Tunnel
Docker
''''''
.. autoclass:: Docker
Subprocess
''''''''''
.. autoclass:: Local
Writing new tunnels
-------------------
It is possible to write a new tunnel driver for any system that allows you to
execute a ``python`` binary with direct relay of ``stdin`` and ``stdout``
pipes. To do this, simply subclass ``chopsticks.group.SubprocessTunnel``. Note
that all tunnel instances must have a ``host`` attibute which is used as the
key for the result in the :class:`GroupResult` dictionary when executing tasks
in a :class:`Group`.
So, strictly, these requirements apply:
* The tunnel setup machinery should not write to ``stdout`` - else you will
have to identify and consume this output.
* The tunnel setup machinery should not read from ``stdin`` - else you will
have to feed the required input.
* Both ``stdin`` and ``stdout`` must be binary-safe pipes.
The tunnel machinery may write to ``stderr``; this output will be presented to
the user.
## Instruction:
Add Tunnel.fetch to the docs
## Code After:
Tunnels
=======
Tunnels are the lowest-level API, used for invoking commands on an individual
host or container. For a higher-level API that allows invoking commands in
parallel across a range of hosts, see :doc:`groups`.
An established tunnel can be used to invoke commands and receive results.
.. currentmodule:: chopsticks.tunnel
SSH
'''
.. autoclass:: SSHTunnel
.. automethod:: call
.. automethod:: fetch
.. autoclass:: Tunnel
Docker
''''''
.. autoclass:: Docker
Subprocess
''''''''''
.. autoclass:: Local
Writing new tunnels
-------------------
It is possible to write a new tunnel driver for any system that allows you to
execute a ``python`` binary with direct relay of ``stdin`` and ``stdout``
pipes. To do this, simply subclass ``chopsticks.group.SubprocessTunnel``. Note
that all tunnel instances must have a ``host`` attibute which is used as the
key for the result in the :class:`GroupResult` dictionary when executing tasks
in a :class:`Group`.
So, strictly, these requirements apply:
* The tunnel setup machinery should not write to ``stdout`` - else you will
have to identify and consume this output.
* The tunnel setup machinery should not read from ``stdin`` - else you will
have to feed the required input.
* Both ``stdin`` and ``stdout`` must be binary-safe pipes.
The tunnel machinery may write to ``stderr``; this output will be presented to
the user.
| Tunnels
=======
Tunnels are the lowest-level API, used for invoking commands on an individual
host or container. For a higher-level API that allows invoking commands in
parallel across a range of hosts, see :doc:`groups`.
An established tunnel can be used to invoke commands and receive results.
.. currentmodule:: chopsticks.tunnel
SSH
'''
.. autoclass:: SSHTunnel
.. automethod:: call
+
+ .. automethod:: fetch
.. autoclass:: Tunnel
Docker
''''''
.. autoclass:: Docker
Subprocess
''''''''''
.. autoclass:: Local
Writing new tunnels
-------------------
It is possible to write a new tunnel driver for any system that allows you to
execute a ``python`` binary with direct relay of ``stdin`` and ``stdout``
pipes. To do this, simply subclass ``chopsticks.group.SubprocessTunnel``. Note
that all tunnel instances must have a ``host`` attibute which is used as the
key for the result in the :class:`GroupResult` dictionary when executing tasks
in a :class:`Group`.
So, strictly, these requirements apply:
* The tunnel setup machinery should not write to ``stdout`` - else you will
have to identify and consume this output.
* The tunnel setup machinery should not read from ``stdin`` - else you will
have to feed the required input.
* Both ``stdin`` and ``stdout`` must be binary-safe pipes.
The tunnel machinery may write to ``stderr``; this output will be presented to
the user. | 2 | 0.037736 | 2 | 0 |
31212104810f6c700ccc9561ac3d355b1894ef47 | glimpse/__init__.py | glimpse/__init__.py | import sys
__version__ = '0.2.1'
| import sys
__version__ = '0.2.1'
import glimpse.util.pil_fix # workaround PIL error on OS X
| Fix PIL bug on OS X. | Fix PIL bug on OS X.
| Python | mit | mthomure/glimpse-project,mthomure/glimpse-project,mthomure/glimpse-project | python | ## Code Before:
import sys
__version__ = '0.2.1'
## Instruction:
Fix PIL bug on OS X.
## Code After:
import sys
__version__ = '0.2.1'
import glimpse.util.pil_fix # workaround PIL error on OS X
| import sys
__version__ = '0.2.1'
+
+ import glimpse.util.pil_fix # workaround PIL error on OS X | 2 | 1 | 2 | 0 |
3b1fc736adb1ace3183e0ce21fe79568bb33e808 | templates/navbar.html | templates/navbar.html | {% load i18n %}
{% load profiles %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}">Memoir</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
{% url 'quote:top' as top_page %}
<li class="{% if request.get_full_path == top_page %}active{% endif %}">
<a href="{{ top_page }}">{% trans "Top" %}</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right flip">
<li>
<div class="btn-nav">
<a class="btn btn-primary navbar-btn" href="{% url 'quote:create' %}">{% trans "Create" %}</a>
</div>
</li>
<li>
<div class="navbar-text">
{% if user.is_authenticated %}
<span>
{% trans "Logged in as " %}<strong>{% profile_link user classes="navbar-link" %}</strong>
</span>
<span>
(<a class="navbar-link" href="{% url 'switch-user' %}">{% trans "switch" %}</a>)
</span>
{% else %}
<a class="navbar-link" href="{% url 'login' %}">{% trans "Login" %}</a>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div>
| {% load i18n %}
{% load profiles %}
{% url 'quote:top' as top_page %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}">Memoir</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="{% if request.get_full_path == top_page %}active{% endif %}">
<a href="{{ top_page }}">{% trans "Top" %}</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right flip">
<li>
<div class="btn-nav">
<a class="btn btn-primary navbar-btn" href="{% url 'quote:create' %}">{% trans "Create" %}</a>
</div>
</li>
<li>
<div class="navbar-text">
{% if user.is_authenticated %}
<span>
{% trans "Logged in as " %}<strong>{% profile_link user classes="navbar-link" %}</strong>
</span>
<span>
(<a class="navbar-link" href="{% url 'switch-user' %}">{% trans "switch" %}</a>)
</span>
{% else %}
<a class="navbar-link" href="{% url 'login' %}">{% trans "Login" %}</a>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div>
| Move template variable set in html | Move template variable set in html
| HTML | mit | nivbend/memoir,nivbend/memoir,nivbend/memoir | html | ## Code Before:
{% load i18n %}
{% load profiles %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}">Memoir</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
{% url 'quote:top' as top_page %}
<li class="{% if request.get_full_path == top_page %}active{% endif %}">
<a href="{{ top_page }}">{% trans "Top" %}</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right flip">
<li>
<div class="btn-nav">
<a class="btn btn-primary navbar-btn" href="{% url 'quote:create' %}">{% trans "Create" %}</a>
</div>
</li>
<li>
<div class="navbar-text">
{% if user.is_authenticated %}
<span>
{% trans "Logged in as " %}<strong>{% profile_link user classes="navbar-link" %}</strong>
</span>
<span>
(<a class="navbar-link" href="{% url 'switch-user' %}">{% trans "switch" %}</a>)
</span>
{% else %}
<a class="navbar-link" href="{% url 'login' %}">{% trans "Login" %}</a>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div>
## Instruction:
Move template variable set in html
## Code After:
{% load i18n %}
{% load profiles %}
{% url 'quote:top' as top_page %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}">Memoir</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="{% if request.get_full_path == top_page %}active{% endif %}">
<a href="{{ top_page }}">{% trans "Top" %}</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right flip">
<li>
<div class="btn-nav">
<a class="btn btn-primary navbar-btn" href="{% url 'quote:create' %}">{% trans "Create" %}</a>
</div>
</li>
<li>
<div class="navbar-text">
{% if user.is_authenticated %}
<span>
{% trans "Logged in as " %}<strong>{% profile_link user classes="navbar-link" %}</strong>
</span>
<span>
(<a class="navbar-link" href="{% url 'switch-user' %}">{% trans "switch" %}</a>)
</span>
{% else %}
<a class="navbar-link" href="{% url 'login' %}">{% trans "Login" %}</a>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div>
| {% load i18n %}
{% load profiles %}
+
+ {% url 'quote:top' as top_page %}
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}">Memoir</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
- {% url 'quote:top' as top_page %}
<li class="{% if request.get_full_path == top_page %}active{% endif %}">
<a href="{{ top_page }}">{% trans "Top" %}</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right flip">
<li>
<div class="btn-nav">
<a class="btn btn-primary navbar-btn" href="{% url 'quote:create' %}">{% trans "Create" %}</a>
</div>
</li>
<li>
<div class="navbar-text">
{% if user.is_authenticated %}
<span>
{% trans "Logged in as " %}<strong>{% profile_link user classes="navbar-link" %}</strong>
</span>
<span>
(<a class="navbar-link" href="{% url 'switch-user' %}">{% trans "switch" %}</a>)
</span>
{% else %}
<a class="navbar-link" href="{% url 'login' %}">{% trans "Login" %}</a>
{% endif %}
</div>
</li>
</ul>
</div>
</div>
</div> | 3 | 0.076923 | 2 | 1 |
844353233c735a5263f2945e079ee06e30e74572 | keratin-core/src/ca/szc/keratin/core/net/BusErrorHandler.java | keratin-core/src/ca/szc/keratin/core/net/BusErrorHandler.java | /**
* Copyright (C) 2013 Alexander Szczuczko
*
* This file may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package ca.szc.keratin.core.net;
import org.pmw.tinylog.Logger;
import net.engio.mbassy.IPublicationErrorHandler;
import net.engio.mbassy.PublicationError;
/**
* Logs PublicationErrors at error level
*/
public class BusErrorHandler
implements IPublicationErrorHandler
{
@Override
public void handleError( PublicationError error )
{
Logger.error( error.toString() );
}
}
| /**
* Copyright (C) 2013 Alexander Szczuczko
*
* This file may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package ca.szc.keratin.core.net;
import org.pmw.tinylog.Logger;
import net.engio.mbassy.IPublicationErrorHandler;
import net.engio.mbassy.PublicationError;
/**
* Logs PublicationErrors at error level
*/
public class BusErrorHandler
implements IPublicationErrorHandler
{
@Override
public void handleError( PublicationError error )
{
Logger.error( error.toString() );
logAllSubCauses( error.getCause() );
}
private void logAllSubCauses( Throwable cause )
{
Throwable subcause = cause.getCause();
if ( subcause != null )
{
Logger.error( subcause, "Subcause of " + cause );
logAllSubCauses( subcause );
}
}
}
| Add recursive logging of causes for the bus error handler. | Add recursive logging of causes for the bus error handler.
| Java | mit | emmettu/keratin-irc,ASzc/keratin-irc | java | ## Code Before:
/**
* Copyright (C) 2013 Alexander Szczuczko
*
* This file may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package ca.szc.keratin.core.net;
import org.pmw.tinylog.Logger;
import net.engio.mbassy.IPublicationErrorHandler;
import net.engio.mbassy.PublicationError;
/**
* Logs PublicationErrors at error level
*/
public class BusErrorHandler
implements IPublicationErrorHandler
{
@Override
public void handleError( PublicationError error )
{
Logger.error( error.toString() );
}
}
## Instruction:
Add recursive logging of causes for the bus error handler.
## Code After:
/**
* Copyright (C) 2013 Alexander Szczuczko
*
* This file may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package ca.szc.keratin.core.net;
import org.pmw.tinylog.Logger;
import net.engio.mbassy.IPublicationErrorHandler;
import net.engio.mbassy.PublicationError;
/**
* Logs PublicationErrors at error level
*/
public class BusErrorHandler
implements IPublicationErrorHandler
{
@Override
public void handleError( PublicationError error )
{
Logger.error( error.toString() );
logAllSubCauses( error.getCause() );
}
private void logAllSubCauses( Throwable cause )
{
Throwable subcause = cause.getCause();
if ( subcause != null )
{
Logger.error( subcause, "Subcause of " + cause );
logAllSubCauses( subcause );
}
}
}
| /**
* Copyright (C) 2013 Alexander Szczuczko
*
* This file may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package ca.szc.keratin.core.net;
import org.pmw.tinylog.Logger;
import net.engio.mbassy.IPublicationErrorHandler;
import net.engio.mbassy.PublicationError;
/**
* Logs PublicationErrors at error level
*/
public class BusErrorHandler
implements IPublicationErrorHandler
{
@Override
public void handleError( PublicationError error )
{
Logger.error( error.toString() );
+ logAllSubCauses( error.getCause() );
+
}
+ private void logAllSubCauses( Throwable cause )
+ {
+ Throwable subcause = cause.getCause();
+ if ( subcause != null )
+ {
+ Logger.error( subcause, "Subcause of " + cause );
+ logAllSubCauses( subcause );
+ }
+ }
} | 11 | 0.407407 | 11 | 0 |
aaccd179306a5a08dcff54d1a631c746d29a1a16 | app/src/main/java/ch/pantas/billsplitter/services/SharedPreferenceService.java | app/src/main/java/ch/pantas/billsplitter/services/SharedPreferenceService.java | package ch.pantas.billsplitter.services;
import android.content.SharedPreferences;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
@Singleton
public class SharedPreferenceService {
public static final String USER_NAME = "USER_NAME";
public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";
@Inject
private SharedPreferences preferences;
public void storeUserName(String userName) {
checkNotNull(userName);
checkArgument(!userName.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(USER_NAME, userName);
editor.apply();
}
public String getUserName() {
return preferences.getString(USER_NAME, null);
}
public void storeActiveEventId(String eventId) {
checkNotNull(eventId);
checkArgument(!eventId.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(ACTIVE_EVENT_ID, eventId);
editor.apply();
}
public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}
| package ch.pantas.billsplitter.services;
import android.content.SharedPreferences;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
@Singleton
public class SharedPreferenceService {
public static final String USER_NAME = "USER_NAME";
public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";
@Inject
private SharedPreferences preferences;
public void storeUserName(String userName) {
checkNotNull(userName);
checkArgument(!userName.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(USER_NAME, userName);
editor.apply();
}
public String getUserName() {
return preferences.getString(USER_NAME, null);
}
public void storeActiveEventId(String eventId) {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(ACTIVE_EVENT_ID, eventId);
editor.apply();
}
public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}
| Allow to save null as default-event (no event) | FIXED: Allow to save null as default-event (no event)
| Java | mit | ybonjour/BillSplitter | java | ## Code Before:
package ch.pantas.billsplitter.services;
import android.content.SharedPreferences;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
@Singleton
public class SharedPreferenceService {
public static final String USER_NAME = "USER_NAME";
public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";
@Inject
private SharedPreferences preferences;
public void storeUserName(String userName) {
checkNotNull(userName);
checkArgument(!userName.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(USER_NAME, userName);
editor.apply();
}
public String getUserName() {
return preferences.getString(USER_NAME, null);
}
public void storeActiveEventId(String eventId) {
checkNotNull(eventId);
checkArgument(!eventId.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(ACTIVE_EVENT_ID, eventId);
editor.apply();
}
public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}
## Instruction:
FIXED: Allow to save null as default-event (no event)
## Code After:
package ch.pantas.billsplitter.services;
import android.content.SharedPreferences;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
@Singleton
public class SharedPreferenceService {
public static final String USER_NAME = "USER_NAME";
public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";
@Inject
private SharedPreferences preferences;
public void storeUserName(String userName) {
checkNotNull(userName);
checkArgument(!userName.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(USER_NAME, userName);
editor.apply();
}
public String getUserName() {
return preferences.getString(USER_NAME, null);
}
public void storeActiveEventId(String eventId) {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(ACTIVE_EVENT_ID, eventId);
editor.apply();
}
public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}
| package ch.pantas.billsplitter.services;
import android.content.SharedPreferences;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;
@Singleton
public class SharedPreferenceService {
public static final String USER_NAME = "USER_NAME";
public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";
@Inject
private SharedPreferences preferences;
public void storeUserName(String userName) {
checkNotNull(userName);
checkArgument(!userName.isEmpty());
SharedPreferences.Editor editor = preferences.edit();
editor.putString(USER_NAME, userName);
editor.apply();
}
public String getUserName() {
return preferences.getString(USER_NAME, null);
}
public void storeActiveEventId(String eventId) {
- checkNotNull(eventId);
- checkArgument(!eventId.isEmpty());
-
SharedPreferences.Editor editor = preferences.edit();
editor.putString(ACTIVE_EVENT_ID, eventId);
editor.apply();
}
public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
} | 3 | 0.069767 | 0 | 3 |
d5fc2a456e463efe4ae5dea1b4cfb542891b6da1 | botbot/templates/includes/field.html | botbot/templates/includes/field.html | <div class="control-group required {% if field_class %} {{ field_class }}{% endif %}">
<label class="control-label" for="id_{{ field.html_name }}">
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %}
{% if not field.field.required and not hide_optional %}<br><small class="muted">optional</small>{% endif %}</label>
<div class="controls">
{{ field }}
{% if help_text %}
<span class="help-inline">{{ help_text }}</span>
{% elif field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% for error in field.errors %}
<p class="text-error">{{ error }}</p>
{% endfor %}
</div>
</div>
| <div class="control-group required {% if field_class %} {{ field_class }}{% endif %}{% if field.errors %} error{% endif %}">
<label class="control-label" for="id_{{ field.html_name }}">
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %}
{% if not field.field.required and not hide_optional %}<br><small class="muted">optional</small>{% endif %}</label>
<div class="controls">
{{ field }}
{% if help_text %}
<span class="help-inline">{{ help_text }}</span>
{% elif field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% for error in field.errors %}
<p class="help-block">{{ error }}</p>
{% endfor %}
</div>
</div>
| Add bootstrap feedback for error form errors. | Add bootstrap feedback for error form errors.
Fixes #81
| HTML | mit | metabrainz/botbot-web,reidwooten99/botbot-web,Freso/botbot-web,reidwooten99/botbot-web,Freso/botbot-web,metabrainz/botbot-web,reidwooten99/botbot-web,Freso/botbot-web,metabrainz/botbot-web | html | ## Code Before:
<div class="control-group required {% if field_class %} {{ field_class }}{% endif %}">
<label class="control-label" for="id_{{ field.html_name }}">
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %}
{% if not field.field.required and not hide_optional %}<br><small class="muted">optional</small>{% endif %}</label>
<div class="controls">
{{ field }}
{% if help_text %}
<span class="help-inline">{{ help_text }}</span>
{% elif field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% for error in field.errors %}
<p class="text-error">{{ error }}</p>
{% endfor %}
</div>
</div>
## Instruction:
Add bootstrap feedback for error form errors.
Fixes #81
## Code After:
<div class="control-group required {% if field_class %} {{ field_class }}{% endif %}{% if field.errors %} error{% endif %}">
<label class="control-label" for="id_{{ field.html_name }}">
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %}
{% if not field.field.required and not hide_optional %}<br><small class="muted">optional</small>{% endif %}</label>
<div class="controls">
{{ field }}
{% if help_text %}
<span class="help-inline">{{ help_text }}</span>
{% elif field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% for error in field.errors %}
<p class="help-block">{{ error }}</p>
{% endfor %}
</div>
</div>
| - <div class="control-group required {% if field_class %} {{ field_class }}{% endif %}">
+ <div class="control-group required {% if field_class %} {{ field_class }}{% endif %}{% if field.errors %} error{% endif %}">
? ++++++++++++++++++++++++++++++++++++++
<label class="control-label" for="id_{{ field.html_name }}">
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %}
{% if not field.field.required and not hide_optional %}<br><small class="muted">optional</small>{% endif %}</label>
<div class="controls">
{{ field }}
{% if help_text %}
<span class="help-inline">{{ help_text }}</span>
{% elif field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
{% for error in field.errors %}
- <p class="text-error">{{ error }}</p>
? ^ ^^ ^^^ ^
+ <p class="help-block">{{ error }}</p>
? ^ ^^ ^^ ^^
{% endfor %}
</div>
</div> | 4 | 0.222222 | 2 | 2 |
6c92bc2b5c487a6ebbaba54fe2c0dd1fb8af1a50 | static/js/web_socket.js | static/js/web_socket.js | function sockets(){
var socket = new WebSocket("ws://localhost:8765");
window.frequency = 1;
window.height = 0;
window.width = 0;
var hero = {};
window.heroId = '';
var units = [];
socket.onopen = function(event) {
console.log("Connected.");
};
socket.onclose = function(event) {
if (event.wasClean) {
console.log('Connection closed');
} else {
console.log('disconnection');
}
console.log('code: ' + event.code + ' reason: ' + event.reason);
};
socket.onmessage = function(event) {
var answer = JSON.parse(event.data);
console.log(answer);
//if (answer.id)
// document.cookie = "hero_id=" + answer.id;
if (answer.hasOwnProperty('frequency')) {
frequency = answer.frequency;
height = answer.field.height;
width = answer.field.width;
heroId = answer.id;
}
else if (units.length == 0) {
units = answer;
hero = units[heroId];
restart(hero, units);
}
//else if (answer.hasOwnProperty('update')){
// unitUpdate(answer['update']);
//}
else {
units = answer;
hero = units[heroId];
unitsUpdate(hero, units);
}
};
socket.onerror = function(error) {
console.log("Error " + error.message);
};
}
| function sockets(){
var socket = new WebSocket("ws://localhost:8765");
window.frequency = 1;
window.height = 0;
window.width = 0;
var hero = {};
window.heroId = '';
var units = [];
socket.onopen = function(event) {
console.log("Connected.");
};
socket.onclose = function(event) {
if (event.wasClean) {
console.log('Connection closed');
} else {
console.log('disconnection');
}
console.log('code: ' + event.code + ' reason: ' + event.reason);
};
socket.onmessage = function(event) {
var answer = JSON.parse(event.data);
console.log(answer);
//if (answer.id)
// document.cookie = "hero_id=" + answer.id;
if (answer.hasOwnProperty('frequency')) {
frequency = answer.frequency;
height = answer.field.height;
width = answer.field.width;
document.getElementById('gameCanvas').width=width;
document.getElementById('gameCanvas').height=height;
heroId = answer.id;
}
else if (units.length == 0) {
units = answer;
hero = units[heroId];
restart(hero, units);
}
//else if (answer.hasOwnProperty('update')){
// unitUpdate(answer['update']);
//}
else {
units = answer;
hero = units[heroId];
unitsUpdate(hero, units);
}
};
socket.onerror = function(error) {
console.log("Error " + error.message);
};
}
| Set parameters for game field from server | Set parameters for game field from server
| JavaScript | mit | pzdeb/SimpleCommander,pzdeb/SimpleCommander,pzdeb/SimpleCommander,pzdeb/SimpleCommander | javascript | ## Code Before:
function sockets(){
var socket = new WebSocket("ws://localhost:8765");
window.frequency = 1;
window.height = 0;
window.width = 0;
var hero = {};
window.heroId = '';
var units = [];
socket.onopen = function(event) {
console.log("Connected.");
};
socket.onclose = function(event) {
if (event.wasClean) {
console.log('Connection closed');
} else {
console.log('disconnection');
}
console.log('code: ' + event.code + ' reason: ' + event.reason);
};
socket.onmessage = function(event) {
var answer = JSON.parse(event.data);
console.log(answer);
//if (answer.id)
// document.cookie = "hero_id=" + answer.id;
if (answer.hasOwnProperty('frequency')) {
frequency = answer.frequency;
height = answer.field.height;
width = answer.field.width;
heroId = answer.id;
}
else if (units.length == 0) {
units = answer;
hero = units[heroId];
restart(hero, units);
}
//else if (answer.hasOwnProperty('update')){
// unitUpdate(answer['update']);
//}
else {
units = answer;
hero = units[heroId];
unitsUpdate(hero, units);
}
};
socket.onerror = function(error) {
console.log("Error " + error.message);
};
}
## Instruction:
Set parameters for game field from server
## Code After:
function sockets(){
var socket = new WebSocket("ws://localhost:8765");
window.frequency = 1;
window.height = 0;
window.width = 0;
var hero = {};
window.heroId = '';
var units = [];
socket.onopen = function(event) {
console.log("Connected.");
};
socket.onclose = function(event) {
if (event.wasClean) {
console.log('Connection closed');
} else {
console.log('disconnection');
}
console.log('code: ' + event.code + ' reason: ' + event.reason);
};
socket.onmessage = function(event) {
var answer = JSON.parse(event.data);
console.log(answer);
//if (answer.id)
// document.cookie = "hero_id=" + answer.id;
if (answer.hasOwnProperty('frequency')) {
frequency = answer.frequency;
height = answer.field.height;
width = answer.field.width;
document.getElementById('gameCanvas').width=width;
document.getElementById('gameCanvas').height=height;
heroId = answer.id;
}
else if (units.length == 0) {
units = answer;
hero = units[heroId];
restart(hero, units);
}
//else if (answer.hasOwnProperty('update')){
// unitUpdate(answer['update']);
//}
else {
units = answer;
hero = units[heroId];
unitsUpdate(hero, units);
}
};
socket.onerror = function(error) {
console.log("Error " + error.message);
};
}
| function sockets(){
var socket = new WebSocket("ws://localhost:8765");
window.frequency = 1;
window.height = 0;
window.width = 0;
var hero = {};
window.heroId = '';
var units = [];
socket.onopen = function(event) {
console.log("Connected.");
};
socket.onclose = function(event) {
if (event.wasClean) {
console.log('Connection closed');
} else {
console.log('disconnection');
}
console.log('code: ' + event.code + ' reason: ' + event.reason);
};
socket.onmessage = function(event) {
var answer = JSON.parse(event.data);
console.log(answer);
//if (answer.id)
// document.cookie = "hero_id=" + answer.id;
if (answer.hasOwnProperty('frequency')) {
frequency = answer.frequency;
height = answer.field.height;
width = answer.field.width;
+ document.getElementById('gameCanvas').width=width;
+ document.getElementById('gameCanvas').height=height;
heroId = answer.id;
}
else if (units.length == 0) {
units = answer;
hero = units[heroId];
restart(hero, units);
}
//else if (answer.hasOwnProperty('update')){
// unitUpdate(answer['update']);
//}
else {
units = answer;
hero = units[heroId];
unitsUpdate(hero, units);
}
};
socket.onerror = function(error) {
console.log("Error " + error.message);
};
}
| 2 | 0.036364 | 2 | 0 |
4694fec1aaaa151aab021565eaec8a075cf85980 | _config.yml | _config.yml | safe: true
exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server" ]
| safe: true
exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server", "node_modules" ]
| Add node_modules/ to Jekyll's 'exclude' config option. | Add node_modules/ to Jekyll's 'exclude' config option.
| YAML | mit | milewdev/TinyMock.doc,milewdev/TinyMock.doc | yaml | ## Code Before:
safe: true
exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server" ]
## Instruction:
Add node_modules/ to Jekyll's 'exclude' config option.
## Code After:
safe: true
exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server", "node_modules" ]
| safe: true
- exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server" ]
+ exclude: [ "Gemfile", "*.coffee", "LICENCE", "*.json", "*.md", "start-local-server", "node_modules" ]
? ++++++++++++++++
| 2 | 1 | 1 | 1 |
9e01d0685c4299920360389c255c14c3a59477ce | public/javascripts/application.js | public/javascripts/application.js | // Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
| // Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
if (!Date.now) {
Date.now = function() {
return (new Date()).getTime();
};
}
function updateClock() {
var el = $("uhr");
var time = new Date();
var hours = time.getHours(),
minutes = time.getMinutes(),
seconds = time.getSeconds();
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
el.update("<p>" + hours + ":" + minutes + ":" + seconds + "</p>");
}
document.observe("dom:loaded", function(ev) {
if ($("uhr")) {
window.setInterval(updateClock, 1000);
}
}) | Make the clock on the frontpage work. | Make the clock on the frontpage work.
| JavaScript | mit | bt4y/bulletin_board,bt4y/bulletin_board | javascript | ## Code Before:
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
## Instruction:
Make the clock on the frontpage work.
## Code After:
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
if (!Date.now) {
Date.now = function() {
return (new Date()).getTime();
};
}
function updateClock() {
var el = $("uhr");
var time = new Date();
var hours = time.getHours(),
minutes = time.getMinutes(),
seconds = time.getSeconds();
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
el.update("<p>" + hours + ":" + minutes + ":" + seconds + "</p>");
}
document.observe("dom:loaded", function(ev) {
if ($("uhr")) {
window.setInterval(updateClock, 1000);
}
}) | // Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
+ if (!Date.now) {
+ Date.now = function() {
+ return (new Date()).getTime();
+ };
+ }
+
+ function updateClock() {
+ var el = $("uhr");
+ var time = new Date();
+
+ var hours = time.getHours(),
+ minutes = time.getMinutes(),
+ seconds = time.getSeconds();
+
+ if (hours < 10)
+ hours = "0" + hours;
+
+ if (minutes < 10)
+ minutes = "0" + minutes;
+
+ if (seconds < 10)
+ seconds = "0" + seconds;
+
+
+ el.update("<p>" + hours + ":" + minutes + ":" + seconds + "</p>");
+ }
+
+ document.observe("dom:loaded", function(ev) {
+ if ($("uhr")) {
+ window.setInterval(updateClock, 1000);
+ }
+ }) | 32 | 16 | 32 | 0 |
694d9937b07509eb9924d0e01328bb6b7e5937f2 | tox.ini | tox.ini | [tox]
envlist =
django{17,18}-py{27,34},
[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
deps =
-r{toxinidir}/requirements.txt
django17: django>=1.7,<1.8
django18: django>=1.8,<1.9
py32: coverage==3.7.1
commands = python {toxinidir}/manage.py test
passenv = LANG SSH_AUTH_SOCK TERM
| [tox]
envlist =
django{17,18}-py{27,34},
[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
deps =
-e{toxinidir}[postgres]
-r{toxinidir}/requirements.txt
django17: django>=1.7,<1.8
django18: django>=1.8,<1.9
py32: coverage==3.7.1
commands = python {toxinidir}/manage.py test
passenv = LANG SSH_AUTH_SOCK TERM
| Fix Tox test requirements to include PostgreSQL engine library | Fix Tox test requirements to include PostgreSQL engine library
| INI | mit | ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events | ini | ## Code Before:
[tox]
envlist =
django{17,18}-py{27,34},
[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
deps =
-r{toxinidir}/requirements.txt
django17: django>=1.7,<1.8
django18: django>=1.8,<1.9
py32: coverage==3.7.1
commands = python {toxinidir}/manage.py test
passenv = LANG SSH_AUTH_SOCK TERM
## Instruction:
Fix Tox test requirements to include PostgreSQL engine library
## Code After:
[tox]
envlist =
django{17,18}-py{27,34},
[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
deps =
-e{toxinidir}[postgres]
-r{toxinidir}/requirements.txt
django17: django>=1.7,<1.8
django18: django>=1.8,<1.9
py32: coverage==3.7.1
commands = python {toxinidir}/manage.py test
passenv = LANG SSH_AUTH_SOCK TERM
| [tox]
envlist =
django{17,18}-py{27,34},
[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
deps =
+ -e{toxinidir}[postgres]
-r{toxinidir}/requirements.txt
django17: django>=1.7,<1.8
django18: django>=1.8,<1.9
py32: coverage==3.7.1
commands = python {toxinidir}/manage.py test
passenv = LANG SSH_AUTH_SOCK TERM | 1 | 0.05 | 1 | 0 |
f9d8cf25ae7cc89fb01aa1d0ad2a42e460f9bb38 | README.md | README.md |
:package: Gulp Trailpack.
## 1. Install
```sh
$ npm install trailpack-gulp --save
```
## 2. Configure
### a. Configure Trails
```js
// config/main.js
module.exports = {
...
packs: [
...
require('trailpack-gulp')
]
...
}
```
### b. Configure Gulp
This trailpack uses standard [Gulp Configuration](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md).
```js
// config/gulp.js
module.exports = {
defaultTaskName : 'default',
tasks: {
'default' : function (next) {
//Do what you want with your assets
next()
},
'production' : function (next) {
//Do what you want with your assets
next()
}
}
}
```
## 3. Start!
```sh
$ npm start
```
## 4. Production build
You can override the `defaultTaskName` to run like this :
```js
// config/env/production.js
module.exports = {
...
gulp : {
defaultTaskName : 'production'
}
...
}
```
## License
MIT
## Maintained By
|
:package: Gulp Trailpack.
## 1. Install
```sh
$ npm install trailpack-gulp --save
```
## 2. Configure
### a. Configure Trails
```js
// config/main.js
module.exports = {
...
packs: [
...
require('trailpack-gulp')
]
...
}
```
### b. Configure Gulp
This trailpack uses standard [Gulp Configuration](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md).
```js
// config/gulp.js
const gulp = require('gulp')
const watch = require('gulp-watch')
const src = './assets'
const dest = './.tmp'
module.exports = {
defaultTaskName : 'default',
tasks: {
default: () => {
gulp
.src(src + '/**/*', { base: src })
.pipe(watch(src, { base: src }))
.pipe(gulp.dest(dest))
}
}
}
```
## 3. Start!
```sh
$ npm start
```
## 4. Production build
You can override the `defaultTaskName` to run like this :
```js
// config/env/production.js
module.exports = {
...
gulp : {
defaultTaskName : 'production'
}
...
}
```
## License
MIT
## Maintained By
| Prepare a default Gulp task | Prepare a default Gulp task
| Markdown | mit | YannBertrand/trailpack-gulp | markdown | ## Code Before:
:package: Gulp Trailpack.
## 1. Install
```sh
$ npm install trailpack-gulp --save
```
## 2. Configure
### a. Configure Trails
```js
// config/main.js
module.exports = {
...
packs: [
...
require('trailpack-gulp')
]
...
}
```
### b. Configure Gulp
This trailpack uses standard [Gulp Configuration](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md).
```js
// config/gulp.js
module.exports = {
defaultTaskName : 'default',
tasks: {
'default' : function (next) {
//Do what you want with your assets
next()
},
'production' : function (next) {
//Do what you want with your assets
next()
}
}
}
```
## 3. Start!
```sh
$ npm start
```
## 4. Production build
You can override the `defaultTaskName` to run like this :
```js
// config/env/production.js
module.exports = {
...
gulp : {
defaultTaskName : 'production'
}
...
}
```
## License
MIT
## Maintained By
## Instruction:
Prepare a default Gulp task
## Code After:
:package: Gulp Trailpack.
## 1. Install
```sh
$ npm install trailpack-gulp --save
```
## 2. Configure
### a. Configure Trails
```js
// config/main.js
module.exports = {
...
packs: [
...
require('trailpack-gulp')
]
...
}
```
### b. Configure Gulp
This trailpack uses standard [Gulp Configuration](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md).
```js
// config/gulp.js
const gulp = require('gulp')
const watch = require('gulp-watch')
const src = './assets'
const dest = './.tmp'
module.exports = {
defaultTaskName : 'default',
tasks: {
default: () => {
gulp
.src(src + '/**/*', { base: src })
.pipe(watch(src, { base: src }))
.pipe(gulp.dest(dest))
}
}
}
```
## 3. Start!
```sh
$ npm start
```
## 4. Production build
You can override the `defaultTaskName` to run like this :
```js
// config/env/production.js
module.exports = {
...
gulp : {
defaultTaskName : 'production'
}
...
}
```
## License
MIT
## Maintained By
|
:package: Gulp Trailpack.
## 1. Install
```sh
$ npm install trailpack-gulp --save
```
## 2. Configure
### a. Configure Trails
```js
// config/main.js
module.exports = {
...
packs: [
...
require('trailpack-gulp')
]
...
}
```
### b. Configure Gulp
This trailpack uses standard [Gulp Configuration](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md).
```js
// config/gulp.js
+ const gulp = require('gulp')
+ const watch = require('gulp-watch')
+
+ const src = './assets'
+ const dest = './.tmp'
+
module.exports = {
+
defaultTaskName : 'default',
+
tasks: {
+ default: () => {
+ gulp
+ .src(src + '/**/*', { base: src })
+ .pipe(watch(src, { base: src }))
+ .pipe(gulp.dest(dest))
- 'default' : function (next) {
- //Do what you want with your assets
- next()
- },
- 'production' : function (next) {
- //Do what you want with your assets
- next()
}
}
+
}
```
## 3. Start!
```sh
$ npm start
```
## 4. Production build
You can override the `defaultTaskName` to run like this :
```js
// config/env/production.js
module.exports = {
...
gulp : {
defaultTaskName : 'production'
}
...
}
```
## License
MIT
## Maintained By | 21 | 0.3 | 14 | 7 |
aa5b830a4466ff1de5ef1bc50a19c01a6c8a01ea | config/initializers/async_helper.rb | config/initializers/async_helper.rb | class ActiveRecord::Base
# Creates a async_<methodname> method that
# enqueues the corresponding method call.
def self.async_method(*methods)
methods.each do |method|
define_method "async_#{method}" do |*args|
async method, *args
end
end
end
def self.async(method, *args)
async_in 'class', 1, method.to_s, *args
end
# Enqueues a method to run in the background
def async(method, *args)
# 1 second in the future should be after finishing the SQL transaction
self.class.async_in 'record', 1, method.to_s, id.to_s, *args
end
# Enqueues a method to run in the future
def self.async_in(type, at, *args)
Sidekiq::Client.push \
'queue' => instance_variable_get('@queue') || 'default',
'class' => Worker,
'retry' => false,
'args' => [type, self.to_s, *args],
'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f
end
end
| class ActiveRecord::Base
def self.async(method, *args)
async_in 'class', 1, method.to_s, *args
end
# Enqueues a method to run in the background
def async(method, *args)
# 1 second in the future should be after finishing the SQL transaction
self.class.async_in 'record', 1, method.to_s, id.to_s, *args
end
# Enqueues a method to run in the future
def self.async_in(type, at, *args)
Sidekiq::Client.push \
'queue' => instance_variable_get('@queue') || 'default',
'class' => Worker,
'retry' => false,
'args' => [type, self.to_s, *args],
'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f
end
end
| Refactor AsyncHelper: Remove unused async_method. | Refactor AsyncHelper: Remove unused async_method.
| Ruby | agpl-3.0 | ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub | ruby | ## Code Before:
class ActiveRecord::Base
# Creates a async_<methodname> method that
# enqueues the corresponding method call.
def self.async_method(*methods)
methods.each do |method|
define_method "async_#{method}" do |*args|
async method, *args
end
end
end
def self.async(method, *args)
async_in 'class', 1, method.to_s, *args
end
# Enqueues a method to run in the background
def async(method, *args)
# 1 second in the future should be after finishing the SQL transaction
self.class.async_in 'record', 1, method.to_s, id.to_s, *args
end
# Enqueues a method to run in the future
def self.async_in(type, at, *args)
Sidekiq::Client.push \
'queue' => instance_variable_get('@queue') || 'default',
'class' => Worker,
'retry' => false,
'args' => [type, self.to_s, *args],
'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f
end
end
## Instruction:
Refactor AsyncHelper: Remove unused async_method.
## Code After:
class ActiveRecord::Base
def self.async(method, *args)
async_in 'class', 1, method.to_s, *args
end
# Enqueues a method to run in the background
def async(method, *args)
# 1 second in the future should be after finishing the SQL transaction
self.class.async_in 'record', 1, method.to_s, id.to_s, *args
end
# Enqueues a method to run in the future
def self.async_in(type, at, *args)
Sidekiq::Client.push \
'queue' => instance_variable_get('@queue') || 'default',
'class' => Worker,
'retry' => false,
'args' => [type, self.to_s, *args],
'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f
end
end
| class ActiveRecord::Base
-
- # Creates a async_<methodname> method that
- # enqueues the corresponding method call.
- def self.async_method(*methods)
- methods.each do |method|
- define_method "async_#{method}" do |*args|
- async method, *args
- end
- end
- end
-
def self.async(method, *args)
async_in 'class', 1, method.to_s, *args
end
# Enqueues a method to run in the background
def async(method, *args)
# 1 second in the future should be after finishing the SQL transaction
self.class.async_in 'record', 1, method.to_s, id.to_s, *args
end
# Enqueues a method to run in the future
def self.async_in(type, at, *args)
Sidekiq::Client.push \
'queue' => instance_variable_get('@queue') || 'default',
'class' => Worker,
'retry' => false,
'args' => [type, self.to_s, *args],
'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f
end
-
end | 12 | 0.363636 | 0 | 12 |
885df04e2e6331138454258391a157fc4a8d656f | _includes/footer.html | _includes/footer.html | <footer class="site-footer">
<p>Copyright © <a href="{{ site.baseurl }}/">{{site.title}}</a></p>
<p>Powered by <a href="https://github.com/jekyll/jekyll">Jekyll</a>
on
<a href="https://github.com/">Github</a>
</footer>
| <footer class="site-footer">
<p>Copyright © <a href="https://github.com/AkashKrDutta/AkashKrDutta.github.io/blob/master/LICENSE">MIT LICENSE</a></p>
<p>Powered by <a href="https://github.com/jekyll/jekyll">Jekyll</a>
</footer>
| Update license info in site | Update license info in site
| HTML | mit | AkashKrDutta/AkashKrDutta.github.io,AkashKrDutta/AkashKrDutta.github.io,AkashKrDutta/AkashKrDutta.github.io | html | ## Code Before:
<footer class="site-footer">
<p>Copyright © <a href="{{ site.baseurl }}/">{{site.title}}</a></p>
<p>Powered by <a href="https://github.com/jekyll/jekyll">Jekyll</a>
on
<a href="https://github.com/">Github</a>
</footer>
## Instruction:
Update license info in site
## Code After:
<footer class="site-footer">
<p>Copyright © <a href="https://github.com/AkashKrDutta/AkashKrDutta.github.io/blob/master/LICENSE">MIT LICENSE</a></p>
<p>Powered by <a href="https://github.com/jekyll/jekyll">Jekyll</a>
</footer>
| <footer class="site-footer">
- <p>Copyright © <a href="{{ site.baseurl }}/">{{site.title}}</a></p>
+ <p>Copyright © <a href="https://github.com/AkashKrDutta/AkashKrDutta.github.io/blob/master/LICENSE">MIT LICENSE</a></p>
<p>Powered by <a href="https://github.com/jekyll/jekyll">Jekyll</a>
- on
- <a href="https://github.com/">Github</a>
</footer> | 4 | 0.5 | 1 | 3 |
34b92b30ff7fd82b8ea327838da2dafe55706b63 | app.js | app.js | const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const contactRoutes = require('./routes/contactsRouter');
const userRoutes = require('./routes/usersRouter');
const app = express();
// Use body-parser middleware
app.use(bodyParser.json());
// Use Express Router
app.use('/api/contacts', contactRoutes);
app.use('/api/users', userRoutes);
// Create database variable outside of the connection
var db;
// Connect to mongoose (Change the URI or localhost path for mongodb as needed)
mongoose.connect(process.env.MONGODB_URI || 'mongodb://achowdhury2015:absolute2895@ds025263.mlab.com:25263/achowdhury-mean-contact', {
useMongoClient: true
}, function(err) {
// Exit process if unable to connect to db
if (err) {
console.log(err);
process.exit(1);
}
// Save databse object
db = mongoose.connection;
console.log("Database connection ready");
// Serve the app
var server = app.listen(process.env.PORT || 8080, function() {
var port = server.address().port;
console.log("App now running on port", port);
});
});
// API home
app.get('/', function(req, res) {
res.send('Use /api/contacts, or /api/users');
});
| const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const contactRoutes = require('./routes/contactsRouter');
const userRoutes = require('./routes/usersRouter');
const app = express();
// Use body-parser middleware
app.use(bodyParser.json());
// Use Express Router
app.use('/api/contacts', contactRoutes);
app.use('/api/users', userRoutes);
// Create database variable outside of the connection
var db;
// Connect to mongoose (Change the URI or localhost path for mongodb as needed)
mongoose.connect(process.env.MONGODB_URI || 'Database address go here', {
useMongoClient: true
}, function(err) {
// Exit process if unable to connect to db
if (err) {
console.log(err);
process.exit(1);
}
// Save databse object
db = mongoose.connection;
console.log("Database connection ready");
// Serve the app
var server = app.listen(process.env.PORT || 8080, function() {
var port = server.address().port;
console.log("App now running on port", port);
});
});
// API home
app.get('/', function(req, res) {
res.send('Use /api/contacts, or /api/users');
});
| Prepare to push repo into Github by changing database URI | Prepare to push repo into Github by changing database URI
| JavaScript | mit | ventus-lionheart/mongo-api | javascript | ## Code Before:
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const contactRoutes = require('./routes/contactsRouter');
const userRoutes = require('./routes/usersRouter');
const app = express();
// Use body-parser middleware
app.use(bodyParser.json());
// Use Express Router
app.use('/api/contacts', contactRoutes);
app.use('/api/users', userRoutes);
// Create database variable outside of the connection
var db;
// Connect to mongoose (Change the URI or localhost path for mongodb as needed)
mongoose.connect(process.env.MONGODB_URI || 'mongodb://achowdhury2015:absolute2895@ds025263.mlab.com:25263/achowdhury-mean-contact', {
useMongoClient: true
}, function(err) {
// Exit process if unable to connect to db
if (err) {
console.log(err);
process.exit(1);
}
// Save databse object
db = mongoose.connection;
console.log("Database connection ready");
// Serve the app
var server = app.listen(process.env.PORT || 8080, function() {
var port = server.address().port;
console.log("App now running on port", port);
});
});
// API home
app.get('/', function(req, res) {
res.send('Use /api/contacts, or /api/users');
});
## Instruction:
Prepare to push repo into Github by changing database URI
## Code After:
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const contactRoutes = require('./routes/contactsRouter');
const userRoutes = require('./routes/usersRouter');
const app = express();
// Use body-parser middleware
app.use(bodyParser.json());
// Use Express Router
app.use('/api/contacts', contactRoutes);
app.use('/api/users', userRoutes);
// Create database variable outside of the connection
var db;
// Connect to mongoose (Change the URI or localhost path for mongodb as needed)
mongoose.connect(process.env.MONGODB_URI || 'Database address go here', {
useMongoClient: true
}, function(err) {
// Exit process if unable to connect to db
if (err) {
console.log(err);
process.exit(1);
}
// Save databse object
db = mongoose.connection;
console.log("Database connection ready");
// Serve the app
var server = app.listen(process.env.PORT || 8080, function() {
var port = server.address().port;
console.log("App now running on port", port);
});
});
// API home
app.get('/', function(req, res) {
res.send('Use /api/contacts, or /api/users');
});
| const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const contactRoutes = require('./routes/contactsRouter');
const userRoutes = require('./routes/usersRouter');
const app = express();
// Use body-parser middleware
app.use(bodyParser.json());
// Use Express Router
app.use('/api/contacts', contactRoutes);
app.use('/api/users', userRoutes);
// Create database variable outside of the connection
var db;
// Connect to mongoose (Change the URI or localhost path for mongodb as needed)
- mongoose.connect(process.env.MONGODB_URI || 'mongodb://achowdhury2015:absolute2895@ds025263.mlab.com:25263/achowdhury-mean-contact', {
+ mongoose.connect(process.env.MONGODB_URI || 'Database address go here', {
useMongoClient: true
}, function(err) {
// Exit process if unable to connect to db
if (err) {
console.log(err);
process.exit(1);
}
// Save databse object
db = mongoose.connection;
console.log("Database connection ready");
// Serve the app
var server = app.listen(process.env.PORT || 8080, function() {
var port = server.address().port;
console.log("App now running on port", port);
});
});
// API home
app.get('/', function(req, res) {
res.send('Use /api/contacts, or /api/users');
}); | 2 | 0.046512 | 1 | 1 |
0a2fd079c828a8d2f48f8e2c33574aec2d416f06 | mbuild/lib/atoms/c3.py | mbuild/lib/atoms/c3.py | from __future__ import division
import numpy as np
import mbuild as mb
class C3(mb.Compound):
"""A tri-valent, planar carbon."""
def __init__(self):
super(C3, self).__init__()
self.add(mb.Particle(name='C'))
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate(self['up'], np.array([0, 0.07, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, 0.07, 0]))
self['down'].spin(np.pi * 2/3, [0, 0, 1])
self.add(mb.Port(anchor=self[0]), 'left')
self['left'].translate(np.array([0, 0.07, 0]))
self['left'].spin(-np.pi * 2/3, [0, 0, 1])
if __name__ == '__main__':
m = C3()
m.visualize(show_ports=True)
| from __future__ import division
import numpy as np
import mbuild as mb
class C3(mb.Compound):
"""A tri-valent, planar carbon."""
def __init__(self):
super(C3, self).__init__()
self.add(mb.Particle(name='C'))
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate(np.array([0, 0.07, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, 0.07, 0]))
self['down'].spin(np.pi * 2/3, [0, 0, 1])
self.add(mb.Port(anchor=self[0]), 'left')
self['left'].translate(np.array([0, 0.07, 0]))
self['left'].spin(-np.pi * 2/3, [0, 0, 1])
if __name__ == '__main__':
m = C3()
m.visualize(show_ports=True)
| Fix bug in translate call | Fix bug in translate call
| Python | mit | iModels/mbuild,ctk3b/mbuild,tcmoore3/mbuild,summeraz/mbuild,summeraz/mbuild,ctk3b/mbuild,iModels/mbuild,tcmoore3/mbuild | python | ## Code Before:
from __future__ import division
import numpy as np
import mbuild as mb
class C3(mb.Compound):
"""A tri-valent, planar carbon."""
def __init__(self):
super(C3, self).__init__()
self.add(mb.Particle(name='C'))
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate(self['up'], np.array([0, 0.07, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, 0.07, 0]))
self['down'].spin(np.pi * 2/3, [0, 0, 1])
self.add(mb.Port(anchor=self[0]), 'left')
self['left'].translate(np.array([0, 0.07, 0]))
self['left'].spin(-np.pi * 2/3, [0, 0, 1])
if __name__ == '__main__':
m = C3()
m.visualize(show_ports=True)
## Instruction:
Fix bug in translate call
## Code After:
from __future__ import division
import numpy as np
import mbuild as mb
class C3(mb.Compound):
"""A tri-valent, planar carbon."""
def __init__(self):
super(C3, self).__init__()
self.add(mb.Particle(name='C'))
self.add(mb.Port(anchor=self[0]), 'up')
self['up'].translate(np.array([0, 0.07, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, 0.07, 0]))
self['down'].spin(np.pi * 2/3, [0, 0, 1])
self.add(mb.Port(anchor=self[0]), 'left')
self['left'].translate(np.array([0, 0.07, 0]))
self['left'].spin(-np.pi * 2/3, [0, 0, 1])
if __name__ == '__main__':
m = C3()
m.visualize(show_ports=True)
| from __future__ import division
import numpy as np
import mbuild as mb
class C3(mb.Compound):
"""A tri-valent, planar carbon."""
def __init__(self):
super(C3, self).__init__()
self.add(mb.Particle(name='C'))
self.add(mb.Port(anchor=self[0]), 'up')
- self['up'].translate(self['up'], np.array([0, 0.07, 0]))
? ------------
+ self['up'].translate(np.array([0, 0.07, 0]))
self.add(mb.Port(anchor=self[0]), 'down')
self['down'].translate(np.array([0, 0.07, 0]))
self['down'].spin(np.pi * 2/3, [0, 0, 1])
self.add(mb.Port(anchor=self[0]), 'left')
self['left'].translate(np.array([0, 0.07, 0]))
self['left'].spin(-np.pi * 2/3, [0, 0, 1])
if __name__ == '__main__':
m = C3()
m.visualize(show_ports=True) | 2 | 0.071429 | 1 | 1 |
719fd8cdc8ae9be63c99407fe6f3aac056220cb8 | taiga/users/fixtures/initial_user.json | taiga/users/fixtures/initial_user.json | [
{
"pk": 1,
"model": "users.user",
"fields": {
"username": "admin",
"full_name": "",
"bio": "",
"default_language": "",
"color": "",
"photo": "",
"is_active": true,
"colorize_tags": false,
"default_timezone": "",
"is_superuser": true,
"token": "",
"github_id": null,
"last_login": "2013-04-04T07:36:09.880Z",
"password": "pbkdf2_sha256$10000$oRIbCKOL1U3w$/gaYMnOlc/GnN4mn3UUXvXpk2Hx0vvht6Uqhu46aikI=",
"email": "niwi@niwi.be",
"date_joined": "2013-04-01T13:48:21.711Z"
}
}
]
| [
{
"pk": 1,
"model": "users.user",
"fields": {
"username": "admin",
"full_name": "",
"bio": "",
"default_language": "",
"color": "",
"photo": "",
"is_active": true,
"colorize_tags": false,
"default_timezone": "",
"is_superuser": true,
"token": "",
"github_id": null,
"last_login": "2013-04-04T07:36:09.880Z",
"password": "pbkdf2_sha256$10000$oRIbCKOL1U3w$/gaYMnOlc/GnN4mn3UUXvXpk2Hx0vvht6Uqhu46aikI=",
"email": "admin@admin.com",
"date_joined": "2013-04-01T13:48:21.711Z"
}
}
]
| Change the email of admin | Change the email of admin
| JSON | agpl-3.0 | Tigerwhit4/taiga-back,crr0004/taiga-back,coopsource/taiga-back,forging2012/taiga-back,Tigerwhit4/taiga-back,jeffdwyatt/taiga-back,Rademade/taiga-back,astagi/taiga-back,bdang2012/taiga-back-casting,seanchen/taiga-back,taigaio/taiga-back,taigaio/taiga-back,astagi/taiga-back,obimod/taiga-back,19kestier/taiga-back,joshisa/taiga-back,Rademade/taiga-back,CoolCloud/taiga-back,joshisa/taiga-back,jeffdwyatt/taiga-back,joshisa/taiga-back,seanchen/taiga-back,Rademade/taiga-back,forging2012/taiga-back,gam-phon/taiga-back,dayatz/taiga-back,jeffdwyatt/taiga-back,astronaut1712/taiga-back,forging2012/taiga-back,19kestier/taiga-back,EvgeneOskin/taiga-back,CoolCloud/taiga-back,Zaneh-/bearded-tribble-back,seanchen/taiga-back,dycodedev/taiga-back,Tigerwhit4/taiga-back,EvgeneOskin/taiga-back,gauravjns/taiga-back,gam-phon/taiga-back,rajiteh/taiga-back,CoolCloud/taiga-back,crr0004/taiga-back,bdang2012/taiga-back-casting,gauravjns/taiga-back,astagi/taiga-back,astronaut1712/taiga-back,coopsource/taiga-back,dycodedev/taiga-back,astagi/taiga-back,Zaneh-/bearded-tribble-back,seanchen/taiga-back,WALR/taiga-back,forging2012/taiga-back,astronaut1712/taiga-back,gam-phon/taiga-back,CMLL/taiga-back,CMLL/taiga-back,astronaut1712/taiga-back,obimod/taiga-back,Zaneh-/bearded-tribble-back,rajiteh/taiga-back,WALR/taiga-back,coopsource/taiga-back,coopsource/taiga-back,CMLL/taiga-back,CMLL/taiga-back,crr0004/taiga-back,dycodedev/taiga-back,dayatz/taiga-back,Rademade/taiga-back,EvgeneOskin/taiga-back,bdang2012/taiga-back-casting,crr0004/taiga-back,bdang2012/taiga-back-casting,WALR/taiga-back,xdevelsistemas/taiga-back-community,frt-arch/taiga-back,joshisa/taiga-back,rajiteh/taiga-back,19kestier/taiga-back,Tigerwhit4/taiga-back,frt-arch/taiga-back,Rademade/taiga-back,gam-phon/taiga-back,dayatz/taiga-back,EvgeneOskin/taiga-back,taigaio/taiga-back,obimod/taiga-back,rajiteh/taiga-back,jeffdwyatt/taiga-back,frt-arch/taiga-back,obimod/taiga-back,CoolCloud/taiga-back,xdevelsistemas/taiga-back-community,gauravjns/taiga-back,xdevelsistemas/taiga-back-community,WALR/taiga-back,gauravjns/taiga-back,dycodedev/taiga-back | json | ## Code Before:
[
{
"pk": 1,
"model": "users.user",
"fields": {
"username": "admin",
"full_name": "",
"bio": "",
"default_language": "",
"color": "",
"photo": "",
"is_active": true,
"colorize_tags": false,
"default_timezone": "",
"is_superuser": true,
"token": "",
"github_id": null,
"last_login": "2013-04-04T07:36:09.880Z",
"password": "pbkdf2_sha256$10000$oRIbCKOL1U3w$/gaYMnOlc/GnN4mn3UUXvXpk2Hx0vvht6Uqhu46aikI=",
"email": "niwi@niwi.be",
"date_joined": "2013-04-01T13:48:21.711Z"
}
}
]
## Instruction:
Change the email of admin
## Code After:
[
{
"pk": 1,
"model": "users.user",
"fields": {
"username": "admin",
"full_name": "",
"bio": "",
"default_language": "",
"color": "",
"photo": "",
"is_active": true,
"colorize_tags": false,
"default_timezone": "",
"is_superuser": true,
"token": "",
"github_id": null,
"last_login": "2013-04-04T07:36:09.880Z",
"password": "pbkdf2_sha256$10000$oRIbCKOL1U3w$/gaYMnOlc/GnN4mn3UUXvXpk2Hx0vvht6Uqhu46aikI=",
"email": "admin@admin.com",
"date_joined": "2013-04-01T13:48:21.711Z"
}
}
]
| [
{
"pk": 1,
"model": "users.user",
"fields": {
"username": "admin",
"full_name": "",
"bio": "",
"default_language": "",
"color": "",
"photo": "",
"is_active": true,
"colorize_tags": false,
"default_timezone": "",
"is_superuser": true,
"token": "",
"github_id": null,
"last_login": "2013-04-04T07:36:09.880Z",
"password": "pbkdf2_sha256$10000$oRIbCKOL1U3w$/gaYMnOlc/GnN4mn3UUXvXpk2Hx0vvht6Uqhu46aikI=",
- "email": "niwi@niwi.be",
+ "email": "admin@admin.com",
"date_joined": "2013-04-01T13:48:21.711Z"
}
}
] | 2 | 0.083333 | 1 | 1 |
715ef04c6ec512715565a1282a9c814f8af64624 | roles/postfix/tasks/mail.yml | roles/postfix/tasks/mail.yml | ---
- name: root alias to kradalby
action: lineinfile dest=/etc/aliases regexp='^root:' line='root:kradalby' state=present
- name: add mail alias to kradalby
action: lineinfile dest=/etc/aliases regexp="^kradalby:" line="kradalby:kradalby@kradalby.no" state=present
- name: run newalias
shell: newaliases
- name: set mailname
template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
notify: restart postfix
| ---
- name: root alias to kradalby
action: lineinfile dest=/etc/aliases regexp='^root:' line='root:kradalby' state=present
- name: add mail alias to kradalby
action: lineinfile dest=/etc/aliases regexp="^kradalby:" line="kradalby:kradalby@kradalby.no" state=present
- name: set mailname
template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
- name: run newalias
shell: newaliases
notify: restart postfix
| Fix order of postfix job, resolve raise condition | Fix order of postfix job, resolve raise condition
| YAML | mit | kradalby/plays,kradalby/plays | yaml | ## Code Before:
---
- name: root alias to kradalby
action: lineinfile dest=/etc/aliases regexp='^root:' line='root:kradalby' state=present
- name: add mail alias to kradalby
action: lineinfile dest=/etc/aliases regexp="^kradalby:" line="kradalby:kradalby@kradalby.no" state=present
- name: run newalias
shell: newaliases
- name: set mailname
template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
notify: restart postfix
## Instruction:
Fix order of postfix job, resolve raise condition
## Code After:
---
- name: root alias to kradalby
action: lineinfile dest=/etc/aliases regexp='^root:' line='root:kradalby' state=present
- name: add mail alias to kradalby
action: lineinfile dest=/etc/aliases regexp="^kradalby:" line="kradalby:kradalby@kradalby.no" state=present
- name: set mailname
template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
- name: run newalias
shell: newaliases
notify: restart postfix
| ---
- name: root alias to kradalby
action: lineinfile dest=/etc/aliases regexp='^root:' line='root:kradalby' state=present
- name: add mail alias to kradalby
action: lineinfile dest=/etc/aliases regexp="^kradalby:" line="kradalby:kradalby@kradalby.no" state=present
+ - name: set mailname
+ template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
+
- name: run newalias
shell: newaliases
-
- - name: set mailname
- template: src=mailname.j2 dest="/etc/mailname" owner=root mode=644
notify: restart postfix | 6 | 0.461538 | 3 | 3 |
844b284dd610a632aa9c1392207223a04ebf5e11 | README.md | README.md | A bzl file that contains maven_jar and maven_aar rules for all artifacts in
https://maven.google.com. Not guaranteed to be correct or up to date. Some of
the artifacts depend on artifacts that are not present on
https://maven.google.com. We ignore these and hope not to fail.
To use this from your project, in your `WORKSPACE` file add
```
git_repository(
name = 'gmaven_rules',
remote = 'https://github.com/aj-michael/gmaven_rules',
commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()
```
To regenerate gmaven.bzl, run
```
rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel
```
Note that this requires a Bazel binary containing the changes in
https://github.com/bazelbuild/bazel/commit/431b6436373c9feb5d03e488ff72f822bbe55b2d
| A bzl file that contains maven_jar and maven_aar rules for all artifacts in
https://maven.google.com. Not guaranteed to be correct or up to date. Some of
the artifacts depend on artifacts that are not present on
https://maven.google.com. We ignore these and hope not to fail.
To use this from your project, in your `WORKSPACE` file add
```
git_repository(
name = 'gmaven_rules',
remote = 'https://github.com/aj-michael/gmaven_rules',
commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()
```
To regenerate gmaven.bzl, run
```
rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel
```
| Remove requirement on new Bazel version | Remove requirement on new Bazel version
A previous commit bundled maven_rules.bzl in this repository, so we no longer reference @bazel_tools. | Markdown | apache-2.0 | bazelbuild/rules_jvm_external,bazelbuild/rules_jvm_external,bazelbuild/gmaven_rules,bazelbuild/gmaven_rules,bazelbuild/rules_jvm_external | markdown | ## Code Before:
A bzl file that contains maven_jar and maven_aar rules for all artifacts in
https://maven.google.com. Not guaranteed to be correct or up to date. Some of
the artifacts depend on artifacts that are not present on
https://maven.google.com. We ignore these and hope not to fail.
To use this from your project, in your `WORKSPACE` file add
```
git_repository(
name = 'gmaven_rules',
remote = 'https://github.com/aj-michael/gmaven_rules',
commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()
```
To regenerate gmaven.bzl, run
```
rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel
```
Note that this requires a Bazel binary containing the changes in
https://github.com/bazelbuild/bazel/commit/431b6436373c9feb5d03e488ff72f822bbe55b2d
## Instruction:
Remove requirement on new Bazel version
A previous commit bundled maven_rules.bzl in this repository, so we no longer reference @bazel_tools.
## Code After:
A bzl file that contains maven_jar and maven_aar rules for all artifacts in
https://maven.google.com. Not guaranteed to be correct or up to date. Some of
the artifacts depend on artifacts that are not present on
https://maven.google.com. We ignore these and hope not to fail.
To use this from your project, in your `WORKSPACE` file add
```
git_repository(
name = 'gmaven_rules',
remote = 'https://github.com/aj-michael/gmaven_rules',
commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()
```
To regenerate gmaven.bzl, run
```
rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel
```
| A bzl file that contains maven_jar and maven_aar rules for all artifacts in
https://maven.google.com. Not guaranteed to be correct or up to date. Some of
the artifacts depend on artifacts that are not present on
https://maven.google.com. We ignore these and hope not to fail.
To use this from your project, in your `WORKSPACE` file add
```
git_repository(
name = 'gmaven_rules',
remote = 'https://github.com/aj-michael/gmaven_rules',
commit = '<FILL IN A COMMIT HERE>',
)
load('@gmaven_rules//:gmaven.bzl', 'gmaven_rules')
gmaven_rules()
```
To regenerate gmaven.bzl, run
```
rm gmaven.bzl && javac GMavenToBazel.java && java GMavenToBazel
```
-
- Note that this requires a Bazel binary containing the changes in
- https://github.com/bazelbuild/bazel/commit/431b6436373c9feb5d03e488ff72f822bbe55b2d | 3 | 0.12 | 0 | 3 |
062e65a161f9c84e5cd18b85790b195eec947b99 | social_website_django_angular/social_website_django_angular/urls.py | social_website_django_angular/social_website_django_angular/urls.py | from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
| from django.conf.urls import url
from django.contrib import admin
from social_website_django_angular.views import IndexView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url('^.*$', IndexView.as_view(), name='index')
]
| Set up url for index page | Set up url for index page
| Python | mit | tomaszzacharczuk/social-website-django-angular,tomaszzacharczuk/social-website-django-angular,tomaszzacharczuk/social-website-django-angular | python | ## Code Before:
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
## Instruction:
Set up url for index page
## Code After:
from django.conf.urls import url
from django.contrib import admin
from social_website_django_angular.views import IndexView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url('^.*$', IndexView.as_view(), name='index')
]
| from django.conf.urls import url
from django.contrib import admin
+ from social_website_django_angular.views import IndexView
+
urlpatterns = [
url(r'^admin/', admin.site.urls),
+ url('^.*$', IndexView.as_view(), name='index')
] | 3 | 0.5 | 3 | 0 |
5df2c9e1426baa90906e42fd4ecfd9dfc1a61220 | test/src/stringutils/CMakeLists.txt | test/src/stringutils/CMakeLists.txt | project(teststringutils)
set (LIB_UNDER_TEST_SOURCE_DIR ${STRINGUTILS_SRC})
set (LIB_UNDER_TEST ${STRINGUTILS_LIBRARY})
set (TESTS_EXECUTABLE test-stringutils)
set (TEST_SOURCE_DIR ${teststringutils_SOURCE_DIR})
set (TEST_HEADERS_DIR ${JIPPI_TEST_MAIN_HEADERS_DIR}/${LIB_UNDER_TEST})
find_package(GTest REQUIRED)
include_directories(${TEST_SOURCE_DIR})
file (
GLOB TEST_HEADERS
${TEST_HEADERS_DIR}/*.hpp
)
file (
GLOB TEST_SRC
${TEST_SOURCE_DIR}/*.cpp
)
add_executable( ${TESTS_EXECUTABLE} ${TEST_HEADERS} ${TEST_SRC} ${LIB_UNDER_TEST_SOURCE_DIR})
target_link_libraries(
${TESTS_EXECUTABLE}
${GTEST_LIBRARY}
${LIB_UNDER_TEST}
)
| project(teststringutils)
set (LIB_UNDER_TEST_SOURCE_DIR ${STRINGUTILS_SRC})
set (LIB_UNDER_TEST ${STRINGUTILS_LIBRARY})
set (TESTS_EXECUTABLE test-stringutils)
set (TEST_SOURCE_DIR ${teststringutils_SOURCE_DIR})
set (TEST_HEADERS_DIR ${JIPPI_TEST_MAIN_HEADERS_DIR}/${LIB_UNDER_TEST})
find_package(GTest REQUIRED)
include_directories(${TEST_SOURCE_DIR})
file (
GLOB TEST_HEADERS
${TEST_HEADERS_DIR}/*.hpp
)
file (
GLOB TEST_SRC
${TEST_SOURCE_DIR}/*.cpp
)
add_executable( ${TESTS_EXECUTABLE} ${TEST_HEADERS} ${TEST_SRC} ${LIB_UNDER_TEST_SOURCE_DIR})
target_link_libraries(
${TESTS_EXECUTABLE}
${GTEST_LIBRARY}
${LIB_UNDER_TEST}
pthread
)
| Add pthread to the link libraries for string utils test suite | Add pthread to the link libraries for string utils test suite
| Text | apache-2.0 | kmichalak/jippi | text | ## Code Before:
project(teststringutils)
set (LIB_UNDER_TEST_SOURCE_DIR ${STRINGUTILS_SRC})
set (LIB_UNDER_TEST ${STRINGUTILS_LIBRARY})
set (TESTS_EXECUTABLE test-stringutils)
set (TEST_SOURCE_DIR ${teststringutils_SOURCE_DIR})
set (TEST_HEADERS_DIR ${JIPPI_TEST_MAIN_HEADERS_DIR}/${LIB_UNDER_TEST})
find_package(GTest REQUIRED)
include_directories(${TEST_SOURCE_DIR})
file (
GLOB TEST_HEADERS
${TEST_HEADERS_DIR}/*.hpp
)
file (
GLOB TEST_SRC
${TEST_SOURCE_DIR}/*.cpp
)
add_executable( ${TESTS_EXECUTABLE} ${TEST_HEADERS} ${TEST_SRC} ${LIB_UNDER_TEST_SOURCE_DIR})
target_link_libraries(
${TESTS_EXECUTABLE}
${GTEST_LIBRARY}
${LIB_UNDER_TEST}
)
## Instruction:
Add pthread to the link libraries for string utils test suite
## Code After:
project(teststringutils)
set (LIB_UNDER_TEST_SOURCE_DIR ${STRINGUTILS_SRC})
set (LIB_UNDER_TEST ${STRINGUTILS_LIBRARY})
set (TESTS_EXECUTABLE test-stringutils)
set (TEST_SOURCE_DIR ${teststringutils_SOURCE_DIR})
set (TEST_HEADERS_DIR ${JIPPI_TEST_MAIN_HEADERS_DIR}/${LIB_UNDER_TEST})
find_package(GTest REQUIRED)
include_directories(${TEST_SOURCE_DIR})
file (
GLOB TEST_HEADERS
${TEST_HEADERS_DIR}/*.hpp
)
file (
GLOB TEST_SRC
${TEST_SOURCE_DIR}/*.cpp
)
add_executable( ${TESTS_EXECUTABLE} ${TEST_HEADERS} ${TEST_SRC} ${LIB_UNDER_TEST_SOURCE_DIR})
target_link_libraries(
${TESTS_EXECUTABLE}
${GTEST_LIBRARY}
${LIB_UNDER_TEST}
pthread
)
| project(teststringutils)
set (LIB_UNDER_TEST_SOURCE_DIR ${STRINGUTILS_SRC})
set (LIB_UNDER_TEST ${STRINGUTILS_LIBRARY})
set (TESTS_EXECUTABLE test-stringutils)
set (TEST_SOURCE_DIR ${teststringutils_SOURCE_DIR})
set (TEST_HEADERS_DIR ${JIPPI_TEST_MAIN_HEADERS_DIR}/${LIB_UNDER_TEST})
find_package(GTest REQUIRED)
include_directories(${TEST_SOURCE_DIR})
file (
GLOB TEST_HEADERS
${TEST_HEADERS_DIR}/*.hpp
)
file (
GLOB TEST_SRC
${TEST_SOURCE_DIR}/*.cpp
)
add_executable( ${TESTS_EXECUTABLE} ${TEST_HEADERS} ${TEST_SRC} ${LIB_UNDER_TEST_SOURCE_DIR})
target_link_libraries(
${TESTS_EXECUTABLE}
${GTEST_LIBRARY}
${LIB_UNDER_TEST}
+ pthread
) | 1 | 0.034483 | 1 | 0 |
bdb1a3fd50e69ac670cc89eaea9838e8cd5c4acd | src/client/apps/player/components.jsx | src/client/apps/player/components.jsx | import React from 'react';
import YouTube from 'react-youtube';
import store from '../root/store.js';
export default class VideoPlayer extends React.Component {
constructor(props) {
super(props);
// Set initial video as a demo
const videoId = store.getState().player.videoId;
this.state = {
player: null,
videoId,
};
// Bind callback methods to make `this` the correct context.
this.handleSetVideo = this.handleSetVideo.bind(this);
this.loadPlayer = this.loadPlayer.bind(this);
this.playVideo = this.playVideo.bind(this);
}
componentDidMount() {
store.subscribe(this.handleSetVideo);
}
handleSetVideo() {
const state = store.getState().player;
if (state.videoId !== this.state.videoId) {
this.setState({ videoId: state.videoId });
}
}
loadPlayer(event) {
this.setState({
player: event.target,
});
}
playVideo() {
this.state.player.playVideo();
}
render() {
const opts = {
playerVars: {
origin: window.location.origin,
},
};
return (
<YouTube
videoId={this.state.videoId}
opts={opts}
onReady={this.loadPlayer}
onStateChange={this.playVideo}
/>
);
}
}
VideoPlayer.propTypes = { videoId: React.PropTypes.string };
| import React from 'react';
import YouTube from 'react-youtube';
import store from '../root/store.js';
export default class VideoPlayer extends React.Component {
constructor(props) {
super(props);
// Set initial video as a demo
const videoId = store.getState().player.videoId;
this.state = {
player: null,
videoId,
};
// Bind callback methods to make `this` the correct context.
this.handleSetVideo = this.handleSetVideo.bind(this);
this.loadPlayer = this.loadPlayer.bind(this);
this.onStateChange = this.onStateChange.bind(this);
}
componentDidMount() {
store.subscribe(this.handleSetVideo);
}
handleSetVideo() {
const state = store.getState().player;
if (state.videoId !== this.state.videoId) {
this.setState({ videoId: state.videoId });
}
}
loadPlayer(event) {
this.setState({
player: event.target,
});
}
onStateChange(event) {
if (event.data == window.YT.PlayerState.CUED) {
this.state.player.playVideo();
}
}
render() {
const opts = {
playerVars: {
origin: window.location.origin,
},
};
return (
<YouTube
videoId={this.state.videoId}
opts={opts}
onReady={this.loadPlayer}
onStateChange={this.onStateChange}
/>
);
}
}
VideoPlayer.propTypes = { videoId: React.PropTypes.string };
| Fix 'always play' bug when using player | Fix 'always play' bug when using player
| JSX | mit | agustin380/youtube-playlists,agustin380/youtube-playlists | jsx | ## Code Before:
import React from 'react';
import YouTube from 'react-youtube';
import store from '../root/store.js';
export default class VideoPlayer extends React.Component {
constructor(props) {
super(props);
// Set initial video as a demo
const videoId = store.getState().player.videoId;
this.state = {
player: null,
videoId,
};
// Bind callback methods to make `this` the correct context.
this.handleSetVideo = this.handleSetVideo.bind(this);
this.loadPlayer = this.loadPlayer.bind(this);
this.playVideo = this.playVideo.bind(this);
}
componentDidMount() {
store.subscribe(this.handleSetVideo);
}
handleSetVideo() {
const state = store.getState().player;
if (state.videoId !== this.state.videoId) {
this.setState({ videoId: state.videoId });
}
}
loadPlayer(event) {
this.setState({
player: event.target,
});
}
playVideo() {
this.state.player.playVideo();
}
render() {
const opts = {
playerVars: {
origin: window.location.origin,
},
};
return (
<YouTube
videoId={this.state.videoId}
opts={opts}
onReady={this.loadPlayer}
onStateChange={this.playVideo}
/>
);
}
}
VideoPlayer.propTypes = { videoId: React.PropTypes.string };
## Instruction:
Fix 'always play' bug when using player
## Code After:
import React from 'react';
import YouTube from 'react-youtube';
import store from '../root/store.js';
export default class VideoPlayer extends React.Component {
constructor(props) {
super(props);
// Set initial video as a demo
const videoId = store.getState().player.videoId;
this.state = {
player: null,
videoId,
};
// Bind callback methods to make `this` the correct context.
this.handleSetVideo = this.handleSetVideo.bind(this);
this.loadPlayer = this.loadPlayer.bind(this);
this.onStateChange = this.onStateChange.bind(this);
}
componentDidMount() {
store.subscribe(this.handleSetVideo);
}
handleSetVideo() {
const state = store.getState().player;
if (state.videoId !== this.state.videoId) {
this.setState({ videoId: state.videoId });
}
}
loadPlayer(event) {
this.setState({
player: event.target,
});
}
onStateChange(event) {
if (event.data == window.YT.PlayerState.CUED) {
this.state.player.playVideo();
}
}
render() {
const opts = {
playerVars: {
origin: window.location.origin,
},
};
return (
<YouTube
videoId={this.state.videoId}
opts={opts}
onReady={this.loadPlayer}
onStateChange={this.onStateChange}
/>
);
}
}
VideoPlayer.propTypes = { videoId: React.PropTypes.string };
| import React from 'react';
import YouTube from 'react-youtube';
import store from '../root/store.js';
export default class VideoPlayer extends React.Component {
constructor(props) {
super(props);
// Set initial video as a demo
const videoId = store.getState().player.videoId;
this.state = {
player: null,
videoId,
};
// Bind callback methods to make `this` the correct context.
this.handleSetVideo = this.handleSetVideo.bind(this);
this.loadPlayer = this.loadPlayer.bind(this);
- this.playVideo = this.playVideo.bind(this);
+ this.onStateChange = this.onStateChange.bind(this);
}
componentDidMount() {
store.subscribe(this.handleSetVideo);
}
handleSetVideo() {
const state = store.getState().player;
if (state.videoId !== this.state.videoId) {
this.setState({ videoId: state.videoId });
}
}
loadPlayer(event) {
this.setState({
player: event.target,
});
}
- playVideo() {
+ onStateChange(event) {
+ if (event.data == window.YT.PlayerState.CUED) {
- this.state.player.playVideo();
+ this.state.player.playVideo();
? ++
+ }
}
render() {
const opts = {
playerVars: {
origin: window.location.origin,
},
};
return (
<YouTube
videoId={this.state.videoId}
opts={opts}
onReady={this.loadPlayer}
- onStateChange={this.playVideo}
? ^^ ^^^^ ^
+ onStateChange={this.onStateChange}
? ^^^^ ^ ^^^^^^
/>
);
}
}
VideoPlayer.propTypes = { videoId: React.PropTypes.string }; | 10 | 0.181818 | 6 | 4 |
c5dbd750f6e1d3e3018d960c8904bc3f239aac99 | all_test.go | all_test.go | package gosseract_test
import "github.com/otiai10/gosseract"
import . "github.com/otiai10/mint"
import "testing"
func Test_Greet(t *testing.T) {
Expect(t, gosseract.Greet()).ToBe("Hello,Gosseract.")
}
func Test_Must(t *testing.T) {
params := map[string]string{
"src": "./samples/hoge.png",
}
Expect(t, gosseract.Must(params)).ToBe("gosseract")
}
func Test_NewClient(t *testing.T) {
client, e := gosseract.NewClient()
Expect(t, e).ToBe(nil)
Expect(t, client).TypeOf("*gosseract.Client")
}
| package gosseract_test
import "github.com/otiai10/gosseract"
import . "github.com/otiai10/mint"
import "testing"
func Test_Greet(t *testing.T) {
Expect(t, gosseract.Greet()).ToBe("Hello,Gosseract.")
}
func Test_Must(t *testing.T) {
params := map[string]string{
"src": "./samples/hoge.png",
}
Expect(t, gosseract.Must(params)).ToBe("gosseract")
}
func Test_NewClient(t *testing.T) {
client, e := gosseract.NewClient()
Expect(t, e).ToBe(nil)
Expect(t, client).TypeOf("*gosseract.Client")
}
func TestClient_Must(t *testing.T) {
client, _ := gosseract.NewClient()
params := map[string]string{}
_, e := client.Must(params)
Expect(t, e).Not().ToBe(nil)
}
| Add `Client.Must` (is name `Must` good?) | Add `Client.Must` (is name `Must` good?)
| Go | mit | otiai10/gosseract,esiqveland/gosseract,tonycoming/gosseract,trigrass2/gosseract,tonycoming/gosseract,otiai10/gosseract,trigrass2/gosseract,esiqveland/gosseract,trigrass2/gosseract,tonycoming/gosseract,otiai10/gosseract,esiqveland/gosseract,otiai10/gosseract | go | ## Code Before:
package gosseract_test
import "github.com/otiai10/gosseract"
import . "github.com/otiai10/mint"
import "testing"
func Test_Greet(t *testing.T) {
Expect(t, gosseract.Greet()).ToBe("Hello,Gosseract.")
}
func Test_Must(t *testing.T) {
params := map[string]string{
"src": "./samples/hoge.png",
}
Expect(t, gosseract.Must(params)).ToBe("gosseract")
}
func Test_NewClient(t *testing.T) {
client, e := gosseract.NewClient()
Expect(t, e).ToBe(nil)
Expect(t, client).TypeOf("*gosseract.Client")
}
## Instruction:
Add `Client.Must` (is name `Must` good?)
## Code After:
package gosseract_test
import "github.com/otiai10/gosseract"
import . "github.com/otiai10/mint"
import "testing"
func Test_Greet(t *testing.T) {
Expect(t, gosseract.Greet()).ToBe("Hello,Gosseract.")
}
func Test_Must(t *testing.T) {
params := map[string]string{
"src": "./samples/hoge.png",
}
Expect(t, gosseract.Must(params)).ToBe("gosseract")
}
func Test_NewClient(t *testing.T) {
client, e := gosseract.NewClient()
Expect(t, e).ToBe(nil)
Expect(t, client).TypeOf("*gosseract.Client")
}
func TestClient_Must(t *testing.T) {
client, _ := gosseract.NewClient()
params := map[string]string{}
_, e := client.Must(params)
Expect(t, e).Not().ToBe(nil)
}
| package gosseract_test
import "github.com/otiai10/gosseract"
import . "github.com/otiai10/mint"
import "testing"
func Test_Greet(t *testing.T) {
Expect(t, gosseract.Greet()).ToBe("Hello,Gosseract.")
}
func Test_Must(t *testing.T) {
params := map[string]string{
"src": "./samples/hoge.png",
}
Expect(t, gosseract.Must(params)).ToBe("gosseract")
}
func Test_NewClient(t *testing.T) {
client, e := gosseract.NewClient()
Expect(t, e).ToBe(nil)
Expect(t, client).TypeOf("*gosseract.Client")
}
+
+ func TestClient_Must(t *testing.T) {
+ client, _ := gosseract.NewClient()
+ params := map[string]string{}
+ _, e := client.Must(params)
+ Expect(t, e).Not().ToBe(nil)
+ } | 7 | 0.318182 | 7 | 0 |
2b691ba17f8d23a620c800a08d06aeb29578e805 | README.rdoc | README.rdoc | = Noodall Comments Component using Disqus
You need to tell Disqus what your shortname is.
Add to your config/initializers/noodall.rb
NoodallComponentsDisqusComments.shortname = "<shortname here>"
See their docs (http://docs.disqus.com/developers/universal/) for more informations
This project rocks and uses MIT-LICENSE. | = Noodall Comments Component using Disqus
You need to tell Disqus what your shortname is.
Add to your config/initializers/noodall.rb
NoodallComponentsDisqusComments.shortname = "<shortname here>"
To override developer mode in the development environment:
if Rails.env.development?
NoodallComponentsDisqusComments.developer_mode = 0
end
See their docs (http://docs.disqus.com/developers/universal/) for more informations
This project rocks and uses MIT-LICENSE. | Add note about disabling 'developer mode' | Add note about disabling 'developer mode'
| RDoc | mit | noodall/noodall-components-disqus-comments,noodall/noodall-components-disqus-comments | rdoc | ## Code Before:
= Noodall Comments Component using Disqus
You need to tell Disqus what your shortname is.
Add to your config/initializers/noodall.rb
NoodallComponentsDisqusComments.shortname = "<shortname here>"
See their docs (http://docs.disqus.com/developers/universal/) for more informations
This project rocks and uses MIT-LICENSE.
## Instruction:
Add note about disabling 'developer mode'
## Code After:
= Noodall Comments Component using Disqus
You need to tell Disqus what your shortname is.
Add to your config/initializers/noodall.rb
NoodallComponentsDisqusComments.shortname = "<shortname here>"
To override developer mode in the development environment:
if Rails.env.development?
NoodallComponentsDisqusComments.developer_mode = 0
end
See their docs (http://docs.disqus.com/developers/universal/) for more informations
This project rocks and uses MIT-LICENSE. | = Noodall Comments Component using Disqus
You need to tell Disqus what your shortname is.
Add to your config/initializers/noodall.rb
NoodallComponentsDisqusComments.shortname = "<shortname here>"
+ To override developer mode in the development environment:
+
+ if Rails.env.development?
+ NoodallComponentsDisqusComments.developer_mode = 0
+ end
+
See their docs (http://docs.disqus.com/developers/universal/) for more informations
This project rocks and uses MIT-LICENSE. | 6 | 0.545455 | 6 | 0 |
84bef973fc573b265c7e22270618fdc874a80480 | src/wasm/README.md | src/wasm/README.md | ```
$ rustup default nightly
$ rustup target add wasm32-unknown-unknown
$ cargo +nightly install wasm-bindgen-cli
$ cargo +nightly build --target wasm32-unknown-unknown --release
# In rgba2laba/
$ wasm-bindgen target/wasm32-unknown-unknown/release/rgba2laba.wasm --out-dir wasm
```
| ```
$ rustup default nightly
$ rustup target add wasm32-unknown-unknown
$ cargo +nightly install wasm-bindgen-cli
$ cargo +nightly build --target wasm32-unknown-unknown --release
# In rgba2laba/
$ wasm-bindgen target/wasm32-unknown-unknown/release/rgba2laba.wasm --out-dir wasm
```
# Serving the bundled wasm
* `gz` is ok, but make sure the Content-Type of the `.wasm` is `application/wasm`, or it will fail to load.
| Add warning about content-type for serving .wasm files | Add warning about content-type for serving .wasm files
| Markdown | mit | gyng/ditherer,gyng/ditherer,gyng/ditherer | markdown | ## Code Before:
```
$ rustup default nightly
$ rustup target add wasm32-unknown-unknown
$ cargo +nightly install wasm-bindgen-cli
$ cargo +nightly build --target wasm32-unknown-unknown --release
# In rgba2laba/
$ wasm-bindgen target/wasm32-unknown-unknown/release/rgba2laba.wasm --out-dir wasm
```
## Instruction:
Add warning about content-type for serving .wasm files
## Code After:
```
$ rustup default nightly
$ rustup target add wasm32-unknown-unknown
$ cargo +nightly install wasm-bindgen-cli
$ cargo +nightly build --target wasm32-unknown-unknown --release
# In rgba2laba/
$ wasm-bindgen target/wasm32-unknown-unknown/release/rgba2laba.wasm --out-dir wasm
```
# Serving the bundled wasm
* `gz` is ok, but make sure the Content-Type of the `.wasm` is `application/wasm`, or it will fail to load.
| ```
$ rustup default nightly
$ rustup target add wasm32-unknown-unknown
$ cargo +nightly install wasm-bindgen-cli
$ cargo +nightly build --target wasm32-unknown-unknown --release
# In rgba2laba/
$ wasm-bindgen target/wasm32-unknown-unknown/release/rgba2laba.wasm --out-dir wasm
```
+
+ # Serving the bundled wasm
+
+ * `gz` is ok, but make sure the Content-Type of the `.wasm` is `application/wasm`, or it will fail to load. | 4 | 0.4 | 4 | 0 |
3d28302ccd38ab334ae9a83c1868456843ae3ffd | src/node/company/TransactionContentGenerator.java | src/node/company/TransactionContentGenerator.java | package node.company;
import org.joda.time.DateTime;
import data.trainnetwork.BookableSection;
import transaction.FailedTransactionException;
import transaction.TransactionContent;
import transaction.Vault;
public abstract class TransactionContentGenerator extends TransactionContent<String, Vault<BookableSection>> {
/**
*
*/
private static final long serialVersionUID = 3685066724312335230L;
public static TransactionContent<String, Vault<BookableSection>> getTestContent() {
TransactionContent<String, Vault<BookableSection>> c
= new TransactionContent<String, Vault<BookableSection>>() {
private static final long serialVersionUID = -8167406104784795108L;
@Override
public void run() throws FailedTransactionException {
BookableSection s = new BookableSection("section", 1, DateTime.now(), 10, 10);
System.out.println("EXECUTING");
data.put(s.getID(), new Vault<BookableSection>(s));
}
};
return c;
}
}
| package node.company;
import java.util.Map;
import org.joda.time.DateTime;
import data.trainnetwork.BookableSection;
import transaction.FailedTransactionException;
import transaction.TransactionContent;
import transaction.Vault;
public abstract class TransactionContentGenerator extends TransactionContent<String, Vault<BookableSection>> {
/**
*
*/
private static final long serialVersionUID = 3685066724312335230L;
public static TransactionContent<String, Vault<BookableSection>> getTestContent() {
TransactionContent<String, Vault<BookableSection>> c
= new TransactionContent<String, Vault<BookableSection>>() {
private static final long serialVersionUID = -8167406104784795108L;
@Override
public void run() throws FailedTransactionException {
BookableSection s = new BookableSection("section", 1, DateTime.now(), 10, 10);
System.out.println("EXECUTING");
Map <String, Vault<BookableSection>> _data = (Map<String, Vault<BookableSection>>) manager.writeLock(new Vault(data));
_data.put(s.getID(), new Vault<BookableSection>(s));
}
};
return c;
}
}
| Extend test code to verify behaviour of vaults with transactions | Extend test code to verify behaviour of vaults with transactions
| Java | mit | balazspete/multi-hop-train-journey-booking | java | ## Code Before:
package node.company;
import org.joda.time.DateTime;
import data.trainnetwork.BookableSection;
import transaction.FailedTransactionException;
import transaction.TransactionContent;
import transaction.Vault;
public abstract class TransactionContentGenerator extends TransactionContent<String, Vault<BookableSection>> {
/**
*
*/
private static final long serialVersionUID = 3685066724312335230L;
public static TransactionContent<String, Vault<BookableSection>> getTestContent() {
TransactionContent<String, Vault<BookableSection>> c
= new TransactionContent<String, Vault<BookableSection>>() {
private static final long serialVersionUID = -8167406104784795108L;
@Override
public void run() throws FailedTransactionException {
BookableSection s = new BookableSection("section", 1, DateTime.now(), 10, 10);
System.out.println("EXECUTING");
data.put(s.getID(), new Vault<BookableSection>(s));
}
};
return c;
}
}
## Instruction:
Extend test code to verify behaviour of vaults with transactions
## Code After:
package node.company;
import java.util.Map;
import org.joda.time.DateTime;
import data.trainnetwork.BookableSection;
import transaction.FailedTransactionException;
import transaction.TransactionContent;
import transaction.Vault;
public abstract class TransactionContentGenerator extends TransactionContent<String, Vault<BookableSection>> {
/**
*
*/
private static final long serialVersionUID = 3685066724312335230L;
public static TransactionContent<String, Vault<BookableSection>> getTestContent() {
TransactionContent<String, Vault<BookableSection>> c
= new TransactionContent<String, Vault<BookableSection>>() {
private static final long serialVersionUID = -8167406104784795108L;
@Override
public void run() throws FailedTransactionException {
BookableSection s = new BookableSection("section", 1, DateTime.now(), 10, 10);
System.out.println("EXECUTING");
Map <String, Vault<BookableSection>> _data = (Map<String, Vault<BookableSection>>) manager.writeLock(new Vault(data));
_data.put(s.getID(), new Vault<BookableSection>(s));
}
};
return c;
}
}
| package node.company;
+
+ import java.util.Map;
import org.joda.time.DateTime;
import data.trainnetwork.BookableSection;
import transaction.FailedTransactionException;
import transaction.TransactionContent;
import transaction.Vault;
public abstract class TransactionContentGenerator extends TransactionContent<String, Vault<BookableSection>> {
/**
*
*/
private static final long serialVersionUID = 3685066724312335230L;
public static TransactionContent<String, Vault<BookableSection>> getTestContent() {
TransactionContent<String, Vault<BookableSection>> c
= new TransactionContent<String, Vault<BookableSection>>() {
private static final long serialVersionUID = -8167406104784795108L;
@Override
public void run() throws FailedTransactionException {
BookableSection s = new BookableSection("section", 1, DateTime.now(), 10, 10);
System.out.println("EXECUTING");
+
+ Map <String, Vault<BookableSection>> _data = (Map<String, Vault<BookableSection>>) manager.writeLock(new Vault(data));
- data.put(s.getID(), new Vault<BookableSection>(s));
+ _data.put(s.getID(), new Vault<BookableSection>(s));
? +
+
+
}
};
return c;
}
} | 8 | 0.242424 | 7 | 1 |
8d409ab4ca35b38d97d17f0f443c8cdb62d5e58e | tests/tests/mendertesting.py | tests/tests/mendertesting.py | import pytest
class MenderTesting(object):
slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")
| import pytest
class MenderTesting(object):
slow_cond = False
fast_cond = False
nightly_cond = False
slow = None
fast = None
nightly = None
if pytest.config.getoption("--runslow"):
MenderTesting.slow_cond = True
else:
MenderTesting.slow_cond = False
if pytest.config.getoption("--runfast"):
MenderTesting.fast_cond = True
else:
MenderTesting.fast_cond = False
if pytest.config.getoption("--runnightly"):
MenderTesting.nightly_cond = True
else:
MenderTesting.nightly_cond = False
if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
# Default to running everything but nightly.
MenderTesting.slow_cond = True
MenderTesting.fast_cond = True
MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")
| Fix no tests running when not passing any options. | Fix no tests running when not passing any options.
Signed-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>
| Python | apache-2.0 | pasinskim/integration,GregorioDiStefano/integration,pasinskim/integration,GregorioDiStefano/integration,pasinskim/integration | python | ## Code Before:
import pytest
class MenderTesting(object):
slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")
## Instruction:
Fix no tests running when not passing any options.
Signed-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>
## Code After:
import pytest
class MenderTesting(object):
slow_cond = False
fast_cond = False
nightly_cond = False
slow = None
fast = None
nightly = None
if pytest.config.getoption("--runslow"):
MenderTesting.slow_cond = True
else:
MenderTesting.slow_cond = False
if pytest.config.getoption("--runfast"):
MenderTesting.fast_cond = True
else:
MenderTesting.fast_cond = False
if pytest.config.getoption("--runnightly"):
MenderTesting.nightly_cond = True
else:
MenderTesting.nightly_cond = False
if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
# Default to running everything but nightly.
MenderTesting.slow_cond = True
MenderTesting.fast_cond = True
MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")
| import pytest
class MenderTesting(object):
- slow = pytest.mark.skipif(not pytest.config.getoption("--runslow"), reason="need --runslow option to run")
- fast = pytest.mark.skipif(not pytest.config.getoption("--runfast"), reason="need --runfast option to run")
+ slow_cond = False
+ fast_cond = False
+ nightly_cond = False
+
+ slow = None
+ fast = None
+ nightly = None
+
+ if pytest.config.getoption("--runslow"):
+ MenderTesting.slow_cond = True
+ else:
+ MenderTesting.slow_cond = False
+
+ if pytest.config.getoption("--runfast"):
+ MenderTesting.fast_cond = True
+ else:
+ MenderTesting.fast_cond = False
+
+ if pytest.config.getoption("--runnightly"):
+ MenderTesting.nightly_cond = True
+ else:
+ MenderTesting.nightly_cond = False
+
+ if not MenderTesting.slow_cond and not MenderTesting.fast_cond and not MenderTesting.nightly_cond:
+ # Default to running everything but nightly.
+ MenderTesting.slow_cond = True
+ MenderTesting.fast_cond = True
+
+ MenderTesting.slow = pytest.mark.skipif(not MenderTesting.slow_cond, reason="need --runslow option to run")
+ MenderTesting.fast = pytest.mark.skipif(not MenderTesting.fast_cond, reason="need --runfast option to run")
- nightly = pytest.mark.skipif(not pytest.config.getoption("--runnightly"), reason="need --runnightly option to run")
? ^^^^ ^^^ ^^^ -- ---------------- ^^
+ MenderTesting.nightly = pytest.mark.skipif(not MenderTesting.nightly_cond, reason="need --runnightly option to run")
? ^^^^^^^^^^^^^^ ^^^^^^^ ^ ^^^^^
| 34 | 5.666667 | 31 | 3 |
89138b1b77808fe3389c74d0616a1100c7ac2060 | tests/integration/components/search-facet-worktype/component-test.js | tests/integration/components/search-facet-worktype/component-test.js | import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-facet-worktype', 'Integration | Component | search facet worktype', {
integration: true
});
test('it renders', function(assert) {
this.set('key', 'type');
this.set('title', 'Type');
this.set('state', ['Publication']);
this.set('filter', '');
this.set('onChange', () => {});
this.set('data', {'presentation': {} });
this.render(hbs`{{search-facet-worktype
key=key
state=state
filter=filter
onChange=(action onChange)
selected=selected
data=data
}}`);
assert.equal(this.$('.type-filter-option')[0].innerText.trim(), 'Presentation');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-facet-worktype', 'Integration | Component | search facet worktype', {
integration: true
});
test('it renders', function(assert) {
this.set('key', 'type');
this.set('title', 'Type');
this.set('state', ['Publication']);
this.set('filter', '');
this.set('onChange', () => {});
this.set('processedTypes', {'presentation': {} });
this.render(hbs`{{search-facet-worktype
key=key
state=state
filter=filter
onChange=(action onChange)
selected=selected
processedTypes=processedTypes
}}`);
assert.equal(this.$('.type-filter-option')[0].innerText.trim(), 'Presentation');
});
| Modify test to reflect new data being passed in. | Modify test to reflect new data being passed in.
| JavaScript | apache-2.0 | CenterForOpenScience/ember-osf,binoculars/ember-osf,chrisseto/ember-osf,jamescdavis/ember-osf,jamescdavis/ember-osf,crcresearch/ember-osf,crcresearch/ember-osf,CenterForOpenScience/ember-osf,baylee-d/ember-osf,baylee-d/ember-osf,chrisseto/ember-osf,binoculars/ember-osf | javascript | ## Code Before:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-facet-worktype', 'Integration | Component | search facet worktype', {
integration: true
});
test('it renders', function(assert) {
this.set('key', 'type');
this.set('title', 'Type');
this.set('state', ['Publication']);
this.set('filter', '');
this.set('onChange', () => {});
this.set('data', {'presentation': {} });
this.render(hbs`{{search-facet-worktype
key=key
state=state
filter=filter
onChange=(action onChange)
selected=selected
data=data
}}`);
assert.equal(this.$('.type-filter-option')[0].innerText.trim(), 'Presentation');
});
## Instruction:
Modify test to reflect new data being passed in.
## Code After:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-facet-worktype', 'Integration | Component | search facet worktype', {
integration: true
});
test('it renders', function(assert) {
this.set('key', 'type');
this.set('title', 'Type');
this.set('state', ['Publication']);
this.set('filter', '');
this.set('onChange', () => {});
this.set('processedTypes', {'presentation': {} });
this.render(hbs`{{search-facet-worktype
key=key
state=state
filter=filter
onChange=(action onChange)
selected=selected
processedTypes=processedTypes
}}`);
assert.equal(this.$('.type-filter-option')[0].innerText.trim(), 'Presentation');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-facet-worktype', 'Integration | Component | search facet worktype', {
integration: true
});
test('it renders', function(assert) {
this.set('key', 'type');
this.set('title', 'Type');
this.set('state', ['Publication']);
this.set('filter', '');
this.set('onChange', () => {});
- this.set('data', {'presentation': {} });
? ^^^
+ this.set('processedTypes', {'presentation': {} });
? ++++++++ ^^^^^
this.render(hbs`{{search-facet-worktype
key=key
state=state
filter=filter
onChange=(action onChange)
selected=selected
- data=data
+ processedTypes=processedTypes
}}`);
assert.equal(this.$('.type-filter-option')[0].innerText.trim(), 'Presentation');
}); | 4 | 0.153846 | 2 | 2 |
de8940f46be7519f6e6482a11b640aaa10b9f741 | make-example-zips.sh | make-example-zips.sh | mkdir ./dist
for f in example-flask* ; do
if [[ -d $f ]] ; then
zip -r ./dist/$f.zip $f ;
fi ;
done;
| rm -rf ./**/__pycache__
# Compress all the example directories in .zip files to be uploaded for a release
mkdir ./dist
for f in example-flask* ; do
if [[ -d $f ]] ; then
zip -r ./dist/$f.zip $f ;
fi ;
done;
| Remove __pycache__ files before adding them to zip files | Remove __pycache__ files before adding them to zip files
| Shell | apache-2.0 | tiangolo/uwsgi-nginx-flask-docker,tiangolo/uwsgi-nginx-flask-docker,tiangolo/uwsgi-nginx-flask-docker | shell | ## Code Before:
mkdir ./dist
for f in example-flask* ; do
if [[ -d $f ]] ; then
zip -r ./dist/$f.zip $f ;
fi ;
done;
## Instruction:
Remove __pycache__ files before adding them to zip files
## Code After:
rm -rf ./**/__pycache__
# Compress all the example directories in .zip files to be uploaded for a release
mkdir ./dist
for f in example-flask* ; do
if [[ -d $f ]] ; then
zip -r ./dist/$f.zip $f ;
fi ;
done;
| + rm -rf ./**/__pycache__
+
+ # Compress all the example directories in .zip files to be uploaded for a release
mkdir ./dist
for f in example-flask* ; do
if [[ -d $f ]] ; then
zip -r ./dist/$f.zip $f ;
fi ;
done; | 3 | 0.5 | 3 | 0 |
73800ada02c99ec3ac1c00f120f1aef915a0bb83 | src/main/java/com/jakewharton/trakt/enumerations/Rating.java | src/main/java/com/jakewharton/trakt/enumerations/Rating.java | package com.jakewharton.trakt.enumerations;
import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;
public enum Rating implements TraktEnumeration {
Love("love"),
Hate("hate"),
Unrate("unrate");
private final String value;
private Rating(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();
static {
for (Rating via : Rating.values()) {
STRING_MAPPING.put(via.toString().toUpperCase(), via);
}
}
public static Rating fromValue(String value) {
return STRING_MAPPING.get(value.toUpperCase());
}
}
| package com.jakewharton.trakt.enumerations;
import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;
public enum Rating implements TraktEnumeration {
WeakSauce("1"),
Terrible("2"),
Bad("3"),
Poor("4"),
Meh("5"),
Fair("6"),
Good("7"),
Great("8"),
Superb("9"),
TotallyNinja("10"),
Unrate("0");
private final String value;
private Rating(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();
static {
for (Rating via : Rating.values()) {
STRING_MAPPING.put(via.toString().toUpperCase(), via);
}
}
public static Rating fromValue(String value) {
return STRING_MAPPING.get(value.toUpperCase());
}
}
| Use new rating values. It is recommended to always send the new ones, so removed Love and Hate and modified Unrate to be 0 instead of 'unrate'. | Use new rating values. It is recommended to always send the new ones, so removed Love and Hate and modified Unrate to be 0 instead of 'unrate'.
| Java | apache-2.0 | UweTrottmann/trakt-java | java | ## Code Before:
package com.jakewharton.trakt.enumerations;
import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;
public enum Rating implements TraktEnumeration {
Love("love"),
Hate("hate"),
Unrate("unrate");
private final String value;
private Rating(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();
static {
for (Rating via : Rating.values()) {
STRING_MAPPING.put(via.toString().toUpperCase(), via);
}
}
public static Rating fromValue(String value) {
return STRING_MAPPING.get(value.toUpperCase());
}
}
## Instruction:
Use new rating values. It is recommended to always send the new ones, so removed Love and Hate and modified Unrate to be 0 instead of 'unrate'.
## Code After:
package com.jakewharton.trakt.enumerations;
import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;
public enum Rating implements TraktEnumeration {
WeakSauce("1"),
Terrible("2"),
Bad("3"),
Poor("4"),
Meh("5"),
Fair("6"),
Good("7"),
Great("8"),
Superb("9"),
TotallyNinja("10"),
Unrate("0");
private final String value;
private Rating(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();
static {
for (Rating via : Rating.values()) {
STRING_MAPPING.put(via.toString().toUpperCase(), via);
}
}
public static Rating fromValue(String value) {
return STRING_MAPPING.get(value.toUpperCase());
}
}
| package com.jakewharton.trakt.enumerations;
import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;
public enum Rating implements TraktEnumeration {
- Love("love"),
- Hate("hate"),
+ WeakSauce("1"),
+ Terrible("2"),
+ Bad("3"),
+ Poor("4"),
+ Meh("5"),
+ Fair("6"),
+ Good("7"),
+ Great("8"),
+ Superb("9"),
+ TotallyNinja("10"),
- Unrate("unrate");
? ^^^^^^
+ Unrate("0");
? ^
private final String value;
private Rating(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();
static {
for (Rating via : Rating.values()) {
STRING_MAPPING.put(via.toString().toUpperCase(), via);
}
}
public static Rating fromValue(String value) {
return STRING_MAPPING.get(value.toUpperCase());
}
} | 14 | 0.411765 | 11 | 3 |
555919bb14d52abe4b16f887890b2426d17453d6 | examples/lighttpd.sh | examples/lighttpd.sh |
ctr1=`buildah from ${1:-fedora}`
## Get all updates and install our minimal httpd server
buildah run $ctr1 -- dnf update -y
buildah run $ctr1 -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" $ctr1
## Run our server and expose the port
buildah config $ctr1 --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf"
buildah config $ctr1 --port 80
## Commit this container to an image name
buildah commit $ctr1 ${2:-$USER/lighttpd}
|
ctr1=`buildah from ${1:-fedora}`
## Get all updates and install our minimal httpd server
buildah run $ctr1 -- dnf update -y
buildah run $ctr1 -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" $ctr1
## Run our server and expose the port
buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" $ctr1
buildah config --port 80 $ctr1
## Commit this container to an image name
buildah commit $ctr1 ${2:-$USER/lighttpd}
| Fix wrong order of parameters | Fix wrong order of parameters
Signed-off-by: SHooZ <SHooZ@ex.ua>
Closes: #513
Approved by: rhatdan
| Shell | apache-2.0 | nalind/buildah,nalind/buildah-1,TomSweeneyRedHat/buildah,rhatdan/buildah,projectatomic/buildah,rhatdan/buildah,rhatdan/buildah,TomSweeneyRedHat/buildah,ipbabble/buildah,projectatomic/buildah,TomSweeneyRedHat/buildah,projectatomic/buildah,nalind/buildah-1,nalind/buildah-1,ipbabble/buildah,nalind/buildah | shell | ## Code Before:
ctr1=`buildah from ${1:-fedora}`
## Get all updates and install our minimal httpd server
buildah run $ctr1 -- dnf update -y
buildah run $ctr1 -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" $ctr1
## Run our server and expose the port
buildah config $ctr1 --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf"
buildah config $ctr1 --port 80
## Commit this container to an image name
buildah commit $ctr1 ${2:-$USER/lighttpd}
## Instruction:
Fix wrong order of parameters
Signed-off-by: SHooZ <SHooZ@ex.ua>
Closes: #513
Approved by: rhatdan
## Code After:
ctr1=`buildah from ${1:-fedora}`
## Get all updates and install our minimal httpd server
buildah run $ctr1 -- dnf update -y
buildah run $ctr1 -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" $ctr1
## Run our server and expose the port
buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" $ctr1
buildah config --port 80 $ctr1
## Commit this container to an image name
buildah commit $ctr1 ${2:-$USER/lighttpd}
|
ctr1=`buildah from ${1:-fedora}`
## Get all updates and install our minimal httpd server
buildah run $ctr1 -- dnf update -y
buildah run $ctr1 -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" $ctr1
## Run our server and expose the port
- buildah config $ctr1 --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf"
? ------
+ buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" $ctr1
? ++++++
- buildah config $ctr1 --port 80
? ------
+ buildah config --port 80 $ctr1
? ++++++
## Commit this container to an image name
buildah commit $ctr1 ${2:-$USER/lighttpd} | 4 | 0.25 | 2 | 2 |
88126de176ab8e33309a1091efa9a0d905277af6 | js/presents/plugins/controls.js | js/presents/plugins/controls.js | (function (exports) {
var Controls = exports.Controls = {};
Controls.attach = function (options) {
var self = this;
document.addEventListener('keypress', function (e) {
if (String.fromCharCode(e.keyCode) == "h") {
self.previous();
}
else if (String.fromCharCode(e.keyCode) == "l") {
self.next();
}
});
};
})(window);
| (function (exports) {
var Controls = exports.Controls = {};
Controls.attach = function (options) {
var self = this;
document.addEventListener('keypress', function (e) {
var c = String.fromCharCode(e.keyCode);
if (c == "h" || c == "k") {
self.previous();
}
else if (c == "l" || c == "j") {
self.next();
}
});
};
})(window);
| Allow `j` and `k` to switch slides as well | [ux] Allow `j` and `k` to switch slides as well
| JavaScript | mit | mmalecki/presents | javascript | ## Code Before:
(function (exports) {
var Controls = exports.Controls = {};
Controls.attach = function (options) {
var self = this;
document.addEventListener('keypress', function (e) {
if (String.fromCharCode(e.keyCode) == "h") {
self.previous();
}
else if (String.fromCharCode(e.keyCode) == "l") {
self.next();
}
});
};
})(window);
## Instruction:
[ux] Allow `j` and `k` to switch slides as well
## Code After:
(function (exports) {
var Controls = exports.Controls = {};
Controls.attach = function (options) {
var self = this;
document.addEventListener('keypress', function (e) {
var c = String.fromCharCode(e.keyCode);
if (c == "h" || c == "k") {
self.previous();
}
else if (c == "l" || c == "j") {
self.next();
}
});
};
})(window);
| (function (exports) {
var Controls = exports.Controls = {};
Controls.attach = function (options) {
var self = this;
document.addEventListener('keypress', function (e) {
- if (String.fromCharCode(e.keyCode) == "h") {
? ^^ ^ ^^^^^^^^^^
+ var c = String.fromCharCode(e.keyCode);
? ^^^ ^^^^ ^
+ if (c == "h" || c == "k") {
self.previous();
}
- else if (String.fromCharCode(e.keyCode) == "l") {
+ else if (c == "l" || c == "j") {
self.next();
}
});
};
})(window);
| 5 | 0.294118 | 3 | 2 |
423956510d1e8696873d8ebd547024e0e127be8b | gitconfig.erb | gitconfig.erb | [user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[color]
ui = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
[apply]
whitespace = nowarn
[format]
pretty = %C(yellow)%h%Cred%d %Creset%s
[github]
user = <%= print("Your github user: "); STDOUT.flush; STDIN.gets.chomp %>
[push]
default = tracking
| [user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[color]
ui = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
[apply]
whitespace = nowarn
[format]
pretty = %C(yellow)%h%Cred%d %Creset%s
[github]
user = <%= print("Your github user: "); STDOUT.flush; STDIN.gets.chomp %>
[push]
default = tracking
[alias]
rmb = !sh -c 'git branch -d $1 && git push origin :$1' -
| Add alias to remove local and remote branch, tks @britto | Add alias to remove local and remote branch, tks @britto
| HTML+ERB | mit | carlosantoniodasilva/dotfiles,carlosantoniodasilva/dotfiles | html+erb | ## Code Before:
[user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[color]
ui = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
[apply]
whitespace = nowarn
[format]
pretty = %C(yellow)%h%Cred%d %Creset%s
[github]
user = <%= print("Your github user: "); STDOUT.flush; STDIN.gets.chomp %>
[push]
default = tracking
## Instruction:
Add alias to remove local and remote branch, tks @britto
## Code After:
[user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[color]
ui = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
[apply]
whitespace = nowarn
[format]
pretty = %C(yellow)%h%Cred%d %Creset%s
[github]
user = <%= print("Your github user: "); STDOUT.flush; STDIN.gets.chomp %>
[push]
default = tracking
[alias]
rmb = !sh -c 'git branch -d $1 && git push origin :$1' -
| [user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[color]
ui = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
[apply]
whitespace = nowarn
[format]
pretty = %C(yellow)%h%Cred%d %Creset%s
[github]
user = <%= print("Your github user: "); STDOUT.flush; STDIN.gets.chomp %>
[push]
default = tracking
+ [alias]
+ rmb = !sh -c 'git branch -d $1 && git push origin :$1' - | 2 | 0.125 | 2 | 0 |
2fb087e02e8197804efb8fab2c23fcfea9bef2cf | src/router/index.js | src/router/index.js | import Vue from 'vue'
import Router from 'vue-router'
import Welcome from '@/components/Welcome'
import Bundles from '@/components/bundles/Bundles'
import BundleItems from '@/components/bundles/BundleItems'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/welcome',
name: 'Welcome',
component: Welcome
},
{
path: '/',
redirect: {
name: 'Welcome'
}
},
{
path: '/bundles',
name: 'Bundles',
component: Bundles,
children: [
{
path: ':id',
name: 'bundle-items',
component: BundleItems
}
]
},
{
name: 'Search',
path: '/search'
},
{
name: 'Inventory',
path: '/inventory'
}
],
linkActiveClass: 'is-active'
})
| import Vue from 'vue'
import Router from 'vue-router'
import Welcome from '@/components/Welcome'
import Bundles from '@/components/bundles/Bundles'
import BundleItems from '@/components/bundles/BundleItems'
import Search from '@/components/search/Search'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/welcome',
name: 'Welcome',
component: Welcome
},
{
path: '/',
redirect: {
name: 'Welcome'
}
},
{
path: '/bundles',
name: 'Bundles',
component: Bundles,
children: [
{
path: ':id',
name: 'bundle-items',
component: BundleItems
}
]
},
{
name: 'Search',
path: '/search',
component: Search
},
{
name: 'Inventory',
path: '/inventory'
}
],
linkActiveClass: 'is-active'
})
| Add search page to router | Add search page to router
| JavaScript | mit | kihashi/stardew_community_checklist,kihashi/stardew_community_checklist | javascript | ## Code Before:
import Vue from 'vue'
import Router from 'vue-router'
import Welcome from '@/components/Welcome'
import Bundles from '@/components/bundles/Bundles'
import BundleItems from '@/components/bundles/BundleItems'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/welcome',
name: 'Welcome',
component: Welcome
},
{
path: '/',
redirect: {
name: 'Welcome'
}
},
{
path: '/bundles',
name: 'Bundles',
component: Bundles,
children: [
{
path: ':id',
name: 'bundle-items',
component: BundleItems
}
]
},
{
name: 'Search',
path: '/search'
},
{
name: 'Inventory',
path: '/inventory'
}
],
linkActiveClass: 'is-active'
})
## Instruction:
Add search page to router
## Code After:
import Vue from 'vue'
import Router from 'vue-router'
import Welcome from '@/components/Welcome'
import Bundles from '@/components/bundles/Bundles'
import BundleItems from '@/components/bundles/BundleItems'
import Search from '@/components/search/Search'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/welcome',
name: 'Welcome',
component: Welcome
},
{
path: '/',
redirect: {
name: 'Welcome'
}
},
{
path: '/bundles',
name: 'Bundles',
component: Bundles,
children: [
{
path: ':id',
name: 'bundle-items',
component: BundleItems
}
]
},
{
name: 'Search',
path: '/search',
component: Search
},
{
name: 'Inventory',
path: '/inventory'
}
],
linkActiveClass: 'is-active'
})
| import Vue from 'vue'
import Router from 'vue-router'
import Welcome from '@/components/Welcome'
import Bundles from '@/components/bundles/Bundles'
import BundleItems from '@/components/bundles/BundleItems'
+ import Search from '@/components/search/Search'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/welcome',
name: 'Welcome',
component: Welcome
},
{
path: '/',
redirect: {
name: 'Welcome'
}
},
{
path: '/bundles',
name: 'Bundles',
component: Bundles,
children: [
{
path: ':id',
name: 'bundle-items',
component: BundleItems
}
]
},
{
name: 'Search',
- path: '/search'
+ path: '/search',
? +
+ component: Search
},
{
name: 'Inventory',
path: '/inventory'
}
],
linkActiveClass: 'is-active'
}) | 4 | 0.090909 | 3 | 1 |
d0f2b1910f4c9776eadfa1297022988db3b6394c | requirements.txt | requirements.txt | unicodecsv
markdown
flask
# -e git+https://github.com/pmandera/semspaces.git@71b4d017a7227a3aced50a6d4b6787d64c637287#egg=semspaces
semspaces==0.1.5
fs
pyinstaller
| unicodecsv
markdown
flask
git+https://github.com/pmandera/semspaces.git@278bfb0cabce2190c500b4390b9c83c8c659dc10#egg=semspaces
fs
pyinstaller
| Switch to using semspaces directly from github | Switch to using semspaces directly from github
| Text | apache-2.0 | pmandera/snaut,pmandera/snaut,pmandera/snaut | text | ## Code Before:
unicodecsv
markdown
flask
# -e git+https://github.com/pmandera/semspaces.git@71b4d017a7227a3aced50a6d4b6787d64c637287#egg=semspaces
semspaces==0.1.5
fs
pyinstaller
## Instruction:
Switch to using semspaces directly from github
## Code After:
unicodecsv
markdown
flask
git+https://github.com/pmandera/semspaces.git@278bfb0cabce2190c500b4390b9c83c8c659dc10#egg=semspaces
fs
pyinstaller
| unicodecsv
markdown
flask
+ git+https://github.com/pmandera/semspaces.git@278bfb0cabce2190c500b4390b9c83c8c659dc10#egg=semspaces
- # -e git+https://github.com/pmandera/semspaces.git@71b4d017a7227a3aced50a6d4b6787d64c637287#egg=semspaces
- semspaces==0.1.5
fs
pyinstaller | 3 | 0.428571 | 1 | 2 |
c7668ba9f0aa4e74b8ddc4a70bcec8d55dac36de | nixos/roles/video-editing.nix | nixos/roles/video-editing.nix | { pkgs, ... }:
{
# fix issue of missing frei0r plugins,
# see https://github.com/NixOS/nixpkgs/issues/29614#issuecomment-511118058
nixpkgs.config.packageOverrides = pkgs: {
kdenlive = pkgs.kdenlive.overrideAttrs (oldAttrs: rec {
postInstall = ''
wrapProgram $out/bin/kdenlive --prefix FREI0R_PATH : ${pkgs.frei0r}/lib/frei0r-1
'';
nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ pkgs.makeWrapper ];
});
};
environment.systemPackages = with pkgs; [
(ffmpeg-full.override {
nonfreeLicensing = true;
nvenc = true;
})
kdenlive
breeze-icons # icon set used in kdenlive
audacity
];
} | { pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(ffmpeg-full.override {
nonfreeLicensing = true;
nvenc = true;
})
kdenlive
breeze-icons # icon set used in kdenlive
audacity
];
} | Remove workaround for missing frei0r plugins in Kdenlive | [nixos] Remove workaround for missing frei0r plugins in Kdenlive
it is not required anymore
| Nix | mit | timjb/dotfiles,timjb/dotfiles,timjb/dotfiles | nix | ## Code Before:
{ pkgs, ... }:
{
# fix issue of missing frei0r plugins,
# see https://github.com/NixOS/nixpkgs/issues/29614#issuecomment-511118058
nixpkgs.config.packageOverrides = pkgs: {
kdenlive = pkgs.kdenlive.overrideAttrs (oldAttrs: rec {
postInstall = ''
wrapProgram $out/bin/kdenlive --prefix FREI0R_PATH : ${pkgs.frei0r}/lib/frei0r-1
'';
nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ pkgs.makeWrapper ];
});
};
environment.systemPackages = with pkgs; [
(ffmpeg-full.override {
nonfreeLicensing = true;
nvenc = true;
})
kdenlive
breeze-icons # icon set used in kdenlive
audacity
];
}
## Instruction:
[nixos] Remove workaround for missing frei0r plugins in Kdenlive
it is not required anymore
## Code After:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(ffmpeg-full.override {
nonfreeLicensing = true;
nvenc = true;
})
kdenlive
breeze-icons # icon set used in kdenlive
audacity
];
} | { pkgs, ... }:
{
- # fix issue of missing frei0r plugins,
- # see https://github.com/NixOS/nixpkgs/issues/29614#issuecomment-511118058
- nixpkgs.config.packageOverrides = pkgs: {
- kdenlive = pkgs.kdenlive.overrideAttrs (oldAttrs: rec {
- postInstall = ''
- wrapProgram $out/bin/kdenlive --prefix FREI0R_PATH : ${pkgs.frei0r}/lib/frei0r-1
- '';
- nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ pkgs.makeWrapper ];
- });
- };
-
environment.systemPackages = with pkgs; [
(ffmpeg-full.override {
nonfreeLicensing = true;
nvenc = true;
})
kdenlive
breeze-icons # icon set used in kdenlive
audacity
];
} | 11 | 0.458333 | 0 | 11 |
244da6a4ffa5ff8de80d18baceedcf947ef6b68e | tensorflow/python/tf2.py | tensorflow/python/tf2.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
_force_enable = False
def enable():
"""Enables v2 behaviors."""
global _force_enable
_force_enable = True
def disable():
"""Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
global _force_enable
_force_enable = False
def enabled():
"""Returns True iff TensorFlow 2.0 behavior should be enabled."""
return _force_enable or os.getenv("TF2_BEHAVIOR") is not None
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
_force_enable = False
def enable():
"""Enables v2 behaviors."""
global _force_enable
_force_enable = True
def disable():
"""Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
global _force_enable
_force_enable = False
def enabled():
"""Returns True iff TensorFlow 2.0 behavior should be enabled."""
return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"
| Make TF2_BEHAVIOR=0 disable TF2 behavior. | Make TF2_BEHAVIOR=0 disable TF2 behavior.
Prior to this change, the mere presence of a TF2_BEHAVIOR
environment variable would enable TF2 behavior. With this,
setting that environment variable to "0" will disable it.
PiperOrigin-RevId: 223804383
| Python | apache-2.0 | freedomtan/tensorflow,kevin-coder/tensorflow-fork,aldian/tensorflow,davidzchen/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,ghchinoy/tensorflow,freedomtan/tensorflow,cxxgtxy/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,theflofly/tensorflow,renyi533/tensorflow,aam-at/tensorflow,gunan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,asimshankar/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,arborh/tensorflow,arborh/tensorflow,gautam1858/tensorflow,kevin-coder/tensorflow-fork,sarvex/tensorflow,ageron/tensorflow,ageron/tensorflow,kevin-coder/tensorflow-fork,chemelnucfin/tensorflow,adit-chandra/tensorflow,frreiss/tensorflow-fred,renyi533/tensorflow,xzturn/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,sarvex/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,cxxgtxy/tensorflow,frreiss/tensorflow-fred,jbedorf/tensorflow,xzturn/tensorflow,xzturn/tensorflow,yongtang/tensorflow,jhseu/tensorflow,hfp/tensorflow-xsmm,apark263/tensorflow,tensorflow/tensorflow-pywrap_saved_model,aam-at/tensorflow,asimshankar/tensorflow,Intel-Corporation/tensorflow,ageron/tensorflow,paolodedios/tensorflow,aam-at/tensorflow,chemelnucfin/tensorflow,xzturn/tensorflow,annarev/tensorflow,sarvex/tensorflow,annarev/tensorflow,petewarden/tensorflow,tensorflow/tensorflow,theflofly/tensorflow,xzturn/tensorflow,DavidNorman/tensorflow,asimshankar/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,asimshankar/tensorflow,renyi533/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ghchinoy/tensorflow,renyi533/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,chemelnucfin/tensorflow,Bismarrck/tensorflow,ppwwyyxx/tensorflow,xzturn/tensorflow,tensorflow/tensorflow,adit-chandra/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gunan/tensorflow,yongtang/tensorflow,renyi533/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,jhseu/tensorflow,davidzchen/tensorflow,karllessard/tensorflow,hfp/tensorflow-xsmm,adit-chandra/tensorflow,DavidNorman/tensorflow,gunan/tensorflow,paolodedios/tensorflow,gunan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,paolodedios/tensorflow,jbedorf/tensorflow,kevin-coder/tensorflow-fork,cxxgtxy/tensorflow,alsrgv/tensorflow,aam-at/tensorflow,theflofly/tensorflow,xzturn/tensorflow,jendap/tensorflow,gunan/tensorflow,annarev/tensorflow,jhseu/tensorflow,hfp/tensorflow-xsmm,paolodedios/tensorflow,freedomtan/tensorflow,arborh/tensorflow,hfp/tensorflow-xsmm,Intel-Corporation/tensorflow,ageron/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,theflofly/tensorflow,xzturn/tensorflow,Intel-Corporation/tensorflow,alsrgv/tensorflow,DavidNorman/tensorflow,chemelnucfin/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,hfp/tensorflow-xsmm,DavidNorman/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow,renyi533/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,aam-at/tensorflow,aam-at/tensorflow,jendap/tensorflow,jhseu/tensorflow,jbedorf/tensorflow,adit-chandra/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,apark263/tensorflow,alsrgv/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,aam-at/tensorflow,freedomtan/tensorflow,Bismarrck/tensorflow,gautam1858/tensorflow,arborh/tensorflow,hfp/tensorflow-xsmm,gautam1858/tensorflow,arborh/tensorflow,theflofly/tensorflow,gautam1858/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,aam-at/tensorflow,chemelnucfin/tensorflow,jhseu/tensorflow,apark263/tensorflow,Intel-tensorflow/tensorflow,apark263/tensorflow,freedomtan/tensorflow,petewarden/tensorflow,asimshankar/tensorflow,annarev/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow,freedomtan/tensorflow,petewarden/tensorflow,yongtang/tensorflow,ageron/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,Bismarrck/tensorflow,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,petewarden/tensorflow,annarev/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,alsrgv/tensorflow,renyi533/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow,Bismarrck/tensorflow,aam-at/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ghchinoy/tensorflow,jendap/tensorflow,ppwwyyxx/tensorflow,hfp/tensorflow-xsmm,Intel-Corporation/tensorflow,aldian/tensorflow,Intel-Corporation/tensorflow,davidzchen/tensorflow,ageron/tensorflow,Bismarrck/tensorflow,Bismarrck/tensorflow,kevin-coder/tensorflow-fork,Intel-Corporation/tensorflow,tensorflow/tensorflow,ppwwyyxx/tensorflow,arborh/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,hfp/tensorflow-xsmm,Bismarrck/tensorflow,theflofly/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,gunan/tensorflow,asimshankar/tensorflow,jendap/tensorflow,aldian/tensorflow,Bismarrck/tensorflow,ghchinoy/tensorflow,alsrgv/tensorflow,jendap/tensorflow,ageron/tensorflow,gautam1858/tensorflow,ghchinoy/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,adit-chandra/tensorflow,asimshankar/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Bismarrck/tensorflow,chemelnucfin/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,petewarden/tensorflow,jendap/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ageron/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,ppwwyyxx/tensorflow,theflofly/tensorflow,sarvex/tensorflow,ppwwyyxx/tensorflow,annarev/tensorflow,renyi533/tensorflow,jhseu/tensorflow,yongtang/tensorflow,petewarden/tensorflow,adit-chandra/tensorflow,ppwwyyxx/tensorflow,karllessard/tensorflow,DavidNorman/tensorflow,jbedorf/tensorflow,jendap/tensorflow,ppwwyyxx/tensorflow,petewarden/tensorflow,ghchinoy/tensorflow,adit-chandra/tensorflow,Intel-Corporation/tensorflow,gunan/tensorflow,frreiss/tensorflow-fred,DavidNorman/tensorflow,DavidNorman/tensorflow,jbedorf/tensorflow,karllessard/tensorflow,jbedorf/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,paolodedios/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jendap/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,davidzchen/tensorflow,jbedorf/tensorflow,jhseu/tensorflow,ghchinoy/tensorflow,jbedorf/tensorflow,xzturn/tensorflow,adit-chandra/tensorflow,jendap/tensorflow,hfp/tensorflow-xsmm,davidzchen/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,aam-at/tensorflow,annarev/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,Intel-tensorflow/tensorflow,apark263/tensorflow,Intel-tensorflow/tensorflow,jhseu/tensorflow,aldian/tensorflow,apark263/tensorflow,ghchinoy/tensorflow,gunan/tensorflow,asimshankar/tensorflow,chemelnucfin/tensorflow,renyi533/tensorflow,karllessard/tensorflow,sarvex/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,theflofly/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,apark263/tensorflow,Intel-tensorflow/tensorflow,petewarden/tensorflow,Intel-Corporation/tensorflow,jbedorf/tensorflow,gunan/tensorflow,jbedorf/tensorflow,hfp/tensorflow-xsmm,Bismarrck/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,Intel-tensorflow/tensorflow,jbedorf/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gunan/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,apark263/tensorflow,jhseu/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,asimshankar/tensorflow,arborh/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,renyi533/tensorflow,arborh/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,ageron/tensorflow,annarev/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,apark263/tensorflow,karllessard/tensorflow,adit-chandra/tensorflow,apark263/tensorflow,theflofly/tensorflow,kevin-coder/tensorflow-fork,Intel-tensorflow/tensorflow,paolodedios/tensorflow,jendap/tensorflow,Intel-tensorflow/tensorflow,ageron/tensorflow,aldian/tensorflow,ppwwyyxx/tensorflow,DavidNorman/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,ppwwyyxx/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,cxxgtxy/tensorflow,adit-chandra/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,asimshankar/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,kevin-coder/tensorflow-fork,alsrgv/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,petewarden/tensorflow,ghchinoy/tensorflow,paolodedios/tensorflow,asimshankar/tensorflow,gunan/tensorflow,chemelnucfin/tensorflow,ppwwyyxx/tensorflow,frreiss/tensorflow-fred,kevin-coder/tensorflow-fork,ageron/tensorflow,ghchinoy/tensorflow,DavidNorman/tensorflow,annarev/tensorflow,karllessard/tensorflow,ageron/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,gautam1858/tensorflow,ppwwyyxx/tensorflow,DavidNorman/tensorflow,Bismarrck/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,theflofly/tensorflow,alsrgv/tensorflow,yongtang/tensorflow,ghchinoy/tensorflow,theflofly/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,DavidNorman/tensorflow,theflofly/tensorflow,arborh/tensorflow | python | ## Code Before:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
_force_enable = False
def enable():
"""Enables v2 behaviors."""
global _force_enable
_force_enable = True
def disable():
"""Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
global _force_enable
_force_enable = False
def enabled():
"""Returns True iff TensorFlow 2.0 behavior should be enabled."""
return _force_enable or os.getenv("TF2_BEHAVIOR") is not None
## Instruction:
Make TF2_BEHAVIOR=0 disable TF2 behavior.
Prior to this change, the mere presence of a TF2_BEHAVIOR
environment variable would enable TF2 behavior. With this,
setting that environment variable to "0" will disable it.
PiperOrigin-RevId: 223804383
## Code After:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
_force_enable = False
def enable():
"""Enables v2 behaviors."""
global _force_enable
_force_enable = True
def disable():
"""Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
global _force_enable
_force_enable = False
def enabled():
"""Returns True iff TensorFlow 2.0 behavior should be enabled."""
return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
_force_enable = False
def enable():
"""Enables v2 behaviors."""
global _force_enable
_force_enable = True
def disable():
"""Disables v2 behaviors (TF2_BEHAVIOR env variable is still respected)."""
global _force_enable
_force_enable = False
def enabled():
"""Returns True iff TensorFlow 2.0 behavior should be enabled."""
- return _force_enable or os.getenv("TF2_BEHAVIOR") is not None
? ^^ ^^^^^^^^
+ return _force_enable or os.getenv("TF2_BEHAVIOR", "0") != "0"
? +++++ ^^ ^^^
| 2 | 0.076923 | 1 | 1 |
974d9b5adab999dfdc0671f5c55ebb80c891ce57 | app/views/respect/rails/schemas/index.html.erb | app/views/respect/rails/schemas/index.html.erb | <h1><%= @info.app.name.titleize %> REST API Reference documentation</h1>
<h2>Routes index</h2>
<ul>
<% @info.routes.sort.each do |route| %>
<li><%= route.spec %></li>
<% end %>
</ul>
<h2>Table of content</h2>
<ul>
<% @info.toc.keys.sort.each do |controller_name| %>
<li>
<%= controller_name.titleize %>
<ul>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<li><%= action_name.titleize %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
| <h1><%= @info.app.name.titleize %> REST API Reference documentation</h1>
<h2>Routes index</h2>
<ul>
<% @info.routes.sort.each do |route| %>
<li><%= route.spec %></li>
<% end %>
</ul>
<h2>Table of content</h2>
<ul>
<% @info.toc.keys.sort.each do |controller_name| %>
<li>
<%= controller_name.titleize %>
<ul>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<li><%= action_name.titleize %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
<h2>Schema</h2>
<% @info.toc.keys.sort.each do |controller_name| %>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<% route = @info.toc[controller_name][action_name] %>
<% schema = route.schema %>
<h3><%= controller_name.titleize %> > <%= action_name.titleize %></h3>
<h4>Route</h4>
<%= route.spec %>
<% if schema.request_schema %>
<h4>Request schema</h4>
<%= schema.request_schema.params %>
<% end %>
<% end %>
<% end %>
| Document request schema for each route. | Document request schema for each route.
| HTML+ERB | mit | nicolasdespres/respect-rails,nicolasdespres/respect-rails,nicolasdespres/respect-rails | html+erb | ## Code Before:
<h1><%= @info.app.name.titleize %> REST API Reference documentation</h1>
<h2>Routes index</h2>
<ul>
<% @info.routes.sort.each do |route| %>
<li><%= route.spec %></li>
<% end %>
</ul>
<h2>Table of content</h2>
<ul>
<% @info.toc.keys.sort.each do |controller_name| %>
<li>
<%= controller_name.titleize %>
<ul>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<li><%= action_name.titleize %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
## Instruction:
Document request schema for each route.
## Code After:
<h1><%= @info.app.name.titleize %> REST API Reference documentation</h1>
<h2>Routes index</h2>
<ul>
<% @info.routes.sort.each do |route| %>
<li><%= route.spec %></li>
<% end %>
</ul>
<h2>Table of content</h2>
<ul>
<% @info.toc.keys.sort.each do |controller_name| %>
<li>
<%= controller_name.titleize %>
<ul>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<li><%= action_name.titleize %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
<h2>Schema</h2>
<% @info.toc.keys.sort.each do |controller_name| %>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<% route = @info.toc[controller_name][action_name] %>
<% schema = route.schema %>
<h3><%= controller_name.titleize %> > <%= action_name.titleize %></h3>
<h4>Route</h4>
<%= route.spec %>
<% if schema.request_schema %>
<h4>Request schema</h4>
<%= schema.request_schema.params %>
<% end %>
<% end %>
<% end %>
| <h1><%= @info.app.name.titleize %> REST API Reference documentation</h1>
<h2>Routes index</h2>
<ul>
<% @info.routes.sort.each do |route| %>
<li><%= route.spec %></li>
<% end %>
</ul>
<h2>Table of content</h2>
<ul>
<% @info.toc.keys.sort.each do |controller_name| %>
<li>
<%= controller_name.titleize %>
<ul>
<% @info.toc[controller_name].keys.sort.each do |action_name| %>
<li><%= action_name.titleize %></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
+
+ <h2>Schema</h2>
+
+ <% @info.toc.keys.sort.each do |controller_name| %>
+ <% @info.toc[controller_name].keys.sort.each do |action_name| %>
+ <% route = @info.toc[controller_name][action_name] %>
+ <% schema = route.schema %>
+
+ <h3><%= controller_name.titleize %> > <%= action_name.titleize %></h3>
+
+ <h4>Route</h4>
+ <%= route.spec %>
+
+ <% if schema.request_schema %>
+ <h4>Request schema</h4>
+ <%= schema.request_schema.params %>
+ <% end %>
+
+ <% end %>
+ <% end %> | 20 | 0.833333 | 20 | 0 |
657b8149d36e833b508817f5477506d8f53db407 | recipes/hkl/meta.yaml | recipes/hkl/meta.yaml | {% set name = "hkl" %}
{% set version = "5.0.0.2173" %}
{% set sha256 = "5f3991d2af4ff01d6f6e29d0176af9bc1b54e6a8598046a050ad804fedd860f2" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://github.com/picca/{{ name }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
build:
number: 0
skip: True # [py<36 or win or osx]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- autoconf
- automake
- gobject-introspection
- gsl
- libtool
- m4
- patchelf
- pkg-config
- pygobject
host:
- python
run:
- python
- gsl
- libiconv
- numpy
- pcre
- pygobject
about:
home: http://repo.or.cz/w/hkl.git
license: GPL-3.0
license_file: COPYING
summary: Diffractometer computation library
doc_url: https://people.debian.org/~picca/hkl/hkl.html
dev_url: http://repo.or.cz/w/hkl.git
extra:
recipe-maintainers:
- mrakitin
- prjemian
| {% set name = "hkl" %}
{% set version = "5.0.0.2173" %}
{% set sha256 = "5f3991d2af4ff01d6f6e29d0176af9bc1b54e6a8598046a050ad804fedd860f2" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://github.com/picca/{{ name }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
build:
number: 0
skip: True # [py<36 or win or osx]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- autoconf
- automake
- libtool
- m4
- pkg-config
host:
- gobject-introspection
- gsl
- pygobject
- python
run:
- python
- gsl
- libiconv
- numpy
- pcre
- pygobject
about:
home: http://repo.or.cz/w/hkl.git
license: GPL-3.0
license_file: COPYING
summary: Diffractometer computation library
doc_url: https://people.debian.org/~picca/hkl/hkl.html
dev_url: http://repo.or.cz/w/hkl.git
extra:
recipe-maintainers:
- mrakitin
- prjemian
| Move some deps to the host requirements | Move some deps to the host requirements
| YAML | bsd-3-clause | patricksnape/staged-recipes,stuertz/staged-recipes,hadim/staged-recipes,ReimarBauer/staged-recipes,igortg/staged-recipes,chrisburr/staged-recipes,patricksnape/staged-recipes,scopatz/staged-recipes,ocefpaf/staged-recipes,stuertz/staged-recipes,kwilcox/staged-recipes,conda-forge/staged-recipes,goanpeca/staged-recipes,conda-forge/staged-recipes,ReimarBauer/staged-recipes,petrushy/staged-recipes,jochym/staged-recipes,jakirkham/staged-recipes,mariusvniekerk/staged-recipes,johanneskoester/staged-recipes,SylvainCorlay/staged-recipes,mariusvniekerk/staged-recipes,chrisburr/staged-recipes,petrushy/staged-recipes,jakirkham/staged-recipes,scopatz/staged-recipes,igortg/staged-recipes,ocefpaf/staged-recipes,jochym/staged-recipes,kwilcox/staged-recipes,hadim/staged-recipes,SylvainCorlay/staged-recipes,johanneskoester/staged-recipes,goanpeca/staged-recipes | yaml | ## Code Before:
{% set name = "hkl" %}
{% set version = "5.0.0.2173" %}
{% set sha256 = "5f3991d2af4ff01d6f6e29d0176af9bc1b54e6a8598046a050ad804fedd860f2" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://github.com/picca/{{ name }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
build:
number: 0
skip: True # [py<36 or win or osx]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- autoconf
- automake
- gobject-introspection
- gsl
- libtool
- m4
- patchelf
- pkg-config
- pygobject
host:
- python
run:
- python
- gsl
- libiconv
- numpy
- pcre
- pygobject
about:
home: http://repo.or.cz/w/hkl.git
license: GPL-3.0
license_file: COPYING
summary: Diffractometer computation library
doc_url: https://people.debian.org/~picca/hkl/hkl.html
dev_url: http://repo.or.cz/w/hkl.git
extra:
recipe-maintainers:
- mrakitin
- prjemian
## Instruction:
Move some deps to the host requirements
## Code After:
{% set name = "hkl" %}
{% set version = "5.0.0.2173" %}
{% set sha256 = "5f3991d2af4ff01d6f6e29d0176af9bc1b54e6a8598046a050ad804fedd860f2" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://github.com/picca/{{ name }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
build:
number: 0
skip: True # [py<36 or win or osx]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- autoconf
- automake
- libtool
- m4
- pkg-config
host:
- gobject-introspection
- gsl
- pygobject
- python
run:
- python
- gsl
- libiconv
- numpy
- pcre
- pygobject
about:
home: http://repo.or.cz/w/hkl.git
license: GPL-3.0
license_file: COPYING
summary: Diffractometer computation library
doc_url: https://people.debian.org/~picca/hkl/hkl.html
dev_url: http://repo.or.cz/w/hkl.git
extra:
recipe-maintainers:
- mrakitin
- prjemian
| {% set name = "hkl" %}
{% set version = "5.0.0.2173" %}
{% set sha256 = "5f3991d2af4ff01d6f6e29d0176af9bc1b54e6a8598046a050ad804fedd860f2" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://github.com/picca/{{ name }}/archive/v{{ version }}.tar.gz
sha256: {{ sha256 }}
build:
number: 0
skip: True # [py<36 or win or osx]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- autoconf
- automake
+ - libtool
+ - m4
+ - pkg-config
+ host:
- gobject-introspection
- gsl
- - libtool
- - m4
- - patchelf
- - pkg-config
- pygobject
- host:
- python
run:
- python
- gsl
- libiconv
- numpy
- pcre
- pygobject
about:
home: http://repo.or.cz/w/hkl.git
license: GPL-3.0
license_file: COPYING
summary: Diffractometer computation library
doc_url: https://people.debian.org/~picca/hkl/hkl.html
dev_url: http://repo.or.cz/w/hkl.git
extra:
recipe-maintainers:
- mrakitin
- prjemian | 9 | 0.176471 | 4 | 5 |
bff39d5e5c16d031982d8d5317eb7ebeaff0e950 | scripts/create_users.sh | scripts/create_users.sh |
DM_ENVIRONMENT=${1:-local}
. "./scripts/envs/${DM_ENVIRONMENT}.sh"
function create_user {
local email=$1;
local name=$2;
local role=$3;
local password=$4;
read -r -d '' USER_PAYLOAD <<EOF
{
"users": {
"emailAddress": "$email",
"name": "$name",
"role": "$role",
"password": "$password"
}
}
EOF
STATUS_CODE=$(curl -sL -w "%{http_code}" -o /dev/null -X POST -H 'Content-type: application/json' -H "Authorization: Bearer ${DM_API_ACCESS_TOKEN}" -d "${USER_PAYLOAD}" "${DM_API_DOMAIN}/users")
if [ "$STATUS_CODE" == "409" ]; then
echo "Already exists"
elif [ "$STATUS_CODE" == "201" ]; then
echo "Created"
else
echo "ERROR: $STATUS_CODE"
fi
}
create_user "$DM_ADMIN_EMAIL" "Admin" "admin" "$DM_ADMIN_PASSWORD"
create_user "$DM_ADMIN_CCS_SOURCING_EMAIL" "Admin" "admin-ccs-sourcing" "$DM_ADMIN_PASSWORD"
|
DM_ENVIRONMENT=${1:-local}
. "./scripts/envs/${DM_ENVIRONMENT}.sh"
function create_user {
local email=$1;
local name=$2;
local role=$3;
local password=$4;
read -r -d '' USER_PAYLOAD <<EOF
{
"users": {
"emailAddress": "$email",
"name": "$name",
"role": "$role",
"password": "$password"
}
}
EOF
echo -n "Creating admin user $email... "
STATUS_CODE=$(curl -sL -w "%{http_code}" -o /dev/null -X POST -H 'Content-type: application/json' -H "Authorization: Bearer ${DM_API_ACCESS_TOKEN}" -d "${USER_PAYLOAD}" "${DM_API_DOMAIN}/users")
if [ "$STATUS_CODE" == "409" ]; then
echo "Already exists"
elif [ "$STATUS_CODE" == "201" ]; then
echo "Created"
else
echo "ERROR: $STATUS_CODE"
fi
}
create_user "$DM_ADMIN_EMAIL" "Admin" "admin" "$DM_ADMIN_PASSWORD"
create_user "$DM_ADMIN_CCS_SOURCING_EMAIL" "Admin" "admin-ccs-sourcing" "$DM_ADMIN_PASSWORD"
| Add context to user bootstrapping script | Add context to user bootstrapping script
| Shell | mit | alphagov/digitalmarketplace-functional-tests,alphagov/digitalmarketplace-functional-tests,alphagov/digitalmarketplace-functional-tests | shell | ## Code Before:
DM_ENVIRONMENT=${1:-local}
. "./scripts/envs/${DM_ENVIRONMENT}.sh"
function create_user {
local email=$1;
local name=$2;
local role=$3;
local password=$4;
read -r -d '' USER_PAYLOAD <<EOF
{
"users": {
"emailAddress": "$email",
"name": "$name",
"role": "$role",
"password": "$password"
}
}
EOF
STATUS_CODE=$(curl -sL -w "%{http_code}" -o /dev/null -X POST -H 'Content-type: application/json' -H "Authorization: Bearer ${DM_API_ACCESS_TOKEN}" -d "${USER_PAYLOAD}" "${DM_API_DOMAIN}/users")
if [ "$STATUS_CODE" == "409" ]; then
echo "Already exists"
elif [ "$STATUS_CODE" == "201" ]; then
echo "Created"
else
echo "ERROR: $STATUS_CODE"
fi
}
create_user "$DM_ADMIN_EMAIL" "Admin" "admin" "$DM_ADMIN_PASSWORD"
create_user "$DM_ADMIN_CCS_SOURCING_EMAIL" "Admin" "admin-ccs-sourcing" "$DM_ADMIN_PASSWORD"
## Instruction:
Add context to user bootstrapping script
## Code After:
DM_ENVIRONMENT=${1:-local}
. "./scripts/envs/${DM_ENVIRONMENT}.sh"
function create_user {
local email=$1;
local name=$2;
local role=$3;
local password=$4;
read -r -d '' USER_PAYLOAD <<EOF
{
"users": {
"emailAddress": "$email",
"name": "$name",
"role": "$role",
"password": "$password"
}
}
EOF
echo -n "Creating admin user $email... "
STATUS_CODE=$(curl -sL -w "%{http_code}" -o /dev/null -X POST -H 'Content-type: application/json' -H "Authorization: Bearer ${DM_API_ACCESS_TOKEN}" -d "${USER_PAYLOAD}" "${DM_API_DOMAIN}/users")
if [ "$STATUS_CODE" == "409" ]; then
echo "Already exists"
elif [ "$STATUS_CODE" == "201" ]; then
echo "Created"
else
echo "ERROR: $STATUS_CODE"
fi
}
create_user "$DM_ADMIN_EMAIL" "Admin" "admin" "$DM_ADMIN_PASSWORD"
create_user "$DM_ADMIN_CCS_SOURCING_EMAIL" "Admin" "admin-ccs-sourcing" "$DM_ADMIN_PASSWORD"
|
DM_ENVIRONMENT=${1:-local}
. "./scripts/envs/${DM_ENVIRONMENT}.sh"
function create_user {
local email=$1;
local name=$2;
local role=$3;
local password=$4;
read -r -d '' USER_PAYLOAD <<EOF
{
"users": {
"emailAddress": "$email",
"name": "$name",
"role": "$role",
"password": "$password"
}
}
EOF
+ echo -n "Creating admin user $email... "
STATUS_CODE=$(curl -sL -w "%{http_code}" -o /dev/null -X POST -H 'Content-type: application/json' -H "Authorization: Bearer ${DM_API_ACCESS_TOKEN}" -d "${USER_PAYLOAD}" "${DM_API_DOMAIN}/users")
if [ "$STATUS_CODE" == "409" ]; then
echo "Already exists"
elif [ "$STATUS_CODE" == "201" ]; then
echo "Created"
else
echo "ERROR: $STATUS_CODE"
fi
}
create_user "$DM_ADMIN_EMAIL" "Admin" "admin" "$DM_ADMIN_PASSWORD"
create_user "$DM_ADMIN_CCS_SOURCING_EMAIL" "Admin" "admin-ccs-sourcing" "$DM_ADMIN_PASSWORD" | 1 | 0.030303 | 1 | 0 |
cf209d8b1656dff39b3cf90fd2e19b3f4bc0efec | models/specialoffer_model.js | models/specialoffer_model.js | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Schema.Types.ObjectId;
var Mixed = mongoose.Schema.Types.Mixed;
var SpecialofferSchema = new Schema({
name: { type: String, unique: true, index: true, set: toLower },
img: String,
description: String, // Short description
body: String, // Page body
partner: String,
partner_product_id: String,
urlid: { type: String, unique: true, index: true },
date: { type: Date, default: Date.now, required: true, index: true },
start_date: { type: Date, default: Date.now, index: true },
end_date: { type: Date, default: Date.now, index: true },
});
SpecialofferSchema.set("_perms", {
admin: "crud",
user: "cr",
all: "cr"
});
function toLower (v) {
return v.toLowerCase();
}
module.exports = mongoose.model('Specialoffer', SpecialofferSchema); | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Schema.Types.ObjectId;
var Mixed = mongoose.Schema.Types.Mixed;
var Location = require("./location_model");
var SpecialofferSchema = new Schema({
name: { type: String, unique: true, index: true },
img: String,
description: String, // Short description
body: String, // Page body
link: String,
partner: String,
partner_code: String,
locations: [ { type: ObjectId, ref: "Location" } ],
date: { type: Date, default: Date.now, required: true, index: true },
start_date: { type: Date, default: Date.now, index: true },
end_date: { type: Date, default: Date.now, index: true },
});
SpecialofferSchema.set("_perms", {
admin: "crud",
user: "cr",
all: "cr"
});
function toLower (v) {
return v.toLowerCase();
}
module.exports = mongoose.model('Specialoffer', SpecialofferSchema); | Rename some stuff and add locations | Rename some stuff and add locations
| JavaScript | mit | 10layer/jexpress,10layer/jexpress | javascript | ## Code Before:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Schema.Types.ObjectId;
var Mixed = mongoose.Schema.Types.Mixed;
var SpecialofferSchema = new Schema({
name: { type: String, unique: true, index: true, set: toLower },
img: String,
description: String, // Short description
body: String, // Page body
partner: String,
partner_product_id: String,
urlid: { type: String, unique: true, index: true },
date: { type: Date, default: Date.now, required: true, index: true },
start_date: { type: Date, default: Date.now, index: true },
end_date: { type: Date, default: Date.now, index: true },
});
SpecialofferSchema.set("_perms", {
admin: "crud",
user: "cr",
all: "cr"
});
function toLower (v) {
return v.toLowerCase();
}
module.exports = mongoose.model('Specialoffer', SpecialofferSchema);
## Instruction:
Rename some stuff and add locations
## Code After:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Schema.Types.ObjectId;
var Mixed = mongoose.Schema.Types.Mixed;
var Location = require("./location_model");
var SpecialofferSchema = new Schema({
name: { type: String, unique: true, index: true },
img: String,
description: String, // Short description
body: String, // Page body
link: String,
partner: String,
partner_code: String,
locations: [ { type: ObjectId, ref: "Location" } ],
date: { type: Date, default: Date.now, required: true, index: true },
start_date: { type: Date, default: Date.now, index: true },
end_date: { type: Date, default: Date.now, index: true },
});
SpecialofferSchema.set("_perms", {
admin: "crud",
user: "cr",
all: "cr"
});
function toLower (v) {
return v.toLowerCase();
}
module.exports = mongoose.model('Specialoffer', SpecialofferSchema); | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = mongoose.Schema.Types.ObjectId;
var Mixed = mongoose.Schema.Types.Mixed;
+ var Location = require("./location_model");
+
var SpecialofferSchema = new Schema({
- name: { type: String, unique: true, index: true, set: toLower },
? --------------
+ name: { type: String, unique: true, index: true },
img: String,
description: String, // Short description
body: String, // Page body
+ link: String,
partner: String,
- partner_product_id: String,
? ^^ ^^^^^^
+ partner_code: String,
? ^ ^
- urlid: { type: String, unique: true, index: true },
+ locations: [ { type: ObjectId, ref: "Location" } ],
date: { type: Date, default: Date.now, required: true, index: true },
start_date: { type: Date, default: Date.now, index: true },
end_date: { type: Date, default: Date.now, index: true },
});
SpecialofferSchema.set("_perms", {
admin: "crud",
user: "cr",
all: "cr"
});
function toLower (v) {
return v.toLowerCase();
}
module.exports = mongoose.model('Specialoffer', SpecialofferSchema); | 9 | 0.3 | 6 | 3 |
38ce2b409cd71928c9028cd9a0fc5be22c21f90f | src/algs/sorting/selection.rb | src/algs/sorting/selection.rb | module Algorithms
module Sorting
class Selection
def sort(array)
for index in 0..(array.size - 2)
min_index = array.find_index(array.slice(index, array.size - index).min)
array = swap(array, index, min_index)
end
array
end
def swap(array, index1, index2)
# Logging events...
puts "Swapping values #{array[index1]} (curr) and #{array[index2]} (min)..."
tmp = array[index1]
array[index1] = array[index2]
array[index2] = tmp
array
end
end
end
end
| module Algorithms
module Sorting
class Selection
def sort(array)
for index in 0..(array.size - 2)
min_index = array.find_index(array.slice(index, array.size - index).min)
array = swap(array, index, min_index) unless min_index == index
end
array
end
def swap(array, index1, index2)
# Logging events...
puts "Swapping values #{array[index1]} (curr) and #{array[index2]} (min)..."
tmp = array[index1]
array[index1] = array[index2]
array[index2] = tmp
array
end
end
end
end
| Add a very (not really) important check. | Add a very (not really) important check.
| Ruby | mit | bound1ess/cs,bound1ess/cs | ruby | ## Code Before:
module Algorithms
module Sorting
class Selection
def sort(array)
for index in 0..(array.size - 2)
min_index = array.find_index(array.slice(index, array.size - index).min)
array = swap(array, index, min_index)
end
array
end
def swap(array, index1, index2)
# Logging events...
puts "Swapping values #{array[index1]} (curr) and #{array[index2]} (min)..."
tmp = array[index1]
array[index1] = array[index2]
array[index2] = tmp
array
end
end
end
end
## Instruction:
Add a very (not really) important check.
## Code After:
module Algorithms
module Sorting
class Selection
def sort(array)
for index in 0..(array.size - 2)
min_index = array.find_index(array.slice(index, array.size - index).min)
array = swap(array, index, min_index) unless min_index == index
end
array
end
def swap(array, index1, index2)
# Logging events...
puts "Swapping values #{array[index1]} (curr) and #{array[index2]} (min)..."
tmp = array[index1]
array[index1] = array[index2]
array[index2] = tmp
array
end
end
end
end
| module Algorithms
module Sorting
class Selection
def sort(array)
for index in 0..(array.size - 2)
min_index = array.find_index(array.slice(index, array.size - index).min)
- array = swap(array, index, min_index)
+ array = swap(array, index, min_index) unless min_index == index
? ++++++++++++++++++++++++++
end
array
end
def swap(array, index1, index2)
# Logging events...
puts "Swapping values #{array[index1]} (curr) and #{array[index2]} (min)..."
tmp = array[index1]
array[index1] = array[index2]
array[index2] = tmp
array
end
end
end
end | 2 | 0.074074 | 1 | 1 |
7e025a5fa40d5f7ba5721ad01951ad2020ed2485 | phoxpy/tests/test_client.py | phoxpy/tests/test_client.py |
import unittest
from phoxpy import client
from phoxpy.tests.lisserver import MockHttpSession
class SessionTestCase(unittest.TestCase):
def test_login(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession())
self.assertTrue(session.is_active())
def test_logout(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession())
self.assertTrue(session.is_active())
session.close()
self.assertFalse(session.is_active())
if __name__ == '__main__':
unittest.main()
|
import unittest
from phoxpy import client
from phoxpy.server import MockHttpSession, SimpleLISServer
class SessionTestCase(unittest.TestCase):
def setUp(self):
self.server = SimpleLISServer('4.2', '31415')
self.server.ext_auth.add_license('foo-bar-baz')
self.server.ext_auth.add_user('John', 'Doe')
def test_login(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession(self.server))
self.assertTrue(session.is_active())
def test_logout(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession(self.server))
self.assertTrue(session.is_active())
session.close()
self.assertFalse(session.is_active())
if __name__ == '__main__':
unittest.main()
| Update tests for new environment. | Update tests for new environment.
| Python | bsd-3-clause | kxepal/phoxpy | python | ## Code Before:
import unittest
from phoxpy import client
from phoxpy.tests.lisserver import MockHttpSession
class SessionTestCase(unittest.TestCase):
def test_login(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession())
self.assertTrue(session.is_active())
def test_logout(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession())
self.assertTrue(session.is_active())
session.close()
self.assertFalse(session.is_active())
if __name__ == '__main__':
unittest.main()
## Instruction:
Update tests for new environment.
## Code After:
import unittest
from phoxpy import client
from phoxpy.server import MockHttpSession, SimpleLISServer
class SessionTestCase(unittest.TestCase):
def setUp(self):
self.server = SimpleLISServer('4.2', '31415')
self.server.ext_auth.add_license('foo-bar-baz')
self.server.ext_auth.add_user('John', 'Doe')
def test_login(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession(self.server))
self.assertTrue(session.is_active())
def test_logout(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
session.open('localhost', http_session=MockHttpSession(self.server))
self.assertTrue(session.is_active())
session.close()
self.assertFalse(session.is_active())
if __name__ == '__main__':
unittest.main()
|
import unittest
from phoxpy import client
- from phoxpy.tests.lisserver import MockHttpSession
? ---------
+ from phoxpy.server import MockHttpSession, SimpleLISServer
? +++++++++++++++++
+
class SessionTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.server = SimpleLISServer('4.2', '31415')
+ self.server.ext_auth.add_license('foo-bar-baz')
+ self.server.ext_auth.add_user('John', 'Doe')
def test_login(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
- session.open('localhost', http_session=MockHttpSession())
+ session.open('localhost', http_session=MockHttpSession(self.server))
? +++++++++++
self.assertTrue(session.is_active())
def test_logout(self):
session = client.Session(login='John', password='Doe',
client_id='foo-bar-baz')
self.assertFalse(session.is_active())
- session.open('localhost', http_session=MockHttpSession())
+ session.open('localhost', http_session=MockHttpSession(self.server))
? +++++++++++
self.assertTrue(session.is_active())
session.close()
self.assertFalse(session.is_active())
if __name__ == '__main__':
unittest.main() | 12 | 0.461538 | 9 | 3 |
9d71d41d959401774046f4acabf4875740912a59 | lib/metrics_satellite/filer.rb | lib/metrics_satellite/filer.rb | require "date"
require "pathname"
require "active_support/core_ext/string/inflections"
module MetricsSatellite
module Filer
EXT = "txt"
private
def pathname
Pathname.new(filepath)
end
def filepath
"#{directory}/#{filename}"
end
def directory
Pathname.new(reports).join(name)
end
def create_directory
FileUtils.mkdir_p(directory)
end
def filename
"#{date}.#{ext}"
end
def date
Date.today.strftime("%Y-%m-%d")
end
def file
File.open(filepath, "w")
end
def name
self.class.to_s.split("::").last.
gsub(/Summarizer$|Collector$/, "").underscore
end
def ext
self.class::EXT
end
def reports
options[:reports] || "reports"
end
end
end
| require "date"
require "pathname"
require "active_support/core_ext/string/inflections"
module MetricsSatellite
module Filer
EXT = "txt"
private
def pathname
Pathname.new(filepath)
end
def filepath
"#{directory}/#{filename}"
end
def directory
Pathname.new(reports).join(name)
end
def create_directory
FileUtils.mkdir_p(directory)
end
def filename
"#{date}.#{ext}"
end
def date
Date.today.strftime("%Y-%m-%d")
end
def file
File.open(filepath, "w")
end
def name
single_class_name.gsub(/Summarizer$|Collector$/, "").underscore
end
def single_class_name
self.class.to_s.split("::").last
end
def ext
self.class::EXT
end
def reports
options[:reports] || "reports"
end
end
end
| Refactor big method by separating | Refactor big method by separating
| Ruby | mit | r7kamura/metrics_satellite | ruby | ## Code Before:
require "date"
require "pathname"
require "active_support/core_ext/string/inflections"
module MetricsSatellite
module Filer
EXT = "txt"
private
def pathname
Pathname.new(filepath)
end
def filepath
"#{directory}/#{filename}"
end
def directory
Pathname.new(reports).join(name)
end
def create_directory
FileUtils.mkdir_p(directory)
end
def filename
"#{date}.#{ext}"
end
def date
Date.today.strftime("%Y-%m-%d")
end
def file
File.open(filepath, "w")
end
def name
self.class.to_s.split("::").last.
gsub(/Summarizer$|Collector$/, "").underscore
end
def ext
self.class::EXT
end
def reports
options[:reports] || "reports"
end
end
end
## Instruction:
Refactor big method by separating
## Code After:
require "date"
require "pathname"
require "active_support/core_ext/string/inflections"
module MetricsSatellite
module Filer
EXT = "txt"
private
def pathname
Pathname.new(filepath)
end
def filepath
"#{directory}/#{filename}"
end
def directory
Pathname.new(reports).join(name)
end
def create_directory
FileUtils.mkdir_p(directory)
end
def filename
"#{date}.#{ext}"
end
def date
Date.today.strftime("%Y-%m-%d")
end
def file
File.open(filepath, "w")
end
def name
single_class_name.gsub(/Summarizer$|Collector$/, "").underscore
end
def single_class_name
self.class.to_s.split("::").last
end
def ext
self.class::EXT
end
def reports
options[:reports] || "reports"
end
end
end
| require "date"
require "pathname"
require "active_support/core_ext/string/inflections"
module MetricsSatellite
module Filer
EXT = "txt"
private
def pathname
Pathname.new(filepath)
end
def filepath
"#{directory}/#{filename}"
end
def directory
Pathname.new(reports).join(name)
end
def create_directory
FileUtils.mkdir_p(directory)
end
def filename
"#{date}.#{ext}"
end
def date
Date.today.strftime("%Y-%m-%d")
end
def file
File.open(filepath, "w")
end
def name
+ single_class_name.gsub(/Summarizer$|Collector$/, "").underscore
+ end
+
+ def single_class_name
- self.class.to_s.split("::").last.
? -
+ self.class.to_s.split("::").last
- gsub(/Summarizer$|Collector$/, "").underscore
end
def ext
self.class::EXT
end
def reports
options[:reports] || "reports"
end
end
end | 7 | 0.134615 | 5 | 2 |
f18a24f0ac96d2cafffc7dbf08bb644d5243a421 | app/views/doorkeeper/applications/_form.html.haml | app/views/doorkeeper/applications/_form.html.haml | = form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
- if application.errors.any?
.alert.alert-danger{"data-alert" => ""}
%p Whoops! Check your form for possible errors
= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do
= f.label :name, class: 'col-sm-2 control-label'
.col-sm-10
= f.text_field :name, class: 'form-control'
= doorkeeper_errors_for application, :name
= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do
= f.label :redirect_uri, class: 'col-sm-2 control-label'
.col-sm-10
= f.text_area :redirect_uri, class: 'form-control'
= doorkeeper_errors_for application, :redirect_uri
%span.help-block
Use one line per URI
- if Doorkeeper.configuration.native_redirect_uri
%span.help-block
Use
%code= Doorkeeper.configuration.native_redirect_uri
for local tests
.form-actions
= f.submit 'Submit', class: "btn btn-primary wide"
= link_to "Cancel", applications_profile_path, class: "btn btn-default"
| = form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
- if application.errors.any?
.alert.alert-danger
%ul
- application.errors.full_messages.each do |msg|
%li= msg
.form-group
= f.label :name, class: 'control-label'
.col-sm-10
= f.text_field :name, class: 'form-control', required: true
.form-group
= f.label :redirect_uri, class: 'control-label'
.col-sm-10
= f.text_area :redirect_uri, class: 'form-control', required: true
%span.help-block
Use one line per URI
- if Doorkeeper.configuration.native_redirect_uri
%span.help-block
Use
%code= Doorkeeper.configuration.native_redirect_uri
for local tests
.form-actions
= f.submit 'Submit', class: "btn btn-primary wide"
= link_to "Cancel", applications_profile_path, class: "btn btn-default"
| Fix layout issue when New Application validation fails. | Fix layout issue when New Application validation fails.
| Haml | mit | dvrylc/gitlabhq,yama07/gitlabhq,bbodenmiller/gitlabhq,ttasanen/gitlabhq,hq804116393/gitlabhq,fantasywind/gitlabhq,michaKFromParis/gitlabhqold,LytayTOUCH/gitlabhq,folpindo/gitlabhq,williamherry/gitlabhq,yonglehou/gitlabhq,mmkassem/gitlabhq,sakishum/gitlabhq,salipro4ever/gitlabhq,louahola/gitlabhq,sue445/gitlabhq,mente/gitlabhq,iiet/iiet-git,Burick/gitlabhq,chadyred/gitlabhq,fantasywind/gitlabhq,bozaro/gitlabhq,gorgee/gitlabhq,OtkurBiz/gitlabhq,ikappas/gitlabhq,luzhongyang/gitlabhq,Exeia/gitlabhq,folpindo/gitlabhq,dplarson/gitlabhq,flashbuckets/gitlabhq,openwide-java/gitlabhq,Datacom/gitlabhq,mr-dxdy/gitlabhq,k4zzk/gitlabhq,MauriceMohlek/gitlabhq,Datacom/gitlabhq,michaKFromParis/gitlabhq,SVArago/gitlabhq,hq804116393/gitlabhq,stanhu/gitlabhq,OtkurBiz/gitlabhq,cui-liqiang/gitlab-ce,fearenales/gitlabhq,Soullivaneuh/gitlabhq,yatish27/gitlabhq,ksoichiro/gitlabhq,OlegGirko/gitlab-ce,folpindo/gitlabhq,johnmyqin/gitlabhq,kemenaran/gitlabhq,pulkit21/gitlabhq,martinma4/gitlabhq,stanhu/gitlabhq,Telekom-PD/gitlabhq,tim-hoff/gitlabhq,tempbottle/gitlabhq,zBMNForks/gitlabhq,jirutka/gitlabhq,fantasywind/gitlabhq,Burick/gitlabhq,cui-liqiang/gitlab-ce,duduribeiro/gitlabhq,jaepyoung/gitlabhq,axilleas/gitlabhq,WSDC-NITWarangal/gitlabhq,t-zuehlsdorff/gitlabhq,szechyjs/gitlabhq,duduribeiro/gitlabhq,williamherry/gitlabhq,vjustov/gitlabhq,rumpelsepp/gitlabhq,fgbreel/gitlabhq,nmav/gitlabhq,aaronsnyder/gitlabhq,t-zuehlsdorff/gitlabhq,michaKFromParis/gitlabhqold,michaKFromParis/gitlabhqold,williamherry/gitlabhq,t-zuehlsdorff/gitlabhq,mr-dxdy/gitlabhq,allysonbarros/gitlabhq,dukex/gitlabhq,allysonbarros/gitlabhq,koreamic/gitlabhq,hq804116393/gitlabhq,iiet/iiet-git,jvanbaarsen/gitlabhq,nguyen-tien-mulodo/gitlabhq,yonglehou/gitlabhq,bozaro/gitlabhq,fendoudeqingchunhh/gitlabhq,axilleas/gitlabhq,wangcan2014/gitlabhq,kemenaran/gitlabhq,delkyd/gitlabhq,screenpages/gitlabhq,salipro4ever/gitlabhq,martijnvermaat/gitlabhq,joalmeid/gitlabhq,louahola/gitlabhq,joalmeid/gitlabhq,bigsurge/gitlabhq,yfaizal/gitlabhq,sakishum/gitlabhq,chadyred/gitlabhq,darkrasid/gitlabhq,stanhu/gitlabhq,ksoichiro/gitlabhq,TheWatcher/gitlabhq,folpindo/gitlabhq,wangcan2014/gitlabhq,whluwit/gitlabhq,johnmyqin/gitlabhq,koreamic/gitlabhq,fscherwi/gitlabhq,sonalkr132/gitlabhq,manfer/gitlabhq,H3Chief/gitlabhq,SVArago/gitlabhq,mente/gitlabhq,rebecamendez/gitlabhq,kitech/gitlabhq,shinexiao/gitlabhq,jrjang/gitlab-ce,Datacom/gitlabhq,daiyu/gitlab-zh,stanhu/gitlabhq,eliasp/gitlabhq,hq804116393/gitlabhq,openwide-java/gitlabhq,OlegGirko/gitlab-ce,liyakun/gitlabhq,since2014/gitlabhq,dwrensha/gitlabhq,ferdinandrosario/gitlabhq,hzy001/gitlabhq,jaepyoung/gitlabhq,nguyen-tien-mulodo/gitlabhq,luzhongyang/gitlabhq,youprofit/gitlabhq,Tyrael/gitlabhq,manfer/gitlabhq,larryli/gitlabhq,openwide-java/gitlabhq,salipro4ever/gitlabhq,allistera/gitlabhq,pjknkda/gitlabhq,DanielZhangQingLong/gitlabhq,manfer/gitlabhq,sakishum/gitlabhq,liyakun/gitlabhq,ksoichiro/gitlabhq,Tyrael/gitlabhq,Burick/gitlabhq,fscherwi/gitlabhq,youprofit/gitlabhq,martinma4/gitlabhq,Telekom-PD/gitlabhq,ferdinandrosario/gitlabhq,gorgee/gitlabhq,mrb/gitlabhq,bbodenmiller/gitlabhq,Telekom-PD/gitlabhq,sakishum/gitlabhq,TheWatcher/gitlabhq,Soullivaneuh/gitlabhq,gorgee/gitlabhq,hzy001/gitlabhq,koreamic/gitlabhq,rebecamendez/gitlabhq,zrbsprite/gitlabhq,Datacom/gitlabhq,k4zzk/gitlabhq,cui-liqiang/gitlab-ce,liyakun/gitlabhq,aaronsnyder/gitlabhq,whluwit/gitlabhq,fgbreel/gitlabhq,axilleas/gitlabhq,michaKFromParis/sparkslab,jrjang/gitlabhq,gopeter/gitlabhq,sonalkr132/gitlabhq,chenrui2014/gitlabhq,julianengel/gitlabhq,johnmyqin/gitlabhq,jirutka/gitlabhq,tk23/gitlabhq,fpgentil/gitlabhq,larryli/gitlabhq,LUMC/gitlabhq,Tyrael/gitlabhq,revaret/gitlabhq,t-zuehlsdorff/gitlabhq,Telekom-PD/gitlabhq,screenpages/gitlabhq,LUMC/gitlabhq,stoplightio/gitlabhq,ttasanen/gitlabhq,fantasywind/gitlabhq,eliasp/gitlabhq,yfaizal/gitlabhq,ayufan/gitlabhq,aaronsnyder/gitlabhq,Exeia/gitlabhq,cinderblock/gitlabhq,zrbsprite/gitlabhq,ferdinandrosario/gitlabhq,initiummedia/gitlabhq,chadyred/gitlabhq,icedwater/gitlabhq,rumpelsepp/gitlabhq,lvfeng1130/gitlabhq,youprofit/gitlabhq,eliasp/gitlabhq,Razer6/gitlabhq,wangcan2014/gitlabhq,kitech/gitlabhq,revaret/gitlabhq,ordiychen/gitlabhq,darkrasid/gitlabhq,michaKFromParis/sparkslab,mmkassem/gitlabhq,fendoudeqingchunhh/gitlabhq,Razer6/gitlabhq,bigsurge/gitlabhq,joalmeid/gitlabhq,tk23/gitlabhq,jrjang/gitlabhq,Tyrael/gitlabhq,delkyd/gitlabhq,htve/GitlabForChinese,dwrensha/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,yatish27/gitlabhq,rumpelsepp/gitlabhq,hacsoc/gitlabhq,pulkit21/gitlabhq,NKMR6194/gitlabhq,tk23/gitlabhq,szechyjs/gitlabhq,revaret/gitlabhq,Razer6/gitlabhq,aaronsnyder/gitlabhq,chenrui2014/gitlabhq,ngpestelos/gitlabhq,martinma4/gitlabhq,zBMNForks/gitlabhq,bozaro/gitlabhq,LytayTOUCH/gitlabhq,iiet/iiet-git,fscherwi/gitlabhq,larryli/gitlabhq,chadyred/gitlabhq,sue445/gitlabhq,Burick/gitlabhq,it33/gitlabhq,htve/GitlabForChinese,kitech/gitlabhq,hacsoc/gitlabhq,ayufan/gitlabhq,jirutka/gitlabhq,fpgentil/gitlabhq,vjustov/gitlabhq,julianengel/gitlabhq,tempbottle/gitlabhq,williamherry/gitlabhq,mrb/gitlabhq,kitech/gitlabhq,rumpelsepp/gitlabhq,joalmeid/gitlabhq,jaepyoung/gitlabhq,ngpestelos/gitlabhq,dukex/gitlabhq,OtkurBiz/gitlabhq,duduribeiro/gitlabhq,luzhongyang/gitlabhq,k4zzk/gitlabhq,dplarson/gitlabhq,shinexiao/gitlabhq,ksoichiro/gitlabhq,lvfeng1130/gitlabhq,initiummedia/gitlabhq,gopeter/gitlabhq,daiyu/gitlab-zh,szechyjs/gitlabhq,julianengel/gitlabhq,mmkassem/gitlabhq,ayufan/gitlabhq,nguyen-tien-mulodo/gitlabhq,revaret/gitlabhq,NKMR6194/gitlabhq,TheWatcher/gitlabhq,ttasanen/gitlabhq,WSDC-NITWarangal/gitlabhq,nmav/gitlabhq,fearenales/gitlabhq,mente/gitlabhq,jaepyoung/gitlabhq,gopeter/gitlabhq,hacsoc/gitlabhq,sue445/gitlabhq,shinexiao/gitlabhq,yama07/gitlabhq,since2014/gitlabhq,kemenaran/gitlabhq,rebecamendez/gitlabhq,eliasp/gitlabhq,dwrensha/gitlabhq,daiyu/gitlab-zh,yatish27/gitlabhq,martinma4/gitlabhq,darkrasid/gitlabhq,dplarson/gitlabhq,fpgentil/gitlabhq,sekcheong/gitlabhq,theonlydoo/gitlabhq,WSDC-NITWarangal/gitlabhq,allistera/gitlabhq,hzy001/gitlabhq,sekcheong/gitlabhq,mr-dxdy/gitlabhq,fgbreel/gitlabhq,lvfeng1130/gitlabhq,michaKFromParis/gitlabhq,hacsoc/gitlabhq,martijnvermaat/gitlabhq,fscherwi/gitlabhq,sonalkr132/gitlabhq,liyakun/gitlabhq,copystudy/gitlabhq,cinderblock/gitlabhq,MauriceMohlek/gitlabhq,zrbsprite/gitlabhq,it33/gitlabhq,tim-hoff/gitlabhq,jrjang/gitlab-ce,louahola/gitlabhq,tk23/gitlabhq,martijnvermaat/gitlabhq,jrjang/gitlabhq,Devin001/gitlabhq,allistera/gitlabhq,youprofit/gitlabhq,fpgentil/gitlabhq,jvanbaarsen/gitlabhq,sonalkr132/gitlabhq,ordiychen/gitlabhq,fendoudeqingchunhh/gitlabhq,martijnvermaat/gitlabhq,tim-hoff/gitlabhq,darkrasid/gitlabhq,louahola/gitlabhq,SVArago/gitlabhq,larryli/gitlabhq,OtkurBiz/gitlabhq,pjknkda/gitlabhq,michaKFromParis/gitlabhqold,duduribeiro/gitlabhq,bbodenmiller/gitlabhq,screenpages/gitlabhq,tim-hoff/gitlabhq,mrb/gitlabhq,Devin001/gitlabhq,NKMR6194/gitlabhq,copystudy/gitlabhq,cui-liqiang/gitlab-ce,DanielZhangQingLong/gitlabhq,vjustov/gitlabhq,fearenales/gitlabhq,H3Chief/gitlabhq,H3Chief/gitlabhq,Soullivaneuh/gitlabhq,rebecamendez/gitlabhq,johnmyqin/gitlabhq,bigsurge/gitlabhq,bbodenmiller/gitlabhq,allistera/gitlabhq,gorgee/gitlabhq,dvrylc/gitlabhq,dukex/gitlabhq,ikappas/gitlabhq,nguyen-tien-mulodo/gitlabhq,Devin001/gitlabhq,ngpestelos/gitlabhq,kemenaran/gitlabhq,ordiychen/gitlabhq,sekcheong/gitlabhq,zBMNForks/gitlabhq,tempbottle/gitlabhq,jirutka/gitlabhq,screenpages/gitlabhq,DanielZhangQingLong/gitlabhq,whluwit/gitlabhq,TheWatcher/gitlabhq,ferdinandrosario/gitlabhq,yonglehou/gitlabhq,fearenales/gitlabhq,manfer/gitlabhq,michaKFromParis/sparkslab,dwrensha/gitlabhq,MauriceMohlek/gitlabhq,bigsurge/gitlabhq,bozaro/gitlabhq,dvrylc/gitlabhq,dreampet/gitlab,luzhongyang/gitlabhq,shinexiao/gitlabhq,delkyd/gitlabhq,ayufan/gitlabhq,jvanbaarsen/gitlabhq,H3Chief/gitlabhq,pjknkda/gitlabhq,LUMC/gitlabhq,SVArago/gitlabhq,flashbuckets/gitlabhq,jvanbaarsen/gitlabhq,yatish27/gitlabhq,initiummedia/gitlabhq,zBMNForks/gitlabhq,zrbsprite/gitlabhq,theonlydoo/gitlabhq,salipro4ever/gitlabhq,dreampet/gitlab,axilleas/gitlabhq,hzy001/gitlabhq,yama07/gitlabhq,openwide-java/gitlabhq,it33/gitlabhq,iiet/iiet-git,ngpestelos/gitlabhq,tempbottle/gitlabhq,it33/gitlabhq,ikappas/gitlabhq,fendoudeqingchunhh/gitlabhq,sekcheong/gitlabhq,since2014/gitlabhq,OlegGirko/gitlab-ce,fgbreel/gitlabhq,DanielZhangQingLong/gitlabhq,stoplightio/gitlabhq,mente/gitlabhq,pulkit21/gitlabhq,jrjang/gitlab-ce,NKMR6194/gitlabhq,julianengel/gitlabhq,OlegGirko/gitlab-ce,dreampet/gitlab,mr-dxdy/gitlabhq,gopeter/gitlabhq,chenrui2014/gitlabhq,icedwater/gitlabhq,ikappas/gitlabhq,yonglehou/gitlabhq,Soullivaneuh/gitlabhq,whluwit/gitlabhq,htve/GitlabForChinese,jrjang/gitlab-ce,icedwater/gitlabhq,yfaizal/gitlabhq,LUMC/gitlabhq,theonlydoo/gitlabhq,sue445/gitlabhq,flashbuckets/gitlabhq,dreampet/gitlab,WSDC-NITWarangal/gitlabhq,copystudy/gitlabhq,Exeia/gitlabhq,Devin001/gitlabhq,pulkit21/gitlabhq,LytayTOUCH/gitlabhq,koreamic/gitlabhq,Razer6/gitlabhq,daiyu/gitlab-zh,chenrui2014/gitlabhq,allysonbarros/gitlabhq,nmav/gitlabhq,htve/GitlabForChinese,jrjang/gitlabhq,dukex/gitlabhq,michaKFromParis/gitlabhq,theonlydoo/gitlabhq,flashbuckets/gitlabhq,allysonbarros/gitlabhq,Exeia/gitlabhq,yama07/gitlabhq,pjknkda/gitlabhq,szechyjs/gitlabhq,mrb/gitlabhq,cinderblock/gitlabhq,wangcan2014/gitlabhq,icedwater/gitlabhq,michaKFromParis/gitlabhq,dvrylc/gitlabhq,yfaizal/gitlabhq,MauriceMohlek/gitlabhq,dplarson/gitlabhq,cinderblock/gitlabhq,k4zzk/gitlabhq,ttasanen/gitlabhq,michaKFromParis/sparkslab,LytayTOUCH/gitlabhq,since2014/gitlabhq,ordiychen/gitlabhq,lvfeng1130/gitlabhq,nmav/gitlabhq,copystudy/gitlabhq,delkyd/gitlabhq,vjustov/gitlabhq,initiummedia/gitlabhq | haml | ## Code Before:
= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
- if application.errors.any?
.alert.alert-danger{"data-alert" => ""}
%p Whoops! Check your form for possible errors
= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do
= f.label :name, class: 'col-sm-2 control-label'
.col-sm-10
= f.text_field :name, class: 'form-control'
= doorkeeper_errors_for application, :name
= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do
= f.label :redirect_uri, class: 'col-sm-2 control-label'
.col-sm-10
= f.text_area :redirect_uri, class: 'form-control'
= doorkeeper_errors_for application, :redirect_uri
%span.help-block
Use one line per URI
- if Doorkeeper.configuration.native_redirect_uri
%span.help-block
Use
%code= Doorkeeper.configuration.native_redirect_uri
for local tests
.form-actions
= f.submit 'Submit', class: "btn btn-primary wide"
= link_to "Cancel", applications_profile_path, class: "btn btn-default"
## Instruction:
Fix layout issue when New Application validation fails.
## Code After:
= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
- if application.errors.any?
.alert.alert-danger
%ul
- application.errors.full_messages.each do |msg|
%li= msg
.form-group
= f.label :name, class: 'control-label'
.col-sm-10
= f.text_field :name, class: 'form-control', required: true
.form-group
= f.label :redirect_uri, class: 'control-label'
.col-sm-10
= f.text_area :redirect_uri, class: 'form-control', required: true
%span.help-block
Use one line per URI
- if Doorkeeper.configuration.native_redirect_uri
%span.help-block
Use
%code= Doorkeeper.configuration.native_redirect_uri
for local tests
.form-actions
= f.submit 'Submit', class: "btn btn-primary wide"
= link_to "Cancel", applications_profile_path, class: "btn btn-default"
| = form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
- if application.errors.any?
- .alert.alert-danger{"data-alert" => ""}
- %p Whoops! Check your form for possible errors
- = content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do
+ .alert.alert-danger
+ %ul
+ - application.errors.full_messages.each do |msg|
+ %li= msg
+
+ .form-group
- = f.label :name, class: 'col-sm-2 control-label'
? ---------
+ = f.label :name, class: 'control-label'
+
.col-sm-10
- = f.text_field :name, class: 'form-control'
+ = f.text_field :name, class: 'form-control', required: true
? ++++++++++++++++
- = doorkeeper_errors_for application, :name
- = content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do
+
+ .form-group
- = f.label :redirect_uri, class: 'col-sm-2 control-label'
? ---------
+ = f.label :redirect_uri, class: 'control-label'
+
.col-sm-10
- = f.text_area :redirect_uri, class: 'form-control'
+ = f.text_area :redirect_uri, class: 'form-control', required: true
? ++++++++++++++++
- = doorkeeper_errors_for application, :redirect_uri
+
%span.help-block
Use one line per URI
- if Doorkeeper.configuration.native_redirect_uri
%span.help-block
Use
%code= Doorkeeper.configuration.native_redirect_uri
for local tests
.form-actions
= f.submit 'Submit', class: "btn btn-primary wide"
= link_to "Cancel", applications_profile_path, class: "btn btn-default" | 25 | 1.041667 | 15 | 10 |
eb142f31cf6a3eb5e3485822789237bd65341d1c | README.md | README.md | The SensorWeb frontend.
| The front-end module of [SensorWeb](https://wiki.mozilla.org/SensorWeb).
## Maintainers
* [Evan Tseng](http://github.com/evanxd)
* [Steve Chung](https://github.com/steveck-chung)
* [Mark Liang](https://github.com/youwenliang)
## Visual Designer
* [Peko Chen](mailto:pchen@mozilla.com)
| Add contact info of maintainers and visual designer | Add contact info of maintainers and visual designer
| Markdown | mit | evanxd/sensorweb-frontend,evanxd/sensorweb-frontend,sensor-web/sensorweb-frontend,sensor-web/sensorweb-frontend | markdown | ## Code Before:
The SensorWeb frontend.
## Instruction:
Add contact info of maintainers and visual designer
## Code After:
The front-end module of [SensorWeb](https://wiki.mozilla.org/SensorWeb).
## Maintainers
* [Evan Tseng](http://github.com/evanxd)
* [Steve Chung](https://github.com/steveck-chung)
* [Mark Liang](https://github.com/youwenliang)
## Visual Designer
* [Peko Chen](mailto:pchen@mozilla.com)
| - The SensorWeb frontend.
+ The front-end module of [SensorWeb](https://wiki.mozilla.org/SensorWeb).
+
+ ## Maintainers
+ * [Evan Tseng](http://github.com/evanxd)
+ * [Steve Chung](https://github.com/steveck-chung)
+ * [Mark Liang](https://github.com/youwenliang)
+
+ ## Visual Designer
+ * [Peko Chen](mailto:pchen@mozilla.com) | 10 | 10 | 9 | 1 |
c787919f4b4d4c13f787560ebd38c58f0ab39253 | composer.json | composer.json | {
"name": "stevenmaguire/zurb-foundation-laravel",
"description": "Build HTML form elements for Foundation 4 inside Laravel 4",
"authors": [
{
"name": "Steven Maguire",
"email": "steven@stevenmaguire.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.0.*",
"illuminate/session": "4.0.*",
"illuminate/html": "4.0.*"
},
"require-dev": {
"mockery/mockery": ">=0.8.0",
"illuminate/routing": "4.0.*",
"illuminate/translation": "4.0.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Stevenmaguire\\Foundation": "src/"
}
},
"minimum-stability": "dev"
}
| {
"name": "stevenmaguire/zurb-foundation-laravel",
"description": "Build HTML form elements for Foundation 4 inside Laravel 4",
"authors": [
{
"name": "Steven Maguire",
"email": "steven@stevenmaguire.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.1.*",
"illuminate/session": "4.1.*",
"illuminate/html": "4.1.*"
},
"require-dev": {
"mockery/mockery": ">=0.8.0",
"illuminate/routing": "4.1.*",
"illuminate/translation": "4.1.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Stevenmaguire\\Foundation": "src/"
}
},
"minimum-stability": "dev"
}
| Update dependencies for Laravel 4.1 | Update dependencies for Laravel 4.1
| JSON | mit | stevenmaguire/zurb-foundation-laravel | json | ## Code Before:
{
"name": "stevenmaguire/zurb-foundation-laravel",
"description": "Build HTML form elements for Foundation 4 inside Laravel 4",
"authors": [
{
"name": "Steven Maguire",
"email": "steven@stevenmaguire.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.0.*",
"illuminate/session": "4.0.*",
"illuminate/html": "4.0.*"
},
"require-dev": {
"mockery/mockery": ">=0.8.0",
"illuminate/routing": "4.0.*",
"illuminate/translation": "4.0.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Stevenmaguire\\Foundation": "src/"
}
},
"minimum-stability": "dev"
}
## Instruction:
Update dependencies for Laravel 4.1
## Code After:
{
"name": "stevenmaguire/zurb-foundation-laravel",
"description": "Build HTML form elements for Foundation 4 inside Laravel 4",
"authors": [
{
"name": "Steven Maguire",
"email": "steven@stevenmaguire.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.1.*",
"illuminate/session": "4.1.*",
"illuminate/html": "4.1.*"
},
"require-dev": {
"mockery/mockery": ">=0.8.0",
"illuminate/routing": "4.1.*",
"illuminate/translation": "4.1.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Stevenmaguire\\Foundation": "src/"
}
},
"minimum-stability": "dev"
}
| {
"name": "stevenmaguire/zurb-foundation-laravel",
"description": "Build HTML form elements for Foundation 4 inside Laravel 4",
"authors": [
{
"name": "Steven Maguire",
"email": "steven@stevenmaguire.com"
}
],
"require": {
"php": ">=5.4.0",
- "illuminate/support": "4.0.*",
? ^
+ "illuminate/support": "4.1.*",
? ^
- "illuminate/session": "4.0.*",
? ^ --------
+ "illuminate/session": "4.1.*",
? ^
- "illuminate/html": "4.0.*"
? ^
+ "illuminate/html": "4.1.*"
? ^
},
"require-dev": {
"mockery/mockery": ">=0.8.0",
- "illuminate/routing": "4.0.*",
? ^
+ "illuminate/routing": "4.1.*",
? ^
- "illuminate/translation": "4.0.*",
? ^
+ "illuminate/translation": "4.1.*",
? ^
"satooshi/php-coveralls": "dev-master"
},
- "autoload": {
? --------
+ "autoload": {
"psr-0": {
"Stevenmaguire\\Foundation": "src/"
}
},
"minimum-stability": "dev"
} | 12 | 0.428571 | 6 | 6 |
e9135218d5b118200b85aa758943fb18c0668e85 | db/seeds.rb | db/seeds.rb | unless ENV.key?("RUNNING_IN_CI")
# See app/tasks/seed_database
ImportOrganisations.new.call
SeedDatabase.instance.run
end
| unless ENV.key?("RUNNING_IN_CI")
# See app/tasks/seed_database
SeedDatabase.instance.run
end
| Remove import organisations from db:seed | Remove import organisations from db:seed
ImportOrganisations.new.call involves pulling data dynamically in from
GOV.UK. This makes it an extremely complicated approach to seeding a
database, and causes a bunch of misery in spinning up a production-like
environment for GOV.UK (as is the case with publishing_e2e_tests [1]) as
you need Whitehall to have published data, that data to make it to
Search API, Router to be running and then Collections running - a heck
of a lot for a db:seed!
It's unclear why this is needed, the SeedDatabase step will create a
single organisation (HMRC) which is probably all that is needed.
This simplifies this just to the more basic seed call.
| Ruby | mit | alphagov/contacts-admin,alphagov/contacts-admin,alphagov/contacts-admin | ruby | ## Code Before:
unless ENV.key?("RUNNING_IN_CI")
# See app/tasks/seed_database
ImportOrganisations.new.call
SeedDatabase.instance.run
end
## Instruction:
Remove import organisations from db:seed
ImportOrganisations.new.call involves pulling data dynamically in from
GOV.UK. This makes it an extremely complicated approach to seeding a
database, and causes a bunch of misery in spinning up a production-like
environment for GOV.UK (as is the case with publishing_e2e_tests [1]) as
you need Whitehall to have published data, that data to make it to
Search API, Router to be running and then Collections running - a heck
of a lot for a db:seed!
It's unclear why this is needed, the SeedDatabase step will create a
single organisation (HMRC) which is probably all that is needed.
This simplifies this just to the more basic seed call.
## Code After:
unless ENV.key?("RUNNING_IN_CI")
# See app/tasks/seed_database
SeedDatabase.instance.run
end
| unless ENV.key?("RUNNING_IN_CI")
# See app/tasks/seed_database
- ImportOrganisations.new.call
SeedDatabase.instance.run
end | 1 | 0.2 | 0 | 1 |
b0f1723c36574b20562b2f22312cb2a134a5b2d5 | sparql/unquote_literals.ru | sparql/unquote_literals.ru | DELETE {
?s ?p ?_o .
}
INSERT {
?s ?p ?o .
}
WHERE {
?s ?p ?_o .
FILTER (isLiteral(?_o) && strstarts(?_o, "\"") && strends(?_o, "\""))
BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o)
}
| DELETE {
?s ?p ?_o .
}
INSERT {
?s ?p ?o .
}
WHERE {
?s ?p ?_o .
FILTER (isLiteral(?_o) && strstarts(str(?_o), "\"") && strends(str(?_o), "\""))
BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o)
}
| Add explicit cast to string for Virtuoso | Add explicit cast to string for Virtuoso
| Ruby | epl-1.0 | jindrichmynarz/vvz-to-rdf,jindrichmynarz/vvz-to-rdf,jindrichmynarz/vvz-to-rdf | ruby | ## Code Before:
DELETE {
?s ?p ?_o .
}
INSERT {
?s ?p ?o .
}
WHERE {
?s ?p ?_o .
FILTER (isLiteral(?_o) && strstarts(?_o, "\"") && strends(?_o, "\""))
BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o)
}
## Instruction:
Add explicit cast to string for Virtuoso
## Code After:
DELETE {
?s ?p ?_o .
}
INSERT {
?s ?p ?o .
}
WHERE {
?s ?p ?_o .
FILTER (isLiteral(?_o) && strstarts(str(?_o), "\"") && strends(str(?_o), "\""))
BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o)
}
| DELETE {
?s ?p ?_o .
}
INSERT {
?s ?p ?o .
}
WHERE {
?s ?p ?_o .
- FILTER (isLiteral(?_o) && strstarts(?_o, "\"") && strends(?_o, "\""))
+ FILTER (isLiteral(?_o) && strstarts(str(?_o), "\"") && strends(str(?_o), "\""))
? ++++ + ++++ +
BIND (substr(?_o, 2, strlen(?_o) - 1) AS ?o)
} | 2 | 0.181818 | 1 | 1 |
3180860a2b2b7da99921d41e188d877c1edb4958 | lib/ruby-os/scheduler.rb | lib/ruby-os/scheduler.rb | class RubyOS::Scheduler
attr_reader :queue_manager
def initialize(queue_manager)
raise NotAQueueManagerError.new if !queue_manager.is_a?(RubyOS::QueueManager)
@queue_manager = queue_manager
end
def next_proc(queue_identifier)
raise NotImpleplementedError.new
end
private
class NotAQueueManagerError < ArgumentError
def initialize
super "Expected RubyOS::QueueManager"
end
end
end
| class RubyOS::Scheduler
attr_reader :queue_manager
def initialize(queue_manager)
raise NotAQueueManagerError.new if !queue_manager.is_a?(RubyOS::QueueManager)
@queue_manager = queue_manager
end
def next_proc(queue_identifier, current_proc=nil)
raise NoQueueFoundError.new queue_identifier if !queue_manager.has_queue? queue_identifier
end
private
class NotAQueueManagerError < ArgumentError
def initialize
super "Expected RubyOS::QueueManager"
end
end
class NoQueueFoundError < ArgumentError
def initialize(identifier)
super "No RubyOS::Queue found identified by '#{identifier}'"
end
end
end
| Add a more base method on Scheduler | Add a more base method on Scheduler
| Ruby | mit | wspurgin/ruby-os,wspurgin/ruby-os | ruby | ## Code Before:
class RubyOS::Scheduler
attr_reader :queue_manager
def initialize(queue_manager)
raise NotAQueueManagerError.new if !queue_manager.is_a?(RubyOS::QueueManager)
@queue_manager = queue_manager
end
def next_proc(queue_identifier)
raise NotImpleplementedError.new
end
private
class NotAQueueManagerError < ArgumentError
def initialize
super "Expected RubyOS::QueueManager"
end
end
end
## Instruction:
Add a more base method on Scheduler
## Code After:
class RubyOS::Scheduler
attr_reader :queue_manager
def initialize(queue_manager)
raise NotAQueueManagerError.new if !queue_manager.is_a?(RubyOS::QueueManager)
@queue_manager = queue_manager
end
def next_proc(queue_identifier, current_proc=nil)
raise NoQueueFoundError.new queue_identifier if !queue_manager.has_queue? queue_identifier
end
private
class NotAQueueManagerError < ArgumentError
def initialize
super "Expected RubyOS::QueueManager"
end
end
class NoQueueFoundError < ArgumentError
def initialize(identifier)
super "No RubyOS::Queue found identified by '#{identifier}'"
end
end
end
| class RubyOS::Scheduler
attr_reader :queue_manager
def initialize(queue_manager)
raise NotAQueueManagerError.new if !queue_manager.is_a?(RubyOS::QueueManager)
@queue_manager = queue_manager
end
- def next_proc(queue_identifier)
+ def next_proc(queue_identifier, current_proc=nil)
? ++++++++++++++++++
- raise NotImpleplementedError.new
+ raise NoQueueFoundError.new queue_identifier if !queue_manager.has_queue? queue_identifier
end
private
class NotAQueueManagerError < ArgumentError
def initialize
super "Expected RubyOS::QueueManager"
end
end
+
+ class NoQueueFoundError < ArgumentError
+ def initialize(identifier)
+ super "No RubyOS::Queue found identified by '#{identifier}'"
+ end
+ end
end | 10 | 0.5 | 8 | 2 |
bff1f36d5199cbc7caa218c9f10056e7c9f284ec | README.md | README.md |
Flask-Blogger is a web blogging software written with Flask and it's extensions.
It is still very WIP and barebones.
## FEATURES
* Create, edit and delete posts
* Tag and categorize posts
* Search through posts
* WYSIWYG Markdown editor
## PLANNED FEATURES
* Comment system
* User management with permissions system
* Customization through settings
* Installer
## INSPIRATION
This project is inspired by [FlaskBB](https://github.com/sh4nks/flaskbb) for best practices
and [flask-blog](https://github.com/dmaslov/flask-blog) for functionality.
|
Flask-Blogger is a web blogging software written with Flask and it's extensions.
It is still very WIP and barebones.
## FEATURES
* Create, edit and delete posts
* Preview posts before publishing
* Tag and categorize posts
* Search through posts
* WYSIWYG Markdown editor
## PLANNED FEATURES
* Draft system
* Comment system
* User management with permissions system
* Customization through settings
* Installer
## INSPIRATION
This project is inspired by [FlaskBB](https://github.com/sh4nks/flaskbb) for best practices
and [flask-blog](https://github.com/dmaslov/flask-blog) for functionality.
| Add draft system to planned features | Add draft system to planned features
| Markdown | mit | Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger | markdown | ## Code Before:
Flask-Blogger is a web blogging software written with Flask and it's extensions.
It is still very WIP and barebones.
## FEATURES
* Create, edit and delete posts
* Tag and categorize posts
* Search through posts
* WYSIWYG Markdown editor
## PLANNED FEATURES
* Comment system
* User management with permissions system
* Customization through settings
* Installer
## INSPIRATION
This project is inspired by [FlaskBB](https://github.com/sh4nks/flaskbb) for best practices
and [flask-blog](https://github.com/dmaslov/flask-blog) for functionality.
## Instruction:
Add draft system to planned features
## Code After:
Flask-Blogger is a web blogging software written with Flask and it's extensions.
It is still very WIP and barebones.
## FEATURES
* Create, edit and delete posts
* Preview posts before publishing
* Tag and categorize posts
* Search through posts
* WYSIWYG Markdown editor
## PLANNED FEATURES
* Draft system
* Comment system
* User management with permissions system
* Customization through settings
* Installer
## INSPIRATION
This project is inspired by [FlaskBB](https://github.com/sh4nks/flaskbb) for best practices
and [flask-blog](https://github.com/dmaslov/flask-blog) for functionality.
|
Flask-Blogger is a web blogging software written with Flask and it's extensions.
It is still very WIP and barebones.
## FEATURES
* Create, edit and delete posts
+ * Preview posts before publishing
* Tag and categorize posts
* Search through posts
* WYSIWYG Markdown editor
## PLANNED FEATURES
+ * Draft system
* Comment system
* User management with permissions system
* Customization through settings
* Installer
## INSPIRATION
This project is inspired by [FlaskBB](https://github.com/sh4nks/flaskbb) for best practices
and [flask-blog](https://github.com/dmaslov/flask-blog) for functionality. | 2 | 0.090909 | 2 | 0 |
35eebec7e40214f6d5c441c2ce64c880a3d1b9e5 | api/EventListener/JsonRequestListener.php | api/EventListener/JsonRequestListener.php | <?php
/*
* This file is part of Contao Manager.
*
* (c) Contao Association
*
* @license LGPL-3.0-or-later
*/
namespace Contao\ManagerApi\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class JsonRequestListener implements EventSubscriberInterface
{
/**
* Disallow everything except JSON and convert data to request content.
*
* @param KernelEvent $event
*
* @throws UnsupportedMediaTypeHttpException
* @throws BadRequestHttpException
*/
public function onKernelRequest(KernelEvent $event)
{
$request = $event->getRequest();
$data = [];
if (($content = $request->getContent()) !== '') {
if ('json' !== $request->getContentType()) {
throw new UnsupportedMediaTypeHttpException('Only JSON requests are supported.');
}
$data = json_decode($content, true);
if (!is_array($data)) {
throw new BadRequestHttpException('Invalid JSON data received.');
}
}
$request->request->replace($data);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return ['kernel.request' => ['onKernelRequest', 100]];
}
}
| <?php
/*
* This file is part of Contao Manager.
*
* (c) Contao Association
*
* @license LGPL-3.0-or-later
*/
namespace Contao\ManagerApi\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class JsonRequestListener implements EventSubscriberInterface
{
/**
* Disallow everything except JSON and convert data to request content.
*
* @param KernelEvent $event
*
* @throws UnsupportedMediaTypeHttpException
* @throws BadRequestHttpException
*/
public function onKernelRequest(KernelEvent $event)
{
$request = $event->getRequest();
$content = $content = $request->getContent();
if ($content === '' && $request->attributes->get('form-data')) {
return;
}
$data = [];
if ($content !== '') {
if ('json' !== $request->getContentType()) {
throw new UnsupportedMediaTypeHttpException('Only JSON requests are supported.');
}
$data = json_decode($content, true);
if (!is_array($data)) {
throw new BadRequestHttpException('Invalid JSON data received.');
}
}
$request->request->replace($data);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
// Priority must be lower than the router (defaults to 32)
return ['kernel.request' => ['onKernelRequest', 20]];
}
}
| Allow a controller to accept non-json data by setting route attribute | Allow a controller to accept non-json data by setting route attribute
| PHP | mit | contao/package-manager | php | ## Code Before:
<?php
/*
* This file is part of Contao Manager.
*
* (c) Contao Association
*
* @license LGPL-3.0-or-later
*/
namespace Contao\ManagerApi\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class JsonRequestListener implements EventSubscriberInterface
{
/**
* Disallow everything except JSON and convert data to request content.
*
* @param KernelEvent $event
*
* @throws UnsupportedMediaTypeHttpException
* @throws BadRequestHttpException
*/
public function onKernelRequest(KernelEvent $event)
{
$request = $event->getRequest();
$data = [];
if (($content = $request->getContent()) !== '') {
if ('json' !== $request->getContentType()) {
throw new UnsupportedMediaTypeHttpException('Only JSON requests are supported.');
}
$data = json_decode($content, true);
if (!is_array($data)) {
throw new BadRequestHttpException('Invalid JSON data received.');
}
}
$request->request->replace($data);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return ['kernel.request' => ['onKernelRequest', 100]];
}
}
## Instruction:
Allow a controller to accept non-json data by setting route attribute
## Code After:
<?php
/*
* This file is part of Contao Manager.
*
* (c) Contao Association
*
* @license LGPL-3.0-or-later
*/
namespace Contao\ManagerApi\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class JsonRequestListener implements EventSubscriberInterface
{
/**
* Disallow everything except JSON and convert data to request content.
*
* @param KernelEvent $event
*
* @throws UnsupportedMediaTypeHttpException
* @throws BadRequestHttpException
*/
public function onKernelRequest(KernelEvent $event)
{
$request = $event->getRequest();
$content = $content = $request->getContent();
if ($content === '' && $request->attributes->get('form-data')) {
return;
}
$data = [];
if ($content !== '') {
if ('json' !== $request->getContentType()) {
throw new UnsupportedMediaTypeHttpException('Only JSON requests are supported.');
}
$data = json_decode($content, true);
if (!is_array($data)) {
throw new BadRequestHttpException('Invalid JSON data received.');
}
}
$request->request->replace($data);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
// Priority must be lower than the router (defaults to 32)
return ['kernel.request' => ['onKernelRequest', 20]];
}
}
| <?php
/*
* This file is part of Contao Manager.
*
* (c) Contao Association
*
* @license LGPL-3.0-or-later
*/
namespace Contao\ManagerApi\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class JsonRequestListener implements EventSubscriberInterface
{
/**
* Disallow everything except JSON and convert data to request content.
*
* @param KernelEvent $event
*
* @throws UnsupportedMediaTypeHttpException
* @throws BadRequestHttpException
*/
public function onKernelRequest(KernelEvent $event)
{
$request = $event->getRequest();
+ $content = $content = $request->getContent();
+
+ if ($content === '' && $request->attributes->get('form-data')) {
+ return;
+ }
$data = [];
- if (($content = $request->getContent()) !== '') {
+ if ($content !== '') {
if ('json' !== $request->getContentType()) {
throw new UnsupportedMediaTypeHttpException('Only JSON requests are supported.');
}
$data = json_decode($content, true);
if (!is_array($data)) {
throw new BadRequestHttpException('Invalid JSON data received.');
}
}
$request->request->replace($data);
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
+ // Priority must be lower than the router (defaults to 32)
- return ['kernel.request' => ['onKernelRequest', 100]];
? ^^
+ return ['kernel.request' => ['onKernelRequest', 20]];
? ^
}
} | 10 | 0.178571 | 8 | 2 |
cfac5b955f48295f69581b3bdaad8a9ec93e2683 | website/_includes/_newsletter.jade | website/_includes/_newsletter.jade | //- 💫 INCLUDES > NEWSLETTER
ul.o-block-small
li.u-text-label.u-color-subtle Stay in the loop!
li Receive updates about new releases, tutorials and more.
form.o-grid#mc-embedded-subscribe-form(action="//#{MAILCHIMP.user}.list-manage.com/subscribe/post?u=#{MAILCHIMP.id}&id=#{MAILCHIMP.list}" method="post" name="mc-embedded-subscribe-form" target="_blank" novalidate)
//- MailChimp spam protection
div(style="position: absolute; left: -5000px;" aria-hidden="true")
input(type="text" name="b_#{MAILCHIMP.id}_#{MAILCHIMP.list}" tabindex="-1" value="")
.o-grid-col.o-grid.o-grid--nowrap.o-field.u-padding-small
input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
button#mc-embedded-subscribe.o-field__button.u-text-label.u-color-theme.u-nowrap(type="submit" name="subscribe") Sign up
| //- 💫 INCLUDES > NEWSLETTER
ul.o-block-small
li.u-text-label.u-color-subtle Stay in the loop!
li Receive updates about new releases, tutorials and more.
form.o-grid#mc-embedded-subscribe-form(action="//#{MAILCHIMP.user}.list-manage.com/subscribe/post?u=#{MAILCHIMP.id}&id=#{MAILCHIMP.list}" method="post" name="mc-embedded-subscribe-form" target="_blank" novalidate)
//- MailChimp spam protection
div(style="position: absolute; left: -5000px;" aria-hidden="true")
input(type="text" name="b_#{MAILCHIMP.id}_#{MAILCHIMP.list}" tabindex="-1" value="")
.o-grid-col.o-grid.o-grid--nowrap.o-field.u-padding-small
div
input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
button#mc-embedded-subscribe.o-field__button.u-text-label.u-color-theme.u-nowrap(type="submit" name="subscribe") Sign up
| Fix aligment issues with newsletter signup form | Fix aligment issues with newsletter signup form
| Jade | mit | recognai/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,honnibal/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy | jade | ## Code Before:
//- 💫 INCLUDES > NEWSLETTER
ul.o-block-small
li.u-text-label.u-color-subtle Stay in the loop!
li Receive updates about new releases, tutorials and more.
form.o-grid#mc-embedded-subscribe-form(action="//#{MAILCHIMP.user}.list-manage.com/subscribe/post?u=#{MAILCHIMP.id}&id=#{MAILCHIMP.list}" method="post" name="mc-embedded-subscribe-form" target="_blank" novalidate)
//- MailChimp spam protection
div(style="position: absolute; left: -5000px;" aria-hidden="true")
input(type="text" name="b_#{MAILCHIMP.id}_#{MAILCHIMP.list}" tabindex="-1" value="")
.o-grid-col.o-grid.o-grid--nowrap.o-field.u-padding-small
input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
button#mc-embedded-subscribe.o-field__button.u-text-label.u-color-theme.u-nowrap(type="submit" name="subscribe") Sign up
## Instruction:
Fix aligment issues with newsletter signup form
## Code After:
//- 💫 INCLUDES > NEWSLETTER
ul.o-block-small
li.u-text-label.u-color-subtle Stay in the loop!
li Receive updates about new releases, tutorials and more.
form.o-grid#mc-embedded-subscribe-form(action="//#{MAILCHIMP.user}.list-manage.com/subscribe/post?u=#{MAILCHIMP.id}&id=#{MAILCHIMP.list}" method="post" name="mc-embedded-subscribe-form" target="_blank" novalidate)
//- MailChimp spam protection
div(style="position: absolute; left: -5000px;" aria-hidden="true")
input(type="text" name="b_#{MAILCHIMP.id}_#{MAILCHIMP.list}" tabindex="-1" value="")
.o-grid-col.o-grid.o-grid--nowrap.o-field.u-padding-small
div
input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
button#mc-embedded-subscribe.o-field__button.u-text-label.u-color-theme.u-nowrap(type="submit" name="subscribe") Sign up
| //- 💫 INCLUDES > NEWSLETTER
ul.o-block-small
li.u-text-label.u-color-subtle Stay in the loop!
li Receive updates about new releases, tutorials and more.
form.o-grid#mc-embedded-subscribe-form(action="//#{MAILCHIMP.user}.list-manage.com/subscribe/post?u=#{MAILCHIMP.id}&id=#{MAILCHIMP.list}" method="post" name="mc-embedded-subscribe-form" target="_blank" novalidate)
//- MailChimp spam protection
div(style="position: absolute; left: -5000px;" aria-hidden="true")
input(type="text" name="b_#{MAILCHIMP.id}_#{MAILCHIMP.list}" tabindex="-1" value="")
.o-grid-col.o-grid.o-grid--nowrap.o-field.u-padding-small
+ div
- input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
+ input#mce-EMAIL.o-field__input.u-text(type="email" name="EMAIL" placeholder="Your email" aria-label="Your email")
? ++++
button#mc-embedded-subscribe.o-field__button.u-text-label.u-color-theme.u-nowrap(type="submit" name="subscribe") Sign up | 3 | 0.2 | 2 | 1 |
35e59e9e6e646f250f72c36d61d31d0acdadef01 | application/Bootstrap.php | application/Bootstrap.php | <?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHeadTitle()
{
$this->bootstrap('view');
/* @var $view Zend_View_Abstract */
$view = $this->getResource('view');
$view->headTitle()->setSeparator(' :: ');
$view->headTitle()->prepend('Postr');
}
protected function _initPagination()
{
Zend_View_Helper_PaginationControl::setDefaultViewPartial(
'paginator.phtml'
);
}
protected function _initNavigation()
{
$this->bootstrap('frontController');
$pages = array(
array(
'label' => 'Home',
'id' => 'index',
'action' => 'index',
'controller' => 'index',
),
array(
'label' => 'Entries',
'id' => 'entry',
'action' => 'index',
'controller' => 'entry',
),
);
$resource = new Zend_Application_Resource_Navigation(
array(
'pages' => $pages,
)
);
$resource->setBootstrap($this);
return $resource->init();
}
}
| <?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHeadTitle()
{
$this->bootstrap('view');
/* @var $view Zend_View_Abstract */
$view = $this->getResource('view');
$view->headTitle()->setSeparator(' :: ');
$view->headTitle()->prepend('Postr');
}
protected function _initPagination()
{
Zend_View_Helper_PaginationControl::setDefaultViewPartial(
'paginator.phtml'
);
}
protected function _initNavigation()
{
$this->bootstrap('frontController');
$pages = array(
array(
'label' => 'Home',
'id' => 'index',
'action' => 'index',
'controller' => 'index',
),
array(
'label' => 'Entries',
'id' => 'entry',
'action' => 'index',
'controller' => 'entry',
'pages' => array(
array(
'action' => 'get',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'post',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'put',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'delete',
'controller' => 'entry',
'visible' => false,
),
),
),
);
$resource = new Zend_Application_Resource_Navigation(
array(
'pages' => $pages,
)
);
$resource->setBootstrap($this);
return $resource->init();
}
}
| Add subordinate pages to Entry page in navigation. | Add subordinate pages to Entry page in navigation.
| PHP | bsd-3-clause | bradley-holt/postr | php | ## Code Before:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHeadTitle()
{
$this->bootstrap('view');
/* @var $view Zend_View_Abstract */
$view = $this->getResource('view');
$view->headTitle()->setSeparator(' :: ');
$view->headTitle()->prepend('Postr');
}
protected function _initPagination()
{
Zend_View_Helper_PaginationControl::setDefaultViewPartial(
'paginator.phtml'
);
}
protected function _initNavigation()
{
$this->bootstrap('frontController');
$pages = array(
array(
'label' => 'Home',
'id' => 'index',
'action' => 'index',
'controller' => 'index',
),
array(
'label' => 'Entries',
'id' => 'entry',
'action' => 'index',
'controller' => 'entry',
),
);
$resource = new Zend_Application_Resource_Navigation(
array(
'pages' => $pages,
)
);
$resource->setBootstrap($this);
return $resource->init();
}
}
## Instruction:
Add subordinate pages to Entry page in navigation.
## Code After:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHeadTitle()
{
$this->bootstrap('view');
/* @var $view Zend_View_Abstract */
$view = $this->getResource('view');
$view->headTitle()->setSeparator(' :: ');
$view->headTitle()->prepend('Postr');
}
protected function _initPagination()
{
Zend_View_Helper_PaginationControl::setDefaultViewPartial(
'paginator.phtml'
);
}
protected function _initNavigation()
{
$this->bootstrap('frontController');
$pages = array(
array(
'label' => 'Home',
'id' => 'index',
'action' => 'index',
'controller' => 'index',
),
array(
'label' => 'Entries',
'id' => 'entry',
'action' => 'index',
'controller' => 'entry',
'pages' => array(
array(
'action' => 'get',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'post',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'put',
'controller' => 'entry',
'visible' => false,
),
array(
'action' => 'delete',
'controller' => 'entry',
'visible' => false,
),
),
),
);
$resource = new Zend_Application_Resource_Navigation(
array(
'pages' => $pages,
)
);
$resource->setBootstrap($this);
return $resource->init();
}
}
| <?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewHeadTitle()
{
$this->bootstrap('view');
/* @var $view Zend_View_Abstract */
$view = $this->getResource('view');
$view->headTitle()->setSeparator(' :: ');
$view->headTitle()->prepend('Postr');
}
protected function _initPagination()
{
Zend_View_Helper_PaginationControl::setDefaultViewPartial(
'paginator.phtml'
);
}
protected function _initNavigation()
{
$this->bootstrap('frontController');
$pages = array(
array(
'label' => 'Home',
'id' => 'index',
'action' => 'index',
'controller' => 'index',
),
array(
'label' => 'Entries',
'id' => 'entry',
'action' => 'index',
'controller' => 'entry',
+ 'pages' => array(
+ array(
+ 'action' => 'get',
+ 'controller' => 'entry',
+ 'visible' => false,
+ ),
+ array(
+ 'action' => 'post',
+ 'controller' => 'entry',
+ 'visible' => false,
+ ),
+ array(
+ 'action' => 'put',
+ 'controller' => 'entry',
+ 'visible' => false,
+ ),
+ array(
+ 'action' => 'delete',
+ 'controller' => 'entry',
+ 'visible' => false,
+ ),
+ ),
),
);
$resource = new Zend_Application_Resource_Navigation(
array(
'pages' => $pages,
)
);
$resource->setBootstrap($this);
return $resource->init();
}
} | 22 | 0.478261 | 22 | 0 |
62a422c17ad86e20dcb55b8c71993e919472f2bb | web/templates/style/show.html.slim | web/templates/style/show.html.slim | .d-inline-block.my-3.mx-2
= mega_octicon(:paintcan)
h3.d-inline-block.my-3 = @style.title
.border.p-2
= if !is_nil(@current_user) && @current_user.name == @style.user.name do
.pb-2.clearfix
a.float-right href="#{style_path(@conn, :edit, @style.user.name, @style.id)}"
= octicon(:pencil)
pre
code = @style.code
| .d-inline-block.my-3.mx-2
= mega_octicon(:paintcan)
h3.d-inline-block.my-3 = @style.title
.border.p-2
.pb-2.clearfix
= gettext "Last updated on"
= @style.updated_at
= if !is_nil(@current_user) && @current_user.name == @style.user.name do
a.float-right href="#{style_path(@conn, :edit, @style.user.name, @style.id)}"
= octicon(:pencil)
pre
code = @style.code
| Add last updated date to show style template | Add last updated date to show style template
| Slim | mit | lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks,lee-dohm/atom-style-tweaks | slim | ## Code Before:
.d-inline-block.my-3.mx-2
= mega_octicon(:paintcan)
h3.d-inline-block.my-3 = @style.title
.border.p-2
= if !is_nil(@current_user) && @current_user.name == @style.user.name do
.pb-2.clearfix
a.float-right href="#{style_path(@conn, :edit, @style.user.name, @style.id)}"
= octicon(:pencil)
pre
code = @style.code
## Instruction:
Add last updated date to show style template
## Code After:
.d-inline-block.my-3.mx-2
= mega_octicon(:paintcan)
h3.d-inline-block.my-3 = @style.title
.border.p-2
.pb-2.clearfix
= gettext "Last updated on"
= @style.updated_at
= if !is_nil(@current_user) && @current_user.name == @style.user.name do
a.float-right href="#{style_path(@conn, :edit, @style.user.name, @style.id)}"
= octicon(:pencil)
pre
code = @style.code
| .d-inline-block.my-3.mx-2
= mega_octicon(:paintcan)
h3.d-inline-block.my-3 = @style.title
.border.p-2
+ .pb-2.clearfix
+ = gettext "Last updated on"
+ = @style.updated_at
- = if !is_nil(@current_user) && @current_user.name == @style.user.name do
+ = if !is_nil(@current_user) && @current_user.name == @style.user.name do
? ++
- .pb-2.clearfix
a.float-right href="#{style_path(@conn, :edit, @style.user.name, @style.id)}"
= octicon(:pencil)
pre
code = @style.code | 6 | 0.6 | 4 | 2 |
6243d3ceb43bbdd0ca778bf02b19f895499a0c52 | src/js/breadcrumbs/breadcrumbs-view.js | src/js/breadcrumbs/breadcrumbs-view.js | /**
* A Backbone view that renders breadcrumbs-type tiered navigation.
*
* Initialize the view by passing in the following attributes:
*
*~~~ javascript
* var view = new DropdownMenuView({
* el: $('selector for element that will contain breadcrumbs'),
* model: new BreadcrumbsModel({
* breadcrumbs: [{url: '/', title: 'Overview'}]
* }),
* events: {
* 'click nav.breadcrumbs a.nav-item': function (event) {
* event.preventDefault();
* window.location = $(event.currentTarget).attr('href');
* }
* }
* });
*~~~
* @module BreadcrumbsView
*/
;(function (define) {
'use strict';
define(['backbone', 'edx-ui-toolkit/js/utils/html-utils', 'text!./breadcrumbs.underscore'],
function (Backbone, HtmlUtils, breadcrumbsTemplate) {
var BreadcrumbsView = Backbone.View.extend({
initialize: function (options) {
this.template = HtmlUtils.template(breadcrumbsTemplate);
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
var json = this.model.attributes;
HtmlUtils.setHtml(this.$el, this.template(json));
return this;
}
});
return BreadcrumbsView;
});
}).call(
this,
// Use the default 'define' function if available, else use 'RequireJS.define'
typeof define === 'function' && define.amd ? define : RequireJS.define
);
| /**
* A Backbone view that renders breadcrumbs-type tiered navigation.
*
* Initialize the view by passing in the following attributes:
*
*~~~ javascript
* var view = new BreadcrumbsView({
* el: $('selector for element that will contain breadcrumbs'),
* model: new BreadcrumbsModel({
* breadcrumbs: [{url: '/', title: 'Overview'}]
* }),
* events: {
* 'click nav.breadcrumbs a.nav-item': function (event) {
* event.preventDefault();
* window.location = $(event.currentTarget).attr('href');
* }
* }
* });
*~~~
* @module BreadcrumbsView
*/
;(function (define) {
'use strict';
define(['backbone', 'edx-ui-toolkit/js/utils/html-utils', 'text!./breadcrumbs.underscore'],
function (Backbone, HtmlUtils, breadcrumbsTemplate) {
var BreadcrumbsView = Backbone.View.extend({
initialize: function (options) {
this.template = HtmlUtils.template(breadcrumbsTemplate);
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
var json = this.model.attributes;
HtmlUtils.setHtml(this.$el, this.template(json));
return this;
}
});
return BreadcrumbsView;
});
}).call(
this,
// Use the default 'define' function if available, else use 'RequireJS.define'
typeof define === 'function' && define.amd ? define : RequireJS.define
);
| Fix BreadcrumbsView docs that still said DropdownMenuView | Fix BreadcrumbsView docs that still said DropdownMenuView
| JavaScript | apache-2.0 | edx/edx-ui-toolkit,edx/edx-ui-toolkit | javascript | ## Code Before:
/**
* A Backbone view that renders breadcrumbs-type tiered navigation.
*
* Initialize the view by passing in the following attributes:
*
*~~~ javascript
* var view = new DropdownMenuView({
* el: $('selector for element that will contain breadcrumbs'),
* model: new BreadcrumbsModel({
* breadcrumbs: [{url: '/', title: 'Overview'}]
* }),
* events: {
* 'click nav.breadcrumbs a.nav-item': function (event) {
* event.preventDefault();
* window.location = $(event.currentTarget).attr('href');
* }
* }
* });
*~~~
* @module BreadcrumbsView
*/
;(function (define) {
'use strict';
define(['backbone', 'edx-ui-toolkit/js/utils/html-utils', 'text!./breadcrumbs.underscore'],
function (Backbone, HtmlUtils, breadcrumbsTemplate) {
var BreadcrumbsView = Backbone.View.extend({
initialize: function (options) {
this.template = HtmlUtils.template(breadcrumbsTemplate);
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
var json = this.model.attributes;
HtmlUtils.setHtml(this.$el, this.template(json));
return this;
}
});
return BreadcrumbsView;
});
}).call(
this,
// Use the default 'define' function if available, else use 'RequireJS.define'
typeof define === 'function' && define.amd ? define : RequireJS.define
);
## Instruction:
Fix BreadcrumbsView docs that still said DropdownMenuView
## Code After:
/**
* A Backbone view that renders breadcrumbs-type tiered navigation.
*
* Initialize the view by passing in the following attributes:
*
*~~~ javascript
* var view = new BreadcrumbsView({
* el: $('selector for element that will contain breadcrumbs'),
* model: new BreadcrumbsModel({
* breadcrumbs: [{url: '/', title: 'Overview'}]
* }),
* events: {
* 'click nav.breadcrumbs a.nav-item': function (event) {
* event.preventDefault();
* window.location = $(event.currentTarget).attr('href');
* }
* }
* });
*~~~
* @module BreadcrumbsView
*/
;(function (define) {
'use strict';
define(['backbone', 'edx-ui-toolkit/js/utils/html-utils', 'text!./breadcrumbs.underscore'],
function (Backbone, HtmlUtils, breadcrumbsTemplate) {
var BreadcrumbsView = Backbone.View.extend({
initialize: function (options) {
this.template = HtmlUtils.template(breadcrumbsTemplate);
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
var json = this.model.attributes;
HtmlUtils.setHtml(this.$el, this.template(json));
return this;
}
});
return BreadcrumbsView;
});
}).call(
this,
// Use the default 'define' function if available, else use 'RequireJS.define'
typeof define === 'function' && define.amd ? define : RequireJS.define
);
| /**
* A Backbone view that renders breadcrumbs-type tiered navigation.
*
* Initialize the view by passing in the following attributes:
*
*~~~ javascript
- * var view = new DropdownMenuView({
? ^ ^^ ^^^^^^
+ * var view = new BreadcrumbsView({
? ^ ^^ ^^ +++
* el: $('selector for element that will contain breadcrumbs'),
* model: new BreadcrumbsModel({
* breadcrumbs: [{url: '/', title: 'Overview'}]
* }),
* events: {
* 'click nav.breadcrumbs a.nav-item': function (event) {
* event.preventDefault();
* window.location = $(event.currentTarget).attr('href');
* }
* }
* });
*~~~
* @module BreadcrumbsView
*/
;(function (define) {
'use strict';
define(['backbone', 'edx-ui-toolkit/js/utils/html-utils', 'text!./breadcrumbs.underscore'],
function (Backbone, HtmlUtils, breadcrumbsTemplate) {
var BreadcrumbsView = Backbone.View.extend({
initialize: function (options) {
this.template = HtmlUtils.template(breadcrumbsTemplate);
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
var json = this.model.attributes;
HtmlUtils.setHtml(this.$el, this.template(json));
return this;
}
});
return BreadcrumbsView;
});
}).call(
this,
// Use the default 'define' function if available, else use 'RequireJS.define'
typeof define === 'function' && define.amd ? define : RequireJS.define
); | 2 | 0.043478 | 1 | 1 |
fb491087b9a8771c8b45d441f5185036ee5adf6e | lib/parsers/as-array.js | lib/parsers/as-array.js | 'use strict';
function parseQueryParamAsArray(p) {
return function parseQueryParameter(q) {
var query = {};
query[p] = q[p].split(',');
return query;
};
}
module.exports = parseQueryParamAsArray;
| 'use strict';
function parseQueryParamAsArray(p) {
return function parseQueryParameter(q) {
var query = {};
query[p] = (q && q[p]) ? q[p].split(',') : [];
return query;
};
}
module.exports = parseQueryParamAsArray;
| Fix array parser parsing blank string. | Fix array parser parsing blank string.
| JavaScript | isc | francisbrito/node-restful-qs | javascript | ## Code Before:
'use strict';
function parseQueryParamAsArray(p) {
return function parseQueryParameter(q) {
var query = {};
query[p] = q[p].split(',');
return query;
};
}
module.exports = parseQueryParamAsArray;
## Instruction:
Fix array parser parsing blank string.
## Code After:
'use strict';
function parseQueryParamAsArray(p) {
return function parseQueryParameter(q) {
var query = {};
query[p] = (q && q[p]) ? q[p].split(',') : [];
return query;
};
}
module.exports = parseQueryParamAsArray;
| 'use strict';
function parseQueryParamAsArray(p) {
return function parseQueryParameter(q) {
var query = {};
- query[p] = q[p].split(',');
+ query[p] = (q && q[p]) ? q[p].split(',') : [];
? ++++++++++++++ +++++
return query;
};
}
module.exports = parseQueryParamAsArray; | 2 | 0.166667 | 1 | 1 |
40a63fd8ca5dd574e729b9f531664ce384aa404c | app/schedule/tasks.py | app/schedule/tasks.py | from datetime import datetime
from importlib import import_module
import pytz
from django.conf import settings
from app.schedule.celery import celery_app
from app.schedule.libs.sms import DeviceNotFoundError
@celery_app.task(bind=True)
def send_message(self, to, message, sg_user, sg_password):
def load_sms_class():
module_name, class_name = settings.APP_MESSENGER_CLASS.rsplit(".", 1)
return getattr(import_module(module_name), class_name)
sms_class = load_sms_class()
try:
messenger = sms_class(sg_user, sg_password)
messenger.send_message(to, message)
except DeviceNotFoundError as e:
# Workaround for Celery issue. Remove after next version is released.
tz = pytz.timezone(settings.TIME_ZONE)
self.request.expires = tz.localize(datetime.strptime(self.request.expires[:-6], '%Y-%m-%dT%H:%M:%S'))
self.retry(exc=e, max_retries=50)
| from datetime import datetime
from importlib import import_module
import pytz
from django.conf import settings
from app.schedule.celery import celery_app
from app.schedule.libs.sms import DeviceNotFoundError
@celery_app.task(bind=True)
def send_message(self, to, message, sg_user, sg_password):
def load_sms_class():
module_name, class_name = settings.APP_MESSENGER_CLASS.rsplit(".", 1)
return getattr(import_module(module_name), class_name)
sms_class = load_sms_class()
try:
messenger = sms_class(sg_user, sg_password)
messenger.send_message(to, message)
except DeviceNotFoundError as e:
# Workaround for Celery issue. Remove after next version is released.
tz = pytz.timezone(settings.TIME_ZONE)
self.request.expires = tz.localize(datetime.strptime(self.request.expires[:-6], '%Y-%m-%dT%H:%M:%S'))
self.retry(exc=e, max_retries=2000, countdown=60 * 5)
| Increase retry count and add countdown to retry method | Increase retry count and add countdown to retry method
| Python | agpl-3.0 | agendaodonto/server,agendaodonto/server | python | ## Code Before:
from datetime import datetime
from importlib import import_module
import pytz
from django.conf import settings
from app.schedule.celery import celery_app
from app.schedule.libs.sms import DeviceNotFoundError
@celery_app.task(bind=True)
def send_message(self, to, message, sg_user, sg_password):
def load_sms_class():
module_name, class_name = settings.APP_MESSENGER_CLASS.rsplit(".", 1)
return getattr(import_module(module_name), class_name)
sms_class = load_sms_class()
try:
messenger = sms_class(sg_user, sg_password)
messenger.send_message(to, message)
except DeviceNotFoundError as e:
# Workaround for Celery issue. Remove after next version is released.
tz = pytz.timezone(settings.TIME_ZONE)
self.request.expires = tz.localize(datetime.strptime(self.request.expires[:-6], '%Y-%m-%dT%H:%M:%S'))
self.retry(exc=e, max_retries=50)
## Instruction:
Increase retry count and add countdown to retry method
## Code After:
from datetime import datetime
from importlib import import_module
import pytz
from django.conf import settings
from app.schedule.celery import celery_app
from app.schedule.libs.sms import DeviceNotFoundError
@celery_app.task(bind=True)
def send_message(self, to, message, sg_user, sg_password):
def load_sms_class():
module_name, class_name = settings.APP_MESSENGER_CLASS.rsplit(".", 1)
return getattr(import_module(module_name), class_name)
sms_class = load_sms_class()
try:
messenger = sms_class(sg_user, sg_password)
messenger.send_message(to, message)
except DeviceNotFoundError as e:
# Workaround for Celery issue. Remove after next version is released.
tz = pytz.timezone(settings.TIME_ZONE)
self.request.expires = tz.localize(datetime.strptime(self.request.expires[:-6], '%Y-%m-%dT%H:%M:%S'))
self.retry(exc=e, max_retries=2000, countdown=60 * 5)
| from datetime import datetime
from importlib import import_module
import pytz
from django.conf import settings
from app.schedule.celery import celery_app
from app.schedule.libs.sms import DeviceNotFoundError
@celery_app.task(bind=True)
def send_message(self, to, message, sg_user, sg_password):
def load_sms_class():
module_name, class_name = settings.APP_MESSENGER_CLASS.rsplit(".", 1)
return getattr(import_module(module_name), class_name)
sms_class = load_sms_class()
try:
messenger = sms_class(sg_user, sg_password)
messenger.send_message(to, message)
except DeviceNotFoundError as e:
# Workaround for Celery issue. Remove after next version is released.
tz = pytz.timezone(settings.TIME_ZONE)
self.request.expires = tz.localize(datetime.strptime(self.request.expires[:-6], '%Y-%m-%dT%H:%M:%S'))
- self.retry(exc=e, max_retries=50)
? -
+ self.retry(exc=e, max_retries=2000, countdown=60 * 5)
? +++++++++++++++++++++
| 2 | 0.08 | 1 | 1 |
1c7a291cac8f0e74595d23f9d55870b82492e5df | subprojects/build-init/src/main/resources/org/gradle/buildinit/tasks/templates/library-versions.properties | subprojects/build-init/src/main/resources/org/gradle/buildinit/tasks/templates/library-versions.properties | junit=4.12
slf4j=1.7.25
scala=2.12
kotlin=1.3.21
scala-library=2.12.8
commons-math=3.6.1
groovy=2.5.6
spock=1.2-groovy-2.5
scala-xml=1.1.1
testng=6.14.3
guava=27.0.1-jre
scalatest=3.0.5 | commons-math=3.6.1
groovy=2.5.6
guava=27.0.1-jre
junit=4.12
kotlin=1.3.21
scala-library=2.12.8
scala-xml=1.1.1
scala=2.12
scalatest=3.0.5
slf4j=1.7.26
spock=1.2-groovy-2.5
testng=6.14.3
| Update library versions in build init to latest for 5.4 | Update library versions in build init to latest for 5.4
| INI | apache-2.0 | robinverduijn/gradle,robinverduijn/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,gradle/gradle,gradle/gradle,gradle/gradle,robinverduijn/gradle,robinverduijn/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,robinverduijn/gradle,blindpirate/gradle,robinverduijn/gradle,blindpirate/gradle | ini | ## Code Before:
junit=4.12
slf4j=1.7.25
scala=2.12
kotlin=1.3.21
scala-library=2.12.8
commons-math=3.6.1
groovy=2.5.6
spock=1.2-groovy-2.5
scala-xml=1.1.1
testng=6.14.3
guava=27.0.1-jre
scalatest=3.0.5
## Instruction:
Update library versions in build init to latest for 5.4
## Code After:
commons-math=3.6.1
groovy=2.5.6
guava=27.0.1-jre
junit=4.12
kotlin=1.3.21
scala-library=2.12.8
scala-xml=1.1.1
scala=2.12
scalatest=3.0.5
slf4j=1.7.26
spock=1.2-groovy-2.5
testng=6.14.3
| + commons-math=3.6.1
+ groovy=2.5.6
+ guava=27.0.1-jre
junit=4.12
- slf4j=1.7.25
- scala=2.12
kotlin=1.3.21
scala-library=2.12.8
- commons-math=3.6.1
- groovy=2.5.6
+ scala-xml=1.1.1
+ scala=2.12
+ scalatest=3.0.5
+ slf4j=1.7.26
spock=1.2-groovy-2.5
- scala-xml=1.1.1
testng=6.14.3
- guava=27.0.1-jre
- scalatest=3.0.5 | 14 | 1.166667 | 7 | 7 |
bc4723481a8ee30b918c9938e25b7e4ba8282893 | examples/addressbook.proto | examples/addressbook.proto | // See README.txt for information and build instructions.
syntax = "proto3";
package tutorial;
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
| // See README.txt for information and build instructions.
//
// Note: START and END tags are used in comments to define sections used in
// tutorials. They are not part of the syntax for Protocol Buffers.
//
// To get an in-depth walkthrough of this file and the related examples, see:
// https://developers.google.com/protocol-buffers/docs/tutorials
// [START declaration]
syntax = "proto3";
package tutorial;
// [END declaration]
// [START java_declaration]
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
// [END java_declaration]
// [START csharp_declaration]
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
// [END csharp_declaration]
// [START messages]
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
// [END messages]
| Add region tags for protocol buffers tutorials. | Add region tags for protocol buffers tutorials.
Since these tags might be confusing, added a note that these are not
part of the normal protocol buffers syntax. I also linked to the main
tutorials page that uses these examples
https://developers.google.com/protocol-buffers/docs/tutorials so that
anyone who arrived here without going through that info first can get
more explanation if they want.
| Protocol Buffer | bsd-3-clause | google/protobuf,google/protobuf,Livefyre/protobuf,Livefyre/protobuf,Livefyre/protobuf,google/protobuf,google/protobuf,google/protobuf,google/protobuf,google/protobuf,google/protobuf,Livefyre/protobuf,Livefyre/protobuf,google/protobuf,google/protobuf,google/protobuf | protocol-buffer | ## Code Before:
// See README.txt for information and build instructions.
syntax = "proto3";
package tutorial;
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
## Instruction:
Add region tags for protocol buffers tutorials.
Since these tags might be confusing, added a note that these are not
part of the normal protocol buffers syntax. I also linked to the main
tutorials page that uses these examples
https://developers.google.com/protocol-buffers/docs/tutorials so that
anyone who arrived here without going through that info first can get
more explanation if they want.
## Code After:
// See README.txt for information and build instructions.
//
// Note: START and END tags are used in comments to define sections used in
// tutorials. They are not part of the syntax for Protocol Buffers.
//
// To get an in-depth walkthrough of this file and the related examples, see:
// https://developers.google.com/protocol-buffers/docs/tutorials
// [START declaration]
syntax = "proto3";
package tutorial;
// [END declaration]
// [START java_declaration]
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
// [END java_declaration]
// [START csharp_declaration]
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
// [END csharp_declaration]
// [START messages]
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
// [END messages]
| // See README.txt for information and build instructions.
+ //
+ // Note: START and END tags are used in comments to define sections used in
+ // tutorials. They are not part of the syntax for Protocol Buffers.
+ //
+ // To get an in-depth walkthrough of this file and the related examples, see:
+ // https://developers.google.com/protocol-buffers/docs/tutorials
+ // [START declaration]
syntax = "proto3";
+ package tutorial;
+ // [END declaration]
+ // [START java_declaration]
- package tutorial;
-
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
+ // [END java_declaration]
+
+ // [START csharp_declaration]
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
+ // [END csharp_declaration]
+ // [START messages]
message Person {
string name = 1;
- int32 id = 2; // Unique ID number for this person.
? ------
+ int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
+ // [END messages] | 20 | 0.606061 | 17 | 3 |
a1ce5d8f0497203a3aedcba98ae66a393eed872f | app/services/current-routed-modal.js | app/services/current-routed-modal.js | import Ember from 'ember';
import Config from 'ember-routable-modal/configuration';
export default Ember.Service.extend({
routing: Ember.inject.service('-routing'),
routeName: null,
activeListener: function() {
if (typeof Ember.$ !== 'undefined') {
Ember.$('body')[this.get('routeName') ? 'addClass' : 'removeClass'](Config.modalOpenBodyClassName);
}
}.observes('routeName'),
init() {
this._super(...arguments);
if (typeof Ember.$ !== 'undefined' && typeof window !== 'undefined') {
Ember.$(window).on('popstate.ember-routable-modal', () => {
if (this.get('routeName')) {
this.set('routeName', null);
}
});
}
},
clear() {
if (this.get('routeName')) {
this.set('routeName', null);
}
},
close() {
const rout = this.get('routing.router.router');
const handlerInfos = this.get('routing.router.router.state.handlerInfos');
const currentController = handlerInfos[handlerInfos.length - 1]._handler.controller;
this.set('routeName', null);
if (currentController._isModalRoute) {
const parentRoute = handlerInfos[handlerInfos.length - 2].name;
rout.transitionTo(parentRoute);
} else {
const url = this.get('routing').generateURL(this.get('routing.currentPath'));
rout.updateURL(url);
}
}
});
| import Ember from 'ember';
import Config from 'ember-routable-modal/configuration';
export default Ember.Service.extend({
routing: Ember.inject.service('-routing'),
routeName: null,
activeListener: function() {
if (typeof Ember.$ !== 'undefined') {
Ember.$('body')[this.get('routeName') ? 'addClass' : 'removeClass'](Config.modalOpenBodyClassName);
}
}.observes('routeName'),
init() {
this._super(...arguments);
if (typeof Ember.$ !== 'undefined' && typeof window !== 'undefined') {
Ember.$(window).on('popstate.ember-routable-modal', () => {
if (this.get('routeName')) {
this.set('routeName', null);
}
});
}
},
clear() {
if (this.get('routeName')) {
this.set('routeName', null);
}
},
close() {
const routerMain = this.get('routing.router');
const routerLib = routerMain._routerMicrolib || routerMain.router;
const handlerInfos = routerLib.state.handlerInfos;
const currentController = handlerInfos[handlerInfos.length - 1]._handler.controller;
this.set('routeName', null);
if (currentController._isModalRoute) {
const parentRoute = handlerInfos[handlerInfos.length - 2].name;
routerLib.transitionTo(parentRoute);
} else {
const url = this.get('routing').generateURL(this.get('routing.currentPath'));
routerLib.updateURL(url);
}
}
});
| Fix routing deprecation for Ember 2.13 | Fix routing deprecation for Ember 2.13
| JavaScript | mit | dbbk/ember-routable-modal,dbbk/ember-routable-modal | javascript | ## Code Before:
import Ember from 'ember';
import Config from 'ember-routable-modal/configuration';
export default Ember.Service.extend({
routing: Ember.inject.service('-routing'),
routeName: null,
activeListener: function() {
if (typeof Ember.$ !== 'undefined') {
Ember.$('body')[this.get('routeName') ? 'addClass' : 'removeClass'](Config.modalOpenBodyClassName);
}
}.observes('routeName'),
init() {
this._super(...arguments);
if (typeof Ember.$ !== 'undefined' && typeof window !== 'undefined') {
Ember.$(window).on('popstate.ember-routable-modal', () => {
if (this.get('routeName')) {
this.set('routeName', null);
}
});
}
},
clear() {
if (this.get('routeName')) {
this.set('routeName', null);
}
},
close() {
const rout = this.get('routing.router.router');
const handlerInfos = this.get('routing.router.router.state.handlerInfos');
const currentController = handlerInfos[handlerInfos.length - 1]._handler.controller;
this.set('routeName', null);
if (currentController._isModalRoute) {
const parentRoute = handlerInfos[handlerInfos.length - 2].name;
rout.transitionTo(parentRoute);
} else {
const url = this.get('routing').generateURL(this.get('routing.currentPath'));
rout.updateURL(url);
}
}
});
## Instruction:
Fix routing deprecation for Ember 2.13
## Code After:
import Ember from 'ember';
import Config from 'ember-routable-modal/configuration';
export default Ember.Service.extend({
routing: Ember.inject.service('-routing'),
routeName: null,
activeListener: function() {
if (typeof Ember.$ !== 'undefined') {
Ember.$('body')[this.get('routeName') ? 'addClass' : 'removeClass'](Config.modalOpenBodyClassName);
}
}.observes('routeName'),
init() {
this._super(...arguments);
if (typeof Ember.$ !== 'undefined' && typeof window !== 'undefined') {
Ember.$(window).on('popstate.ember-routable-modal', () => {
if (this.get('routeName')) {
this.set('routeName', null);
}
});
}
},
clear() {
if (this.get('routeName')) {
this.set('routeName', null);
}
},
close() {
const routerMain = this.get('routing.router');
const routerLib = routerMain._routerMicrolib || routerMain.router;
const handlerInfos = routerLib.state.handlerInfos;
const currentController = handlerInfos[handlerInfos.length - 1]._handler.controller;
this.set('routeName', null);
if (currentController._isModalRoute) {
const parentRoute = handlerInfos[handlerInfos.length - 2].name;
routerLib.transitionTo(parentRoute);
} else {
const url = this.get('routing').generateURL(this.get('routing.currentPath'));
routerLib.updateURL(url);
}
}
});
| import Ember from 'ember';
import Config from 'ember-routable-modal/configuration';
export default Ember.Service.extend({
routing: Ember.inject.service('-routing'),
routeName: null,
activeListener: function() {
if (typeof Ember.$ !== 'undefined') {
Ember.$('body')[this.get('routeName') ? 'addClass' : 'removeClass'](Config.modalOpenBodyClassName);
}
}.observes('routeName'),
init() {
this._super(...arguments);
if (typeof Ember.$ !== 'undefined' && typeof window !== 'undefined') {
Ember.$(window).on('popstate.ember-routable-modal', () => {
if (this.get('routeName')) {
this.set('routeName', null);
}
});
}
},
clear() {
if (this.get('routeName')) {
this.set('routeName', null);
}
},
close() {
- const rout = this.get('routing.router.router');
? -------
+ const routerMain = this.get('routing.router');
? ++++++
+ const routerLib = routerMain._routerMicrolib || routerMain.router;
- const handlerInfos = this.get('routing.router.router.state.handlerInfos');
? ------------------ ^^^^^^^ --
+ const handlerInfos = routerLib.state.handlerInfos;
? ^^^
const currentController = handlerInfos[handlerInfos.length - 1]._handler.controller;
this.set('routeName', null);
if (currentController._isModalRoute) {
const parentRoute = handlerInfos[handlerInfos.length - 2].name;
- rout.transitionTo(parentRoute);
+ routerLib.transitionTo(parentRoute);
? +++++
} else {
const url = this.get('routing').generateURL(this.get('routing.currentPath'));
- rout.updateURL(url);
+ routerLib.updateURL(url);
? +++++
}
}
}); | 9 | 0.2 | 5 | 4 |
abef4133e82d6738698a26e775b40994d692c76b | Gruntfile.js | Gruntfile.js | module.exports = function (grunt) {
/**
* Configuration.
*/
grunt.initConfig({
uglify: {
default: {
options: {
preserveComments: 'some'
},
files: {
'angular-draganddrop.min.js': 'angular-draganddrop.js'
}
}
}
});
/**
* Tasks.
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
}; | module.exports = function (grunt) {
/**
* Configuration.
*/
grunt.initConfig({
uglify: {
default: {
options: {
preserveComments: 'some',
sourceMap: 'angular-draganddrop.min.map',
sourceMappingURL: 'angular-draganddrop.min.map'
},
files: {
'angular-draganddrop.min.js': 'angular-draganddrop.js'
}
}
}
});
/**
* Tasks.
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
}; | Add sourcemap options to uglify. | Add sourcemap options to uglify.
| JavaScript | mit | EvanOxfeld/angular-draganddrop,lemonde/angular-draganddrop,ecurley-nextcentury/angular-draganddrop,neoziro/angular-draganddrop,kranthitech/angular-draganddrop | javascript | ## Code Before:
module.exports = function (grunt) {
/**
* Configuration.
*/
grunt.initConfig({
uglify: {
default: {
options: {
preserveComments: 'some'
},
files: {
'angular-draganddrop.min.js': 'angular-draganddrop.js'
}
}
}
});
/**
* Tasks.
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
};
## Instruction:
Add sourcemap options to uglify.
## Code After:
module.exports = function (grunt) {
/**
* Configuration.
*/
grunt.initConfig({
uglify: {
default: {
options: {
preserveComments: 'some',
sourceMap: 'angular-draganddrop.min.map',
sourceMappingURL: 'angular-draganddrop.min.map'
},
files: {
'angular-draganddrop.min.js': 'angular-draganddrop.js'
}
}
}
});
/**
* Tasks.
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
}; | module.exports = function (grunt) {
/**
* Configuration.
*/
grunt.initConfig({
uglify: {
default: {
options: {
- preserveComments: 'some'
+ preserveComments: 'some',
? +
+ sourceMap: 'angular-draganddrop.min.map',
+ sourceMappingURL: 'angular-draganddrop.min.map'
},
files: {
'angular-draganddrop.min.js': 'angular-draganddrop.js'
}
}
}
});
/**
* Tasks.
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
}; | 4 | 0.153846 | 3 | 1 |
446fbd56fc8ab90ea108f30376fb3f8706eabe75 | src/sigen.h | src/sigen.h | //
// sigen.h: global header file for user includes
// -----------------------------------
#pragma once
#include <sigen/types.h>
#include <sigen/dvb_defs.h>
#include <sigen/version.h>
#include <sigen/tstream.h>
#include <sigen/packetizer.h>
#include <sigen/utc.h>
#include <sigen/util.h>
#include <sigen/dump.h>
#include <sigen/table.h>
#include <sigen/nit.h>
#include <sigen/bat.h>
#include <sigen/sdt.h>
#include <sigen/pat.h>
#include <sigen/pmt.h>
#include <sigen/cat.h>
#include <sigen/eit.h>
#include <sigen/tdt.h>
#include <sigen/tot.h>
#include <sigen/other_tables.h>
#include <sigen/descriptor.h>
#include <sigen/dvb_desc.h>
#include <sigen/stream_desc.h>
#include <sigen/nit_desc.h>
#include <sigen/linkage_desc.h>
#include <sigen/sdt_desc.h>
#include <sigen/pmt_desc.h>
#include <sigen/ssu_desc.h>
#include <sigen/eit_desc.h>
| //
// sigen.h: global header file for user includes
// -----------------------------------
#pragma once
#include "types.h"
#include "dvb_defs.h"
#include "version.h"
#include "tstream.h"
#include "packetizer.h"
#include "utc.h"
#include "util.h"
#include "dump.h"
#include "table.h"
#include "nit.h"
#include "bat.h"
#include "sdt.h"
#include "pat.h"
#include "pmt.h"
#include "cat.h"
#include "eit.h"
#include "tdt.h"
#include "tot.h"
#include "other_tables.h"
#include "descriptor.h"
#include "dvb_desc.h"
#include "stream_desc.h"
#include "nit_desc.h"
#include "linkage_desc.h"
#include "sdt_desc.h"
#include "pmt_desc.h"
#include "ssu_desc.h"
#include "eit_desc.h"
| Fix header includes to use local paths. | Fix header includes to use local paths.
| C | mit | edporras/sigen,edporras/sigen,edporras/sigen,edporras/sigen | c | ## Code Before:
//
// sigen.h: global header file for user includes
// -----------------------------------
#pragma once
#include <sigen/types.h>
#include <sigen/dvb_defs.h>
#include <sigen/version.h>
#include <sigen/tstream.h>
#include <sigen/packetizer.h>
#include <sigen/utc.h>
#include <sigen/util.h>
#include <sigen/dump.h>
#include <sigen/table.h>
#include <sigen/nit.h>
#include <sigen/bat.h>
#include <sigen/sdt.h>
#include <sigen/pat.h>
#include <sigen/pmt.h>
#include <sigen/cat.h>
#include <sigen/eit.h>
#include <sigen/tdt.h>
#include <sigen/tot.h>
#include <sigen/other_tables.h>
#include <sigen/descriptor.h>
#include <sigen/dvb_desc.h>
#include <sigen/stream_desc.h>
#include <sigen/nit_desc.h>
#include <sigen/linkage_desc.h>
#include <sigen/sdt_desc.h>
#include <sigen/pmt_desc.h>
#include <sigen/ssu_desc.h>
#include <sigen/eit_desc.h>
## Instruction:
Fix header includes to use local paths.
## Code After:
//
// sigen.h: global header file for user includes
// -----------------------------------
#pragma once
#include "types.h"
#include "dvb_defs.h"
#include "version.h"
#include "tstream.h"
#include "packetizer.h"
#include "utc.h"
#include "util.h"
#include "dump.h"
#include "table.h"
#include "nit.h"
#include "bat.h"
#include "sdt.h"
#include "pat.h"
#include "pmt.h"
#include "cat.h"
#include "eit.h"
#include "tdt.h"
#include "tot.h"
#include "other_tables.h"
#include "descriptor.h"
#include "dvb_desc.h"
#include "stream_desc.h"
#include "nit_desc.h"
#include "linkage_desc.h"
#include "sdt_desc.h"
#include "pmt_desc.h"
#include "ssu_desc.h"
#include "eit_desc.h"
| //
// sigen.h: global header file for user includes
// -----------------------------------
#pragma once
- #include <sigen/types.h>
? ^^^^^^^ ^
+ #include "types.h"
? ^ ^
- #include <sigen/dvb_defs.h>
? ^^^^^^^ ^
+ #include "dvb_defs.h"
? ^ ^
- #include <sigen/version.h>
? ^^^^^^^ ^
+ #include "version.h"
? ^ ^
- #include <sigen/tstream.h>
? ^^^^^^^ ^
+ #include "tstream.h"
? ^ ^
- #include <sigen/packetizer.h>
? ^^^^^^^ ^
+ #include "packetizer.h"
? ^ ^
- #include <sigen/utc.h>
+ #include "utc.h"
- #include <sigen/util.h>
? ^^^^^^^ ^
+ #include "util.h"
? ^ ^
- #include <sigen/dump.h>
? ^^^^^^^ ^
+ #include "dump.h"
? ^ ^
- #include <sigen/table.h>
? ^^^^^^^ ^
+ #include "table.h"
? ^ ^
- #include <sigen/nit.h>
- #include <sigen/bat.h>
- #include <sigen/sdt.h>
- #include <sigen/pat.h>
- #include <sigen/pmt.h>
- #include <sigen/cat.h>
- #include <sigen/eit.h>
- #include <sigen/tdt.h>
- #include <sigen/tot.h>
+ #include "nit.h"
+ #include "bat.h"
+ #include "sdt.h"
+ #include "pat.h"
+ #include "pmt.h"
+ #include "cat.h"
+ #include "eit.h"
+ #include "tdt.h"
+ #include "tot.h"
- #include <sigen/other_tables.h>
? ^^^^^^^ ^
+ #include "other_tables.h"
? ^ ^
- #include <sigen/descriptor.h>
? ^^^^^^^ ^
+ #include "descriptor.h"
? ^ ^
- #include <sigen/dvb_desc.h>
? ^^^^^^^ ^
+ #include "dvb_desc.h"
? ^ ^
- #include <sigen/stream_desc.h>
? ^^^^^^^ ^
+ #include "stream_desc.h"
? ^ ^
- #include <sigen/nit_desc.h>
? ^^^^^^^ ^
+ #include "nit_desc.h"
? ^ ^
- #include <sigen/linkage_desc.h>
? ^^^^^^^ ^
+ #include "linkage_desc.h"
? ^ ^
- #include <sigen/sdt_desc.h>
? ^^^^^^^ ^
+ #include "sdt_desc.h"
? ^ ^
- #include <sigen/pmt_desc.h>
? ^^^^^^^ ^
+ #include "pmt_desc.h"
? ^ ^
- #include <sigen/ssu_desc.h>
? ^^^^^^^ ^
+ #include "ssu_desc.h"
? ^ ^
- #include <sigen/eit_desc.h>
? ^^^^^^^ ^
+ #include "eit_desc.h"
? ^ ^
| 56 | 1.513514 | 28 | 28 |
018e634dc7249fc3c5dff87f8088a974ca52410c | fog_pry.rb | fog_pry.rb |
require 'fog'
require 'fog/core'
require 'fog/compute'
require 'fog/aws'
require 'pry'
require 'chef_metal/aws_credentials' # Cheat on how to get credentials
aws_credentials = ChefMetal::AWSCredentials.new
aws_credentials.load_default
creds = aws_credentials.default
# creds = aws_credentials["profile"]
compute = Fog::Compute.new({
:provider => "AWS",
:aws_access_key_id => creds[:access_key_id],
:aws_secret_access_key => creds[:secret_access_key]
})
# Gimme shell
binding.pry
|
require 'fog'
require 'fog/core'
require 'fog/compute'
require 'fog/aws'
require 'pry'
require 'inifile'
aws_credentials = IniFile.load(
File.join(File.expand_path('~'), ".aws", "config"))
if ARGV[0].nil?
creds = aws_credentials['default']
else
creds = aws_credentials["profile #{ARGV[0]}"]
end
compute = Fog::Compute.new({
:provider => "AWS",
:aws_access_key_id => creds['aws_access_key_id'],
:aws_secret_access_key => creds['aws_secret_access_key'],
:region => creds['region'] || 'us-east-1'
})
# Gimme shell
binding.pry
| Use inifile instead of chef-metal | Use inifile instead of chef-metal
| Ruby | mit | mivok/tools,mivok/tools,mivok/tools,mivok/tools | ruby | ## Code Before:
require 'fog'
require 'fog/core'
require 'fog/compute'
require 'fog/aws'
require 'pry'
require 'chef_metal/aws_credentials' # Cheat on how to get credentials
aws_credentials = ChefMetal::AWSCredentials.new
aws_credentials.load_default
creds = aws_credentials.default
# creds = aws_credentials["profile"]
compute = Fog::Compute.new({
:provider => "AWS",
:aws_access_key_id => creds[:access_key_id],
:aws_secret_access_key => creds[:secret_access_key]
})
# Gimme shell
binding.pry
## Instruction:
Use inifile instead of chef-metal
## Code After:
require 'fog'
require 'fog/core'
require 'fog/compute'
require 'fog/aws'
require 'pry'
require 'inifile'
aws_credentials = IniFile.load(
File.join(File.expand_path('~'), ".aws", "config"))
if ARGV[0].nil?
creds = aws_credentials['default']
else
creds = aws_credentials["profile #{ARGV[0]}"]
end
compute = Fog::Compute.new({
:provider => "AWS",
:aws_access_key_id => creds['aws_access_key_id'],
:aws_secret_access_key => creds['aws_secret_access_key'],
:region => creds['region'] || 'us-east-1'
})
# Gimme shell
binding.pry
|
require 'fog'
require 'fog/core'
require 'fog/compute'
require 'fog/aws'
require 'pry'
- require 'chef_metal/aws_credentials' # Cheat on how to get credentials
+ require 'inifile'
- aws_credentials = ChefMetal::AWSCredentials.new
- aws_credentials.load_default
+ aws_credentials = IniFile.load(
+ File.join(File.expand_path('~'), ".aws", "config"))
+ if ARGV[0].nil?
- creds = aws_credentials.default
? ^
+ creds = aws_credentials['default']
? ++ ^^ ++
+ else
- # creds = aws_credentials["profile"]
? ^
+ creds = aws_credentials["profile #{ARGV[0]}"]
? ^ +++++++++++
+ end
compute = Fog::Compute.new({
:provider => "AWS",
- :aws_access_key_id => creds[:access_key_id],
? ^
+ :aws_access_key_id => creds['aws_access_key_id'],
? ^^^^^ +
- :aws_secret_access_key => creds[:secret_access_key]
? ^
+ :aws_secret_access_key => creds['aws_secret_access_key'],
? ^^^^^ + +
+ :region => creds['region'] || 'us-east-1'
})
# Gimme shell
binding.pry | 18 | 0.818182 | 11 | 7 |
e93789084c03b2a566835006d6d5adaee3d4bbe6 | silk/globals.py | silk/globals.py |
__all__ = []
try:
from silk.webdoc import css, html, node
__all__.extend(('css', 'html', 'node'))
except ImportError:
pass
try:
from silk.webdb import (
AuthenticationError, BoolColumn, Column, DB, DataColumn,
DateTimeColumn, FloatColumn, IntColumn, RecordError, ReferenceColumn,
RowidColumn, SQLSyntaxError, StrColumn, Table, UnknownDriver, connect
)
__all__.extend((
'AuthenticationError', 'BoolColumn', 'Column', 'DB', 'DataColumn',
'DateTimeColumn', 'FloatColumn', 'IntColumn', 'RecordError',
'ReferenceColumn', 'RowidColumn', 'SQLSyntaxError', 'StrColumn',
'Table', 'UnknownDriver', 'connect'
))
except ImportError:
pass
try:
from silk.webreq import (
B64Document, BaseRouter, Document, FormData, HTTP, Header, HeaderList,
PathRouter, Query, Redirect, Response, TextView, URI
)
__all__.extend((
'B64Document', 'BaseRouter', 'Document', 'FormData', 'HTTP', 'Header',
'HeaderList', 'PathRouter', 'Query', 'Redirect', 'Response',
'TextView', 'URI'
))
except ImportError:
pass
|
__all__ = []
try:
from silk.webdoc import css, html, node
__all__ += ['css', 'html', 'node']
except ImportError:
pass
try:
from silk.webdb import (
AuthenticationError, BoolColumn, Column, DB, DataColumn,
DateTimeColumn, FloatColumn, IntColumn, RecordError, ReferenceColumn,
RowidColumn, SQLSyntaxError, StrColumn, Table, UnknownDriver, connect
)
__all__ += [
'AuthenticationError', 'BoolColumn', 'Column', 'DB', 'DataColumn',
'DateTimeColumn', 'FloatColumn', 'IntColumn', 'RecordError',
'ReferenceColumn', 'RowidColumn', 'SQLSyntaxError', 'StrColumn',
'Table', 'UnknownDriver', 'connect'
]
except ImportError:
pass
try:
from silk.webreq import (
B64Document, BaseRouter, Document, FormData, HTTP, Header, HeaderList,
PathRouter, Query, Redirect, Response, TextView, URI
)
__all__ += [
'B64Document', 'BaseRouter', 'Document', 'FormData', 'HTTP', 'Header',
'HeaderList', 'PathRouter', 'Query', 'Redirect', 'Response',
'TextView', 'URI'
]
except ImportError:
pass
| Use += to modify __all__, to appease flake8 | Use += to modify __all__, to appease flake8
| Python | bsd-3-clause | orbnauticus/silk | python | ## Code Before:
__all__ = []
try:
from silk.webdoc import css, html, node
__all__.extend(('css', 'html', 'node'))
except ImportError:
pass
try:
from silk.webdb import (
AuthenticationError, BoolColumn, Column, DB, DataColumn,
DateTimeColumn, FloatColumn, IntColumn, RecordError, ReferenceColumn,
RowidColumn, SQLSyntaxError, StrColumn, Table, UnknownDriver, connect
)
__all__.extend((
'AuthenticationError', 'BoolColumn', 'Column', 'DB', 'DataColumn',
'DateTimeColumn', 'FloatColumn', 'IntColumn', 'RecordError',
'ReferenceColumn', 'RowidColumn', 'SQLSyntaxError', 'StrColumn',
'Table', 'UnknownDriver', 'connect'
))
except ImportError:
pass
try:
from silk.webreq import (
B64Document, BaseRouter, Document, FormData, HTTP, Header, HeaderList,
PathRouter, Query, Redirect, Response, TextView, URI
)
__all__.extend((
'B64Document', 'BaseRouter', 'Document', 'FormData', 'HTTP', 'Header',
'HeaderList', 'PathRouter', 'Query', 'Redirect', 'Response',
'TextView', 'URI'
))
except ImportError:
pass
## Instruction:
Use += to modify __all__, to appease flake8
## Code After:
__all__ = []
try:
from silk.webdoc import css, html, node
__all__ += ['css', 'html', 'node']
except ImportError:
pass
try:
from silk.webdb import (
AuthenticationError, BoolColumn, Column, DB, DataColumn,
DateTimeColumn, FloatColumn, IntColumn, RecordError, ReferenceColumn,
RowidColumn, SQLSyntaxError, StrColumn, Table, UnknownDriver, connect
)
__all__ += [
'AuthenticationError', 'BoolColumn', 'Column', 'DB', 'DataColumn',
'DateTimeColumn', 'FloatColumn', 'IntColumn', 'RecordError',
'ReferenceColumn', 'RowidColumn', 'SQLSyntaxError', 'StrColumn',
'Table', 'UnknownDriver', 'connect'
]
except ImportError:
pass
try:
from silk.webreq import (
B64Document, BaseRouter, Document, FormData, HTTP, Header, HeaderList,
PathRouter, Query, Redirect, Response, TextView, URI
)
__all__ += [
'B64Document', 'BaseRouter', 'Document', 'FormData', 'HTTP', 'Header',
'HeaderList', 'PathRouter', 'Query', 'Redirect', 'Response',
'TextView', 'URI'
]
except ImportError:
pass
|
__all__ = []
try:
from silk.webdoc import css, html, node
- __all__.extend(('css', 'html', 'node'))
? ^^^^^^^^^ ^^
+ __all__ += ['css', 'html', 'node']
? ^^^^^ ^
except ImportError:
pass
try:
from silk.webdb import (
AuthenticationError, BoolColumn, Column, DB, DataColumn,
DateTimeColumn, FloatColumn, IntColumn, RecordError, ReferenceColumn,
RowidColumn, SQLSyntaxError, StrColumn, Table, UnknownDriver, connect
)
- __all__.extend((
+ __all__ += [
'AuthenticationError', 'BoolColumn', 'Column', 'DB', 'DataColumn',
'DateTimeColumn', 'FloatColumn', 'IntColumn', 'RecordError',
'ReferenceColumn', 'RowidColumn', 'SQLSyntaxError', 'StrColumn',
'Table', 'UnknownDriver', 'connect'
- ))
+ ]
except ImportError:
pass
try:
from silk.webreq import (
B64Document, BaseRouter, Document, FormData, HTTP, Header, HeaderList,
PathRouter, Query, Redirect, Response, TextView, URI
)
- __all__.extend((
+ __all__ += [
'B64Document', 'BaseRouter', 'Document', 'FormData', 'HTTP', 'Header',
'HeaderList', 'PathRouter', 'Query', 'Redirect', 'Response',
'TextView', 'URI'
- ))
+ ]
except ImportError:
pass | 10 | 0.27027 | 5 | 5 |
939717c4255093b1827e514fb79b2503daadb1e3 | streams_tabs_helper.php | streams_tabs_helper.php | <?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* @package PyroCMS
* @subpackage Streams Tabs Helper
* @author Chris Harvey <chris@chrisnharvey.com>
* @license MIT
*/
/**
* Build a tabs array for streams
*
* @param array $tabs Your associative tab array
* @param string $stream Stream slug
* @param string $namespace Stream namesapce
* @param string $default The default tab where other fields will go if they have not been assigned to a tab
* @return array The tabs array ready to be passed into $this->streams->cp->entry_form()
*/
function build_tabs($tabs, $stream, $namespace = null, $default = 'general')
{
$fields = ci()->streams->streams->get_assignments($stream, $namespace);
foreach ($fields as $field) $tabs[$default]['fields'][$field->field_slug] = $field->field_slug;
foreach ($tabs as $key => $tab) {
if ($key == $default) continue;
foreach ($fields as $field) {
if (in_array($field->field_slug, $tab['fields'])) {
unset($tabs[$default]['fields'][$field->field_slug]);
}
}
}
if (empty($tabs[$default]['fields'])) unset($tabs[$default]);
return $tabs;
} | <?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* @package PyroCMS
* @subpackage Streams Tabs Helper
* @author Chris Harvey <chris@chrisnharvey.com>
* @license MIT
*/
/**
* Build a tabs array for streams
*
* @param array $tabs Your associative tab array
* @param string $stream Stream slug
* @param string $namespace Stream namesapce
* @param string $default The default tab where other fields will go if they have not been assigned to a tab
* @return array The tabs array ready to be passed into $this->streams->cp->entry_form()
*/
function build_tabs($tabs, $stream, $namespace = null, $default = 'general')
{
$fields = ci()->streams->streams->get_assignments($stream, $namespace);
foreach ($fields as $field) $tabs[$default]['fields'][$field->field_slug] = $field->field_slug;
foreach ($tabs as $key => &$tab) {
if ($key == $default) continue;
foreach ($tab['fields'] as $field_key => $field) {
if ( ! in_array($field, $tabs[$default]['fields'])) {
unset($tab['fields'][$field_key]);
}
}
foreach ($fields as $field) {
if (in_array($field->field_slug, $tab['fields'])) {
unset($tabs[$default]['fields'][$field->field_slug]);
}
}
}
if (empty($tabs[$default]['fields'])) unset($tabs[$default]);
return $tabs;
} | Remove the field from the tab if the field does not exist | Remove the field from the tab if the field does not exist
| PHP | mit | chrisnharvey/PyroCMS-Streams-Tabs-Helper | php | ## Code Before:
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* @package PyroCMS
* @subpackage Streams Tabs Helper
* @author Chris Harvey <chris@chrisnharvey.com>
* @license MIT
*/
/**
* Build a tabs array for streams
*
* @param array $tabs Your associative tab array
* @param string $stream Stream slug
* @param string $namespace Stream namesapce
* @param string $default The default tab where other fields will go if they have not been assigned to a tab
* @return array The tabs array ready to be passed into $this->streams->cp->entry_form()
*/
function build_tabs($tabs, $stream, $namespace = null, $default = 'general')
{
$fields = ci()->streams->streams->get_assignments($stream, $namespace);
foreach ($fields as $field) $tabs[$default]['fields'][$field->field_slug] = $field->field_slug;
foreach ($tabs as $key => $tab) {
if ($key == $default) continue;
foreach ($fields as $field) {
if (in_array($field->field_slug, $tab['fields'])) {
unset($tabs[$default]['fields'][$field->field_slug]);
}
}
}
if (empty($tabs[$default]['fields'])) unset($tabs[$default]);
return $tabs;
}
## Instruction:
Remove the field from the tab if the field does not exist
## Code After:
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* @package PyroCMS
* @subpackage Streams Tabs Helper
* @author Chris Harvey <chris@chrisnharvey.com>
* @license MIT
*/
/**
* Build a tabs array for streams
*
* @param array $tabs Your associative tab array
* @param string $stream Stream slug
* @param string $namespace Stream namesapce
* @param string $default The default tab where other fields will go if they have not been assigned to a tab
* @return array The tabs array ready to be passed into $this->streams->cp->entry_form()
*/
function build_tabs($tabs, $stream, $namespace = null, $default = 'general')
{
$fields = ci()->streams->streams->get_assignments($stream, $namespace);
foreach ($fields as $field) $tabs[$default]['fields'][$field->field_slug] = $field->field_slug;
foreach ($tabs as $key => &$tab) {
if ($key == $default) continue;
foreach ($tab['fields'] as $field_key => $field) {
if ( ! in_array($field, $tabs[$default]['fields'])) {
unset($tab['fields'][$field_key]);
}
}
foreach ($fields as $field) {
if (in_array($field->field_slug, $tab['fields'])) {
unset($tabs[$default]['fields'][$field->field_slug]);
}
}
}
if (empty($tabs[$default]['fields'])) unset($tabs[$default]);
return $tabs;
} | <?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* @package PyroCMS
* @subpackage Streams Tabs Helper
* @author Chris Harvey <chris@chrisnharvey.com>
* @license MIT
*/
/**
* Build a tabs array for streams
*
* @param array $tabs Your associative tab array
* @param string $stream Stream slug
* @param string $namespace Stream namesapce
* @param string $default The default tab where other fields will go if they have not been assigned to a tab
* @return array The tabs array ready to be passed into $this->streams->cp->entry_form()
*/
function build_tabs($tabs, $stream, $namespace = null, $default = 'general')
{
$fields = ci()->streams->streams->get_assignments($stream, $namespace);
foreach ($fields as $field) $tabs[$default]['fields'][$field->field_slug] = $field->field_slug;
- foreach ($tabs as $key => $tab) {
+ foreach ($tabs as $key => &$tab) {
? +
if ($key == $default) continue;
+
+ foreach ($tab['fields'] as $field_key => $field) {
+ if ( ! in_array($field, $tabs[$default]['fields'])) {
+ unset($tab['fields'][$field_key]);
+ }
+ }
foreach ($fields as $field) {
if (in_array($field->field_slug, $tab['fields'])) {
unset($tabs[$default]['fields'][$field->field_slug]);
}
}
}
if (empty($tabs[$default]['fields'])) unset($tabs[$default]);
return $tabs;
} | 8 | 0.190476 | 7 | 1 |
00cea9f8e51f53f338e19adf0165031d2f9cad77 | c2corg_ui/templates/utils/format.py | c2corg_ui/templates/utils/format.py | import bbcode
import markdown
import html
from c2corg_ui.format.wikilinks import C2CWikiLinkExtension
_markdown_parser = None
_bbcode_parser = None
def _get_markdown_parser():
global _markdown_parser
if not _markdown_parser:
extensions = [
C2CWikiLinkExtension(),
]
_markdown_parser = markdown.Markdown(output_format='xhtml5',
extensions=extensions)
return _markdown_parser
def _get_bbcode_parser():
global _bbcode_parser
if not _bbcode_parser:
_bbcode_parser = bbcode.Parser(escape_html=False, newline='\n')
return _bbcode_parser
def parse_code(text, md=True, bb=True):
if md:
text = _get_markdown_parser().convert(text)
if bb:
text = _get_bbcode_parser().format(text)
return text
def sanitize(text):
return html.escape(text)
| import bbcode
import markdown
import html
from c2corg_ui.format.wikilinks import C2CWikiLinkExtension
from markdown.extensions.nl2br import Nl2BrExtension
from markdown.extensions.toc import TocExtension
_markdown_parser = None
_bbcode_parser = None
def _get_markdown_parser():
global _markdown_parser
if not _markdown_parser:
extensions = [
C2CWikiLinkExtension(),
Nl2BrExtension(),
TocExtension(marker='[toc]', baselevel=2),
]
_markdown_parser = markdown.Markdown(output_format='xhtml5',
extensions=extensions)
return _markdown_parser
def _get_bbcode_parser():
global _bbcode_parser
if not _bbcode_parser:
_bbcode_parser = bbcode.Parser(escape_html=False, newline='\n')
return _bbcode_parser
def parse_code(text, md=True, bb=True):
if md:
text = _get_markdown_parser().convert(text)
if bb:
text = _get_bbcode_parser().format(text)
return text
def sanitize(text):
return html.escape(text)
| Enable markdown extensions for TOC and linebreaks | Enable markdown extensions for TOC and linebreaks
| Python | agpl-3.0 | Courgetteandratatouille/v6_ui,Courgetteandratatouille/v6_ui,olaurendeau/v6_ui,c2corg/v6_ui,c2corg/v6_ui,c2corg/v6_ui,Courgetteandratatouille/v6_ui,olaurendeau/v6_ui,olaurendeau/v6_ui,c2corg/v6_ui,Courgetteandratatouille/v6_ui,olaurendeau/v6_ui | python | ## Code Before:
import bbcode
import markdown
import html
from c2corg_ui.format.wikilinks import C2CWikiLinkExtension
_markdown_parser = None
_bbcode_parser = None
def _get_markdown_parser():
global _markdown_parser
if not _markdown_parser:
extensions = [
C2CWikiLinkExtension(),
]
_markdown_parser = markdown.Markdown(output_format='xhtml5',
extensions=extensions)
return _markdown_parser
def _get_bbcode_parser():
global _bbcode_parser
if not _bbcode_parser:
_bbcode_parser = bbcode.Parser(escape_html=False, newline='\n')
return _bbcode_parser
def parse_code(text, md=True, bb=True):
if md:
text = _get_markdown_parser().convert(text)
if bb:
text = _get_bbcode_parser().format(text)
return text
def sanitize(text):
return html.escape(text)
## Instruction:
Enable markdown extensions for TOC and linebreaks
## Code After:
import bbcode
import markdown
import html
from c2corg_ui.format.wikilinks import C2CWikiLinkExtension
from markdown.extensions.nl2br import Nl2BrExtension
from markdown.extensions.toc import TocExtension
_markdown_parser = None
_bbcode_parser = None
def _get_markdown_parser():
global _markdown_parser
if not _markdown_parser:
extensions = [
C2CWikiLinkExtension(),
Nl2BrExtension(),
TocExtension(marker='[toc]', baselevel=2),
]
_markdown_parser = markdown.Markdown(output_format='xhtml5',
extensions=extensions)
return _markdown_parser
def _get_bbcode_parser():
global _bbcode_parser
if not _bbcode_parser:
_bbcode_parser = bbcode.Parser(escape_html=False, newline='\n')
return _bbcode_parser
def parse_code(text, md=True, bb=True):
if md:
text = _get_markdown_parser().convert(text)
if bb:
text = _get_bbcode_parser().format(text)
return text
def sanitize(text):
return html.escape(text)
| import bbcode
import markdown
import html
from c2corg_ui.format.wikilinks import C2CWikiLinkExtension
+ from markdown.extensions.nl2br import Nl2BrExtension
+ from markdown.extensions.toc import TocExtension
_markdown_parser = None
_bbcode_parser = None
def _get_markdown_parser():
global _markdown_parser
if not _markdown_parser:
extensions = [
C2CWikiLinkExtension(),
+ Nl2BrExtension(),
+ TocExtension(marker='[toc]', baselevel=2),
]
_markdown_parser = markdown.Markdown(output_format='xhtml5',
extensions=extensions)
return _markdown_parser
def _get_bbcode_parser():
global _bbcode_parser
if not _bbcode_parser:
_bbcode_parser = bbcode.Parser(escape_html=False, newline='\n')
return _bbcode_parser
def parse_code(text, md=True, bb=True):
if md:
text = _get_markdown_parser().convert(text)
if bb:
text = _get_bbcode_parser().format(text)
return text
def sanitize(text):
return html.escape(text) | 4 | 0.102564 | 4 | 0 |
9fcf408dad5b97094445677eb42429beaa830c22 | apps/homepage/templatetags/homepage_tags.py | apps/homepage/templatetags/homepage_tags.py | from django import template
from homepage.models import Tab
register = template.Library()
@register.tag(name="get_tabs")
def get_tabs(parser, token):
return GetElementNode()
class GetElementNode(template.Node):
def __init__(self):
pass
def render(self, context):
context['tabs'] = Tab.objects.all()
return '' | from django import template
from homepage.models import Tab
register = template.Library()
@register.tag(name="get_tabs")
def get_tabs(parser, token):
return GetElementNode()
class GetElementNode(template.Node):
def __init__(self):
pass
def render(self, context):
context['tabs'] = Tab.objects.all().select_related('grid')
return '' | Reduce queries on all pages by using select_related in the get_tabs template tag. | Reduce queries on all pages by using select_related in the get_tabs template tag.
| Python | mit | benracine/opencomparison,audreyr/opencomparison,QLGu/djangopackages,cartwheelweb/packaginator,QLGu/djangopackages,miketheman/opencomparison,nanuxbe/djangopackages,QLGu/djangopackages,miketheman/opencomparison,nanuxbe/djangopackages,audreyr/opencomparison,cartwheelweb/packaginator,nanuxbe/djangopackages,cartwheelweb/packaginator,pydanny/djangopackages,pydanny/djangopackages,pydanny/djangopackages,benracine/opencomparison | python | ## Code Before:
from django import template
from homepage.models import Tab
register = template.Library()
@register.tag(name="get_tabs")
def get_tabs(parser, token):
return GetElementNode()
class GetElementNode(template.Node):
def __init__(self):
pass
def render(self, context):
context['tabs'] = Tab.objects.all()
return ''
## Instruction:
Reduce queries on all pages by using select_related in the get_tabs template tag.
## Code After:
from django import template
from homepage.models import Tab
register = template.Library()
@register.tag(name="get_tabs")
def get_tabs(parser, token):
return GetElementNode()
class GetElementNode(template.Node):
def __init__(self):
pass
def render(self, context):
context['tabs'] = Tab.objects.all().select_related('grid')
return '' | from django import template
from homepage.models import Tab
register = template.Library()
@register.tag(name="get_tabs")
def get_tabs(parser, token):
return GetElementNode()
class GetElementNode(template.Node):
def __init__(self):
pass
def render(self, context):
- context['tabs'] = Tab.objects.all()
+ context['tabs'] = Tab.objects.all().select_related('grid')
? +++++++++++++++++++++++
return '' | 2 | 0.105263 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.