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
@mckelvey
mckelvey / master-git-ignore
Created November 21, 2010 17:10
This is my best case .gitignore file.
# Services #
############
*.sassc
.sass-cache
# Generic #
###########
/log/*
/tmp/*
/pids/*
# GET /entries/:hashtag/receiver
# POST /entries/:hashtag/receiver.json
def receiver
if request.method == 'GET' and !params['hub.challenge'].blank? and params['hub.mode'] == 'subscribe'
if !params['hub.verify_token'].blank?
game = Game.find_by_token(params['hub.verify_token'])
if !game.nil? and game.hashtag == params[:hashtag]
render :status => 200, :text => params['hub.challenge']
else
InstagaMe::Log.rails "bad token match for #{params['hub.verify_token']}; returning status 406"
@mckelvey
mckelvey / public.application.public_notifier.php
Created July 20, 2012 18:15
PublicNotifier (LiveWhale Application Module)
<?php
$_LW->REGISTERED_APPS['public_notifier']=array(
'title'=>'PublicNotifier',
'handlers' => array('onAfterPublicSubmission')
);
class LiveWhaleApplicationPublicNotifier {
// These two arrays are for including the users and/or groups that