Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block rettal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rettal / isemptyobject.js
Created Jan 25, 2016 — forked from gruppjo/isemptyobject.js
angularjs - empty object filter
View isemptyobject.js
'use strict';
.filter('isEmptyObject', function () {
return function (obj) {
return angular.equals({}, obj);
View 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="">U.S. Census Bureau</a></cite>, via <cite><a href="">Census Reporter</a></cite></small>
View PHPUnit way to mock Doctrine2 Entity Manager.php
class AbstractManagerBase extends \PHPUnit_Framework_TestCase
protected function getEmMock()
$emMock = $this->getMock('\Doctrine\ORM\EntityManager',
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
View pretty-json.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
View Strip Spaces & Tabs in Javascrip
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
You can’t perform that action at this time.