Skip to content

Instantly share code, notes, and snippets.

@lumivient
lumivient / csv-intersection.php
Last active June 4, 2019 01:25
Find the value at an intersection of a CSV file when given column and row headings
<?
/**
* Finds the value of an intersection of a CSV file
* when given column and row headings
*
* @param string $file Path to CSV file
* @param string $column Column heading to search by
* @param string $row Row heading to search by
*/
@lumivient
lumivient / SpeechSynthesis.html
Last active November 18, 2015 18:16
Demo of the Speech Synthesis API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Speech Synthesis Test</title>
<style>
* { box-sizing: border-box; }
body { font-family: sans-serif; }
#left, #right { width: 50%; padding: 1em; }
#left { float: left; }
@lumivient
lumivient / zendesk-newlines.js
Created November 19, 2015 09:54
Makes ZenDesk honour newlines added to field descriptions
setTimeout(function () {
var descriptions = $(".form-field p");
descriptions.each(function (index, value) {
$(this).html($(this).html().replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "<br>"));
});
}, 10);
@lumivient
lumivient / readme.md
Created November 21, 2015 11:54
Responsive Captivate template

Responsive Captivate

Responsive template for Adobe Captivate projects.

Installation

Move standard.htm to the following two locations, backing-up the original files:

  • C:\Program Files (x86)\Adobe\Adobe Captivate 5\Templates\Publish\
  • C:\Program Files (x86)\Adobe\Adobe Captivate 5\Templates\Publish\SCORM\1_2\
@lumivient
lumivient / countries.md
Last active November 20, 2025 19:18
ISO 3166 countries by region — AMER, EMEA & APAC
Country ISO 3166 Region
Afghanistan AF EMEA
Åland Islands AX EMEA
Albania AL EMEA
Algeria DZ EMEA
American Samoa AS APAC
Andorra AD EMEA
Angola AO EMEA
Anguilla AI AMER
@lumivient
lumivient / .htaccess
Last active April 16, 2016 07:17
Clean URLs
<IfModule mod_rewrite.c>
# Force https
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove www.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@lumivient
lumivient / regex-curriculum.md
Created April 16, 2016 07:45
Regex Curriculum

Basics

  • Text match
  • Asterisks & Pluses
  • Question Marks
  • Pipe Options
  • Character Groups
  • Character Ranges
  • Range Shorthand
  • Counting Characters
  • Replacement
# ~/.bas_aliases
alias l="ls -alhgc"
alias update="sudo apt-get update && sudo apt-get upgrade"
alias apache="sudo service apache2"
alias google-chrome="google-chrome-stable"
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n"
# Make list of installed locales the same as all supported locales
sudo cp /usr/share/i18n/SUPPORTED /var/lib/locales/supported.d/local
# Generates locales
sudo locale-gen
# List installed locales
locale -a
<?php
define('ABSPATH', '/var/www/wordpress/');
require ABSPATH.'wp-includes/pluggable.php';
echo wp_hash_password('new_password');