Skip to content

Instantly share code, notes, and snippets.

@rettal
rettal / isemptyobject.js
Created January 25, 2016 09:26 — forked from gruppjo/isemptyobject.js
angularjs - empty object filter
'use strict';
angular.module('crmApp')
.filter('isEmptyObject', function () {
return function (obj) {
return angular.equals({}, obj);
};
});
@rettal
rettal / chart.html
Last active August 29, 2015 14:16 — forked from eyeseast/chart.html
<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>
<?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')
<?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
*/
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