Skip to content

Instantly share code, notes, and snippets.

View natecavanaugh's full-sized avatar

Nate Cavanaugh natecavanaugh

View GitHub Profile
$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);
@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 '/',
@natecavanaugh
natecavanaugh / carousel_fx.js
Last active August 29, 2015 14:00
Carousel FX definitions
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 / 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....
@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');
@natecavanaugh
natecavanaugh / _mixins.scss
Last active December 20, 2015 07:19
improve respond-to mixin
// phone, tablet, desktop
// phone, desktop, tablet
// tablet, phone, desktop
// tablet, desktop, phone
// desktop, phone, tablet
// desktop, tablet, phone
// phone: max-width: 767
// tablet: min-width: 768 - max-width: 979
// desktop: min-width: 980
@natecavanaugh
natecavanaugh / form_navigator_responsive.css
Created July 24, 2013 16:26
Make the form navigator respond to tablets
/* ---------- Form navigator ---------- */
@import "mixins";
@include respond-to(tablet) {
.aui .taglib-form-navigator {
> .tab-content {
clear: both;
float: none;
width: 100%;