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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
61cef22952451df6345355ad596b38cb92697256 | flocker/test/test_flocker.py | flocker/test/test_flocker.py |
from sys import executable
from subprocess import check_output, STDOUT
from twisted.trial.unittest import SynchronousTestCase
class WarningsTests(SynchronousTestCase):
"""
Tests for warning suppression.
"""
def test_warnings_suppressed(self):
"""
Warnings are suppressed for processes that import flocker.
"""
result = check_output(
[executable, b"-c", (b"import flocker; import warnings; " +
b"warnings.warn('ohno')")],
stderr=STDOUT)
self.assertEqual(result, b"")
|
from sys import executable
from subprocess import check_output, STDOUT
from twisted.trial.unittest import SynchronousTestCase
from twisted.python.filepath import FilePath
import flocker
class WarningsTests(SynchronousTestCase):
"""
Tests for warning suppression.
"""
def test_warnings_suppressed(self):
"""
Warnings are suppressed for processes that import flocker.
"""
root = FilePath(flocker.__file__)
result = check_output(
[executable, b"-c", (b"import flocker; import warnings; " +
b"warnings.warn('ohno')")],
stderr=STDOUT,
# Make sure we can import flocker package:
cwd=root.parent().parent().path)
self.assertEqual(result, b"")
| Make sure flocker package can be imported even if it's not installed. | Make sure flocker package can be imported even if it's not installed.
| Python | apache-2.0 | beni55/flocker,hackday-profilers/flocker,achanda/flocker,adamtheturtle/flocker,mbrukman/flocker,Azulinho/flocker,w4ngyi/flocker,agonzalezro/flocker,agonzalezro/flocker,1d4Nf6/flocker,moypray/flocker,AndyHuu/flocker,lukemarsden/flocker,wallnerryan/flocker-profiles,mbrukman/flocker,w4ngyi/flocker,Azulinho/flocker,LaynePeng/flocker,lukemarsden/flocker,mbrukman/flocker,moypray/flocker,LaynePeng/flocker,runcom/flocker,AndyHuu/flocker,runcom/flocker,wallnerryan/flocker-profiles,AndyHuu/flocker,agonzalezro/flocker,w4ngyi/flocker,achanda/flocker,hackday-profilers/flocker,adamtheturtle/flocker,lukemarsden/flocker,1d4Nf6/flocker,jml/flocker,runcom/flocker,LaynePeng/flocker,beni55/flocker,adamtheturtle/flocker,moypray/flocker,achanda/flocker,hackday-profilers/flocker,wallnerryan/flocker-profiles,Azulinho/flocker,beni55/flocker,1d4Nf6/flocker,jml/flocker,jml/flocker | python | ## Code Before:
from sys import executable
from subprocess import check_output, STDOUT
from twisted.trial.unittest import SynchronousTestCase
class WarningsTests(SynchronousTestCase):
"""
Tests for warning suppression.
"""
def test_warnings_suppressed(self):
"""
Warnings are suppressed for processes that import flocker.
"""
result = check_output(
[executable, b"-c", (b"import flocker; import warnings; " +
b"warnings.warn('ohno')")],
stderr=STDOUT)
self.assertEqual(result, b"")
## Instruction:
Make sure flocker package can be imported even if it's not installed.
## Code After:
from sys import executable
from subprocess import check_output, STDOUT
from twisted.trial.unittest import SynchronousTestCase
from twisted.python.filepath import FilePath
import flocker
class WarningsTests(SynchronousTestCase):
"""
Tests for warning suppression.
"""
def test_warnings_suppressed(self):
"""
Warnings are suppressed for processes that import flocker.
"""
root = FilePath(flocker.__file__)
result = check_output(
[executable, b"-c", (b"import flocker; import warnings; " +
b"warnings.warn('ohno')")],
stderr=STDOUT,
# Make sure we can import flocker package:
cwd=root.parent().parent().path)
self.assertEqual(result, b"")
|
from sys import executable
from subprocess import check_output, STDOUT
from twisted.trial.unittest import SynchronousTestCase
+ from twisted.python.filepath import FilePath
+
+ import flocker
class WarningsTests(SynchronousTestCase):
"""
Tests for warning suppression.
"""
def test_warnings_suppressed(self):
"""
Warnings are suppressed for processes that import flocker.
"""
+ root = FilePath(flocker.__file__)
result = check_output(
[executable, b"-c", (b"import flocker; import warnings; " +
b"warnings.warn('ohno')")],
- stderr=STDOUT)
? ^
+ stderr=STDOUT,
? ^
+ # Make sure we can import flocker package:
+ cwd=root.parent().parent().path)
self.assertEqual(result, b"") | 8 | 0.4 | 7 | 1 |
0ef926df941628e9bb2b24c27670ede86c78c890 | Manga/app/src/main/java/nhdphuong/com/manga/data/entity/book/BookTitle.kt | Manga/app/src/main/java/nhdphuong/com/manga/data/entity/book/BookTitle.kt | package nhdphuong.com.manga.data.entity.book
import com.google.gson.annotations.SerializedName
import nhdphuong.com.manga.Constants
import java.io.Serializable
/*
* Created by nhdphuong on 3/24/18.
*/
class BookTitle(@field:SerializedName(Constants.TITLE_ENG) val englishName: String,
@field:SerializedName(Constants.TITLE_JAPANESE) val japaneseName: String = "",
@field:SerializedName(Constants.TITLE_PRETTY) val pretty: String) : Serializable | package nhdphuong.com.manga.data.entity.book
import com.google.gson.annotations.SerializedName
import nhdphuong.com.manga.Constants
import java.io.Serializable
/*
* Created by nhdphuong on 3/24/18.
*/
class BookTitle(@field:SerializedName(Constants.TITLE_ENG) private val mEnglishName: String?,
@field:SerializedName(Constants.TITLE_JAPANESE) private val mJapaneseName: String?,
@field:SerializedName(Constants.TITLE_PRETTY) private val mPretty: String?) : Serializable {
val japaneseName: String
get() = mJapaneseName ?: ""
val englishName: String
get() = mEnglishName ?: ""
val pretty: String
get() = mPretty ?: ""
} | Fix bug crash on null Japanese name | Fix bug crash on null Japanese name
| Kotlin | mit | duyphuong5126/Android,duyphuong5126/Android | kotlin | ## Code Before:
package nhdphuong.com.manga.data.entity.book
import com.google.gson.annotations.SerializedName
import nhdphuong.com.manga.Constants
import java.io.Serializable
/*
* Created by nhdphuong on 3/24/18.
*/
class BookTitle(@field:SerializedName(Constants.TITLE_ENG) val englishName: String,
@field:SerializedName(Constants.TITLE_JAPANESE) val japaneseName: String = "",
@field:SerializedName(Constants.TITLE_PRETTY) val pretty: String) : Serializable
## Instruction:
Fix bug crash on null Japanese name
## Code After:
package nhdphuong.com.manga.data.entity.book
import com.google.gson.annotations.SerializedName
import nhdphuong.com.manga.Constants
import java.io.Serializable
/*
* Created by nhdphuong on 3/24/18.
*/
class BookTitle(@field:SerializedName(Constants.TITLE_ENG) private val mEnglishName: String?,
@field:SerializedName(Constants.TITLE_JAPANESE) private val mJapaneseName: String?,
@field:SerializedName(Constants.TITLE_PRETTY) private val mPretty: String?) : Serializable {
val japaneseName: String
get() = mJapaneseName ?: ""
val englishName: String
get() = mEnglishName ?: ""
val pretty: String
get() = mPretty ?: ""
} | package nhdphuong.com.manga.data.entity.book
import com.google.gson.annotations.SerializedName
import nhdphuong.com.manga.Constants
import java.io.Serializable
/*
* Created by nhdphuong on 3/24/18.
*/
- class BookTitle(@field:SerializedName(Constants.TITLE_ENG) val englishName: String,
? ^
+ class BookTitle(@field:SerializedName(Constants.TITLE_ENG) private val mEnglishName: String?,
? ++++++++ ^^ +
- @field:SerializedName(Constants.TITLE_JAPANESE) val japaneseName: String = "",
? ^ ^^^^^
+ @field:SerializedName(Constants.TITLE_JAPANESE) private val mJapaneseName: String?,
? ++++++++ ^^ ^
- @field:SerializedName(Constants.TITLE_PRETTY) val pretty: String) : Serializable
? ^
+ @field:SerializedName(Constants.TITLE_PRETTY) private val mPretty: String?) : Serializable {
? ++++++++ ^^ + ++
+ val japaneseName: String
+ get() = mJapaneseName ?: ""
+
+ val englishName: String
+ get() = mEnglishName ?: ""
+
+ val pretty: String
+ get() = mPretty ?: ""
+ } | 15 | 1.25 | 12 | 3 |
8b9b1e05d9e26c8a34a92d6ee182f88d5a8c5439 | js/novnc/iframe.php | js/novnc/iframe.php | <?php
$id = rand(0,100000);
echo("
<html>
<body>
<style>
#noVNC_screen_".$id." { width: 100%; height: 100%; }
html, body { margin: 0; }
</style>
<script src=\"util.js\"></script>
<div id=\"noVNC_screen_".$id."\">
<canvas id=\"noVNC_canvas_".$id."\"></canvas>
</div>
<script>
INCLUDE_URI = '';
Util.load_scripts(['webutil.js', 'base64.js', 'websock.js', 'des.js', 'input.js', 'display.js', 'jsunzip.js', 'rfb.js']);
var rfb_".$id.";
window.onscriptsload = function () {
rfb_".$id." = new RFB({'target': \$D('noVNC_canvas_".$id."'), 'view_only': false });
rfb_".$id.".connect('".$_GET["host"]."', '".$_GET["port"]."', '".$_GET["password"]."', '');
};
</script>
</body>
</html>
");
?> | <?php
$id = rand(0,100000);
echo("
<html>
<body>
<style>
#noVNC_screen_".$id." { width: 100%; height: 100%; }
html, body { margin: 0; }
</style>
<script src=\"util.js\"></script>
<div id=\"noVNC_screen_".$id."\">
<canvas id=\"noVNC_canvas_".$id."\"></canvas>
</div>
<script>
INCLUDE_URI = '';
Util.load_scripts(['webutil.js', 'base64.js', 'websock.js', 'des.js', 'input.js', 'display.js', 'jsunzip.js', 'rfb.js']);
var rfb_".$id.";
window.onscriptsload = function () {
rfb_".$id." = new RFB({'target': \$D('noVNC_canvas_".$id."'), 'view_only': false });
rfb_".$id.".connect('".$_GET["host"]."', '".$_GET["port"]."', '".$_GET["password"]."', '');
setTimeout('rfb_".$id.".sendKey();', 2000);
};
</script>
</body>
</html>
");
?> | Fix noVNC not doing initial screen update by simulating a keypress after 2 seconds | Fix noVNC not doing initial screen update by simulating a keypress after 2 seconds
| PHP | mit | jonty-comp/neptr,jonty-comp/neptr | php | ## Code Before:
<?php
$id = rand(0,100000);
echo("
<html>
<body>
<style>
#noVNC_screen_".$id." { width: 100%; height: 100%; }
html, body { margin: 0; }
</style>
<script src=\"util.js\"></script>
<div id=\"noVNC_screen_".$id."\">
<canvas id=\"noVNC_canvas_".$id."\"></canvas>
</div>
<script>
INCLUDE_URI = '';
Util.load_scripts(['webutil.js', 'base64.js', 'websock.js', 'des.js', 'input.js', 'display.js', 'jsunzip.js', 'rfb.js']);
var rfb_".$id.";
window.onscriptsload = function () {
rfb_".$id." = new RFB({'target': \$D('noVNC_canvas_".$id."'), 'view_only': false });
rfb_".$id.".connect('".$_GET["host"]."', '".$_GET["port"]."', '".$_GET["password"]."', '');
};
</script>
</body>
</html>
");
?>
## Instruction:
Fix noVNC not doing initial screen update by simulating a keypress after 2 seconds
## Code After:
<?php
$id = rand(0,100000);
echo("
<html>
<body>
<style>
#noVNC_screen_".$id." { width: 100%; height: 100%; }
html, body { margin: 0; }
</style>
<script src=\"util.js\"></script>
<div id=\"noVNC_screen_".$id."\">
<canvas id=\"noVNC_canvas_".$id."\"></canvas>
</div>
<script>
INCLUDE_URI = '';
Util.load_scripts(['webutil.js', 'base64.js', 'websock.js', 'des.js', 'input.js', 'display.js', 'jsunzip.js', 'rfb.js']);
var rfb_".$id.";
window.onscriptsload = function () {
rfb_".$id." = new RFB({'target': \$D('noVNC_canvas_".$id."'), 'view_only': false });
rfb_".$id.".connect('".$_GET["host"]."', '".$_GET["port"]."', '".$_GET["password"]."', '');
setTimeout('rfb_".$id.".sendKey();', 2000);
};
</script>
</body>
</html>
");
?> | <?php
$id = rand(0,100000);
echo("
<html>
<body>
<style>
#noVNC_screen_".$id." { width: 100%; height: 100%; }
html, body { margin: 0; }
</style>
<script src=\"util.js\"></script>
<div id=\"noVNC_screen_".$id."\">
<canvas id=\"noVNC_canvas_".$id."\"></canvas>
</div>
<script>
INCLUDE_URI = '';
Util.load_scripts(['webutil.js', 'base64.js', 'websock.js', 'des.js', 'input.js', 'display.js', 'jsunzip.js', 'rfb.js']);
var rfb_".$id.";
window.onscriptsload = function () {
rfb_".$id." = new RFB({'target': \$D('noVNC_canvas_".$id."'), 'view_only': false });
rfb_".$id.".connect('".$_GET["host"]."', '".$_GET["port"]."', '".$_GET["password"]."', '');
+ setTimeout('rfb_".$id.".sendKey();', 2000);
};
</script>
</body>
</html>
");
?> | 1 | 0.032258 | 1 | 0 |
252dc6307437762a6bf7c1cfc7ef88e6088330a9 | PWGLF/STRANGENESS/Lifetimes/macros/AddTaskStrangenessLifetimes.cc | PWGLF/STRANGENESS/Lifetimes/macros/AddTaskStrangenessLifetimes.cc | AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(
TString tskname = "LifetimesFiltering", TString suffix = "") {
// Get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskStrangenessLifetimes", "No analysis manager found.");
return 0x0;
}
// Check the analysis type using the event handlers connected to the analysis
// manager.
if (!mgr->GetInputEventHandler()) {
::Error("AddTaskStrangenessLifetimes",
"This task requires an input event handler");
return 0x0;
}
tskname.Append(suffix.Data());
AliAnalysisTaskStrangenessLifetimes *task =
new AliAnalysisTaskStrangenessLifetimes(tskname.Data());
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(
Form("%s_summary", tskname.Data()), TList::Class(),
AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
AliAnalysisDataContainer *coutput2 =
mgr->CreateContainer(Form("V0tree%s", suffix.Data()), TTree::Class(),
AliAnalysisManager::kOutputContainer, "V0tree.root");
coutput2->SetSpecialOutput();
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, coutput1);
mgr->ConnectOutput(task, 2, coutput2);
return task;
}
| AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(bool isMC = false,
TString tskname = "LifetimesFiltering", TString suffix = "") {
// Get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskStrangenessLifetimes", "No analysis manager found.");
return 0x0;
}
// Check the analysis type using the event handlers connected to the analysis
// manager.
if (!mgr->GetInputEventHandler()) {
::Error("AddTaskStrangenessLifetimes",
"This task requires an input event handler");
return 0x0;
}
tskname.Append(suffix.Data());
AliAnalysisTaskStrangenessLifetimes *task =
new AliAnalysisTaskStrangenessLifetimes(isMC, tskname.Data());
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(
Form("%s_summary", tskname.Data()), TList::Class(),
AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
AliAnalysisDataContainer *coutput2 =
mgr->CreateContainer(Form("V0tree%s", suffix.Data()), TTree::Class(),
AliAnalysisManager::kOutputContainer, "V0tree.root");
coutput2->SetSpecialOutput();
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, coutput1);
mgr->ConnectOutput(task, 2, coutput2);
return task;
}
| Enable MC flag in the AddTask π
| Enable MC flag in the AddTask π
| C++ | bsd-3-clause | dstocco/AliPhysics,sebaleh/AliPhysics,rihanphys/AliPhysics,SHornung1/AliPhysics,AMechler/AliPhysics,rbailhac/AliPhysics,SHornung1/AliPhysics,rderradi/AliPhysics,AMechler/AliPhysics,kreisl/AliPhysics,alisw/AliPhysics,btrzecia/AliPhysics,kreisl/AliPhysics,mvala/AliPhysics,hzanoli/AliPhysics,nschmidtALICE/AliPhysics,amaringarcia/AliPhysics,rbailhac/AliPhysics,sebaleh/AliPhysics,dstocco/AliPhysics,lcunquei/AliPhysics,AMechler/AliPhysics,sebaleh/AliPhysics,victor-gonzalez/AliPhysics,adriansev/AliPhysics,dstocco/AliPhysics,rderradi/AliPhysics,nschmidtALICE/AliPhysics,pchrista/AliPhysics,carstooon/AliPhysics,rihanphys/AliPhysics,hzanoli/AliPhysics,pchrista/AliPhysics,hzanoli/AliPhysics,dmuhlhei/AliPhysics,victor-gonzalez/AliPhysics,rbailhac/AliPhysics,akubera/AliPhysics,nschmidtALICE/AliPhysics,pchrista/AliPhysics,pchrista/AliPhysics,alisw/AliPhysics,victor-gonzalez/AliPhysics,SHornung1/AliPhysics,rderradi/AliPhysics,pbuehler/AliPhysics,kreisl/AliPhysics,alisw/AliPhysics,dstocco/AliPhysics,rbailhac/AliPhysics,amaringarcia/AliPhysics,rbailhac/AliPhysics,rderradi/AliPhysics,hcab14/AliPhysics,nschmidtALICE/AliPhysics,kreisl/AliPhysics,preghenella/AliPhysics,alisw/AliPhysics,alisw/AliPhysics,pbuehler/AliPhysics,hcab14/AliPhysics,fbellini/AliPhysics,lcunquei/AliPhysics,fcolamar/AliPhysics,btrzecia/AliPhysics,amatyja/AliPhysics,rihanphys/AliPhysics,hcab14/AliPhysics,dstocco/AliPhysics,rbailhac/AliPhysics,alisw/AliPhysics,rderradi/AliPhysics,lcunquei/AliPhysics,dstocco/AliPhysics,nschmidtALICE/AliPhysics,mvala/AliPhysics,sebaleh/AliPhysics,mvala/AliPhysics,preghenella/AliPhysics,mpuccio/AliPhysics,mpuccio/AliPhysics,carstooon/AliPhysics,adriansev/AliPhysics,pchrista/AliPhysics,fcolamar/AliPhysics,victor-gonzalez/AliPhysics,akubera/AliPhysics,amatyja/AliPhysics,fcolamar/AliPhysics,hcab14/AliPhysics,adriansev/AliPhysics,rihanphys/AliPhysics,hzanoli/AliPhysics,carstooon/AliPhysics,AMechler/AliPhysics,pchrista/AliPhysics,AMechler/AliPhysics,rbailhac/AliPhysics,alisw/AliPhysics,adriansev/AliPhysics,lcunquei/AliPhysics,dmuhlhei/AliPhysics,fcolamar/AliPhysics,akubera/AliPhysics,mvala/AliPhysics,btrzecia/AliPhysics,fcolamar/AliPhysics,carstooon/AliPhysics,mpuccio/AliPhysics,preghenella/AliPhysics,victor-gonzalez/AliPhysics,preghenella/AliPhysics,preghenella/AliPhysics,akubera/AliPhysics,akubera/AliPhysics,amaringarcia/AliPhysics,fcolamar/AliPhysics,kreisl/AliPhysics,mpuccio/AliPhysics,hcab14/AliPhysics,fbellini/AliPhysics,dmuhlhei/AliPhysics,btrzecia/AliPhysics,amatyja/AliPhysics,dmuhlhei/AliPhysics,dmuhlhei/AliPhysics,nschmidtALICE/AliPhysics,rderradi/AliPhysics,pchrista/AliPhysics,amatyja/AliPhysics,lcunquei/AliPhysics,lcunquei/AliPhysics,mpuccio/AliPhysics,fbellini/AliPhysics,hzanoli/AliPhysics,pbuehler/AliPhysics,adriansev/AliPhysics,mpuccio/AliPhysics,amaringarcia/AliPhysics,preghenella/AliPhysics,btrzecia/AliPhysics,mvala/AliPhysics,fcolamar/AliPhysics,SHornung1/AliPhysics,fbellini/AliPhysics,fbellini/AliPhysics,SHornung1/AliPhysics,carstooon/AliPhysics,lcunquei/AliPhysics,rderradi/AliPhysics,preghenella/AliPhysics,mpuccio/AliPhysics,SHornung1/AliPhysics,SHornung1/AliPhysics,amatyja/AliPhysics,victor-gonzalez/AliPhysics,pbuehler/AliPhysics,pbuehler/AliPhysics,carstooon/AliPhysics,hcab14/AliPhysics,sebaleh/AliPhysics,sebaleh/AliPhysics,dmuhlhei/AliPhysics,rihanphys/AliPhysics,akubera/AliPhysics,mvala/AliPhysics,mvala/AliPhysics,hcab14/AliPhysics,hzanoli/AliPhysics,adriansev/AliPhysics,amaringarcia/AliPhysics,nschmidtALICE/AliPhysics,rihanphys/AliPhysics,amatyja/AliPhysics,carstooon/AliPhysics,btrzecia/AliPhysics,kreisl/AliPhysics,btrzecia/AliPhysics,pbuehler/AliPhysics,amaringarcia/AliPhysics,dmuhlhei/AliPhysics,fbellini/AliPhysics,victor-gonzalez/AliPhysics,amatyja/AliPhysics,AMechler/AliPhysics,fbellini/AliPhysics,adriansev/AliPhysics,hzanoli/AliPhysics,AMechler/AliPhysics,pbuehler/AliPhysics,kreisl/AliPhysics,sebaleh/AliPhysics,akubera/AliPhysics,rihanphys/AliPhysics,amaringarcia/AliPhysics,dstocco/AliPhysics | c++ | ## Code Before:
AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(
TString tskname = "LifetimesFiltering", TString suffix = "") {
// Get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskStrangenessLifetimes", "No analysis manager found.");
return 0x0;
}
// Check the analysis type using the event handlers connected to the analysis
// manager.
if (!mgr->GetInputEventHandler()) {
::Error("AddTaskStrangenessLifetimes",
"This task requires an input event handler");
return 0x0;
}
tskname.Append(suffix.Data());
AliAnalysisTaskStrangenessLifetimes *task =
new AliAnalysisTaskStrangenessLifetimes(tskname.Data());
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(
Form("%s_summary", tskname.Data()), TList::Class(),
AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
AliAnalysisDataContainer *coutput2 =
mgr->CreateContainer(Form("V0tree%s", suffix.Data()), TTree::Class(),
AliAnalysisManager::kOutputContainer, "V0tree.root");
coutput2->SetSpecialOutput();
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, coutput1);
mgr->ConnectOutput(task, 2, coutput2);
return task;
}
## Instruction:
Enable MC flag in the AddTask π
## Code After:
AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(bool isMC = false,
TString tskname = "LifetimesFiltering", TString suffix = "") {
// Get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskStrangenessLifetimes", "No analysis manager found.");
return 0x0;
}
// Check the analysis type using the event handlers connected to the analysis
// manager.
if (!mgr->GetInputEventHandler()) {
::Error("AddTaskStrangenessLifetimes",
"This task requires an input event handler");
return 0x0;
}
tskname.Append(suffix.Data());
AliAnalysisTaskStrangenessLifetimes *task =
new AliAnalysisTaskStrangenessLifetimes(isMC, tskname.Data());
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(
Form("%s_summary", tskname.Data()), TList::Class(),
AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
AliAnalysisDataContainer *coutput2 =
mgr->CreateContainer(Form("V0tree%s", suffix.Data()), TTree::Class(),
AliAnalysisManager::kOutputContainer, "V0tree.root");
coutput2->SetSpecialOutput();
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, coutput1);
mgr->ConnectOutput(task, 2, coutput2);
return task;
}
| - AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(
+ AliAnalysisTaskStrangenessLifetimes *AddTaskStrangenessLifetimes(bool isMC = false,
? ++++++++++++++++++
TString tskname = "LifetimesFiltering", TString suffix = "") {
// Get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTaskStrangenessLifetimes", "No analysis manager found.");
return 0x0;
}
// Check the analysis type using the event handlers connected to the analysis
// manager.
if (!mgr->GetInputEventHandler()) {
::Error("AddTaskStrangenessLifetimes",
"This task requires an input event handler");
return 0x0;
}
tskname.Append(suffix.Data());
AliAnalysisTaskStrangenessLifetimes *task =
- new AliAnalysisTaskStrangenessLifetimes(tskname.Data());
+ new AliAnalysisTaskStrangenessLifetimes(isMC, tskname.Data());
? ++++++
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(
Form("%s_summary", tskname.Data()), TList::Class(),
AliAnalysisManager::kOutputContainer, "AnalysisResults.root");
AliAnalysisDataContainer *coutput2 =
mgr->CreateContainer(Form("V0tree%s", suffix.Data()), TTree::Class(),
AliAnalysisManager::kOutputContainer, "V0tree.root");
coutput2->SetSpecialOutput();
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, coutput1);
mgr->ConnectOutput(task, 2, coutput2);
return task;
} | 4 | 0.114286 | 2 | 2 |
30bd8b9b4d18579cdf9b723f82f35987c1ad9176 | __main__.py | __main__.py | from scanresults import ScanResults
import sys
sr = ScanResults()
sr.add_files(*sys.argv[1:])
sr.train()
out = sr.sentences()
if out is not None:
print(out)
| from scanresults import ScanResults
import sys
from argparse import ArgumentParser
parser = ArgumentParser(description='Generate markov text from a corpus')
parser.add_argument('-t','--train', default=2, type=int, metavar='train_n',
help="The size of the Markov state prefix to train the corpus on")
parser.add_argument('-s','--sentences', default=25, type=int, metavar='sentences',
help="The number of sentences to print")
parser.add_argument('corpus_path', nargs="+",
help="Paths to corpus files to train on. Globs are permitted")
args = parser.parse_args()
sr = ScanResults()
sr.add_files(*args.corpus_path)
sr.train(args.train)
out = sr.sentences(args.sentences)
if out is not None:
print(out)
| Enable command-line args for configuration | Enable command-line args for configuration
| Python | bsd-3-clause | darrenpmeyer/scanresults,darrenpmeyer/scanresults | python | ## Code Before:
from scanresults import ScanResults
import sys
sr = ScanResults()
sr.add_files(*sys.argv[1:])
sr.train()
out = sr.sentences()
if out is not None:
print(out)
## Instruction:
Enable command-line args for configuration
## Code After:
from scanresults import ScanResults
import sys
from argparse import ArgumentParser
parser = ArgumentParser(description='Generate markov text from a corpus')
parser.add_argument('-t','--train', default=2, type=int, metavar='train_n',
help="The size of the Markov state prefix to train the corpus on")
parser.add_argument('-s','--sentences', default=25, type=int, metavar='sentences',
help="The number of sentences to print")
parser.add_argument('corpus_path', nargs="+",
help="Paths to corpus files to train on. Globs are permitted")
args = parser.parse_args()
sr = ScanResults()
sr.add_files(*args.corpus_path)
sr.train(args.train)
out = sr.sentences(args.sentences)
if out is not None:
print(out)
| from scanresults import ScanResults
import sys
+ from argparse import ArgumentParser
+
+ parser = ArgumentParser(description='Generate markov text from a corpus')
+ parser.add_argument('-t','--train', default=2, type=int, metavar='train_n',
+ help="The size of the Markov state prefix to train the corpus on")
+ parser.add_argument('-s','--sentences', default=25, type=int, metavar='sentences',
+ help="The number of sentences to print")
+ parser.add_argument('corpus_path', nargs="+",
+ help="Paths to corpus files to train on. Globs are permitted")
+ args = parser.parse_args()
sr = ScanResults()
- sr.add_files(*sys.argv[1:])
+ sr.add_files(*args.corpus_path)
- sr.train()
- out = sr.sentences()
+ sr.train(args.train)
+ out = sr.sentences(args.sentences)
if out is not None:
print(out) | 16 | 1.6 | 13 | 3 |
8f2c8f6e9dec950e0ddd46f563b65f64424cadd1 | erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py | erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py | from frappe import _
def get_data():
return {
'fieldname': 'sales_invoice',
'non_standard_fieldnames': {
'Delivery Note': 'against_sales_invoice',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Sales Invoice': 'return_against'
},
'internal_links': {
'Sales Order': ['items', 'sales_order'],
'Delivery Note': ['items', 'delivery_note']
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
{
'label': _('Reference'),
'items': ['Timesheet', 'Delivery Note', 'Sales Order']
},
{
'label': _('Returns'),
'items': ['Sales Invoice']
},
]
} | from frappe import _
def get_data():
return {
'fieldname': 'sales_invoice',
'non_standard_fieldnames': {
'Delivery Note': 'against_sales_invoice',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Sales Invoice': 'return_against'
},
'internal_links': {
'Sales Order': ['items', 'sales_order']
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
{
'label': _('Reference'),
'items': ['Timesheet', 'Delivery Note', 'Sales Order']
},
{
'label': _('Returns'),
'items': ['Sales Invoice']
},
]
} | Revert sales invoice dn link issue | Revert sales invoice dn link issue
| Python | agpl-3.0 | gsnbng/erpnext,gsnbng/erpnext,Aptitudetech/ERPNext,geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,indictranstech/erpnext,geekroot/erpnext,geekroot/erpnext | python | ## Code Before:
from frappe import _
def get_data():
return {
'fieldname': 'sales_invoice',
'non_standard_fieldnames': {
'Delivery Note': 'against_sales_invoice',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Sales Invoice': 'return_against'
},
'internal_links': {
'Sales Order': ['items', 'sales_order'],
'Delivery Note': ['items', 'delivery_note']
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
{
'label': _('Reference'),
'items': ['Timesheet', 'Delivery Note', 'Sales Order']
},
{
'label': _('Returns'),
'items': ['Sales Invoice']
},
]
}
## Instruction:
Revert sales invoice dn link issue
## Code After:
from frappe import _
def get_data():
return {
'fieldname': 'sales_invoice',
'non_standard_fieldnames': {
'Delivery Note': 'against_sales_invoice',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Sales Invoice': 'return_against'
},
'internal_links': {
'Sales Order': ['items', 'sales_order']
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
{
'label': _('Reference'),
'items': ['Timesheet', 'Delivery Note', 'Sales Order']
},
{
'label': _('Returns'),
'items': ['Sales Invoice']
},
]
} | from frappe import _
def get_data():
return {
'fieldname': 'sales_invoice',
'non_standard_fieldnames': {
'Delivery Note': 'against_sales_invoice',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name',
'Sales Invoice': 'return_against'
},
'internal_links': {
- 'Sales Order': ['items', 'sales_order'],
? -
+ 'Sales Order': ['items', 'sales_order']
- 'Delivery Note': ['items', 'delivery_note']
},
'transactions': [
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
{
'label': _('Reference'),
'items': ['Timesheet', 'Delivery Note', 'Sales Order']
},
{
'label': _('Returns'),
'items': ['Sales Invoice']
},
]
} | 3 | 0.096774 | 1 | 2 |
c9cd06f9bb2a3b7598a49e97bde93e6845394ec7 | gvi/accounts/models.py | gvi/accounts/models.py | from django.db import models
class Currency(models.Model):
name = models.CharField(max_length=25)
contraction = models.CarField(max_length=5)
def __str__(self):
return self.name
class Account(models.Model):
DEFAULT_CURRENCY_ID = 1 # pounds ?
BANK = 'b'
CASH = 'c'
TYPE_CHOICES = (
(BANK, 'Bank'),
(CASH, 'Cash'),
)
account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
bank_name = models.CharField(max_length=25, blank=True)
number = models.CharField(max_length=140, blank=True)
balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
active = models.BooleanField(initial=True)
#add the account owner
def __str__(self):
if(account_type == 'b')
return self.number
else
return self.currency
| from django.db import models
import datetime
class Currency(models.Model):
name = models.CharField(max_length=25)
contraction = models.CarField(max_length=5)
def __str__(self):
return self.name
class Account(models.Model):
DEFAULT_CURRENCY_ID = 1 # pounds ?
BANK = 'b'
CASH = 'c'
TYPE_CHOICES = (
(BANK, 'Bank'),
(CASH, 'Cash'),
)
account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
bank_name = models.CharField(max_length=25, blank=True)
number = models.CharField(max_length=140, blank=True)
balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
active = models.BooleanField(initial=True)
#add the account owner
def __str__(self):
if account_type == 'b'
return self.number
else
return self.currency
class Transfer(models.Model):
from_account = models.ForeignKey(Account)
to_account = models.ForeignKey(Account)
amount = models.DecimalField(decimal_places=10, max_digits=19)
exchange_rate = models.DecimalField(decimal_places=10, max_digits=19)
date = models.DateTimeField(default=datetime.now())
def __str__(self):
return self.amount
| Create the transfer model of accounts | Create the transfer model of accounts
| Python | mit | m1k3r/gvi-accounts,m1k3r/gvi-accounts,m1k3r/gvi-accounts | python | ## Code Before:
from django.db import models
class Currency(models.Model):
name = models.CharField(max_length=25)
contraction = models.CarField(max_length=5)
def __str__(self):
return self.name
class Account(models.Model):
DEFAULT_CURRENCY_ID = 1 # pounds ?
BANK = 'b'
CASH = 'c'
TYPE_CHOICES = (
(BANK, 'Bank'),
(CASH, 'Cash'),
)
account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
bank_name = models.CharField(max_length=25, blank=True)
number = models.CharField(max_length=140, blank=True)
balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
active = models.BooleanField(initial=True)
#add the account owner
def __str__(self):
if(account_type == 'b')
return self.number
else
return self.currency
## Instruction:
Create the transfer model of accounts
## Code After:
from django.db import models
import datetime
class Currency(models.Model):
name = models.CharField(max_length=25)
contraction = models.CarField(max_length=5)
def __str__(self):
return self.name
class Account(models.Model):
DEFAULT_CURRENCY_ID = 1 # pounds ?
BANK = 'b'
CASH = 'c'
TYPE_CHOICES = (
(BANK, 'Bank'),
(CASH, 'Cash'),
)
account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
bank_name = models.CharField(max_length=25, blank=True)
number = models.CharField(max_length=140, blank=True)
balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
active = models.BooleanField(initial=True)
#add the account owner
def __str__(self):
if account_type == 'b'
return self.number
else
return self.currency
class Transfer(models.Model):
from_account = models.ForeignKey(Account)
to_account = models.ForeignKey(Account)
amount = models.DecimalField(decimal_places=10, max_digits=19)
exchange_rate = models.DecimalField(decimal_places=10, max_digits=19)
date = models.DateTimeField(default=datetime.now())
def __str__(self):
return self.amount
| from django.db import models
+ import datetime
class Currency(models.Model):
name = models.CharField(max_length=25)
contraction = models.CarField(max_length=5)
def __str__(self):
return self.name
class Account(models.Model):
DEFAULT_CURRENCY_ID = 1 # pounds ?
BANK = 'b'
CASH = 'c'
TYPE_CHOICES = (
(BANK, 'Bank'),
(CASH, 'Cash'),
)
account_type = models.CharField(max_length=5, choices=TYPE_CHOICES, default=CASH)
bank_name = models.CharField(max_length=25, blank=True)
number = models.CharField(max_length=140, blank=True)
balance = models.DecimalField(decimal_places=10, max_digits=19, default=0)
currency = models.ForeignKey(Currency, default=DEFAULT_CURRENCY_ID)
active = models.BooleanField(initial=True)
#add the account owner
def __str__(self):
- if(account_type == 'b')
? ^ -
+ if account_type == 'b'
? ^
return self.number
else
- return self.currency
+ return self.currency
? +
+
+
+ class Transfer(models.Model):
+ from_account = models.ForeignKey(Account)
+ to_account = models.ForeignKey(Account)
+ amount = models.DecimalField(decimal_places=10, max_digits=19)
+ exchange_rate = models.DecimalField(decimal_places=10, max_digits=19)
+ date = models.DateTimeField(default=datetime.now())
+
+ def __str__(self):
+ return self.amount | 16 | 0.516129 | 14 | 2 |
95b459ce5f4d614a5bdd0805c44d11f5bfdc77ff | travis-init.sh | travis-init.sh | set -e
set -o pipefail
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" &&
"$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
# install "libevent" (used by 'event' and 'libevent' PHP extensions)
sudo apt-get install -y libevent-dev
# install 'event' PHP extension
echo "yes" | pecl install event
# install 'libevent' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
# install 'libev' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
make install
popd
echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
fi
composer install --prefer-source
| set -e
set -o pipefail
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" &&
"$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
# install "libevent" (used by 'event' and 'libevent' PHP extensions)
sudo apt-get install -y libevent-dev
# install 'event' PHP extension
echo "yes" | pecl install event
# install 'libevent' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
# install 'libev' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
make install
popd
echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
fi
composer install
| Remove --prefer-source from composer install | Remove --prefer-source from composer install
| Shell | mit | kaduev13/event-loop,clue-labs/event-loop,kaduev13/event-loop,reactphp/event-loop | shell | ## Code Before:
set -e
set -o pipefail
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" &&
"$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
# install "libevent" (used by 'event' and 'libevent' PHP extensions)
sudo apt-get install -y libevent-dev
# install 'event' PHP extension
echo "yes" | pecl install event
# install 'libevent' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
# install 'libev' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
make install
popd
echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
fi
composer install --prefer-source
## Instruction:
Remove --prefer-source from composer install
## Code After:
set -e
set -o pipefail
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" &&
"$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
# install "libevent" (used by 'event' and 'libevent' PHP extensions)
sudo apt-get install -y libevent-dev
# install 'event' PHP extension
echo "yes" | pecl install event
# install 'libevent' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
# install 'libev' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
make install
popd
echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
fi
composer install
| set -e
set -o pipefail
if [[ "$TRAVIS_PHP_VERSION" != "hhvm" &&
"$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]]; then
# install "libevent" (used by 'event' and 'libevent' PHP extensions)
sudo apt-get install -y libevent-dev
# install 'event' PHP extension
echo "yes" | pecl install event
# install 'libevent' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
# install 'libev' PHP extension (does not support php 7)
if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]]; then
git clone --recursive https://github.com/m4rw3r/php-libev
pushd php-libev
phpize
./configure --with-libev
make
make install
popd
echo "extension=libev.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
fi
- composer install --prefer-source
+ composer install | 2 | 0.051282 | 1 | 1 |
4ed69e4568060ce796c133dd7ca345c5ce37169f | spec/controllers/course/levels_controller_spec.rb | spec/controllers/course/levels_controller_spec.rb | require 'rails_helper'
RSpec.describe Course::LevelsController, type: :controller do
let!(:instance) { create(:instance) }
with_tenant(:instance) do
let!(:user) { create(:administrator) }
let!(:course) { create(:course) }
let!(:level_stub) do
stub = create(:course_level, course: course)
allow(stub).to receive(:save).and_return(false)
allow(stub).to receive(:destroy).and_return(false)
stub
end
before { sign_in(user) }
describe '#destroy' do
subject { delete :destroy, course_id: course, id: level_stub }
context 'upon destroy failure' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it 'redirects with a flash message' do
it { is_expected.to redirect_to(course_levels_path(course)) }
expect(flash[:danger]).to eq(I18n.t('course.levels.destroy.failure', error: ''))
end
end
end
describe '#save' do
subject { post :create, course_id: course, level: level_stub }
context 'upon save failure' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it { is_expected.to render_template('new') }
end
end
end
end
| require 'rails_helper'
RSpec.describe Course::LevelsController, type: :controller do
let!(:instance) { create(:instance) }
with_tenant(:instance) do
let!(:user) { create(:administrator) }
let!(:course) { create(:course) }
let!(:level_stub) do
stub = create(:course_level, course: course)
allow(stub).to receive(:save).and_return(false)
allow(stub).to receive(:destroy).and_return(false)
stub
end
before { sign_in(user) }
describe '#destroy' do
subject { delete :destroy, course_id: course, id: level_stub }
context 'when destroy fails' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it 'redirects with a flash message' do
it { is_expected.to redirect_to(course_levels_path(course)) }
expect(flash[:danger]).to eq(I18n.t('course.levels.destroy.failure', error: ''))
end
end
end
describe '#save' do
subject { post :create, course_id: course, level: level_stub }
context 'when saving fails' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it { is_expected.to render_template('new') }
end
end
end
end
| Rephrase in level controller spec | Rephrase in level controller spec
| Ruby | mit | harryggg/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,cysjonathan/coursemology2,xzhflying/coursemology2,harryggg/coursemology2,xzhflying/coursemology2,cysjonathan/coursemology2,Coursemology/coursemology2,BenMQ/coursemology2,harryggg/coursemology2,xzhflying/coursemology2,cysjonathan/coursemology2,BenMQ/coursemology2,BenMQ/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2 | ruby | ## Code Before:
require 'rails_helper'
RSpec.describe Course::LevelsController, type: :controller do
let!(:instance) { create(:instance) }
with_tenant(:instance) do
let!(:user) { create(:administrator) }
let!(:course) { create(:course) }
let!(:level_stub) do
stub = create(:course_level, course: course)
allow(stub).to receive(:save).and_return(false)
allow(stub).to receive(:destroy).and_return(false)
stub
end
before { sign_in(user) }
describe '#destroy' do
subject { delete :destroy, course_id: course, id: level_stub }
context 'upon destroy failure' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it 'redirects with a flash message' do
it { is_expected.to redirect_to(course_levels_path(course)) }
expect(flash[:danger]).to eq(I18n.t('course.levels.destroy.failure', error: ''))
end
end
end
describe '#save' do
subject { post :create, course_id: course, level: level_stub }
context 'upon save failure' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it { is_expected.to render_template('new') }
end
end
end
end
## Instruction:
Rephrase in level controller spec
## Code After:
require 'rails_helper'
RSpec.describe Course::LevelsController, type: :controller do
let!(:instance) { create(:instance) }
with_tenant(:instance) do
let!(:user) { create(:administrator) }
let!(:course) { create(:course) }
let!(:level_stub) do
stub = create(:course_level, course: course)
allow(stub).to receive(:save).and_return(false)
allow(stub).to receive(:destroy).and_return(false)
stub
end
before { sign_in(user) }
describe '#destroy' do
subject { delete :destroy, course_id: course, id: level_stub }
context 'when destroy fails' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it 'redirects with a flash message' do
it { is_expected.to redirect_to(course_levels_path(course)) }
expect(flash[:danger]).to eq(I18n.t('course.levels.destroy.failure', error: ''))
end
end
end
describe '#save' do
subject { post :create, course_id: course, level: level_stub }
context 'when saving fails' do
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it { is_expected.to render_template('new') }
end
end
end
end
| require 'rails_helper'
RSpec.describe Course::LevelsController, type: :controller do
let!(:instance) { create(:instance) }
with_tenant(:instance) do
let!(:user) { create(:administrator) }
let!(:course) { create(:course) }
let!(:level_stub) do
stub = create(:course_level, course: course)
allow(stub).to receive(:save).and_return(false)
allow(stub).to receive(:destroy).and_return(false)
stub
end
before { sign_in(user) }
describe '#destroy' do
subject { delete :destroy, course_id: course, id: level_stub }
- context 'upon destroy failure' do
? ^^^ ^^^
+ context 'when destroy fails' do
? ^^^ ^
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it 'redirects with a flash message' do
it { is_expected.to redirect_to(course_levels_path(course)) }
expect(flash[:danger]).to eq(I18n.t('course.levels.destroy.failure', error: ''))
end
end
end
describe '#save' do
subject { post :create, course_id: course, level: level_stub }
- context 'upon save failure' do
? ^^^ ^ ^^^
+ context 'when saving fails' do
? ^^^ ^^^ ^
before do
controller.instance_variable_set(:@level, level_stub)
subject
end
it { is_expected.to render_template('new') }
end
end
end
end | 4 | 0.085106 | 2 | 2 |
69304be6df25ba2db53985b3d1e2e66954b7d655 | genes/lib/traits.py | genes/lib/traits.py | from functools import wraps
def if_any(*conds):
def wrapper(func):
@wraps
def run_if_any(*args, **kwargs):
if any(conds):
return func(*args, **kwargs)
return run_if_any
return wrapper
def if_all(*conds):
def wrapper(func):
@wraps
def run_if_all(*args, **kwargs):
if all(conds):
return func(*args, **kwargs)
return run_if_all
return wrapper
| from functools import wraps
def if_any(*conds):
def wrapper(func):
@wraps(func)
def run_if_any(*args, **kwargs):
if any(conds):
return func(*args, **kwargs)
return run_if_any
return wrapper
def if_all(*conds):
def wrapper(func):
@wraps(func)
def run_if_all(*args, **kwargs):
if all(conds):
return func(*args, **kwargs)
return run_if_all
return wrapper
| Add argument to @wraps decorator | Add argument to @wraps decorator
| Python | mit | hatchery/Genepool2,hatchery/genepool | python | ## Code Before:
from functools import wraps
def if_any(*conds):
def wrapper(func):
@wraps
def run_if_any(*args, **kwargs):
if any(conds):
return func(*args, **kwargs)
return run_if_any
return wrapper
def if_all(*conds):
def wrapper(func):
@wraps
def run_if_all(*args, **kwargs):
if all(conds):
return func(*args, **kwargs)
return run_if_all
return wrapper
## Instruction:
Add argument to @wraps decorator
## Code After:
from functools import wraps
def if_any(*conds):
def wrapper(func):
@wraps(func)
def run_if_any(*args, **kwargs):
if any(conds):
return func(*args, **kwargs)
return run_if_any
return wrapper
def if_all(*conds):
def wrapper(func):
@wraps(func)
def run_if_all(*args, **kwargs):
if all(conds):
return func(*args, **kwargs)
return run_if_all
return wrapper
| from functools import wraps
def if_any(*conds):
def wrapper(func):
- @wraps
+ @wraps(func)
? ++++++
def run_if_any(*args, **kwargs):
if any(conds):
return func(*args, **kwargs)
return run_if_any
return wrapper
def if_all(*conds):
def wrapper(func):
- @wraps
+ @wraps(func)
? ++++++
def run_if_all(*args, **kwargs):
if all(conds):
return func(*args, **kwargs)
return run_if_all
return wrapper | 4 | 0.190476 | 2 | 2 |
9211276aa30d208111f3ee7f2f54703163cc867e | README.md | README.md |
A command line tool for executing custom python scripts.
## Getting Started
* Install clr
```
$ pip install git+https://github.com/ColorGenomics/[email protected]
```
* Create a custom command
```
# clr_commands/say.py
class Commands(object):
descr = "say commands"
def cmd_hello_world(self):
print "hello world!"
COMMANDS = Commands()
```
* Create clrfile.py in your root directory
```
# clrfile.py
commands = {
'say': 'clr_commands.say',
}
```
* Run your command
```
$ clr say:hello_world
> hello world!
```
## Useful commands
* Get available namespaces
```
$ clr help
```
* Get available commands in a namespace
```
$ clr help namespace
```
|
A command line tool for executing custom python scripts.
## Getting Started
* Install clr
```
$ pip install git+https://github.com/ColorGenomics/[email protected]
```
* Create a custom command
```
# color/src/clr_commands/say.py
class Commands(object):
descr = "say commands"
def cmd_hello_world(self):
print "hello world!"
COMMANDS = Commands()
```
* Create clrfile.py in your root directory
```
# color/clrfile.py
commands = {
'say': 'clr_commands.say',
}
```
* Run your command
```
$ clr say:hello_world
> hello world!
```
## Useful commands
* Get available namespaces
```
$ clr help
```
* Get available commands in a namespace
```
$ clr help namespace
```
| Make pathnames in comments more explicit | Make pathnames in comments more explicit
| Markdown | mit | ColorGenomics/clr | markdown | ## Code Before:
A command line tool for executing custom python scripts.
## Getting Started
* Install clr
```
$ pip install git+https://github.com/ColorGenomics/[email protected]
```
* Create a custom command
```
# clr_commands/say.py
class Commands(object):
descr = "say commands"
def cmd_hello_world(self):
print "hello world!"
COMMANDS = Commands()
```
* Create clrfile.py in your root directory
```
# clrfile.py
commands = {
'say': 'clr_commands.say',
}
```
* Run your command
```
$ clr say:hello_world
> hello world!
```
## Useful commands
* Get available namespaces
```
$ clr help
```
* Get available commands in a namespace
```
$ clr help namespace
```
## Instruction:
Make pathnames in comments more explicit
## Code After:
A command line tool for executing custom python scripts.
## Getting Started
* Install clr
```
$ pip install git+https://github.com/ColorGenomics/[email protected]
```
* Create a custom command
```
# color/src/clr_commands/say.py
class Commands(object):
descr = "say commands"
def cmd_hello_world(self):
print "hello world!"
COMMANDS = Commands()
```
* Create clrfile.py in your root directory
```
# color/clrfile.py
commands = {
'say': 'clr_commands.say',
}
```
* Run your command
```
$ clr say:hello_world
> hello world!
```
## Useful commands
* Get available namespaces
```
$ clr help
```
* Get available commands in a namespace
```
$ clr help namespace
```
|
A command line tool for executing custom python scripts.
## Getting Started
* Install clr
```
$ pip install git+https://github.com/ColorGenomics/[email protected]
```
* Create a custom command
```
- # clr_commands/say.py
+ # color/src/clr_commands/say.py
? ++++++++++
class Commands(object):
descr = "say commands"
def cmd_hello_world(self):
print "hello world!"
COMMANDS = Commands()
```
* Create clrfile.py in your root directory
```
- # clrfile.py
+ # color/clrfile.py
? ++++++
commands = {
'say': 'clr_commands.say',
}
```
* Run your command
```
$ clr say:hello_world
> hello world!
```
## Useful commands
* Get available namespaces
```
$ clr help
```
* Get available commands in a namespace
```
$ clr help namespace
``` | 4 | 0.086957 | 2 | 2 |
3270d30dc7289936aaa0041bfbd2d94c16ec9e5f | components/simple_contact/templates/contact_partner.jade | components/simple_contact/templates/contact_partner.jade | header.scontact-header
h1.scontact-headline
| Send message to #{partner.displayType().toLowerCase()}
hr
p.scontact-description
| To: #{partner.get('name')}
span.js-contact-location
//- Rendered separately?
hr
include forms/inquiry
| header.scontact-header
h1.scontact-headline
| Send message to #{artwork.related().partner.displayType().toLowerCase()}
hr
p.scontact-description
| To: #{artwork.related().partner.get('name')}
span.js-contact-location
//- Rendered separately?
hr
include forms/inquiry
| Work of the partner attached on the artwork rather than having to pass it in | Work of the partner attached on the artwork rather than having to pass it in
| Jade | mit | oxaudo/force,cavvia/force-1,dblock/force,xtina-starr/force,artsy/force,cavvia/force-1,xtina-starr/force,mzikherman/force,joeyAghion/force,cavvia/force-1,yuki24/force,damassi/force,yuki24/force,kanaabe/force,yuki24/force,joeyAghion/force,eessex/force,damassi/force,izakp/force,artsy/force-public,oxaudo/force,erikdstock/force,izakp/force,yuki24/force,damassi/force,izakp/force,erikdstock/force,izakp/force,kanaabe/force,oxaudo/force,dblock/force,TribeMedia/force-public,TribeMedia/force-public,cavvia/force-1,artsy/force,xtina-starr/force,artsy/force-public,mzikherman/force,dblock/force,erikdstock/force,artsy/force,joeyAghion/force,xtina-starr/force,anandaroop/force,kanaabe/force,anandaroop/force,artsy/force,oxaudo/force,eessex/force,mzikherman/force,eessex/force,kanaabe/force,eessex/force,erikdstock/force,anandaroop/force,joeyAghion/force,damassi/force,mzikherman/force,anandaroop/force,kanaabe/force | jade | ## Code Before:
header.scontact-header
h1.scontact-headline
| Send message to #{partner.displayType().toLowerCase()}
hr
p.scontact-description
| To: #{partner.get('name')}
span.js-contact-location
//- Rendered separately?
hr
include forms/inquiry
## Instruction:
Work of the partner attached on the artwork rather than having to pass it in
## Code After:
header.scontact-header
h1.scontact-headline
| Send message to #{artwork.related().partner.displayType().toLowerCase()}
hr
p.scontact-description
| To: #{artwork.related().partner.get('name')}
span.js-contact-location
//- Rendered separately?
hr
include forms/inquiry
| header.scontact-header
h1.scontact-headline
- | Send message to #{partner.displayType().toLowerCase()}
+ | Send message to #{artwork.related().partner.displayType().toLowerCase()}
? ++++++++++++++++++
hr
p.scontact-description
- | To: #{partner.get('name')}
+ | To: #{artwork.related().partner.get('name')}
? ++++++++++++++++++
span.js-contact-location
//- Rendered separately?
hr
include forms/inquiry | 4 | 0.285714 | 2 | 2 |
2490f008daff03f07f55ce62124dc2f30e4ea4b5 | README.md | README.md | webWorkerPool
=============
webWorkerPool.js a rudimentary web worker pool
| webWorkerPool
=============
webWorkerPool.js a rudimentary implementation of a web worker pool (thread pool) and an easy way to execute your functions in a multithreaded manner
## Usage
Simply create a WorkerPool:
```javascript
var myPool = new WorkerPool(2);
```
add tasks to the pool:
```javascrip
myPool.fnExecute(yourFunction, callbackMethod, param);
myPool.fnExecute(yourOtherFunction, callbackMethod, paramOne, paramTwo);
myPool.fnExecute(yourFunction, callbackMethod, param);
```
Since we are adding three tasks to a pool containing only two threads it is likely that the workers are still busy when the third task is added. The pool will run this task as soon as one of the workers is available.
You are able to close the pool whenever you want:
```javascript
myPool.fnClose();
```
If you close the pool and either tasks are waiting for execution or are being executed at the moment, the execution of all tasks will be finished before the pool gets closed. After calling fnClose no new tasks can be added. | Add usage paragraph to readme | Add usage paragraph to readme
| Markdown | mit | Bensk1/webWorkerPool | markdown | ## Code Before:
webWorkerPool
=============
webWorkerPool.js a rudimentary web worker pool
## Instruction:
Add usage paragraph to readme
## Code After:
webWorkerPool
=============
webWorkerPool.js a rudimentary implementation of a web worker pool (thread pool) and an easy way to execute your functions in a multithreaded manner
## Usage
Simply create a WorkerPool:
```javascript
var myPool = new WorkerPool(2);
```
add tasks to the pool:
```javascrip
myPool.fnExecute(yourFunction, callbackMethod, param);
myPool.fnExecute(yourOtherFunction, callbackMethod, paramOne, paramTwo);
myPool.fnExecute(yourFunction, callbackMethod, param);
```
Since we are adding three tasks to a pool containing only two threads it is likely that the workers are still busy when the third task is added. The pool will run this task as soon as one of the workers is available.
You are able to close the pool whenever you want:
```javascript
myPool.fnClose();
```
If you close the pool and either tasks are waiting for execution or are being executed at the moment, the execution of all tasks will be finished before the pool gets closed. After calling fnClose no new tasks can be added. | webWorkerPool
=============
- webWorkerPool.js a rudimentary web worker pool
+ webWorkerPool.js a rudimentary implementation of a web worker pool (thread pool) and an easy way to execute your functions in a multithreaded manner
+
+ ## Usage
+
+ Simply create a WorkerPool:
+
+ ```javascript
+ var myPool = new WorkerPool(2);
+ ```
+
+ add tasks to the pool:
+
+ ```javascrip
+ myPool.fnExecute(yourFunction, callbackMethod, param);
+ myPool.fnExecute(yourOtherFunction, callbackMethod, paramOne, paramTwo);
+ myPool.fnExecute(yourFunction, callbackMethod, param);
+ ```
+
+ Since we are adding three tasks to a pool containing only two threads it is likely that the workers are still busy when the third task is added. The pool will run this task as soon as one of the workers is available.
+
+ You are able to close the pool whenever you want:
+
+ ```javascript
+ myPool.fnClose();
+ ```
+
+ If you close the pool and either tasks are waiting for execution or are being executed at the moment, the execution of all tasks will be finished before the pool gets closed. After calling fnClose no new tasks can be added. | 28 | 7 | 27 | 1 |
bb37ef87d573ebd6fa925ddfcfe146a9d350483c | .travis.yml | .travis.yml | language: node_js
dist: trusty
cache: yarn
env:
global:
- CXX=g++-4.8
jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 7
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- shellcheck bin/*
language: generic
- env: task=doctoc
install: npm install doctoc
script:
- cp README.md README.md.orig
- npm run doctoc
- diff -q README.md README.md.orig
language: generic
- env: task=json-lint
install: npm install jsonlint
script:
- npm run jsonlint
language: generic
| language: node_js
dist: trusty
cache: yarn
env:
global:
- CXX=g++-4.8
- YARN_VERSION=1.3.2
jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 7
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- shellcheck bin/*
language: generic
- env: task=doctoc
install: npm install doctoc
script:
- cp README.md README.md.orig
- npm run doctoc
- diff -q README.md README.md.orig
language: generic
- env: task=json-lint
install: npm install jsonlint
script:
- npm run jsonlint
language: generic
| Fix build problem by updating yarn version | Fix build problem by updating yarn version
| YAML | unknown | PeterDaveHello/hackmd,jackycute/HackMD,hackmdio/hackmd,Yukaii/hackmd,PeterDaveHello/hackmd,hackmdio/hackmd,Yukaii/hackmd,Yukaii/hackmd,hackmdio/hackmd,jackycute/HackMD,jackycute/HackMD,PeterDaveHello/hackmd | yaml | ## Code Before:
language: node_js
dist: trusty
cache: yarn
env:
global:
- CXX=g++-4.8
jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 7
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- shellcheck bin/*
language: generic
- env: task=doctoc
install: npm install doctoc
script:
- cp README.md README.md.orig
- npm run doctoc
- diff -q README.md README.md.orig
language: generic
- env: task=json-lint
install: npm install jsonlint
script:
- npm run jsonlint
language: generic
## Instruction:
Fix build problem by updating yarn version
## Code After:
language: node_js
dist: trusty
cache: yarn
env:
global:
- CXX=g++-4.8
- YARN_VERSION=1.3.2
jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 7
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- shellcheck bin/*
language: generic
- env: task=doctoc
install: npm install doctoc
script:
- cp README.md README.md.orig
- npm run doctoc
- diff -q README.md README.md.orig
language: generic
- env: task=json-lint
install: npm install jsonlint
script:
- npm run jsonlint
language: generic
| language: node_js
dist: trusty
cache: yarn
env:
global:
- CXX=g++-4.8
+ - YARN_VERSION=1.3.2
jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
? ^^^^^
+ - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
? ^^^^^^^^^^^^^^^
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 7
before_install:
- - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.1.0
? ^^^^^
+ - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
? ^^^^^^^^^^^^^^^
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- shellcheck bin/*
language: generic
- env: task=doctoc
install: npm install doctoc
script:
- cp README.md README.md.orig
- npm run doctoc
- diff -q README.md README.md.orig
language: generic
- env: task=json-lint
install: npm install jsonlint
script:
- npm run jsonlint
language: generic | 5 | 0.135135 | 3 | 2 |
b9595f23a4e0577e1ea60ffeaae2afd0bb36e395 | sass/variables.scss | sass/variables.scss | //
// Variables
// --------------------------------------------------
// Type
// --------------------------------------------------
$font-family-default: "Helvetica Neue", Helvetica, sans-serif !default;
$font-size-default: 17px !default;
$font-weight: 500 !default;
$font-weight-light: 400 !default;
$line-height-default: 21px !default;
// Colors
// --------------------------------------------------
// Main theme colors
$primary-color: #428bca !default;
$chrome-color: #fff !default;
// Action colors
$default-color: #fff !default;
$positive-color: #5cb85c !default;
$negative-color: #d9534f !default;
// Bars
// --------------------------------------------------
$bar-base-height: 44px !default;
$bar-tab-height: 50px !default;
$bar-side-spacing: 10px !default;
// Cards
// --------------------------------------------------
$card-bg: #fff !default;
// Buttons
// --------------------------------------------------
$button-font-size: 12px !default;
// Transitions
// --------------------------------------------------
$timing-fuction: cubic-bezier(.1,.5,.1,1) !default; // Inspired by @c2prods
// Borders
// --------------------------------------------------
$border-default: 1px solid #ddd !default;
$border-radius: 6px !default;
| //
// Variables
// --------------------------------------------------
// Type
// --------------------------------------------------
$font-family-default: "Helvetica Neue", Helvetica, sans-serif !default;
$font-size-default: 17px !default;
$font-weight: 500 !default;
$font-weight-light: 400 !default;
$line-height-default: 21px !default;
// Colors
// --------------------------------------------------
// Main theme colors
$primary-color: #428bca !default;
$chrome-color: #fff !default;
// Action colors
$default-color: #fff !default;
$positive-color: #5cb85c !default;
$negative-color: #d9534f !default;
// Bars
// --------------------------------------------------
$bar-base-height: 44px !default;
$bar-tab-height: 50px !default;
$bar-side-spacing: 10px !default;
// Cards
// --------------------------------------------------
$card-bg: #fff !default;
// Buttons
// --------------------------------------------------
$button-font-size: 12px !default;
// Transitions
// --------------------------------------------------
$timing-fuction: cubic-bezier(.1,.5,.1,1) !default; // Inspired by @c2prods
// Borders
// --------------------------------------------------
$border-default-width: 1px;
$border-default: $border-default-width solid #ddd;
$border-radius: 6px !default;
| Split border-width into separate variable | Split border-width into separate variable
| SCSS | mit | Diaosir/ratchet,AndBicScadMedia/ratchet,liangxiaojuan/ratchet,vebin/ratchet,Artea/ratchet,aisakeniudun/ratchet,cslgjiangjinjian/ratchet,Holism/ratchet,jamesrom/ratchet,mazong1123/ratchet-pro,jackyzonewen/ratchet,isathish/ratchet,wallynm/ratchet,kkirsche/ratchet,youzaiyouzai666/ratchet,mazong1123/ratchet-pro,tranc99/ratchet,calvintychan/ratchet,twbs/ratchet,leplatrem/ratchet,asonni/ratchet,ctkjose/ratchet-1,AladdinSonni/ratchet,guohuadeng/ratchet,jimjin/ratchet,arnoo/ratchet,mbowie5/playground2,youprofit/ratchet,Joozo/ratchet,coderstudy/ratchet,twbs/ratchet,hashg/ratchet,Samda/ratchet | scss | ## Code Before:
//
// Variables
// --------------------------------------------------
// Type
// --------------------------------------------------
$font-family-default: "Helvetica Neue", Helvetica, sans-serif !default;
$font-size-default: 17px !default;
$font-weight: 500 !default;
$font-weight-light: 400 !default;
$line-height-default: 21px !default;
// Colors
// --------------------------------------------------
// Main theme colors
$primary-color: #428bca !default;
$chrome-color: #fff !default;
// Action colors
$default-color: #fff !default;
$positive-color: #5cb85c !default;
$negative-color: #d9534f !default;
// Bars
// --------------------------------------------------
$bar-base-height: 44px !default;
$bar-tab-height: 50px !default;
$bar-side-spacing: 10px !default;
// Cards
// --------------------------------------------------
$card-bg: #fff !default;
// Buttons
// --------------------------------------------------
$button-font-size: 12px !default;
// Transitions
// --------------------------------------------------
$timing-fuction: cubic-bezier(.1,.5,.1,1) !default; // Inspired by @c2prods
// Borders
// --------------------------------------------------
$border-default: 1px solid #ddd !default;
$border-radius: 6px !default;
## Instruction:
Split border-width into separate variable
## Code After:
//
// Variables
// --------------------------------------------------
// Type
// --------------------------------------------------
$font-family-default: "Helvetica Neue", Helvetica, sans-serif !default;
$font-size-default: 17px !default;
$font-weight: 500 !default;
$font-weight-light: 400 !default;
$line-height-default: 21px !default;
// Colors
// --------------------------------------------------
// Main theme colors
$primary-color: #428bca !default;
$chrome-color: #fff !default;
// Action colors
$default-color: #fff !default;
$positive-color: #5cb85c !default;
$negative-color: #d9534f !default;
// Bars
// --------------------------------------------------
$bar-base-height: 44px !default;
$bar-tab-height: 50px !default;
$bar-side-spacing: 10px !default;
// Cards
// --------------------------------------------------
$card-bg: #fff !default;
// Buttons
// --------------------------------------------------
$button-font-size: 12px !default;
// Transitions
// --------------------------------------------------
$timing-fuction: cubic-bezier(.1,.5,.1,1) !default; // Inspired by @c2prods
// Borders
// --------------------------------------------------
$border-default-width: 1px;
$border-default: $border-default-width solid #ddd;
$border-radius: 6px !default;
| //
// Variables
// --------------------------------------------------
// Type
// --------------------------------------------------
$font-family-default: "Helvetica Neue", Helvetica, sans-serif !default;
$font-size-default: 17px !default;
$font-weight: 500 !default;
$font-weight-light: 400 !default;
$line-height-default: 21px !default;
// Colors
// --------------------------------------------------
// Main theme colors
$primary-color: #428bca !default;
$chrome-color: #fff !default;
// Action colors
$default-color: #fff !default;
$positive-color: #5cb85c !default;
$negative-color: #d9534f !default;
// Bars
// --------------------------------------------------
$bar-base-height: 44px !default;
$bar-tab-height: 50px !default;
$bar-side-spacing: 10px !default;
// Cards
// --------------------------------------------------
$card-bg: #fff !default;
// Buttons
// --------------------------------------------------
$button-font-size: 12px !default;
// Transitions
// --------------------------------------------------
$timing-fuction: cubic-bezier(.1,.5,.1,1) !default; // Inspired by @c2prods
// Borders
// --------------------------------------------------
- $border-default: 1px solid #ddd !default;
+ $border-default-width: 1px;
+ $border-default: $border-default-width solid #ddd;
$border-radius: 6px !default; | 3 | 0.051724 | 2 | 1 |
102097447406ec337bbe03efd7ee3115f867a028 | src/CssInlinerPlugin.php | src/CssInlinerPlugin.php | <?php
namespace Fedeisas\LaravelMailCssInliner;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class CssInlinerPlugin implements \Swift_Events_SendListener
{
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
$converter->setEncoding($message->getCharset());
$converter->setUseInlineStylesBlock();
$converter->setCleanup();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
/**
* Do nothing
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
// Do Nothing
}
}
| <?php
namespace Fedeisas\LaravelMailCssInliner;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class CssInlinerPlugin implements \Swift_Events_SendListener
{
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
$converter->setUseInlineStylesBlock();
$converter->setStripOriginalStyleTags();
$converter->setCleanup();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
/**
* Do nothing
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
// Do Nothing
}
}
| Remove deprecated reference + always cleanup the <style> block | Feature: Remove deprecated reference + always cleanup the <style> block
| PHP | mit | fedeisas/laravel-mail-css-inliner | php | ## Code Before:
<?php
namespace Fedeisas\LaravelMailCssInliner;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class CssInlinerPlugin implements \Swift_Events_SendListener
{
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
$converter->setEncoding($message->getCharset());
$converter->setUseInlineStylesBlock();
$converter->setCleanup();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
/**
* Do nothing
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
// Do Nothing
}
}
## Instruction:
Feature: Remove deprecated reference + always cleanup the <style> block
## Code After:
<?php
namespace Fedeisas\LaravelMailCssInliner;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class CssInlinerPlugin implements \Swift_Events_SendListener
{
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
$converter->setUseInlineStylesBlock();
$converter->setStripOriginalStyleTags();
$converter->setCleanup();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
/**
* Do nothing
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
// Do Nothing
}
}
| <?php
namespace Fedeisas\LaravelMailCssInliner;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class CssInlinerPlugin implements \Swift_Events_SendListener
{
/**
* @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$converter = new CssToInlineStyles();
- $converter->setEncoding($message->getCharset());
$converter->setUseInlineStylesBlock();
+ $converter->setStripOriginalStyleTags();
+
$converter->setCleanup();
if ($message->getContentType() === 'text/html' ||
($message->getContentType() === 'multipart/alternative' && $message->getBody())
) {
$converter->setHTML($message->getBody());
$message->setBody($converter->convert());
}
foreach ($message->getChildren() as $part) {
if (strpos($part->getContentType(), 'text/html') === 0) {
$converter->setHTML($part->getBody());
$part->setBody($converter->convert());
}
}
}
/**
* Do nothing
*
* @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(\Swift_Events_SendEvent $evt)
{
// Do Nothing
}
} | 3 | 0.066667 | 2 | 1 |
331b3987ba09db5d8f774509bedd30c3c6522795 | ooni/tests/test_utils.py | ooni/tests/test_utils.py | import os
import unittest
from ooni.utils import pushFilenameStack
class TestUtils(unittest.TestCase):
def test_pushFilenameStack(self):
basefilename = os.path.join(os.getcwd(), 'dummyfile')
f = open(basefilename, "w+")
f.write("0\n")
f.close()
for i in xrange(1, 5):
f = open(basefilename+".%s" % i, "w+")
f.write("%s\n" % i)
f.close()
pushFilenameStack(basefilename)
for i in xrange(1, 5):
f = open(basefilename+".%s" % i)
c = f.readlines()[0].strip()
self.assertEqual(str(i-1), str(c))
f.close()
| import os
from twisted.trial import unittest
from ooni.utils import pushFilenameStack
class TestUtils(unittest.TestCase):
def test_pushFilenameStack(self):
basefilename = os.path.join(os.getcwd(), 'dummyfile')
f = open(basefilename, "w+")
f.write("0\n")
f.close()
for i in xrange(1, 5):
f = open(basefilename+".%s" % i, "w+")
f.write("%s\n" % i)
f.close()
pushFilenameStack(basefilename)
for i in xrange(1, 5):
f = open(basefilename+".%s" % i)
c = f.readlines()[0].strip()
self.assertEqual(str(i-1), str(c))
f.close()
| Use trial unittest instead of python unittest | Use trial unittest instead of python unittest
| Python | bsd-2-clause | juga0/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe | python | ## Code Before:
import os
import unittest
from ooni.utils import pushFilenameStack
class TestUtils(unittest.TestCase):
def test_pushFilenameStack(self):
basefilename = os.path.join(os.getcwd(), 'dummyfile')
f = open(basefilename, "w+")
f.write("0\n")
f.close()
for i in xrange(1, 5):
f = open(basefilename+".%s" % i, "w+")
f.write("%s\n" % i)
f.close()
pushFilenameStack(basefilename)
for i in xrange(1, 5):
f = open(basefilename+".%s" % i)
c = f.readlines()[0].strip()
self.assertEqual(str(i-1), str(c))
f.close()
## Instruction:
Use trial unittest instead of python unittest
## Code After:
import os
from twisted.trial import unittest
from ooni.utils import pushFilenameStack
class TestUtils(unittest.TestCase):
def test_pushFilenameStack(self):
basefilename = os.path.join(os.getcwd(), 'dummyfile')
f = open(basefilename, "w+")
f.write("0\n")
f.close()
for i in xrange(1, 5):
f = open(basefilename+".%s" % i, "w+")
f.write("%s\n" % i)
f.close()
pushFilenameStack(basefilename)
for i in xrange(1, 5):
f = open(basefilename+".%s" % i)
c = f.readlines()[0].strip()
self.assertEqual(str(i-1), str(c))
f.close()
| import os
- import unittest
+ from twisted.trial import unittest
+
from ooni.utils import pushFilenameStack
class TestUtils(unittest.TestCase):
def test_pushFilenameStack(self):
basefilename = os.path.join(os.getcwd(), 'dummyfile')
f = open(basefilename, "w+")
f.write("0\n")
f.close()
for i in xrange(1, 5):
f = open(basefilename+".%s" % i, "w+")
f.write("%s\n" % i)
f.close()
pushFilenameStack(basefilename)
for i in xrange(1, 5):
f = open(basefilename+".%s" % i)
c = f.readlines()[0].strip()
self.assertEqual(str(i-1), str(c))
f.close()
| 3 | 0.142857 | 2 | 1 |
abaa882aaa1b7e251d989d60391bd2e06801c2a2 | py/desiUtil/install/most_recent_tag.py | py/desiUtil/install/most_recent_tag.py | from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support.
def most_recent_tag(tags,username=None):
"""Scan an SVN tags directory and return the most recent tag.
Parameters
----------
tags : str
A URL pointing to an SVN tags directory.
username : str, optional
If set, pass the value to SVN's ``--username`` option.
Returns
-------
most_recent_tag : str
The most recent tag found in ``tags``.
"""
from subprocess import Popen, PIPE
command = ['svn']
if username is not None:
command += ['--username', username]
command += ['ls',tags]
proc = Popen(command,stdout=PIPE,stderr=PIPE)
out, err = proc.communicate()
try:
mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0])[-1]
except IndexError:
mrt = '0.0.0'
return mrt
| from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support.
def most_recent_tag(tags,username=None):
"""Scan an SVN tags directory and return the most recent tag.
Parameters
----------
tags : str
A URL pointing to an SVN tags directory.
username : str, optional
If set, pass the value to SVN's ``--username`` option.
Returns
-------
most_recent_tag : str
The most recent tag found in ``tags``.
"""
from distutils.version import StrictVersion as V
from subprocess import Popen, PIPE
command = ['svn']
if username is not None:
command += ['--username', username]
command += ['ls',tags]
proc = Popen(command,stdout=PIPE,stderr=PIPE)
out, err = proc.communicate()
try:
mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0],
key=lambda x: V(x))[-1]
except IndexError:
mrt = '0.0.0'
return mrt
| Add more careful version checks | Add more careful version checks
| Python | bsd-3-clause | desihub/desiutil,desihub/desiutil | python | ## Code Before:
from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support.
def most_recent_tag(tags,username=None):
"""Scan an SVN tags directory and return the most recent tag.
Parameters
----------
tags : str
A URL pointing to an SVN tags directory.
username : str, optional
If set, pass the value to SVN's ``--username`` option.
Returns
-------
most_recent_tag : str
The most recent tag found in ``tags``.
"""
from subprocess import Popen, PIPE
command = ['svn']
if username is not None:
command += ['--username', username]
command += ['ls',tags]
proc = Popen(command,stdout=PIPE,stderr=PIPE)
out, err = proc.communicate()
try:
mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0])[-1]
except IndexError:
mrt = '0.0.0'
return mrt
## Instruction:
Add more careful version checks
## Code After:
from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support.
def most_recent_tag(tags,username=None):
"""Scan an SVN tags directory and return the most recent tag.
Parameters
----------
tags : str
A URL pointing to an SVN tags directory.
username : str, optional
If set, pass the value to SVN's ``--username`` option.
Returns
-------
most_recent_tag : str
The most recent tag found in ``tags``.
"""
from distutils.version import StrictVersion as V
from subprocess import Popen, PIPE
command = ['svn']
if username is not None:
command += ['--username', username]
command += ['ls',tags]
proc = Popen(command,stdout=PIPE,stderr=PIPE)
out, err = proc.communicate()
try:
mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0],
key=lambda x: V(x))[-1]
except IndexError:
mrt = '0.0.0'
return mrt
| from __future__ import absolute_import, division, print_function, unicode_literals
# The line above will help with 2to3 support.
def most_recent_tag(tags,username=None):
"""Scan an SVN tags directory and return the most recent tag.
Parameters
----------
tags : str
A URL pointing to an SVN tags directory.
username : str, optional
If set, pass the value to SVN's ``--username`` option.
Returns
-------
most_recent_tag : str
The most recent tag found in ``tags``.
"""
+ from distutils.version import StrictVersion as V
from subprocess import Popen, PIPE
command = ['svn']
if username is not None:
command += ['--username', username]
command += ['ls',tags]
proc = Popen(command,stdout=PIPE,stderr=PIPE)
out, err = proc.communicate()
try:
- mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0])[-1]
? ^^^^^
+ mrt = sorted([v.rstrip('/') for v in out.split('\n') if len(v) > 0],
? ^
+ key=lambda x: V(x))[-1]
except IndexError:
mrt = '0.0.0'
return mrt | 4 | 0.137931 | 3 | 1 |
99cbddcc62af3d5373ac187e469aeeb305751fff | app/views/submissions/list.html.erb | app/views/submissions/list.html.erb | <thead class="submissions-table-header">
<tr>
<th class="submission-header-name">Full name</th>
<th class="submission-header-narrow submission-mobile-hidden">Age</th>
<% if show_average %>
<th class="submission-header-narrow submission-mobile-hidden">Average</th>
<% end %>
<% if show_rates_count %>
<th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
<% end %>
<th class="submission-header-narrow submission-mobile-hidden">Date</th>
<th class="submission-header-narrow" colspan="3"></th>
</tr>
</thead>
<tbody class="submissions-table-body">
<% submission_presenters.each do |submission| %>
<tr>
<td class="submission-body-name"><%= submission.full_name %></td>
<td class="submission-mobile-hidden"><%= submission.age %></td>
<% if show_average %>
<td class="submission-mobile-hidden"><%= submission.average_rate %></td>
<% end %>
<% if show_rates_count %>
<td class="submission-mobile-hidden"><%= submission.rates_count %></td>
<% end %>
<td class="submission-mobile-hidden"><%= submission.created_at %></td>
<td><%= link_to 'Show', submission %></td>
</tr>
<% end %>
</tbody>
| <table class="submissions-table">
<thead class="submissions-table-header">
<tr>
<th class="submission-header-name">Full name</th>
<th class="submission-header-narrow submission-mobile-hidden">Age</th>
<% if show_average %>
<th class="submission-header-narrow submission-mobile-hidden">Average</th>
<% end %>
<% if show_rates_count %>
<th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
<% end %>
<th class="submission-header-narrow submission-mobile-hidden">Date</th>
<th class="submission-header-narrow" colspan="3"></th>
</tr>
</thead>
<tbody class="submissions-table-body">
<% submission_presenters.each do |submission| %>
<tr>
<td class="submission-body-name"><%= submission.full_name %></td>
<td class="submission-mobile-hidden"><%= submission.age %></td>
<% if show_average %>
<td class="submission-mobile-hidden"><%= submission.average_rate %></td>
<% end %>
<% if show_rates_count %>
<td class="submission-mobile-hidden"><%= submission.rates_count %></td>
<% end %>
<td class="submission-mobile-hidden"><%= submission.created_at %></td>
<td><%= link_to 'Show', submission %></td>
</tr>
<% end %>
</tbody>
</table>
| Fix the list table view | Fix the list table view
| HTML+ERB | mit | LunarLogic/rails-girls-submissions,LunarLogic/rails-girls-submissions,LunarLogic/rails-girls-submissions | html+erb | ## Code Before:
<thead class="submissions-table-header">
<tr>
<th class="submission-header-name">Full name</th>
<th class="submission-header-narrow submission-mobile-hidden">Age</th>
<% if show_average %>
<th class="submission-header-narrow submission-mobile-hidden">Average</th>
<% end %>
<% if show_rates_count %>
<th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
<% end %>
<th class="submission-header-narrow submission-mobile-hidden">Date</th>
<th class="submission-header-narrow" colspan="3"></th>
</tr>
</thead>
<tbody class="submissions-table-body">
<% submission_presenters.each do |submission| %>
<tr>
<td class="submission-body-name"><%= submission.full_name %></td>
<td class="submission-mobile-hidden"><%= submission.age %></td>
<% if show_average %>
<td class="submission-mobile-hidden"><%= submission.average_rate %></td>
<% end %>
<% if show_rates_count %>
<td class="submission-mobile-hidden"><%= submission.rates_count %></td>
<% end %>
<td class="submission-mobile-hidden"><%= submission.created_at %></td>
<td><%= link_to 'Show', submission %></td>
</tr>
<% end %>
</tbody>
## Instruction:
Fix the list table view
## Code After:
<table class="submissions-table">
<thead class="submissions-table-header">
<tr>
<th class="submission-header-name">Full name</th>
<th class="submission-header-narrow submission-mobile-hidden">Age</th>
<% if show_average %>
<th class="submission-header-narrow submission-mobile-hidden">Average</th>
<% end %>
<% if show_rates_count %>
<th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
<% end %>
<th class="submission-header-narrow submission-mobile-hidden">Date</th>
<th class="submission-header-narrow" colspan="3"></th>
</tr>
</thead>
<tbody class="submissions-table-body">
<% submission_presenters.each do |submission| %>
<tr>
<td class="submission-body-name"><%= submission.full_name %></td>
<td class="submission-mobile-hidden"><%= submission.age %></td>
<% if show_average %>
<td class="submission-mobile-hidden"><%= submission.average_rate %></td>
<% end %>
<% if show_rates_count %>
<td class="submission-mobile-hidden"><%= submission.rates_count %></td>
<% end %>
<td class="submission-mobile-hidden"><%= submission.created_at %></td>
<td><%= link_to 'Show', submission %></td>
</tr>
<% end %>
</tbody>
</table>
| + <table class="submissions-table">
- <thead class="submissions-table-header">
+ <thead class="submissions-table-header">
? ++
- <tr>
+ <tr>
? ++
- <th class="submission-header-name">Full name</th>
+ <th class="submission-header-name">Full name</th>
? ++
- <th class="submission-header-narrow submission-mobile-hidden">Age</th>
+ <th class="submission-header-narrow submission-mobile-hidden">Age</th>
? ++
- <% if show_average %>
+ <% if show_average %>
? ++
- <th class="submission-header-narrow submission-mobile-hidden">Average</th>
+ <th class="submission-header-narrow submission-mobile-hidden">Average</th>
? ++
+ <% end %>
+ <% if show_rates_count %>
+ <th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
+ <% end %>
+ <th class="submission-header-narrow submission-mobile-hidden">Date</th>
+ <th class="submission-header-narrow" colspan="3"></th>
+ </tr>
+ </thead>
+
+ <tbody class="submissions-table-body">
+ <% submission_presenters.each do |submission| %>
+ <tr>
+ <td class="submission-body-name"><%= submission.full_name %></td>
+ <td class="submission-mobile-hidden"><%= submission.age %></td>
+ <% if show_average %>
+ <td class="submission-mobile-hidden"><%= submission.average_rate %></td>
+ <% end %>
+ <% if show_rates_count %>
+ <td class="submission-mobile-hidden"><%= submission.rates_count %></td>
+ <% end %>
+ <td class="submission-mobile-hidden"><%= submission.created_at %></td>
+ <td><%= link_to 'Show', submission %></td>
+ </tr>
<% end %>
- <% if show_rates_count %>
- <th class="submission-header-narrow submission-mobile-hidden">Rate count</th>
- <% end %>
- <th class="submission-header-narrow submission-mobile-hidden">Date</th>
- <th class="submission-header-narrow" colspan="3"></th>
- </tr>
- </thead>
-
- <tbody class="submissions-table-body">
- <% submission_presenters.each do |submission| %>
- <tr>
- <td class="submission-body-name"><%= submission.full_name %></td>
- <td class="submission-mobile-hidden"><%= submission.age %></td>
- <% if show_average %>
- <td class="submission-mobile-hidden"><%= submission.average_rate %></td>
- <% end %>
- <% if show_rates_count %>
- <td class="submission-mobile-hidden"><%= submission.rates_count %></td>
- <% end %>
- <td class="submission-mobile-hidden"><%= submission.created_at %></td>
- <td><%= link_to 'Show', submission %></td>
- </tr>
- <% end %>
- </tbody>
+ </tbody>
? ++
+ </table> | 62 | 2 | 32 | 30 |
30d4c7eb2d8f97e9ff35612aba2c90ad72e9c3ac | catalog/Developer_Tools/ruby_version_management.yml | catalog/Developer_Tools/ruby_version_management.yml | name: Ruby Version Management
description:
projects:
# deprecated in favor of chruby:
- hmans/rbfu
# deprecated
- phoet/which_ruby
- postmodern/chruby
- postmodern/ruby-install
- rvm/rvm
- senny/rvm.el
- sstephenson/rbenv
- sstephenson/ruby-build
# deprecated in favor of https://bitbucket.org/jonforums/uru
- vertiginous/pik
| name: Ruby Version Management
description:
projects:
- asdf-vm/asdf-ruby
# deprecated in favor of chruby:
- hmans/rbfu
# deprecated
- phoet/which_ruby
- postmodern/chruby
- postmodern/ruby-install
- rvm/rvm
- senny/rvm.el
- sstephenson/rbenv
- sstephenson/ruby-build
# deprecated in favor of https://bitbucket.org/jonforums/uru
- vertiginous/pik
| Add my favorite ruby version manager :) | Add my favorite ruby version manager :) | YAML | mit | rubytoolbox/catalog | yaml | ## Code Before:
name: Ruby Version Management
description:
projects:
# deprecated in favor of chruby:
- hmans/rbfu
# deprecated
- phoet/which_ruby
- postmodern/chruby
- postmodern/ruby-install
- rvm/rvm
- senny/rvm.el
- sstephenson/rbenv
- sstephenson/ruby-build
# deprecated in favor of https://bitbucket.org/jonforums/uru
- vertiginous/pik
## Instruction:
Add my favorite ruby version manager :)
## Code After:
name: Ruby Version Management
description:
projects:
- asdf-vm/asdf-ruby
# deprecated in favor of chruby:
- hmans/rbfu
# deprecated
- phoet/which_ruby
- postmodern/chruby
- postmodern/ruby-install
- rvm/rvm
- senny/rvm.el
- sstephenson/rbenv
- sstephenson/ruby-build
# deprecated in favor of https://bitbucket.org/jonforums/uru
- vertiginous/pik
| name: Ruby Version Management
description:
projects:
+ - asdf-vm/asdf-ruby
# deprecated in favor of chruby:
- hmans/rbfu
# deprecated
- phoet/which_ruby
- postmodern/chruby
- postmodern/ruby-install
- rvm/rvm
- senny/rvm.el
- sstephenson/rbenv
- sstephenson/ruby-build
# deprecated in favor of https://bitbucket.org/jonforums/uru
- vertiginous/pik | 1 | 0.066667 | 1 | 0 |
c322cf1f8b8fcfda8e73eb20a6dab3e59d292c97 | views/call.jade | views/call.jade | body
h1= title
div= email || "Not logged in"
p(id='outgoingstatus') This Browser's Stream
video(id="outgoingvid", autoplay)
br
p(id='incomingstatus') The Other Browser's Stream
video(id="incomingvid", autoplay)
br
button(id="startbtn", onclick="start()") Turn On Camera
button(id="callbtn", onclick="call()") Call
button(id="stoptransbtn", onclick="stopTransmitting()") Stop Transmitting
button(id="stopreceivebtn", onclick="stopReceiving()") Stop Receiving
br
br
input(id="contactemail", type="text", placeholder="Email")
button(id="addcontactbtn", onclick="addContact()") Add Contact
br
div Emails:
div(id="emails")
script(src="/js/main.js")
| body
h1= title
div= email
p(id='outgoingstatus') This Browser's Stream
video(id="outgoingvid", autoplay)
br
p(id='incomingstatus') The Other Browser's Stream
video(id="incomingvid", autoplay)
br
button(id="startbtn", onclick="start()") Turn On Camera
button(id="callbtn", onclick="call()") Call
button(id="stoptransbtn", onclick="stopTransmitting()") Stop Transmitting
button(id="stopreceivebtn", onclick="stopReceiving()") Stop Receiving
br
br
input(id="contactemail", type="text", placeholder="Email")
button(id="addcontactbtn", onclick="addContact()") Add Contact
br
div Emails:
div(id="emails")
script(src="/js/main.js")
| Remove not logged in because it will never occur | Remove not logged in because it will never occur
| Jade | mit | vladikoff/tincan,rafaelfragosom/tincan,rafaelfragosom/tincan,mozilla/tincan | jade | ## Code Before:
body
h1= title
div= email || "Not logged in"
p(id='outgoingstatus') This Browser's Stream
video(id="outgoingvid", autoplay)
br
p(id='incomingstatus') The Other Browser's Stream
video(id="incomingvid", autoplay)
br
button(id="startbtn", onclick="start()") Turn On Camera
button(id="callbtn", onclick="call()") Call
button(id="stoptransbtn", onclick="stopTransmitting()") Stop Transmitting
button(id="stopreceivebtn", onclick="stopReceiving()") Stop Receiving
br
br
input(id="contactemail", type="text", placeholder="Email")
button(id="addcontactbtn", onclick="addContact()") Add Contact
br
div Emails:
div(id="emails")
script(src="/js/main.js")
## Instruction:
Remove not logged in because it will never occur
## Code After:
body
h1= title
div= email
p(id='outgoingstatus') This Browser's Stream
video(id="outgoingvid", autoplay)
br
p(id='incomingstatus') The Other Browser's Stream
video(id="incomingvid", autoplay)
br
button(id="startbtn", onclick="start()") Turn On Camera
button(id="callbtn", onclick="call()") Call
button(id="stoptransbtn", onclick="stopTransmitting()") Stop Transmitting
button(id="stopreceivebtn", onclick="stopReceiving()") Stop Receiving
br
br
input(id="contactemail", type="text", placeholder="Email")
button(id="addcontactbtn", onclick="addContact()") Add Contact
br
div Emails:
div(id="emails")
script(src="/js/main.js")
| body
h1= title
- div= email || "Not logged in"
+ div= email
p(id='outgoingstatus') This Browser's Stream
video(id="outgoingvid", autoplay)
br
p(id='incomingstatus') The Other Browser's Stream
video(id="incomingvid", autoplay)
br
button(id="startbtn", onclick="start()") Turn On Camera
button(id="callbtn", onclick="call()") Call
button(id="stoptransbtn", onclick="stopTransmitting()") Stop Transmitting
button(id="stopreceivebtn", onclick="stopReceiving()") Stop Receiving
br
br
input(id="contactemail", type="text", placeholder="Email")
button(id="addcontactbtn", onclick="addContact()") Add Contact
br
div Emails:
div(id="emails")
script(src="/js/main.js") | 2 | 0.090909 | 1 | 1 |
b35eef5f78538e024a4c03f90e15e3fba88d5132 | lib/metadata_hook.rb | lib/metadata_hook.rb | class RubyMetadataHook < Mumukit::Hook
def metadata
{language: {
name: 'ruby',
icon: {type: 'devicon', name: 'ruby'},
version: '2.0',
extension: 'rb',
ace_mode: 'ruby'
},
test_framework: {
name: 'rspec',
version: '2.13',
test_extension: 'rb'
}}
end
end | class RubyMetadataHook < Mumukit::Hook
def metadata
{language: {
name: 'ruby',
icon: {type: 'devicon', name: 'ruby'},
version: '2.0',
extension: 'rb',
ace_mode: 'ruby'
},
test_framework: {
name: 'rspec',
version: '2.13',
test_extension: 'rb',
template: <<ruby
describe '{{ test_template_group_description }}' do
it '{{ test_template_sample_description }}' do
expect(true).to eq true
end
end
ruby
}}
end
end | Add rspec template to metadata | Add rspec template to metadata
| Ruby | mit | mumuki/mumuki-rspec-server | ruby | ## Code Before:
class RubyMetadataHook < Mumukit::Hook
def metadata
{language: {
name: 'ruby',
icon: {type: 'devicon', name: 'ruby'},
version: '2.0',
extension: 'rb',
ace_mode: 'ruby'
},
test_framework: {
name: 'rspec',
version: '2.13',
test_extension: 'rb'
}}
end
end
## Instruction:
Add rspec template to metadata
## Code After:
class RubyMetadataHook < Mumukit::Hook
def metadata
{language: {
name: 'ruby',
icon: {type: 'devicon', name: 'ruby'},
version: '2.0',
extension: 'rb',
ace_mode: 'ruby'
},
test_framework: {
name: 'rspec',
version: '2.13',
test_extension: 'rb',
template: <<ruby
describe '{{ test_template_group_description }}' do
it '{{ test_template_sample_description }}' do
expect(true).to eq true
end
end
ruby
}}
end
end | class RubyMetadataHook < Mumukit::Hook
def metadata
{language: {
name: 'ruby',
icon: {type: 'devicon', name: 'ruby'},
version: '2.0',
extension: 'rb',
ace_mode: 'ruby'
},
test_framework: {
name: 'rspec',
version: '2.13',
- test_extension: 'rb'
+ test_extension: 'rb',
? +
+ template: <<ruby
+ describe '{{ test_template_group_description }}' do
+ it '{{ test_template_sample_description }}' do
+ expect(true).to eq true
+ end
+ end
+ ruby
}}
end
end | 9 | 0.5625 | 8 | 1 |
59df433c4f34f2d8150b80a45b800d51c5d178bb | wix/replace/replace_windows.go | wix/replace/replace_windows.go | package main
import (
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("Usage: replace [filename] [old string] [new string]")
}
file := os.Args[1]
old := os.Args[2]
new := os.Args[3]
content, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), old, new, -1)), 0644)
if err != nil {
log.Fatal(err)
}
}
| package main
import (
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("Usage: replace [filename] [old string] [new string]")
}
file := os.Args[1]
oldStr := os.Args[2]
newStr := os.Args[3]
content, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), oldStr, newStr, -1)), 0644)
if err != nil {
log.Fatal(err)
}
}
| Rename variable to avoid built-in function name | Rename variable to avoid built-in function name
| Go | apache-2.0 | moznion/mackerel-agent,kamatama41/mackerel-agent,stanaka/mackerel-agent,mackerelio/mackerel-agent,stanaka/mackerel-agent,mackerelio/mackerel-agent,moznion/mackerel-agent,stanaka/mackerel-agent,kamatama41/mackerel-agent,yyljlyy/mackerel-agent,kamatama41/mackerel-agent,yyljlyy/mackerel-agent,moznion/mackerel-agent,stanaka/mackerel-agent,moznion/mackerel-agent,mackerelio/mackerel-agent,kamatama41/mackerel-agent,yyljlyy/mackerel-agent,yyljlyy/mackerel-agent | go | ## Code Before:
package main
import (
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("Usage: replace [filename] [old string] [new string]")
}
file := os.Args[1]
old := os.Args[2]
new := os.Args[3]
content, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), old, new, -1)), 0644)
if err != nil {
log.Fatal(err)
}
}
## Instruction:
Rename variable to avoid built-in function name
## Code After:
package main
import (
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("Usage: replace [filename] [old string] [new string]")
}
file := os.Args[1]
oldStr := os.Args[2]
newStr := os.Args[3]
content, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), oldStr, newStr, -1)), 0644)
if err != nil {
log.Fatal(err)
}
}
| package main
import (
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("Usage: replace [filename] [old string] [new string]")
}
file := os.Args[1]
- old := os.Args[2]
+ oldStr := os.Args[2]
? +++
- new := os.Args[3]
+ newStr := os.Args[3]
? +++
content, err := ioutil.ReadFile(file)
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), old, new, -1)), 0644)
+ err = ioutil.WriteFile(file, []byte(strings.Replace(string(content), oldStr, newStr, -1)), 0644)
? +++ +++
if err != nil {
log.Fatal(err)
}
} | 6 | 0.222222 | 3 | 3 |
ffc0c2ed3a5b53196dcd8209e24f73a028ff851e | test/slider_test.js | test/slider_test.js | import React from 'react';
import { shallow, mount, render } from 'enzyme';
import Slider from '../src/slider.jsx';
import GoldTagLine from '../src/goldtagline.jsx'
import {expect} from 'chai';
describe("slider", function() {
it("defaults to 10 pieces of gold", function() {
expect(shallow(<Slider />).contains(<GoldTagLine goldPieces="10"/>)).to.be.true;
});
});
| import React from 'react';
import { shallow, mount, render } from 'enzyme';
import Slider from '../src/slider.jsx';
import GoldTagLine from '../src/goldtagline.jsx'
import {expect} from 'chai';
describe("slider", function() {
it("defaults to 10 pieces of gold", function() {
expect(shallow(<Slider />).contains(<GoldTagLine goldPieces="10"/>)).to.be.true;
});
it("changes description when slider is moved", function(){
const slider = mount(<Slider />);
slider.find("input").simulate('change', {target: {value: 15}})
expect(slider.contains(<GoldTagLine goldPieces="15"/>)).to.be.true;
});
});
| Test moving of slider updates text | Test moving of slider updates text
| JavaScript | mit | mtc2013/hangperson,mtc2013/hangperson,mtc2013/hangperson | javascript | ## Code Before:
import React from 'react';
import { shallow, mount, render } from 'enzyme';
import Slider from '../src/slider.jsx';
import GoldTagLine from '../src/goldtagline.jsx'
import {expect} from 'chai';
describe("slider", function() {
it("defaults to 10 pieces of gold", function() {
expect(shallow(<Slider />).contains(<GoldTagLine goldPieces="10"/>)).to.be.true;
});
});
## Instruction:
Test moving of slider updates text
## Code After:
import React from 'react';
import { shallow, mount, render } from 'enzyme';
import Slider from '../src/slider.jsx';
import GoldTagLine from '../src/goldtagline.jsx'
import {expect} from 'chai';
describe("slider", function() {
it("defaults to 10 pieces of gold", function() {
expect(shallow(<Slider />).contains(<GoldTagLine goldPieces="10"/>)).to.be.true;
});
it("changes description when slider is moved", function(){
const slider = mount(<Slider />);
slider.find("input").simulate('change', {target: {value: 15}})
expect(slider.contains(<GoldTagLine goldPieces="15"/>)).to.be.true;
});
});
| import React from 'react';
import { shallow, mount, render } from 'enzyme';
import Slider from '../src/slider.jsx';
import GoldTagLine from '../src/goldtagline.jsx'
import {expect} from 'chai';
describe("slider", function() {
it("defaults to 10 pieces of gold", function() {
expect(shallow(<Slider />).contains(<GoldTagLine goldPieces="10"/>)).to.be.true;
});
+ it("changes description when slider is moved", function(){
+ const slider = mount(<Slider />);
+ slider.find("input").simulate('change', {target: {value: 15}})
+ expect(slider.contains(<GoldTagLine goldPieces="15"/>)).to.be.true;
+ });
}); | 5 | 0.454545 | 5 | 0 |
a41d2e79dcf83793dab5c37c4a4b46ad6225d719 | anchor/names.py | anchor/names.py |
# Set constants of the names of the models so they can always be referenced
# as variables rather than strings
# Most of the density is at 0
NEAR_ZERO = '~0'
# Old "middle" modality - most of the density is at 0.5
NEAR_HALF = 'concurrent'
# Most of the density is at 1
NEAR_ONE = '~1'
# The density is split between 0 and 1
BOTH_ONE_ZERO = 'bimodal'
# Cannot decide on one of the above models (the null model fits better) so use
# this model instead
NULL_MODEL = 'ambivalent'
|
# Set constants of the names of the models so they can always be referenced
# as variables rather than strings
# Most of the density is at 0
NEAR_ZERO = 'excluded'
# Old "middle" modality - most of the density is at 0.5
NEAR_HALF = 'concurrent'
# Most of the density is at 1
NEAR_ONE = 'included'
# The density is split between 0 and 1
BOTH_ONE_ZERO = 'bimodal'
# Cannot decide on one of the above models (the null model fits better) so use
# this model instead
NULL_MODEL = 'ambivalent'
| Use words for near zero and near one | Use words for near zero and near one
| Python | bsd-3-clause | YeoLab/anchor | python | ## Code Before:
# Set constants of the names of the models so they can always be referenced
# as variables rather than strings
# Most of the density is at 0
NEAR_ZERO = '~0'
# Old "middle" modality - most of the density is at 0.5
NEAR_HALF = 'concurrent'
# Most of the density is at 1
NEAR_ONE = '~1'
# The density is split between 0 and 1
BOTH_ONE_ZERO = 'bimodal'
# Cannot decide on one of the above models (the null model fits better) so use
# this model instead
NULL_MODEL = 'ambivalent'
## Instruction:
Use words for near zero and near one
## Code After:
# Set constants of the names of the models so they can always be referenced
# as variables rather than strings
# Most of the density is at 0
NEAR_ZERO = 'excluded'
# Old "middle" modality - most of the density is at 0.5
NEAR_HALF = 'concurrent'
# Most of the density is at 1
NEAR_ONE = 'included'
# The density is split between 0 and 1
BOTH_ONE_ZERO = 'bimodal'
# Cannot decide on one of the above models (the null model fits better) so use
# this model instead
NULL_MODEL = 'ambivalent'
|
# Set constants of the names of the models so they can always be referenced
# as variables rather than strings
# Most of the density is at 0
- NEAR_ZERO = '~0'
+ NEAR_ZERO = 'excluded'
# Old "middle" modality - most of the density is at 0.5
NEAR_HALF = 'concurrent'
# Most of the density is at 1
- NEAR_ONE = '~1'
+ NEAR_ONE = 'included'
# The density is split between 0 and 1
BOTH_ONE_ZERO = 'bimodal'
# Cannot decide on one of the above models (the null model fits better) so use
# this model instead
NULL_MODEL = 'ambivalent' | 4 | 0.210526 | 2 | 2 |
aac5c1b44261228c9ccb205a7281943043b91cc0 | src/Middleware/Request/IncludedResource.php | src/Middleware/Request/IncludedResource.php | <?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use Refinery29\Piston\Middleware\Payload;
use Refinery29\Piston\Request;
class IncludedResource implements StageInterface
{
use GetOnlyStage;
/**
* @param Payload $payload
*
* @throws \League\Route\Http\Exception\BadRequestException
*
* @return Request
*/
public function process($payload)
{
/** @var Request $request */
$request = $payload->getRequest();
if (!isset($request->getQueryParams()['include'])) {
return $payload;
}
$this->ensureGetOnlyRequest($request);
$include = explode(',', $request->getQueryParams()['include']);
if (!empty($include)) {
foreach ((array) $include as $k => $resource) {
if (strpos($resource, '.') !== false) {
$resource = explode('.', $resource);
$include[$k] = $resource;
}
}
//$request->setIncludedResources($include);
$payload->withRequest($request->withIncludedResources($include));
}
return $payload;
}
}
| <?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use Refinery29\Piston\Middleware\Payload;
use Refinery29\Piston\Request;
class IncludedResource implements StageInterface
{
use GetOnlyStage;
/**
* @param Payload $payload
*
* @throws \League\Route\Http\Exception\BadRequestException
*
* @return Payload
*/
public function process($payload)
{
/** @var Request $request */
$request = $payload->getRequest();
if (!isset($request->getQueryParams()['include'])) {
return $payload;
}
$this->ensureGetOnlyRequest($request);
$include = explode(',', $request->getQueryParams()['include']);
if (!empty($include)) {
foreach ((array) $include as $k => $resource) {
if (strpos($resource, '.') !== false) {
$resource = explode('.', $resource);
$include[$k] = $resource;
}
}
$payload = $payload->withRequest(
$request->withIncludedResources($include)
);
}
return $payload;
}
}
| Correct bug in updating Payload with new Request object | Correct bug in updating Payload with new Request object
| PHP | mit | refinery29/piston,refinery29/piston | php | ## Code Before:
<?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use Refinery29\Piston\Middleware\Payload;
use Refinery29\Piston\Request;
class IncludedResource implements StageInterface
{
use GetOnlyStage;
/**
* @param Payload $payload
*
* @throws \League\Route\Http\Exception\BadRequestException
*
* @return Request
*/
public function process($payload)
{
/** @var Request $request */
$request = $payload->getRequest();
if (!isset($request->getQueryParams()['include'])) {
return $payload;
}
$this->ensureGetOnlyRequest($request);
$include = explode(',', $request->getQueryParams()['include']);
if (!empty($include)) {
foreach ((array) $include as $k => $resource) {
if (strpos($resource, '.') !== false) {
$resource = explode('.', $resource);
$include[$k] = $resource;
}
}
//$request->setIncludedResources($include);
$payload->withRequest($request->withIncludedResources($include));
}
return $payload;
}
}
## Instruction:
Correct bug in updating Payload with new Request object
## Code After:
<?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use Refinery29\Piston\Middleware\Payload;
use Refinery29\Piston\Request;
class IncludedResource implements StageInterface
{
use GetOnlyStage;
/**
* @param Payload $payload
*
* @throws \League\Route\Http\Exception\BadRequestException
*
* @return Payload
*/
public function process($payload)
{
/** @var Request $request */
$request = $payload->getRequest();
if (!isset($request->getQueryParams()['include'])) {
return $payload;
}
$this->ensureGetOnlyRequest($request);
$include = explode(',', $request->getQueryParams()['include']);
if (!empty($include)) {
foreach ((array) $include as $k => $resource) {
if (strpos($resource, '.') !== false) {
$resource = explode('.', $resource);
$include[$k] = $resource;
}
}
$payload = $payload->withRequest(
$request->withIncludedResources($include)
);
}
return $payload;
}
}
| <?php
/*
* Copyright (c) 2016 Refinery29, Inc.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Refinery29\Piston\Middleware\Request;
use League\Pipeline\StageInterface;
use Refinery29\Piston\Middleware\GetOnlyStage;
use Refinery29\Piston\Middleware\Payload;
use Refinery29\Piston\Request;
class IncludedResource implements StageInterface
{
use GetOnlyStage;
/**
* @param Payload $payload
*
* @throws \League\Route\Http\Exception\BadRequestException
*
- * @return Request
+ * @return Payload
*/
public function process($payload)
{
/** @var Request $request */
$request = $payload->getRequest();
if (!isset($request->getQueryParams()['include'])) {
return $payload;
}
$this->ensureGetOnlyRequest($request);
$include = explode(',', $request->getQueryParams()['include']);
if (!empty($include)) {
foreach ((array) $include as $k => $resource) {
if (strpos($resource, '.') !== false) {
$resource = explode('.', $resource);
$include[$k] = $resource;
}
}
+ $payload = $payload->withRequest(
- //$request->setIncludedResources($include);
? ^^ ^^ -
+ $request->withIncludedResources($include)
? ^^^^ ^^ +
- $payload->withRequest($request->withIncludedResources($include));
+ );
+
}
return $payload;
}
} | 8 | 0.142857 | 5 | 3 |
3ef37c7a4726b5916ce0559961dd905ba2f19efb | recipes/default.rb | recipes/default.rb |
unless node['push_jobs']['whitelist'].is_a? Hash
raise "node['push_jobs']['whitelist'] should have a hash value!"
end
case node['platform_family']
when 'windows', 'debian', 'rhel', 'suse'
include_recipe 'push-jobs::install'
else
raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
end
|
unless node['push_jobs']['whitelist'].is_a? Hash
raise "node['push_jobs']['whitelist'] should have a hash value!"
end
case node['platform_family']
when 'windows', 'debian', 'rhel', 'suse', 'amazon'
include_recipe 'push-jobs::install'
else
raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
end
| Add back amazon Linux support | Add back amazon Linux support
Signed-off-by: Tim Smith <[email protected]>
| Ruby | apache-2.0 | chef-cookbooks/push-jobs,opscode-cookbooks/push-jobs,chef-cookbooks/push-jobs,opscode-cookbooks/push-jobs,opscode-cookbooks/push-jobs,chef-cookbooks/push-jobs | ruby | ## Code Before:
unless node['push_jobs']['whitelist'].is_a? Hash
raise "node['push_jobs']['whitelist'] should have a hash value!"
end
case node['platform_family']
when 'windows', 'debian', 'rhel', 'suse'
include_recipe 'push-jobs::install'
else
raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
end
## Instruction:
Add back amazon Linux support
Signed-off-by: Tim Smith <[email protected]>
## Code After:
unless node['push_jobs']['whitelist'].is_a? Hash
raise "node['push_jobs']['whitelist'] should have a hash value!"
end
case node['platform_family']
when 'windows', 'debian', 'rhel', 'suse', 'amazon'
include_recipe 'push-jobs::install'
else
raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
end
|
unless node['push_jobs']['whitelist'].is_a? Hash
raise "node['push_jobs']['whitelist'] should have a hash value!"
end
case node['platform_family']
- when 'windows', 'debian', 'rhel', 'suse'
+ when 'windows', 'debian', 'rhel', 'suse', 'amazon'
? ++++++++++
include_recipe 'push-jobs::install'
else
raise 'This cookbook currently supports only Windows, Debian-family Linux, RHEL-family Linux, and Suse.'
end | 2 | 0.181818 | 1 | 1 |
dac4c8fc817e367e7dfe7fcc3276ccc6d8d3d089 | client/mobilizations/widgets/__plugins__/content/components/index.js | client/mobilizations/widgets/__plugins__/content/components/index.js | export { default } from './__content__'
export { default as EditorOld } from './editor-old'
export { default as EditorNew } from './editor-new.connected'
export { default as EditorSlate } from './editor-slate'
export { default as ActionButton } from './action-button'
export { default as Layer } from './layer'
| export { default } from './__content__'
export { default as EditorOld } from './editor-old.connected'
export { default as EditorNew } from './editor-new.connected'
export { default as EditorSlate } from './editor-slate'
export { default as ActionButton } from './action-button'
export { default as Layer } from './layer'
| Fix import connected to old editor | Fix import connected to old editor
| JavaScript | agpl-3.0 | nossas/bonde-client,nossas/bonde-client,nossas/bonde-client | javascript | ## Code Before:
export { default } from './__content__'
export { default as EditorOld } from './editor-old'
export { default as EditorNew } from './editor-new.connected'
export { default as EditorSlate } from './editor-slate'
export { default as ActionButton } from './action-button'
export { default as Layer } from './layer'
## Instruction:
Fix import connected to old editor
## Code After:
export { default } from './__content__'
export { default as EditorOld } from './editor-old.connected'
export { default as EditorNew } from './editor-new.connected'
export { default as EditorSlate } from './editor-slate'
export { default as ActionButton } from './action-button'
export { default as Layer } from './layer'
| export { default } from './__content__'
- export { default as EditorOld } from './editor-old'
+ export { default as EditorOld } from './editor-old.connected'
? ++++++++++
export { default as EditorNew } from './editor-new.connected'
export { default as EditorSlate } from './editor-slate'
export { default as ActionButton } from './action-button'
export { default as Layer } from './layer' | 2 | 0.333333 | 1 | 1 |
cc5028b58736ca7e06083d733d2e0a16a7ec8696 | src/vrun/cli.py | src/vrun/cli.py | from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', [])
PATH = binpath + os.pathsep + PATH
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTIVATED', '1')
os.putenv('VIRTUAL_ENV', sys.prefix)
newargv = sys.argv[1:]
if not newargv:
print('vrun requires the program to execute as an argument.', file=sys.stderr)
print('Example: ./venv/bin/vrun /bin/bash', file=sys.stderr)
sys.exit(-1)
execbin = newargv[0]
if os.sep not in execbin:
execbin = os.path.join(binpath, execbin)
if not os.path.exists(execbin):
print('vrun requires that the target executable exists.', file=sys.stderr)
print('Unable to find: {}'.format(execbin), file=sys.stderr)
sys.exit(-1)
try:
# Execute the actual executable...
os.execv(execbin, newargv)
except Exception as e:
print('vrun was unable to execute the target executable.', file=sys.stderr)
print('Executable: {}'.format(execbin), file=sys.stderr)
print('Exception as follows: {}'.format(e), file=sys.stderr)
| from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', '')
if PATH:
PATH = binpath + os.pathsep + PATH
else:
PATH = binpath
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTIVATED', '1')
os.putenv('VIRTUAL_ENV', sys.prefix)
newargv = sys.argv[1:]
if not newargv:
print('vrun requires the program to execute as an argument.', file=sys.stderr)
print('Example: ./venv/bin/vrun /bin/bash', file=sys.stderr)
sys.exit(-1)
execbin = newargv[0]
if os.sep not in execbin:
execbin = os.path.join(binpath, execbin)
if not os.path.exists(execbin):
print('vrun requires that the target executable exists.', file=sys.stderr)
print('Unable to find: {}'.format(execbin), file=sys.stderr)
sys.exit(-1)
try:
# Execute the actual executable...
os.execv(execbin, newargv)
except Exception as e:
print('vrun was unable to execute the target executable.', file=sys.stderr)
print('Executable: {}'.format(execbin), file=sys.stderr)
print('Exception as follows: {}'.format(e), file=sys.stderr)
| Add protection against empty PATH | Add protection against empty PATH
| Python | isc | bertjwregeer/vrun | python | ## Code Before:
from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', [])
PATH = binpath + os.pathsep + PATH
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTIVATED', '1')
os.putenv('VIRTUAL_ENV', sys.prefix)
newargv = sys.argv[1:]
if not newargv:
print('vrun requires the program to execute as an argument.', file=sys.stderr)
print('Example: ./venv/bin/vrun /bin/bash', file=sys.stderr)
sys.exit(-1)
execbin = newargv[0]
if os.sep not in execbin:
execbin = os.path.join(binpath, execbin)
if not os.path.exists(execbin):
print('vrun requires that the target executable exists.', file=sys.stderr)
print('Unable to find: {}'.format(execbin), file=sys.stderr)
sys.exit(-1)
try:
# Execute the actual executable...
os.execv(execbin, newargv)
except Exception as e:
print('vrun was unable to execute the target executable.', file=sys.stderr)
print('Executable: {}'.format(execbin), file=sys.stderr)
print('Exception as follows: {}'.format(e), file=sys.stderr)
## Instruction:
Add protection against empty PATH
## Code After:
from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', '')
if PATH:
PATH = binpath + os.pathsep + PATH
else:
PATH = binpath
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTIVATED', '1')
os.putenv('VIRTUAL_ENV', sys.prefix)
newargv = sys.argv[1:]
if not newargv:
print('vrun requires the program to execute as an argument.', file=sys.stderr)
print('Example: ./venv/bin/vrun /bin/bash', file=sys.stderr)
sys.exit(-1)
execbin = newargv[0]
if os.sep not in execbin:
execbin = os.path.join(binpath, execbin)
if not os.path.exists(execbin):
print('vrun requires that the target executable exists.', file=sys.stderr)
print('Unable to find: {}'.format(execbin), file=sys.stderr)
sys.exit(-1)
try:
# Execute the actual executable...
os.execv(execbin, newargv)
except Exception as e:
print('vrun was unable to execute the target executable.', file=sys.stderr)
print('Executable: {}'.format(execbin), file=sys.stderr)
print('Exception as follows: {}'.format(e), file=sys.stderr)
| from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
- PATH = os.environ.get('PATH', [])
? ^^
+ PATH = os.environ.get('PATH', '')
? ^^
+ if PATH:
- PATH = binpath + os.pathsep + PATH
+ PATH = binpath + os.pathsep + PATH
? ++++
+ else:
+ PATH = binpath
+
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTIVATED', '1')
os.putenv('VIRTUAL_ENV', sys.prefix)
newargv = sys.argv[1:]
if not newargv:
print('vrun requires the program to execute as an argument.', file=sys.stderr)
print('Example: ./venv/bin/vrun /bin/bash', file=sys.stderr)
sys.exit(-1)
execbin = newargv[0]
if os.sep not in execbin:
execbin = os.path.join(binpath, execbin)
if not os.path.exists(execbin):
print('vrun requires that the target executable exists.', file=sys.stderr)
print('Unable to find: {}'.format(execbin), file=sys.stderr)
sys.exit(-1)
try:
# Execute the actual executable...
os.execv(execbin, newargv)
except Exception as e:
print('vrun was unable to execute the target executable.', file=sys.stderr)
print('Executable: {}'.format(execbin), file=sys.stderr)
print('Exception as follows: {}'.format(e), file=sys.stderr) | 8 | 0.210526 | 6 | 2 |
ac2a02bdd49759403cae7a25b9a48b4c83b08534 | _sass/_navbar.scss | _sass/_navbar.scss | $navbar-height: 5.5rem;
$navbar-item-img-max-height: 67px;
@import "bulma/sass/components/navbar";
.navbar-logo {
width: 175px;
height: 175/388*148px;
}
.navbar-brand {
.is-hidden-desktop {
margin-left: auto;
}
.navbar-burger {
margin-left: 0;
}
}
.navbar-item {
text-transform: uppercase;
.button {
border-radius: 0;
}
.button.is-primary {
box-shadow: 0 1px 13px 0 rgba(247,147,30,.6)
}
}
| $navbar-height: 5.5rem;
$navbar-item-img-max-height: 67px;
@import "bulma/sass/components/navbar";
.navbar-logo {
$baseWidth: 175px;
width: $baseWidth;
@include mobile {
width: $baseWidth / 2;
}
}
.navbar-brand {
.is-hidden-desktop {
margin-left: auto;
}
@include tablet {
.navbar-burger {
margin-left: 0;
}
}
@include mobile {
.navbar-burger {
margin-left: 0;
}
}
}
.navbar-item {
text-transform: uppercase;
.button {
border-radius: 0;
}
.button.is-primary {
box-shadow: 0 1px 13px 0 rgba(247,147,30,.6)
}
}
| Make logo smaller on mobile | Make logo smaller on mobile
| SCSS | mit | bright/new-www,bright/new-www | scss | ## Code Before:
$navbar-height: 5.5rem;
$navbar-item-img-max-height: 67px;
@import "bulma/sass/components/navbar";
.navbar-logo {
width: 175px;
height: 175/388*148px;
}
.navbar-brand {
.is-hidden-desktop {
margin-left: auto;
}
.navbar-burger {
margin-left: 0;
}
}
.navbar-item {
text-transform: uppercase;
.button {
border-radius: 0;
}
.button.is-primary {
box-shadow: 0 1px 13px 0 rgba(247,147,30,.6)
}
}
## Instruction:
Make logo smaller on mobile
## Code After:
$navbar-height: 5.5rem;
$navbar-item-img-max-height: 67px;
@import "bulma/sass/components/navbar";
.navbar-logo {
$baseWidth: 175px;
width: $baseWidth;
@include mobile {
width: $baseWidth / 2;
}
}
.navbar-brand {
.is-hidden-desktop {
margin-left: auto;
}
@include tablet {
.navbar-burger {
margin-left: 0;
}
}
@include mobile {
.navbar-burger {
margin-left: 0;
}
}
}
.navbar-item {
text-transform: uppercase;
.button {
border-radius: 0;
}
.button.is-primary {
box-shadow: 0 1px 13px 0 rgba(247,147,30,.6)
}
}
| $navbar-height: 5.5rem;
$navbar-item-img-max-height: 67px;
@import "bulma/sass/components/navbar";
.navbar-logo {
- width: 175px;
? ^
+ $baseWidth: 175px;
? ^^^^^^
- height: 175/388*148px;
+ width: $baseWidth;
+
+ @include mobile {
+ width: $baseWidth / 2;
+ }
}
.navbar-brand {
.is-hidden-desktop {
margin-left: auto;
}
+ @include tablet {
- .navbar-burger {
+ .navbar-burger {
? ++
- margin-left: 0;
+ margin-left: 0;
? ++
+ }
+ }
+ @include mobile {
+ .navbar-burger {
+ margin-left: 0;
+ }
}
}
.navbar-item {
text-transform: uppercase;
.button {
border-radius: 0;
}
.button.is-primary {
box-shadow: 0 1px 13px 0 rgba(247,147,30,.6)
}
}
| 19 | 0.633333 | 15 | 4 |
443d91e4d31ac763b37c0df2de2d0e1e86fdde7f | package.json | package.json | {
"name": "Enaml-Native Demo",
"bundle_id":"com.frmdstryr.enamlnative.demo",
"version": "1.8",
"private": true,
"sources": [
"src/apps/",
"src"
],
"android": {
"ndk":"/home/jrm/Android/Crystax/crystax-ndk-10.3.2",
"sdk":"/home/jrm/Android/Sdk",
"arches": ["x86", "armeabi-v7a"],
"dependencies": {
"python2crystax": "2.7.10",
"enamlnative": ">=2.1",
"tornado": ">=4.0",
"singledispatch":">=0",
"backports_abc":">=0",
"ply": "==3.10"
},
"excluded":[]
},
"ios": {
"project": "demo",
"arches": [
"x86_64",
"i386",
"armv7",
"arm64"
],
"dependencies": {
"openssl":"1.0.2l",
"python":"2.7.13",
"tornado": ">=4.0",
"singledispatch": ">=0",
"backports_abc": ">=0",
"ply": "==3.10"
},
"excluded":[]
}
}
| {
"name": "Enaml-Native Demo",
"bundle_id":"com.frmdstryr.enamlnative.demo",
"version": "1.8",
"private": true,
"sources": [
"src/apps/",
"src"
],
"android": {
"ndk":"~/Android/Crystax/crystax-ndk-10.3.2",
"sdk":"~/Android/Sdk",
"arches": ["x86", "armeabi-v7a"],
"dependencies": {
"python2crystax": "2.7.10",
"enamlnative": ">=2.1",
"tornado": ">=4.0",
"singledispatch":">=0",
"backports_abc":">=0",
"ply": "==3.10"
},
"excluded":[]
},
"ios": {
"project": "demo",
"arches": [
"x86_64",
"i386",
"armv7",
"arm64"
],
"dependencies": {
"openssl":"1.0.2l",
"python":"2.7.13",
"tornado": ">=4.0",
"singledispatch": ">=0",
"backports_abc": ">=0",
"ply": "==3.10"
},
"excluded":[]
}
}
| Make paths relative to home | Make paths relative to home
| JSON | mit | codelv/enaml-native,codelv/enaml-native,codelv/enaml-native,codelv/enaml-native | json | ## Code Before:
{
"name": "Enaml-Native Demo",
"bundle_id":"com.frmdstryr.enamlnative.demo",
"version": "1.8",
"private": true,
"sources": [
"src/apps/",
"src"
],
"android": {
"ndk":"/home/jrm/Android/Crystax/crystax-ndk-10.3.2",
"sdk":"/home/jrm/Android/Sdk",
"arches": ["x86", "armeabi-v7a"],
"dependencies": {
"python2crystax": "2.7.10",
"enamlnative": ">=2.1",
"tornado": ">=4.0",
"singledispatch":">=0",
"backports_abc":">=0",
"ply": "==3.10"
},
"excluded":[]
},
"ios": {
"project": "demo",
"arches": [
"x86_64",
"i386",
"armv7",
"arm64"
],
"dependencies": {
"openssl":"1.0.2l",
"python":"2.7.13",
"tornado": ">=4.0",
"singledispatch": ">=0",
"backports_abc": ">=0",
"ply": "==3.10"
},
"excluded":[]
}
}
## Instruction:
Make paths relative to home
## Code After:
{
"name": "Enaml-Native Demo",
"bundle_id":"com.frmdstryr.enamlnative.demo",
"version": "1.8",
"private": true,
"sources": [
"src/apps/",
"src"
],
"android": {
"ndk":"~/Android/Crystax/crystax-ndk-10.3.2",
"sdk":"~/Android/Sdk",
"arches": ["x86", "armeabi-v7a"],
"dependencies": {
"python2crystax": "2.7.10",
"enamlnative": ">=2.1",
"tornado": ">=4.0",
"singledispatch":">=0",
"backports_abc":">=0",
"ply": "==3.10"
},
"excluded":[]
},
"ios": {
"project": "demo",
"arches": [
"x86_64",
"i386",
"armv7",
"arm64"
],
"dependencies": {
"openssl":"1.0.2l",
"python":"2.7.13",
"tornado": ">=4.0",
"singledispatch": ">=0",
"backports_abc": ">=0",
"ply": "==3.10"
},
"excluded":[]
}
}
| {
"name": "Enaml-Native Demo",
"bundle_id":"com.frmdstryr.enamlnative.demo",
"version": "1.8",
"private": true,
"sources": [
"src/apps/",
"src"
],
"android": {
- "ndk":"/home/jrm/Android/Crystax/crystax-ndk-10.3.2",
? ^^^^^^^^^
+ "ndk":"~/Android/Crystax/crystax-ndk-10.3.2",
? ^
- "sdk":"/home/jrm/Android/Sdk",
? ^^^^^^^^^
+ "sdk":"~/Android/Sdk",
? ^
"arches": ["x86", "armeabi-v7a"],
"dependencies": {
"python2crystax": "2.7.10",
"enamlnative": ">=2.1",
"tornado": ">=4.0",
"singledispatch":">=0",
"backports_abc":">=0",
"ply": "==3.10"
},
"excluded":[]
},
"ios": {
"project": "demo",
"arches": [
"x86_64",
"i386",
"armv7",
"arm64"
],
"dependencies": {
"openssl":"1.0.2l",
"python":"2.7.13",
"tornado": ">=4.0",
"singledispatch": ">=0",
"backports_abc": ">=0",
"ply": "==3.10"
},
"excluded":[]
}
} | 4 | 0.095238 | 2 | 2 |
780e4eb03420d75c18d0b21b5e616f2952aeda41 | test/test_basic_logic.py | test/test_basic_logic.py | import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
(':path', '/'),
(':scheme', 'https'),
(':method', 'GET'),
]
def test_begin_connection(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
assert len(frames) == 1
def test_sending_some_data(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
frames.append(c.send_data_on_stream(1, b'test', end_stream=True))
assert len(frames) == 2
def test_receive_headers_frame(self):
f = frame.HeadersFrame(1)
f.data = b'fake headers'
f.flags = set(['END_STREAM', 'END_HEADERS'])
c = h2.connection.H2Connection()
assert c.receive_frame(f) is None
| import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
(':path', '/'),
(':scheme', 'https'),
(':method', 'GET'),
]
def test_begin_connection(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
assert len(frames) == 1
def test_sending_some_data(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
frames.append(c.send_data_on_stream(1, b'test', end_stream=True))
assert len(frames) == 2
def test_receive_headers_frame(self):
f = frame.HeadersFrame(1)
f.data = b'fake headers'
f.flags = set(['END_STREAM', 'END_HEADERS'])
c = h2.connection.H2Connection()
assert c.receive_frame(f) is None
def test_send_headers_end_stream(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(
1, self.example_request_headers, end_stream=True
)
assert len(frames) == 1
assert frames[-1].flags == set(['END_STREAM', 'END_HEADERS'])
| Test sending headers with end stream. | Test sending headers with end stream.
| Python | mit | python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2,vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2 | python | ## Code Before:
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
(':path', '/'),
(':scheme', 'https'),
(':method', 'GET'),
]
def test_begin_connection(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
assert len(frames) == 1
def test_sending_some_data(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
frames.append(c.send_data_on_stream(1, b'test', end_stream=True))
assert len(frames) == 2
def test_receive_headers_frame(self):
f = frame.HeadersFrame(1)
f.data = b'fake headers'
f.flags = set(['END_STREAM', 'END_HEADERS'])
c = h2.connection.H2Connection()
assert c.receive_frame(f) is None
## Instruction:
Test sending headers with end stream.
## Code After:
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
(':path', '/'),
(':scheme', 'https'),
(':method', 'GET'),
]
def test_begin_connection(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
assert len(frames) == 1
def test_sending_some_data(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
frames.append(c.send_data_on_stream(1, b'test', end_stream=True))
assert len(frames) == 2
def test_receive_headers_frame(self):
f = frame.HeadersFrame(1)
f.data = b'fake headers'
f.flags = set(['END_STREAM', 'END_HEADERS'])
c = h2.connection.H2Connection()
assert c.receive_frame(f) is None
def test_send_headers_end_stream(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(
1, self.example_request_headers, end_stream=True
)
assert len(frames) == 1
assert frames[-1].flags == set(['END_STREAM', 'END_HEADERS'])
| import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
(':path', '/'),
(':scheme', 'https'),
(':method', 'GET'),
]
def test_begin_connection(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
assert len(frames) == 1
def test_sending_some_data(self):
c = h2.connection.H2Connection()
frames = c.send_headers_on_stream(1, self.example_request_headers)
frames.append(c.send_data_on_stream(1, b'test', end_stream=True))
assert len(frames) == 2
def test_receive_headers_frame(self):
f = frame.HeadersFrame(1)
f.data = b'fake headers'
f.flags = set(['END_STREAM', 'END_HEADERS'])
c = h2.connection.H2Connection()
assert c.receive_frame(f) is None
+
+ def test_send_headers_end_stream(self):
+ c = h2.connection.H2Connection()
+ frames = c.send_headers_on_stream(
+ 1, self.example_request_headers, end_stream=True
+ )
+ assert len(frames) == 1
+ assert frames[-1].flags == set(['END_STREAM', 'END_HEADERS']) | 8 | 0.235294 | 8 | 0 |
f25b84f4df181e6f54b223b2ce1cf4e881722206 | test/support/ipv6.rb | test/support/ipv6.rb | IPV6_SUPPORT = File.exist?("/proc/net/if_inet6")
class Minitest::Test
private
def skip_unless_ipv6_support
unless IPV6_SUPPORT
message = "WARNING: Skipping test_static_ipv6 due to lack of IPv6 support."
warn(message)
skip(message)
end
end
end
| IPV6_SUPPORT = (File.exist?("/proc/net/if_inet6") && !File.read("/proc/net/if_inet6").empty?)
class Minitest::Test
private
def skip_unless_ipv6_support
unless IPV6_SUPPORT
message = "WARNING: Skipping test_static_ipv6 due to lack of IPv6 support."
warn(message)
skip(message)
end
end
end
| Fix IPv6 detection in CI environment. | Fix IPv6 detection in CI environment.
| Ruby | mit | NREL/api-umbrella,NREL/api-umbrella,NREL/api-umbrella,NREL/api-umbrella | ruby | ## Code Before:
IPV6_SUPPORT = File.exist?("/proc/net/if_inet6")
class Minitest::Test
private
def skip_unless_ipv6_support
unless IPV6_SUPPORT
message = "WARNING: Skipping test_static_ipv6 due to lack of IPv6 support."
warn(message)
skip(message)
end
end
end
## Instruction:
Fix IPv6 detection in CI environment.
## Code After:
IPV6_SUPPORT = (File.exist?("/proc/net/if_inet6") && !File.read("/proc/net/if_inet6").empty?)
class Minitest::Test
private
def skip_unless_ipv6_support
unless IPV6_SUPPORT
message = "WARNING: Skipping test_static_ipv6 due to lack of IPv6 support."
warn(message)
skip(message)
end
end
end
| - IPV6_SUPPORT = File.exist?("/proc/net/if_inet6")
+ IPV6_SUPPORT = (File.exist?("/proc/net/if_inet6") && !File.read("/proc/net/if_inet6").empty?)
class Minitest::Test
private
def skip_unless_ipv6_support
unless IPV6_SUPPORT
message = "WARNING: Skipping test_static_ipv6 due to lack of IPv6 support."
warn(message)
skip(message)
end
end
end | 2 | 0.153846 | 1 | 1 |
038fde309fe825a7c4fef140f7cbbf59c6ad8163 | lib/rails/assets/templates/README.md.erb | lib/rails/assets/templates/README.md.erb |
This gem was generated, please visit [rails-asset.org](http://rails-assets.org) for more information.
## Installation
Add this two lines to your application's Gemfile:
```ruby
source "http://rails-assets.org"
gem <%= component.gem_name.dump %>
```
## Usage
```js
//= require <%= component.name.dump %>
```
|
> The Bower package inside a gem
This gem was automatically generated. You can visit [rails-assets.org](http://rails-assets.org) for more information.
## Usage
Add these two lines to your applicationβs `Gemfile`:
```ruby
source "http://rails-assets.org"
gem <%= component.gem_name.dump %>
```
Then, import the asset using Sprocketsβ `require` directive:
```js
//= require <%= component.name.dump %>
```
| Tweak the gem README template | Tweak the gem README template
| HTML+ERB | mit | tenex/rails-assets,tenex/rails-assets,tenex/rails-assets | html+erb | ## Code Before:
This gem was generated, please visit [rails-asset.org](http://rails-assets.org) for more information.
## Installation
Add this two lines to your application's Gemfile:
```ruby
source "http://rails-assets.org"
gem <%= component.gem_name.dump %>
```
## Usage
```js
//= require <%= component.name.dump %>
```
## Instruction:
Tweak the gem README template
## Code After:
> The Bower package inside a gem
This gem was automatically generated. You can visit [rails-assets.org](http://rails-assets.org) for more information.
## Usage
Add these two lines to your applicationβs `Gemfile`:
```ruby
source "http://rails-assets.org"
gem <%= component.gem_name.dump %>
```
Then, import the asset using Sprocketsβ `require` directive:
```js
//= require <%= component.name.dump %>
```
|
- This gem was generated, please visit [rails-asset.org](http://rails-assets.org) for more information.
+ > The Bower package inside a gem
- ## Installation
+ This gem was automatically generated. You can visit [rails-assets.org](http://rails-assets.org) for more information.
+ ## Usage
+
- Add this two lines to your application's Gemfile:
? ^ ^
+ Add these two lines to your applicationβs `Gemfile`:
? ^ + ^ + +
```ruby
source "http://rails-assets.org"
gem <%= component.gem_name.dump %>
```
- ## Usage
+ Then, import the asset using Sprocketsβ `require` directive:
```js
//= require <%= component.name.dump %>
``` | 10 | 0.555556 | 6 | 4 |
ffcf920df29328e59817707c7789d1b8f90f7332 | CHANGELOG.md | CHANGELOG.md |
- Add Apt proxy configuration for FTP URIs ([GH-5][])
- Warn and fail if Vagrant is older than v1.2.0 ([GH-7][])
# 0.1.1 / 2013-06-27
- Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2][])
* Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
# 0.1.0 / 2013-06-27
- Initial release
- Support for Apt proxy configuration
- Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
|
- Add Apt proxy configuration for FTP URIs ([GH-5][])
- Warn and fail if Vagrant is older than v1.2.0 ([GH-7][])
# 0.1.1 / 2013-06-27
- Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2][])
* Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
# 0.1.0 / 2013-06-27
- Initial release
- Support for Apt proxy configuration
- Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
[GH-7]: https://github.com/tmatilai/vagrant-proxyconf/issues/7 "Issue 7"
| Fix issue link in changelog | Fix issue link in changelog
[ci skip]
| Markdown | mit | tmatilai/vagrant-proxyconf,otahi/vagrant-proxyconf,tmatilai/vagrant-proxyconf,mrsheepuk/vagrant-proxyconf | markdown | ## Code Before:
- Add Apt proxy configuration for FTP URIs ([GH-5][])
- Warn and fail if Vagrant is older than v1.2.0 ([GH-7][])
# 0.1.1 / 2013-06-27
- Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2][])
* Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
# 0.1.0 / 2013-06-27
- Initial release
- Support for Apt proxy configuration
- Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
## Instruction:
Fix issue link in changelog
[ci skip]
## Code After:
- Add Apt proxy configuration for FTP URIs ([GH-5][])
- Warn and fail if Vagrant is older than v1.2.0 ([GH-7][])
# 0.1.1 / 2013-06-27
- Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2][])
* Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
# 0.1.0 / 2013-06-27
- Initial release
- Support for Apt proxy configuration
- Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
[GH-7]: https://github.com/tmatilai/vagrant-proxyconf/issues/7 "Issue 7"
|
- Add Apt proxy configuration for FTP URIs ([GH-5][])
- Warn and fail if Vagrant is older than v1.2.0 ([GH-7][])
# 0.1.1 / 2013-06-27
- Don't crash if there is no configuration for us in the Vagrantfiles ([GH-2][])
* Related [Vagrant issue](https://github.com/mitchellh/vagrant/issues/1877)
# 0.1.0 / 2013-06-27
- Initial release
- Support for Apt proxy configuration
- Based heavily on [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) plugin
[GH-2]: https://github.com/tmatilai/vagrant-proxyconf/issues/2 "Issue 2"
[GH-5]: https://github.com/tmatilai/vagrant-proxyconf/issues/5 "Issue 5"
+ [GH-7]: https://github.com/tmatilai/vagrant-proxyconf/issues/7 "Issue 7" | 1 | 0.055556 | 1 | 0 |
77b90bbe7a1e16bef0a52811a8aabb3f0ac5702a | src/App/Bundle/MainBundle/Resources/views/Submission/submit.html.twig | src/App/Bundle/MainBundle/Resources/views/Submission/submit.html.twig | {% extends 'AppMainBundle::layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% javascripts
'@AppMainBundle/Resources/public/js/jquery.form-3.51.0.min.js'
'@AppMainBundle/Resources/public/js/submission/main.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h3>DΓ©tails</h3>
{{ form_start(form) }}
{{ form_rest(form) }}
<input type="submit" value="{{ 'form.submit'|trans }}" />
<a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
{{ form_end(form) }}
</div>
<div class="col-md-4">
<h3>Auto-remplissage</h3>
{{ form_start(linkForm, {action: path('app_main_submission_autocomplete'), attr: {'data-ajax-form': true}}) }}
{{ form_rest(linkForm) }}
<input type="submit" value="{{ 'form.submit'|trans }}" />
{{ form_end(linkForm) }}
</div>
</div>
{% endblock %}
| {% extends 'AppMainBundle::layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% javascripts
'@AppMainBundle/Resources/public/js/jquery.form-3.51.0.min.js'
'@AppMainBundle/Resources/public/js/submission/main.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h3>DΓ©tails</h3>
{{ form_start(form) }}
{{ form_rest(form) }}
<button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
ou <a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
{{ form_end(form) }}
</div>
<div class="col-md-4">
<h3>Auto-remplissage</h3>
{{ form_start(linkForm, {action: path('app_main_submission_autocomplete'), attr: {'data-ajax-form': true}}) }}
{{ form_rest(linkForm) }}
<button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
{{ form_end(linkForm) }}
</div>
</div>
{% endblock %}
| Fix button's design on the submission page | Fix button's design on the submission page
| Twig | mit | re7/world-records,re7/world-records,re7/world-records,re7/world-records | twig | ## Code Before:
{% extends 'AppMainBundle::layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% javascripts
'@AppMainBundle/Resources/public/js/jquery.form-3.51.0.min.js'
'@AppMainBundle/Resources/public/js/submission/main.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h3>DΓ©tails</h3>
{{ form_start(form) }}
{{ form_rest(form) }}
<input type="submit" value="{{ 'form.submit'|trans }}" />
<a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
{{ form_end(form) }}
</div>
<div class="col-md-4">
<h3>Auto-remplissage</h3>
{{ form_start(linkForm, {action: path('app_main_submission_autocomplete'), attr: {'data-ajax-form': true}}) }}
{{ form_rest(linkForm) }}
<input type="submit" value="{{ 'form.submit'|trans }}" />
{{ form_end(linkForm) }}
</div>
</div>
{% endblock %}
## Instruction:
Fix button's design on the submission page
## Code After:
{% extends 'AppMainBundle::layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% javascripts
'@AppMainBundle/Resources/public/js/jquery.form-3.51.0.min.js'
'@AppMainBundle/Resources/public/js/submission/main.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h3>DΓ©tails</h3>
{{ form_start(form) }}
{{ form_rest(form) }}
<button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
ou <a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
{{ form_end(form) }}
</div>
<div class="col-md-4">
<h3>Auto-remplissage</h3>
{{ form_start(linkForm, {action: path('app_main_submission_autocomplete'), attr: {'data-ajax-form': true}}) }}
{{ form_rest(linkForm) }}
<button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
{{ form_end(linkForm) }}
</div>
</div>
{% endblock %}
| {% extends 'AppMainBundle::layout.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% javascripts
'@AppMainBundle/Resources/public/js/jquery.form-3.51.0.min.js'
'@AppMainBundle/Resources/public/js/submission/main.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h3>DΓ©tails</h3>
{{ form_start(form) }}
{{ form_rest(form) }}
- <input type="submit" value="{{ 'form.submit'|trans }}" />
? ^^^ ^ ^^^ ^^
+ <button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
? ^ +++ ^^ ^^ +++++++++++++++++ ^ ++++++
- <a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
+ ou <a href="{{ path('app_main_homepage') }}">{{ 'form.cancel'|trans }}</a>
? +++
{{ form_end(form) }}
</div>
<div class="col-md-4">
<h3>Auto-remplissage</h3>
{{ form_start(linkForm, {action: path('app_main_submission_autocomplete'), attr: {'data-ajax-form': true}}) }}
{{ form_rest(linkForm) }}
- <input type="submit" value="{{ 'form.submit'|trans }}" />
? ^^^ ^ ^^^ ^^
+ <button type="submit" class="btn btn-default">{{ 'form.submit'|trans }}</button>
? ^ +++ ^^ ^^ +++++++++++++++++ ^ ++++++
{{ form_end(linkForm) }}
</div>
</div>
{% endblock %} | 6 | 0.193548 | 3 | 3 |
4b663941065ea70dda7434fd51f051d8faafab22 | README.md | README.md |
A simple Go program to print the date and time.
## Installation
Use `go install github.com/brettchalupa/dat` to fetch the program.
[Go](https://golang.org/) must be installed and configured.
## Usage
Use the `dat` command to output the current date and time.
For example:
```
$ dat
Feb 15, 2016 at 12:26pm (PST)
```
|
A simple Go program to print the date and time.
## Installation
[Go](https://golang.org/) must be installed and configured.
Use the following commands to install the program:
1. Get the source - `go get github.com/brettchalupa/dat`
2. Install dat - `go install github.com/brettchalupa/dat`
3. Make Go bins accessible to PATH by adding `export PATH=$PATH:$GOPATH/bin` to the shell config.
## Usage
Use the `dat` command to output the current date and time.
For example:
```
$ dat
Feb 15, 2016 at 12:26pm (PST)
```
| Update the installation instructions to work | Update the installation instructions to work
This tweaks the steps to be more accurate as to what needs to happen.
| Markdown | mit | brettchalupa/dat | markdown | ## Code Before:
A simple Go program to print the date and time.
## Installation
Use `go install github.com/brettchalupa/dat` to fetch the program.
[Go](https://golang.org/) must be installed and configured.
## Usage
Use the `dat` command to output the current date and time.
For example:
```
$ dat
Feb 15, 2016 at 12:26pm (PST)
```
## Instruction:
Update the installation instructions to work
This tweaks the steps to be more accurate as to what needs to happen.
## Code After:
A simple Go program to print the date and time.
## Installation
[Go](https://golang.org/) must be installed and configured.
Use the following commands to install the program:
1. Get the source - `go get github.com/brettchalupa/dat`
2. Install dat - `go install github.com/brettchalupa/dat`
3. Make Go bins accessible to PATH by adding `export PATH=$PATH:$GOPATH/bin` to the shell config.
## Usage
Use the `dat` command to output the current date and time.
For example:
```
$ dat
Feb 15, 2016 at 12:26pm (PST)
```
|
A simple Go program to print the date and time.
## Installation
- Use `go install github.com/brettchalupa/dat` to fetch the program.
[Go](https://golang.org/) must be installed and configured.
+
+ Use the following commands to install the program:
+
+ 1. Get the source - `go get github.com/brettchalupa/dat`
+ 2. Install dat - `go install github.com/brettchalupa/dat`
+ 3. Make Go bins accessible to PATH by adding `export PATH=$PATH:$GOPATH/bin` to the shell config.
## Usage
Use the `dat` command to output the current date and time.
For example:
```
$ dat
Feb 15, 2016 at 12:26pm (PST)
``` | 7 | 0.388889 | 6 | 1 |
881822e5bda0debcadcaafdb284dc11024d3031a | fedoracommunity/mokshaapps/updates/templates/package_updates_table_widget.mak | fedoracommunity/mokshaapps/updates/templates/package_updates_table_widget.mak | <div class="list header-list">
<table id="${id}">
<thead>
<tr>
<th><a href="#nvr">Version</a></th>
<th>Age</th>
<th>Status</th>
<th> </th>
</tr>
</thead>
<tbody class="rowtemplate">
<tr>
<td>
${c.update_hover_menu(show_package=False, show_version=True)}
</td>
<td>@{date_pushed}</td>
<td>@{status}
<div class="karma"><a href="https://admin.fedoraproject.org/updates/@{title}" moksha_url="dynamic"><img src="/images/16_karma-@{karma_level}.png" />@{karma_str} karma</a></div>
</td>
<td>
@{package_update_action}
</td>
</tr>
</tbody>
</table>
<div id="grid-controls">
<div class="message template" id="info_display" >
Viewing @{visible_rows} of @{total_rows} updates
</div>
<div class="pager" id="pager" type="numeric" ></div>
<div class="pager template" id="pager" type="more_link">
<a href="@{more_link}" moksha_url="dynamic">View more stable updates ></a>
</div>
</div>
</div>
| <div class="list header-list">
<table id="${id}">
<thead>
<tr>
<th><a href="#nvr">Version</a></th>
<th>Age</th>
<th>Status</th>
<th> </th>
</tr>
</thead>
<tbody class="rowtemplate">
<tr>
<td>
${c.update_hover_menu(show_package=False, show_version=True)}
</td>
<td>@{date_pushed_display}</td>
<td>@{status}
<div class="karma"><a href="https://admin.fedoraproject.org/updates/@{title}" moksha_url="dynamic"><img src="/images/16_karma-@{karma_level}.png" />@{karma_str} karma</a></div>
</td>
<td>
@{details}
</td>
</tr>
</tbody>
</table>
<div id="grid-controls">
<div class="message template" id="info_display" >
Viewing @{visible_rows} of @{total_rows} updates
</div>
<div class="pager" id="pager" type="numeric" ></div>
<div class="pager template" id="pager" type="more_link">
<a href="@{more_link}" moksha_url="dynamic">View more stable updates ></a>
</div>
</div>
</div>
| Tweak some of the updates grid columns | Tweak some of the updates grid columns
| Makefile | agpl-3.0 | Fale/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages | makefile | ## Code Before:
<div class="list header-list">
<table id="${id}">
<thead>
<tr>
<th><a href="#nvr">Version</a></th>
<th>Age</th>
<th>Status</th>
<th> </th>
</tr>
</thead>
<tbody class="rowtemplate">
<tr>
<td>
${c.update_hover_menu(show_package=False, show_version=True)}
</td>
<td>@{date_pushed}</td>
<td>@{status}
<div class="karma"><a href="https://admin.fedoraproject.org/updates/@{title}" moksha_url="dynamic"><img src="/images/16_karma-@{karma_level}.png" />@{karma_str} karma</a></div>
</td>
<td>
@{package_update_action}
</td>
</tr>
</tbody>
</table>
<div id="grid-controls">
<div class="message template" id="info_display" >
Viewing @{visible_rows} of @{total_rows} updates
</div>
<div class="pager" id="pager" type="numeric" ></div>
<div class="pager template" id="pager" type="more_link">
<a href="@{more_link}" moksha_url="dynamic">View more stable updates ></a>
</div>
</div>
</div>
## Instruction:
Tweak some of the updates grid columns
## Code After:
<div class="list header-list">
<table id="${id}">
<thead>
<tr>
<th><a href="#nvr">Version</a></th>
<th>Age</th>
<th>Status</th>
<th> </th>
</tr>
</thead>
<tbody class="rowtemplate">
<tr>
<td>
${c.update_hover_menu(show_package=False, show_version=True)}
</td>
<td>@{date_pushed_display}</td>
<td>@{status}
<div class="karma"><a href="https://admin.fedoraproject.org/updates/@{title}" moksha_url="dynamic"><img src="/images/16_karma-@{karma_level}.png" />@{karma_str} karma</a></div>
</td>
<td>
@{details}
</td>
</tr>
</tbody>
</table>
<div id="grid-controls">
<div class="message template" id="info_display" >
Viewing @{visible_rows} of @{total_rows} updates
</div>
<div class="pager" id="pager" type="numeric" ></div>
<div class="pager template" id="pager" type="more_link">
<a href="@{more_link}" moksha_url="dynamic">View more stable updates ></a>
</div>
</div>
</div>
| <div class="list header-list">
<table id="${id}">
<thead>
<tr>
<th><a href="#nvr">Version</a></th>
<th>Age</th>
<th>Status</th>
<th> </th>
</tr>
</thead>
<tbody class="rowtemplate">
<tr>
<td>
${c.update_hover_menu(show_package=False, show_version=True)}
</td>
- <td>@{date_pushed}</td>
+ <td>@{date_pushed_display}</td>
? ++++++++
<td>@{status}
<div class="karma"><a href="https://admin.fedoraproject.org/updates/@{title}" moksha_url="dynamic"><img src="/images/16_karma-@{karma_level}.png" />@{karma_str} karma</a></div>
</td>
<td>
- @{package_update_action}
+ @{details}
</td>
</tr>
</tbody>
</table>
<div id="grid-controls">
<div class="message template" id="info_display" >
Viewing @{visible_rows} of @{total_rows} updates
</div>
<div class="pager" id="pager" type="numeric" ></div>
<div class="pager template" id="pager" type="more_link">
<a href="@{more_link}" moksha_url="dynamic">View more stable updates ></a>
</div>
</div>
</div> | 4 | 0.114286 | 2 | 2 |
23f2306617a4e4bceecd20190c328b2b3418abc4 | setup.py | setup.py |
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='[email protected]',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),
install_requires=['pandas', 'tables', 'h5py', 'scandir']
)
|
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='[email protected]',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),
install_requires=[
'numpy',
'pandas',
'tables',
'h5py',
'scandir',
'PyYAML'
]
)
| Add PyYAML & numpy dependency | Add PyYAML & numpy dependency
I'm adding numpy too because we import it directly.
| Python | bsd-3-clause | datreant/datreant,dotsdl/datreant,datreant/datreant.core,datreant/datreant.core,datreant/datreant,datreant/datreant.data | python | ## Code Before:
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='[email protected]',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),
install_requires=['pandas', 'tables', 'h5py', 'scandir']
)
## Instruction:
Add PyYAML & numpy dependency
I'm adding numpy too because we import it directly.
## Code After:
from setuptools import setup
setup(name='datreant',
version='0.5.1',
author='David Dotson',
author_email='[email protected]',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),
install_requires=[
'numpy',
'pandas',
'tables',
'h5py',
'scandir',
'PyYAML'
]
)
|
from setuptools import setup
setup(name='datreant',
version='0.5.1',
- author='David Dotson',
? -
+ author='David Dotson',
author_email='[email protected]',
packages=['datreant', 'datreant.tests'],
scripts=[],
license='BSD',
long_description=open('README.rst').read(),
- install_requires=['pandas', 'tables', 'h5py', 'scandir']
+ install_requires=[
+ 'numpy',
+ 'pandas',
+ 'tables',
+ 'h5py',
+ 'scandir',
+ 'PyYAML'
+ ]
- )
+ )
? +
| 13 | 1 | 10 | 3 |
fcad9199caf7a1d712e5730aebe8bb8610da7eea | spec/factories/plugins_thermometers.rb | spec/factories/plugins_thermometers.rb | FactoryGirl.define do
factory :plugins_thermometer, :class => 'Plugins::Thermometer' do
title "MyString"
offset 1
total 1
campaign_page nil
active false
end
end
| FactoryGirl.define do
factory :plugins_thermometer, :class => 'Plugins::Thermometer' do
title "MyString"
offset 1
goal 1
campaign_page nil
active false
end
end
| Fix thermometer plugin factory as per Omar's master plan | Fix thermometer plugin factory as per Omar's master plan
| Ruby | mit | SumOfUs/Champaign,SumOfUs/Champaign,SumOfUs/Champaign,SumOfUs/Champaign,SumOfUs/Champaign | ruby | ## Code Before:
FactoryGirl.define do
factory :plugins_thermometer, :class => 'Plugins::Thermometer' do
title "MyString"
offset 1
total 1
campaign_page nil
active false
end
end
## Instruction:
Fix thermometer plugin factory as per Omar's master plan
## Code After:
FactoryGirl.define do
factory :plugins_thermometer, :class => 'Plugins::Thermometer' do
title "MyString"
offset 1
goal 1
campaign_page nil
active false
end
end
| FactoryGirl.define do
factory :plugins_thermometer, :class => 'Plugins::Thermometer' do
title "MyString"
- offset 1
+ offset 1
? ++++
- total 1
+ goal 1
- campaign_page nil
+ campaign_page nil
? ++++
- active false
+ active false
? ++++
end
-
end | 9 | 0.9 | 4 | 5 |
657a49055f192b95303f5869126705ad02ff169d | hiera/users/modustri-ci.yaml | hiera/users/modustri-ci.yaml | boxen::personal::homebrew_packages:
- ngrok
boxen::personal::osx_apps:
- caffeine
| boxen::personal::homebrew_packages:
- groovy
- lcov
- ngrok
boxen::personal::osx_apps:
- caffeine
| Include groovy and lcov for robots | Include groovy and lcov for robots
| YAML | mit | jacebrowning/my-boxen,jacebrowning/my-boxen,jacebrowning/my-boxen | yaml | ## Code Before:
boxen::personal::homebrew_packages:
- ngrok
boxen::personal::osx_apps:
- caffeine
## Instruction:
Include groovy and lcov for robots
## Code After:
boxen::personal::homebrew_packages:
- groovy
- lcov
- ngrok
boxen::personal::osx_apps:
- caffeine
| boxen::personal::homebrew_packages:
+ - groovy
+ - lcov
- ngrok
boxen::personal::osx_apps:
- caffeine | 2 | 0.4 | 2 | 0 |
8efab7ddd356a9b2e2209b668d3ed83a5ac9faf2 | tests/test_logic.py | tests/test_logic.py | from context import core
from context import models
from models import model
from core import logic
import unittest
class test_logic(unittest.TestCase):
def test_create_room_office(self):
new_office = logic.create_room('office', 'orange')
self.assertIsInstance(new_office, model.Office)
def test_create_room_livingspace(self):
new_livingspace = logic.create_room('livingspace', 'manjaro')
self.assertIsInstance(new_livingspace, model.LivingSpace)
def test_create_room_Wrongtype(self):
self.assertRaises(TypeError, logic.create_room('wrongname', 'orange'))
def test_create_room_Noname(self):
self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
| from context import core
from context import models
from models import model
from core import logic
import unittest
class test_logic(unittest.TestCase):
def setUp(self):
self.white_char_in_name = logic.create_room('office', "name ")
self.white_char_in_typr = logic.create_room('livingspace ', "name")
def test_create_room_office(self):
new_office = logic.create_room('office', 'orange')
self.assertIsInstance(new_office, model.Office)
def test_create_room_livingspace(self):
new_livingspace = logic.create_room('livingspace', 'manjaro')
self.assertIsInstance(new_livingspace, model.LivingSpace)
def test_create_room_Wrongtype(self):
with self.assertRaises(TypeError):
logic.create_room('wrongname', 'gooodname')
def test_create_room_Noname(self):
self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
def test_white_char_in_name(self):
self.assertEqual(self.white_char_in_name.name, "name")
def test_white_char_in_type(self):
self.assertIsInstance(self.white_char_in_typr, model.LivingSpace)
| Add test case to test non-standard input | Add test case to test non-standard input
| Python | mit | georgreen/Geoogreen-Mamboleo-Dojo-Project | python | ## Code Before:
from context import core
from context import models
from models import model
from core import logic
import unittest
class test_logic(unittest.TestCase):
def test_create_room_office(self):
new_office = logic.create_room('office', 'orange')
self.assertIsInstance(new_office, model.Office)
def test_create_room_livingspace(self):
new_livingspace = logic.create_room('livingspace', 'manjaro')
self.assertIsInstance(new_livingspace, model.LivingSpace)
def test_create_room_Wrongtype(self):
self.assertRaises(TypeError, logic.create_room('wrongname', 'orange'))
def test_create_room_Noname(self):
self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
## Instruction:
Add test case to test non-standard input
## Code After:
from context import core
from context import models
from models import model
from core import logic
import unittest
class test_logic(unittest.TestCase):
def setUp(self):
self.white_char_in_name = logic.create_room('office', "name ")
self.white_char_in_typr = logic.create_room('livingspace ', "name")
def test_create_room_office(self):
new_office = logic.create_room('office', 'orange')
self.assertIsInstance(new_office, model.Office)
def test_create_room_livingspace(self):
new_livingspace = logic.create_room('livingspace', 'manjaro')
self.assertIsInstance(new_livingspace, model.LivingSpace)
def test_create_room_Wrongtype(self):
with self.assertRaises(TypeError):
logic.create_room('wrongname', 'gooodname')
def test_create_room_Noname(self):
self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
def test_white_char_in_name(self):
self.assertEqual(self.white_char_in_name.name, "name")
def test_white_char_in_type(self):
self.assertIsInstance(self.white_char_in_typr, model.LivingSpace)
| from context import core
from context import models
from models import model
from core import logic
import unittest
class test_logic(unittest.TestCase):
- def test_create_room_office(self):
- new_office = logic.create_room('office', 'orange')
- self.assertIsInstance(new_office, model.Office)
+ def setUp(self):
+ self.white_char_in_name = logic.create_room('office', "name ")
+ self.white_char_in_typr = logic.create_room('livingspace ', "name")
- def test_create_room_livingspace(self):
- new_livingspace = logic.create_room('livingspace', 'manjaro')
- self.assertIsInstance(new_livingspace, model.LivingSpace)
- def test_create_room_Wrongtype(self):
? ^ -- ^^^^^
+ def test_create_room_office(self):
? ^^^^ ^^^^
- self.assertRaises(TypeError, logic.create_room('wrongname', 'orange'))
+ new_office = logic.create_room('office', 'orange')
+ self.assertIsInstance(new_office, model.Office)
+ def test_create_room_livingspace(self):
+ new_livingspace = logic.create_room('livingspace', 'manjaro')
+ self.assertIsInstance(new_livingspace, model.LivingSpace)
+
+ def test_create_room_Wrongtype(self):
+ with self.assertRaises(TypeError):
+ logic.create_room('wrongname', 'gooodname')
+
- def test_create_room_Noname(self):
? ^
+ def test_create_room_Noname(self):
? ^^^^
- self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
? ^^
+ self.assertEqual(logic.create_room('office', ' '), 'Invalid name')
? ^^^^^^^^
+
+ def test_white_char_in_name(self):
+ self.assertEqual(self.white_char_in_name.name, "name")
+
+ def test_white_char_in_type(self):
+ self.assertIsInstance(self.white_char_in_typr, model.LivingSpace) | 32 | 1.454545 | 22 | 10 |
c393265858eb8b87b8e298695995963870663179 | .github/workflows/ci.yml | .github/workflows/ci.yml | name: ci
on:
workflow_dispatch:
push:
branches:
- develop
- main
pull_request:
jobs:
call-workflow:
uses: craftcms/.github/.github/workflows/ci.yml@v1
secrets:
slack_webhook_url: ${{ secrets.SLACK_PLUGIN_WEBHOOK_URL }}
with:
run_ecs: true
run_phpstan: true
| name: ci
on:
workflow_dispatch:
push:
branches:
- develop
- main
- '5.0'
pull_request:
jobs:
call-workflow:
uses: craftcms/.github/.github/workflows/ci.yml@v1
secrets:
slack_webhook_url: ${{ secrets.SLACK_PLUGIN_WEBHOOK_URL }}
with:
run_ecs: true
run_phpstan: true
| Include 5.0 branch in CI | Include 5.0 branch in CI
| YAML | mit | engram-design/FeedMe,engram-design/FeedMe,engram-design/FeedMe | yaml | ## Code Before:
name: ci
on:
workflow_dispatch:
push:
branches:
- develop
- main
pull_request:
jobs:
call-workflow:
uses: craftcms/.github/.github/workflows/ci.yml@v1
secrets:
slack_webhook_url: ${{ secrets.SLACK_PLUGIN_WEBHOOK_URL }}
with:
run_ecs: true
run_phpstan: true
## Instruction:
Include 5.0 branch in CI
## Code After:
name: ci
on:
workflow_dispatch:
push:
branches:
- develop
- main
- '5.0'
pull_request:
jobs:
call-workflow:
uses: craftcms/.github/.github/workflows/ci.yml@v1
secrets:
slack_webhook_url: ${{ secrets.SLACK_PLUGIN_WEBHOOK_URL }}
with:
run_ecs: true
run_phpstan: true
| name: ci
on:
workflow_dispatch:
push:
branches:
- develop
- main
+ - '5.0'
pull_request:
jobs:
call-workflow:
uses: craftcms/.github/.github/workflows/ci.yml@v1
secrets:
slack_webhook_url: ${{ secrets.SLACK_PLUGIN_WEBHOOK_URL }}
with:
run_ecs: true
run_phpstan: true | 1 | 0.0625 | 1 | 0 |
326fbf66f4cb9c6c6ca15e5bd4fdf6ddc2f5a491 | tests/README.md | tests/README.md | Snippet-tests
=====================
Automated tests for the Snippets web app
Running Tests
-------------
___Running the tests against staging___
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* Run `tox`
___Running the tests against production___
* `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
* `tox`
Or:
* Run `tox -- --base-url=https://snippets.mozilla.com`
License
-------
This software is licensed under the [MPL] 2.0:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
[MPL]: http://www.mozilla.org/MPL/2.0/
| Snippet-tests
=====================
Automated tests for the Snippets web app
Running Tests
-------------
___Running the tests against staging___
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* Run `tox`
___Running the tests against production___
* Set `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
* Run `tox`
Or:
* Run `tox -e py27 -- --base-url=https://snippets.mozilla.com`
License
-------
This software is licensed under the [MPL] 2.0:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
[MPL]: http://www.mozilla.org/MPL/2.0/
| Fix stupid typos on tox params | Fix stupid typos on tox params
| Markdown | mpl-2.0 | mozilla/snippets-service,mozilla/snippets-service,glogiotatidis/snippets-service,glogiotatidis/snippets-service,mozmar/snippets-service,mozilla/snippets-service,mozilla/snippets-service,glogiotatidis/snippets-service,glogiotatidis/snippets-service,mozmar/snippets-service,mozmar/snippets-service,mozmar/snippets-service | markdown | ## Code Before:
Snippet-tests
=====================
Automated tests for the Snippets web app
Running Tests
-------------
___Running the tests against staging___
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* Run `tox`
___Running the tests against production___
* `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
* `tox`
Or:
* Run `tox -- --base-url=https://snippets.mozilla.com`
License
-------
This software is licensed under the [MPL] 2.0:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
[MPL]: http://www.mozilla.org/MPL/2.0/
## Instruction:
Fix stupid typos on tox params
## Code After:
Snippet-tests
=====================
Automated tests for the Snippets web app
Running Tests
-------------
___Running the tests against staging___
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* Run `tox`
___Running the tests against production___
* Set `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
* Run `tox`
Or:
* Run `tox -e py27 -- --base-url=https://snippets.mozilla.com`
License
-------
This software is licensed under the [MPL] 2.0:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
[MPL]: http://www.mozilla.org/MPL/2.0/
| Snippet-tests
=====================
Automated tests for the Snippets web app
Running Tests
-------------
___Running the tests against staging___
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* Run `tox`
___Running the tests against production___
- * `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
+ * Set `export PYTEST_BASE_URL="https://snippets.mozilla.com"`
? ++++
- * `tox`
+ * Run `tox`
? ++++
Or:
- * Run `tox -- --base-url=https://snippets.mozilla.com`
+ * Run `tox -e py27 -- --base-url=https://snippets.mozilla.com`
? ++++++++
License
-------
This software is licensed under the [MPL] 2.0:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
[MPL]: http://www.mozilla.org/MPL/2.0/ | 6 | 0.193548 | 3 | 3 |
c1610d201df4513d2e93a4e0ea760542b6e4aa0a | COMMITTERS.md | COMMITTERS.md |
Please see our [Project Governance](https://github.com/twitter/analytics-infra-governance) page for more details.
## Active
| Name | Handle |
|------------------------|-----------------------------------------------------------|
| Alex Levenson | [@isnotinvain](https://github.com/isnotinvain) |
| Ben Pence | [@benpence](https://github.com/benpence) |
| Ian O'Connell | [@ianoc](https://github.com/ianoc) |
| Joe Nievelt | [@jnievelt](https://github.com/jnievelt) |
| Oscar Boykin | [@johnynek](https://github.com/johnynek) |
| Pankaj Gupta | [@pankajroark](https://github.com/pankajroark) |
| Piyush Narang | [@piyushnarang](https://github.com/piyushnarang) |
| Ruban Monu | [@rubanm](https://github.com/rubanm) |
| Sriram Krishnan | [@sriramkrishnan](https://github.com/sriramkrishnan) |
##Emeritus
|
Please see our [Project Governance](https://github.com/twitter/analytics-infra-governance) page for more details.
## Active
| Name | Handle |
|------------------------|-----------------------------------------------------------|
| Alex Levenson | [@isnotinvain](https://github.com/isnotinvain) |
| Ben Pence | [@benpence](https://github.com/benpence) |
| Ian O'Connell | [@ianoc](https://github.com/ianoc) |
| Joe Nievelt | [@jnievelt](https://github.com/jnievelt) |
| Oscar Boykin | [@johnynek](https://github.com/johnynek) |
| Pankaj Gupta | [@pankajroark](https://github.com/pankajroark) |
| Piyush Narang | [@piyushnarang](https://github.com/piyushnarang) |
| Ruban Monu | [@rubanm](https://github.com/rubanm) |
| Sam Ritchie | [@sritchie](https://github.com/sritchie) |
| Sriram Krishnan | [@sriramkrishnan](https://github.com/sriramkrishnan) |
##Emeritus
| Add Sam Ritchie as a COMMITTER | Add Sam Ritchie as a COMMITTER
| Markdown | apache-2.0 | twitter/summingbird,twitter/summingbird | markdown | ## Code Before:
Please see our [Project Governance](https://github.com/twitter/analytics-infra-governance) page for more details.
## Active
| Name | Handle |
|------------------------|-----------------------------------------------------------|
| Alex Levenson | [@isnotinvain](https://github.com/isnotinvain) |
| Ben Pence | [@benpence](https://github.com/benpence) |
| Ian O'Connell | [@ianoc](https://github.com/ianoc) |
| Joe Nievelt | [@jnievelt](https://github.com/jnievelt) |
| Oscar Boykin | [@johnynek](https://github.com/johnynek) |
| Pankaj Gupta | [@pankajroark](https://github.com/pankajroark) |
| Piyush Narang | [@piyushnarang](https://github.com/piyushnarang) |
| Ruban Monu | [@rubanm](https://github.com/rubanm) |
| Sriram Krishnan | [@sriramkrishnan](https://github.com/sriramkrishnan) |
##Emeritus
## Instruction:
Add Sam Ritchie as a COMMITTER
## Code After:
Please see our [Project Governance](https://github.com/twitter/analytics-infra-governance) page for more details.
## Active
| Name | Handle |
|------------------------|-----------------------------------------------------------|
| Alex Levenson | [@isnotinvain](https://github.com/isnotinvain) |
| Ben Pence | [@benpence](https://github.com/benpence) |
| Ian O'Connell | [@ianoc](https://github.com/ianoc) |
| Joe Nievelt | [@jnievelt](https://github.com/jnievelt) |
| Oscar Boykin | [@johnynek](https://github.com/johnynek) |
| Pankaj Gupta | [@pankajroark](https://github.com/pankajroark) |
| Piyush Narang | [@piyushnarang](https://github.com/piyushnarang) |
| Ruban Monu | [@rubanm](https://github.com/rubanm) |
| Sam Ritchie | [@sritchie](https://github.com/sritchie) |
| Sriram Krishnan | [@sriramkrishnan](https://github.com/sriramkrishnan) |
##Emeritus
|
Please see our [Project Governance](https://github.com/twitter/analytics-infra-governance) page for more details.
## Active
| Name | Handle |
|------------------------|-----------------------------------------------------------|
| Alex Levenson | [@isnotinvain](https://github.com/isnotinvain) |
| Ben Pence | [@benpence](https://github.com/benpence) |
| Ian O'Connell | [@ianoc](https://github.com/ianoc) |
| Joe Nievelt | [@jnievelt](https://github.com/jnievelt) |
| Oscar Boykin | [@johnynek](https://github.com/johnynek) |
| Pankaj Gupta | [@pankajroark](https://github.com/pankajroark) |
| Piyush Narang | [@piyushnarang](https://github.com/piyushnarang) |
| Ruban Monu | [@rubanm](https://github.com/rubanm) |
+ | Sam Ritchie | [@sritchie](https://github.com/sritchie) |
| Sriram Krishnan | [@sriramkrishnan](https://github.com/sriramkrishnan) |
##Emeritus | 1 | 0.055556 | 1 | 0 |
6883c4702db90173bcdc282ce8980fee04f03b66 | pages/apim/overview/components.adoc | pages/apim/overview/components.adoc | = Components
:page-sidebar: apim_sidebar
:page-permalink: apim_overview_components.html
:page-folder: apim/overview
Next sections are describing top components which are part of Gravitee.io.
== Gateway
The gateway is the core component of the Gravitee.io platform. You can compare it to a "smart" proxy to understand its goal.
Unlike traditional HTTP proxy, the gateway is able to apply <<apim_overview_plugins.adoc#gravitee-plugins-policies, policies>> (ie. rules) to
both HTTP requests and responses according to your needs, meaning that you can enhance requests and responses processing
by adding transformation, security, and many other crazy features!
.Gravitee.io - Gateway Internal
image::architecture/graviteeio-gateway-internal.png[Gravitee.io - Gateway Internal]
.Gravitee.io - Gateway Architecture
image::architecture/graviteeio-gateway-architecture.png[Gravitee.io - Gateway Architecture]
== Management API
A restful API providing a bunch of services to manage and configure the global platform. All exposed
services are constraint by authentication and authorization rules.
You can find more information by having a look to the <<gravitee-management-api-overview, Management API>> section.
== Management UI
This is the Web UI for <<gravitee-components-mgmt-api, Gravitee.io Management API>>. This UI acts as a management tool
for API Publishers but also as a portal for your API Consumers.
| = Components
:page-sidebar: apim_sidebar
:page-permalink: apim_overview_components.html
:page-folder: apim/overview
Next sections are describing top components which are part of Gravitee.io.
== Gateway
The gateway is the core component of the Gravitee.io platform. You can compare it to a "smart" proxy to understand its goal.
Unlike traditional HTTP proxy, the gateway is able to apply <<apim_overview_plugins.adoc#gravitee-plugins-policies, policies>> (ie. rules) to
both HTTP requests and responses according to your needs, meaning that you can enhance requests and responses processing
by adding transformation, security, and many other crazy features!
.Gravitee.io - Gateway Internal
image::architecture/graviteeio-gateway-internal.png[Gravitee.io - Gateway Internal]
.Gravitee.io - Gateway Architecture
image::architecture/graviteeio-gateway-architecture.png[Gravitee.io - Gateway Architecture]
== Management API
A restful API providing a bunch of services to manage and configure the global platform. All exposed
services are constraint by authentication and authorization rules.
You can find more information by having a look to the link:/apim_installguide_management_api_documentation.html[Management API > Documentation] section.
== Management UI
This is the Web UI for <<gravitee-components-mgmt-api, Gravitee.io Management API>>. This UI acts as a management tool
for API Publishers but also as a portal for your API Consumers.
| Fix the documentation of REST API link | Fix the documentation of REST API link
| AsciiDoc | apache-2.0 | gravitee-io/gravitee-docs,gravitee-io/gravitee-docs,gravitee-io/gravitee-docs | asciidoc | ## Code Before:
= Components
:page-sidebar: apim_sidebar
:page-permalink: apim_overview_components.html
:page-folder: apim/overview
Next sections are describing top components which are part of Gravitee.io.
== Gateway
The gateway is the core component of the Gravitee.io platform. You can compare it to a "smart" proxy to understand its goal.
Unlike traditional HTTP proxy, the gateway is able to apply <<apim_overview_plugins.adoc#gravitee-plugins-policies, policies>> (ie. rules) to
both HTTP requests and responses according to your needs, meaning that you can enhance requests and responses processing
by adding transformation, security, and many other crazy features!
.Gravitee.io - Gateway Internal
image::architecture/graviteeio-gateway-internal.png[Gravitee.io - Gateway Internal]
.Gravitee.io - Gateway Architecture
image::architecture/graviteeio-gateway-architecture.png[Gravitee.io - Gateway Architecture]
== Management API
A restful API providing a bunch of services to manage and configure the global platform. All exposed
services are constraint by authentication and authorization rules.
You can find more information by having a look to the <<gravitee-management-api-overview, Management API>> section.
== Management UI
This is the Web UI for <<gravitee-components-mgmt-api, Gravitee.io Management API>>. This UI acts as a management tool
for API Publishers but also as a portal for your API Consumers.
## Instruction:
Fix the documentation of REST API link
## Code After:
= Components
:page-sidebar: apim_sidebar
:page-permalink: apim_overview_components.html
:page-folder: apim/overview
Next sections are describing top components which are part of Gravitee.io.
== Gateway
The gateway is the core component of the Gravitee.io platform. You can compare it to a "smart" proxy to understand its goal.
Unlike traditional HTTP proxy, the gateway is able to apply <<apim_overview_plugins.adoc#gravitee-plugins-policies, policies>> (ie. rules) to
both HTTP requests and responses according to your needs, meaning that you can enhance requests and responses processing
by adding transformation, security, and many other crazy features!
.Gravitee.io - Gateway Internal
image::architecture/graviteeio-gateway-internal.png[Gravitee.io - Gateway Internal]
.Gravitee.io - Gateway Architecture
image::architecture/graviteeio-gateway-architecture.png[Gravitee.io - Gateway Architecture]
== Management API
A restful API providing a bunch of services to manage and configure the global platform. All exposed
services are constraint by authentication and authorization rules.
You can find more information by having a look to the link:/apim_installguide_management_api_documentation.html[Management API > Documentation] section.
== Management UI
This is the Web UI for <<gravitee-components-mgmt-api, Gravitee.io Management API>>. This UI acts as a management tool
for API Publishers but also as a portal for your API Consumers.
| = Components
:page-sidebar: apim_sidebar
:page-permalink: apim_overview_components.html
:page-folder: apim/overview
Next sections are describing top components which are part of Gravitee.io.
== Gateway
The gateway is the core component of the Gravitee.io platform. You can compare it to a "smart" proxy to understand its goal.
Unlike traditional HTTP proxy, the gateway is able to apply <<apim_overview_plugins.adoc#gravitee-plugins-policies, policies>> (ie. rules) to
both HTTP requests and responses according to your needs, meaning that you can enhance requests and responses processing
by adding transformation, security, and many other crazy features!
.Gravitee.io - Gateway Internal
image::architecture/graviteeio-gateway-internal.png[Gravitee.io - Gateway Internal]
.Gravitee.io - Gateway Architecture
image::architecture/graviteeio-gateway-architecture.png[Gravitee.io - Gateway Architecture]
== Management API
A restful API providing a bunch of services to manage and configure the global platform. All exposed
services are constraint by authentication and authorization rules.
- You can find more information by having a look to the <<gravitee-management-api-overview, Management API>> section.
+ You can find more information by having a look to the link:/apim_installguide_management_api_documentation.html[Management API > Documentation] section.
== Management UI
This is the Web UI for <<gravitee-components-mgmt-api, Gravitee.io Management API>>. This UI acts as a management tool
for API Publishers but also as a portal for your API Consumers.
| 2 | 0.068966 | 1 | 1 |
9a15fe60f5575b0209aaf297cdd527952f8b12c0 | src/util/moduleTemplate.js | src/util/moduleTemplate.js | import template from 'babel-template';
export default str => {
return template(str, {sourceType: 'module'});
};
| import template from 'babel-template';
export default (str, opts = {}) => {
return template(str, {
...opts,
sourceType: 'module',
});
};
| Update template wrapper to support preserveComments. | Update template wrapper to support preserveComments.
| JavaScript | mit | ben-eb/css-values | javascript | ## Code Before:
import template from 'babel-template';
export default str => {
return template(str, {sourceType: 'module'});
};
## Instruction:
Update template wrapper to support preserveComments.
## Code After:
import template from 'babel-template';
export default (str, opts = {}) => {
return template(str, {
...opts,
sourceType: 'module',
});
};
| import template from 'babel-template';
- export default str => {
+ export default (str, opts = {}) => {
? + ++++++++++++
- return template(str, {sourceType: 'module'});
+ return template(str, {
+ ...opts,
+ sourceType: 'module',
+ });
}; | 7 | 1.4 | 5 | 2 |
2edd4fafe2e039d4d35d2fdd6cf2a8fc4aa88387 | docs/haystack.rst | docs/haystack.rst | ******
Search
******
To enable search in *comics* you need to install ``django-haystack`` and
setup one of their support `search backends
<http://docs.haystacksearch.org/1.0/installing_search_engines.html>`_.
Consult the `Haystack documentation <http://docs.haystacksearch.org/1.0>`_
for information about further settings.
Furthermore ``INSTALLED_APPS`` needs to contain ``haystack`` and
``comics.search``. E.g. in your ``comics/settings/local.py``, add::
from comics.settings.base import INSTALLED_APPS
INSTALLED_APPS += ('haystack', 'comics.search')
Solr schema
===========
Solr needs to be setup with at ``schema.xml`` that knows about the Comics
image model. This file can be created by running::
python manage.py build_solr_schema
Indexing
========
For initial indexing, run::
python manage.py update_index
Subsequent indexing should be done from ``cron`` with for instance::
python manage.py update_index --age=HOURS
where ``HOURS`` should be replaced according with how often you reindex.
| ******
Search
******
To enable search in *comics* you need to install ``django-haystack`` and
setup one of their `search backends
<http://docs.haystacksearch.org/1.0/installing_search_engines.html>`_.
Consult the `Haystack documentation <http://docs.haystacksearch.org/1.0>`_
for information on further settings.
Furthermore ``INSTALLED_APPS`` needs to contain ``haystack`` and
``comics.search``. E.g. in your ``comics/settings/local.py``, add::
from comics.settings.base import INSTALLED_APPS
INSTALLED_APPS += ('haystack', 'comics.search')
Solr schema
===========
Solr needs to be setup with a ``schema.xml`` that knows about the *comics*
:class:`comics.core.models.Image` model. This file can be created by running::
python manage.py build_solr_schema
Indexing
========
For initial indexing, run::
python manage.py update_index
Subsequent indexing should be done from ``cron`` with for instance::
python manage.py update_index --age=HOURS
where ``HOURS`` should be replaced according with how often you reindex.
| Improve search doc wording a bit | Improve search doc wording a bit
| reStructuredText | agpl-3.0 | klette/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,klette/comics,jodal/comics,datagutten/comics,klette/comics,datagutten/comics | restructuredtext | ## Code Before:
******
Search
******
To enable search in *comics* you need to install ``django-haystack`` and
setup one of their support `search backends
<http://docs.haystacksearch.org/1.0/installing_search_engines.html>`_.
Consult the `Haystack documentation <http://docs.haystacksearch.org/1.0>`_
for information about further settings.
Furthermore ``INSTALLED_APPS`` needs to contain ``haystack`` and
``comics.search``. E.g. in your ``comics/settings/local.py``, add::
from comics.settings.base import INSTALLED_APPS
INSTALLED_APPS += ('haystack', 'comics.search')
Solr schema
===========
Solr needs to be setup with at ``schema.xml`` that knows about the Comics
image model. This file can be created by running::
python manage.py build_solr_schema
Indexing
========
For initial indexing, run::
python manage.py update_index
Subsequent indexing should be done from ``cron`` with for instance::
python manage.py update_index --age=HOURS
where ``HOURS`` should be replaced according with how often you reindex.
## Instruction:
Improve search doc wording a bit
## Code After:
******
Search
******
To enable search in *comics* you need to install ``django-haystack`` and
setup one of their `search backends
<http://docs.haystacksearch.org/1.0/installing_search_engines.html>`_.
Consult the `Haystack documentation <http://docs.haystacksearch.org/1.0>`_
for information on further settings.
Furthermore ``INSTALLED_APPS`` needs to contain ``haystack`` and
``comics.search``. E.g. in your ``comics/settings/local.py``, add::
from comics.settings.base import INSTALLED_APPS
INSTALLED_APPS += ('haystack', 'comics.search')
Solr schema
===========
Solr needs to be setup with a ``schema.xml`` that knows about the *comics*
:class:`comics.core.models.Image` model. This file can be created by running::
python manage.py build_solr_schema
Indexing
========
For initial indexing, run::
python manage.py update_index
Subsequent indexing should be done from ``cron`` with for instance::
python manage.py update_index --age=HOURS
where ``HOURS`` should be replaced according with how often you reindex.
| ******
Search
******
To enable search in *comics* you need to install ``django-haystack`` and
- setup one of their support `search backends
? --------
+ setup one of their `search backends
<http://docs.haystacksearch.org/1.0/installing_search_engines.html>`_.
Consult the `Haystack documentation <http://docs.haystacksearch.org/1.0>`_
- for information about further settings.
? -- ^^
+ for information on further settings.
? ^
Furthermore ``INSTALLED_APPS`` needs to contain ``haystack`` and
``comics.search``. E.g. in your ``comics/settings/local.py``, add::
from comics.settings.base import INSTALLED_APPS
INSTALLED_APPS += ('haystack', 'comics.search')
Solr schema
===========
- Solr needs to be setup with at ``schema.xml`` that knows about the Comics
? - ^
+ Solr needs to be setup with a ``schema.xml`` that knows about the *comics*
? ^^ +
- image model. This file can be created by running::
+ :class:`comics.core.models.Image` model. This file can be created by running::
? +++++++++++ ++++++++++++++++ +
python manage.py build_solr_schema
Indexing
========
For initial indexing, run::
python manage.py update_index
Subsequent indexing should be done from ``cron`` with for instance::
python manage.py update_index --age=HOURS
where ``HOURS`` should be replaced according with how often you reindex. | 8 | 0.210526 | 4 | 4 |
180550a9e2fd5490e0f9e1694321d5f2dd24b97c | python/qibuild/test/world/CMakeLists.txt | python/qibuild/test/world/CMakeLists.txt | cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
project(world)
include("${CMAKE_CURRENT_SOURCE_DIR}/qibuild.cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
qi_create_lib(world SHARED SRC world/world.h world/world.cpp)
qi_stage_lib(world)
| cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
project(world)
include("${CMAKE_CURRENT_SOURCE_DIR}/qibuild.cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
qi_create_lib(world SHARED SRC world/world.h world/world.cpp)
qi_stage_lib(world)
qi_install_header(world/world.h)
| Fix install rules of the world project | Fix install rules of the world project
| Text | bsd-3-clause | dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild | text | ## Code Before:
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
project(world)
include("${CMAKE_CURRENT_SOURCE_DIR}/qibuild.cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
qi_create_lib(world SHARED SRC world/world.h world/world.cpp)
qi_stage_lib(world)
## Instruction:
Fix install rules of the world project
## Code After:
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
project(world)
include("${CMAKE_CURRENT_SOURCE_DIR}/qibuild.cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
qi_create_lib(world SHARED SRC world/world.h world/world.cpp)
qi_stage_lib(world)
qi_install_header(world/world.h)
| cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
project(world)
include("${CMAKE_CURRENT_SOURCE_DIR}/qibuild.cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
qi_create_lib(world SHARED SRC world/world.h world/world.cpp)
qi_stage_lib(world)
+ qi_install_header(world/world.h) | 1 | 0.111111 | 1 | 0 |
2a48ea482cfce7bf2e5e1f3d6dd1bfba1b4af016 | src/openmods/asm/OpenModsClassTransformer.java | src/openmods/asm/OpenModsClassTransformer.java | package openmods.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
public class OpenModsClassTransformer implements IClassTransformer {
public static interface TransformProvider {
public ClassVisitor createVisitor(ClassVisitor cv);
}
private final static TransformProvider INCLUDING_CV = new TransformProvider() {
@Override
public ClassVisitor createVisitor(ClassVisitor cv) {
return new IncludingClassVisitor(cv);
}
};
public static byte[] applyVisitor(byte[] bytes, int flags, TransformProvider context) {
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(cr, flags);
ClassVisitor mod = context.createVisitor(cw);
try {
cr.accept(mod, 0);
return cw.toByteArray();
} catch (StopTransforming e) {
return bytes;
}
}
@Override
public byte[] transform(final String name, String transformedName, byte[] bytes) {
if (name.startsWith("openmods.asm")) return bytes;
// / no need for COMPUTE_FRAMES, we can handle simple stuff
return applyVisitor(bytes, 0, INCLUDING_CV);
}
}
| package openmods.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import com.google.common.base.Preconditions;
public class OpenModsClassTransformer implements IClassTransformer {
public static interface TransformProvider {
public ClassVisitor createVisitor(ClassVisitor cv);
}
private final static TransformProvider INCLUDING_CV = new TransformProvider() {
@Override
public ClassVisitor createVisitor(ClassVisitor cv) {
return new IncludingClassVisitor(cv);
}
};
public static byte[] applyVisitor(byte[] bytes, int flags, TransformProvider context) {
Preconditions.checkNotNull(bytes);
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(cr, flags);
ClassVisitor mod = context.createVisitor(cw);
try {
cr.accept(mod, 0);
return cw.toByteArray();
} catch (StopTransforming e) {
return bytes;
}
}
@Override
public byte[] transform(final String name, String transformedName, byte[] bytes) {
if (bytes == null || name.startsWith("openmods.asm") || name.startsWith("net.minecraft.")) return bytes;
// / no need for COMPUTE_FRAMES, we can handle simple stuff
return applyVisitor(bytes, 0, INCLUDING_CV);
}
}
| Fix crash on missing classes (it will crash later, but nobody will blame us | Fix crash on missing classes (it will crash later, but nobody will blame us
| Java | mit | OpenMods/OpenModsLib,OpenMods/OpenModsLib,nevercast/OpenModsLib | java | ## Code Before:
package openmods.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
public class OpenModsClassTransformer implements IClassTransformer {
public static interface TransformProvider {
public ClassVisitor createVisitor(ClassVisitor cv);
}
private final static TransformProvider INCLUDING_CV = new TransformProvider() {
@Override
public ClassVisitor createVisitor(ClassVisitor cv) {
return new IncludingClassVisitor(cv);
}
};
public static byte[] applyVisitor(byte[] bytes, int flags, TransformProvider context) {
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(cr, flags);
ClassVisitor mod = context.createVisitor(cw);
try {
cr.accept(mod, 0);
return cw.toByteArray();
} catch (StopTransforming e) {
return bytes;
}
}
@Override
public byte[] transform(final String name, String transformedName, byte[] bytes) {
if (name.startsWith("openmods.asm")) return bytes;
// / no need for COMPUTE_FRAMES, we can handle simple stuff
return applyVisitor(bytes, 0, INCLUDING_CV);
}
}
## Instruction:
Fix crash on missing classes (it will crash later, but nobody will blame us
## Code After:
package openmods.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import com.google.common.base.Preconditions;
public class OpenModsClassTransformer implements IClassTransformer {
public static interface TransformProvider {
public ClassVisitor createVisitor(ClassVisitor cv);
}
private final static TransformProvider INCLUDING_CV = new TransformProvider() {
@Override
public ClassVisitor createVisitor(ClassVisitor cv) {
return new IncludingClassVisitor(cv);
}
};
public static byte[] applyVisitor(byte[] bytes, int flags, TransformProvider context) {
Preconditions.checkNotNull(bytes);
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(cr, flags);
ClassVisitor mod = context.createVisitor(cw);
try {
cr.accept(mod, 0);
return cw.toByteArray();
} catch (StopTransforming e) {
return bytes;
}
}
@Override
public byte[] transform(final String name, String transformedName, byte[] bytes) {
if (bytes == null || name.startsWith("openmods.asm") || name.startsWith("net.minecraft.")) return bytes;
// / no need for COMPUTE_FRAMES, we can handle simple stuff
return applyVisitor(bytes, 0, INCLUDING_CV);
}
}
| package openmods.asm;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
+
+ import com.google.common.base.Preconditions;
public class OpenModsClassTransformer implements IClassTransformer {
public static interface TransformProvider {
public ClassVisitor createVisitor(ClassVisitor cv);
}
private final static TransformProvider INCLUDING_CV = new TransformProvider() {
@Override
public ClassVisitor createVisitor(ClassVisitor cv) {
return new IncludingClassVisitor(cv);
}
};
public static byte[] applyVisitor(byte[] bytes, int flags, TransformProvider context) {
+ Preconditions.checkNotNull(bytes);
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(cr, flags);
ClassVisitor mod = context.createVisitor(cw);
try {
cr.accept(mod, 0);
return cw.toByteArray();
} catch (StopTransforming e) {
return bytes;
}
}
@Override
public byte[] transform(final String name, String transformedName, byte[] bytes) {
- if (name.startsWith("openmods.asm")) return bytes;
+ if (bytes == null || name.startsWith("openmods.asm") || name.startsWith("net.minecraft.")) return bytes;
// / no need for COMPUTE_FRAMES, we can handle simple stuff
return applyVisitor(bytes, 0, INCLUDING_CV);
}
} | 5 | 0.119048 | 4 | 1 |
b103c02815a7819e9cb4f1cc0061202cfcfd0fa6 | bidb/api/views.py | bidb/api/views.py | from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .utils import parse_submission, InvalidSubmission
@csrf_exempt
@require_http_methods(['PUT'])
def submit(request):
try:
submission, created = parse_submission(request)
except InvalidSubmission as exc:
return HttpResponseBadRequest("{}\n".format(exc))
return HttpResponse('{}{}\n'.format(
settings.SITE_URL,
submission.buildinfo.get_absolute_url(),
), status=201 if created else 200)
| from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .utils import parse_submission, InvalidSubmission
@csrf_exempt
@require_http_methods(['PUT'])
def submit(request):
try:
submission, created = parse_submission(request)
except InvalidSubmission as exc:
return HttpResponseBadRequest("Rejecting submission: {}\n".format(exc))
return HttpResponse('{}{}\n'.format(
settings.SITE_URL,
submission.buildinfo.get_absolute_url(),
), status=201 if created else 200)
| Make it clearer that we are rejecting the submission. | Make it clearer that we are rejecting the submission.
| Python | agpl-3.0 | lamby/buildinfo.debian.net,lamby/buildinfo.debian.net | python | ## Code Before:
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .utils import parse_submission, InvalidSubmission
@csrf_exempt
@require_http_methods(['PUT'])
def submit(request):
try:
submission, created = parse_submission(request)
except InvalidSubmission as exc:
return HttpResponseBadRequest("{}\n".format(exc))
return HttpResponse('{}{}\n'.format(
settings.SITE_URL,
submission.buildinfo.get_absolute_url(),
), status=201 if created else 200)
## Instruction:
Make it clearer that we are rejecting the submission.
## Code After:
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .utils import parse_submission, InvalidSubmission
@csrf_exempt
@require_http_methods(['PUT'])
def submit(request):
try:
submission, created = parse_submission(request)
except InvalidSubmission as exc:
return HttpResponseBadRequest("Rejecting submission: {}\n".format(exc))
return HttpResponse('{}{}\n'.format(
settings.SITE_URL,
submission.buildinfo.get_absolute_url(),
), status=201 if created else 200)
| from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .utils import parse_submission, InvalidSubmission
@csrf_exempt
@require_http_methods(['PUT'])
def submit(request):
try:
submission, created = parse_submission(request)
except InvalidSubmission as exc:
- return HttpResponseBadRequest("{}\n".format(exc))
+ return HttpResponseBadRequest("Rejecting submission: {}\n".format(exc))
? ++++++++++++++++++++++
return HttpResponse('{}{}\n'.format(
settings.SITE_URL,
submission.buildinfo.get_absolute_url(),
), status=201 if created else 200) | 2 | 0.1 | 1 | 1 |
eed9e611f4c207be6e8a1163bc44f6f72356226d | views/base.tpl | views/base.tpl | <html>
<head>
<title>{{ "Sericata" + (title and " - "+title or "") }}</title>
<link rel="stylesheet" type="text/css" href="./style.css">
<meta name="viewport" content="width=device-width">
</head>
<body>
{{!base}}
<div id="footer">
<ul id="menu">
<li><a href="./">Main</a></li>
<li><a href="./stats">Stats</a></li>
</ul>
<span id="donate">Donate: <a href="./donate.png">{{current_address}}</a></span>
<div id="attrib">
© <a href="http://www.gmathews.com">Grant Mathews</a> - <a href="https://github.com/grantisu/Sericata">source code</a>
</div>
</body>
</html>
| <html>
<head>
<title>{{ "Sericata" + (title and " - "+title or "") }}</title>
<link rel="stylesheet" type="text/css" href="./style.css">
<meta name="viewport" content="width=device-width">
<meta http-equiv="refresh" content="600;URL='?auto'">
</head>
<body>
{{!base}}
<div id="footer">
<ul id="menu">
<li><a href="./">Main</a></li>
<li><a href="./stats">Stats</a></li>
</ul>
<span id="donate">Donate: <a href="./donate.png">{{current_address}}</a></span>
<div id="attrib">
© <a href="http://www.gmathews.com">Grant Mathews</a> - <a href="https://github.com/grantisu/Sericata">source code</a>
</div>
</body>
</html>
| Add 10 minute refresh to all pages | Add 10 minute refresh to all pages
Since each page displays content that changes with time, add a meta
refresh tag to keep numbers and stats semi-recent.
Use the query string '?auto' for the URL, to distinguish "actual" page
loads from automated page loads in the logs.
| Smarty | mit | grantisu/Sericata | smarty | ## Code Before:
<html>
<head>
<title>{{ "Sericata" + (title and " - "+title or "") }}</title>
<link rel="stylesheet" type="text/css" href="./style.css">
<meta name="viewport" content="width=device-width">
</head>
<body>
{{!base}}
<div id="footer">
<ul id="menu">
<li><a href="./">Main</a></li>
<li><a href="./stats">Stats</a></li>
</ul>
<span id="donate">Donate: <a href="./donate.png">{{current_address}}</a></span>
<div id="attrib">
© <a href="http://www.gmathews.com">Grant Mathews</a> - <a href="https://github.com/grantisu/Sericata">source code</a>
</div>
</body>
</html>
## Instruction:
Add 10 minute refresh to all pages
Since each page displays content that changes with time, add a meta
refresh tag to keep numbers and stats semi-recent.
Use the query string '?auto' for the URL, to distinguish "actual" page
loads from automated page loads in the logs.
## Code After:
<html>
<head>
<title>{{ "Sericata" + (title and " - "+title or "") }}</title>
<link rel="stylesheet" type="text/css" href="./style.css">
<meta name="viewport" content="width=device-width">
<meta http-equiv="refresh" content="600;URL='?auto'">
</head>
<body>
{{!base}}
<div id="footer">
<ul id="menu">
<li><a href="./">Main</a></li>
<li><a href="./stats">Stats</a></li>
</ul>
<span id="donate">Donate: <a href="./donate.png">{{current_address}}</a></span>
<div id="attrib">
© <a href="http://www.gmathews.com">Grant Mathews</a> - <a href="https://github.com/grantisu/Sericata">source code</a>
</div>
</body>
</html>
| <html>
<head>
<title>{{ "Sericata" + (title and " - "+title or "") }}</title>
<link rel="stylesheet" type="text/css" href="./style.css">
<meta name="viewport" content="width=device-width">
+ <meta http-equiv="refresh" content="600;URL='?auto'">
</head>
<body>
{{!base}}
<div id="footer">
<ul id="menu">
<li><a href="./">Main</a></li>
<li><a href="./stats">Stats</a></li>
</ul>
<span id="donate">Donate: <a href="./donate.png">{{current_address}}</a></span>
<div id="attrib">
© <a href="http://www.gmathews.com">Grant Mathews</a> - <a href="https://github.com/grantisu/Sericata">source code</a>
</div>
</body>
</html> | 1 | 0.047619 | 1 | 0 |
b61ada99d9031e418a57b1676605f7ea0818735f | lib/server/appTokenUtil.js | lib/server/appTokenUtil.js | const AppTokenUtil = {
getAppTokensBasedOnQuery: getAppTokensBasedOnQuery
};
function getAppTokensBasedOnQuery(query, desktopAppId) {
let userDisabledMap = new Map();
let userIdsSet = new Set();
let appTokens = Push.appTokens.find(query).fetch();
if (!appTokens.length) {
return [];
}
appTokens.forEach(function (appToken) {
if (appToken.userId) {
userIdsSet.add(appToken.userId);
}
});
let vet = GlobalVets.findOne({appIdentifier: appTokens[0].appName});
if (!vet && desktopAppId) {
vet = GlobalVets.findOne({_id: desktopAppId});
}
if (!vet) {
console.log(`Couldn't find vet for id ${desktopAppId} or app identifier ${appTokens[0].appName}`);
return false;
}
let users = Meteor.users.find({_id: {$in: [...userIdsSet]}}).fetch();
users.forEach(user => {
let isUserDisabled = user.accountDisabledPerVet && user.accountDisabledPerVet[vet._id];
userDisabledMap.set(user._id, isUserDisabled);
});
return appTokens.filter(appToken => {
return !(appToken.userId && userDisabledMap.get(appToken.userId));
});
}
export {AppTokenUtil};
| const AppTokenUtil = {
getAppTokensBasedOnQuery: getAppTokensBasedOnQuery
};
function getAppTokensBasedOnQuery(query, desktopAppId) {
let userDisabledMap = new Map();
let userIdsSet = new Set();
let appTokens = Push.appTokens.find(query).fetch();
if (!appTokens.length) {
return [];
}
if (desktopAppId) {
return appTokens;
}
appTokens.forEach(function (appToken) {
if (appToken.userId) {
userIdsSet.add(appToken.userId);
}
});
let vet = GlobalVets.findOne({appIdentifier: appTokens[0].appName});
if (!vet) {
return [];
}
let users = Meteor.users.find({_id: {$in: [...userIdsSet]}}).fetch();
users.forEach(user => {
let isUserDisabled = user.accountDisabledPerVet && user.accountDisabledPerVet[vet._id];
userDisabledMap.set(user._id, isUserDisabled);
});
return appTokens.filter(appToken => {
return !(appToken.userId && userDisabledMap.get(appToken.userId));
});
}
export {AppTokenUtil};
| Remove vet check for desktop notifications in AppTokenUtil. | Remove vet check for desktop notifications in AppTokenUtil.
| JavaScript | mit | okgrow/push,staceesanti/push | javascript | ## Code Before:
const AppTokenUtil = {
getAppTokensBasedOnQuery: getAppTokensBasedOnQuery
};
function getAppTokensBasedOnQuery(query, desktopAppId) {
let userDisabledMap = new Map();
let userIdsSet = new Set();
let appTokens = Push.appTokens.find(query).fetch();
if (!appTokens.length) {
return [];
}
appTokens.forEach(function (appToken) {
if (appToken.userId) {
userIdsSet.add(appToken.userId);
}
});
let vet = GlobalVets.findOne({appIdentifier: appTokens[0].appName});
if (!vet && desktopAppId) {
vet = GlobalVets.findOne({_id: desktopAppId});
}
if (!vet) {
console.log(`Couldn't find vet for id ${desktopAppId} or app identifier ${appTokens[0].appName}`);
return false;
}
let users = Meteor.users.find({_id: {$in: [...userIdsSet]}}).fetch();
users.forEach(user => {
let isUserDisabled = user.accountDisabledPerVet && user.accountDisabledPerVet[vet._id];
userDisabledMap.set(user._id, isUserDisabled);
});
return appTokens.filter(appToken => {
return !(appToken.userId && userDisabledMap.get(appToken.userId));
});
}
export {AppTokenUtil};
## Instruction:
Remove vet check for desktop notifications in AppTokenUtil.
## Code After:
const AppTokenUtil = {
getAppTokensBasedOnQuery: getAppTokensBasedOnQuery
};
function getAppTokensBasedOnQuery(query, desktopAppId) {
let userDisabledMap = new Map();
let userIdsSet = new Set();
let appTokens = Push.appTokens.find(query).fetch();
if (!appTokens.length) {
return [];
}
if (desktopAppId) {
return appTokens;
}
appTokens.forEach(function (appToken) {
if (appToken.userId) {
userIdsSet.add(appToken.userId);
}
});
let vet = GlobalVets.findOne({appIdentifier: appTokens[0].appName});
if (!vet) {
return [];
}
let users = Meteor.users.find({_id: {$in: [...userIdsSet]}}).fetch();
users.forEach(user => {
let isUserDisabled = user.accountDisabledPerVet && user.accountDisabledPerVet[vet._id];
userDisabledMap.set(user._id, isUserDisabled);
});
return appTokens.filter(appToken => {
return !(appToken.userId && userDisabledMap.get(appToken.userId));
});
}
export {AppTokenUtil};
| const AppTokenUtil = {
getAppTokensBasedOnQuery: getAppTokensBasedOnQuery
};
function getAppTokensBasedOnQuery(query, desktopAppId) {
let userDisabledMap = new Map();
let userIdsSet = new Set();
let appTokens = Push.appTokens.find(query).fetch();
if (!appTokens.length) {
return [];
}
+ if (desktopAppId) {
+ return appTokens;
+ }
+
appTokens.forEach(function (appToken) {
if (appToken.userId) {
userIdsSet.add(appToken.userId);
}
});
let vet = GlobalVets.findOne({appIdentifier: appTokens[0].appName});
- if (!vet && desktopAppId) {
- vet = GlobalVets.findOne({_id: desktopAppId});
- }
-
if (!vet) {
- console.log(`Couldn't find vet for id ${desktopAppId} or app identifier ${appTokens[0].appName}`);
- return false;
? ^^^^^
+ return [];
? ^^
}
let users = Meteor.users.find({_id: {$in: [...userIdsSet]}}).fetch();
users.forEach(user => {
let isUserDisabled = user.accountDisabledPerVet && user.accountDisabledPerVet[vet._id];
userDisabledMap.set(user._id, isUserDisabled);
});
return appTokens.filter(appToken => {
return !(appToken.userId && userDisabledMap.get(appToken.userId));
});
}
export {AppTokenUtil}; | 11 | 0.244444 | 5 | 6 |
85faea2a9185924d1255e84aad1489f7e3627d13 | django_lightweight_queue/utils.py | django_lightweight_queue/utils.py | from django.db import models
from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import MiddlewareNotUsed
from django.utils.functional import memoize
from django.utils.module_loading import module_has_submodule
from . import app_settings
def get_path(path):
module_name, attr = path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, attr)
def get_backend():
return get_path(app_settings.BACKEND)()
def get_middleware():
middleware = []
for path in app_settings.MIDDLEWARE:
try:
middleware.append(get_path(path)())
except MiddlewareNotUsed:
pass
return middleware
get_path = memoize(get_path, {}, 1)
get_backend = memoize(get_backend, {}, 0)
get_middleware = memoize(get_middleware, {}, 0)
| from django.db import models
from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import MiddlewareNotUsed
from django.utils.functional import memoize
from django.utils.module_loading import module_has_submodule
from . import app_settings
def get_path(path):
module_name, attr = path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, attr)
def get_backend():
return get_path(app_settings.BACKEND)()
def get_middleware():
middleware = []
for path in app_settings.MIDDLEWARE:
try:
middleware.append(get_path(path)())
except MiddlewareNotUsed:
pass
return middleware
try:
from setproctitle import setproctitle
except ImportError:
def setproctitle(title):
pass
get_path = memoize(get_path, {}, 1)
get_backend = memoize(get_backend, {}, 0)
get_middleware = memoize(get_middleware, {}, 0)
| Add setproctitle wrapper so it's optional. | Add setproctitle wrapper so it's optional.
Signed-off-by: Chris Lamb <[email protected]>
| Python | bsd-3-clause | prophile/django-lightweight-queue,prophile/django-lightweight-queue,thread/django-lightweight-queue,lamby/django-lightweight-queue,thread/django-lightweight-queue | python | ## Code Before:
from django.db import models
from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import MiddlewareNotUsed
from django.utils.functional import memoize
from django.utils.module_loading import module_has_submodule
from . import app_settings
def get_path(path):
module_name, attr = path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, attr)
def get_backend():
return get_path(app_settings.BACKEND)()
def get_middleware():
middleware = []
for path in app_settings.MIDDLEWARE:
try:
middleware.append(get_path(path)())
except MiddlewareNotUsed:
pass
return middleware
get_path = memoize(get_path, {}, 1)
get_backend = memoize(get_backend, {}, 0)
get_middleware = memoize(get_middleware, {}, 0)
## Instruction:
Add setproctitle wrapper so it's optional.
Signed-off-by: Chris Lamb <[email protected]>
## Code After:
from django.db import models
from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import MiddlewareNotUsed
from django.utils.functional import memoize
from django.utils.module_loading import module_has_submodule
from . import app_settings
def get_path(path):
module_name, attr = path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, attr)
def get_backend():
return get_path(app_settings.BACKEND)()
def get_middleware():
middleware = []
for path in app_settings.MIDDLEWARE:
try:
middleware.append(get_path(path)())
except MiddlewareNotUsed:
pass
return middleware
try:
from setproctitle import setproctitle
except ImportError:
def setproctitle(title):
pass
get_path = memoize(get_path, {}, 1)
get_backend = memoize(get_backend, {}, 0)
get_middleware = memoize(get_middleware, {}, 0)
| from django.db import models
from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import MiddlewareNotUsed
from django.utils.functional import memoize
from django.utils.module_loading import module_has_submodule
from . import app_settings
def get_path(path):
module_name, attr = path.rsplit('.', 1)
module = import_module(module_name)
return getattr(module, attr)
def get_backend():
return get_path(app_settings.BACKEND)()
def get_middleware():
middleware = []
for path in app_settings.MIDDLEWARE:
try:
middleware.append(get_path(path)())
except MiddlewareNotUsed:
pass
return middleware
+ try:
+ from setproctitle import setproctitle
+ except ImportError:
+ def setproctitle(title):
+ pass
+
get_path = memoize(get_path, {}, 1)
get_backend = memoize(get_backend, {}, 0)
get_middleware = memoize(get_middleware, {}, 0) | 6 | 0.181818 | 6 | 0 |
3b94c916a4ec146d378d1d877f843dcf110767a5 | lib/ext_scaffold_core_extensions/array.rb | lib/ext_scaffold_core_extensions/array.rb | module ExtScaffoldCoreExtensions
module Array
# return Ext compatible JSON form of an Array, i.e.:
# {"results": n,
# "posts": [ {"id": 1, "title": "First Post",
# "body": "This is my first post.",
# "published": true, ... },
# ...
# ]
# }
def to_ext_json(options = {})
if given_class = options.delete(:class)
element_class = (given_class.is_a?(Class) ? given_class : given_class.to_s.classify.constantize)
else
element_class = first.class
end
element_count = options.delete(:count) || self.length
{ :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
end
end
end
| module ExtScaffoldCoreExtensions
module Array
# return Ext compatible JSON form of an Array, i.e.:
# {"results": n,
# "posts": [ {"id": 1, "title": "First Post",
# "body": "This is my first post.",
# "published": true, ... },
# ...
# ]
# }
def to_ext_json(options = {})
if given_class = options.delete(:class)
element_class = (given_class.is_a?(Class) ? given_class : given_class.to_s.classify.constantize)
else
element_class = first.class
end
element_count = options.delete(:count) || self.length
# Only apply the ActiveRecord JSON options
if (options[:ar_options])
r2 = self.map { | i | i.to_json(options[:ar_options]) }
r = "{ \"results\" : #{element_count}, \"#{element_class.to_s.underscore.pluralize}\" : [#{r2.join(", ")}] }"
else
r = { :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
end
return r
end
end
end
| Allow ActiveRecord to_json options to be specified, like :only or :methods (reduces JSON payload) | Allow ActiveRecord to_json options to be specified, like :only or :methods (reduces JSON payload)
| Ruby | mit | drudru/ext_scaffold,drudru/ext_scaffold | ruby | ## Code Before:
module ExtScaffoldCoreExtensions
module Array
# return Ext compatible JSON form of an Array, i.e.:
# {"results": n,
# "posts": [ {"id": 1, "title": "First Post",
# "body": "This is my first post.",
# "published": true, ... },
# ...
# ]
# }
def to_ext_json(options = {})
if given_class = options.delete(:class)
element_class = (given_class.is_a?(Class) ? given_class : given_class.to_s.classify.constantize)
else
element_class = first.class
end
element_count = options.delete(:count) || self.length
{ :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
end
end
end
## Instruction:
Allow ActiveRecord to_json options to be specified, like :only or :methods (reduces JSON payload)
## Code After:
module ExtScaffoldCoreExtensions
module Array
# return Ext compatible JSON form of an Array, i.e.:
# {"results": n,
# "posts": [ {"id": 1, "title": "First Post",
# "body": "This is my first post.",
# "published": true, ... },
# ...
# ]
# }
def to_ext_json(options = {})
if given_class = options.delete(:class)
element_class = (given_class.is_a?(Class) ? given_class : given_class.to_s.classify.constantize)
else
element_class = first.class
end
element_count = options.delete(:count) || self.length
# Only apply the ActiveRecord JSON options
if (options[:ar_options])
r2 = self.map { | i | i.to_json(options[:ar_options]) }
r = "{ \"results\" : #{element_count}, \"#{element_class.to_s.underscore.pluralize}\" : [#{r2.join(", ")}] }"
else
r = { :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
end
return r
end
end
end
| module ExtScaffoldCoreExtensions
module Array
# return Ext compatible JSON form of an Array, i.e.:
# {"results": n,
# "posts": [ {"id": 1, "title": "First Post",
# "body": "This is my first post.",
# "published": true, ... },
# ...
# ]
# }
def to_ext_json(options = {})
if given_class = options.delete(:class)
element_class = (given_class.is_a?(Class) ? given_class : given_class.to_s.classify.constantize)
else
element_class = first.class
end
element_count = options.delete(:count) || self.length
+ # Only apply the ActiveRecord JSON options
+ if (options[:ar_options])
+ r2 = self.map { | i | i.to_json(options[:ar_options]) }
+ r = "{ \"results\" : #{element_count}, \"#{element_class.to_s.underscore.pluralize}\" : [#{r2.join(", ")}] }"
+ else
- { :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
+ r = { :results => element_count, element_class.to_s.underscore.pluralize => self }.to_json(options)
? ++++++
+ end
+ return r
end
end
end | 9 | 0.375 | 8 | 1 |
8f3856d50c28828e056b3294209732dbbe1de804 | README.md | README.md | Isomorphic function to load the referer
## Isomorphic referer!
You can also plug it directly with a Node.js request by adding just before the renderToString: `var unplug = reactReferer.plugToRequest(req, res);`<br />
## Download
NPM: `npm install react-referer`<br />
Bower: `bower install react-referer`<br />
CDN: `https://cdnjs.cloudflare.com/ajax/libs/react-referer/1.0.0/react-referer.min.js`
# Examples
```js
import { Component } from 'react';
import reactReferer from 'react-referer';
export default class MyApp extends Component {
constructor(props) {
super(props);
this.state = { referer: reactReferer.referer() };
}
render() {
return (
<div>
{this.state.referer}
</div>
);
}
}
```
## License
This project is under the MIT license. You are free to do whatever you want with it.
| Isomorphic function to load the referer
## Isomorphic referer!
You can also plug it directly with a Node.js request by adding just before the renderToString: `reactReferer.plugToRequest(req);`<br />
## Download
NPM: `npm install react-referer`<br />
# Examples
```js
import { Component } from 'react';
import reactReferer from 'react-referer';
export default class MyApp extends Component {
constructor(props) {
super(props);
this.state = { referer: reactReferer.referer() };
}
render() {
return (
<div>
{this.state.referer}
</div>
);
}
}
```
## License
This project is under the MIT license. You are free to do whatever you want with it.
| Remove bower for now. Will setup this later | Remove bower for now. Will setup this later
| Markdown | mit | kevinrademan/react-referer | markdown | ## Code Before:
Isomorphic function to load the referer
## Isomorphic referer!
You can also plug it directly with a Node.js request by adding just before the renderToString: `var unplug = reactReferer.plugToRequest(req, res);`<br />
## Download
NPM: `npm install react-referer`<br />
Bower: `bower install react-referer`<br />
CDN: `https://cdnjs.cloudflare.com/ajax/libs/react-referer/1.0.0/react-referer.min.js`
# Examples
```js
import { Component } from 'react';
import reactReferer from 'react-referer';
export default class MyApp extends Component {
constructor(props) {
super(props);
this.state = { referer: reactReferer.referer() };
}
render() {
return (
<div>
{this.state.referer}
</div>
);
}
}
```
## License
This project is under the MIT license. You are free to do whatever you want with it.
## Instruction:
Remove bower for now. Will setup this later
## Code After:
Isomorphic function to load the referer
## Isomorphic referer!
You can also plug it directly with a Node.js request by adding just before the renderToString: `reactReferer.plugToRequest(req);`<br />
## Download
NPM: `npm install react-referer`<br />
# Examples
```js
import { Component } from 'react';
import reactReferer from 'react-referer';
export default class MyApp extends Component {
constructor(props) {
super(props);
this.state = { referer: reactReferer.referer() };
}
render() {
return (
<div>
{this.state.referer}
</div>
);
}
}
```
## License
This project is under the MIT license. You are free to do whatever you want with it.
| Isomorphic function to load the referer
## Isomorphic referer!
- You can also plug it directly with a Node.js request by adding just before the renderToString: `var unplug = reactReferer.plugToRequest(req, res);`<br />
? ------------- -----
+ You can also plug it directly with a Node.js request by adding just before the renderToString: `reactReferer.plugToRequest(req);`<br />
## Download
NPM: `npm install react-referer`<br />
- Bower: `bower install react-referer`<br />
- CDN: `https://cdnjs.cloudflare.com/ajax/libs/react-referer/1.0.0/react-referer.min.js`
# Examples
```js
import { Component } from 'react';
import reactReferer from 'react-referer';
export default class MyApp extends Component {
constructor(props) {
super(props);
this.state = { referer: reactReferer.referer() };
}
render() {
return (
<div>
{this.state.referer}
</div>
);
}
}
```
## License
This project is under the MIT license. You are free to do whatever you want with it. | 4 | 0.114286 | 1 | 3 |
6480ff0ee375950789e4b3b379f8eb94df70e5d7 | .hlint.yaml | .hlint.yaml | - ignore: {name: "Use fmap"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use isAsciiLower"}
- ignore: {name: "Use isAsciiUpper"}
- ignore: {name: "Use isDigit"}
- ignore: {name: "Use let"}
- ignore: {name: "Use &&&"}
- ignore: {name: "Use fromMaybe"}
- ignore: {name: "Use module export list"}
- ignore: {name: "Use section"}
- ignore: {name: "Unused LANGUAGE pragma"}
- ignore: {name: "Redundant if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use isNothing"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use null"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"}
|
- ignore: # Due to CPP
name: Unused LANGUAGE pragma
within:
- Development.Shake.Internal.Progress
- Development.Shake.Internal.FileInfo
# Warnings currently triggered by the code
- ignore: {name: "Use fmap"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use isAsciiLower"}
- ignore: {name: "Use isAsciiUpper"}
- ignore: {name: "Use isDigit"}
- ignore: {name: "Use let"}
- ignore: {name: "Use &&&"}
- ignore: {name: "Use fromMaybe"}
- ignore: {name: "Use section"}
- ignore: {name: "Redundant if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use isNothing"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use null"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"}
| Make the HLint restrictions a bit more precise | Make the HLint restrictions a bit more precise
| YAML | bsd-3-clause | ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake | yaml | ## Code Before:
- ignore: {name: "Use fmap"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use isAsciiLower"}
- ignore: {name: "Use isAsciiUpper"}
- ignore: {name: "Use isDigit"}
- ignore: {name: "Use let"}
- ignore: {name: "Use &&&"}
- ignore: {name: "Use fromMaybe"}
- ignore: {name: "Use module export list"}
- ignore: {name: "Use section"}
- ignore: {name: "Unused LANGUAGE pragma"}
- ignore: {name: "Redundant if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use isNothing"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use null"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"}
## Instruction:
Make the HLint restrictions a bit more precise
## Code After:
- ignore: # Due to CPP
name: Unused LANGUAGE pragma
within:
- Development.Shake.Internal.Progress
- Development.Shake.Internal.FileInfo
# Warnings currently triggered by the code
- ignore: {name: "Use fmap"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use isAsciiLower"}
- ignore: {name: "Use isAsciiUpper"}
- ignore: {name: "Use isDigit"}
- ignore: {name: "Use let"}
- ignore: {name: "Use &&&"}
- ignore: {name: "Use fromMaybe"}
- ignore: {name: "Use section"}
- ignore: {name: "Redundant if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use isNothing"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use null"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"}
| +
+ - ignore: # Due to CPP
+ name: Unused LANGUAGE pragma
+ within:
+ - Development.Shake.Internal.Progress
+ - Development.Shake.Internal.FileInfo
+
+ # Warnings currently triggered by the code
- ignore: {name: "Use fmap"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use isAsciiLower"}
- ignore: {name: "Use isAsciiUpper"}
- ignore: {name: "Use isDigit"}
- ignore: {name: "Use let"}
- ignore: {name: "Use &&&"}
- ignore: {name: "Use fromMaybe"}
- - ignore: {name: "Use module export list"}
- ignore: {name: "Use section"}
- - ignore: {name: "Unused LANGUAGE pragma"}
- ignore: {name: "Redundant if"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use isNothing"}
- ignore: {name: "Redundant $"}
- ignore: {name: "Use unless"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use null"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"} | 10 | 0.434783 | 8 | 2 |
57c3daed4338e33fce5efade3d3afd23446a6988 | html/index.html | html/index.html | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Coding Math!</title>
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
canvas {
display: block;
display: inline-block;
}
#sidebar {
position: absolute;
display: inline-block;
width: 150px;
background: #AAA;
height: 100%;
opacity: .9;
}
#sidebar > div {
position: relative;
margin: 5px 0px;
padding: 5px;
}
#sidebar > div:hover {
cursor: pointer;
background: #EAEAEA;
}
.current {
background: #CACACA;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<canvas id="canvas"></canvas>
<script src="bundle.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Coding Math!</title>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
box-sizing: border-box;
font-family: 'Roboto Slab', serif;
}
*, *:before, *:after {
box-sizing: inherit;
}
canvas {
display: block;
display: inline-block;
}
#sidebar {
position: absolute;
display: inline-block;
width: 150px;
background: #AAA;
height: 100%;
opacity: .9;
}
#sidebar > div {
position: relative;
margin: 5px 0px;
padding: 5px;
}
#sidebar > div:hover {
cursor: pointer;
background: #EAEAEA;
}
.current {
background: #CACACA;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<canvas id="canvas"></canvas>
<script src="bundle.js"></script>
</body>
</html>
| Add roboto slab, cause it is the best font eva | Add roboto slab, cause it is the best font eva
| HTML | mit | michaelghinrichs/coding-math,michaelghinrichs/coding-math | html | ## Code Before:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Coding Math!</title>
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
canvas {
display: block;
display: inline-block;
}
#sidebar {
position: absolute;
display: inline-block;
width: 150px;
background: #AAA;
height: 100%;
opacity: .9;
}
#sidebar > div {
position: relative;
margin: 5px 0px;
padding: 5px;
}
#sidebar > div:hover {
cursor: pointer;
background: #EAEAEA;
}
.current {
background: #CACACA;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<canvas id="canvas"></canvas>
<script src="bundle.js"></script>
</body>
</html>
## Instruction:
Add roboto slab, cause it is the best font eva
## Code After:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Coding Math!</title>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
box-sizing: border-box;
font-family: 'Roboto Slab', serif;
}
*, *:before, *:after {
box-sizing: inherit;
}
canvas {
display: block;
display: inline-block;
}
#sidebar {
position: absolute;
display: inline-block;
width: 150px;
background: #AAA;
height: 100%;
opacity: .9;
}
#sidebar > div {
position: relative;
margin: 5px 0px;
padding: 5px;
}
#sidebar > div:hover {
cursor: pointer;
background: #EAEAEA;
}
.current {
background: #CACACA;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<canvas id="canvas"></canvas>
<script src="bundle.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Coding Math!</title>
+ <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
box-sizing: border-box;
+ font-family: 'Roboto Slab', serif;
}
*, *:before, *:after {
box-sizing: inherit;
}
canvas {
display: block;
display: inline-block;
}
#sidebar {
position: absolute;
display: inline-block;
width: 150px;
background: #AAA;
height: 100%;
opacity: .9;
}
#sidebar > div {
position: relative;
margin: 5px 0px;
padding: 5px;
}
#sidebar > div:hover {
cursor: pointer;
background: #EAEAEA;
}
.current {
background: #CACACA;
}
</style>
</head>
<body>
<div id="sidebar"></div>
<canvas id="canvas"></canvas>
<script src="bundle.js"></script>
</body>
</html> | 2 | 0.043478 | 2 | 0 |
df135b8c9b45638250cd0c309da3579c54637bb6 | libraries/Trampoline.elm | libraries/Trampoline.elm | module Trampoline where
{-| Trampolining loops for unbounded recursion.
Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
```haskell
fac' : Int -> Int -> Int
fac' n acc = if n <= 0
then acc
else fac' (n - 1) (n * acc)
fac : Int -> Int
fac n = fac' n 1
-- Stack overflow
main = asText <| fac 1000000000000
```
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell
facT : Int -> Int -> Trampoline Int
facT n acc = Trampoline <| if n <= 0
then Left acc
else Right <| \() -> facT (n - 1) (n * acc)
fac : Int -> Int
fac n = trampoline <| facT n 0
-- Doesn't stack overflow
main = asText <| fac 1000000000000
```
# Trampoline
@docs Trampoline, trampoline
-}
import Native.Trampoline
{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
data Trampoline a = Done a
| Continue (() -> Trampoline a)
{-| Run a trampolining loop in constant space. -}
trampoline : Trampoline a -> a
trampoline = Native.Trampoline.trampoline
| module Trampoline where
{-| Trampolining loops for unbounded recursion.
Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
```haskell
fac' : Int -> Int -> Int
fac' n acc = if n <= 0
then acc
else fac' (n - 1) (n * acc)
fac : Int -> Int
fac n = fac' n 1
-- Stack overflow
main = asText <| fac 1000000000000
```
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell
facT : Int -> Int -> Trampoline Int
facT n acc = if n <= 0
then Done acc
else Continue <| \() -> facT (n - 1) (n * acc)
fac : Int -> Int
fac n = trampoline <| facT n 0
-- Doesn't stack overflow
main = asText <| fac 1000000000000
```
# Trampoline
@docs Trampoline, trampoline
-}
import Native.Trampoline
{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
data Trampoline a = Done a
| Continue (() -> Trampoline a)
{-| Run a trampolining loop in constant space. -}
trampoline : Trampoline a -> a
trampoline = Native.Trampoline.trampoline
| Update trampoline docs to new interface. | Update trampoline docs to new interface.
| Elm | bsd-3-clause | pairyo/elm-compiler,Axure/elm-compiler,laszlopandy/elm-compiler,mgold/Elm,JoeyEremondi/elm-pattern-effects,deadfoxygrandpa/Elm,5outh/Elm | elm | ## Code Before:
module Trampoline where
{-| Trampolining loops for unbounded recursion.
Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
```haskell
fac' : Int -> Int -> Int
fac' n acc = if n <= 0
then acc
else fac' (n - 1) (n * acc)
fac : Int -> Int
fac n = fac' n 1
-- Stack overflow
main = asText <| fac 1000000000000
```
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell
facT : Int -> Int -> Trampoline Int
facT n acc = Trampoline <| if n <= 0
then Left acc
else Right <| \() -> facT (n - 1) (n * acc)
fac : Int -> Int
fac n = trampoline <| facT n 0
-- Doesn't stack overflow
main = asText <| fac 1000000000000
```
# Trampoline
@docs Trampoline, trampoline
-}
import Native.Trampoline
{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
data Trampoline a = Done a
| Continue (() -> Trampoline a)
{-| Run a trampolining loop in constant space. -}
trampoline : Trampoline a -> a
trampoline = Native.Trampoline.trampoline
## Instruction:
Update trampoline docs to new interface.
## Code After:
module Trampoline where
{-| Trampolining loops for unbounded recursion.
Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
```haskell
fac' : Int -> Int -> Int
fac' n acc = if n <= 0
then acc
else fac' (n - 1) (n * acc)
fac : Int -> Int
fac n = fac' n 1
-- Stack overflow
main = asText <| fac 1000000000000
```
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell
facT : Int -> Int -> Trampoline Int
facT n acc = if n <= 0
then Done acc
else Continue <| \() -> facT (n - 1) (n * acc)
fac : Int -> Int
fac n = trampoline <| facT n 0
-- Doesn't stack overflow
main = asText <| fac 1000000000000
```
# Trampoline
@docs Trampoline, trampoline
-}
import Native.Trampoline
{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
data Trampoline a = Done a
| Continue (() -> Trampoline a)
{-| Run a trampolining loop in constant space. -}
trampoline : Trampoline a -> a
trampoline = Native.Trampoline.trampoline
| module Trampoline where
{-| Trampolining loops for unbounded recursion.
Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
```haskell
fac' : Int -> Int -> Int
fac' n acc = if n <= 0
then acc
else fac' (n - 1) (n * acc)
fac : Int -> Int
fac n = fac' n 1
-- Stack overflow
main = asText <| fac 1000000000000
```
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell
facT : Int -> Int -> Trampoline Int
- facT n acc = Trampoline <| if n <= 0
? --------------
+ facT n acc = if n <= 0
- then Left acc
+ then Done acc
- else Right <| \() -> facT (n - 1) (n * acc)
? -------------- ^ ^^^
+ else Continue <| \() -> facT (n - 1) (n * acc)
? ^^^^ ^^^
fac : Int -> Int
fac n = trampoline <| facT n 0
-- Doesn't stack overflow
main = asText <| fac 1000000000000
```
# Trampoline
@docs Trampoline, trampoline
-}
import Native.Trampoline
{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
data Trampoline a = Done a
| Continue (() -> Trampoline a)
{-| Run a trampolining loop in constant space. -}
trampoline : Trampoline a -> a
trampoline = Native.Trampoline.trampoline | 6 | 0.142857 | 3 | 3 |
0a6d22a4c7840f7a7ffcd3cfbeacd886e77eb9d9 | app/views/sessions/session/visualization/textvisualization/textvisualization.component.ts | app/views/sessions/session/visualization/textvisualization/textvisualization.component.ts | import FileResource from "../../../../../resources/fileresource";
import SessionDataService from "../../sessiondata.service";
class TextVisualizationController {
static $inject = ['FileResource', '$scope', 'SessionDataService'];
datasetId: string;
data: string;
constructor(private fileResource: FileResource, private $scope: ng.IScope, private SessionDataService: SessionDataService) {
}
$onInit() {
this.fileResource.getData(this.SessionDataService.getSessionId(), this.datasetId).then( (resp: any) => {
this.data = resp.data;
});
}
}
export default {
controller: TextVisualizationController,
template: '<p>{{$ctrl.data}}</p>',
bindings: {
datasetId: '<'
}
}
| import FileResource from "../../../../../resources/fileresource";
import SessionDataService from "../../sessiondata.service";
class TextVisualizationController {
static $inject = ['FileResource', '$scope', 'SessionDataService'];
datasetId: string;
data: string;
constructor(private fileResource: FileResource, private $scope: ng.IScope, private SessionDataService: SessionDataService) {
}
$onInit() {
this.fileResource.getData(this.SessionDataService.getSessionId(), this.datasetId).then( (resp: any) => {
this.$scope.$apply(() => {
this.data = resp.data;
});
});
}
}
export default {
controller: TextVisualizationController,
template: '<p>{{$ctrl.data}}</p>',
bindings: {
datasetId: '<'
}
}
| Update view when we get the reponse | Update view when we get the reponse
| TypeScript | mit | chipster/chipster-web,chipster/chipster-web,chipster/chipster-web | typescript | ## Code Before:
import FileResource from "../../../../../resources/fileresource";
import SessionDataService from "../../sessiondata.service";
class TextVisualizationController {
static $inject = ['FileResource', '$scope', 'SessionDataService'];
datasetId: string;
data: string;
constructor(private fileResource: FileResource, private $scope: ng.IScope, private SessionDataService: SessionDataService) {
}
$onInit() {
this.fileResource.getData(this.SessionDataService.getSessionId(), this.datasetId).then( (resp: any) => {
this.data = resp.data;
});
}
}
export default {
controller: TextVisualizationController,
template: '<p>{{$ctrl.data}}</p>',
bindings: {
datasetId: '<'
}
}
## Instruction:
Update view when we get the reponse
## Code After:
import FileResource from "../../../../../resources/fileresource";
import SessionDataService from "../../sessiondata.service";
class TextVisualizationController {
static $inject = ['FileResource', '$scope', 'SessionDataService'];
datasetId: string;
data: string;
constructor(private fileResource: FileResource, private $scope: ng.IScope, private SessionDataService: SessionDataService) {
}
$onInit() {
this.fileResource.getData(this.SessionDataService.getSessionId(), this.datasetId).then( (resp: any) => {
this.$scope.$apply(() => {
this.data = resp.data;
});
});
}
}
export default {
controller: TextVisualizationController,
template: '<p>{{$ctrl.data}}</p>',
bindings: {
datasetId: '<'
}
}
| import FileResource from "../../../../../resources/fileresource";
import SessionDataService from "../../sessiondata.service";
class TextVisualizationController {
static $inject = ['FileResource', '$scope', 'SessionDataService'];
datasetId: string;
data: string;
constructor(private fileResource: FileResource, private $scope: ng.IScope, private SessionDataService: SessionDataService) {
}
$onInit() {
this.fileResource.getData(this.SessionDataService.getSessionId(), this.datasetId).then( (resp: any) => {
+ this.$scope.$apply(() => {
- this.data = resp.data;
+ this.data = resp.data;
? ++++
+ });
});
}
}
export default {
controller: TextVisualizationController,
template: '<p>{{$ctrl.data}}</p>',
bindings: {
datasetId: '<'
}
} | 4 | 0.142857 | 3 | 1 |
61bbc5697df7e7d9186618219d390a13069b0d98 | package.json | package.json | {
"name": "easy-react-native",
"version": "1.1.11",
"description": "A combination of store and router to make react-native app easy.",
"main": "src/EasyReactNative.js",
"contributors": [
{
"name": "Jimmy-YMJ",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Jimmy-YMJ/easy-react-native"
},
"author": "Jimmy-YMJ",
"license": "MIT",
"dependencies": {
"deep-equal": ">=1.0.1",
"jsonstore-js": ">=1.1.12",
"mini-routerjs": ">=1.1.5",
"react": "^16.0.0-alpha.6",
"react-native": ">=0.42.0",
"simple-url": ">=1.1.8"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
}
}
| {
"name": "easy-react-native",
"version": "1.1.11",
"description": "A combination of store and router to make react-native app easy.",
"main": "src/EasyReactNative.js",
"contributors": [
{
"name": "Jimmy-YMJ",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Jimmy-YMJ/easy-react-native"
},
"author": "Jimmy-YMJ",
"license": "MIT",
"dependencies": {
"deep-equal": "^1.0.1",
"jsonstore-js": "^1.1.12",
"mini-routerjs": "^1.1.5",
"simple-url": "^1.1.8"
},
"peerDependencies": {
"react": "^15.5.4",
"react-native": "^0.42.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
}
}
| Change dependencies type of react and react-native to peerDependencies | Change dependencies type of react and react-native to peerDependencies
| JSON | mit | Jimmy-YMJ/easy-react-native | json | ## Code Before:
{
"name": "easy-react-native",
"version": "1.1.11",
"description": "A combination of store and router to make react-native app easy.",
"main": "src/EasyReactNative.js",
"contributors": [
{
"name": "Jimmy-YMJ",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Jimmy-YMJ/easy-react-native"
},
"author": "Jimmy-YMJ",
"license": "MIT",
"dependencies": {
"deep-equal": ">=1.0.1",
"jsonstore-js": ">=1.1.12",
"mini-routerjs": ">=1.1.5",
"react": "^16.0.0-alpha.6",
"react-native": ">=0.42.0",
"simple-url": ">=1.1.8"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
}
}
## Instruction:
Change dependencies type of react and react-native to peerDependencies
## Code After:
{
"name": "easy-react-native",
"version": "1.1.11",
"description": "A combination of store and router to make react-native app easy.",
"main": "src/EasyReactNative.js",
"contributors": [
{
"name": "Jimmy-YMJ",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Jimmy-YMJ/easy-react-native"
},
"author": "Jimmy-YMJ",
"license": "MIT",
"dependencies": {
"deep-equal": "^1.0.1",
"jsonstore-js": "^1.1.12",
"mini-routerjs": "^1.1.5",
"simple-url": "^1.1.8"
},
"peerDependencies": {
"react": "^15.5.4",
"react-native": "^0.42.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
}
}
| {
"name": "easy-react-native",
"version": "1.1.11",
"description": "A combination of store and router to make react-native app easy.",
"main": "src/EasyReactNative.js",
"contributors": [
{
"name": "Jimmy-YMJ",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Jimmy-YMJ/easy-react-native"
},
"author": "Jimmy-YMJ",
"license": "MIT",
"dependencies": {
- "deep-equal": ">=1.0.1",
? ^^
+ "deep-equal": "^1.0.1",
? ^
- "jsonstore-js": ">=1.1.12",
? ^^
+ "jsonstore-js": "^1.1.12",
? ^
- "mini-routerjs": ">=1.1.5",
? ^^
+ "mini-routerjs": "^1.1.5",
? ^
- "react": "^16.0.0-alpha.6",
- "react-native": ">=0.42.0",
- "simple-url": ">=1.1.8"
? ^^
+ "simple-url": "^1.1.8"
? ^
+ },
+ "peerDependencies": {
+ "react": "^15.5.4",
+ "react-native": "^0.42.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1"
}
} | 14 | 0.466667 | 8 | 6 |
98aedf6a235e145929b40b7e14607ee3d5b83979 | lib/stepping_stone/text_mapper/pattern.rb | lib/stepping_stone/text_mapper/pattern.rb | module SteppingStone
class Pattern
def self.[](*parts)
new(parts)
end
attr_reader :parts
def initialize(parts)
@parts = parts
end
def match(targets)
self.===(targets)
end
def ===(targets)
return false unless Array === targets
compare(parts, targets)
end
def captures_from(targets)
result, bindings = captures_helper(parts, targets)
return bindings if result
end
def captures_helper(parts, targets, last_result=nil, captures=[])
return [last_result, captures] unless part = parts[0] and target = targets[0]
current_result = (part === target)
if current_result
case part
when Class
captures.push(target)
when Regexp
captures.push(*part.match(target).captures)
end
captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
end
def to_s
"#{self.class}: '#{parts}'"
end
private
def compare(parts, targets, last_result=nil)
return last_result unless part = parts[0] and target = targets[0]
current_result = (part === target)
return false unless current_result
compare(parts[1..-1], targets[1..-1], current_result)
end
end
end
| module SteppingStone
module TextMapper
class Pattern
def self.[](*parts)
new(parts)
end
attr_reader :parts
def initialize(parts)
@parts = parts
end
def match(targets)
self.===(targets)
end
def ===(targets)
return false unless Array === targets
compare(parts, targets)
end
def captures_from(targets)
result, bindings = captures_helper(parts, targets)
return bindings if result
end
def captures_helper(parts, targets, last_result=nil, captures=[])
return [last_result, captures] unless part = parts[0] and target = targets[0]
current_result = (part === target)
if current_result
case part
when Class
captures.push(target)
when Regexp
captures.push(*part.match(target).captures)
end
captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
end
def to_s
"#{self.class}: '#{parts}'"
end
private
def compare(parts, targets, last_result=nil)
return last_result unless part = parts[0] and target = targets[0]
current_result = (part === target)
return false unless current_result
compare(parts[1..-1], targets[1..-1], current_result)
end
end
end
end
| Move Pattern into TextMapper module | Move Pattern into TextMapper module
| Ruby | mit | cucumber/cucumber-ruby-spike-donotuse | ruby | ## Code Before:
module SteppingStone
class Pattern
def self.[](*parts)
new(parts)
end
attr_reader :parts
def initialize(parts)
@parts = parts
end
def match(targets)
self.===(targets)
end
def ===(targets)
return false unless Array === targets
compare(parts, targets)
end
def captures_from(targets)
result, bindings = captures_helper(parts, targets)
return bindings if result
end
def captures_helper(parts, targets, last_result=nil, captures=[])
return [last_result, captures] unless part = parts[0] and target = targets[0]
current_result = (part === target)
if current_result
case part
when Class
captures.push(target)
when Regexp
captures.push(*part.match(target).captures)
end
captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
end
def to_s
"#{self.class}: '#{parts}'"
end
private
def compare(parts, targets, last_result=nil)
return last_result unless part = parts[0] and target = targets[0]
current_result = (part === target)
return false unless current_result
compare(parts[1..-1], targets[1..-1], current_result)
end
end
end
## Instruction:
Move Pattern into TextMapper module
## Code After:
module SteppingStone
module TextMapper
class Pattern
def self.[](*parts)
new(parts)
end
attr_reader :parts
def initialize(parts)
@parts = parts
end
def match(targets)
self.===(targets)
end
def ===(targets)
return false unless Array === targets
compare(parts, targets)
end
def captures_from(targets)
result, bindings = captures_helper(parts, targets)
return bindings if result
end
def captures_helper(parts, targets, last_result=nil, captures=[])
return [last_result, captures] unless part = parts[0] and target = targets[0]
current_result = (part === target)
if current_result
case part
when Class
captures.push(target)
when Regexp
captures.push(*part.match(target).captures)
end
captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
end
def to_s
"#{self.class}: '#{parts}'"
end
private
def compare(parts, targets, last_result=nil)
return last_result unless part = parts[0] and target = targets[0]
current_result = (part === target)
return false unless current_result
compare(parts[1..-1], targets[1..-1], current_result)
end
end
end
end
| module SteppingStone
+ module TextMapper
- class Pattern
+ class Pattern
? ++
- def self.[](*parts)
+ def self.[](*parts)
? ++
- new(parts)
+ new(parts)
? ++
- end
+ end
? ++
- attr_reader :parts
+ attr_reader :parts
? ++
- def initialize(parts)
+ def initialize(parts)
? ++
- @parts = parts
+ @parts = parts
? ++
- end
+ end
? ++
- def match(targets)
+ def match(targets)
? ++
- self.===(targets)
+ self.===(targets)
? ++
- end
+ end
? ++
- def ===(targets)
+ def ===(targets)
? ++
- return false unless Array === targets
+ return false unless Array === targets
? ++
- compare(parts, targets)
+ compare(parts, targets)
? ++
- end
+ end
? ++
- def captures_from(targets)
+ def captures_from(targets)
? ++
- result, bindings = captures_helper(parts, targets)
+ result, bindings = captures_helper(parts, targets)
? ++
- return bindings if result
+ return bindings if result
? ++
- end
+ end
? ++
- def captures_helper(parts, targets, last_result=nil, captures=[])
+ def captures_helper(parts, targets, last_result=nil, captures=[])
? ++
- return [last_result, captures] unless part = parts[0] and target = targets[0]
+ return [last_result, captures] unless part = parts[0] and target = targets[0]
? ++
- current_result = (part === target)
+ current_result = (part === target)
? ++
- if current_result
+ if current_result
? ++
- case part
+ case part
? ++
- when Class
+ when Class
? ++
- captures.push(target)
+ captures.push(target)
? ++
- when Regexp
+ when Regexp
? ++
- captures.push(*part.match(target).captures)
+ captures.push(*part.match(target).captures)
? ++
+ end
+ captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
- captures_helper(parts[1..-1], targets[1..-1], current_result, captures)
end
- end
- def to_s
+ def to_s
? ++
- "#{self.class}: '#{parts}'"
+ "#{self.class}: '#{parts}'"
? ++
- end
+ end
? ++
- private
+ private
? ++
- def compare(parts, targets, last_result=nil)
+ def compare(parts, targets, last_result=nil)
? ++
- return last_result unless part = parts[0] and target = targets[0]
+ return last_result unless part = parts[0] and target = targets[0]
? ++
- current_result = (part === target)
+ current_result = (part === target)
? ++
- return false unless current_result
+ return false unless current_result
? ++
- compare(parts[1..-1], targets[1..-1], current_result)
+ compare(parts[1..-1], targets[1..-1], current_result)
? ++
+ end
end
end
end | 80 | 1.454545 | 41 | 39 |
c7532f3f4aeb30d1b6090f3483623d2c9b1dfaa5 | public/locales/su/send.ftl | public/locales/su/send.ftl | importingFile = Ngimpor...
encryptingFile = NgΓ©nkripsi...
decryptingFile = NgadΓ©kripsi...
downloadCount =
{ $num ->
*[other] { $num } undeuran
}
timespanHours =
{ $num ->
*[other] { $num } jam
}
copiedUrl = Ditiron!
unlockInputPlaceholder = Kecap sandi
unlockButtonLabel = Laan konci
downloadButtonLabel = Undeur
downloadFinish = Undeuran anggeus
fileSizeProgress = ({ $partialSize } ti { $totalSize })
sendYourFilesLink = Pecakan Firefox Send
errorPageHeader = Aya nu salah!
fileTooBig = Koropak unjalkeuneun badag teuing. Kudu kurang ti { $size }.
linkExpiredAlt = Tutumbu kadaluwarsa
## Send version 2 strings
| importingFile = Ngimpor...
encryptingFile = NgΓ©nkripsi...
decryptingFile = NgadΓ©kripsi...
downloadCount =
{ $num ->
*[other] { $num } undeuran
}
timespanHours =
{ $num ->
*[other] { $num } jam
}
copiedUrl = Ditiron!
unlockInputPlaceholder = Kecap sandi
unlockButtonLabel = Laan konci
downloadButtonLabel = Undeur
downloadFinish = Undeuran anggeus
fileSizeProgress = ({ $partialSize } ti { $totalSize })
sendYourFilesLink = Pecakan Firefox Send
errorPageHeader = Aya nu salah!
fileTooBig = Koropak unjalkeuneun badag teuing. Kudu kurang ti { $size }.
linkExpiredAlt = Tutumbu kadaluwarsa
notSupportedHeader = Panyungsi anjeun teu dirojong
notSupportedLink = Naha panyungsi kuring teu dirojong?
notSupportedOutdatedDetail = Hanjakal Firefox vΓ©rsi ieu teu ngarojong tΓ©hnologi wΓ©b nu ngagerakkeun Firefox Send. Anjeun perlu ngapdΓ©t panyungsi anjeun.
updateFirefox = ApdΓ©t Firefox
deletePopupCancel = Bolay
deleteButtonHover = Pupus
footerLinkLegal = LΓ©gal
footerLinkPrivacy = Privasi
footerLinkCookies = Kuki
passwordTryAgain = Kecap sandi salah. Pecakan deui.
javascriptRequired = Firefox Send merlukeun JavaScript
whyJavascript = Naha Firefox Send merlukeun JavaScript?
## Send version 2 strings
| Update Sundanese (su) localization of Firefox Send | Pontoon: Update Sundanese (su) localization of Firefox Send
Localization authors:
- yusup.ramdani <[email protected]>
| FreeMarker | mpl-2.0 | mozilla/send,mozilla/send,mozilla/send,mozilla/send,mozilla/send | freemarker | ## Code Before:
importingFile = Ngimpor...
encryptingFile = NgΓ©nkripsi...
decryptingFile = NgadΓ©kripsi...
downloadCount =
{ $num ->
*[other] { $num } undeuran
}
timespanHours =
{ $num ->
*[other] { $num } jam
}
copiedUrl = Ditiron!
unlockInputPlaceholder = Kecap sandi
unlockButtonLabel = Laan konci
downloadButtonLabel = Undeur
downloadFinish = Undeuran anggeus
fileSizeProgress = ({ $partialSize } ti { $totalSize })
sendYourFilesLink = Pecakan Firefox Send
errorPageHeader = Aya nu salah!
fileTooBig = Koropak unjalkeuneun badag teuing. Kudu kurang ti { $size }.
linkExpiredAlt = Tutumbu kadaluwarsa
## Send version 2 strings
## Instruction:
Pontoon: Update Sundanese (su) localization of Firefox Send
Localization authors:
- yusup.ramdani <[email protected]>
## Code After:
importingFile = Ngimpor...
encryptingFile = NgΓ©nkripsi...
decryptingFile = NgadΓ©kripsi...
downloadCount =
{ $num ->
*[other] { $num } undeuran
}
timespanHours =
{ $num ->
*[other] { $num } jam
}
copiedUrl = Ditiron!
unlockInputPlaceholder = Kecap sandi
unlockButtonLabel = Laan konci
downloadButtonLabel = Undeur
downloadFinish = Undeuran anggeus
fileSizeProgress = ({ $partialSize } ti { $totalSize })
sendYourFilesLink = Pecakan Firefox Send
errorPageHeader = Aya nu salah!
fileTooBig = Koropak unjalkeuneun badag teuing. Kudu kurang ti { $size }.
linkExpiredAlt = Tutumbu kadaluwarsa
notSupportedHeader = Panyungsi anjeun teu dirojong
notSupportedLink = Naha panyungsi kuring teu dirojong?
notSupportedOutdatedDetail = Hanjakal Firefox vΓ©rsi ieu teu ngarojong tΓ©hnologi wΓ©b nu ngagerakkeun Firefox Send. Anjeun perlu ngapdΓ©t panyungsi anjeun.
updateFirefox = ApdΓ©t Firefox
deletePopupCancel = Bolay
deleteButtonHover = Pupus
footerLinkLegal = LΓ©gal
footerLinkPrivacy = Privasi
footerLinkCookies = Kuki
passwordTryAgain = Kecap sandi salah. Pecakan deui.
javascriptRequired = Firefox Send merlukeun JavaScript
whyJavascript = Naha Firefox Send merlukeun JavaScript?
## Send version 2 strings
| importingFile = Ngimpor...
encryptingFile = NgΓ©nkripsi...
decryptingFile = NgadΓ©kripsi...
downloadCount =
{ $num ->
*[other] { $num } undeuran
}
timespanHours =
{ $num ->
*[other] { $num } jam
}
copiedUrl = Ditiron!
unlockInputPlaceholder = Kecap sandi
unlockButtonLabel = Laan konci
downloadButtonLabel = Undeur
downloadFinish = Undeuran anggeus
fileSizeProgress = ({ $partialSize } ti { $totalSize })
sendYourFilesLink = Pecakan Firefox Send
errorPageHeader = Aya nu salah!
fileTooBig = Koropak unjalkeuneun badag teuing. Kudu kurang ti { $size }.
linkExpiredAlt = Tutumbu kadaluwarsa
+ notSupportedHeader = Panyungsi anjeun teu dirojong
+ notSupportedLink = Naha panyungsi kuring teu dirojong?
+ notSupportedOutdatedDetail = Hanjakal Firefox vΓ©rsi ieu teu ngarojong tΓ©hnologi wΓ©b nu ngagerakkeun Firefox Send. Anjeun perlu ngapdΓ©t panyungsi anjeun.
+ updateFirefox = ApdΓ©t Firefox
+ deletePopupCancel = Bolay
+ deleteButtonHover = Pupus
+ footerLinkLegal = LΓ©gal
+ footerLinkPrivacy = Privasi
+ footerLinkCookies = Kuki
+ passwordTryAgain = Kecap sandi salah. Pecakan deui.
+ javascriptRequired = Firefox Send merlukeun JavaScript
+ whyJavascript = Naha Firefox Send merlukeun JavaScript?
## Send version 2 strings
| 12 | 0.5 | 12 | 0 |
bbcb554c11497eb311b0e5f691202ce587dd69f1 | .gitlab-ci.yml | .gitlab-ci.yml | variables:
COMPOSER_HOME: /cache/composer
build:
image: composer
script:
- composer install --no-dev --no-interaction
- |
cd vendor-bin/box
composer install --no-interaction
cd -
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- ./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
artifacts:
expose_as: 'cli-phar'
paths: ['platform.phar']
| variables:
COMPOSER_HOME: /cache/composer
build:
image: php:7.4-cli
before_script:
- apt-get update
- apt-get install zip unzip
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- mkdir -p /cache/composer/bin && chmod +x composer.phar && mv composer.phar /cache/composer/bin/composer
script:
- export PATH="/cache/composer/bin:$PATH"
- composer install --no-dev --no-interaction
- |
cd vendor-bin/box
composer install --no-interaction
cd -
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- ./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
artifacts:
expose_as: 'cli-phar'
paths: ['platform.phar']
| Fix GitLab CI build, using PHP 7.4 (for Box compatibility) [skip changelog] | Fix GitLab CI build, using PHP 7.4 (for Box compatibility) [skip changelog]
| YAML | mit | platformsh/platformsh-cli,platformsh/platformsh-cli,platformsh/platformsh-cli | yaml | ## Code Before:
variables:
COMPOSER_HOME: /cache/composer
build:
image: composer
script:
- composer install --no-dev --no-interaction
- |
cd vendor-bin/box
composer install --no-interaction
cd -
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- ./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
artifacts:
expose_as: 'cli-phar'
paths: ['platform.phar']
## Instruction:
Fix GitLab CI build, using PHP 7.4 (for Box compatibility) [skip changelog]
## Code After:
variables:
COMPOSER_HOME: /cache/composer
build:
image: php:7.4-cli
before_script:
- apt-get update
- apt-get install zip unzip
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- mkdir -p /cache/composer/bin && chmod +x composer.phar && mv composer.phar /cache/composer/bin/composer
script:
- export PATH="/cache/composer/bin:$PATH"
- composer install --no-dev --no-interaction
- |
cd vendor-bin/box
composer install --no-interaction
cd -
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- ./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
artifacts:
expose_as: 'cli-phar'
paths: ['platform.phar']
| variables:
COMPOSER_HOME: /cache/composer
build:
- image: composer
+ image: php:7.4-cli
+ before_script:
+ - apt-get update
+ - apt-get install zip unzip
+ - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+ - php composer-setup.php
+ - mkdir -p /cache/composer/bin && chmod +x composer.phar && mv composer.phar /cache/composer/bin/composer
script:
+ - export PATH="/cache/composer/bin:$PATH"
- composer install --no-dev --no-interaction
- |
cd vendor-bin/box
composer install --no-interaction
cd -
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- ./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
artifacts:
expose_as: 'cli-phar'
paths: ['platform.phar'] | 9 | 0.529412 | 8 | 1 |
c0349711630eff2a645e926ce4504f8b4a8ca71c | app/templates/contributing.md | app/templates/contributing.md |
Please note that this project is released with a
[Contributor Code of Conduct](code-of-conduct.md). By participating in this
project you agree to abide by its terms.
---
Ensure your pull request adheres to the following guidelines:
- Make sure you take care of this
- And this as well
- And don't forget to check this
Thank you for your suggestions!
## Updating your PR
A lot of times, making a PR adhere to the standards above can be difficult.
If the maintainers notice anything that we'd like changed, we'll ask you to
edit your PR before we merge it. There's no need to open a new PR, just edit
the existing one. If you're not sure how to do that,
[here is a guide](https://github.com/RichardLitt/docs/blob/master/amending-a-commit-guide.md)
on the different ways you can update your PR so that we can merge it.
|
Please note that this project is released with a
[Contributor Code of Conduct](code-of-conduct.md). By participating in this
project you agree to abide by its terms.
---
Ensure your pull request adheres to the following guidelines:
- Make sure you take care of this
- And this as well
- And don't forget to check this
Thank you for your suggestions!
## Updating your PR
A lot of times, making a PR adhere to the standards above can be difficult.
If the maintainers notice anything that we'd like changed, we'll ask you to
edit your PR before we merge it. There's no need to open a new PR, just edit
the existing one. If you're not sure how to do that,
[here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md)
on the different ways you can update your PR so that we can merge it.
| Update link to PR amend guide | Update link to PR amend guide
The old one has moved. | Markdown | apache-2.0 | dar5hak/generator-awesome-list | markdown | ## Code Before:
Please note that this project is released with a
[Contributor Code of Conduct](code-of-conduct.md). By participating in this
project you agree to abide by its terms.
---
Ensure your pull request adheres to the following guidelines:
- Make sure you take care of this
- And this as well
- And don't forget to check this
Thank you for your suggestions!
## Updating your PR
A lot of times, making a PR adhere to the standards above can be difficult.
If the maintainers notice anything that we'd like changed, we'll ask you to
edit your PR before we merge it. There's no need to open a new PR, just edit
the existing one. If you're not sure how to do that,
[here is a guide](https://github.com/RichardLitt/docs/blob/master/amending-a-commit-guide.md)
on the different ways you can update your PR so that we can merge it.
## Instruction:
Update link to PR amend guide
The old one has moved.
## Code After:
Please note that this project is released with a
[Contributor Code of Conduct](code-of-conduct.md). By participating in this
project you agree to abide by its terms.
---
Ensure your pull request adheres to the following guidelines:
- Make sure you take care of this
- And this as well
- And don't forget to check this
Thank you for your suggestions!
## Updating your PR
A lot of times, making a PR adhere to the standards above can be difficult.
If the maintainers notice anything that we'd like changed, we'll ask you to
edit your PR before we merge it. There's no need to open a new PR, just edit
the existing one. If you're not sure how to do that,
[here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md)
on the different ways you can update your PR so that we can merge it.
|
Please note that this project is released with a
[Contributor Code of Conduct](code-of-conduct.md). By participating in this
project you agree to abide by its terms.
---
Ensure your pull request adheres to the following guidelines:
- Make sure you take care of this
- And this as well
- And don't forget to check this
Thank you for your suggestions!
## Updating your PR
A lot of times, making a PR adhere to the standards above can be difficult.
If the maintainers notice anything that we'd like changed, we'll ask you to
edit your PR before we merge it. There's no need to open a new PR, just edit
the existing one. If you're not sure how to do that,
- [here is a guide](https://github.com/RichardLitt/docs/blob/master/amending-a-commit-guide.md)
? ^^^
+ [here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md)
? ++++++ ^^ +++++++
on the different ways you can update your PR so that we can merge it. | 2 | 0.083333 | 1 | 1 |
1b0fc8e0014fa1ac36812db5147b7d7ac25c1b0e | .travis.yml | .travis.yml | language: bash
services: docker
install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
before_script:
- env | sort
- cd "$VERSION"
- image='rails'
script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- docker build -t "$image:onbuild" onbuild
after_script:
- docker images
# vim:set et ts=2 sw=2:
| language: bash
services: docker
install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
before_script:
- env | sort
- image='rails'
script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- docker build -t "$image:onbuild" onbuild
after_script:
- docker images
# vim:set et ts=2 sw=2:
| Fix Travis referencing nonexistent variable | Fix Travis referencing nonexistent variable
| YAML | mit | infosiftr/rails,docker-library/rails | yaml | ## Code Before:
language: bash
services: docker
install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
before_script:
- env | sort
- cd "$VERSION"
- image='rails'
script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- docker build -t "$image:onbuild" onbuild
after_script:
- docker images
# vim:set et ts=2 sw=2:
## Instruction:
Fix Travis referencing nonexistent variable
## Code After:
language: bash
services: docker
install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
before_script:
- env | sort
- image='rails'
script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- docker build -t "$image:onbuild" onbuild
after_script:
- docker images
# vim:set et ts=2 sw=2:
| language: bash
services: docker
install:
- git clone https://github.com/docker-library/official-images.git ~/official-images
before_script:
- env | sort
- - cd "$VERSION"
- image='rails'
script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- docker build -t "$image:onbuild" onbuild
after_script:
- docker images
# vim:set et ts=2 sw=2: | 1 | 0.05 | 0 | 1 |
695e95e95b12ab99773c87fa81bc6d49f82f67b3 | modules/distribution/product/src/main/conf/synapse-configs/default/sequences/outDispatchSeq.xml | modules/distribution/product/src/main/conf/synapse-configs/default/sequences/outDispatchSeq.xml | <?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="outDispatchSeq">
<log level="full">
<property name="MESSAGE" value="out dispatch seq"/>
</log>
<respond/>
</sequence>
| <?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="outDispatchSeq">
<respond/>
</sequence>
| Remove unnessary logs from out dispatch sequence | ws: Remove unnessary logs from out dispatch sequence
| XML | apache-2.0 | wso2/product-apim,dewmini/product-apim,nu1silva/product-apim,chamilaadhi/product-apim,ChamNDeSilva/product-apim,chamilaadhi/product-apim,dewmini/product-apim,chamilaadhi/product-apim,jaadds/product-apim,wso2/product-apim,jaadds/product-apim,chamilaadhi/product-apim,sambaheerathan/product-apim,tharikaGitHub/product-apim,nu1silva/product-apim,dewmini/product-apim,nu1silva/product-apim,nu1silva/product-apim,tharikaGitHub/product-apim,tharikaGitHub/product-apim,rswijesena/product-apim,tharikaGitHub/product-apim,jaadds/product-apim,tharikaGitHub/product-apim,rswijesena/product-apim,dewmini/product-apim,wso2/product-apim,sambaheerathan/product-apim,jaadds/product-apim,dewmini/product-apim,ChamNDeSilva/product-apim,lakmali/product-apim,chamilaadhi/product-apim,abimarank/product-apim,nu1silva/product-apim,wso2/product-apim,abimarank/product-apim,wso2/product-apim,lakmali/product-apim | xml | ## Code Before:
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="outDispatchSeq">
<log level="full">
<property name="MESSAGE" value="out dispatch seq"/>
</log>
<respond/>
</sequence>
## Instruction:
ws: Remove unnessary logs from out dispatch sequence
## Code After:
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="outDispatchSeq">
<respond/>
</sequence>
| <?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="outDispatchSeq">
- <log level="full">
- <property name="MESSAGE" value="out dispatch seq"/>
- </log>
<respond/>
</sequence> | 3 | 0.428571 | 0 | 3 |
c57da0278f9ab63531f2a40e2bdaf10410c31c90 | calendar/cs50/unit1-fundamentals/module2/materials/class3/README.md | calendar/cs50/unit1-fundamentals/module2/materials/class3/README.md | Complete the [Soft Skills Prep](../soft-skills) for today.
Work away on [Problem Set 2](../problem-set).
### During Class
1. Soft Skills Presentation by Steven Lawler.
2. Office Hours: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
### Homework
1. Finish [Problem Set 2](../problem-set)
2. You're ready for [Module 3](../../../module3)! The next step is to start work on the [Prep for Module 3 / Class 1](../../../module3/materials/class1-prep)
| Complete the [Soft Skills Prep](../soft-skills) for today.
Work away on [Problem Set 2](../problem-set).
### During Class
1. Soft Skills Presentation by Steven Lawler.
2. Extreme Coding: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
### Homework
1. Finish [Problem Set 2](../problem-set)
2. You're ready for [Module 3](../../../module3)! The next step is to start work on the [Prep for Module 3 / Class 1](../../../module3/materials/class1-prep)
| Rename Office Hours to Extreme Coding | Rename Office Hours to Extreme Coding | Markdown | cc0-1.0 | LaunchCodeEducation/cs50x-kansascity,LaunchCodeEducation/cs50x-kansascity,LaunchCodeEducation/cs50x-kansascity,LaunchCodeEducation/cs50x-kansascity,LaunchCodeEducation/cs50x-kansascity | markdown | ## Code Before:
Complete the [Soft Skills Prep](../soft-skills) for today.
Work away on [Problem Set 2](../problem-set).
### During Class
1. Soft Skills Presentation by Steven Lawler.
2. Office Hours: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
### Homework
1. Finish [Problem Set 2](../problem-set)
2. You're ready for [Module 3](../../../module3)! The next step is to start work on the [Prep for Module 3 / Class 1](../../../module3/materials/class1-prep)
## Instruction:
Rename Office Hours to Extreme Coding
## Code After:
Complete the [Soft Skills Prep](../soft-skills) for today.
Work away on [Problem Set 2](../problem-set).
### During Class
1. Soft Skills Presentation by Steven Lawler.
2. Extreme Coding: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
### Homework
1. Finish [Problem Set 2](../problem-set)
2. You're ready for [Module 3](../../../module3)! The next step is to start work on the [Prep for Module 3 / Class 1](../../../module3/materials/class1-prep)
| Complete the [Soft Skills Prep](../soft-skills) for today.
Work away on [Problem Set 2](../problem-set).
### During Class
1. Soft Skills Presentation by Steven Lawler.
- 2. Office Hours: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
? ^^^^^ ^ ^^^
+ 2. Extreme Coding: Continue working on [Problem Set 2](../problem-set). Instructors will be circulating to provide help.
? ^^^^^^ ^ ^^^^
### Homework
1. Finish [Problem Set 2](../problem-set)
2. You're ready for [Module 3](../../../module3)! The next step is to start work on the [Prep for Module 3 / Class 1](../../../module3/materials/class1-prep) | 2 | 0.166667 | 1 | 1 |
7b9708664d3ca9f8db998983a4814f1a1fe91147 | .travis.yml | .travis.yml | rvm:
- 2.1.2
cache: bundler
before_script:
- 'git submodule init'
- 'git submodule update'
- 'cd spec/dummy/'
- 'cp .env.example ../../.env'
- './bin/bootstrap'
- 'bundle exec rake db:migrate'
- 'rm -rf spec/'
- 'cd ../../'
script:
- 'bundle exec rspec'
notifications:
webhooks: http://neighborly-ci.herokuapp.com/projects/a23a5977-8a4d-4760-a8a4-77755486dc59/status
| rvm:
- 2.1.2
cache: bundler
before_script:
- 'git submodule init'
- 'git submodule update'
- 'cd spec/dummy/'
- 'cp .env.example ../../.env'
- './bin/bootstrap'
- 'bundle exec rake db:migrate'
- 'rm -rf spec/'
- 'cd ../../'
script:
- 'bundle exec rspec'
notifications:
webhooks: https://ci.neighbor.ly/projects/17c44875-7158-4126-a66f-e85c47daad59/status
| Update Travis CI webhooks url | Update Travis CI webhooks url | YAML | mit | FromUte/dune-api | yaml | ## Code Before:
rvm:
- 2.1.2
cache: bundler
before_script:
- 'git submodule init'
- 'git submodule update'
- 'cd spec/dummy/'
- 'cp .env.example ../../.env'
- './bin/bootstrap'
- 'bundle exec rake db:migrate'
- 'rm -rf spec/'
- 'cd ../../'
script:
- 'bundle exec rspec'
notifications:
webhooks: http://neighborly-ci.herokuapp.com/projects/a23a5977-8a4d-4760-a8a4-77755486dc59/status
## Instruction:
Update Travis CI webhooks url
## Code After:
rvm:
- 2.1.2
cache: bundler
before_script:
- 'git submodule init'
- 'git submodule update'
- 'cd spec/dummy/'
- 'cp .env.example ../../.env'
- './bin/bootstrap'
- 'bundle exec rake db:migrate'
- 'rm -rf spec/'
- 'cd ../../'
script:
- 'bundle exec rspec'
notifications:
webhooks: https://ci.neighbor.ly/projects/17c44875-7158-4126-a66f-e85c47daad59/status
| rvm:
- 2.1.2
cache: bundler
before_script:
- 'git submodule init'
- 'git submodule update'
- 'cd spec/dummy/'
- 'cp .env.example ../../.env'
- './bin/bootstrap'
- 'bundle exec rake db:migrate'
- 'rm -rf spec/'
- 'cd ../../'
script:
- 'bundle exec rspec'
notifications:
- webhooks: http://neighborly-ci.herokuapp.com/projects/a23a5977-8a4d-4760-a8a4-77755486dc59/status
+ webhooks: https://ci.neighbor.ly/projects/17c44875-7158-4126-a66f-e85c47daad59/status | 2 | 0.105263 | 1 | 1 |
b8abe79e221ce9ab8f6e0d5a7c0c03c81ec9d251 | lib/emcee/processors/directive_processor.rb | lib/emcee/processors/directive_processor.rb | module Emcee
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
class DirectiveProcessor < Sprockets::DirectiveProcessor
# Matches the entire header/directive block. This is everything from the
# top of the file, enclosed in html comments.
HEADER_PATTERN = /\A((?m:\s*)(<!--(?m:.*?)-->))+/
# Matches the an asset pipeline directive.
#
# *= require_tree .
#
DIRECTIVE_PATTERN = /^\W*=\s*(\w+.*?)$/
# Implement `render` so that it uses our own regex patterns.
def render(context, locals)
@context = context
@pathname = context.pathname
@directory = File.dirname(@pathname)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@result = ""
@result.force_encoding(body.encoding)
@has_written_body = false
process_directives
process_source
@result
end
end
end
| module Emcee
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
class DirectiveProcessor < Sprockets::DirectiveProcessor
# Matches the entire header/directive block. This is everything from the
# top of the file, enclosed in html comments.
HEADER_PATTERN = /\A((?m:\s*)(<!--(?m:.*?)-->))+/
# Implement `render` so that it uses our own regex patterns.
def render(context, locals)
@context = context
@pathname = context.pathname
@directory = File.dirname(@pathname)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@result = ""
@result.force_encoding(body.encoding)
@has_written_body = false
process_directives
process_source
@result
end
end
end
| Remove unnecessary directive pattern regex | Remove unnecessary directive pattern regex
The default one in Sprockets works fine
| Ruby | mit | ahuth/emcee,ahuth/emcee,ahuth/emcee | ruby | ## Code Before:
module Emcee
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
class DirectiveProcessor < Sprockets::DirectiveProcessor
# Matches the entire header/directive block. This is everything from the
# top of the file, enclosed in html comments.
HEADER_PATTERN = /\A((?m:\s*)(<!--(?m:.*?)-->))+/
# Matches the an asset pipeline directive.
#
# *= require_tree .
#
DIRECTIVE_PATTERN = /^\W*=\s*(\w+.*?)$/
# Implement `render` so that it uses our own regex patterns.
def render(context, locals)
@context = context
@pathname = context.pathname
@directory = File.dirname(@pathname)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@result = ""
@result.force_encoding(body.encoding)
@has_written_body = false
process_directives
process_source
@result
end
end
end
## Instruction:
Remove unnecessary directive pattern regex
The default one in Sprockets works fine
## Code After:
module Emcee
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
class DirectiveProcessor < Sprockets::DirectiveProcessor
# Matches the entire header/directive block. This is everything from the
# top of the file, enclosed in html comments.
HEADER_PATTERN = /\A((?m:\s*)(<!--(?m:.*?)-->))+/
# Implement `render` so that it uses our own regex patterns.
def render(context, locals)
@context = context
@pathname = context.pathname
@directory = File.dirname(@pathname)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@result = ""
@result.force_encoding(body.encoding)
@has_written_body = false
process_directives
process_source
@result
end
end
end
| module Emcee
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
class DirectiveProcessor < Sprockets::DirectiveProcessor
# Matches the entire header/directive block. This is everything from the
# top of the file, enclosed in html comments.
HEADER_PATTERN = /\A((?m:\s*)(<!--(?m:.*?)-->))+/
-
- # Matches the an asset pipeline directive.
- #
- # *= require_tree .
- #
- DIRECTIVE_PATTERN = /^\W*=\s*(\w+.*?)$/
# Implement `render` so that it uses our own regex patterns.
def render(context, locals)
@context = context
@pathname = context.pathname
@directory = File.dirname(@pathname)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@result = ""
@result.force_encoding(body.encoding)
@has_written_body = false
process_directives
process_source
@result
end
end
end | 6 | 0.153846 | 0 | 6 |
5f562d2d64f838152e38f829b23e9bbe0254be79 | event-info.md | event-info.md | ---
title: Event Information
layout: text
---
We run talks, workshops, and social events. Come along and work on your personal projects, and also meet like-minded people.
### Buddy Scheme
We know it can be difficult to join a new social group, so we offer a Buddy Scheme to make it easier. One of our team will meet you before the event starts, and introduce you to the group.
Please send an email to **[email protected]** with the following information:
- name
- pronouns
- contact email or phone number
- which event you would like a buddy for
- at what time you would like to meet before the event (up to 30 minutes before)
- whether you have a preference for a particular location to meet (e.g. in a cafe, outside or inside a tube station, should be close to the venue)
#### Would you like to volunteer to be a buddy for a new attendee?
Thank you very much, we rely on volunteers to keep this going!
Please join the #buddy-scheme channel on our [Slack](https://slackinvite-qcldn.herokuapp.com/). We're looking for people who:
- commit to attending a meetup
- are prepared to meet new members before the event starts and walk to the venue together
- will try and help new members to feel welcome during the meetup
### Accessibility
We try to host our events in accessible spaces. Check the individual event pages for specific venue information.
| ---
title: Event Information
layout: text
---
We run talks, workshops, and social events. Come along and work on your personal projects, and also meet like-minded people.
Upcoming events are listed on [our Meetup community page](https://www.meetup.com/Queer-Code-London).
### Buddy Scheme
We know it can be difficult to join a new social group, so we offer a Buddy Scheme to make it easier. One of our team will meet you before the event starts, and introduce you to the group.
Please send an email to **[email protected]** with the following information:
- name
- pronouns
- contact email or phone number
- which event you would like a buddy for
- at what time you would like to meet before the event (up to 30 minutes before)
- whether you have a preference for a particular location to meet (e.g. in a cafe, outside or inside a tube station, should be close to the venue)
#### Would you like to volunteer to be a buddy for a new attendee?
Thank you very much, we rely on volunteers to keep this going!
Please join the #buddy-scheme channel on our [Slack](https://slackinvite-qcldn.herokuapp.com/). We're looking for people who:
- commit to attending a meetup
- are prepared to meet new members before the event starts and walk to the venue together
- will try and help new members to feel welcome during the meetup
### Accessibility
We try to host our events in accessible spaces. Check the individual event pages for specific venue information.
| Add link to our Meetup page | Add link to our Meetup page | Markdown | unlicense | QueerCodeOrg/queercodeberlin.github.io,QueerCodeOrg/queercodeberlin.github.io,QueerCodeBerlin/queercodeberlin.github.io,QueerCodeOrg/queercodeberlin.github.io | markdown | ## Code Before:
---
title: Event Information
layout: text
---
We run talks, workshops, and social events. Come along and work on your personal projects, and also meet like-minded people.
### Buddy Scheme
We know it can be difficult to join a new social group, so we offer a Buddy Scheme to make it easier. One of our team will meet you before the event starts, and introduce you to the group.
Please send an email to **[email protected]** with the following information:
- name
- pronouns
- contact email or phone number
- which event you would like a buddy for
- at what time you would like to meet before the event (up to 30 minutes before)
- whether you have a preference for a particular location to meet (e.g. in a cafe, outside or inside a tube station, should be close to the venue)
#### Would you like to volunteer to be a buddy for a new attendee?
Thank you very much, we rely on volunteers to keep this going!
Please join the #buddy-scheme channel on our [Slack](https://slackinvite-qcldn.herokuapp.com/). We're looking for people who:
- commit to attending a meetup
- are prepared to meet new members before the event starts and walk to the venue together
- will try and help new members to feel welcome during the meetup
### Accessibility
We try to host our events in accessible spaces. Check the individual event pages for specific venue information.
## Instruction:
Add link to our Meetup page
## Code After:
---
title: Event Information
layout: text
---
We run talks, workshops, and social events. Come along and work on your personal projects, and also meet like-minded people.
Upcoming events are listed on [our Meetup community page](https://www.meetup.com/Queer-Code-London).
### Buddy Scheme
We know it can be difficult to join a new social group, so we offer a Buddy Scheme to make it easier. One of our team will meet you before the event starts, and introduce you to the group.
Please send an email to **[email protected]** with the following information:
- name
- pronouns
- contact email or phone number
- which event you would like a buddy for
- at what time you would like to meet before the event (up to 30 minutes before)
- whether you have a preference for a particular location to meet (e.g. in a cafe, outside or inside a tube station, should be close to the venue)
#### Would you like to volunteer to be a buddy for a new attendee?
Thank you very much, we rely on volunteers to keep this going!
Please join the #buddy-scheme channel on our [Slack](https://slackinvite-qcldn.herokuapp.com/). We're looking for people who:
- commit to attending a meetup
- are prepared to meet new members before the event starts and walk to the venue together
- will try and help new members to feel welcome during the meetup
### Accessibility
We try to host our events in accessible spaces. Check the individual event pages for specific venue information.
| ---
title: Event Information
layout: text
---
We run talks, workshops, and social events. Come along and work on your personal projects, and also meet like-minded people.
+
+ Upcoming events are listed on [our Meetup community page](https://www.meetup.com/Queer-Code-London).
### Buddy Scheme
We know it can be difficult to join a new social group, so we offer a Buddy Scheme to make it easier. One of our team will meet you before the event starts, and introduce you to the group.
Please send an email to **[email protected]** with the following information:
- name
- pronouns
- contact email or phone number
- which event you would like a buddy for
- at what time you would like to meet before the event (up to 30 minutes before)
- whether you have a preference for a particular location to meet (e.g. in a cafe, outside or inside a tube station, should be close to the venue)
#### Would you like to volunteer to be a buddy for a new attendee?
Thank you very much, we rely on volunteers to keep this going!
Please join the #buddy-scheme channel on our [Slack](https://slackinvite-qcldn.herokuapp.com/). We're looking for people who:
- commit to attending a meetup
- are prepared to meet new members before the event starts and walk to the venue together
- will try and help new members to feel welcome during the meetup
### Accessibility
We try to host our events in accessible spaces. Check the individual event pages for specific venue information. | 2 | 0.060606 | 2 | 0 |
bf737e99dd9fb759499919236142eb1da80cabab | includes/Rasterizer.h | includes/Rasterizer.h |
class Rasterizer : public Renderer {
private:
const float k_a = 0.1;
const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
Rasterizer();
Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
~Rasterizer();
const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
void render(const std::string output_path) override;
private:
const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
};
#endif /* RASTERIZER_H */
|
class Rasterizer : public Renderer {
private:
const float k_a = 0.1;
const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
Rasterizer();
Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
~Rasterizer();
const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
void render(const std::string output_path) override;
private:
const Triangle2D toRaster(const Triangle3D& triangle_world) const;
const float getDepth(const Triangle3D& triangle_world, const Triangle2D& triangle_raster, const Point2D& pixel_raster) const;
const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
};
#endif /* RASTERIZER_H */
| Refactor render method to make it simpler | Refactor render method to make it simpler
| C | mit | mtrebi/Rasterizer,mtrebi/Rasterizer | c | ## Code Before:
class Rasterizer : public Renderer {
private:
const float k_a = 0.1;
const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
Rasterizer();
Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
~Rasterizer();
const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
void render(const std::string output_path) override;
private:
const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
};
#endif /* RASTERIZER_H */
## Instruction:
Refactor render method to make it simpler
## Code After:
class Rasterizer : public Renderer {
private:
const float k_a = 0.1;
const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
Rasterizer();
Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
~Rasterizer();
const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
void render(const std::string output_path) override;
private:
const Triangle2D toRaster(const Triangle3D& triangle_world) const;
const float getDepth(const Triangle3D& triangle_world, const Triangle2D& triangle_raster, const Point2D& pixel_raster) const;
const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
};
#endif /* RASTERIZER_H */
|
class Rasterizer : public Renderer {
private:
const float k_a = 0.1;
const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
Rasterizer();
Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
~Rasterizer();
const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
void render(const std::string output_path) override;
private:
+ const Triangle2D toRaster(const Triangle3D& triangle_world) const;
+ const float getDepth(const Triangle3D& triangle_world, const Triangle2D& triangle_raster, const Point2D& pixel_raster) const;
const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
};
#endif /* RASTERIZER_H */
| 2 | 0.1 | 2 | 0 |
6e6870e01a7251022ae36b76220fd4fb3f4b2fc7 | solace/cmd/play/Help.java | solace/cmd/play/Help.java | package solace.cmd.play;
import solace.util.*;
import solace.net.*;
import solace.cmd.*;
import java.util.*;
/**
* Help command, allows players to search for and browse
* articles in the solace help system.
* @author Ryan Sandor Richards
*/
public class Help extends AbstractCommand {
HelpSystem help;
public Help() {
super("help");
help = HelpSystem.getInstance();
}
public boolean run(Connection c, String []params) {
if (params.length < 2) {
c.wrapln( help.getArticle("index.md") );
return true;
}
List<String> keywords = new LinkedList<String>();
for (int i = 1; i < params.length; i++) {
keywords.add(params[i]);
}
c.send("\n\r" + help.query(keywords) + "\n\r");
return true;
}
}
| package solace.cmd.play;
import solace.util.*;
import solace.net.*;
import solace.cmd.*;
import java.util.*;
/**
* Help command, allows players to search for and browse
* articles in the solace help system.
* @author Ryan Sandor Richards
*/
public class Help extends AbstractCommand {
HelpSystem help;
public Help() {
super("help");
help = HelpSystem.getInstance();
}
public boolean run(Connection c, String []params) {
if (params.length < 2) {
c.wrapln( help.getArticle("index.md") );
return true;
}
List<String> keywords = new LinkedList<String>();
for (int i = 1; i < params.length; i++) {
keywords.add(params[i].toLowerCase());
}
c.send("\n\r" + help.query(keywords) + "\n\r");
return true;
}
}
| Convert input to lowercase when searching for help articles via keywords. | Convert input to lowercase when searching for help articles via keywords.
| Java | mit | rsandor/Solace,rsandor/Solace | java | ## Code Before:
package solace.cmd.play;
import solace.util.*;
import solace.net.*;
import solace.cmd.*;
import java.util.*;
/**
* Help command, allows players to search for and browse
* articles in the solace help system.
* @author Ryan Sandor Richards
*/
public class Help extends AbstractCommand {
HelpSystem help;
public Help() {
super("help");
help = HelpSystem.getInstance();
}
public boolean run(Connection c, String []params) {
if (params.length < 2) {
c.wrapln( help.getArticle("index.md") );
return true;
}
List<String> keywords = new LinkedList<String>();
for (int i = 1; i < params.length; i++) {
keywords.add(params[i]);
}
c.send("\n\r" + help.query(keywords) + "\n\r");
return true;
}
}
## Instruction:
Convert input to lowercase when searching for help articles via keywords.
## Code After:
package solace.cmd.play;
import solace.util.*;
import solace.net.*;
import solace.cmd.*;
import java.util.*;
/**
* Help command, allows players to search for and browse
* articles in the solace help system.
* @author Ryan Sandor Richards
*/
public class Help extends AbstractCommand {
HelpSystem help;
public Help() {
super("help");
help = HelpSystem.getInstance();
}
public boolean run(Connection c, String []params) {
if (params.length < 2) {
c.wrapln( help.getArticle("index.md") );
return true;
}
List<String> keywords = new LinkedList<String>();
for (int i = 1; i < params.length; i++) {
keywords.add(params[i].toLowerCase());
}
c.send("\n\r" + help.query(keywords) + "\n\r");
return true;
}
}
| package solace.cmd.play;
import solace.util.*;
import solace.net.*;
import solace.cmd.*;
import java.util.*;
/**
* Help command, allows players to search for and browse
* articles in the solace help system.
* @author Ryan Sandor Richards
*/
public class Help extends AbstractCommand {
HelpSystem help;
public Help() {
super("help");
help = HelpSystem.getInstance();
}
public boolean run(Connection c, String []params) {
if (params.length < 2) {
c.wrapln( help.getArticle("index.md") );
return true;
}
List<String> keywords = new LinkedList<String>();
for (int i = 1; i < params.length; i++) {
- keywords.add(params[i]);
+ keywords.add(params[i].toLowerCase());
? ++++++++++++++
}
c.send("\n\r" + help.query(keywords) + "\n\r");
return true;
}
} | 2 | 0.057143 | 1 | 1 |
5d963d460a06011bcdbf54eec23614323372f543 | S19-command-line/dash-e.t | S19-command-line/dash-e.t | use v6;
use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
plan 4;
my Str $x;
is_run $x, :args['-e', 'print q[Moin]'],
{
out => 'Moin',
err => '',
status => 0,
},
'-e print $something works';
is_run $x, :args['-e', "print q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]]"],
{
out => "\c[LATIN SMALL LETTER A WITH DOT ABOVE]",
err => '',
status => 0,
},
'-e print $something works with non-ASCII string literals';
is_run $x, :args['-e', 'print <1 2> Β»+Β« <1 1>'],
{
out => "2 3",
err => '',
status => 0,
},
'-e works with non-ASCII program texts';
is_run $x, :args['-e', 'say @*ARGS', '-e=foo'],
{
out => "[-e=foo]\n",
err => '',
status => 0,
},
'-e works correctly as a stopper';
| use v6;
use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
plan 4;
my Str $x;
is_run $x, :args['-e', 'print(q[Moin])'],
{
out => 'Moin',
err => '',
status => 0,
},
'-e print $something works';
is_run $x, :args['-e', "print(q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]])"],
{
out => "\c[LATIN SMALL LETTER A WITH DOT ABOVE]",
err => '',
status => 0,
},
'-e print $something works with non-ASCII string literals';
is_run $x, :args['-e', '(2,3)Β».print'],
{
out => "23",
err => '',
status => 0,
},
'-e works with non-ASCII program texts';
is_run $x, :args['-e', 'say(@*ARGS)', '-e=foo'],
{
out => "[-e=foo]\n",
err => '',
status => 0,
},
'-e works correctly as a stopper';
| Remove spaces from is_run code to workaround windows issues | Remove spaces from is_run code to workaround windows issues
| Perl | artistic-2.0 | dogbert17/roast,perl6/roast,dogbert17/roast | perl | ## Code Before:
use v6;
use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
plan 4;
my Str $x;
is_run $x, :args['-e', 'print q[Moin]'],
{
out => 'Moin',
err => '',
status => 0,
},
'-e print $something works';
is_run $x, :args['-e', "print q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]]"],
{
out => "\c[LATIN SMALL LETTER A WITH DOT ABOVE]",
err => '',
status => 0,
},
'-e print $something works with non-ASCII string literals';
is_run $x, :args['-e', 'print <1 2> Β»+Β« <1 1>'],
{
out => "2 3",
err => '',
status => 0,
},
'-e works with non-ASCII program texts';
is_run $x, :args['-e', 'say @*ARGS', '-e=foo'],
{
out => "[-e=foo]\n",
err => '',
status => 0,
},
'-e works correctly as a stopper';
## Instruction:
Remove spaces from is_run code to workaround windows issues
## Code After:
use v6;
use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
plan 4;
my Str $x;
is_run $x, :args['-e', 'print(q[Moin])'],
{
out => 'Moin',
err => '',
status => 0,
},
'-e print $something works';
is_run $x, :args['-e', "print(q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]])"],
{
out => "\c[LATIN SMALL LETTER A WITH DOT ABOVE]",
err => '',
status => 0,
},
'-e print $something works with non-ASCII string literals';
is_run $x, :args['-e', '(2,3)Β».print'],
{
out => "23",
err => '',
status => 0,
},
'-e works with non-ASCII program texts';
is_run $x, :args['-e', 'say(@*ARGS)', '-e=foo'],
{
out => "[-e=foo]\n",
err => '',
status => 0,
},
'-e works correctly as a stopper';
| use v6;
use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;
plan 4;
my Str $x;
- is_run $x, :args['-e', 'print q[Moin]'],
? ^
+ is_run $x, :args['-e', 'print(q[Moin])'],
? ^ +
{
out => 'Moin',
err => '',
status => 0,
},
'-e print $something works';
- is_run $x, :args['-e', "print q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]]"],
? ^
+ is_run $x, :args['-e', "print(q[\c[LATIN SMALL LETTER A WITH DOT ABOVE]])"],
? ^ +
{
out => "\c[LATIN SMALL LETTER A WITH DOT ABOVE]",
err => '',
status => 0,
},
'-e print $something works with non-ASCII string literals';
- is_run $x, :args['-e', 'print <1 2> Β»+Β« <1 1>'],
+ is_run $x, :args['-e', '(2,3)Β».print'],
{
- out => "2 3",
? -
+ out => "23",
err => '',
status => 0,
},
'-e works with non-ASCII program texts';
- is_run $x, :args['-e', 'say @*ARGS', '-e=foo'],
? ^
+ is_run $x, :args['-e', 'say(@*ARGS)', '-e=foo'],
? ^ +
{
out => "[-e=foo]\n",
err => '',
status => 0,
},
'-e works correctly as a stopper'; | 10 | 0.25 | 5 | 5 |
cdb9aee94eecb05fd6fcc4c12ac3aab7a7cf035e | 2.3.3/init_container.sh | 2.3.3/init_container.sh | cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Ruby quickstart: https://aka.ms/ruby-qs
EOL
cat /etc/motd
service ssh start
eval "$(rbenv init -)"
rbenv global 2.3.3
/opt/startup.sh "$@"
| cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Ruby quickstart: https://aka.ms/ruby-qs
EOL
cat /etc/motd
service ssh start
# Get environment variables to show up in SSH session
eval $(printenv | awk -F= '{print "export " $1"="$2 }' >> /etc/profile)
eval "$(rbenv init -)"
rbenv global 2.3.3
/opt/startup.sh "$@"
| Add env vars to profile so they show up in ssh | Add env vars to profile so they show up in ssh
| Shell | apache-2.0 | Azure-App-Service/ruby,Azure-App-Service/ruby,Azure-App-Service/ruby | shell | ## Code Before:
cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Ruby quickstart: https://aka.ms/ruby-qs
EOL
cat /etc/motd
service ssh start
eval "$(rbenv init -)"
rbenv global 2.3.3
/opt/startup.sh "$@"
## Instruction:
Add env vars to profile so they show up in ssh
## Code After:
cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Ruby quickstart: https://aka.ms/ruby-qs
EOL
cat /etc/motd
service ssh start
# Get environment variables to show up in SSH session
eval $(printenv | awk -F= '{print "export " $1"="$2 }' >> /etc/profile)
eval "$(rbenv init -)"
rbenv global 2.3.3
/opt/startup.sh "$@"
| cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Ruby quickstart: https://aka.ms/ruby-qs
EOL
cat /etc/motd
service ssh start
+
+ # Get environment variables to show up in SSH session
+ eval $(printenv | awk -F= '{print "export " $1"="$2 }' >> /etc/profile)
+
eval "$(rbenv init -)"
rbenv global 2.3.3
/opt/startup.sh "$@"
| 4 | 0.2 | 4 | 0 |
8e68abd512560450656d5f5875e6fdddc958e971 | src/adapter.js | src/adapter.js | export default createNodeIterator
function createNodeIterator(root, whatToShow = 0xFFFFFFFF, filter = null) {
const doc = root.ownerDocument
const iter = doc.createNodeIterator(root, whatToShow, filter, false)
return new NodeIterator(iter, root, whatToShow, filter)
}
class NodeIterator {
constructor(iter, root, whatToShow, filter) {
this.root = root
this.whatToShow = whatToShow
this.filter = filter
this.referenceNode = root
this.pointerBeforeReferenceNode = true
this._iter = iter
}
nextNode() {
const result = this._iter.nextNode()
this.pointerBeforeReferenceNode = false
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
previousNode() {
const result = this._iter.previousNode()
this.pointerBeforeReferenceNode = true
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
toString() {
return '[object NodeIterator]'
}
}
| export default createNodeIterator
function createNodeIterator(root, whatToShow = 0xFFFFFFFF, filter = null) {
const doc = (root.nodeType == 9) || root.ownerDocument
const iter = doc.createNodeIterator(root, whatToShow, filter, false)
return new NodeIterator(iter, root, whatToShow, filter)
}
class NodeIterator {
constructor(iter, root, whatToShow, filter) {
this.root = root
this.whatToShow = whatToShow
this.filter = filter
this.referenceNode = root
this.pointerBeforeReferenceNode = true
this._iter = iter
}
nextNode() {
const result = this._iter.nextNode()
this.pointerBeforeReferenceNode = false
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
previousNode() {
const result = this._iter.previousNode()
this.pointerBeforeReferenceNode = true
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
toString() {
return '[object NodeIterator]'
}
}
| Support document object as first argument | Support document object as first argument
| JavaScript | mit | tilgovi/dom-node-iterator,tilgovi/node-iterator-shim | javascript | ## Code Before:
export default createNodeIterator
function createNodeIterator(root, whatToShow = 0xFFFFFFFF, filter = null) {
const doc = root.ownerDocument
const iter = doc.createNodeIterator(root, whatToShow, filter, false)
return new NodeIterator(iter, root, whatToShow, filter)
}
class NodeIterator {
constructor(iter, root, whatToShow, filter) {
this.root = root
this.whatToShow = whatToShow
this.filter = filter
this.referenceNode = root
this.pointerBeforeReferenceNode = true
this._iter = iter
}
nextNode() {
const result = this._iter.nextNode()
this.pointerBeforeReferenceNode = false
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
previousNode() {
const result = this._iter.previousNode()
this.pointerBeforeReferenceNode = true
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
toString() {
return '[object NodeIterator]'
}
}
## Instruction:
Support document object as first argument
## Code After:
export default createNodeIterator
function createNodeIterator(root, whatToShow = 0xFFFFFFFF, filter = null) {
const doc = (root.nodeType == 9) || root.ownerDocument
const iter = doc.createNodeIterator(root, whatToShow, filter, false)
return new NodeIterator(iter, root, whatToShow, filter)
}
class NodeIterator {
constructor(iter, root, whatToShow, filter) {
this.root = root
this.whatToShow = whatToShow
this.filter = filter
this.referenceNode = root
this.pointerBeforeReferenceNode = true
this._iter = iter
}
nextNode() {
const result = this._iter.nextNode()
this.pointerBeforeReferenceNode = false
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
previousNode() {
const result = this._iter.previousNode()
this.pointerBeforeReferenceNode = true
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
toString() {
return '[object NodeIterator]'
}
}
| export default createNodeIterator
function createNodeIterator(root, whatToShow = 0xFFFFFFFF, filter = null) {
- const doc = root.ownerDocument
+ const doc = (root.nodeType == 9) || root.ownerDocument
const iter = doc.createNodeIterator(root, whatToShow, filter, false)
return new NodeIterator(iter, root, whatToShow, filter)
}
class NodeIterator {
constructor(iter, root, whatToShow, filter) {
this.root = root
this.whatToShow = whatToShow
this.filter = filter
this.referenceNode = root
this.pointerBeforeReferenceNode = true
this._iter = iter
}
nextNode() {
const result = this._iter.nextNode()
this.pointerBeforeReferenceNode = false
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
previousNode() {
const result = this._iter.previousNode()
this.pointerBeforeReferenceNode = true
if (result === null) return null
this.referenceNode = result
return this.referenceNode
}
toString() {
return '[object NodeIterator]'
}
} | 2 | 0.05 | 1 | 1 |
fab0b47b1278bef20b61dd71773041a7c941ce4e | install.sh | install.sh |
VERSION=0.9.5
PREFIX="."
RECORD="ltepi-files.txt"
if [ -n "$1" ]; then
PREFIX="$1"
fi
RECORD="${PREFIX}/ltepi-files.txt"
function assert_root {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
}
function install_pyserial {
python -c "import serial"
if [ "$?" == "0" ]; then
return
fi
apt-get update -qq
apt-get install -y python-serial
}
function install {
cp -f PKG-INFO.txt PKG-INFO
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" PKG-INFO
cp -f setup.py.txt setup.py
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" setup.py
python ./setup.py install --record ${RECORD}
cp -f uninstall.sh ${PREFIX}/ltepi-uninstall.sh
}
function package {
rm -f ltepi-${VERSION}.tgz
# http://unix.stackexchange.com/a/9865
COPYFILE_DISABLE=1 tar --exclude="./.*" -zcf ltepi-${VERSION}.tgz *
}
if [ "$1" == "pack" ]; then
package
exit 0
fi
assert_root
install_pyserial
install
|
VERSION=0.9.5
PREFIX="."
RECORD="ltepi-files.txt"
if [ -n "$1" ]; then
PREFIX="$1"
fi
RECORD="${PREFIX}/ltepi-files.txt"
function assert_root {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
}
function install_pyserial {
python -c "import serial"
if [ "$?" == "0" ]; then
return
fi
apt-get update -qq
apt-get install -y python-serial
}
function install {
cp -f PKG-INFO.txt PKG-INFO
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" PKG-INFO
cp -f setup.py.txt setup.py
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" setup.py
python ./setup.py install --record ${RECORD}
cp -f uninstall.sh ${PREFIX}/ltepi-uninstall.sh
}
function package {
rm -f ltepi-*.tgz
# http://unix.stackexchange.com/a/9865
COPYFILE_DISABLE=1 tar --exclude="./.*" -zcf ltepi-${VERSION}.tgz *
}
if [ "$1" == "pack" ]; then
package
exit 0
fi
assert_root
install_pyserial
install
| Remove all tgz files in order to delete older version of tgz files | Remove all tgz files in order to delete older version of tgz files
| Shell | bsd-3-clause | Robotma-com/ltepi,Robotma-com/ltepi | shell | ## Code Before:
VERSION=0.9.5
PREFIX="."
RECORD="ltepi-files.txt"
if [ -n "$1" ]; then
PREFIX="$1"
fi
RECORD="${PREFIX}/ltepi-files.txt"
function assert_root {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
}
function install_pyserial {
python -c "import serial"
if [ "$?" == "0" ]; then
return
fi
apt-get update -qq
apt-get install -y python-serial
}
function install {
cp -f PKG-INFO.txt PKG-INFO
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" PKG-INFO
cp -f setup.py.txt setup.py
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" setup.py
python ./setup.py install --record ${RECORD}
cp -f uninstall.sh ${PREFIX}/ltepi-uninstall.sh
}
function package {
rm -f ltepi-${VERSION}.tgz
# http://unix.stackexchange.com/a/9865
COPYFILE_DISABLE=1 tar --exclude="./.*" -zcf ltepi-${VERSION}.tgz *
}
if [ "$1" == "pack" ]; then
package
exit 0
fi
assert_root
install_pyserial
install
## Instruction:
Remove all tgz files in order to delete older version of tgz files
## Code After:
VERSION=0.9.5
PREFIX="."
RECORD="ltepi-files.txt"
if [ -n "$1" ]; then
PREFIX="$1"
fi
RECORD="${PREFIX}/ltepi-files.txt"
function assert_root {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
}
function install_pyserial {
python -c "import serial"
if [ "$?" == "0" ]; then
return
fi
apt-get update -qq
apt-get install -y python-serial
}
function install {
cp -f PKG-INFO.txt PKG-INFO
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" PKG-INFO
cp -f setup.py.txt setup.py
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" setup.py
python ./setup.py install --record ${RECORD}
cp -f uninstall.sh ${PREFIX}/ltepi-uninstall.sh
}
function package {
rm -f ltepi-*.tgz
# http://unix.stackexchange.com/a/9865
COPYFILE_DISABLE=1 tar --exclude="./.*" -zcf ltepi-${VERSION}.tgz *
}
if [ "$1" == "pack" ]; then
package
exit 0
fi
assert_root
install_pyserial
install
|
VERSION=0.9.5
PREFIX="."
RECORD="ltepi-files.txt"
if [ -n "$1" ]; then
PREFIX="$1"
fi
RECORD="${PREFIX}/ltepi-files.txt"
function assert_root {
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
}
function install_pyserial {
python -c "import serial"
if [ "$?" == "0" ]; then
return
fi
apt-get update -qq
apt-get install -y python-serial
}
function install {
cp -f PKG-INFO.txt PKG-INFO
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" PKG-INFO
cp -f setup.py.txt setup.py
sed -i -e "s/%VERSION%/${VERSION//\//\\/}/g" setup.py
python ./setup.py install --record ${RECORD}
cp -f uninstall.sh ${PREFIX}/ltepi-uninstall.sh
}
function package {
- rm -f ltepi-${VERSION}.tgz
? ^^^^^^^^^^
+ rm -f ltepi-*.tgz
? ^
# http://unix.stackexchange.com/a/9865
COPYFILE_DISABLE=1 tar --exclude="./.*" -zcf ltepi-${VERSION}.tgz *
}
if [ "$1" == "pack" ]; then
package
exit 0
fi
assert_root
install_pyserial
install | 2 | 0.040816 | 1 | 1 |
6787a16132a753b725a19a12c297700f2e6d40f4 | README.md | README.md | HGJ13
=====
FH Hagenberg GLAB GameJam 2013
Team cheese
| HGJ13
=====
FH Hagenberg GLAB GameJam 2013
Team cheese
- David Berger
- Fabian Meisinger
- Peter Kainrad
| Add Names for initial push test. | Add Names for initial push test.
| Markdown | mit | V-Play/HGJ13,V-Play/HGJ13 | markdown | ## Code Before:
HGJ13
=====
FH Hagenberg GLAB GameJam 2013
Team cheese
## Instruction:
Add Names for initial push test.
## Code After:
HGJ13
=====
FH Hagenberg GLAB GameJam 2013
Team cheese
- David Berger
- Fabian Meisinger
- Peter Kainrad
| HGJ13
=====
FH Hagenberg GLAB GameJam 2013
Team cheese
+ - David Berger
+ - Fabian Meisinger
+ - Peter Kainrad | 3 | 0.5 | 3 | 0 |
13e294a2a5c7041eb4833f744a7dbf5f371584c4 | io/example/read-sink1/read-sink1.cc | io/example/read-sink1/read-sink1.cc |
class Sink {
LogHandle log_;
StreamHandle fd_;
Action *action_;
public:
Sink(int fd)
: log_("/sink"),
fd_(fd),
action_(NULL)
{
EventCallback *cb = callback(this, &Sink::read_complete);
action_ = fd_.read(0, cb);
}
~Sink()
{
ASSERT(log_, action_ == NULL);
}
void read_complete(Event e)
{
action_->cancel();
action_ = NULL;
switch (e.type_) {
case Event::Done:
case Event::EOS:
break;
default:
HALT(log_) << "Unexpected event: " << e;
return;
}
if (e.type_ == Event::EOS) {
SimpleCallback *cb = callback(this, &Sink::close_complete);
action_ = fd_.close(cb);
return;
}
EventCallback *cb = callback(this, &Sink::read_complete);
action_ = fd_.read(0, cb);
}
void close_complete(void)
{
action_->cancel();
action_ = NULL;
}
};
int
main(void)
{
Sink sink(STDIN_FILENO);
event_main();
}
|
class Sink {
LogHandle log_;
StreamHandle fd_;
CallbackHandler close_handler_;
EventHandler read_handler_;
public:
Sink(int fd)
: log_("/sink"),
fd_(fd),
read_handler_()
{
read_handler_.handler(Event::Done, this, &Sink::read_done);
read_handler_.handler(Event::EOS, this, &Sink::read_eos);
close_handler_.handler(this, &Sink::close_done);
read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
~Sink()
{ }
void read_done(Event)
{
read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
void read_eos(Event)
{
close_handler_.wait(fd_.close(close_handler_.callback()));
}
void close_done(void)
{ }
};
int
main(void)
{
Sink sink(STDIN_FILENO);
event_main();
}
| Convert to use Handlers. Could be simpler. | Convert to use Handlers. Could be simpler.
| C++ | bsd-2-clause | wanproxy/wanproxy,wanproxy/wanproxy,wanproxy/wanproxy | c++ | ## Code Before:
class Sink {
LogHandle log_;
StreamHandle fd_;
Action *action_;
public:
Sink(int fd)
: log_("/sink"),
fd_(fd),
action_(NULL)
{
EventCallback *cb = callback(this, &Sink::read_complete);
action_ = fd_.read(0, cb);
}
~Sink()
{
ASSERT(log_, action_ == NULL);
}
void read_complete(Event e)
{
action_->cancel();
action_ = NULL;
switch (e.type_) {
case Event::Done:
case Event::EOS:
break;
default:
HALT(log_) << "Unexpected event: " << e;
return;
}
if (e.type_ == Event::EOS) {
SimpleCallback *cb = callback(this, &Sink::close_complete);
action_ = fd_.close(cb);
return;
}
EventCallback *cb = callback(this, &Sink::read_complete);
action_ = fd_.read(0, cb);
}
void close_complete(void)
{
action_->cancel();
action_ = NULL;
}
};
int
main(void)
{
Sink sink(STDIN_FILENO);
event_main();
}
## Instruction:
Convert to use Handlers. Could be simpler.
## Code After:
class Sink {
LogHandle log_;
StreamHandle fd_;
CallbackHandler close_handler_;
EventHandler read_handler_;
public:
Sink(int fd)
: log_("/sink"),
fd_(fd),
read_handler_()
{
read_handler_.handler(Event::Done, this, &Sink::read_done);
read_handler_.handler(Event::EOS, this, &Sink::read_eos);
close_handler_.handler(this, &Sink::close_done);
read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
~Sink()
{ }
void read_done(Event)
{
read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
void read_eos(Event)
{
close_handler_.wait(fd_.close(close_handler_.callback()));
}
void close_done(void)
{ }
};
int
main(void)
{
Sink sink(STDIN_FILENO);
event_main();
}
|
class Sink {
LogHandle log_;
StreamHandle fd_;
- Action *action_;
+ CallbackHandler close_handler_;
+ EventHandler read_handler_;
public:
Sink(int fd)
: log_("/sink"),
fd_(fd),
- action_(NULL)
+ read_handler_()
{
- EventCallback *cb = callback(this, &Sink::read_complete);
- action_ = fd_.read(0, cb);
+ read_handler_.handler(Event::Done, this, &Sink::read_done);
+ read_handler_.handler(Event::EOS, this, &Sink::read_eos);
+
+ close_handler_.handler(this, &Sink::close_done);
+
+ read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
~Sink()
+ { }
+
+ void read_done(Event)
{
- ASSERT(log_, action_ == NULL);
+ read_handler_.wait(fd_.read(0, read_handler_.callback()));
}
- void read_complete(Event e)
? ^ ^^^^^^ --
+ void read_eos(Event)
? ^ ^
{
+ close_handler_.wait(fd_.close(close_handler_.callback()));
- action_->cancel();
- action_ = NULL;
-
- switch (e.type_) {
- case Event::Done:
- case Event::EOS:
- break;
- default:
- HALT(log_) << "Unexpected event: " << e;
- return;
- }
-
- if (e.type_ == Event::EOS) {
- SimpleCallback *cb = callback(this, &Sink::close_complete);
- action_ = fd_.close(cb);
- return;
- }
-
- EventCallback *cb = callback(this, &Sink::read_complete);
- action_ = fd_.read(0, cb);
}
- void close_complete(void)
? ^ ^^^^^
+ void close_done(void)
? ^ ^
+ { }
- {
- action_->cancel();
- action_ = NULL;
- }
};
int
main(void)
{
Sink sink(STDIN_FILENO);
event_main();
} | 48 | 0.813559 | 17 | 31 |
70ee64464316f4c4f6ce41e9874996f74b03700c | content/posts/2018-02-05-jvm-memory-model.md | content/posts/2018-02-05-jvm-memory-model.md | ---
title: "Jvm Memory Model"
date: 2018-02-05T16:47:59+08:00
categories: "Notes"
tags: ["jvm", "memory model"]
description: "Note on JVM memory model"
draft: false
---
JVM ηε
ε樑εοΌδ»η½δΈζ΄ηηεΎηοΌ


| ---
title: "Jvm Memory Model"
date: 2018-02-05T16:47:59+08:00
categories: "Notes"
tags: ["jvm", "memory model"]
description: "Note on JVM memory model"
draft: false
---
JVM ηε
ε樑εοΌδ»η½δΈζ΄ηηεΎηοΌ


| Update relative path to images for jvm memory model | Update relative path to images for jvm memory model
| Markdown | mit | wbprime/wbpages,wbprime/wbpages,wbprime/wbpages | markdown | ## Code Before:
---
title: "Jvm Memory Model"
date: 2018-02-05T16:47:59+08:00
categories: "Notes"
tags: ["jvm", "memory model"]
description: "Note on JVM memory model"
draft: false
---
JVM ηε
ε樑εοΌδ»η½δΈζ΄ηηεΎηοΌ


## Instruction:
Update relative path to images for jvm memory model
## Code After:
---
title: "Jvm Memory Model"
date: 2018-02-05T16:47:59+08:00
categories: "Notes"
tags: ["jvm", "memory model"]
description: "Note on JVM memory model"
draft: false
---
JVM ηε
ε樑εοΌδ»η½δΈζ΄ηηεΎηοΌ


| ---
title: "Jvm Memory Model"
date: 2018-02-05T16:47:59+08:00
categories: "Notes"
tags: ["jvm", "memory model"]
description: "Note on JVM memory model"
draft: false
---
JVM ηε
ε樑εοΌδ»η½δΈζ΄ηηεΎηοΌ
- 
+ 
? +++++++
- 
+ 
? +++++++
| 4 | 0.285714 | 2 | 2 |
60b20d83f4fdc9c625b56a178c93af1533b82a60 | src/redux/modules/card.js | src/redux/modules/card.js | import uuid from 'uuid';
import { Record as record } from 'immutable';
export class CardModel extends record({
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
}) {
constructor(obj) {
super(obj);
this.id = uuid.v4();
}
}
| // import uuid from 'uuid';
import { Record as record } from 'immutable';
export const CardModel = record({
id: null,
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
});
| Remove id from Record and add id field | Remove id from Record and add id field
Reason: on CardModel.update() it doesnβt keep the id field, so shit
crashes
| JavaScript | mit | inooid/react-redux-card-game,inooid/react-redux-card-game | javascript | ## Code Before:
import uuid from 'uuid';
import { Record as record } from 'immutable';
export class CardModel extends record({
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
}) {
constructor(obj) {
super(obj);
this.id = uuid.v4();
}
}
## Instruction:
Remove id from Record and add id field
Reason: on CardModel.update() it doesnβt keep the id field, so shit
crashes
## Code After:
// import uuid from 'uuid';
import { Record as record } from 'immutable';
export const CardModel = record({
id: null,
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
});
| - import uuid from 'uuid';
+ // import uuid from 'uuid';
? +++
import { Record as record } from 'immutable';
- export class CardModel extends record({
? ^^ ^ ^^^^^^^
+ export const CardModel = record({
? ^^ ^ ^
+ id: null,
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
+ });
- }) {
- constructor(obj) {
- super(obj);
- this.id = uuid.v4();
- }
- } | 12 | 0.8 | 4 | 8 |
25e52813b663e5ed23ffc7ccd62fee782ab2927b | .github/workflows/ci.yml | .github/workflows/ci.yml | name: test with macos
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- run: git clone --depth 1 https://github.com/sstephenson/bats.git
- run: PATH="./bats/bin:$PATH" script/test
| name: Test
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: git clone --depth 1 https://github.com/sstephenson/bats.git
- run: PATH="./bats/bin:$PATH" script/test
| Test Linux in GitHub Actions too | Test Linux in GitHub Actions too
| YAML | mit | dark-panda/ruby-build,rbenv/ruby-build,rbenv/ruby-build,dark-panda/ruby-build | yaml | ## Code Before:
name: test with macos
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- run: git clone --depth 1 https://github.com/sstephenson/bats.git
- run: PATH="./bats/bin:$PATH" script/test
## Instruction:
Test Linux in GitHub Actions too
## Code After:
name: Test
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: git clone --depth 1 https://github.com/sstephenson/bats.git
- run: PATH="./bats/bin:$PATH" script/test
| - name: test with macos
+ name: Test
on: [push, pull_request]
jobs:
- build:
- runs-on: macos-latest
+ test:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: git clone --depth 1 https://github.com/sstephenson/bats.git
- run: PATH="./bats/bin:$PATH" script/test | 10 | 0.909091 | 7 | 3 |
3b9144acc0031957a1e824d15597a8605cd0be86 | examples/index.js | examples/index.js | import 'bootstrap/dist/css/bootstrap.min.css';
import 'nvd3/build/nv.d3.min.css';
import 'react-select/dist/react-select.min.css';
import 'fixed-data-table/dist/fixed-data-table.min.css';
import ReactDOM from 'react-dom';
import React from 'react';
import customDataHandlers from './customDataHandlers';
import { settings } from './settings';
import App from './App';
import { Router, Route, browserHistory } from 'react-router';
console.log('JJ', jeckyll);
ReactDOM.render(<App />, document.getElementById('root'));
| import 'bootstrap/dist/css/bootstrap.min.css';
import 'nvd3/build/nv.d3.min.css';
import 'react-select/dist/react-select.min.css';
import 'fixed-data-table/dist/fixed-data-table.min.css';
import ReactDOM from 'react-dom';
import React from 'react';
import customDataHandlers from './customDataHandlers';
import { settings } from './settings';
import App from './App';
import { Router, Route, browserHistory } from 'react-router';
ReactDOM.render(<App />, document.getElementById('root'));
| Test for jekyll env - 1.1 | Test for jekyll env - 1.1
| JavaScript | mit | NuCivic/react-dashboard,NuCivic/react-dash,NuCivic/react-dashboard,NuCivic/react-dashboard,NuCivic/react-dash,NuCivic/react-dash | javascript | ## Code Before:
import 'bootstrap/dist/css/bootstrap.min.css';
import 'nvd3/build/nv.d3.min.css';
import 'react-select/dist/react-select.min.css';
import 'fixed-data-table/dist/fixed-data-table.min.css';
import ReactDOM from 'react-dom';
import React from 'react';
import customDataHandlers from './customDataHandlers';
import { settings } from './settings';
import App from './App';
import { Router, Route, browserHistory } from 'react-router';
console.log('JJ', jeckyll);
ReactDOM.render(<App />, document.getElementById('root'));
## Instruction:
Test for jekyll env - 1.1
## Code After:
import 'bootstrap/dist/css/bootstrap.min.css';
import 'nvd3/build/nv.d3.min.css';
import 'react-select/dist/react-select.min.css';
import 'fixed-data-table/dist/fixed-data-table.min.css';
import ReactDOM from 'react-dom';
import React from 'react';
import customDataHandlers from './customDataHandlers';
import { settings } from './settings';
import App from './App';
import { Router, Route, browserHistory } from 'react-router';
ReactDOM.render(<App />, document.getElementById('root'));
| import 'bootstrap/dist/css/bootstrap.min.css';
import 'nvd3/build/nv.d3.min.css';
import 'react-select/dist/react-select.min.css';
import 'fixed-data-table/dist/fixed-data-table.min.css';
import ReactDOM from 'react-dom';
import React from 'react';
import customDataHandlers from './customDataHandlers';
import { settings } from './settings';
import App from './App';
import { Router, Route, browserHistory } from 'react-router';
- console.log('JJ', jeckyll);
-
ReactDOM.render(<App />, document.getElementById('root')); | 2 | 0.142857 | 0 | 2 |
c72bc891d6dfb110abb76ace91a453a2e3cead2e | code/MenuItemExtension.php | code/MenuItemExtension.php | <?php
namespace Guttmann\SilverStripe;
use DataExtension;
use FieldList;
use HiddenField;
use Subsite;
class MenuItemExtension extends DataExtension
{
private static $has_one = array(
'Subsite' => 'Subsite'
);
public function updateCMSFields(FieldList $fields)
{
$fields->push(new HiddenField('SubsiteID'));
}
public function onBeforeWrite()
{
$this->owner->SubsiteID = Subsite::currentSubsiteID();
}
}
| <?php
namespace Guttmann\SilverStripe;
use DataExtension;
use FieldList;
use HiddenField;
use Subsite;
class MenuItemExtension extends DataExtension
{
private static $has_one = array(
'Subsite' => 'Subsite'
);
public function updateCMSFields(FieldList $fields)
{
$fields->push(new HiddenField('SubsiteID'));
}
public function onBeforeWrite()
{
if (!$this->owner->SubsiteID) {
$this->owner->SubsiteID = Subsite::currentSubsiteID();
}
}
}
| Maintain subsite id on before write if already set | Maintain subsite id on before write if already set
| PHP | mit | guttmann/silverstripe-menumanager-subsites | php | ## Code Before:
<?php
namespace Guttmann\SilverStripe;
use DataExtension;
use FieldList;
use HiddenField;
use Subsite;
class MenuItemExtension extends DataExtension
{
private static $has_one = array(
'Subsite' => 'Subsite'
);
public function updateCMSFields(FieldList $fields)
{
$fields->push(new HiddenField('SubsiteID'));
}
public function onBeforeWrite()
{
$this->owner->SubsiteID = Subsite::currentSubsiteID();
}
}
## Instruction:
Maintain subsite id on before write if already set
## Code After:
<?php
namespace Guttmann\SilverStripe;
use DataExtension;
use FieldList;
use HiddenField;
use Subsite;
class MenuItemExtension extends DataExtension
{
private static $has_one = array(
'Subsite' => 'Subsite'
);
public function updateCMSFields(FieldList $fields)
{
$fields->push(new HiddenField('SubsiteID'));
}
public function onBeforeWrite()
{
if (!$this->owner->SubsiteID) {
$this->owner->SubsiteID = Subsite::currentSubsiteID();
}
}
}
| <?php
namespace Guttmann\SilverStripe;
use DataExtension;
use FieldList;
use HiddenField;
use Subsite;
class MenuItemExtension extends DataExtension
{
private static $has_one = array(
'Subsite' => 'Subsite'
);
public function updateCMSFields(FieldList $fields)
{
$fields->push(new HiddenField('SubsiteID'));
}
public function onBeforeWrite()
{
+ if (!$this->owner->SubsiteID) {
- $this->owner->SubsiteID = Subsite::currentSubsiteID();
+ $this->owner->SubsiteID = Subsite::currentSubsiteID();
? ++++
+ }
}
} | 4 | 0.153846 | 3 | 1 |
4e172e3e01a9741b6548b188d9cd757ddccd0e20 | conferences/2018/dotnet.json | conferences/2018/dotnet.json | [
{
"name": "Visual Studio Live!",
"url": "https://vslive.com/Events/Redmond-2018/Home.aspx",
"startDate": "2018-08-13",
"endDate": "2018-08-17",
"city": "Redmond, WA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live!",
"url": "https://vslive.com/Events/San-Diego-2018/Home.aspx",
"startDate": "2018-10-07",
"endDate": "2018-10-11",
"city": "San Diego, CA",
"country": "U.S.A.",
"twitter": "@vslive"
}
]
| [
{
"name": "Visual Studio Live! Redmond",
"url": "https://vslive.com/Events/Redmond-2018/Home.aspx",
"startDate": "2018-08-13",
"endDate": "2018-08-17",
"city": "Redmond, WA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live! San Diego",
"url": "https://vslive.com/Events/San-Diego-2018/Home.aspx",
"startDate": "2018-10-07",
"endDate": "2018-10-11",
"city": "San Diego, CA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live! Chicago",
"url": "https://vslive.com/events/chicago-2018/home.aspx",
"startDate": "2018-09-17",
"endDate": "2018-09-20",
"city": "Chicago, IL",
"country": "U.S.A.",
"twitter": "@vslive"
}
]
| Add Visual Studio Live! Chicago | Add Visual Studio Live! Chicago
| JSON | mit | tech-conferences/confs.tech,tech-conferences/confs.tech,tech-conferences/confs.tech | json | ## Code Before:
[
{
"name": "Visual Studio Live!",
"url": "https://vslive.com/Events/Redmond-2018/Home.aspx",
"startDate": "2018-08-13",
"endDate": "2018-08-17",
"city": "Redmond, WA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live!",
"url": "https://vslive.com/Events/San-Diego-2018/Home.aspx",
"startDate": "2018-10-07",
"endDate": "2018-10-11",
"city": "San Diego, CA",
"country": "U.S.A.",
"twitter": "@vslive"
}
]
## Instruction:
Add Visual Studio Live! Chicago
## Code After:
[
{
"name": "Visual Studio Live! Redmond",
"url": "https://vslive.com/Events/Redmond-2018/Home.aspx",
"startDate": "2018-08-13",
"endDate": "2018-08-17",
"city": "Redmond, WA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live! San Diego",
"url": "https://vslive.com/Events/San-Diego-2018/Home.aspx",
"startDate": "2018-10-07",
"endDate": "2018-10-11",
"city": "San Diego, CA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
"name": "Visual Studio Live! Chicago",
"url": "https://vslive.com/events/chicago-2018/home.aspx",
"startDate": "2018-09-17",
"endDate": "2018-09-20",
"city": "Chicago, IL",
"country": "U.S.A.",
"twitter": "@vslive"
}
]
| [
{
- "name": "Visual Studio Live!",
+ "name": "Visual Studio Live! Redmond",
? ++++++++
"url": "https://vslive.com/Events/Redmond-2018/Home.aspx",
"startDate": "2018-08-13",
"endDate": "2018-08-17",
"city": "Redmond, WA",
"country": "U.S.A.",
"twitter": "@vslive"
},
{
- "name": "Visual Studio Live!",
+ "name": "Visual Studio Live! San Diego",
? ++++++++++
"url": "https://vslive.com/Events/San-Diego-2018/Home.aspx",
"startDate": "2018-10-07",
"endDate": "2018-10-11",
"city": "San Diego, CA",
"country": "U.S.A.",
"twitter": "@vslive"
+ },
+ {
+ "name": "Visual Studio Live! Chicago",
+ "url": "https://vslive.com/events/chicago-2018/home.aspx",
+ "startDate": "2018-09-17",
+ "endDate": "2018-09-20",
+ "city": "Chicago, IL",
+ "country": "U.S.A.",
+ "twitter": "@vslive"
}
] | 13 | 0.65 | 11 | 2 |
39a235fbd619b4d24346f0b7889d4dfa489b1cbb | app/view/twig/editcontent/_aside-save.twig | app/view/twig/editcontent/_aside-save.twig | <div class="btn-group">
<button type="button" class="btn btn-primary" id="sidebar_save">
<i class="fa fa-flag"></i> {{ __('contenttypes.generic.save', {'%contenttype%': context.contenttype.singular_name}) }}
</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<button type="submit" class="btn btn-link" id="save_return">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-return-overview') }}
</button>
</li>
<li>
<button type="submit" class="btn btn-link" id="sidebar_save_create">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-create-new-record') }}
</button>
</li>
</ul>
</div>
| <div class="btn-group">
<button type="button" class="btn btn-primary" id="sidebar_save">
<i class="fa fa-flag"></i> {{ __('contenttypes.generic.save', {'%contenttype%': context.contenttype.singular_name}) }}
</button>
{% if not context.contenttype.singleton %}
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<button type="submit" class="btn btn-link" id="save_return">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-return-overview') }}
</button>
</li>
<li>
<button type="submit" class="btn btn-link" id="sidebar_save_create">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-create-new-record') }}
</button>
</li>
</ul>
{% endif %}
</div>
| Remove dropdown options for singleton | Remove dropdown options for singleton
| Twig | mit | nikgo/bolt,nikgo/bolt,GawainLynch/bolt,romulo1984/bolt,GawainLynch/bolt,bolt/bolt,romulo1984/bolt,bolt/bolt,GawainLynch/bolt,bolt/bolt,nikgo/bolt,romulo1984/bolt,nikgo/bolt,bolt/bolt,GawainLynch/bolt,romulo1984/bolt | twig | ## Code Before:
<div class="btn-group">
<button type="button" class="btn btn-primary" id="sidebar_save">
<i class="fa fa-flag"></i> {{ __('contenttypes.generic.save', {'%contenttype%': context.contenttype.singular_name}) }}
</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<button type="submit" class="btn btn-link" id="save_return">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-return-overview') }}
</button>
</li>
<li>
<button type="submit" class="btn btn-link" id="sidebar_save_create">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-create-new-record') }}
</button>
</li>
</ul>
</div>
## Instruction:
Remove dropdown options for singleton
## Code After:
<div class="btn-group">
<button type="button" class="btn btn-primary" id="sidebar_save">
<i class="fa fa-flag"></i> {{ __('contenttypes.generic.save', {'%contenttype%': context.contenttype.singular_name}) }}
</button>
{% if not context.contenttype.singleton %}
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<button type="submit" class="btn btn-link" id="save_return">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-return-overview') }}
</button>
</li>
<li>
<button type="submit" class="btn btn-link" id="sidebar_save_create">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-create-new-record') }}
</button>
</li>
</ul>
{% endif %}
</div>
| <div class="btn-group">
<button type="button" class="btn btn-primary" id="sidebar_save">
<i class="fa fa-flag"></i> {{ __('contenttypes.generic.save', {'%contenttype%': context.contenttype.singular_name}) }}
</button>
+ {% if not context.contenttype.singleton %}
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<button type="submit" class="btn btn-link" id="save_return">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-return-overview') }}
</button>
</li>
<li>
<button type="submit" class="btn btn-link" id="sidebar_save_create">
<i class="fa fa-fw fa-flag"></i> {{ __('general.phrase.save-and-create-new-record') }}
</button>
</li>
</ul>
+ {% endif %}
</div> | 2 | 0.083333 | 2 | 0 |
8b01406f6f5421bd6cd6f1fdbe8e014512e20b08 | circle.yml | circle.yml | machine:
timezone:
Australia/Sydney
node:
version: 6
test:
pre:
- npm run lint
override:
- npm test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
| machine:
timezone:
Australia/Sydney
node:
version: 6
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
dependencies:
override:
- yarn
cache_directories:
- ~/.cache/yarn
test:
pre:
- yarn lint
- yarn flow
override:
- yarn test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
| Use Yarn in Circle and add Flow | Use Yarn in Circle and add Flow
| YAML | mit | Thinkmill/react-conf-app,Thinkmill/react-conf-app,brentvatne/react-conf-app,Thinkmill/react-conf-app | yaml | ## Code Before:
machine:
timezone:
Australia/Sydney
node:
version: 6
test:
pre:
- npm run lint
override:
- npm test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
## Instruction:
Use Yarn in Circle and add Flow
## Code After:
machine:
timezone:
Australia/Sydney
node:
version: 6
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
dependencies:
override:
- yarn
cache_directories:
- ~/.cache/yarn
test:
pre:
- yarn lint
- yarn flow
override:
- yarn test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
| machine:
timezone:
Australia/Sydney
node:
version: 6
+ environment:
+ PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
+ dependencies:
+ override:
+ - yarn
+ cache_directories:
+ - ~/.cache/yarn
test:
pre:
- - npm run lint
? ^^^^ -
+ - yarn lint
? ^^
+ - yarn flow
override:
- - npm test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
? --
+ - yarn test -- --runInBand # Jest overloads our poor container when it tries to parallelise tests, and they all fail.
? +++
| 12 | 1.2 | 10 | 2 |
019230f699a0177e9e46b967c4cf1d6c82876bd8 | spec/integration/deployment_jobs_spec.rb | spec/integration/deployment_jobs_spec.rb | require 'spec_helper'
describe 'deployment job control' do
include IntegrationExampleGroup
before do
deploy_simple
end
it 'restarts a job' do
expect(run_bosh('restart foobar 0')).to match %r{foobar/0 has been restarted}
end
it 'recreates a job' do
expect(run_bosh('recreate foobar 1')).to match %r{foobar/1 has been recreated}
end
it 'stops and starts a job' do
expect(run_bosh('stop foobar 2')).to match %r{foobar/2 has been stopped}
expect(run_bosh('start foobar 2')).to match %r{foobar/2 has been started}
end
end | require 'spec_helper'
describe 'deployment job control' do
include IntegrationExampleGroup
before do
deploy_simple
end
it 'restarts a job' do
expect(run_bosh('restart foobar 0')).to match %r{foobar/0 has been restarted}
end
it 'recreates a job' do
expect(run_bosh('recreate foobar 1')).to match %r{foobar/1 has been recreated}
end
end | Revert "Limit concurrent integration specs on travis to 12" | Revert "Limit concurrent integration specs on travis to 12"
This reverts commit 046f50663389d03d1ea4b0c4854b2fb614b41f66.
| Ruby | apache-2.0 | barthy1/bosh,barthy1/bosh,barthy1/bosh,barthy1/bosh | ruby | ## Code Before:
require 'spec_helper'
describe 'deployment job control' do
include IntegrationExampleGroup
before do
deploy_simple
end
it 'restarts a job' do
expect(run_bosh('restart foobar 0')).to match %r{foobar/0 has been restarted}
end
it 'recreates a job' do
expect(run_bosh('recreate foobar 1')).to match %r{foobar/1 has been recreated}
end
it 'stops and starts a job' do
expect(run_bosh('stop foobar 2')).to match %r{foobar/2 has been stopped}
expect(run_bosh('start foobar 2')).to match %r{foobar/2 has been started}
end
end
## Instruction:
Revert "Limit concurrent integration specs on travis to 12"
This reverts commit 046f50663389d03d1ea4b0c4854b2fb614b41f66.
## Code After:
require 'spec_helper'
describe 'deployment job control' do
include IntegrationExampleGroup
before do
deploy_simple
end
it 'restarts a job' do
expect(run_bosh('restart foobar 0')).to match %r{foobar/0 has been restarted}
end
it 'recreates a job' do
expect(run_bosh('recreate foobar 1')).to match %r{foobar/1 has been recreated}
end
end | require 'spec_helper'
describe 'deployment job control' do
include IntegrationExampleGroup
before do
deploy_simple
end
it 'restarts a job' do
expect(run_bosh('restart foobar 0')).to match %r{foobar/0 has been restarted}
end
it 'recreates a job' do
expect(run_bosh('recreate foobar 1')).to match %r{foobar/1 has been recreated}
end
-
- it 'stops and starts a job' do
- expect(run_bosh('stop foobar 2')).to match %r{foobar/2 has been stopped}
- expect(run_bosh('start foobar 2')).to match %r{foobar/2 has been started}
- end
end | 5 | 0.227273 | 0 | 5 |
6c1602ee9459adf8b8b4e7bb50338787210ba662 | memopol/base/templates/blocks/what_is_memopol.html | memopol/base/templates/blocks/what_is_memopol.html | <div class="panel callout">
<h3>What I'm doing here?</h3>
<p>Political Memory is a toolbox designed to help you reach members of European Parliament (MEPs), and track their voting records. We hope it will help citizens to get to better know their elected representatives, and to allow them to inform them on the issues covered by La Quadrature du Net. <a href="{% url about %}">More...</a></p>
</div>
| <div class="panel callout">
<h3>What is memopol?</h3>
<p>Political Memory is a tool designed by La Quadrature du Net to help European citizens to reach members of European Parliament (MEPs) and track their voting records on issues related to fundamental freedoms online. <em><a href="{% url about %}">More...</a></em></p>
</div>
| Update "what is memopol?" box text | [mod] Update "what is memopol?" box text
| HTML | agpl-3.0 | yohanboniface/memopol-core,yohanboniface/memopol-core,yohanboniface/memopol-core | html | ## Code Before:
<div class="panel callout">
<h3>What I'm doing here?</h3>
<p>Political Memory is a toolbox designed to help you reach members of European Parliament (MEPs), and track their voting records. We hope it will help citizens to get to better know their elected representatives, and to allow them to inform them on the issues covered by La Quadrature du Net. <a href="{% url about %}">More...</a></p>
</div>
## Instruction:
[mod] Update "what is memopol?" box text
## Code After:
<div class="panel callout">
<h3>What is memopol?</h3>
<p>Political Memory is a tool designed by La Quadrature du Net to help European citizens to reach members of European Parliament (MEPs) and track their voting records on issues related to fundamental freedoms online. <em><a href="{% url about %}">More...</a></em></p>
</div>
| <div class="panel callout">
- <h3>What I'm doing here?</h3>
- <p>Political Memory is a toolbox designed to help you reach members of European Parliament (MEPs), and track their voting records. We hope it will help citizens to get to better know their elected representatives, and to allow them to inform them on the issues covered by La Quadrature du Net. <a href="{% url about %}">More...</a></p>
+ <h3>What is memopol?</h3>
+ <p>Political Memory is a tool designed by La Quadrature du Net to help European citizens to reach members of European Parliament (MEPs) and track their voting records on issues related to fundamental freedoms online. <em><a href="{% url about %}">More...</a></em></p>
</div> | 4 | 1 | 2 | 2 |
8f39dd85c5f5839241e2618873c1dd23e93bb972 | src/main/resources/templates/parts/search-results.jade | src/main/resources/templates/parts/search-results.jade | if cards
.ui.main.fluid.vertical.segment
.ui.three.cards
for card in cards
.ui.card
.content
.header(href="##{card.name}") #{card.name}
.content
img.left.floated.small.ui.image(src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=#{card.multiverseId}&type=card")
.ui.violet.labels
.ui.label lorem ipsum
.ui.label dolor sit amet
.ui.label consectetuer
.ui.label adipiscing elit
.ui.bottom.attached.button View details
i.angle.double.right.icon
else
.ui.main.fluid.vertical.segment
.ui.violet.message No results | if cards
.ui.main.fluid.vertical.segment
.ui.three.cards
for card in cards
.ui.card
.content
.header #{card.name}
.content
img.left.floated.small.ui.image(src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=#{card.multiverseId}&type=card")
.ui.violet.labels
.ui.label lorem ipsum
.ui.label dolor sit amet
.ui.label consectetuer
.ui.label adipiscing elit
.ui.bottom.attached.button(
ic-post-to="/ic/card/#{card.multiverseId}",
ic-target="#card"
) View details
i.angle.double.right.icon
else
.ui.main.fluid.vertical.segment
.ui.violet.message No results | Add button to show a card | [view] Add button to show a card
| Jade | mit | mbarberot/mtg-grimoire,mbarberot/mtg-grimoire | jade | ## Code Before:
if cards
.ui.main.fluid.vertical.segment
.ui.three.cards
for card in cards
.ui.card
.content
.header(href="##{card.name}") #{card.name}
.content
img.left.floated.small.ui.image(src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=#{card.multiverseId}&type=card")
.ui.violet.labels
.ui.label lorem ipsum
.ui.label dolor sit amet
.ui.label consectetuer
.ui.label adipiscing elit
.ui.bottom.attached.button View details
i.angle.double.right.icon
else
.ui.main.fluid.vertical.segment
.ui.violet.message No results
## Instruction:
[view] Add button to show a card
## Code After:
if cards
.ui.main.fluid.vertical.segment
.ui.three.cards
for card in cards
.ui.card
.content
.header #{card.name}
.content
img.left.floated.small.ui.image(src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=#{card.multiverseId}&type=card")
.ui.violet.labels
.ui.label lorem ipsum
.ui.label dolor sit amet
.ui.label consectetuer
.ui.label adipiscing elit
.ui.bottom.attached.button(
ic-post-to="/ic/card/#{card.multiverseId}",
ic-target="#card"
) View details
i.angle.double.right.icon
else
.ui.main.fluid.vertical.segment
.ui.violet.message No results | if cards
.ui.main.fluid.vertical.segment
.ui.three.cards
for card in cards
.ui.card
.content
- .header(href="##{card.name}") #{card.name}
? ----------------------
+ .header #{card.name}
.content
img.left.floated.small.ui.image(src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=#{card.multiverseId}&type=card")
.ui.violet.labels
.ui.label lorem ipsum
.ui.label dolor sit amet
.ui.label consectetuer
.ui.label adipiscing elit
- .ui.bottom.attached.button View details
? ^^^^^^^^^^^^^
+ .ui.bottom.attached.button(
? ^
+ ic-post-to="/ic/card/#{card.multiverseId}",
+ ic-target="#card"
+ ) View details
i.angle.double.right.icon
else
.ui.main.fluid.vertical.segment
.ui.violet.message No results | 7 | 0.35 | 5 | 2 |
d98e51ed235741e8292b4ef3df7b977c2218b8ee | components/styles/RestartButtonStyle.js | components/styles/RestartButtonStyle.js | import { StyleSheet, Dimensions } from 'react-native';
export default StyleSheet.create({
button: {
height: 45,
borderRadius: 5,
marginHorizontal: 5,
backgroundColor: 'black',
justifyContent: 'center',
top: Dimensions.get('window').height / 1.6
},
buttonText: {
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
fontSize: 15
}
});
| import { StyleSheet, Dimensions } from 'react-native';
export default StyleSheet.create({
button: {
height: 45,
borderRadius: 5,
marginHorizontal: 5,
backgroundColor: 'black',
justifyContent: 'center',
},
buttonText: {
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
fontSize: 15
}
});
| Remove margintop from restart button to keep it on screen | Remove margintop from restart button to keep it on screen
| JavaScript | mit | fridl8/cold-bacon-client,fridl8/cold-bacon-client,fridl8/cold-bacon-client | javascript | ## Code Before:
import { StyleSheet, Dimensions } from 'react-native';
export default StyleSheet.create({
button: {
height: 45,
borderRadius: 5,
marginHorizontal: 5,
backgroundColor: 'black',
justifyContent: 'center',
top: Dimensions.get('window').height / 1.6
},
buttonText: {
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
fontSize: 15
}
});
## Instruction:
Remove margintop from restart button to keep it on screen
## Code After:
import { StyleSheet, Dimensions } from 'react-native';
export default StyleSheet.create({
button: {
height: 45,
borderRadius: 5,
marginHorizontal: 5,
backgroundColor: 'black',
justifyContent: 'center',
},
buttonText: {
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
fontSize: 15
}
});
| import { StyleSheet, Dimensions } from 'react-native';
export default StyleSheet.create({
button: {
height: 45,
borderRadius: 5,
marginHorizontal: 5,
backgroundColor: 'black',
justifyContent: 'center',
- top: Dimensions.get('window').height / 1.6
},
buttonText: {
color: 'white',
textAlign: 'center',
fontWeight: 'bold',
fontSize: 15
}
}); | 1 | 0.055556 | 0 | 1 |
69a4e2ba1022b3215255d13b15d5b35063f46386 | index.js | index.js | const request = require('request');
const fs = require('fs');
const thenify = require('thenify').withCallback;
const download = (url, file, callback) => {
const stream = fs.createWriteStream(file);
stream.on('finish', () => {
callback(null, file);
});
stream.on('error', error => {
callback(error);
});
request
.get(url)
.pipe(stream);
};
module.exports = thenify(download);
| const request = require('request');
const fs = require('fs');
const thenify = require('thenify').withCallback;
const download = (url, file, callback) => {
const stream = fs.createWriteStream(file);
stream.on('finish', () => {
callback(null, file);
});
stream.on('error', error => {
callback(error);
});
request
.get(url)
.on('error', error => {
callback(error);
})
.pipe(stream);
};
module.exports = thenify(download);
| Handle errors that occure during request | Handle errors that occure during request | JavaScript | mit | demohi/co-download | javascript | ## Code Before:
const request = require('request');
const fs = require('fs');
const thenify = require('thenify').withCallback;
const download = (url, file, callback) => {
const stream = fs.createWriteStream(file);
stream.on('finish', () => {
callback(null, file);
});
stream.on('error', error => {
callback(error);
});
request
.get(url)
.pipe(stream);
};
module.exports = thenify(download);
## Instruction:
Handle errors that occure during request
## Code After:
const request = require('request');
const fs = require('fs');
const thenify = require('thenify').withCallback;
const download = (url, file, callback) => {
const stream = fs.createWriteStream(file);
stream.on('finish', () => {
callback(null, file);
});
stream.on('error', error => {
callback(error);
});
request
.get(url)
.on('error', error => {
callback(error);
})
.pipe(stream);
};
module.exports = thenify(download);
| const request = require('request');
const fs = require('fs');
const thenify = require('thenify').withCallback;
const download = (url, file, callback) => {
const stream = fs.createWriteStream(file);
stream.on('finish', () => {
callback(null, file);
});
stream.on('error', error => {
callback(error);
});
request
.get(url)
+ .on('error', error => {
+ callback(error);
+ })
.pipe(stream);
};
module.exports = thenify(download); | 3 | 0.166667 | 3 | 0 |
33bb321e6ad440efcb73cd9e0d42223793b503c3 | DependencyInjection/Compiler/AddResolveTargetEntitiesPass.php | DependencyInjection/Compiler/AddResolveTargetEntitiesPass.php | <?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Add resolve target entities compiler pass
*/
class AddResolveTargetEntitiesPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasExtension('doctrine')) {
return;
}
$resolveTargetEntities = [];
foreach ($container->getExtensionConfig('darvin_admin') as $config) {
if (!isset($config['entity_override'])) {
continue;
}
foreach ($config['entity_override'] as $target => $replacement) {
foreach (class_implements($target) as $interface) {
if ($interface === $target.'Interface') {
$resolveTargetEntities[$interface] = $replacement;
}
}
}
}
if (!empty($resolveTargetEntities)) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
'resolve_target_entities' => $resolveTargetEntities,
],
]);
}
}
}
| <?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Add resolve target entities to resolve target entity listener compiler pass
*/
class AddResolveTargetEntitiesPass implements CompilerPassInterface
{
const RESOLVE_TARGET_ENTITY_LISTENER_ID = 'doctrine.orm.listeners.resolve_target_entity';
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID)) {
return;
}
$listenerDefinition = $container->getDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID);
foreach ($container->getExtensionConfig('darvin_admin') as $config) {
if (!isset($config['entity_override'])) {
continue;
}
foreach ($config['entity_override'] as $target => $replacement) {
foreach (class_implements($target) as $interface) {
if ($interface === $target.'Interface') {
$listenerDefinition->addMethodCall('addResolveTargetEntity', [
$interface,
$replacement,
[],
]);
}
}
}
}
}
}
| Add resolve target entity to listener instead of configuration in the add resolve target entities compiler pass. | Add resolve target entity to listener instead of configuration in the add resolve target entities compiler pass.
| PHP | mit | DarvinStudio/DarvinAdminBundle,DarvinStudio/DarvinAdminBundle,DarvinStudio/DarvinAdminBundle | php | ## Code Before:
<?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Add resolve target entities compiler pass
*/
class AddResolveTargetEntitiesPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasExtension('doctrine')) {
return;
}
$resolveTargetEntities = [];
foreach ($container->getExtensionConfig('darvin_admin') as $config) {
if (!isset($config['entity_override'])) {
continue;
}
foreach ($config['entity_override'] as $target => $replacement) {
foreach (class_implements($target) as $interface) {
if ($interface === $target.'Interface') {
$resolveTargetEntities[$interface] = $replacement;
}
}
}
}
if (!empty($resolveTargetEntities)) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
'resolve_target_entities' => $resolveTargetEntities,
],
]);
}
}
}
## Instruction:
Add resolve target entity to listener instead of configuration in the add resolve target entities compiler pass.
## Code After:
<?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Add resolve target entities to resolve target entity listener compiler pass
*/
class AddResolveTargetEntitiesPass implements CompilerPassInterface
{
const RESOLVE_TARGET_ENTITY_LISTENER_ID = 'doctrine.orm.listeners.resolve_target_entity';
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID)) {
return;
}
$listenerDefinition = $container->getDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID);
foreach ($container->getExtensionConfig('darvin_admin') as $config) {
if (!isset($config['entity_override'])) {
continue;
}
foreach ($config['entity_override'] as $target => $replacement) {
foreach (class_implements($target) as $interface) {
if ($interface === $target.'Interface') {
$listenerDefinition->addMethodCall('addResolveTargetEntity', [
$interface,
$replacement,
[],
]);
}
}
}
}
}
}
| <?php
/**
* @author Igor Nikolaev <[email protected]>
* @copyright Copyright (c) 2017, Darvin Studio
* @link https://www.darvin-studio.ru
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Darvin\AdminBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
- * Add resolve target entities compiler pass
+ * Add resolve target entities to resolve target entity listener compiler pass
*/
class AddResolveTargetEntitiesPass implements CompilerPassInterface
{
+ const RESOLVE_TARGET_ENTITY_LISTENER_ID = 'doctrine.orm.listeners.resolve_target_entity';
+
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
- if (!$container->hasExtension('doctrine')) {
+ if (!$container->hasDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID)) {
return;
}
- $resolveTargetEntities = [];
+ $listenerDefinition = $container->getDefinition(self::RESOLVE_TARGET_ENTITY_LISTENER_ID);
foreach ($container->getExtensionConfig('darvin_admin') as $config) {
if (!isset($config['entity_override'])) {
continue;
}
foreach ($config['entity_override'] as $target => $replacement) {
foreach (class_implements($target) as $interface) {
if ($interface === $target.'Interface') {
- $resolveTargetEntities[$interface] = $replacement;
+ $listenerDefinition->addMethodCall('addResolveTargetEntity', [
+ $interface,
+ $replacement,
+ [],
+ ]);
}
}
}
}
- if (!empty($resolveTargetEntities)) {
- $container->prependExtensionConfig('doctrine', [
- 'orm' => [
- 'resolve_target_entities' => $resolveTargetEntities,
- ],
- ]);
- }
}
} | 21 | 0.403846 | 10 | 11 |
ade32137ebcb6c6ba30e5ed185c9e51e9c942915 | templates/zerver/help/star-a-message.md | templates/zerver/help/star-a-message.md |
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
### Star a message
{start_tabs}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
their right. Click on it to unstar the message.
## Access your starred messages
You can access your starred messages by clicking **Starred Messages** in the
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
## Display the number of starred messages
{start_tabs}
{settings_tab|display-settings}
1. Under **Display settings**, select **Show counts for starred messages**.
{end_tabs}
Zulip will add a number to the right of **Starred messages** in the left
sidebar.
|
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
## Star a message
{start_tabs}
{tab|desktop}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
{tab|mobile}
1. Long press on a message.
1. Select **Star message** in the menu that appears.
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
their right. You can unstar a message using the same instructions
used to star it.
## Access your starred messages
You can access your starred messages by clicking **Starred messages** in the
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
By default, Zulip displays the number of starred messages in the left
sidebar; this allows you to use them as an inbox of messages you'd
like to come back to. If you are using starred messages for something
else and would prefer not to see the count in your left sidebar, you
can disable that feature.
{start_tabs}
{settings_tab|display-settings}
1. Under **Display settings**, toggle **Show counts for starred messages**.
{end_tabs}
| Improve documentation for starred messages. | help: Improve documentation for starred messages.
* Add mobile app instructions for interacting with them.
* Fix inconsistent headings.
* Document the new state that starred message counts are the deafult,
and mention the "come back to" workflow for them.
| Markdown | apache-2.0 | kou/zulip,hackerkid/zulip,zulip/zulip,andersk/zulip,andersk/zulip,andersk/zulip,hackerkid/zulip,hackerkid/zulip,zulip/zulip,punchagan/zulip,kou/zulip,rht/zulip,andersk/zulip,punchagan/zulip,eeshangarg/zulip,hackerkid/zulip,rht/zulip,eeshangarg/zulip,punchagan/zulip,hackerkid/zulip,hackerkid/zulip,hackerkid/zulip,eeshangarg/zulip,punchagan/zulip,kou/zulip,andersk/zulip,zulip/zulip,eeshangarg/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,kou/zulip,zulip/zulip,punchagan/zulip,eeshangarg/zulip,punchagan/zulip,eeshangarg/zulip,rht/zulip,andersk/zulip,kou/zulip,rht/zulip,zulip/zulip,rht/zulip,kou/zulip,punchagan/zulip,eeshangarg/zulip,zulip/zulip,kou/zulip | markdown | ## Code Before:
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
### Star a message
{start_tabs}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
their right. Click on it to unstar the message.
## Access your starred messages
You can access your starred messages by clicking **Starred Messages** in the
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
## Display the number of starred messages
{start_tabs}
{settings_tab|display-settings}
1. Under **Display settings**, select **Show counts for starred messages**.
{end_tabs}
Zulip will add a number to the right of **Starred messages** in the left
sidebar.
## Instruction:
help: Improve documentation for starred messages.
* Add mobile app instructions for interacting with them.
* Fix inconsistent headings.
* Document the new state that starred message counts are the deafult,
and mention the "come back to" workflow for them.
## Code After:
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
## Star a message
{start_tabs}
{tab|desktop}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
{tab|mobile}
1. Long press on a message.
1. Select **Star message** in the menu that appears.
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
their right. You can unstar a message using the same instructions
used to star it.
## Access your starred messages
You can access your starred messages by clicking **Starred messages** in the
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
By default, Zulip displays the number of starred messages in the left
sidebar; this allows you to use them as an inbox of messages you'd
like to come back to. If you are using starred messages for something
else and would prefer not to see the count in your left sidebar, you
can disable that feature.
{start_tabs}
{settings_tab|display-settings}
1. Under **Display settings**, toggle **Show counts for starred messages**.
{end_tabs}
|
Starring messages is a good way to keep track of important messages, such as
tasks you need to go back to or documents you reference often.
- ### Star a message
? -
+ ## Star a message
{start_tabs}
+ {tab|desktop}
{!message-actions.md!}
1. Click the star (<i class="fa fa-star-o"></i>) icon.
+ {tab|mobile}
+
+ 1. Long press on a message.
+
+ 1. Select **Star message** in the menu that appears.
+
{end_tabs}
Starred messages have a filled in star (<i class="fa fa-star"></i>) to
- their right. Click on it to unstar the message.
+ their right. You can unstar a message using the same instructions
+ used to star it.
## Access your starred messages
- You can access your starred messages by clicking **Starred Messages** in the
? ^
+ You can access your starred messages by clicking **Starred messages** in the
? ^
left sidebar, or by [searching](/help/search-for-messages) for `is:starred`.
- ## Display the number of starred messages
+ By default, Zulip displays the number of starred messages in the left
+ sidebar; this allows you to use them as an inbox of messages you'd
+ like to come back to. If you are using starred messages for something
+ else and would prefer not to see the count in your left sidebar, you
+ can disable that feature.
{start_tabs}
{settings_tab|display-settings}
- 1. Under **Display settings**, select **Show counts for starred messages**.
? ^^ --
+ 1. Under **Display settings**, toggle **Show counts for starred messages**.
? ^^^^
{end_tabs}
-
- Zulip will add a number to the right of **Starred messages** in the left
- sidebar. | 25 | 0.735294 | 17 | 8 |
3dbfcb229df22e3a5f916a05baed6922467de88d | lib/baton/server.rb | lib/baton/server.rb | require "ohai"
module Baton
class Server
attr_accessor :environment, :fqdn, :app_names
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
# file.
def initialize
@ohai = Ohai::System.new
@ohai.all_plugins
configure
end
# Public: Method that configures the server. It sets the fqdn, environment and a list
# of app names specified by the ohai config file.
#
# Returns nothing.
def configure
@environment = facts.fetch("chef_environment"){"development"}.downcase
@fqdn = facts.fetch("fqdn"){""}
@app_names = facts.fetch("trebuchet"){[]}
end
# Public: Method that reads facts from the file specified by facts_file.
#
# Examples
#
# facts
# # => {"fqdn" => "server.dsci.it", "chef_environment" => "production", "trebuchet" => []}
#
# Returns a hash with server information.
def facts
@facts ||= @ohai.data
end
# Public: Method that provides an hash of attributes for a server.
#
# Examples
#
# attributes
# # => {environment: "production", fqdn: "server.dsci.it", app_names: ["app1","app2"]}
#
# Returns Output depends on the implementation.
def attributes
{environment: environment, fqdn: fqdn, app_names: app_names}
end
end
end
| require "ohai"
module Baton
class Server
attr_accessor :environment, :fqdn, :app_names
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
# file.
def initialize
Ohai::Config[:plugin_path] << "/etc/chef/ohai_plugins"
@ohai = Ohai::System.new
@ohai.all_plugins
configure
end
# Public: Method that configures the server. It sets the fqdn, environment and a list
# of app names specified by the ohai config file.
#
# Returns nothing.
def configure
@environment = facts.fetch("chef_environment"){"development"}.downcase
@fqdn = facts.fetch("fqdn"){""}
@app_names = facts.fetch("trebuchet"){[]}
end
# Public: Method that reads facts from the file specified by facts_file.
#
# Examples
#
# facts
# # => {"fqdn" => "server.dsci.it", "chef_environment" => "production", "trebuchet" => []}
#
# Returns a hash with server information.
def facts
@facts ||= @ohai.data
end
# Public: Method that provides an hash of attributes for a server.
#
# Examples
#
# attributes
# # => {environment: "production", fqdn: "server.dsci.it", app_names: ["app1","app2"]}
#
# Returns Output depends on the implementation.
def attributes
{environment: environment, fqdn: fqdn, app_names: app_names}
end
end
end
| Allow for custom ohai plugins | Allow for custom ohai plugins
| Ruby | mit | psteward/baton,digital-science/baton | ruby | ## Code Before:
require "ohai"
module Baton
class Server
attr_accessor :environment, :fqdn, :app_names
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
# file.
def initialize
@ohai = Ohai::System.new
@ohai.all_plugins
configure
end
# Public: Method that configures the server. It sets the fqdn, environment and a list
# of app names specified by the ohai config file.
#
# Returns nothing.
def configure
@environment = facts.fetch("chef_environment"){"development"}.downcase
@fqdn = facts.fetch("fqdn"){""}
@app_names = facts.fetch("trebuchet"){[]}
end
# Public: Method that reads facts from the file specified by facts_file.
#
# Examples
#
# facts
# # => {"fqdn" => "server.dsci.it", "chef_environment" => "production", "trebuchet" => []}
#
# Returns a hash with server information.
def facts
@facts ||= @ohai.data
end
# Public: Method that provides an hash of attributes for a server.
#
# Examples
#
# attributes
# # => {environment: "production", fqdn: "server.dsci.it", app_names: ["app1","app2"]}
#
# Returns Output depends on the implementation.
def attributes
{environment: environment, fqdn: fqdn, app_names: app_names}
end
end
end
## Instruction:
Allow for custom ohai plugins
## Code After:
require "ohai"
module Baton
class Server
attr_accessor :environment, :fqdn, :app_names
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
# file.
def initialize
Ohai::Config[:plugin_path] << "/etc/chef/ohai_plugins"
@ohai = Ohai::System.new
@ohai.all_plugins
configure
end
# Public: Method that configures the server. It sets the fqdn, environment and a list
# of app names specified by the ohai config file.
#
# Returns nothing.
def configure
@environment = facts.fetch("chef_environment"){"development"}.downcase
@fqdn = facts.fetch("fqdn"){""}
@app_names = facts.fetch("trebuchet"){[]}
end
# Public: Method that reads facts from the file specified by facts_file.
#
# Examples
#
# facts
# # => {"fqdn" => "server.dsci.it", "chef_environment" => "production", "trebuchet" => []}
#
# Returns a hash with server information.
def facts
@facts ||= @ohai.data
end
# Public: Method that provides an hash of attributes for a server.
#
# Examples
#
# attributes
# # => {environment: "production", fqdn: "server.dsci.it", app_names: ["app1","app2"]}
#
# Returns Output depends on the implementation.
def attributes
{environment: environment, fqdn: fqdn, app_names: app_names}
end
end
end
| require "ohai"
module Baton
class Server
attr_accessor :environment, :fqdn, :app_names
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
# file.
def initialize
+ Ohai::Config[:plugin_path] << "/etc/chef/ohai_plugins"
@ohai = Ohai::System.new
@ohai.all_plugins
configure
end
# Public: Method that configures the server. It sets the fqdn, environment and a list
# of app names specified by the ohai config file.
#
# Returns nothing.
def configure
@environment = facts.fetch("chef_environment"){"development"}.downcase
@fqdn = facts.fetch("fqdn"){""}
@app_names = facts.fetch("trebuchet"){[]}
end
# Public: Method that reads facts from the file specified by facts_file.
#
# Examples
#
# facts
# # => {"fqdn" => "server.dsci.it", "chef_environment" => "production", "trebuchet" => []}
#
# Returns a hash with server information.
def facts
@facts ||= @ohai.data
end
# Public: Method that provides an hash of attributes for a server.
#
# Examples
#
# attributes
# # => {environment: "production", fqdn: "server.dsci.it", app_names: ["app1","app2"]}
#
# Returns Output depends on the implementation.
def attributes
{environment: environment, fqdn: fqdn, app_names: app_names}
end
end
end | 1 | 0.019608 | 1 | 0 |
346f7027e2285b3ff1280197045c4db541f4a700 | spec/frontend/test_setup.js | spec/frontend/test_setup.js | import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Vue.use(Translate);
| import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Vue.use(Translate);
// workaround for JSDOM not supporting innerText
// see https://github.com/jsdom/jsdom/issues/1245
Object.defineProperty(global.Element.prototype, 'innerText', {
get() {
return this.textContent;
},
configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch
});
| Add workaround for innerText in Jest | Add workaround for innerText in Jest
| JavaScript | mit | iiet/iiet-git,stoplightio/gitlabhq,iiet/iiet-git,iiet/iiet-git,mmkassem/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,iiet/iiet-git | javascript | ## Code Before:
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Vue.use(Translate);
## Instruction:
Add workaround for innerText in Jest
## Code After:
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Vue.use(Translate);
// workaround for JSDOM not supporting innerText
// see https://github.com/jsdom/jsdom/issues/1245
Object.defineProperty(global.Element.prototype, 'innerText', {
get() {
return this.textContent;
},
configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch
});
| import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
// wait for pending setTimeout()s
afterEach(() => {
jest.runAllTimers();
});
initializeTestTimeout(300);
// fail tests for unmocked requests
beforeEach(done => {
axios.defaults.adapter = config => {
const error = new Error(`Unexpected unmocked request: ${JSON.stringify(config, null, 2)}`);
error.config = config;
done.fail(error);
return Promise.reject(error);
};
done();
});
Vue.use(Translate);
+
+ // workaround for JSDOM not supporting innerText
+ // see https://github.com/jsdom/jsdom/issues/1245
+ Object.defineProperty(global.Element.prototype, 'innerText', {
+ get() {
+ return this.textContent;
+ },
+ configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch
+ }); | 9 | 0.36 | 9 | 0 |
c569f4c6f0165b6a121ccf022e55f09ba44ba4d5 | dph-base/Data/Array/Parallel/Base/Util.hs | dph-base/Data/Array/Parallel/Base/Util.hs | module Data.Array.Parallel.Base.Util (
fromBool, toBool
) where
fromBool :: Num a => Bool -> a
fromBool False = 0
fromBool True = 1
{-# INLINE fromBool #-}
toBool :: Num a => a -> Bool
toBool n | n == 0 = False
| otherwise = True
{-# INLINE toBool #-}
| module Data.Array.Parallel.Base.Util (
fromBool, toBool
) where
fromBool :: Bool -> Int
fromBool False = 0
fromBool True = 1
{-# INLINE fromBool #-}
toBool :: Int -> Bool
toBool n | n == 0 = False
| otherwise = True
{-# INLINE toBool #-}
| Make fromBool and toBool monomorphic | Make fromBool and toBool monomorphic
They weren't getting inlined otherwise. Big performance ouch: this change
makes sequential Quickhull about 30% faster.
| Haskell | bsd-3-clause | mainland/dph,mainland/dph,mainland/dph | haskell | ## Code Before:
module Data.Array.Parallel.Base.Util (
fromBool, toBool
) where
fromBool :: Num a => Bool -> a
fromBool False = 0
fromBool True = 1
{-# INLINE fromBool #-}
toBool :: Num a => a -> Bool
toBool n | n == 0 = False
| otherwise = True
{-# INLINE toBool #-}
## Instruction:
Make fromBool and toBool monomorphic
They weren't getting inlined otherwise. Big performance ouch: this change
makes sequential Quickhull about 30% faster.
## Code After:
module Data.Array.Parallel.Base.Util (
fromBool, toBool
) where
fromBool :: Bool -> Int
fromBool False = 0
fromBool True = 1
{-# INLINE fromBool #-}
toBool :: Int -> Bool
toBool n | n == 0 = False
| otherwise = True
{-# INLINE toBool #-}
| module Data.Array.Parallel.Base.Util (
fromBool, toBool
) where
- fromBool :: Num a => Bool -> a
? --------- ^
+ fromBool :: Bool -> Int
? ^^^
fromBool False = 0
fromBool True = 1
{-# INLINE fromBool #-}
- toBool :: Num a => a -> Bool
+ toBool :: Int -> Bool
toBool n | n == 0 = False
| otherwise = True
{-# INLINE toBool #-}
| 4 | 0.285714 | 2 | 2 |
2793b1488737ef75b59abb0052416bdc4dd7ca86 | app/views/projects/pulls.html.haml | app/views/projects/pulls.html.haml | - @pulls.each do |pull|
= pull.desc
= pull.status
= 'Merge'
| .center
- @pulls.each do |pull|
= pull.desc
= pull.status
= 'Merge'
| Make pull page center aligned | Make pull page center aligned
| Haml | mit | glittergallery/GlitterGallery,glittergallery/GlitterGallery,glittergallery/GlitterGallery,glittergallery/GlitterGallery | haml | ## Code Before:
- @pulls.each do |pull|
= pull.desc
= pull.status
= 'Merge'
## Instruction:
Make pull page center aligned
## Code After:
.center
- @pulls.each do |pull|
= pull.desc
= pull.status
= 'Merge'
| + .center
- - @pulls.each do |pull|
+ - @pulls.each do |pull|
? +
- = pull.desc
+ = pull.desc
? +
- = pull.status
+ = pull.status
? +
- = 'Merge'
+ = 'Merge'
? +
| 9 | 1.8 | 5 | 4 |
4f53c1b089dc35c870cfbee28fae5abf7153af47 | .travis.yml | .travis.yml | language: go
go:
- 1.5
install:
- go get github.com/constabulary/gb/...
# before_script:
- make dist
script:
- gb test -v
| language: go
go:
- 1.5.3
install:
- go get github.com/constabulary/gb/...
- go get github.com/alecthomas/gometalinter
before_script:
- make dist
- gometalinter --install --update
- export GOPATH=$HOME/gopath:$HOME/gopath/src/github.com/skizzehq/skizze/:$HOME/gopath/src/github.com/skizzehq/skizze/vendor
script:
- gometalinter ./src/* -D gocyclo -D gotype -D interfacer -D dupl -D errcheck --deadline=60s
- gb test -v
| Update Travis to include gometalinter | Update Travis to include gometalinter
| YAML | unknown | skizzehq/skizze,seiflotfy/counts,martinpinto/counts,njpatel/skizze,skizzehq/skizze,martinpinto/skizze,seiflotfy/counts,seiflotfy/skizze,njpatel/skizze,mbarkhau/counts,mbarkhau/counts | yaml | ## Code Before:
language: go
go:
- 1.5
install:
- go get github.com/constabulary/gb/...
# before_script:
- make dist
script:
- gb test -v
## Instruction:
Update Travis to include gometalinter
## Code After:
language: go
go:
- 1.5.3
install:
- go get github.com/constabulary/gb/...
- go get github.com/alecthomas/gometalinter
before_script:
- make dist
- gometalinter --install --update
- export GOPATH=$HOME/gopath:$HOME/gopath/src/github.com/skizzehq/skizze/:$HOME/gopath/src/github.com/skizzehq/skizze/vendor
script:
- gometalinter ./src/* -D gocyclo -D gotype -D interfacer -D dupl -D errcheck --deadline=60s
- gb test -v
| language: go
go:
- - 1.5
+ - 1.5.3
? ++
install:
- go get github.com/constabulary/gb/...
+ - go get github.com/alecthomas/gometalinter
- # before_script:
? --
+ before_script:
- make dist
+ - gometalinter --install --update
+ - export GOPATH=$HOME/gopath:$HOME/gopath/src/github.com/skizzehq/skizze/:$HOME/gopath/src/github.com/skizzehq/skizze/vendor
script:
+ - gometalinter ./src/* -D gocyclo -D gotype -D interfacer -D dupl -D errcheck --deadline=60s
- gb test -v | 8 | 0.666667 | 6 | 2 |
13208d4656adcf52a5842200ee1d9e079fdffc2b | bin/rate_limit_watcher.py | bin/rate_limit_watcher.py |
import requests
URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
def main():
resp = requests.get(URL)
if resp.status_code == 200:
print resp.content
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
if __name__ == '__main__':
main()
|
import argparse
from datetime import datetime
import requests
DOMAIN = 'http://tutorials.pluralsight.com/'
URL = '/gh_rate_limit'
def main(domain):
response = get_rate_limit(domain)
if response:
pprint(response)
def get_rate_limit(domain=DOMAIN):
"""Get rate limit as dictionary"""
url = '%s%s' % (domain, URL)
resp = requests.get(url)
if resp.status_code == 200:
return resp.json()
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
return {}
def pprint(rate_limit):
"""
Pretty print rate limit dictionary to be easily parsable and readable
across multiple lines
"""
# Ignoring the 'rate' key b/c github API claims this will be removed in
# next major version:
# https://developer.github.com/v3/rate_limit/#deprecation-notice
def print_(name, limits):
date_ = datetime.utcfromtimestamp(limits[name]['reset'])
print '%8s remaining: %4s limit: %4s reset: %s' % (
name,
limits[name]['remaining'],
limits[name]['limit'],
date_.strftime('%d-%m-%Y %H:%M:%S'))
print_('core', rate_limit['resources'])
print_('search', rate_limit['resources'])
#u'resources': {u'core': {u'reset': 1462781427, u'limit': 5000, u'remaining': 4923}, u'search': {u'reset': 1462780271, u'limit': 30, u'remaining': 30}}}
def _parse_args():
"""Parse args and get dictionary back"""
parser = argparse.ArgumentParser(description='Get Github.com rate limit')
parser.add_argument('-d', '--domain', action='store', required=False,
default=DOMAIN,
help='Domain to ping for rate limit JSON response (default: %s)' % (DOMAIN))
# Turn odd argparse namespace object into a plain dict
return vars(parser.parse_args())
if __name__ == '__main__':
main(_parse_args()['domain'])
| Print rate limits from new JSON response url in a pretty, parsable format | Print rate limits from new JSON response url in a pretty, parsable format
| Python | agpl-3.0 | paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms | python | ## Code Before:
import requests
URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
def main():
resp = requests.get(URL)
if resp.status_code == 200:
print resp.content
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
if __name__ == '__main__':
main()
## Instruction:
Print rate limits from new JSON response url in a pretty, parsable format
## Code After:
import argparse
from datetime import datetime
import requests
DOMAIN = 'http://tutorials.pluralsight.com/'
URL = '/gh_rate_limit'
def main(domain):
response = get_rate_limit(domain)
if response:
pprint(response)
def get_rate_limit(domain=DOMAIN):
"""Get rate limit as dictionary"""
url = '%s%s' % (domain, URL)
resp = requests.get(url)
if resp.status_code == 200:
return resp.json()
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
return {}
def pprint(rate_limit):
"""
Pretty print rate limit dictionary to be easily parsable and readable
across multiple lines
"""
# Ignoring the 'rate' key b/c github API claims this will be removed in
# next major version:
# https://developer.github.com/v3/rate_limit/#deprecation-notice
def print_(name, limits):
date_ = datetime.utcfromtimestamp(limits[name]['reset'])
print '%8s remaining: %4s limit: %4s reset: %s' % (
name,
limits[name]['remaining'],
limits[name]['limit'],
date_.strftime('%d-%m-%Y %H:%M:%S'))
print_('core', rate_limit['resources'])
print_('search', rate_limit['resources'])
#u'resources': {u'core': {u'reset': 1462781427, u'limit': 5000, u'remaining': 4923}, u'search': {u'reset': 1462780271, u'limit': 30, u'remaining': 30}}}
def _parse_args():
"""Parse args and get dictionary back"""
parser = argparse.ArgumentParser(description='Get Github.com rate limit')
parser.add_argument('-d', '--domain', action='store', required=False,
default=DOMAIN,
help='Domain to ping for rate limit JSON response (default: %s)' % (DOMAIN))
# Turn odd argparse namespace object into a plain dict
return vars(parser.parse_args())
if __name__ == '__main__':
main(_parse_args()['domain'])
|
+ import argparse
+ from datetime import datetime
import requests
- URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
? ^^^ -------------
+ DOMAIN = 'http://tutorials.pluralsight.com/'
? ^^^^^^
+ URL = '/gh_rate_limit'
+
- def main():
+ def main(domain):
? ++++++
+ response = get_rate_limit(domain)
+ if response:
+ pprint(response)
+
+
+ def get_rate_limit(domain=DOMAIN):
+ """Get rate limit as dictionary"""
+
+ url = '%s%s' % (domain, URL)
- resp = requests.get(URL)
? ^^^
+ resp = requests.get(url)
? ^^^
+
if resp.status_code == 200:
- print resp.content
+ return resp.json()
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
+ return {}
+
+
+ def pprint(rate_limit):
+ """
+ Pretty print rate limit dictionary to be easily parsable and readable
+ across multiple lines
+ """
+
+ # Ignoring the 'rate' key b/c github API claims this will be removed in
+ # next major version:
+ # https://developer.github.com/v3/rate_limit/#deprecation-notice
+
+ def print_(name, limits):
+ date_ = datetime.utcfromtimestamp(limits[name]['reset'])
+ print '%8s remaining: %4s limit: %4s reset: %s' % (
+ name,
+ limits[name]['remaining'],
+ limits[name]['limit'],
+ date_.strftime('%d-%m-%Y %H:%M:%S'))
+
+ print_('core', rate_limit['resources'])
+ print_('search', rate_limit['resources'])
+
+ #u'resources': {u'core': {u'reset': 1462781427, u'limit': 5000, u'remaining': 4923}, u'search': {u'reset': 1462780271, u'limit': 30, u'remaining': 30}}}
+
+ def _parse_args():
+ """Parse args and get dictionary back"""
+
+ parser = argparse.ArgumentParser(description='Get Github.com rate limit')
+ parser.add_argument('-d', '--domain', action='store', required=False,
+ default=DOMAIN,
+ help='Domain to ping for rate limit JSON response (default: %s)' % (DOMAIN))
+
+ # Turn odd argparse namespace object into a plain dict
+ return vars(parser.parse_args())
if __name__ == '__main__':
- main()
+ main(_parse_args()['domain']) | 60 | 4 | 55 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.