Skip to content

Instantly share code, notes, and snippets.

View natecavanaugh's full-sized avatar

Nate Cavanaugh natecavanaugh

View GitHub Profile
@natecavanaugh
natecavanaugh / gist:6284612
Created August 20, 2013 17:34
main.js control panel
Liferay.Util.portletTitleEdit = function() {
};
if (!themeDisplay.isStatePopUp()) {
AUI().ready('aui-live-search', 'aui-overlay-context-panel', 'event-mouseenter', 'liferay-message', 'liferay-panel', 'liferay-store', 'node-focusmanager', 'transition',
function(A) {
var body = A.getBody();
var portletInformationEl = A.one('#cpContextPanelTemplate');
var portletInformationIcon = A.one('#cpPortletTitleHelpIcon');
;(function(A) {
Liferay.on(
'chatPortletReady',
function(event) {
var Chat = Liferay.Chat;
Chat.ConversationPanel = Chat.Conversation;
Chat.Conversation = function(){
// code before constructor....
@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',
@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',
var pieChart = A.Widget.getByNode($0);
var graphic = pieChart.get("graph").get("graphic");
var width = graphic.get('width'), height = graphic.get('width');
var newWidth = width - 100, newHeight = height - 100;
var circle = graphic.addShape({type: 'circle',
width: newWidth,
height: newHeight,
x: 100,
y: 100,
fill: {color: '#ffffff'},
@natecavanaugh
natecavanaugh / carousel_fx.js
Last active August 29, 2015 14:00
Carousel FX definitions
@natecavanaugh
natecavanaugh / up.sh
Last active August 29, 2015 14:01
up function
# Convenience function for moving up levels in the path to the current working directory.
# Synopsis:
# `up [n]` moves n levels up in the directory hierarchy; default is 1.
# `up dirname` changes to the closest ancestral directory by that name, regardless of case.
# `up absolutepath` changes to the specified absolute path; primarily used with command completion (see below).
# Additionally, if command completion via _complete_up() is in effect (<tab> represents pressing the tab key):
# `up [n]<tab>` replaces n with the absolute path of the directory n levels up (default is 1).
# `up dirnameprefix<tab>` replaces dirnameprefix with the absolute path of the closest ancestral directory whose name starts with the specified name prefix, terminated with '/'.
# Whether dirnameprefix is matched case-insensitively or not depends on whether case-insensitive command completion is turned on globally via ~/.inputrc or /etc/inputrc.
# In both cases the completed absolute path ends in '/',
$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);

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:

@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"]}