Skip to content

Instantly share code, notes, and snippets.

View muddy-28's full-sized avatar
🎯
Focusing

Adnan Shafique muddy-28

🎯
Focusing
View GitHub Profile
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
<?php
function get_url_contents($url){
if (function_exists('file_get_contents')) {
$result = @file_get_contents($url);
}
if ($result == '') {
$ch = curl_init();
$timeout = 30;
curl_setopt($ch, CURLOPT_URL, $url);
@muddy-28
muddy-28 / downloadFileChunks.php
Created June 9, 2016 10:34 — forked from irazasyed/downloadFileChunks.php
PHP: File downloader function - Downloading files in chunks.
<?php
/**
* Download helper to download files in chunks and save it.
*
* @author Syed I.R <syed@lukonet.com>
* @link https://github.com/irazasyed
*
* @param string $srcName Source Path/URL to the file you want to download
* @param string $dstName Destination Path to save your file
* @param integer $chunkSize (Optional) How many bytes to download per chunk (In MB). Defaults to 1 MB.
@muddy-28
muddy-28 / Convert-csv-to-associated-Array.php
Last active July 16, 2016 18:17
Convert a comma separated file into an associated Array | Eagale Solutions
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Function Parameters:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@muddy-28
muddy-28 / ampps-mysql-fix.md
Created November 14, 2016 18:49 — forked from irazasyed/ampps-mysql-fix.md
AMPPS MySQL not working, Solution!
  1. Open Ampps Application -> MySQL Tab -> Configuration.

  2. In [mysqld] section, add the following line: innodb_force_recovery = 1

  3. Save the file and try starting MySQL

  4. Remove that line which you just added and Save.

<?php
/**
* Plugin Name: WooCommerce Display Products by Tags
* Plugin URI: https://wordpress.org/plugins/woocommerce-display-products-by-tags/
* Description: Display WooCommerce products by tags using a shortcode.
* Version: 1.0.0
* Author: Eagale Solutions
* Author URI: http://www.eagalesoft.com
* Developer: Adnan Shafique
* Developer URI: http://www.eagalesoft.com
@muddy-28
muddy-28 / .htaccess
Created April 26, 2017 11:36 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@muddy-28
muddy-28 / gist:0f251c4173ae866d12d494b1faaaef1e
Created May 2, 2017 06:18 — forked from rolandinsh/gist:5143047
Codeigniter file upload permissions (CHMOD)
<?php
$config['upload_path'] = './uploads/'; // upload path
/* OR any oyher form, e.g.:
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/uploads/'; // upload path
*/
$config['allowed_types'] = 'zip'; // array or string of file extensions
$config['max_size'] = '100'; // max file size
$this->load->library('upload', $config); // do the job
$zdata = array('upload_data' => $this->upload->data()); // get data
$zfile = $zdata['upload_data']['full_path']; // get file path
<?php
/** Please excuse this code I wrote in 2011, I'll be updating this post for 2015/6 standards soon */
// clean up the input
if(empty($_GET['text'])) fatal_error('Error: No text specified.') ;
$text = html_entity_decode($_GET['text']).' ' ;
$text = floatval($text);
$text = number_format($text, 1, '.', '') . '%';
@muddy-28
muddy-28 / woocommerce_by_tags.php
Created December 21, 2017 10:51 — forked from bbirdme/woocommerce_by_tags.php
List WooCommerce products by tags
<?php
/**
* Plugin Name: WooCommerce - List Products by Tags
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-tags/
* Description: List WooCommerce products by tags using a shortcode, ex: [woo_products_by_tags tags="shoes,socks"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5