Skip to content

Instantly share code, notes, and snippets.

View natecavanaugh's full-sized avatar

Nate Cavanaugh natecavanaugh

View GitHub Profile
#!/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 / 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/}"
}
@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 / 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';
'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 / 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 () {
<#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)>