Skip to content

Instantly share code, notes, and snippets.

View lokothodida's full-sized avatar

Lawrence Okoth-Odida lokothodida

View GitHub Profile
@lokothodida
lokothodida / README.md
Last active March 25, 2016 19:46
GetSimple Theme Developer Language Helper Functions

GetSimple Theme Developer Language Helper Functions

Allows GetSimple theme designers to have theme-dependent language strings in a lang folder of their theme.

Usage

  1. Add language_functions.php (from this gist) to your current theme's folder.
  2. Create a lang folder in your current theme
  3. Create language files for your theme with file names corresponding to language codes:
@lokothodida
lokothodida / README.md
Last active March 26, 2016 10:45
GetSimple Tutorial: Setting up a Plugin Development Environment

GetSimple Tutorial: Setting up a Plugin Development Environment

These are the steps I take for setting up an environment for developing GetSimple plugins. It allows me to Keep my individual plugin's repository separate from the plugins folder.

  1. Install GetSimple to your desired root directory (for now we will refer to it as root/).
  2. Create your plugin's working directory/clone your repository to the root/ directory.
  3. Symbollically the plugin's registration file and assets folders to the plugins directory:
@lokothodida
lokothodida / powerset.iterative.js
Last active August 10, 2017 01:11
Javascript implementation(s) of a Power Set function
/* Calculates the power set, P(s) := { s' : s' is a subset of s }
* Assumes an implementation of a Set that has the following methods:
* add, equals, forEach, clone
*/
var powerSet = function(set) {
var prevSet = new Set(); // prevSet := {}
var currSet = new Set().add(new Set()); // currSet := { {} }
// Main loop will continually add elements to currSet until no
// new elements are added
@lokothodida
lokothodida / getsimple-tutorial-shortcodes.md
Last active December 18, 2017 04:56
GetSimple tutorial for adding shortcode-like to the admin panel.

GetSimple Tutorial: Shortcodes

Sometimes you have content that you want to place onto a page that requires a bit of messy HTML, CSS and PHP coding. This can be very frustrating when there are multiple occurrences of said piece of content within your page, and when each occurrence requires something different about it. What is even worse is when the person who needs to manipulate this content isn't very confident with the above markup (HTML, CSS) and code (PHP) languages, yet they need to be able to edit the necessary pieces without breaking a crucial piece of the markup. Wouldn't it be great if GetSimple had such a function?

Other content management systems such as forums and Wordpress do have such functions, called BBCode and Shortcodes respectively, which allow for dynamic content to be output on pages without knowledge of the messy code that goes in beforehand. For example, on forums you can often place a link on the page by simply using [url][/url] tags instead of knowing how to use HTML anchors and p

@lokothodida
lokothodida / getsimple-tutorial-i18n-randomize-results.md
Last active February 7, 2019 12:11
GetSimple tutorial on providing random search results for i18n search.

Ever wanted to have random items put into the search results pulled from I18N Search?

It's actually not that difficult. The technique hinges on the return_i18n_search_results function, specifically designed for doing custom results rendering.

We call the function with the desired paramters to get the results. To ensure a properly random selection, we'll set the maximum number of results to a high number (e.g. 999).

$search = return_i18n_search_results($tags, $words, 0, 999, $order, $lang);
@lokothodida
lokothodida / getsimple-tutorial-i18n-blog-system.md
Last active March 24, 2019 14:40
GetSimple Tutorial for creating a blog with the I18N plugin(s)

GetSimple Tutorial: Creating a blog with the I18N plugin(s)

Ever wanted to have a complete blogging module for GetSimple? Did you know that such a feat is achievable through the use of a number of GetSimple plugins? Look no further than this tutorial in order to discover how to construct such a module yourself!

Plugins that you need

@lokothodida
lokothodida / README.md
Last active October 20, 2021 10:11
Small bookmarklet to help change app drawer icons for Chrome OS web apps
  • Create a bookmark with the following text in the URL field:
javascript:(function() {
  if (!document.querySelectorAll('link[rel*=icon]').length) {
      const link = document.createElement('link');
      link.rel   = 'icon';
      document.querySelector('head').appendChild(link);
  }