This file contains hidden or 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); | |
}; | |
}); |
This file contains hidden or 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
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 **/ |
This file contains hidden or 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
function getList(item, $list) { | |
if($.isArray(item)) { | |
$.each(item, function (key, value) { | |
getList(value, $list); | |
}); | |
return; | |
} | |
if (item) { | |
var $li = $('<li />'); | |
if (item.name) { |
This file contains hidden or 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
# http://php.net/manual/en/function.checkdate.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 |
This file contains hidden or 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 | |
use Zend\Mvc\ModuleRouteListener; | |
use Zend\Mvc\MvcEvent; | |
class Module | |
{ | |
public function onBootstrap(MvcEvent $e) | |
{ |
This file contains hidden or 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 composer.phar create-project -sdev --repository-url="https://packages.zendframework.com" zendframework/skeleton-application c:\xampp\htdocs\zf2 |
This file contains hidden or 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
update log_data SET `timestamp` = `timestamp` + INTERVAL 1 DAY WHERE id >= 1000 LIMIT 1000; | |
SELECT datetime + INTERVAL 10 YEAR + INTERVAL 3 MONTH + INTERVAL 22 DAY | |
+ INTERVAL 10 HOUR + INTERVAL 30 MINUTE AS new_date_time FROM table; |
This file contains hidden or 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 hidden or 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
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( | |
'location_name', | |
'breakdown_period', |
This file contains hidden or 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
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. |
NewerOlder