See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
<?php | |
define('FANN_TRAIN_INCREMENTAL', 0); | |
define('FANN_TRAIN_BATCH', 1); | |
define('FANN_TRAIN_RPROP', 2); | |
define('FANN_TRAIN_QUICKPROP', 3); | |
define('FANN_TRAIN_SARPROP', 4); | |
define('FANN_LINEAR', 0); | |
define('FANN_THRESHOLD', 1); | |
define('FANN_THRESHOLD_SYMMETRIC', 2); |
<?php | |
abstract class baseDAO{ | |
private $__connection; | |
public function __construct(){ | |
$this->_connectToDB(DB_USER, DB_PASS, DB_HOST, DB_DATABASE); | |
} | |
private function __connectToDB($user, $pass, $host, $database){ |
// transform cropper dataURI output to a Blob which Dropzone accepts | |
function dataURItoBlob(dataURI) { | |
var byteString = atob(dataURI.split(',')[1]); | |
var ab = new ArrayBuffer(byteString.length); | |
var ia = new Uint8Array(ab); | |
for (var i = 0; i < byteString.length; i++) { | |
ia[i] = byteString.charCodeAt(i); | |
} | |
return new Blob([ab], { type: 'image/jpeg' }); | |
} |
This gist is about:
Mainly:
function
cannot (should not) be used when side-effects occurvar toast=function(msg){ | |
$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h3>"+msg+"</h3></div>") | |
.css({ display: "block", | |
opacity: 0.90, | |
position: "fixed", | |
padding: "7px", | |
"text-align": "center", | |
width: "270px", | |
left: ($(window).width() - 284)/2, | |
top: $(window).height()/2 }) |
<?php | |
$flatten = function( $array , $keySeparator = '.' ) use ( & $flatten ) | |
{ | |
if( is_array( $array ) ) { | |
foreach( $array as $name => $value ) { | |
$f = $flatten( $value , $keySeparator ); | |
if( is_array( $f ) ) { | |
foreach( $f as $key => $val ) { | |
$array[ $name . $keySeparator . $key ] = $val; |