Skip to content

Instantly share code, notes, and snippets.

View jetonr's full-sized avatar
🏠
Working from home

Jeton R. jetonr

🏠
Working from home
View GitHub Profile
@jetonr
jetonr / neighbours.php
Last active August 29, 2015 14:08
Country Neighbours Array
<?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","
<?php
// Array With Kosovo Neighbours and their cities
function all_cities_array() {
return array(
"albania" => array(
array(
'city_name' => 'Ballsh',
'city_slug' => 'ballsh'
<?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
@jetonr
jetonr / pdf_parser.php
Last active July 29, 2016 14:02
pdf parser
<?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'));
@jetonr
jetonr / array_from_csv.php
Created October 26, 2014 23:53
echo array from csv file
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 ) {
@jetonr
jetonr / coderbyte.php
Created November 26, 2018 21:24
PHP Simple Algorithms - Coderbyte.com
<?php
function NumberEncoding( $str ) {
$albphabet = range('a','z');
$arrStr = str_split( strtolower( $str ) );
$newArr = array();
foreach( $arrStr as $key => $value ) {
@jetonr
jetonr / wordcount.php
Created November 26, 2018 22:28
Word Count From Word Docs
<?php
function read_docx($filename){
$striped_content = '';
$content = '';
if(!$filename || !file_exists($filename)) return false;
$zip = zip_open($filename);
<?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
<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>
#!/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