Skip to content

Instantly share code, notes, and snippets.

View amin3d's full-sized avatar
💭
I may be slow to respond.

Amin Amanpour amin3d

💭
I may be slow to respond.
View GitHub Profile
@amin3d
amin3d / functions.php
Created May 15, 2017 09:19
Plain text to paragraph
function paragraph_formater($content,$limit)
{
$content = array_filter(preg_split('/(?<!\.)\.\s*(?!\.)/', $content));
$out = [];
$temp = '';
for ($i = 0; $i < count($content); $i++) {
$len = mb_strlen($content[$i]);
if ($temp == '') {
if ($len > $limit) {
$out[] = '<p>' . $content[$i] . '.</p>';
@amin3d
amin3d / index.haml
Created October 20, 2016 03:17
Login Box Concept
.brand
%a{:href => 'http://www.jamiecoulter.co.uk',:target => '_blank'}
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/logo.png'}
.login
.login_title
%span Login to your account
.login_fields
.login_fields__user
.icon
%img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/user_icon_copy.png'}
@amin3d
amin3d / css-only-cupcake-slider-with-sprinkles.markdown
Created October 20, 2016 03:12
CSS Only Cupcake Slider with Sprinkles!
@amin3d
amin3d / functions.php
Created October 15, 2016 15:33
Register widget with wrapping the widget content
function pana_widgets_init() {
register_sidebar( array(
'name' => 'سایدبار پست',
'id' => 'post_sidebar',
'description' => 'در این سایدبار می توایند به تعداد دلخواه ابزارک قرار دهید',
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</div></section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2><div class="widget-content">',
) );
@amin3d
amin3d / functions.php
Created September 14, 2016 11:35
Iranian Tax Rate woocommerce
function add_iranian_tax_rate( $settings ) {
$updated_settings = array();
foreach ( $settings as $section ) {
if ( isset( $section['id'] ) && 'tax_options' == $section['id'] &&
isset( $section['type'] ) && 'sectionend' == $section['type'] ) {
$updated_settings[] = array(
'name' => 'میزان نرخ مالیات',
'desc_tip' => 'در این بخش می توانید نرخ مالیات را وارد نمایید',
'id' => 'woocommerce_iranian_tax_rate',
@amin3d
amin3d / get_term_child.php
Created September 6, 2016 13:31
get term child
function get_term_child($tax,$slug)
{
$term=get_term_by('slug', $slug, $tax);
return get_term_link($term);
/* $terms = get_terms($tax);
foreach ($terms as $term) {
if($term->slug==$slug)
return get_term_link($term);
}
@amin3d
amin3d / WP-Pagenavi-bootstrap-3.php
Created August 23, 2016 13:08
Bootstrap WordPress Pagination Using WP-Pagenavi
/*-------------------------------------------------------------------
Bootstrap WordPress Pagination Using WP-Pagenavi
-------------------------------------------------------------------*/
//attach our function to the wp_pagenavi filter
add_filter( 'wp_pagenavi', 'ik_pagination', 10, 2 );
//customize the PageNavi HTML before it is output
function ik_pagination($html) {
$out = '';
@amin3d
amin3d / add.php
Created June 22, 2016 11:41
add to database PHPEXCEL AND CODEIGNITER
public function index()
{
$this->load->library('excel');
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load("uploads/foghetakhasos.xlsx");
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$this->load->database();
@amin3d
amin3d / a.css
Created June 21, 2016 06:37
PanaTeam Logo in CSS
.pixelart-to-css {
box-shadow: 10px 10px 0 #000000, 20px 10px 0 #000000, 30px 10px 0 #000000, 40px 10px 0 #000000, 50px 10px 0 #000000, 60px 10px 0 #000000, 70px 10px 0 #000000, 80px 10px 0 #000000, 90px 10px 0 #000000, 100px 10px 0 #000000, 110px 10px 0 #000000, 120px 10px 0 #000000, 130px 10px 0 #000000, 140px 10px 0 #000000, 150px 10px 0 #000000, 160px 10px 0 #000000, 170px 10px 0 #000000, 180px 10px 0 #000000, 190px 10px 0 #000000, 200px 10px 0 #000000, 10px 20px 0 #000000, 20px 20px 0 #ffffff, 30px 20px 0 #ffffff, 40px 20px 0 #ffffff, 50px 20px 0 #ffffff, 60px 20px 0 #ffffff, 70px 20px 0 #ffffff, 80px 20px 0 #ffffff, 90px 20px 0 #ffffff, 100px 20px 0 #ffffff, 110px 20px 0 #ffffff, 120px 20px 0 #ffffff, 130px 20px 0 #ffffff, 140px 20px 0 #ffffff, 150px 20px 0 #ffffff, 160px 20px 0 #ffffff, 170px 20px 0 #ffffff, 180px 20px 0 #ffffff, 190px 20px 0 #ffffff, 200px 20px 0 #000000, 10px 30px 0 #000000, 20px 30px 0 #ffffff, 30px 30px 0 #000000, 40px 30px 0 #000000, 50px 30px 0 #000000, 60px 30px 0 #000000, 70
@amin3d
amin3d / plugin_utility.php
Created March 31, 2016 11:32
An utility for my plugin system
class plugin_utility
{
private $CI;
private $name;
public function __construct($name) {
$this->CI =& get_instance();
$this->name=$name;
if($this->checklang())
{
$this->CI->lang->plg_load($name,$name);