This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = '\n\n\n Multiline text\n with indentation\n damn.\n\n\n'; | |
// remove first and last empty lines | |
str = str.replace(/^[\r\n]+|[\n\r]+$/gi, ''); | |
var indentTab = str.match(/\t*/) != '', | |
indentSize = indentTab ? 1 : str.match(/\s*/)[0].length, | |
regex = new RegExp('^(?:' + (indentTab ? '\\t' : ' {' + indentSize + '}') + ')', 'mg'); | |
// Remove indent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Formats a JSON string for pretty printing | |
* | |
* @param string $json The JSON to make pretty | |
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks | |
* @return string The prettified output | |
* @author Jay Roberts | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AbstractManagerBase extends \PHPUnit_Framework_TestCase | |
{ | |
protected function getEmMock() | |
{ | |
$emMock = $this->getMock('\Doctrine\ORM\EntityManager', | |
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false); | |
$emMock->expects($this->any()) | |
->method('getRepository') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="chart"> | |
<h4>Percent of adults over 25 with at least a bachelor's degree:</h4> | |
<p><strong>Median:</strong> <span class="median"></span></p> | |
<small>Source: <cite><a href="http://census.gov">U.S. Census Bureau</a></cite>, via <cite><a href="http://beta.censusreporter.org/compare/01000US/040/table/?release=acs2011_1yr&table=B15003">Census Reporter</a></cite></small> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('crmApp') | |
.filter('isEmptyObject', function () { | |
return function (obj) { | |
return angular.equals({}, obj); | |
}; | |
}); |