Skip to content

Instantly share code, notes, and snippets.

View ryanschuhler's full-sized avatar

Ryan Schuhler ryanschuhler

View GitHub Profile
@ryanschuhler
ryanschuhler / gist:5095848
Created March 6, 2013 00:56
Here is a script I wrote to find and replace things on linux. You might be able to modify it for windows if you install perl, but Im not sure.
#!/usr/bin/perl
print "Find\n"; ##this defines what you are searching for, it will be inserted into a regex expression, so escape character if needed
$test1 = <STDIN>;
chomp $test1;
print "Replace\n"; ##this defines what you will replace the previous string with, also in regex so escape special characters
$test2 = <STDIN>;
chomp $test2;
print "Where\n"; ##where you want it to look. ie. ~/Desktop/test (this will search all files in the directory and its subdirectories)
@ryanschuhler
ryanschuhler / gist:5320646
Created April 5, 2013 16:27
A simple javascript to make a menu (or anything) appear on click and disappear when anything else is clicked.
var A = AUI();
var docClick = function () {
if (A.one('.pop-click')) {
A.one('.pop-click').removeClass('pop-click');
document.removeEventListener('click', docClick, true);
}
}
A.all('.pop-clickable').each(
@ryanschuhler
ryanschuhler / lazyLoad
Last active December 16, 2015 08:58
lazy load javascript idea
var A = AUI();
var lazyLoadObj = A.all('.lazy-load');
var winHeight = window.innerHeight;
var getCumulativeOffset = function (obj) {
var top = 0;
if (obj.offsetParent) {
do {
@ryanschuhler
ryanschuhler / gist:5732772
Created June 7, 2013 22:12
agenda pull template
<style type="text/css">
.printer-link {
display: block;
float: right;
padding-bottom: 1px;
width: 60px;
}
.print-text {
padding-left: 5px;
@ryanschuhler
ryanschuhler / gist:5732780
Created June 7, 2013 22:13
Sortable Events Alloy
#set ($ns = $request.portlet-namespace)
#set ($companyId = $getterUtil.getLong($request.theme-display.company-id))
#set ($scopeGroupId = $getterUtil.getLong($request.theme-display.scope-group-id))
#set ($jsLogging = $getterUtil.getBoolean($javascript-logging-enabled.data))
#set ($defaultEventType = $getterUtil.getString($default-event-type.data, 'All'))
#set ($pathThemeImages = $request.theme-display.path-theme-images)
#set ($languageId = $request.theme-display.language-id)
#set ($defaultRegion = $getterUtil.getString($httpUtil.getParameter(${request.attributes.CURRENT_URL}, 'wcd-region', false), 'All'))
@ryanschuhler
ryanschuhler / gist:5749775
Last active December 18, 2015 07:49
isOnScreen
AUI().use(
'aui-base',
'event-base',
'transition',
function(A) {
var body = A.getBody();
var WIN = A.getWin();
var toggle = A.one('#toggle');
var topNav = A.one('#topNavigation');
@ryanschuhler
ryanschuhler / Hudcrumbs
Created June 21, 2013 23:52
Liferay AUI Sticky-nav with hudcrums.
AUI().use(
'liferay-hudcrumbs',
function(A) {
var navigation = A.one('#navigation');
if (navigation) {
navigation.plug(A.Hudcrumbs);
}
}
);
@ryanschuhler
ryanschuhler / lazy-load.js
Last active March 8, 2023 22:01
This is a function which can be used to lazy-load images or content onto the page. Essentially you give the respective node the class "lazy-load" and the class "lazy-loaded" will be added once the user scrolls to that node. Also if you give the class to an image and place the "src" in a "datasrc" attribute instead, it will switch it to source wh…
AUI().use(
'aui-base',
function(A) {
var WIN = A.getWin();
var lazyLoadNode = A.all('.lazy-load');
var lazyLoad = function() {
var currentScrollPos = WIN.get('docScrollY');
@ryanschuhler
ryanschuhler / on-screen-helper.js
Last active December 18, 2015 19:48
This script is used when a node has the class "on-screen-helper". When the node hits the bottom of the screen, it will add the class "on-screen-bottom" , when the node hits the top of the screen it will add the class "on-screen-top" and when the node has completely left the screen it removes both classes. This is useful for both timing animation…
AUI().use(
'aui-base',
function(A) {
var WIN = A.getWin();
var onScreenHelperNode = A.all('.on-screen-helper');
var updateOnScreen = function() {
var currentScrollPos = WIN.get('docScrollY');
@ryanschuhler
ryanschuhler / pop-click.js
Created June 22, 2013 00:11
This script toggles the class "pop-click-active" on any div with the class "pop-click" when it is clicked. When the user clicks anywhere on the screen that is not tagged with "pop-click-content", it will then remove the class. This is helpful for things like menus that will appear when something is clicked and disappear when they are clicked off…
AUI().use(
'aui-base',
function(A) {
var popClicks = A.all('.pop-click');
var popClickHandle;
var togglePopClick = function(event) {
event.stopPropagation();