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 array_to_csv.php
function convert_to_csv($input_array, $output_file_name, $delimiter)
/** open raw memory as file, no need for temp files, be careful not to run out of memory thought */
$f = fopen('php://memory', 'w');
/** loop through array */
foreach ($input_array as $line) {
/** default php csv handler **/
fputcsv($f, $line, $delimiter);
/** rewrind the "file" with the csv lines **/
View nested list.js
function getList(item, $list) {
if($.isArray(item)) {
$.each(item, function (key, value) {
getList(value, $list);
if (item) {
var $li = $('<li />');
if ( {
View validate_date.php
function validateDate($date, $format = 'Y-m-d H:i:s')
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
var_dump(validateDate('2012-02-28 12:12:12')); # true
var_dump(validateDate('2012-02-30 12:12:12')); # false
var_dump(validateDate('2012-02-28', 'Y-m-d')); # true
View gist:4a6e9ae973ed09fae382
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
public function onBootstrap(MvcEvent $e)
rettal / composer_git_create_project
Created Apr 23, 2015
Composer/Git Checkout and Create Project
View composer_git_create_project
php composer.phar create-project -sdev --repository-url="" zendframework/skeleton-application c:\xampp\htdocs\zf2
View MySQL Datetime Manipulation
update log_data SET `timestamp` = `timestamp` + INTERVAL 1 DAY WHERE id >= 1000 LIMIT 1000;
+ INTERVAL 10 HOUR + INTERVAL 30 MINUTE AS new_date_time FROM table;
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 Download CSV
public function downloadCsvAction()
$oldTimeLimit = ini_get('max_execution_time');
ini_set('max_execution_time', 60);
$lang = $this->params('lang', "en");
$this->setRatingsViewData($this->viewData, $lang);
$headers = array(
View D3 States
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
Code example explaining the enter, update and exit states in D3.
The 3 states basically define the actions that occur when data is added to a selection of elements.
Say if we were selecting data from a database where we had to perform a search with a query string,
each time we ran query the number of rows returned could be more, less, or could be the same but
contain different data, these in essence are the 3 states. more = enter, less = exit, same = update.
You can’t perform that action at this time.