Skip to content

Instantly share code, notes, and snippets.

View natecavanaugh's full-sized avatar

Nate Cavanaugh natecavanaugh

View GitHub Profile
<#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 / 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 () {
@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
'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 / generate_changelog.sh
Last active November 12, 2015 19:55
Create a cursory changelog from a git log
# Generates a cursory changelog from all tags in a git log
# All params are optional. If the from param is empty,
# it will create a changelog from all tags
#
# @param from - the tag or git commit to start from
# @param to - the tag or git commit to end at
# @param title - a title to give the log if specifying the previous options
function generate_changelog {
local changes hash log log_title tag tags prev from="$1" to="$2" title nl=$'\n';
@natecavanaugh
natecavanaugh / MyComponent.js
Last active August 29, 2015 14:20
SoyComponent Error Example
import core from 'metaljs/src/core';
import dom from 'metaljs/src/dom/dom';
import SoyComponent from 'metaljs/src/soy/SoyComponent';
import ComponentRegistry from 'metaljs/src/component/ComponentRegistry';
import './MyComponent.soy.js';
class MyComponent extends SoyComponent {
constructor(opt_config) {
super(opt_config);
}
@natecavanaugh
natecavanaugh / Liferay Build System.sublime-build
Last active August 29, 2015 14:19
Build system for sublime, runs ant deploy-fast when modifying something in portal-web, and ant deploy when modifying something in modules/apps
{
"shell_cmd": "ant deploy${file/.*((.*\\/portal-web\\/)|(\\/modules\\/)).*/(?2-fast:)/}",
"working_dir": "${file/(.*(\\/portal-web\\/|((\\/modules\\/([^\\/]+)\\/)([^\\/]+)\\/)))?.*/$1/}"
}
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@natecavanaugh
natecavanaugh / Default.sublime-commands
Last active August 29, 2015 14:10
Splitting CSS into structure and skin sections using Sublime Text
[
{
"caption": "Reg Replace: Clean Skin",
"command": "reg_replace",
"args": {"replacements": ["css_comment_skin_properties", "css_comment_skin_properties_borders", "css_comment_skin_mixins", "css_remove_uncommented_properties", "css_remove_comment_from_property", "css_remove_empty_class_rule", "css_reduce_new_lines"]}
},
{
"caption": "Reg Replace: Clean Structure",
"command": "reg_replace",
"args": {"replacements": ["css_comment_skin_properties", "css_comment_skin_properties_borders", "css_comment_skin_mixins", "css_remove_commented_properties", "css_remove_empty_class_rule", "css_reduce_new_lines"]}

Possible jQuery plugins

I'm contemplating two new jQuery plugins, but wanted some feedback, both on the implementation, as well as if it's worth doing.

Here are the two pieces of functionality/problems I'm hoping to address (and they're somewhat related):

Problem/Feature 1

YUI has a feature in Nodes and NodeLists with .get. It supports both: