Skip to content

Instantly share code, notes, and snippets.

Nate Cavanaugh natecavanaugh

Block or report user

Report or block natecavanaugh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@natecavanaugh
natecavanaugh / amirunningliferay_chrome.js
Created Jan 29, 2019
Am I Running Liferay (TamperMonkey)
View amirunningliferay_chrome.js
// ==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 Apr 10, 2019
The Lexicon icon design process and guidelines for designers and developers
View Lexicon Icon Design Guidelines.md

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
View JSX.js
'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 Nov 12, 2015
Create a cursory changelog from a git log
View generate_changelog.sh
# 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 Aug 29, 2015
SoyComponent Error Example
View MyComponent.js
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 Aug 29, 2015
Build system for sublime, runs ant deploy-fast when modifying something in portal-web, and ant deploy when modifying something in modules/apps
View Liferay Build System.sublime-build
{
"shell_cmd": "ant deploy${file/.*((.*\\/portal-web\\/)|(\\/modules\\/)).*/(?2-fast:)/}",
"working_dir": "${file/(.*(\\/portal-web\\/|((\\/modules\\/([^\\/]+)\\/)([^\\/]+)\\/)))?.*/$1/}"
}
View osx-for-hackers.sh
#!/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 Aug 29, 2015
Splitting CSS into structure and skin sections using Sublime Text
View Default.sublime-commands
[
{
"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"]}
View plugins.md

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:

View _mixins.scss
$breakpoint_phone: 768px !default;
$breakpoint_tablet: 980px !default;
@mixin respond-to($types...) {
$maxWidth: -1;
$minWidth: -1;
@each $type in $types {
@if $type == phone {
$maxWidth: if($maxWidth == -1, $breakpoint_phone - 1, $maxWidth);
You can’t perform that action at this time.