Skip to content

Instantly share code, notes, and snippets.

View akizor's full-sized avatar
🎯
Focusing

Daniel Placinta akizor

🎯
Focusing
  • Bucharest, Romania
View GitHub Profile
@akizor
akizor / app.css
Last active August 29, 2015 14:06 — forked from runzway/app.css
.ng-modal-overlay {
position:absolute;
z-index:9999;
top:0;
left:0;
width:100%;
height:100%;
background-color:#000;
opacity: 0.8;
}
@akizor
akizor / Content.php
Last active August 29, 2015 14:06
Magento - New admin custom form entity to display custom content
<?php
class Varien_Data_Form_Element_Content extends Varien_Data_Form_Element_Abstract {
private $_defaults = array(
'block' => 'core/template',
'params' => '',
'template' => '',
);
public function __construct($attributes=array())
//Add Hover effect to menus
jQuery('ul.nav li.dropdown').hover(function() {
jQuery(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn();
}, function() {
jQuery(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut();
});
@akizor
akizor / Observer.php
Last active August 29, 2015 14:11
Magento Observer for Product/Orders Massactions
public function addMassAction($observer) {
$block = $observer->getEvent()->getBlock();
if(!$block) {
return $this;
}
$store = Mage::app()->getStore();
$storeId = Mage::app()->getStore()->getCode();
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction) {
@akizor
akizor / ro_slugs.php
Last active August 29, 2015 14:15 — forked from samatsav/ro_slugs.php
function ro_slugs($cuvant) {
$slug = trim(strtolower(stripslashes($cuvant)));
$map = array(
'/à|á|å|â|ă|â|Â|Ă|ă/i' => 'a',
'/è|é|ê|ẽ|ë/i' => 'e',
'/ì|í|î|î|Î|Î/i' => 'i',
'/ò|ó|ô|ø/i' => 'o',
'/ù|ú|ů|û/i' => 'u',
'/ș|ș|ş|Ș|Ș|Ş/i'=>'s',
'/ț|ţ|ț|Ț|Ţ/i'=>'t',
@akizor
akizor / validate-sweden-ssn.js
Last active August 29, 2015 14:23
Sweden Personnumber Validator for Magento
/**
* Magento Sweden SSN Validator
* @param none
* @return boolean
* @author Daniel Placinta (daniel@artgames.ro)
* Based on: jquery-validate-personnummer by Sebastian Wallin
* Github: https://github.com/wallin/jquery-validate-personnummer
*/
if(Validation) {
Validation.addAllThese([
@akizor
akizor / file.php
Created September 4, 2015 11:09
MacOSX fix special characters (diacritics) in PHP export xls (excel) for Magento
$fileName = 'export-casete-plastica-' . Mage::getModel('core/date')->date('Y-m-d-h-i-s') . '.xls';
$content = mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
$this->_prepareDownloadResponse($fileName, chr(255) . chr(254) . $content);
@akizor
akizor / Bnr.php
Last active February 4, 2020 07:37
Laravel BNR currency rate (curs valutar) + Cache
<?php
/**
* ART GAMES BNR Rate Class
*
* @description A currency rate method for Laravel using BNR's api. The main currency is Romanian LEU (RON). Price response from BNR is compared with the RON currency. The method uses Laravel's caching properties.
* @usage \App\Models\Bnr::curs("EUR")
* @author Daniel Placinta <daniel@artgames.ro>
* @license MIT
*/
@akizor
akizor / validateCif.js
Last active May 24, 2017 09:03
Validate CUI/CIF for Romania
var validateCui = function(cui){
var cif = cui;
// Daca este string, elimina atributul fiscal si spatiile
if(isNaN(parseFloat(cui)) || !isFinite(cui)){
cif = cif.toUpperCase();
if(cif.indexOf('RO') === 0){
cif = cif.replace('RO', '');
} else {
return false;
}
@akizor
akizor / Cnp.php
Created May 8, 2018 12:40
Custom validation class for CNP field in Laravel
<?php
/**
* @author Daniel Placinta
* http://artgames.ro
* Heavy inspiration from https://github.com/alceanicu/cnp/
*/
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;