Skip to content

Instantly share code, notes, and snippets.

@mckelvey
mckelvey / public.application.time_formatter.php
Last active August 29, 2015 13:56
This tiny LiveWhale application module alters the time and meridian formatting from the PHP-based LiveWhale defaults.
<?php
$_LW->REGISTERED_APPS['time_formatter']=array(
'title'=>'Time Formatter',
'handlers'=>array('onWidgetFormat'),
);
class LiveWhaleApplicationTimeFormatter {
public function onWidgetFormat($type, $handler, $variables) { // alter widget variables
@mckelvey
mckelvey / public.application.short_summary.php
Last active August 29, 2015 13:56
This tiny LiveWhale application module limits the length of the summary to 90 words.
<?php
$_LW->REGISTERED_APPS['short_summary']=array(
'title'=>'Short Summary',
'handlers'=>array('onWidgetFormat'),
);
class LiveWhaleApplicationShortSummary {
public function onWidgetFormat($type, $handler, $variables) { // alter widget variables
@mckelvey
mckelvey / private.application.community_public_group.php
Created March 3, 2014 22:24
How to use the Public group for LDAP/SSO community submissions.
<?php
$_LW->REGISTERED_APPS['community_public_group'] = array( // configure this application module
'title' => 'Community Public Group',
'handlers' => array(
'onLoad',
'onLoginSuccess',
'onLoginFailure',
'onSubnavs',
'onManagerQuery',
// Generated by CoffeeScript 1.4.0
(function() {
var PreProcessor;
PreProcessor = (function() {
/*
from: https://github.com/sockjs/sockjs-node/commit/e0e7113f0f8bd8e5fea25e1eb2a8b1fe1413da2c
from: https://github.com/sockjs/sockjs-client/blob/a571c94e051de7af489b4fc541194956e1d171fe/lib/utils.js
*/
@mckelvey
mckelvey / profile.php
Last active August 29, 2015 13:57
This simple module and xphp snippet produce a link to edit the profile being viewed on any profiles details page regardless of login status.
...
<xphp content="true">
<if var="profiles_edit_link"/>
<content>
<div class="profiles_edit_link">
<xphp var="profiles_edit_link" inner="true"/>
</div>
</content>
</xphp>
@mckelvey
mckelvey / private.application.custom_fields.php
Created April 2, 2014 00:20
This Alex-made™ code demonstrates how to use five handlers to get and set a custom field on an existing LiveWhale datatype.
<?php
/*
This is a sample application designed to demonstrate how to add an additional custom field to a backend editor.
The example provided adds a "Dress Code" field to the existing event editor in LiveWhale. To add a custom field to the news editor, for example, follow the same example but change all references from events to news below.
*/
@mckelvey
mckelvey / gist:657a5c86b4429ac951d8
Created July 7, 2015 20:29
How to collect all Material Design SVGs into a single folder...
# Inside the repo root
$ mkdir svg-collected
$ find . -type f -iname '*_48px.svg' -exec cp {} ~/Desktop/material-design-icons-2.0/svg-collected/ \;
# Rename the Filenames
$ for i in *_48px.svg; do mv -- "$i" "${i/_48px/}"; done
$ for i in ic_*; do mv -- "$i" "${i/ic_/}"; done
$ for i in *_*; do mv -- "$i" "${i/_/ }"; done

Keybase proof

I hereby claim:

  • I am mckelvey on github.
  • I am mckelvey (https://keybase.io/mckelvey) on keybase.
  • I have a public key whose fingerprint is 6C10 B568 D534 3F3A EF3B C6E1 02CF 9F99 0275 F076

To claim this, I am signing this object:

/* replaces lines 18985-19057 of HTMLPurifier.standalone.php v.4.9.3 */
/**
* @param DOMNode $node
*/
protected function getTagName($node)
{
if (property_exists($node, 'tagName')) {
return $node->tagName;
} else if (property_exists($node, 'nodeName')) {
@mckelvey
mckelvey / wget.sh
Last active August 6, 2022 14:45 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
wget --recursive --no-clobber --page-requisites --adjust-extension --span-hosts --convert-links --no-parent --no-check-certificate -erobots=off --domains yoursite.com yoursite.com/whatever/path