Skip to content

Instantly share code, notes, and snippets.

View sunel's full-sized avatar
🎯
Focusing

Sunel Tr sunel

🎯
Focusing
View GitHub Profile
@sunel
sunel / icon.js
Created September 21, 2018 09:17
// This icon file is generated by build/generateIcons.ts
// tslint:disable
export { default as AccountBookFill } from '@ant-design/icons/lib/fill/AccountBookFill';
export { default as AlertFill } from '@ant-design/icons/lib/fill/AlertFill';
export { default as AlipayCircleFill } from '@ant-design/icons/lib/fill/AlipayCircleFill';
export { default as AlipaySquareFill } from '@ant-design/icons/lib/fill/AlipaySquareFill';
export { default as AliwangwangFill } from '@ant-design/icons/lib/fill/AliwangwangFill';
export { default as AmazonCircleFill } from '@ant-design/icons/lib/fill/AmazonCircleFill';
export { default as AmazonSquareFill } from '@ant-design/icons/lib/fill/AmazonSquareFill';
export { default as ApiFill } from '@ant-design/icons/lib/fill/ApiFill';
@sunel
sunel / ThlInstaller.php
Created June 28, 2016 04:29
Autoload problem
<?php
namespace THL\Installer;
class ThlInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'Modules/{$name}/',
'theme' => 'Themes/{$name}/'
);
[{"name":"users","color":"Red","position":{"x":100,"y":100},"increment":true,"timestamp":true,"softdelete":true,"column":[{"name":"name","type":"string","length":"255","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c35","order":0}],"relation":[{"extramethods":"","foreignkeys":"user_id","name":"courses","relatedmodel":"courses","relationtype":"hasMany","usenamespace":""}],"seeding":[]},{"name":"courses","color":"Red","position":{"x":770,"y":215},"increment":true,"timestamp":true,"softdelete":true,"column":[],"relation":[],"seeding":[]}]
<?php
class Namespace_Module_Model_Entity extends Mage_Core_Model_Abstract
{
/**
* Initialization
*/
public function _construct()
{
$this->_init('namespace_module/entity');
}
@sunel
sunel / pre-commit
Created December 10, 2015 12:00 — forked from phpfunk/pre-commit
PHP Syntax Check on Git Commit
#!/usr/bin/php
<?php
// Set empty files array
$files = array();
// Get untracked files
// Get modified files
exec('git ls-files --others --exclude-standard', $untracked);
exec('git diff --cached --diff-filter=ACMRTUX --name-only', $modified);
@sunel
sunel / My Magento Code.php
Created October 26, 2015 12:54 — forked from claudiu-marginean/My Magento Code.php
Magento Snippets
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
@sunel
sunel / gist:3af00fe6660ff84bc7c7
Created October 6, 2015 10:03 — forked from obukhow/gist:5040981
Magento file size and file extensions frontend validation
Validation.addAllThese([
['validate-filesize','The file size should not exceed 100 kb.',function(v, elm){
var maxSize = 102400;
if (navigator.appName == "Microsoft Internet Explorer") {
if (elm.value) {
var oas = new ActiveXObject("Scripting.FileSystemObject");
var e = oas.getFile(elm.value);
var size = e.size;
}
} else {
@sunel
sunel / pre-commit-csfixer
Last active September 10, 2015 08:44 — forked from sampart/pre-commit-csfixer
git pre-commit hook to run the Coding Standards fixer against changed files
#!/bin/bash
# Coding Standards fixer from http://cs.sensiolabs.org/ pre-commit hook for git
#
# Based on https://github.com/s0enke/git-hooks
#
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
@sunel
sunel / .gitconfig
Last active September 10, 2015 08:40 — forked from havvg/.gitconfig
apply PHP-CS-Fixer on all changed files in the staging area
[alias]
fix-staged = "!git diff-index --cached --name-status HEAD | grep -ve '^D' | cut -f2 | xargs -n1 php-cs-fixer fix"
@sunel
sunel / ajax.html
Last active September 6, 2015 13:43 — forked from colinmegill/ajax.html
Styling inline with AJAX for CSSConf - jQuery is hacked into the header, I know, I know.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
<script type="text/javascript">
/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return