Skip to content

Instantly share code, notes, and snippets.

View kand's full-sized avatar
🏝️
Focusing

Andrew Kos kand

🏝️
Focusing
View GitHub Profile
@kand
kand / dev_setup.md
Last active March 20, 2019 20:10
Dev Environment

Hey all, here are some of the tools I presented from my dev environment, I hope you can find some of these useful! Also, if you have suggestions, fixes, improvements etc. I’d love to hear them!

Command Line Tools

  • ag - Search tool that's fast and does pretty much anything you could hope for with a search tool.
  • fzf - A better version of ctrl-r backwards history search. It has a lot of other functionality as well that I'm not even really sure about!
  • hub - Tons of aliases for git commands and the ability to go from your command line to the repository.
  • tmux - This is a nice windowing program for the terminal in my keyboard-shortcut-heavy environment.

Custom Command Line Tools

var testPalindromicity = function (num) {
var strNum = '' + num;
for (var i = 0; i <= strNum.length / 2; i++) {
if (strNum[i] !== strNum[strNum.length - i - 1]) {
return false;
}
}
return true;
};
@kand
kand / requirements.txt
Created October 17, 2014 18:29
Django requirements.txt using git commit hash
-e git://github.com/<organization>/<repo>.git@<commit_hash>#egg=<repo>
@kand
kand / ServiceUtil.java
Created June 11, 2014 21:02
In cases where there is no incoming request, you can retrieve a registered OSGi service through the current class' BundleContext. Provide ServiceUtil.getService() with the class of the service you wish to retrieve.
/**
* Methods for interacting with services.
*/
public final class ServiceUtil {
private ServiceUtil() {
// private constructor for utility class
}
@kand
kand / _cq_editConfig.xml
Last active August 29, 2015 13:57
In some cases, a component does not need to have a target button in its edit bar. To deactivate the Target button for a component, the cq:disableTargeting property must be set.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:EditConfig"
cq:disableTargeting="true">
<!-- rest of config goes here -->
</jcr:root>
@kand
kand / Nested Paragraph Systems in CQ5
Last active December 2, 2022 21:17
Sometimes nested paragraph systems are needed for special layout type components in CQ5. Here is a custom paragraph system that will overcome the issues related to nesting out of the box paragraph systems.
Set up your file structure for the innerParsys component:
innerParsys
-> parsys
-> new
- _cq_editConfig.xml
- .content.xml
- _cq_editConfig.xml
- .content.xml
- parsys.jsp
@kand
kand / Custom Sidekick Dialog in CQ5
Last active December 1, 2017 06:28
Add a custom dialog as an option in the sidekick. customSidekickDialog.js will add another action to the DEFAULT_ACTIONS list for the sidekick. In this example, the action will open a dialog but, in practice, you could put any action you wanted in the handler. launchSidekick.js is Javascript that should replace the Javascript in your project tha…
Set up your file structure something like this:
/apps/your-site/components/page
-> yourPage
-> clientlibs
-> js
-> customSidekickDialog.js
-> .content.xml
-> js.txt
-> customDialog.xml