Skip to content

Instantly share code, notes, and snippets.

View pixelsoul's full-sized avatar

Oliver Kelso pixelsoul

View GitHub Profile
@pixelsoul
pixelsoul / index.php
Last active May 19, 2020 03:40
Remove duplicates from multidimensional array in PHP
<?php
$array = array(
array("Github","https://github.com"),
array("Pixelsoul","https://pixelsoul.com"),
array("Pixelsoul","https://pixelsoul.com"),
array("Acertus","https://www.acertusdelivers.com"),
array("Github","https://github.com"),
array("YouTube","https://youtube.com"),
array("Acertus","https://metrogistics.com")
);
{"lastUpload":"2022-02-20T19:34:21.587Z","extensionVersion":"v3.4.3"}
@pixelsoul
pixelsoul / slugify.php
Created March 14, 2019 03:54
slugify a string
<?php
function slugify($string){
// trim off hyphens on ends of string
$string = trim($string, '-');
// replace all non-standard characters or numbers
$string = preg_replace('~[^\\pL\d]+~u', '-', $string);
(function(window){
window.htmlentities = {
/**
* Converts a string to its html characters completely.
*
* @param {String} str String with unescaped HTML characters
**/
encode : function(str) {
var buf = [];
@pixelsoul
pixelsoul / robots.php
Created February 12, 2019 04:05
Parse robots.txt file for sitemaps
<?php
function robotsFile($url){
$file = file_get_contents($url);
$pattern = '/Sitemap: ([^\s]+)/';
preg_match_all($pattern, $file, $match);
$results = array();
@pixelsoul
pixelsoul / parseUrl.js
Last active September 28, 2017 20:41
Parse url with JavaScript
function parseUrl(url) {
var parser = document.createElement('a'),
searchObject = {},
queries, split, i;
// Let the browser do the work
parser.href = url;
// Convert query string to object
@pixelsoul
pixelsoul / demo.html
Last active June 15, 2017 23:14 — forked from insin/index.html
jQuery plugin to export a html table to a Excel file.
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>