commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 5
4.84k
| subject
stringlengths 15
778
| message
stringlengths 16
6.86k
| lang
stringlengths 1
30
| license
stringclasses 13
values | repos
stringlengths 5
116k
| config
stringlengths 1
30
| content
stringlengths 105
8.72k
|
---|---|---|---|---|---|---|---|---|---|---|---|
273249d28f038c94e3890dd7679f067409970ac5 | xfire-core/src/main/org/codehaus/xfire/handler/EndpointHandler.java | xfire-core/src/main/org/codehaus/xfire/handler/EndpointHandler.java | package org.codehaus.xfire.handler;
import org.codehaus.xfire.MessageContext;
/**
* By virtue of XFire being stream based, a service can not write its
* response until the very end of processing. So a service which needs
* to write response headers but do so first before writing the
* SOAP Body. The writeResponse method tells an Endpoint that it is
* now okay (i.e. there have been no Faults) to write the
* response to the OutputStream (if there is an response to the
* sender at all) or to another endpoint.
* <p>
* If a Service does not wishes to write its response immediately when
* reading the incoming stream, it may do so and not implement the
* <code>writeResponse</code> method. The service must then realize that
* the response Handler pipeline will not be able to outgoing stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface EndpointHandler
extends Handler
{
public void writeResponse(MessageContext context);
}
| package org.codehaus.xfire.handler;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;
/**
* By virtue of XFire being stream based, a service can not write its
* response until the very end of processing. So a service which needs
* to write response headers but do so first before writing the
* SOAP Body. The writeResponse method tells an Endpoint that it is
* now okay (i.e. there have been no Faults) to write the
* response to the OutputStream (if there is an response to the
* sender at all) or to another endpoint.
* <p>
* If a Service does not wishes to write its response immediately when
* reading the incoming stream, it may do so and not implement the
* <code>writeResponse</code> method. The service must then realize that
* the response Handler pipeline will not be able to outgoing stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface EndpointHandler
extends Handler
{
public void writeResponse(MessageContext context) throws XFireFault;
}
| Fix the JavaServiceHandler so the response is written when its supposed to be. | Fix the JavaServiceHandler so the response is written when its
supposed to be.
git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@101 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba
| Java | mit | eduardodaluz/xfire,eduardodaluz/xfire | java | ## Code Before:
package org.codehaus.xfire.handler;
import org.codehaus.xfire.MessageContext;
/**
* By virtue of XFire being stream based, a service can not write its
* response until the very end of processing. So a service which needs
* to write response headers but do so first before writing the
* SOAP Body. The writeResponse method tells an Endpoint that it is
* now okay (i.e. there have been no Faults) to write the
* response to the OutputStream (if there is an response to the
* sender at all) or to another endpoint.
* <p>
* If a Service does not wishes to write its response immediately when
* reading the incoming stream, it may do so and not implement the
* <code>writeResponse</code> method. The service must then realize that
* the response Handler pipeline will not be able to outgoing stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface EndpointHandler
extends Handler
{
public void writeResponse(MessageContext context);
}
## Instruction:
Fix the JavaServiceHandler so the response is written when its
supposed to be.
git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@101 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba
## Code After:
package org.codehaus.xfire.handler;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;
/**
* By virtue of XFire being stream based, a service can not write its
* response until the very end of processing. So a service which needs
* to write response headers but do so first before writing the
* SOAP Body. The writeResponse method tells an Endpoint that it is
* now okay (i.e. there have been no Faults) to write the
* response to the OutputStream (if there is an response to the
* sender at all) or to another endpoint.
* <p>
* If a Service does not wishes to write its response immediately when
* reading the incoming stream, it may do so and not implement the
* <code>writeResponse</code> method. The service must then realize that
* the response Handler pipeline will not be able to outgoing stream.
*
* @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
*/
public interface EndpointHandler
extends Handler
{
public void writeResponse(MessageContext context) throws XFireFault;
}
|
f34a38dfcaae82dc0b2de6cfc27749128a1d79c9 | .github/release-drafter.yml | .github/release-drafter.yml | _extends: .github
tag-template: analysis-model-$NEXT_MINOR_VERSION
| _extends: .github
tag-template: analysis-model-$NEXT_MINOR_VERSION
name-template: Analysis Model $NEXT_PATCH_VERSION
| Add release drafter name template. | Add release drafter name template.
| YAML | mit | jenkinsci/analysis-model,jenkinsci/analysis-model,jenkinsci/analysis-model,jenkinsci/analysis-model | yaml | ## Code Before:
_extends: .github
tag-template: analysis-model-$NEXT_MINOR_VERSION
## Instruction:
Add release drafter name template.
## Code After:
_extends: .github
tag-template: analysis-model-$NEXT_MINOR_VERSION
name-template: Analysis Model $NEXT_PATCH_VERSION
|
3c14f5d0e3912e783b15a1de5468343307a142e9 | src/Command/ContainerAwareCommand.php | src/Command/ContainerAwareCommand.php | <?php
/*
* This file is part of the awurth/silex-user package.
*
* (c) Alexis Wurth <awurth.dev@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AWurth\SilexUser\Command;
use LogicException;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
/**
* Command.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class ContainerAwareCommand extends Command
{
/**
* @var ContainerInterface|null
*/
private $container;
/**
* @return ContainerInterface
*
* @throws LogicException
*/
protected function getContainer()
{
if (null === $this->container) {
$application = $this->getApplication();
if (null === $application) {
throw new LogicException('The container cannot be retrieved as the application instance is not yet set.');
}
$this->container = $application->getKernel()->getContainer();
}
return $this->container;
}
/**
* Sets the container.
*
* @param ContainerInterface|null $container A ContainerInterface instance or null
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}
| <?php
/*
* This file is part of the awurth/silex-user package.
*
* (c) Alexis Wurth <awurth.dev@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AWurth\SilexUser\Command;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
/**
* Command.
*
* @author Alexis Wurth <awurth.dev@gmail.com>
*/
abstract class ContainerAwareCommand extends Command
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* Constructor.
*
* @param ContainerInterface $container
* @param string|null $name
*/
public function __construct(ContainerInterface $container, $name = null)
{
parent::__construct($name);
$this->container = $container;
}
/**
* Gets the container.
*
* @return ContainerInterface
*/
public function getContainer()
{
return $this->container;
}
/**
* Sets the container.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container)
{
$this->container = $container;
}
}
| Set the container in the constructor | Set the container in the constructor
| PHP | mit | awurth/silex-user,awurth/silex-user | php | ## Code Before:
<?php
/*
* This file is part of the awurth/silex-user package.
*
* (c) Alexis Wurth <awurth.dev@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AWurth\SilexUser\Command;
use LogicException;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
/**
* Command.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class ContainerAwareCommand extends Command
{
/**
* @var ContainerInterface|null
*/
private $container;
/**
* @return ContainerInterface
*
* @throws LogicException
*/
protected function getContainer()
{
if (null === $this->container) {
$application = $this->getApplication();
if (null === $application) {
throw new LogicException('The container cannot be retrieved as the application instance is not yet set.');
}
$this->container = $application->getKernel()->getContainer();
}
return $this->container;
}
/**
* Sets the container.
*
* @param ContainerInterface|null $container A ContainerInterface instance or null
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}
## Instruction:
Set the container in the constructor
## Code After:
<?php
/*
* This file is part of the awurth/silex-user package.
*
* (c) Alexis Wurth <awurth.dev@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AWurth\SilexUser\Command;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
/**
* Command.
*
* @author Alexis Wurth <awurth.dev@gmail.com>
*/
abstract class ContainerAwareCommand extends Command
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* Constructor.
*
* @param ContainerInterface $container
* @param string|null $name
*/
public function __construct(ContainerInterface $container, $name = null)
{
parent::__construct($name);
$this->container = $container;
}
/**
* Gets the container.
*
* @return ContainerInterface
*/
public function getContainer()
{
return $this->container;
}
/**
* Sets the container.
*
* @param ContainerInterface $container
*/
public function setContainer(ContainerInterface $container)
{
$this->container = $container;
}
}
|
c077ea76ba62f3fff54e12715e64f188714e3a3f | README.md | README.md | A simple one window WatchApp, written in C.
| A simple one window WatchApp, written in C.
![CloudPebble emulator screenshot](https://cloud.githubusercontent.com/assets/816651/10659817/99d05eda-7857-11e5-8423-d1c7bcef6d98.png)
| Add screenshot from the CloudPebble emulator. | Add screenshot from the CloudPebble emulator. | Markdown | mit | tcpiplab/PebbleTrapped,tcpiplab/PebbleTrapped | markdown | ## Code Before:
A simple one window WatchApp, written in C.
## Instruction:
Add screenshot from the CloudPebble emulator.
## Code After:
A simple one window WatchApp, written in C.
![CloudPebble emulator screenshot](https://cloud.githubusercontent.com/assets/816651/10659817/99d05eda-7857-11e5-8423-d1c7bcef6d98.png)
|
e120a1941b272c666c946814592913ca601d4058 | sbt-runner/src/main/scala/com.olegych.scastie.sbt/FormatActor.scala | sbt-runner/src/main/scala/com.olegych.scastie.sbt/FormatActor.scala | package com.olegych.scastie
package sbt
import akka.actor.Actor
import com.olegych.scastie.api.{FormatRequest, FormatResponse, ScalaTarget}
import org.scalafmt.config.ScalafmtRunner.Dialect
import org.scalafmt.config.{ScalafmtConfig, ScalafmtRunner}
import org.scalafmt.{Formatted, Scalafmt}
import org.slf4j.LoggerFactory
class FormatActor() extends Actor {
private val log = LoggerFactory.getLogger(getClass)
private def format(code: String, isWorksheetMode: Boolean, scalaTarget: ScalaTarget): Either[String, String] = {
log.info(s"format (isWorksheetMode: $isWorksheetMode)")
log.info(code)
val config = scalaTarget match {
case scalaTarget if isWorksheetMode && scalaTarget.hasWorksheetMode =>
ScalafmtConfig.default.copy(runner = ScalafmtRunner.sbt)
case dotty: ScalaTarget.Scala3 =>
ScalafmtConfig.default.withDialect(scala.meta.dialects.Scala3)
case _ =>
ScalafmtConfig.default
}
Scalafmt.format(code, style = config) match {
case Formatted.Success(formattedCode) => Right(formattedCode)
case Formatted.Failure(failure) =>
Left(failure.toString)
}
}
override def receive: Receive = {
case FormatRequest(code, isWorksheetMode, scalaTarget) =>
sender() ! FormatResponse(format(code, isWorksheetMode, scalaTarget))
}
}
| package com.olegych.scastie
package sbt
import akka.actor.Actor
import com.olegych.scastie.api.{FormatRequest, FormatResponse, ScalaTarget}
import org.scalafmt.config.ScalafmtRunner.Dialect
import org.scalafmt.config.{ScalafmtConfig, ScalafmtRunner}
import org.scalafmt.{Formatted, Scalafmt}
import org.slf4j.LoggerFactory
class FormatActor() extends Actor {
private val log = LoggerFactory.getLogger(getClass)
private def format(code: String, isWorksheetMode: Boolean, scalaTarget: ScalaTarget): Either[String, String] = {
log.info(s"format (isWorksheetMode: $isWorksheetMode)")
log.info(code)
val config: ScalafmtConfig = {
val withDialect = scalaTarget match {
case dotty: ScalaTarget.Scala3 => ScalafmtConfig.default.withDialect(scala.meta.dialects.Scala3)
case _ => ScalafmtConfig.default
}
if (isWorksheetMode && scalaTarget.hasWorksheetMode)
withDialect.copy(runner = ScalafmtRunner.sbt.copy(dialect=withDialect.runner.dialect))
else withDialect
}
Scalafmt.format(code, style = config) match {
case Formatted.Success(formattedCode) => Right(formattedCode)
case Formatted.Failure(failure) => Left(failure.toString)
}
}
override def receive: Receive = {
case FormatRequest(code, isWorksheetMode, scalaTarget) =>
sender() ! FormatResponse(format(code, isWorksheetMode, scalaTarget))
}
}
| Support formatting of Scala3 worksheet | Support formatting of Scala3 worksheet
| Scala | apache-2.0 | scalacenter/scastie,scalacenter/scastie,scalacenter/scastie | scala | ## Code Before:
package com.olegych.scastie
package sbt
import akka.actor.Actor
import com.olegych.scastie.api.{FormatRequest, FormatResponse, ScalaTarget}
import org.scalafmt.config.ScalafmtRunner.Dialect
import org.scalafmt.config.{ScalafmtConfig, ScalafmtRunner}
import org.scalafmt.{Formatted, Scalafmt}
import org.slf4j.LoggerFactory
class FormatActor() extends Actor {
private val log = LoggerFactory.getLogger(getClass)
private def format(code: String, isWorksheetMode: Boolean, scalaTarget: ScalaTarget): Either[String, String] = {
log.info(s"format (isWorksheetMode: $isWorksheetMode)")
log.info(code)
val config = scalaTarget match {
case scalaTarget if isWorksheetMode && scalaTarget.hasWorksheetMode =>
ScalafmtConfig.default.copy(runner = ScalafmtRunner.sbt)
case dotty: ScalaTarget.Scala3 =>
ScalafmtConfig.default.withDialect(scala.meta.dialects.Scala3)
case _ =>
ScalafmtConfig.default
}
Scalafmt.format(code, style = config) match {
case Formatted.Success(formattedCode) => Right(formattedCode)
case Formatted.Failure(failure) =>
Left(failure.toString)
}
}
override def receive: Receive = {
case FormatRequest(code, isWorksheetMode, scalaTarget) =>
sender() ! FormatResponse(format(code, isWorksheetMode, scalaTarget))
}
}
## Instruction:
Support formatting of Scala3 worksheet
## Code After:
package com.olegych.scastie
package sbt
import akka.actor.Actor
import com.olegych.scastie.api.{FormatRequest, FormatResponse, ScalaTarget}
import org.scalafmt.config.ScalafmtRunner.Dialect
import org.scalafmt.config.{ScalafmtConfig, ScalafmtRunner}
import org.scalafmt.{Formatted, Scalafmt}
import org.slf4j.LoggerFactory
class FormatActor() extends Actor {
private val log = LoggerFactory.getLogger(getClass)
private def format(code: String, isWorksheetMode: Boolean, scalaTarget: ScalaTarget): Either[String, String] = {
log.info(s"format (isWorksheetMode: $isWorksheetMode)")
log.info(code)
val config: ScalafmtConfig = {
val withDialect = scalaTarget match {
case dotty: ScalaTarget.Scala3 => ScalafmtConfig.default.withDialect(scala.meta.dialects.Scala3)
case _ => ScalafmtConfig.default
}
if (isWorksheetMode && scalaTarget.hasWorksheetMode)
withDialect.copy(runner = ScalafmtRunner.sbt.copy(dialect=withDialect.runner.dialect))
else withDialect
}
Scalafmt.format(code, style = config) match {
case Formatted.Success(formattedCode) => Right(formattedCode)
case Formatted.Failure(failure) => Left(failure.toString)
}
}
override def receive: Receive = {
case FormatRequest(code, isWorksheetMode, scalaTarget) =>
sender() ! FormatResponse(format(code, isWorksheetMode, scalaTarget))
}
}
|
f23509bf6026b969c7317fb51adc1910083bce36 | src/styles/partials/AdminMenu.scss | src/styles/partials/AdminMenu.scss | @import '../Constants';
.AdminMenu__mainItem {
font-weight: bold !important;
}
.AdminMenu__item {
padding-left: 16px !important;
}
@media only screen and (min-width: $screen-min-sm) {
.AdminMenu__show-xs {
display: none !important;
}
}
@media only screen and (max-width: $screen-max-xs) {
.AdminMenu__hide-xs {
display: none !important;
}
}
| @import '../Constants';
.AdminMenu__mainItem {
}
.AdminMenu__item {
padding-left: 16px !important;
}
@media only screen and (min-width: $screen-min-sm) {
.AdminMenu__show-xs {
display: none !important;
}
}
@media only screen and (max-width: $screen-max-xs) {
.AdminMenu__hide-xs {
display: none !important;
}
}
| Remove bold on main items in menu | Remove bold on main items in menu
| SCSS | mit | ungdev/flux2-client,ungdev/flux2-client,ungdev/flux2-client | scss | ## Code Before:
@import '../Constants';
.AdminMenu__mainItem {
font-weight: bold !important;
}
.AdminMenu__item {
padding-left: 16px !important;
}
@media only screen and (min-width: $screen-min-sm) {
.AdminMenu__show-xs {
display: none !important;
}
}
@media only screen and (max-width: $screen-max-xs) {
.AdminMenu__hide-xs {
display: none !important;
}
}
## Instruction:
Remove bold on main items in menu
## Code After:
@import '../Constants';
.AdminMenu__mainItem {
}
.AdminMenu__item {
padding-left: 16px !important;
}
@media only screen and (min-width: $screen-min-sm) {
.AdminMenu__show-xs {
display: none !important;
}
}
@media only screen and (max-width: $screen-max-xs) {
.AdminMenu__hide-xs {
display: none !important;
}
}
|
56f5cc3ece93db4a773fd444583e485acf1cc793 | app/_includes/config.html | app/_includes/config.html | <script id="config_tmpl" type="text/template">
<div id="config">
<div class="wrapper">
<a class="configBtn" href="#" title="Close" role="button">×</a>
<h3>Configure site options</h3>
<section>
<h4>Change theme</h4>
<ul id="styleSwitcher">
<li><a class="on" href="#" id="standard"><i class="icon-check-empty"></i> Standard</a></li>
<li><a href="#" id="geocities"><i class="icon-check-empty"></i> Geocities</a></li>
</ul>
</section>
<section>
<h4>Modify link behaviour</h4>
<ul id="linkSwitcher">
<li><a href="#"><i class="icon-check-empty"></i> Open external links in a new tab</a></li>
</ul>
</section>
</div>
</div>
</script> | <script id="config_tmpl" type="text/template">
<div id="config">
<div class="wrapper">
<a class="configBtn" href="#" title="Close" role="button">×</a>
<h3>Configure site options</h3>
<section>
<h4>Change theme</h4>
<ul id="styleSwitcher">
<li><a class="on" href="#" id="standard"><i class="icon-check-empty"></i> Standard</a></li>
<li><a href="#" id="geocities"><i class="icon-check-empty"></i> Geocities</a></li>
</ul>
</section>
<section>
<h4>Modify link behaviour</h4>
<ul id="linkSwitcher">
<li><a href="#" class="on"><i class="icon-check-empty"></i> Open external links in a new tab</a></li>
</ul>
</section>
</div>
</div>
</script> | Make external link toggler show 'on' by default | Make external link toggler show 'on' by default
| HTML | mit | richardwestenra/richardwestenra-dev,richardwestenra/richardwestenra-dev,richardwestenra/richardwestenra-dev | html | ## Code Before:
<script id="config_tmpl" type="text/template">
<div id="config">
<div class="wrapper">
<a class="configBtn" href="#" title="Close" role="button">×</a>
<h3>Configure site options</h3>
<section>
<h4>Change theme</h4>
<ul id="styleSwitcher">
<li><a class="on" href="#" id="standard"><i class="icon-check-empty"></i> Standard</a></li>
<li><a href="#" id="geocities"><i class="icon-check-empty"></i> Geocities</a></li>
</ul>
</section>
<section>
<h4>Modify link behaviour</h4>
<ul id="linkSwitcher">
<li><a href="#"><i class="icon-check-empty"></i> Open external links in a new tab</a></li>
</ul>
</section>
</div>
</div>
</script>
## Instruction:
Make external link toggler show 'on' by default
## Code After:
<script id="config_tmpl" type="text/template">
<div id="config">
<div class="wrapper">
<a class="configBtn" href="#" title="Close" role="button">×</a>
<h3>Configure site options</h3>
<section>
<h4>Change theme</h4>
<ul id="styleSwitcher">
<li><a class="on" href="#" id="standard"><i class="icon-check-empty"></i> Standard</a></li>
<li><a href="#" id="geocities"><i class="icon-check-empty"></i> Geocities</a></li>
</ul>
</section>
<section>
<h4>Modify link behaviour</h4>
<ul id="linkSwitcher">
<li><a href="#" class="on"><i class="icon-check-empty"></i> Open external links in a new tab</a></li>
</ul>
</section>
</div>
</div>
</script> |
97fbcc7fd794b8c3fbabbce95fe4c255b0ba6361 | coin-selfservice-war/src/main/java/nl/surfnet/coin/selfservice/api/rest/UsersController.java | coin-selfservice-war/src/main/java/nl/surfnet/coin/selfservice/api/rest/UsersController.java | package nl.surfnet.coin.selfservice.api.rest;
import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HttpServletBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;
@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {
@RequestMapping("/me")
public ResponseEntity<RestResponse> me(HttpServletRequest request) {
return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
}
@RequestMapping("/me/switch-to-idp/{switchToIdp}")
public ResponseEntity currentIdp(@PathVariable("switchToIdp") String switchToIdp, HttpServletResponse response) {
SpringSecurity.setCurrentIdp(switchToIdp);
response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
return new ResponseEntity(HttpStatus.OK);
}
}
| package nl.surfnet.coin.selfservice.api.rest;
import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.owasp.esapi.waf.internal.InterceptingHTTPServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.HttpServletBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;
@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {
@RequestMapping("/me")
public ResponseEntity<RestResponse> me(HttpServletRequest request) {
return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
}
@RequestMapping("/me/switch-to-idp/**")
public ResponseEntity currentIdp(HttpServletResponse response, HttpServletRequest request) {
String path = (String)request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String switchToIdp = path.replaceAll("/users/me/switch-to-idp/", "");
SpringSecurity.setCurrentIdp(switchToIdp);
response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
return new ResponseEntity(HttpStatus.OK);
}
}
| Fix issue with the `switch-to-idp` controller mapping | Fix issue with the `switch-to-idp` controller mapping
Since the switch-to-idp path variable can be an url, including forward
slashes, it doesn’t match the specified `RequestMapping`. So this
changes the `RequestMapping` to match the complete path, including all
slashes. | Java | apache-2.0 | OpenConext/OpenConext-dashboard,OpenConext/OpenConext-dashboard,OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard,OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard | java | ## Code Before:
package nl.surfnet.coin.selfservice.api.rest;
import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HttpServletBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;
@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {
@RequestMapping("/me")
public ResponseEntity<RestResponse> me(HttpServletRequest request) {
return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
}
@RequestMapping("/me/switch-to-idp/{switchToIdp}")
public ResponseEntity currentIdp(@PathVariable("switchToIdp") String switchToIdp, HttpServletResponse response) {
SpringSecurity.setCurrentIdp(switchToIdp);
response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
return new ResponseEntity(HttpStatus.OK);
}
}
## Instruction:
Fix issue with the `switch-to-idp` controller mapping
Since the switch-to-idp path variable can be an url, including forward
slashes, it doesn’t match the specified `RequestMapping`. So this
changes the `RequestMapping` to match the complete path, including all
slashes.
## Code After:
package nl.surfnet.coin.selfservice.api.rest;
import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.owasp.esapi.waf.internal.InterceptingHTTPServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.HttpServletBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;
@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {
@RequestMapping("/me")
public ResponseEntity<RestResponse> me(HttpServletRequest request) {
return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
}
@RequestMapping("/me/switch-to-idp/**")
public ResponseEntity currentIdp(HttpServletResponse response, HttpServletRequest request) {
String path = (String)request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String switchToIdp = path.replaceAll("/users/me/switch-to-idp/", "");
SpringSecurity.setCurrentIdp(switchToIdp);
response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
return new ResponseEntity(HttpStatus.OK);
}
}
|
54edca05e14abc563c9128809f0221e586e557dc | setup-makefiles.sh | setup-makefiles.sh |
set -e
VENDOR=lge
DEVICE=hammerhead
# Load extractutils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
CM_ROOT="$MY_DIR"/../../..
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER"
exit 1
fi
. "$HELPER"
# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
# Copyright headers and guards
write_headers
# The standard blobs
write_makefiles "$MY_DIR"/proprietary-blobs.txt
# Done
write_footers
|
set -e
INITIAL_COPYRIGHT_YEAR=2013
VENDOR=lge
DEVICE=hammerhead
# Load extractutils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
CM_ROOT="$MY_DIR"/../../..
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER"
exit 1
fi
. "$HELPER"
# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
# Copyright headers and guards
write_headers
# The standard blobs
write_makefiles "$MY_DIR"/proprietary-blobs.txt
# Done
write_footers
| Set initial copyright year for extract script | hammerhead: Set initial copyright year for extract script
Use new variable introduced in I6895b5b69bc7ba399042ac3c29e17f3209d15f1b
Change-Id: Ic6d9f6b1316c10aabdf89d6e8e972e32e2ff0039
| Shell | apache-2.0 | maruos/android_device_lge_hammerhead,maruos/android_device_lge_hammerhead,maruos/android_device_lge_hammerhead,maruos/android_device_lge_hammerhead | shell | ## Code Before:
set -e
VENDOR=lge
DEVICE=hammerhead
# Load extractutils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
CM_ROOT="$MY_DIR"/../../..
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER"
exit 1
fi
. "$HELPER"
# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
# Copyright headers and guards
write_headers
# The standard blobs
write_makefiles "$MY_DIR"/proprietary-blobs.txt
# Done
write_footers
## Instruction:
hammerhead: Set initial copyright year for extract script
Use new variable introduced in I6895b5b69bc7ba399042ac3c29e17f3209d15f1b
Change-Id: Ic6d9f6b1316c10aabdf89d6e8e972e32e2ff0039
## Code After:
set -e
INITIAL_COPYRIGHT_YEAR=2013
VENDOR=lge
DEVICE=hammerhead
# Load extractutils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
CM_ROOT="$MY_DIR"/../../..
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER"
exit 1
fi
. "$HELPER"
# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
# Copyright headers and guards
write_headers
# The standard blobs
write_makefiles "$MY_DIR"/proprietary-blobs.txt
# Done
write_footers
|
80d0d6d4110036c346c5c45daf8ec2ef221fd6ce | scripts/install_doxygen.sh | scripts/install_doxygen.sh |
set -ev
# Fetch and build updated version of Doxygen from source.
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.src.tar.gz
tar -xzvf doxygen-1.8.11.src.tar.gz
cd doxygen-1.8.11 && ./configure --prefix=$HOME/doxygen && make && make install
|
set -ev
# Fetch and build updated version of Doxygen from source.
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.src.tar.gz
tar -xzvf doxygen-1.8.11.src.tar.gz
cd doxygen-1.8.11
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
make install | Fix commands to install Doxygen from source for Travis setup. | Fix commands to install Doxygen from source for Travis setup.
| Shell | mit | ennehekma/enne-stage,abhi-agrawal/ATOM_ADR,abhi-agrawal/ATOM_ADR,ennehekma/enne-stage,kartikkumar/cpp-project,kartikkumar/cppbase,kartikkumar/cpp-project,abhi-agrawal/TestAtomProject,ennehekma/enne-stage,abhi-agrawal/TestAtomProject | shell | ## Code Before:
set -ev
# Fetch and build updated version of Doxygen from source.
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.src.tar.gz
tar -xzvf doxygen-1.8.11.src.tar.gz
cd doxygen-1.8.11 && ./configure --prefix=$HOME/doxygen && make && make install
## Instruction:
Fix commands to install Doxygen from source for Travis setup.
## Code After:
set -ev
# Fetch and build updated version of Doxygen from source.
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.11.src.tar.gz
tar -xzvf doxygen-1.8.11.src.tar.gz
cd doxygen-1.8.11
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
make install |
f85ff86c047e4ada2fdf5168bf946f1186716320 | bin/pill.bat | bin/pill.bat | @echo off
echo "Not yet"
| @echo off
IF "%~1"=="" (
goto usage
) ELSE IF "%~1"=="init" (
mkdir _pill\bin
set CONDA_BIN_PATH="conda info --root"
set CONDA_DEFAULT_ENV
) ELSE IF "%~1"=="in" (
echo "Ready to go in"
) ELSE IF "%~1" == "out" (
echo "Ready to go out"
) ELSE (
echo "error"
goto usage
exit /b 1
)
exit /b
:usage
echo usage: pill [COMMAND]
echo.
echo SYNOPSIS
echo Create a local python and conda environment in the current directory.
echo When activated all the libraries will be installed and imported from
echo the '_pill' directory in the root of your project.
echo.
echo USAGE
echo Create and run temporal/local environments.
echo.
echo $ pill init
echo $ source pill in
echo $ source pill out
echo.
echo COMMANDS
echo init Creates the .pill directory and create links.
echo in Modifies CONDA_DEFAULT_ENV and PATH to use
echo the .pill directory and sets the PILL_NAME variable.
echo out Restores the previous CONDA_DEFAULT_ENV and PATH. Also
echo unsets PILL_NAME.
echo.
exit /b
:create_symlinks
exit /b
:backup
set PILL_OLD_PATH=%PATH%
set PILL_OLD_CONDA_DEFAULT_ENV=%CONDA_DEFAULT_ENV%
set PILL_PROMPT=%PROMPT%
exit /b
:remove_current_conda
set CONDA_BIN_PATH="conda info --root"
set CONDA_BIN_PATH="%CONDA_BIN_PATH%\bin"
PATH=:$PATH:
PATH=${PATH//:$CONDA_BIN_PATH:/:}
exit /b
| Switch statement in batch file | Switch statement in batch file
| Batchfile | mit | malev/pill | batchfile | ## Code Before:
@echo off
echo "Not yet"
## Instruction:
Switch statement in batch file
## Code After:
@echo off
IF "%~1"=="" (
goto usage
) ELSE IF "%~1"=="init" (
mkdir _pill\bin
set CONDA_BIN_PATH="conda info --root"
set CONDA_DEFAULT_ENV
) ELSE IF "%~1"=="in" (
echo "Ready to go in"
) ELSE IF "%~1" == "out" (
echo "Ready to go out"
) ELSE (
echo "error"
goto usage
exit /b 1
)
exit /b
:usage
echo usage: pill [COMMAND]
echo.
echo SYNOPSIS
echo Create a local python and conda environment in the current directory.
echo When activated all the libraries will be installed and imported from
echo the '_pill' directory in the root of your project.
echo.
echo USAGE
echo Create and run temporal/local environments.
echo.
echo $ pill init
echo $ source pill in
echo $ source pill out
echo.
echo COMMANDS
echo init Creates the .pill directory and create links.
echo in Modifies CONDA_DEFAULT_ENV and PATH to use
echo the .pill directory and sets the PILL_NAME variable.
echo out Restores the previous CONDA_DEFAULT_ENV and PATH. Also
echo unsets PILL_NAME.
echo.
exit /b
:create_symlinks
exit /b
:backup
set PILL_OLD_PATH=%PATH%
set PILL_OLD_CONDA_DEFAULT_ENV=%CONDA_DEFAULT_ENV%
set PILL_PROMPT=%PROMPT%
exit /b
:remove_current_conda
set CONDA_BIN_PATH="conda info --root"
set CONDA_BIN_PATH="%CONDA_BIN_PATH%\bin"
PATH=:$PATH:
PATH=${PATH//:$CONDA_BIN_PATH:/:}
exit /b
|
d9e198c2199dd8d5de6f6f643862abb6d6e8dc77 | packages.txt | packages.txt | autoconf
automake
brew-cask
cairo
cask
ccat
cmake
cscope
ctags
czmq
direnv
docker
emacs
fontconfig
fontforge
fpp
freetype
fzf
gdbm
gettext
git
gitsh
glib
go
gobject-introspection
harfbuzz
htop-osx
hub
icu4c
jmeter
jpeg
libevent
libffi
libgpg-error
libksba
libpng
libsodium
libtiff
libtool
libyaml
liftoff
mercurial
mysql
nvm
openssl
pango
pcre
pick
pixman
pkg-config
rbenv
rcm
readline
reattach-to-user-namespace
redis
ruby-build
the_silver_searcher
tmux
urlview
vim
xcproj
xz
zeromq
| autoconf
automake
cairo
cask
ccat
cmake
cscope
ctags
czmq
direnv
docker
emacs
fontconfig
fontforge
fpp
freetype
fzf
gdbm
gettext
git
gitsh
glib
go
gobject-introspection
harfbuzz
htop-osx
hub
icu4c
jmeter
jpeg
libevent
libffi
libgpg-error
libksba
libpng
libsodium
libtiff
libtool
libyaml
liftoff
mercurial
mysql
nvm
openssl
pango
pcre
pick
pixman
pkg-config
rbenv
rcm
readline
reattach-to-user-namespace
redis
ruby-build
the_silver_searcher
tmux
urlview
vim
xcproj
xz
zeromq
| Remove brew-cask which would lead to an error | Remove brew-cask which would lead to an error
Why:
*
This change addresses the need by:
*
| Text | mit | YepengFan/dotfiles,YepengFan/dotfiles | text | ## Code Before:
autoconf
automake
brew-cask
cairo
cask
ccat
cmake
cscope
ctags
czmq
direnv
docker
emacs
fontconfig
fontforge
fpp
freetype
fzf
gdbm
gettext
git
gitsh
glib
go
gobject-introspection
harfbuzz
htop-osx
hub
icu4c
jmeter
jpeg
libevent
libffi
libgpg-error
libksba
libpng
libsodium
libtiff
libtool
libyaml
liftoff
mercurial
mysql
nvm
openssl
pango
pcre
pick
pixman
pkg-config
rbenv
rcm
readline
reattach-to-user-namespace
redis
ruby-build
the_silver_searcher
tmux
urlview
vim
xcproj
xz
zeromq
## Instruction:
Remove brew-cask which would lead to an error
Why:
*
This change addresses the need by:
*
## Code After:
autoconf
automake
cairo
cask
ccat
cmake
cscope
ctags
czmq
direnv
docker
emacs
fontconfig
fontforge
fpp
freetype
fzf
gdbm
gettext
git
gitsh
glib
go
gobject-introspection
harfbuzz
htop-osx
hub
icu4c
jmeter
jpeg
libevent
libffi
libgpg-error
libksba
libpng
libsodium
libtiff
libtool
libyaml
liftoff
mercurial
mysql
nvm
openssl
pango
pcre
pick
pixman
pkg-config
rbenv
rcm
readline
reattach-to-user-namespace
redis
ruby-build
the_silver_searcher
tmux
urlview
vim
xcproj
xz
zeromq
|
34f96c2f25556024f9095ddd1536654a23ac632f | json/test_rapid.cpp | json/test_rapid.cpp |
using namespace std;
void read_file(string filename, stringstream &buffer){
ifstream f(filename.c_str());
if (f)
{
buffer << f.rdbuf();
f.close();
}
}
using namespace rapidjson;
int main() {
std::stringstream ss;
read_file("./1.json", ss);
string text = ss.str();
Document jobj; jobj.Parse(text.c_str());
const Value &coordinates = jobj["coordinates"];
int len = coordinates.Size();
double x = 0, y = 0, z = 0;
for (SizeType i = 0; i < len; i++) {
const Value &coord = coordinates[i];
x += coord["x"].GetDouble();
y += coord["y"].GetDouble();
z += coord["z"].GetDouble();
}
std::cout << x / len << std::endl;
std::cout << y / len << std::endl;
std::cout << z / len << std::endl;
return 0;
}
|
using namespace std;
using namespace rapidjson;
int main() {
FILE* fp = std::fopen("./1.json", "r");
char buffer[65536];
FileReadStream frs(fp, buffer, sizeof(buffer));
Document jobj;
jobj.ParseStream(frs);
const Value &coordinates = jobj["coordinates"];
int len = coordinates.Size();
double x = 0, y = 0, z = 0;
for (SizeType i = 0; i < len; i++) {
const Value &coord = coordinates[i];
x += coord["x"].GetDouble();
y += coord["y"].GetDouble();
z += coord["z"].GetDouble();
}
std::cout << x / len << std::endl;
std::cout << y / len << std::endl;
std::cout << z / len << std::endl;
fclose(fp);
return 0;
}
| Use FileReadStream instead of multiple conversions. | Use FileReadStream instead of multiple conversions.
Doubles timing and reduce memory usage.
| C++ | mit | kostya/benchmarks,chalucha/benchmarks,erickt/benchmarks,erickt/benchmarks,kostya/benchmarks,erickt/benchmarks,kostya/benchmarks,chalucha/benchmarks,erickt/benchmarks,chalucha/benchmarks,chalucha/benchmarks,erickt/benchmarks,erickt/benchmarks,erickt/benchmarks,erickt/benchmarks,chalucha/benchmarks,kostya/benchmarks,chalucha/benchmarks,erickt/benchmarks,erickt/benchmarks,chalucha/benchmarks,chalucha/benchmarks,kostya/benchmarks,kostya/benchmarks,chalucha/benchmarks,erickt/benchmarks,kostya/benchmarks,kostya/benchmarks,chalucha/benchmarks,kostya/benchmarks,chalucha/benchmarks,kostya/benchmarks,erickt/benchmarks,kostya/benchmarks,chalucha/benchmarks,kostya/benchmarks,kostya/benchmarks,kostya/benchmarks | c++ | ## Code Before:
using namespace std;
void read_file(string filename, stringstream &buffer){
ifstream f(filename.c_str());
if (f)
{
buffer << f.rdbuf();
f.close();
}
}
using namespace rapidjson;
int main() {
std::stringstream ss;
read_file("./1.json", ss);
string text = ss.str();
Document jobj; jobj.Parse(text.c_str());
const Value &coordinates = jobj["coordinates"];
int len = coordinates.Size();
double x = 0, y = 0, z = 0;
for (SizeType i = 0; i < len; i++) {
const Value &coord = coordinates[i];
x += coord["x"].GetDouble();
y += coord["y"].GetDouble();
z += coord["z"].GetDouble();
}
std::cout << x / len << std::endl;
std::cout << y / len << std::endl;
std::cout << z / len << std::endl;
return 0;
}
## Instruction:
Use FileReadStream instead of multiple conversions.
Doubles timing and reduce memory usage.
## Code After:
using namespace std;
using namespace rapidjson;
int main() {
FILE* fp = std::fopen("./1.json", "r");
char buffer[65536];
FileReadStream frs(fp, buffer, sizeof(buffer));
Document jobj;
jobj.ParseStream(frs);
const Value &coordinates = jobj["coordinates"];
int len = coordinates.Size();
double x = 0, y = 0, z = 0;
for (SizeType i = 0; i < len; i++) {
const Value &coord = coordinates[i];
x += coord["x"].GetDouble();
y += coord["y"].GetDouble();
z += coord["z"].GetDouble();
}
std::cout << x / len << std::endl;
std::cout << y / len << std::endl;
std::cout << z / len << std::endl;
fclose(fp);
return 0;
}
|
d8299f295a5cdfdcfa10ca305695519a557310c3 | README.md | README.md |
Tinycsockets is a thin cross-platform socket library written in C. It focuses on minimal a minimal
footprint and simple usage. See the example folder for information on how to use it.
## MFAQ (Made up Frequently Asked Questions)
- How do I contribute?
You can create a merge-request at gitlan.com. Please note that we use semi-linear history.
- Why C and not *random fancy language*
The focus is cross-platform, hardware and OS. Almost all platforms and OS:s have a C-compiler. Many
scripting language also supports bind to a C ABI.
- Does it support *random fancy OS*
No, but please make an MR.
## FAQ
- Can I use this under license X?
No, but there is probably no need for that. This project uses the MIT license, which is very
permissive license. You can even sell this code if you want. The unwillingness of relicensing is
of practical reasons, but also because MIT gives us the authors a good liability protection.
| Tinycsockets
============
Tinycsockets is a thin cross-platform socket library written in C. It focuses on a minimal
footprint and on simple usage.
Currently support:
- Windows
Usage
------------
```C
#include <tinycsocket.h>
TinyCSocketCtx* socketCtx = NULL;
tinycsocket_create_socket(&socketCtx);
tinycsocket_connect(socketCtx, "localhost", "1212");
const char msg[] = "hello world";
tinycsocket_send_data(socketCtx, msg, sizeof(msg));
tinycsocket_close_socket(&socketCtx);
tinycsocket_free();
```
See the example folder for information of how to use tinycsockets.
MFAQ (Made up Frequently Asked Questions)
------------
- How do I contribute?
- You can create a merge-request at gitlab.com/dosshell/tinycsockets. Please note that we use
semi-linear history.
- Why C and not \**random fancy language*\* ?
- The focus is cross-platform, hardware and OS. Almost all platforms and OS:s have a C-compiler.
Many scripting language also supports bind to a C ABI.
- Does it support \**random fancy OS*\* ?
- No, but please make an MR.
- Can I use this under license *X ?
- No, but there is probably no need for that. This project uses the MIT license, which is very
permissive license. You can even sell this code if you want. The unwillingness of relicensing is
of practical reasons, but also because MIT gives us the authors a good liability protection.
| Fix layout and basic readme info | Fix layout and basic readme info
| Markdown | mit | dosshell/tinycsockets,dosshell/tinycsockets,dosshell/tinycsockets | markdown | ## Code Before:
Tinycsockets is a thin cross-platform socket library written in C. It focuses on minimal a minimal
footprint and simple usage. See the example folder for information on how to use it.
## MFAQ (Made up Frequently Asked Questions)
- How do I contribute?
You can create a merge-request at gitlan.com. Please note that we use semi-linear history.
- Why C and not *random fancy language*
The focus is cross-platform, hardware and OS. Almost all platforms and OS:s have a C-compiler. Many
scripting language also supports bind to a C ABI.
- Does it support *random fancy OS*
No, but please make an MR.
## FAQ
- Can I use this under license X?
No, but there is probably no need for that. This project uses the MIT license, which is very
permissive license. You can even sell this code if you want. The unwillingness of relicensing is
of practical reasons, but also because MIT gives us the authors a good liability protection.
## Instruction:
Fix layout and basic readme info
## Code After:
Tinycsockets
============
Tinycsockets is a thin cross-platform socket library written in C. It focuses on a minimal
footprint and on simple usage.
Currently support:
- Windows
Usage
------------
```C
#include <tinycsocket.h>
TinyCSocketCtx* socketCtx = NULL;
tinycsocket_create_socket(&socketCtx);
tinycsocket_connect(socketCtx, "localhost", "1212");
const char msg[] = "hello world";
tinycsocket_send_data(socketCtx, msg, sizeof(msg));
tinycsocket_close_socket(&socketCtx);
tinycsocket_free();
```
See the example folder for information of how to use tinycsockets.
MFAQ (Made up Frequently Asked Questions)
------------
- How do I contribute?
- You can create a merge-request at gitlab.com/dosshell/tinycsockets. Please note that we use
semi-linear history.
- Why C and not \**random fancy language*\* ?
- The focus is cross-platform, hardware and OS. Almost all platforms and OS:s have a C-compiler.
Many scripting language also supports bind to a C ABI.
- Does it support \**random fancy OS*\* ?
- No, but please make an MR.
- Can I use this under license *X ?
- No, but there is probably no need for that. This project uses the MIT license, which is very
permissive license. You can even sell this code if you want. The unwillingness of relicensing is
of practical reasons, but also because MIT gives us the authors a good liability protection.
|
2fd30735d9c678ab81d812b29a95bd1780ed7324 | stylesheets/_mixin.media-queries.scss | stylesheets/_mixin.media-queries.scss | @mixin respond-min($width) {
@if $ie-version < 9 {
@content;
}
@else {
@media screen and (min-width: $width) {
@content;
}
}
}
@mixin respond-max($width) {
@if $ie-version < 9 {
@if $width >= $screen-medium {
@content;
}
}
@else {
@media screen and (max-width: $width - 1) {
@content;
}
}
}
| @mixin respond-min($width) {
@if $ie-version < 9 {
@content;
}
@else {
@media screen and (min-width: $width) {
@content;
}
}
}
@mixin respond-max($width) {
@if $ie-version < 9 {
@if $width >= $screen-medium {
@content;
}
}
@else {
@media screen and (max-width: $width - 1) {
@content;
}
}
}
@mixin respond-min-max($min-width, $max-width) {
@if $ie-version < 9 {
@if $max-width >= $screen-medium {
@content;
}
}
@else {
@media screen and (min-width: $min-width) and (max-width: $max-width - 1) {
@content;
}
}
}
| Add mixin for min-width and max-width MQs. | Add mixin for min-width and max-width MQs.
| SCSS | mit | jadu/pulsar,jadu/pulsar,jadu/pulsar | scss | ## Code Before:
@mixin respond-min($width) {
@if $ie-version < 9 {
@content;
}
@else {
@media screen and (min-width: $width) {
@content;
}
}
}
@mixin respond-max($width) {
@if $ie-version < 9 {
@if $width >= $screen-medium {
@content;
}
}
@else {
@media screen and (max-width: $width - 1) {
@content;
}
}
}
## Instruction:
Add mixin for min-width and max-width MQs.
## Code After:
@mixin respond-min($width) {
@if $ie-version < 9 {
@content;
}
@else {
@media screen and (min-width: $width) {
@content;
}
}
}
@mixin respond-max($width) {
@if $ie-version < 9 {
@if $width >= $screen-medium {
@content;
}
}
@else {
@media screen and (max-width: $width - 1) {
@content;
}
}
}
@mixin respond-min-max($min-width, $max-width) {
@if $ie-version < 9 {
@if $max-width >= $screen-medium {
@content;
}
}
@else {
@media screen and (min-width: $min-width) and (max-width: $max-width - 1) {
@content;
}
}
}
|
74b6acc2c98dccbd3cd6cd32837ca3380785b51b | README.md | README.md | miniramp
========
Miniramp recommends new SoundCloud artists to listen to, based on an artist you already like.
All data is from the very cool SoundCloud [API](http://developers.soundcloud.com/)
Check it out at [miniramp.net](http://miniramp.net/)
| miniramp
========
Miniramp recommends new SoundCloud artists to listen to, based on an artist you already like.
All data is from the very cool SoundCloud [API](http://developers.soundcloud.com/)
Check it out at [miniramp.net](http://miniramp.net/)
graphics
========
As of Jan 2015, Miniramp also hosts some graphics experiments, such as [this one](http://miniramp.net/cubes)
<p><img src="https://raw.githubusercontent.com/oldhill/miniramp/screenshots/cubes.png">
| Add graphics stuff to readme | Add graphics stuff to readme | Markdown | mit | oldhill/miniramp,oldhill/miniramp,oldhill/miniramp | markdown | ## Code Before:
miniramp
========
Miniramp recommends new SoundCloud artists to listen to, based on an artist you already like.
All data is from the very cool SoundCloud [API](http://developers.soundcloud.com/)
Check it out at [miniramp.net](http://miniramp.net/)
## Instruction:
Add graphics stuff to readme
## Code After:
miniramp
========
Miniramp recommends new SoundCloud artists to listen to, based on an artist you already like.
All data is from the very cool SoundCloud [API](http://developers.soundcloud.com/)
Check it out at [miniramp.net](http://miniramp.net/)
graphics
========
As of Jan 2015, Miniramp also hosts some graphics experiments, such as [this one](http://miniramp.net/cubes)
<p><img src="https://raw.githubusercontent.com/oldhill/miniramp/screenshots/cubes.png">
|
690f0bf8c504d034842367e9321fc2871618fdf1 | lib/upstream/tracker/helper.rb | lib/upstream/tracker/helper.rb | require 'upstream/tracker'
module Upstream
module Tracker
module Helper
def get_config_dir
directory = File.join(ENV['HOME'], '.upstream-tracker')
unless Dir.exist?(directory)
Dir.mkdir(directory)
end
directory
end
def get_config_path
File.join(get_config_dir, CONFIG_FILE)
end
def load_config
YAML.load_file(get_config_path)
end
def save_config(config)
File.open(get_config_path, "w+") do |file|
file.puts(YAML.dump(config))
end
end
def save_components(components)
path = File.join(get_config_dir, COMPONENT_FILE)
File.open(path, "w+") do |file|
file.puts(YAML.dump(components))
end
end
end
end
end
| require 'upstream/tracker'
module Upstream
module Tracker
module Helper
def get_config_dir
directory = File.join(ENV['HOME'], '.upstream-tracker')
unless Dir.exist?(directory)
Dir.mkdir(directory)
end
directory
end
def get_config_path
File.join(get_config_dir, CONFIG_FILE)
end
def load_config
YAML.load_file(get_config_path)
end
def save_config(config)
File.open(get_config_path, "w+") do |file|
file.puts(YAML.dump(config))
end
end
def get_component_path
File.join(get_config_dir, COMPONENT_FILE)
end
def save_components(components)
path = File.join(get_config_dir, COMPONENT_FILE)
File.open(path, "w+") do |file|
file.puts(YAML.dump(components))
end
end
end
end
end
| Add function to get path of component | Add function to get path of component
| Ruby | mit | kenhys/upstream-tracker | ruby | ## Code Before:
require 'upstream/tracker'
module Upstream
module Tracker
module Helper
def get_config_dir
directory = File.join(ENV['HOME'], '.upstream-tracker')
unless Dir.exist?(directory)
Dir.mkdir(directory)
end
directory
end
def get_config_path
File.join(get_config_dir, CONFIG_FILE)
end
def load_config
YAML.load_file(get_config_path)
end
def save_config(config)
File.open(get_config_path, "w+") do |file|
file.puts(YAML.dump(config))
end
end
def save_components(components)
path = File.join(get_config_dir, COMPONENT_FILE)
File.open(path, "w+") do |file|
file.puts(YAML.dump(components))
end
end
end
end
end
## Instruction:
Add function to get path of component
## Code After:
require 'upstream/tracker'
module Upstream
module Tracker
module Helper
def get_config_dir
directory = File.join(ENV['HOME'], '.upstream-tracker')
unless Dir.exist?(directory)
Dir.mkdir(directory)
end
directory
end
def get_config_path
File.join(get_config_dir, CONFIG_FILE)
end
def load_config
YAML.load_file(get_config_path)
end
def save_config(config)
File.open(get_config_path, "w+") do |file|
file.puts(YAML.dump(config))
end
end
def get_component_path
File.join(get_config_dir, COMPONENT_FILE)
end
def save_components(components)
path = File.join(get_config_dir, COMPONENT_FILE)
File.open(path, "w+") do |file|
file.puts(YAML.dump(components))
end
end
end
end
end
|
4340909c0d46645a6658cbdc18c23bde93825a0e | src/MicroAPI/Model.php | src/MicroAPI/Model.php | <?php
namespace MicroAPI;
use MicroAPI\Injector;
class Model
{
/**
* Access a service from the injector
*
* @param $serviceName - The name of the service
* @return mixed
*/
public function getService($serviceName)
{
return Injector::getInstance()->getService($serviceName);
}
} | <?php
namespace MicroAPI;
use MicroAPI\Injector;
class Model
{
/**
* Access a service from the injector
*
* @param $serviceName - The name of the service
* @return mixed
*/
public static function _service($serviceName)
{
return Injector::getInstance()->getService($serviceName);
}
} | Allow accessing services from a static context | Allow accessing services from a static context
| PHP | apache-2.0 | tomlerendu/MicroAPI | php | ## Code Before:
<?php
namespace MicroAPI;
use MicroAPI\Injector;
class Model
{
/**
* Access a service from the injector
*
* @param $serviceName - The name of the service
* @return mixed
*/
public function getService($serviceName)
{
return Injector::getInstance()->getService($serviceName);
}
}
## Instruction:
Allow accessing services from a static context
## Code After:
<?php
namespace MicroAPI;
use MicroAPI\Injector;
class Model
{
/**
* Access a service from the injector
*
* @param $serviceName - The name of the service
* @return mixed
*/
public static function _service($serviceName)
{
return Injector::getInstance()->getService($serviceName);
}
} |
4c5b6342ea0400ab779126b27f14d615b1f961e6 | docker/docker-compose.build.yaml | docker/docker-compose.build.yaml | ---
version: "3.2"
services:
web:
image: "${IMAGE_NAME:-portal_web}:${TAG:-latest}"
build:
context: ..
dockerfile: docker/Dockerfile
args:
- debian_repo="${DEBIAN_REPO:-http://dl.bintray.com/v1/content/uwcirg/${BINTRAY_DEB_REPO:-true_nth}}"
builder:
build:
context: ..
dockerfile: docker/Dockerfile.build
environment:
- BRANCH=${BRANCH:-develop}
- REPO_SLUG=${REPO_SLUG:-uwcirg/true_nth_usa_portal}
volumes:
- source: ../debian/artifacts
target: /tmp/artifacts
type: bind
| ---
version: "3.2"
services:
web:
image: "${IMAGE_NAME:-portal_web}:${TAG:-latest}"
build:
context: ..
dockerfile: docker/Dockerfile
args:
- debian_repo="${DEBIAN_REPO:-http://dl.bintray.com/v1/content/uwcirg/${BINTRAY_DEB_REPO:-true_nth}}"
builder:
build:
context: ..
dockerfile: docker/Dockerfile.build
environment:
- GIT_REPO=${GIT_REPO:-/mnt/git_repo}
- BRANCH=${BRANCH:-develop}
volumes:
- source: ../debian/artifacts
target: /tmp/artifacts
type: bind
- source: ..
target: "${GIT_REPO:-/mnt/git_repo}"
type: bind
read_only: true
| Clone from local repo by default | Clone from local repo by default
| YAML | bsd-3-clause | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | yaml | ## Code Before:
---
version: "3.2"
services:
web:
image: "${IMAGE_NAME:-portal_web}:${TAG:-latest}"
build:
context: ..
dockerfile: docker/Dockerfile
args:
- debian_repo="${DEBIAN_REPO:-http://dl.bintray.com/v1/content/uwcirg/${BINTRAY_DEB_REPO:-true_nth}}"
builder:
build:
context: ..
dockerfile: docker/Dockerfile.build
environment:
- BRANCH=${BRANCH:-develop}
- REPO_SLUG=${REPO_SLUG:-uwcirg/true_nth_usa_portal}
volumes:
- source: ../debian/artifacts
target: /tmp/artifacts
type: bind
## Instruction:
Clone from local repo by default
## Code After:
---
version: "3.2"
services:
web:
image: "${IMAGE_NAME:-portal_web}:${TAG:-latest}"
build:
context: ..
dockerfile: docker/Dockerfile
args:
- debian_repo="${DEBIAN_REPO:-http://dl.bintray.com/v1/content/uwcirg/${BINTRAY_DEB_REPO:-true_nth}}"
builder:
build:
context: ..
dockerfile: docker/Dockerfile.build
environment:
- GIT_REPO=${GIT_REPO:-/mnt/git_repo}
- BRANCH=${BRANCH:-develop}
volumes:
- source: ../debian/artifacts
target: /tmp/artifacts
type: bind
- source: ..
target: "${GIT_REPO:-/mnt/git_repo}"
type: bind
read_only: true
|
705c67feb7b765c06e167a330d3fb1cc7cd6d8e1 | lib/ruboty/handers/fizzbuzz.rb | lib/ruboty/handers/fizzbuzz.rb | require 'ruboty/Fizzbuzz/actions/fizzbuzz'
module Ruboty
module Handler
class Fizzbuzz < Base
end
end
end
| require 'ruboty/Fizzbuzz/actions/fizzbuzz'
module Ruboty
module Handler
class Fizzbuzz < Base
on /fizzbuzz (?<number>.*?)\z/, name: 'fizzbuzz', description: 'output fizzbuzz result'
end
end
end
| Add on method in handler | Add on method in handler
| Ruby | mit | ta1kt0me/ruboty-fizzbuzz,ta1kt0me/ruboty-fizzbuzz | ruby | ## Code Before:
require 'ruboty/Fizzbuzz/actions/fizzbuzz'
module Ruboty
module Handler
class Fizzbuzz < Base
end
end
end
## Instruction:
Add on method in handler
## Code After:
require 'ruboty/Fizzbuzz/actions/fizzbuzz'
module Ruboty
module Handler
class Fizzbuzz < Base
on /fizzbuzz (?<number>.*?)\z/, name: 'fizzbuzz', description: 'output fizzbuzz result'
end
end
end
|
53718c8c91135a823c28eac05c73269fe6491df3 | cache/redis/redis.go | cache/redis/redis.go | package redis
import (
"github.com/DMarby/picsum-photos/cache"
"github.com/mediocregopher/radix/v3"
)
// Provider implements a redis cache
type Provider struct {
pool *radix.Pool
}
// New returns a new Provider instance
func New(address string, poolSize int) (*Provider, error) {
// Use the default pool, which has a 10 second timeout
pool, err := radix.NewPool("tcp", address, poolSize)
if err != nil {
return nil, err
}
return &Provider{
pool: pool,
}, nil
}
// Get returns an object from the cache if it exists
func (p *Provider) Get(key string) (data []byte, err error) {
err = p.pool.Do(radix.Cmd(&data, "GET", key))
if err != nil {
return nil, err
}
if len(data) == 0 {
return nil, cache.ErrNotFound
}
return
}
// Set adds an object to the cache
func (p *Provider) Set(key string, data []byte) (err error) {
return p.pool.Do(radix.FlatCmd(nil, "SET", key, data))
}
// Shutdown shuts down the cache
func (p *Provider) Shutdown() {
p.pool.Close()
}
| package redis
import (
"github.com/DMarby/picsum-photos/cache"
"github.com/mediocregopher/radix/v3"
)
// Provider implements a redis cache
type Provider struct {
pool *radix.Pool
}
// New returns a new Provider instance
func New(address string, poolSize int) (*Provider, error) {
// Use the default pool, which has a 10 second timeout
pool, err := radix.NewPool("tcp", address, poolSize)
if err != nil {
return nil, err
}
return &Provider{
pool: pool,
}, nil
}
// Get returns an object from the cache if it exists
func (p *Provider) Get(key string) (data []byte, err error) {
mn := radix.MaybeNil{Rcv: &data}
err = p.pool.Do(radix.Cmd(&mn, "GET", key))
if err != nil {
return nil, err
}
if mn.Nil {
return nil, cache.ErrNotFound
}
return
}
// Set adds an object to the cache
func (p *Provider) Set(key string, data []byte) (err error) {
return p.pool.Do(radix.FlatCmd(nil, "SET", key, data))
}
// Shutdown shuts down the cache
func (p *Provider) Shutdown() {
p.pool.Close()
}
| Use radix.MaybeNil for detecting if something doesn't exist in the cache | Use radix.MaybeNil for detecting if something doesn't exist in the cache
| Go | mit | DMarby/unsplash-it,DMarby/unsplash-it | go | ## Code Before:
package redis
import (
"github.com/DMarby/picsum-photos/cache"
"github.com/mediocregopher/radix/v3"
)
// Provider implements a redis cache
type Provider struct {
pool *radix.Pool
}
// New returns a new Provider instance
func New(address string, poolSize int) (*Provider, error) {
// Use the default pool, which has a 10 second timeout
pool, err := radix.NewPool("tcp", address, poolSize)
if err != nil {
return nil, err
}
return &Provider{
pool: pool,
}, nil
}
// Get returns an object from the cache if it exists
func (p *Provider) Get(key string) (data []byte, err error) {
err = p.pool.Do(radix.Cmd(&data, "GET", key))
if err != nil {
return nil, err
}
if len(data) == 0 {
return nil, cache.ErrNotFound
}
return
}
// Set adds an object to the cache
func (p *Provider) Set(key string, data []byte) (err error) {
return p.pool.Do(radix.FlatCmd(nil, "SET", key, data))
}
// Shutdown shuts down the cache
func (p *Provider) Shutdown() {
p.pool.Close()
}
## Instruction:
Use radix.MaybeNil for detecting if something doesn't exist in the cache
## Code After:
package redis
import (
"github.com/DMarby/picsum-photos/cache"
"github.com/mediocregopher/radix/v3"
)
// Provider implements a redis cache
type Provider struct {
pool *radix.Pool
}
// New returns a new Provider instance
func New(address string, poolSize int) (*Provider, error) {
// Use the default pool, which has a 10 second timeout
pool, err := radix.NewPool("tcp", address, poolSize)
if err != nil {
return nil, err
}
return &Provider{
pool: pool,
}, nil
}
// Get returns an object from the cache if it exists
func (p *Provider) Get(key string) (data []byte, err error) {
mn := radix.MaybeNil{Rcv: &data}
err = p.pool.Do(radix.Cmd(&mn, "GET", key))
if err != nil {
return nil, err
}
if mn.Nil {
return nil, cache.ErrNotFound
}
return
}
// Set adds an object to the cache
func (p *Provider) Set(key string, data []byte) (err error) {
return p.pool.Do(radix.FlatCmd(nil, "SET", key, data))
}
// Shutdown shuts down the cache
func (p *Provider) Shutdown() {
p.pool.Close()
}
|
97974657b06a7def883256162e732109aa75865d | lib/hyper_paranoid.rb | lib/hyper_paranoid.rb | require "hyper_paranoid/version"
module HyperParanoid
class Railtie < Rails::Railtie
config.app_generators do |g|
g.templates.unshift File::expand_path("../templates", __FILE__)
end
end
end
| require "hyper_paranoid/version"
module HyperParanoid
class Railtie < Rails::Railtie
initializer "require stuff" do
require "acts_as_paranoid"
end
config.app_generators do |g|
g.templates.unshift File::expand_path("../templates", __FILE__)
end
end
end
| Add initializer to require acts_as_paranoid in the rails app | Add initializer to require acts_as_paranoid in the rails app
| Ruby | mit | excid3/hyper_paranoid | ruby | ## Code Before:
require "hyper_paranoid/version"
module HyperParanoid
class Railtie < Rails::Railtie
config.app_generators do |g|
g.templates.unshift File::expand_path("../templates", __FILE__)
end
end
end
## Instruction:
Add initializer to require acts_as_paranoid in the rails app
## Code After:
require "hyper_paranoid/version"
module HyperParanoid
class Railtie < Rails::Railtie
initializer "require stuff" do
require "acts_as_paranoid"
end
config.app_generators do |g|
g.templates.unshift File::expand_path("../templates", __FILE__)
end
end
end
|
70607a7d3fa7e6ddd51b0e62f3b405517566468b | DataMapperInterface.php | DataMapperInterface.php | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface DataMapperInterface
{
/**
* Maps properties of some data to a list of forms.
*
* @param mixed $data Structured data
* @param FormInterface[] $forms A list of {@link FormInterface} instances
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapDataToForms($data, $forms);
/**
* Maps the data of a list of forms into the properties of some data.
*
* @param FormInterface[] $forms A list of {@link FormInterface} instances
* @param mixed $data Structured data
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapFormsToData($forms, &$data);
}
| <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface DataMapperInterface
{
/**
* Maps properties of some data to a list of forms.
*
* @param mixed $data Structured data
* @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapDataToForms($data, $forms);
/**
* Maps the data of a list of forms into the properties of some data.
*
* @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
* @param mixed $data Structured data
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapFormsToData($forms, &$data);
}
| Add \Traversable typehint to phpdoc | Add \Traversable typehint to phpdoc
| PHP | mit | symfony/Form | php | ## Code Before:
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface DataMapperInterface
{
/**
* Maps properties of some data to a list of forms.
*
* @param mixed $data Structured data
* @param FormInterface[] $forms A list of {@link FormInterface} instances
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapDataToForms($data, $forms);
/**
* Maps the data of a list of forms into the properties of some data.
*
* @param FormInterface[] $forms A list of {@link FormInterface} instances
* @param mixed $data Structured data
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapFormsToData($forms, &$data);
}
## Instruction:
Add \Traversable typehint to phpdoc
## Code After:
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface DataMapperInterface
{
/**
* Maps properties of some data to a list of forms.
*
* @param mixed $data Structured data
* @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapDataToForms($data, $forms);
/**
* Maps the data of a list of forms into the properties of some data.
*
* @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
* @param mixed $data Structured data
*
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
*/
public function mapFormsToData($forms, &$data);
}
|
24041b6cb068a1f0033a8fcca37d7da3cad51913 | src/components/Button/SpinnerWrapper.js | src/components/Button/SpinnerWrapper.js | import styled from 'styled-components';
const SpinnerWrapper = styled.span`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
`;
export default SpinnerWrapper;
| import styled from 'styled-components';
const SpinnerWrapper = styled.span`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
`;
export default SpinnerWrapper;
| Fix positioning of the spinner inside the button | Fix positioning of the spinner inside the button
| JavaScript | mit | thegrinder/basic-styled-uikit | javascript | ## Code Before:
import styled from 'styled-components';
const SpinnerWrapper = styled.span`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
`;
export default SpinnerWrapper;
## Instruction:
Fix positioning of the spinner inside the button
## Code After:
import styled from 'styled-components';
const SpinnerWrapper = styled.span`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
`;
export default SpinnerWrapper;
|
9a178036eeb2c39b168712fed3388007217933ea | src/advent_2017/day_06.cljc | src/advent_2017/day_06.cljc | (ns advent-2017.day-06
(:require
#?(:cljs [planck.core :refer [slurp read-string]])
[#?(:clj clojure.java.io :cljs planck.io) :as io]
[clojure.string :as str]))
(def input (-> "advent_2017/day_06/input" io/resource slurp))
(def data (as-> input x (str/trim x) (str/split x #"\t") (mapv read-string x)))
(defn redistribute [banks]
(let [max-ndx (.indexOf banks (apply max banks))
target-ndxs (map #(mod (+ max-ndx 1 %) (count banks))
(range (banks max-ndx)))]
(merge-with + (assoc banks max-ndx 0) (frequencies target-ndxs))))
(defn solve [banks]
(reduce (fn [[last-seen banks] steps]
(if (last-seen banks)
(reduced [steps (last-seen banks)])
[(assoc last-seen banks steps) (redistribute banks)]))
[{} banks]
(range)))
(defn part-1 []
(first (solve data)))
(defn part-2 []
(apply - (solve data)))
| (ns advent-2017.day-06
(:require
#?(:cljs [planck.core :refer [slurp read-string]])
[#?(:clj clojure.java.io :cljs planck.io) :as io]
[clojure.string :as str]))
(def input (-> "advent_2017/day_06/input" io/resource slurp))
(def data (as-> input x (str/trim x) (str/split x #"\t") (mapv read-string x)))
(defn redistribute [banks]
(let [max-val (apply max (vals banks))
max-ndx (apply min (keep (fn [[k v]] (when (= max-val v) k)) banks))
target-ndxs (map #(mod (+ max-ndx 1 %) (count banks))
(range (banks max-ndx)))]
(merge-with + (assoc banks max-ndx 0) (frequencies target-ndxs))))
(defn solve [banks]
(reduce (fn [[last-seen banks] steps]
(if (last-seen banks)
(reduced [steps (last-seen banks)])
[(assoc last-seen banks steps) (redistribute banks)]))
[{} (zipmap (range) banks)]
(range)))
(defn part-1 []
(first (solve data)))
(defn part-2 []
(apply - (solve data)))
| Work in terms of maps so merge-with use is correct | Work in terms of maps so merge-with use is correct
| Clojure | epl-1.0 | mfikes/advent-of-cljs | clojure | ## Code Before:
(ns advent-2017.day-06
(:require
#?(:cljs [planck.core :refer [slurp read-string]])
[#?(:clj clojure.java.io :cljs planck.io) :as io]
[clojure.string :as str]))
(def input (-> "advent_2017/day_06/input" io/resource slurp))
(def data (as-> input x (str/trim x) (str/split x #"\t") (mapv read-string x)))
(defn redistribute [banks]
(let [max-ndx (.indexOf banks (apply max banks))
target-ndxs (map #(mod (+ max-ndx 1 %) (count banks))
(range (banks max-ndx)))]
(merge-with + (assoc banks max-ndx 0) (frequencies target-ndxs))))
(defn solve [banks]
(reduce (fn [[last-seen banks] steps]
(if (last-seen banks)
(reduced [steps (last-seen banks)])
[(assoc last-seen banks steps) (redistribute banks)]))
[{} banks]
(range)))
(defn part-1 []
(first (solve data)))
(defn part-2 []
(apply - (solve data)))
## Instruction:
Work in terms of maps so merge-with use is correct
## Code After:
(ns advent-2017.day-06
(:require
#?(:cljs [planck.core :refer [slurp read-string]])
[#?(:clj clojure.java.io :cljs planck.io) :as io]
[clojure.string :as str]))
(def input (-> "advent_2017/day_06/input" io/resource slurp))
(def data (as-> input x (str/trim x) (str/split x #"\t") (mapv read-string x)))
(defn redistribute [banks]
(let [max-val (apply max (vals banks))
max-ndx (apply min (keep (fn [[k v]] (when (= max-val v) k)) banks))
target-ndxs (map #(mod (+ max-ndx 1 %) (count banks))
(range (banks max-ndx)))]
(merge-with + (assoc banks max-ndx 0) (frequencies target-ndxs))))
(defn solve [banks]
(reduce (fn [[last-seen banks] steps]
(if (last-seen banks)
(reduced [steps (last-seen banks)])
[(assoc last-seen banks steps) (redistribute banks)]))
[{} (zipmap (range) banks)]
(range)))
(defn part-1 []
(first (solve data)))
(defn part-2 []
(apply - (solve data)))
|
e6ffbfd741dbc5e04acc643ad19ec5ce3e60cfb6 | Samples/Media/materials/programs/GLSL400/TesselationTd.glsl | Samples/Media/materials/programs/GLSL400/TesselationTd.glsl |
uniform mat4 g_mWorldViewProjection;
// GLSL tessellation evaluation shader (domain shader in HLSL).
layout(triangles, equal_spacing, cw) in;
void main()
{
// Baricentric interpolation
vec3 finalPos = (gl_TessCoord.x * gl_in[0].gl_Position + gl_TessCoord.y * gl_in[1].gl_Position + gl_TessCoord.z * gl_in[2].gl_Position).xyz;
gl_Position = g_mWorldViewProjection * vec4(finalPos, 1.0);
}
|
uniform mat4 g_mWorldViewProjection;
// GLSL tessellation evaluation shader (domain shader in HLSL).
layout(triangles, equal_spacing, cw) in;
void main()
{
// Baricentric interpolation
vec3 finalPos = vec3(gl_TessCoord.x * gl_in[0].gl_Position +
gl_TessCoord.y * gl_in[1].gl_Position +
gl_TessCoord.z * gl_in[2].gl_Position);
gl_Position = g_mWorldViewProjection * vec4(finalPos, 1.0);
}
| Fix implicit vec 3 to vec4 conversion in Tessellation sample GLSL shader | [samples] Fix implicit vec 3 to vec4 conversion in Tessellation sample GLSL shader
| GLSL | mit | paroj/ogre,OGRECave/ogre,paroj/ogre,RealityFactory/ogre,paroj/ogre,RealityFactory/ogre,OGRECave/ogre,RealityFactory/ogre,RealityFactory/ogre,RealityFactory/ogre,paroj/ogre,OGRECave/ogre,OGRECave/ogre,paroj/ogre,OGRECave/ogre | glsl | ## Code Before:
uniform mat4 g_mWorldViewProjection;
// GLSL tessellation evaluation shader (domain shader in HLSL).
layout(triangles, equal_spacing, cw) in;
void main()
{
// Baricentric interpolation
vec3 finalPos = (gl_TessCoord.x * gl_in[0].gl_Position + gl_TessCoord.y * gl_in[1].gl_Position + gl_TessCoord.z * gl_in[2].gl_Position).xyz;
gl_Position = g_mWorldViewProjection * vec4(finalPos, 1.0);
}
## Instruction:
[samples] Fix implicit vec 3 to vec4 conversion in Tessellation sample GLSL shader
## Code After:
uniform mat4 g_mWorldViewProjection;
// GLSL tessellation evaluation shader (domain shader in HLSL).
layout(triangles, equal_spacing, cw) in;
void main()
{
// Baricentric interpolation
vec3 finalPos = vec3(gl_TessCoord.x * gl_in[0].gl_Position +
gl_TessCoord.y * gl_in[1].gl_Position +
gl_TessCoord.z * gl_in[2].gl_Position);
gl_Position = g_mWorldViewProjection * vec4(finalPos, 1.0);
}
|
d66b9ecd1a28042ab6511c99b4cba38480b1b96e | fpsd/test/test_sketchy_sites.py | fpsd/test/test_sketchy_sites.py |
import unittest
from crawler import Crawler
class CrawlBadSitesTest(unittest.TestCase):
bad_sites = ["http://jlve2diknf45qwjv.onion/",
"http://money2mxtcfcauot.onion",
"http://22222222aziwzse2.onion"]
def test_crawl_of_bad_sites(self):
with Crawler(restart_on_sketchy_exception=True) as crawler:
crawler.collect_set_of_traces(self.bad_sites)
if __name__ == "__main__":
unittest.main()
|
import unittest
from crawler import Crawler
class CrawlBadSitesTest(unittest.TestCase):
bad_sites = ["http://jlve2diknf45qwjv.onion/",
"http://money2mxtcfcauot.onion",
"http://22222222aziwzse2.onion",
"http://xnsoeplvch4fhk3s.onion",
"http://uptgsidhuvcsquoi.onion",
"http://cubie3atuvex2gdw.onion"]
def test_crawl_of_bad_sites(self):
with Crawler(restart_on_sketchy_exception=True) as crawler:
crawler.collect_set_of_traces(self.bad_sites)
if __name__ == "__main__":
unittest.main()
| Add more sites that cause unusual errors | Add more sites that cause unusual errors
| Python | agpl-3.0 | freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop,freedomofpress/FingerprintSecureDrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop | python | ## Code Before:
import unittest
from crawler import Crawler
class CrawlBadSitesTest(unittest.TestCase):
bad_sites = ["http://jlve2diknf45qwjv.onion/",
"http://money2mxtcfcauot.onion",
"http://22222222aziwzse2.onion"]
def test_crawl_of_bad_sites(self):
with Crawler(restart_on_sketchy_exception=True) as crawler:
crawler.collect_set_of_traces(self.bad_sites)
if __name__ == "__main__":
unittest.main()
## Instruction:
Add more sites that cause unusual errors
## Code After:
import unittest
from crawler import Crawler
class CrawlBadSitesTest(unittest.TestCase):
bad_sites = ["http://jlve2diknf45qwjv.onion/",
"http://money2mxtcfcauot.onion",
"http://22222222aziwzse2.onion",
"http://xnsoeplvch4fhk3s.onion",
"http://uptgsidhuvcsquoi.onion",
"http://cubie3atuvex2gdw.onion"]
def test_crawl_of_bad_sites(self):
with Crawler(restart_on_sketchy_exception=True) as crawler:
crawler.collect_set_of_traces(self.bad_sites)
if __name__ == "__main__":
unittest.main()
|
420b5dc5f1da47a88aff71a6067a0a533b3d1c80 | fish/oh-my-fish/pkg/jrduncans/init.fish | fish/oh-my-fish/pkg/jrduncans/init.fish | function mkdir --wraps mkdir
command mkdir -p $argv;
end
function jl --description 'colorized pretty-printed JSON in less'
jq -C . | less -R $argv;
end
if status --is-login
set PATH $PATH ~/bin ~/.local/bin
end
function ll --wraps exa
exa -lh --git $argv
end
function amm-cats --wraps amm
amm -p ~/dotfiles/amm/cats-predef.sc
end
| function mkdir --wraps mkdir
command mkdir -p $argv;
end
function jl --description 'colorized pretty-printed JSON in less'
jq -C . | less -R $argv;
end
if status --is-login
set PATH $PATH ~/bin ~/.local/bin
end
status --is-interactive; and source (rbenv init -|psub)
function ll --wraps exa
exa -lh --git $argv
end
function amm --description 'Scala REPL'
sh -c 'amm "$@"' amm $argv
end
function amm-cats --wraps amm
amm -p ~/dotfiles/amm/cats-predef.sc
end
| Add wrapper for ammonite to use from brew; add rbenv | Add wrapper for ammonite to use from brew; add rbenv
| fish | mit | jrduncans/dotfiles | fish | ## Code Before:
function mkdir --wraps mkdir
command mkdir -p $argv;
end
function jl --description 'colorized pretty-printed JSON in less'
jq -C . | less -R $argv;
end
if status --is-login
set PATH $PATH ~/bin ~/.local/bin
end
function ll --wraps exa
exa -lh --git $argv
end
function amm-cats --wraps amm
amm -p ~/dotfiles/amm/cats-predef.sc
end
## Instruction:
Add wrapper for ammonite to use from brew; add rbenv
## Code After:
function mkdir --wraps mkdir
command mkdir -p $argv;
end
function jl --description 'colorized pretty-printed JSON in less'
jq -C . | less -R $argv;
end
if status --is-login
set PATH $PATH ~/bin ~/.local/bin
end
status --is-interactive; and source (rbenv init -|psub)
function ll --wraps exa
exa -lh --git $argv
end
function amm --description 'Scala REPL'
sh -c 'amm "$@"' amm $argv
end
function amm-cats --wraps amm
amm -p ~/dotfiles/amm/cats-predef.sc
end
|
7c7667e555ef423cbbabd0717f8bdee3c1396a0f | app/views/layouts/application.html.haml | app/views/layouts/application.html.haml | !!!
%html.no-js{lang: 'en'}
%head
%meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}
%title= content_for?(:title) ? yield(:title) : I18n.t('brand.name')
%meta{content: (content_for?(:description) ? yield(:description) : I18n.t('brand.name')), name: 'description'}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
/[if lt IE 9]
= javascript_include_tag 'ie', 'data-turbolinks-track' => true
= javascript_include_tag 'head', 'data-turbolinks-track' => true
= headjs_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
= yield :head
= render 'layouts/airbrake'
%body{class: "#{controller_name} #{action_name}"}
= render 'layouts/navigation'
.container
.errors__container
= render 'layouts/messages'
= yield
%footer.page__footer
- if content_for? :footer
= yield :footer
- else
= render 'layouts/footer'
= render 'layouts/analytics'
= render 'layouts/javascripts'
| !!!
%html.no-js{lang: 'en'}
%head
%meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}
%title= content_for?(:title) ? yield(:title) : I18n.t('brand.name')
%meta{content: (content_for?(:description) ? yield(:description) : I18n.t('brand.name')), name: 'description'}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
/[if lt IE 9]
= javascript_include_tag 'ie', 'data-turbolinks-track' => true
= javascript_include_tag 'head', 'data-turbolinks-track' => true
= headjs_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
= yield :head
= render 'layouts/airbrake'
%body{class: "controller__#{controller_name} action__#{action_name}"}
= render 'layouts/navigation'
.container
.errors__container
= render 'layouts/messages'
= yield
%footer.page__footer
- if content_for? :footer
= yield :footer
- else
= render 'layouts/footer'
= render 'layouts/analytics'
= render 'layouts/javascripts'
| Add prefix to body classes | Add prefix to body classes
Helps avoid class name collisions. | Haml | mit | Wendersonandes/emerge,Wendersonandes/emerge,Wendersonandes/emerge | haml | ## Code Before:
!!!
%html.no-js{lang: 'en'}
%head
%meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}
%title= content_for?(:title) ? yield(:title) : I18n.t('brand.name')
%meta{content: (content_for?(:description) ? yield(:description) : I18n.t('brand.name')), name: 'description'}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
/[if lt IE 9]
= javascript_include_tag 'ie', 'data-turbolinks-track' => true
= javascript_include_tag 'head', 'data-turbolinks-track' => true
= headjs_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
= yield :head
= render 'layouts/airbrake'
%body{class: "#{controller_name} #{action_name}"}
= render 'layouts/navigation'
.container
.errors__container
= render 'layouts/messages'
= yield
%footer.page__footer
- if content_for? :footer
= yield :footer
- else
= render 'layouts/footer'
= render 'layouts/analytics'
= render 'layouts/javascripts'
## Instruction:
Add prefix to body classes
Helps avoid class name collisions.
## Code After:
!!!
%html.no-js{lang: 'en'}
%head
%meta{content: 'width=device-width, initial-scale=1.0', name: 'viewport'}
%title= content_for?(:title) ? yield(:title) : I18n.t('brand.name')
%meta{content: (content_for?(:description) ? yield(:description) : I18n.t('brand.name')), name: 'description'}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
/[if lt IE 9]
= javascript_include_tag 'ie', 'data-turbolinks-track' => true
= javascript_include_tag 'head', 'data-turbolinks-track' => true
= headjs_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
= yield :head
= render 'layouts/airbrake'
%body{class: "controller__#{controller_name} action__#{action_name}"}
= render 'layouts/navigation'
.container
.errors__container
= render 'layouts/messages'
= yield
%footer.page__footer
- if content_for? :footer
= yield :footer
- else
= render 'layouts/footer'
= render 'layouts/analytics'
= render 'layouts/javascripts'
|
b147fe62836078bb15fa4b7ca144a29c63aa012f | .travis.yml | .travis.yml | language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.1
before_install:
- gem install puppet
- gem install librarian-puppet
- librarian-puppet install
script:
- ./run_tests.sh
notifications:
email: false
matrix:
allow_failures:
- rvm: 2.0.0
- rvm: 2.1.1
branches:
except:
- /^build_\d+$/
| language: ruby
rvm:
- 1.9.3
- 2.1.1
before_install:
- gem install puppet
- gem install librarian-puppet
- librarian-puppet install
script:
- ./run_tests.sh
notifications:
email: false
branches:
except:
- /^build_\d+$/
| Test on 1.9.3 and 2.1.1 & be less wimpy | Test on 1.9.3 and 2.1.1 & be less wimpy
Our actual "supported" ruby version is 1.9.3 so we should definitely be
testing on that.
It seems excessive to test on an additional *two* future ruby versions. Just
test on 2.1.1 and don't be wimpy about allowing failures. It's currently
passing so let's prep ourselves for a future upversion.
Also three versions can't help our (dreadful) Travis build times...
| YAML | mit | alphagov/pp-puppet,alphagov/pp-puppet,alphagov/pp-puppet,alphagov/pp-puppet | yaml | ## Code Before:
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.1
before_install:
- gem install puppet
- gem install librarian-puppet
- librarian-puppet install
script:
- ./run_tests.sh
notifications:
email: false
matrix:
allow_failures:
- rvm: 2.0.0
- rvm: 2.1.1
branches:
except:
- /^build_\d+$/
## Instruction:
Test on 1.9.3 and 2.1.1 & be less wimpy
Our actual "supported" ruby version is 1.9.3 so we should definitely be
testing on that.
It seems excessive to test on an additional *two* future ruby versions. Just
test on 2.1.1 and don't be wimpy about allowing failures. It's currently
passing so let's prep ourselves for a future upversion.
Also three versions can't help our (dreadful) Travis build times...
## Code After:
language: ruby
rvm:
- 1.9.3
- 2.1.1
before_install:
- gem install puppet
- gem install librarian-puppet
- librarian-puppet install
script:
- ./run_tests.sh
notifications:
email: false
branches:
except:
- /^build_\d+$/
|
32f7ddeec8a67338d0e9663d0fb1f3e448e6d32a | renderer/components/box/box-image.css | renderer/components/box/box-image.css | .base {
position: relative;
width: 100%;
min-height: 20px;
text-align: center;
cursor: zoom-in;
}
.base svg {
position: absolute;
width: 25px;
height: 25px;
padding: 2px;
fill: white;
background-color: rgba(180, 180, 180, 0.5);
border-radius: 4px;
margin-top: 5px;
margin-left: 5px;
z-index: 100;
}
.base img {
max-width: 100%;
min-height: 100px;
background: #eeffee;
overflow: hidden;
}
.loaded {
animation: fade-in 300ms both;
}
@keyframes fade-in {
0% {
filter: blur(50px);
opacity: 0;
}
100% {
filter: none;
opacity: 1;
}
}
| .base {
position: relative;
width: 100%;
min-height: 20px;
text-align: center;
cursor: zoom-in;
overflow: hidden;
}
.base svg {
position: absolute;
width: 25px;
height: 25px;
padding: 2px;
fill: white;
background-color: rgba(180, 180, 180, 0.5);
border-radius: 4px;
margin-top: 5px;
margin-left: 5px;
z-index: 100;
}
.base img {
max-width: 100%;
min-height: 100px;
background: #eeffee;
overflow: hidden;
}
.loaded {
animation: fade-in 300ms both;
}
@keyframes fade-in {
0% {
filter: blur(50px);
margin: -50px;
opacity: 0;
}
100% {
filter: none;
margin: 0;
opacity: 1;
}
}
| Fix blur blur blur blur... | Fix blur blur blur blur...
| CSS | mit | akameco/PixivDeck,akameco/PixivDeck | css | ## Code Before:
.base {
position: relative;
width: 100%;
min-height: 20px;
text-align: center;
cursor: zoom-in;
}
.base svg {
position: absolute;
width: 25px;
height: 25px;
padding: 2px;
fill: white;
background-color: rgba(180, 180, 180, 0.5);
border-radius: 4px;
margin-top: 5px;
margin-left: 5px;
z-index: 100;
}
.base img {
max-width: 100%;
min-height: 100px;
background: #eeffee;
overflow: hidden;
}
.loaded {
animation: fade-in 300ms both;
}
@keyframes fade-in {
0% {
filter: blur(50px);
opacity: 0;
}
100% {
filter: none;
opacity: 1;
}
}
## Instruction:
Fix blur blur blur blur...
## Code After:
.base {
position: relative;
width: 100%;
min-height: 20px;
text-align: center;
cursor: zoom-in;
overflow: hidden;
}
.base svg {
position: absolute;
width: 25px;
height: 25px;
padding: 2px;
fill: white;
background-color: rgba(180, 180, 180, 0.5);
border-radius: 4px;
margin-top: 5px;
margin-left: 5px;
z-index: 100;
}
.base img {
max-width: 100%;
min-height: 100px;
background: #eeffee;
overflow: hidden;
}
.loaded {
animation: fade-in 300ms both;
}
@keyframes fade-in {
0% {
filter: blur(50px);
margin: -50px;
opacity: 0;
}
100% {
filter: none;
margin: 0;
opacity: 1;
}
}
|
88a174b69b5146ada43ce34470696aeb335b78a9 | vrnetlab.sh | vrnetlab.sh |
vr_mgmt_ip() {
VROUTER=$1
VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
echo $VR_ADDRESS
}
vrssh() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
ssh $VR_ADDRESS -l vrnetlab
else
ssh $VR_ADDRESS -l $USER
fi
}
vrcons() {
VROUTER=$1
telnet $(vr_mgmt_ip $VROUTER) 5000
}
vrbridge() {
VR1=$1
VP1=$2
VR2=$3
VP2=$4
docker run -d --name "bridge-${VR1}-${VP1}-${VR2}-${VP2}" --link $VR1 --link $VR2 tcpbridge --p2p "${VR1}/${VP1}--${VR2}/${VP2}"
}
|
vr_mgmt_ip() {
VROUTER=$1
VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
echo $VR_ADDRESS
}
vrssh() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l vrnetlab
else
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l $USER
fi
}
vrcons() {
VROUTER=$1
telnet $(vr_mgmt_ip $VROUTER) 5000
}
vrbridge() {
VR1=$1
VP1=$2
VR2=$3
VP2=$4
docker run -d --name "bridge-${VR1}-${VP1}-${VR2}-${VP2}" --link $VR1 --link $VR2 tcpbridge --p2p "${VR1}/${VP1}--${VR2}/${VP2}"
}
| Disable strict host key checking for vrssh shorthand | Disable strict host key checking for vrssh shorthand
| Shell | mit | bdreisbach/vrnetlab,holmahenkel/vrnetlab,mzagozen/vrnetlab,mzagozen/vrnetlab,bdreisbach/vrnetlab,plajjan/vrnetlab,plajjan/vrnetlab,holmahenkel/vrnetlab | shell | ## Code Before:
vr_mgmt_ip() {
VROUTER=$1
VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
echo $VR_ADDRESS
}
vrssh() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
ssh $VR_ADDRESS -l vrnetlab
else
ssh $VR_ADDRESS -l $USER
fi
}
vrcons() {
VROUTER=$1
telnet $(vr_mgmt_ip $VROUTER) 5000
}
vrbridge() {
VR1=$1
VP1=$2
VR2=$3
VP2=$4
docker run -d --name "bridge-${VR1}-${VP1}-${VR2}-${VP2}" --link $VR1 --link $VR2 tcpbridge --p2p "${VR1}/${VP1}--${VR2}/${VP2}"
}
## Instruction:
Disable strict host key checking for vrssh shorthand
## Code After:
vr_mgmt_ip() {
VROUTER=$1
VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
echo $VR_ADDRESS
}
vrssh() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l vrnetlab
else
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l $USER
fi
}
vrcons() {
VROUTER=$1
telnet $(vr_mgmt_ip $VROUTER) 5000
}
vrbridge() {
VR1=$1
VP1=$2
VR2=$3
VP2=$4
docker run -d --name "bridge-${VR1}-${VP1}-${VR2}-${VP2}" --link $VR1 --link $VR2 tcpbridge --p2p "${VR1}/${VP1}--${VR2}/${VP2}"
}
|
7d604df10e86db5b4f81923f655a86639e07669d | www/search_cse.php | www/search_cse.php | <?php
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require("defs.php3");
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING,
"query", PAGEARG_STRING);
if (!isset($query) || $query == "Search Documentation") {
$query = "";
}
header("Location: http://wiki.emulab.net/@@search?SearchableText=$query");
?>
| <?php
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require("defs.php3");
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING,
"query", PAGEARG_STRING);
if (!isset($query) || $query == "Search Documentation") {
$query = "";
}
else {
$query = urldecode($query);
$query = preg_replace("/[\ ]+/", "+", $query);
}
header("Location: http://wiki.emulab.net/@@search?SearchableText=$query");
?>
| Send the query over to plone in the proper format. | Send the query over to plone in the proper format.
| PHP | agpl-3.0 | nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome | php | ## Code Before:
<?php
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require("defs.php3");
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING,
"query", PAGEARG_STRING);
if (!isset($query) || $query == "Search Documentation") {
$query = "";
}
header("Location: http://wiki.emulab.net/@@search?SearchableText=$query");
?>
## Instruction:
Send the query over to plone in the proper format.
## Code After:
<?php
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require("defs.php3");
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING,
"query", PAGEARG_STRING);
if (!isset($query) || $query == "Search Documentation") {
$query = "";
}
else {
$query = urldecode($query);
$query = preg_replace("/[\ ]+/", "+", $query);
}
header("Location: http://wiki.emulab.net/@@search?SearchableText=$query");
?>
|