Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jeton R. jetonr

🏠
Working from home
View GitHub Profile
View airquality.html
<div class="reading-box">
<div class="title">
<a id="pollutants_link" onclick="javascript:activeReading('pollutants')" class="active">Pollutants</a></div>
<div class="pollutants" style="display:block;">
<div class="pollutant-item">
<div class="name">PM10</div>
<div class="unit">μg/m³</div>
<div class="value">87</div>
<div class="ratio-bar" style="background:#EB3737; width:calc(100%*0.83194446563721);"></div>
<div class="ratio-bar-bg"></div>
View smartReadFile.php
<?php
/**
* Reads the requested portion of a file and sends its contents to the client with the appropriate headers.
*
* This HTTP_RANGE compatible read file function is necessary for allowing streaming media to be skipped around in.
*
* @param string $location
* @param string $filename
* @param string $mimeType
* @return void
@jetonr
jetonr / wordcount.php
Created November 26, 2018 22:28
Word Count From Word Docs
View wordcount.php
<?php
function read_docx($filename){
$striped_content = '';
$content = '';
if(!$filename || !file_exists($filename)) return false;
$zip = zip_open($filename);
@jetonr
jetonr / coderbyte.php
Created November 26, 2018 21:24
PHP Simple Algorithms - Coderbyte.com
View coderbyte.php
<?php
function NumberEncoding( $str ) {
$albphabet = range('a','z');
$arrStr = str_split( strtolower( $str ) );
$newArr = array();
foreach( $arrStr as $key => $value ) {
View wp_install.sh
#!/bin/bash
# This script installs WordPress from Command Line.
#Colors settings
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
@jetonr
jetonr / pdf_parser.php
Last active July 29, 2016 14:02
pdf parser
View pdf_parser.php
<?php
include 'vendor/autoload.php';
ini_set('memory_limit','1024M');
ini_set('max_execution_time', 300);
//var_dump(pages_text('42.pdf',50,202));
var_dump(text_to_array('42.pdf.txt'));
View countries_json.php
<?php
$returnValue = json_decode(' {"countries":[["AF","Afghanistan"],["AL","Albania"],["DZ","Algeria"],["AS","American Samoa"],["AD","Andorra"],["AO","Angola"],["AI","Anguilla"],["AQ","Antarctica"],["AG","Antigua and Barbuda"],["AR","Argentina"],["AM","Armenia"],["AW","Aruba"],["AU","Australia"],["AT","Austria"],["AZ","Azerbaijan"],["BS","Bahamas"],["BH","Bahrain"],["BD","Bangladesh"],["BB","Barbados"],["BY","Belarus"],["BE","Belgium"],["BZ","Belize"],["BJ","Benin"],["BM","Bermuda"],["BT","Bhutan"],["BO","Bolivia"],["BQ","Bonaire, Sint Eustatius and Saba"],["BA","Bosnia and Herzegovina"],["BW","Botswana"],["BV","Bouvet Island"],["BR","Brazil"],["IO","British Indian Ocean Territory"],["VG","British Virgin Islands"],["BN","Brunei"],["BG","Bulgaria"],["BF","Burkina Faso"],["BI","Burundi"],["KH","Cambodia"],["CM","Cameroon"],["CA","Canada"],["CV","Cape Verde"],["KY","Cayman Islands"],["CF","Central African Republic"],["TD","Chad"],["CL","Chile"],["CN","China"],["CX","Christmas Island"],["CC","Cocos Islands"],["C
View cities_balkan.php
<?php
// Array With Kosovo Neighbours and their cities
function all_cities_array() {
return array(
"albania" => array(
array(
'city_name' => 'Ballsh',
'city_slug' => 'ballsh'
@jetonr
jetonr / neighbours.php
Last active August 29, 2015 14:08
Country Neighbours Array
View neighbours.php
<?php
function sc_embassy_countries() {
return array("Afghanistan","Albania","Algeria","Andorra","Angola","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Cyprus","Czech Republic","Democratic Republic of Congo","Denmark","Djibouti","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Greenland","Grenada","Guatemala","Guinea","Guinea - Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Ivory Coast","Jamaica","Japan","
@jetonr
jetonr / array_from_csv.php
Created October 26, 2014 23:53
echo array from csv file
View array_from_csv.php
function world_cities(){
$csv = array_map( 'str_getcsv', file( plugin_dir_path( __FILE__ ) . 'data/countries_bordered1.csv', FILE_SKIP_EMPTY_LINES ) );
$headers = $csv[0];
unset($csv[0]);
$rowsWithKeys = [];
foreach ( $csv as $row ) {
$newRow = [];
foreach ( $headers as $k => $key ) {