Skip to content

Instantly share code, notes, and snippets.

View trieloff's full-sized avatar
🏠
Working from home

Lars Trieloff trieloff

🏠
Working from home
View GitHub Profile
@trieloff
trieloff / component.jsp
Created April 11, 2017 10:04
How to get an edit configuration property in JSP
<%@include file="/libs/foundation/global.jsp"%><%
%><%
String url = properties.get("webpage", String.class);
%>
@trieloff
trieloff / cq_dialog.xml
Created April 11, 2017 09:59
A simple AEM dialog definition
<cq:dialog jcr:primaryType="nt:unstructured" jcr:title="Embed" sling:resourceType="cq/gui/components/authoring/dialog">
<content jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<url
jcr:primaryType="nt:unstructured"
fieldDescription="URL of a page that supports oEmbed auto-discovery (e.g. YouTube)"
fieldLabel="Web page address"
name="./webpage"
var request = require('request-promise');
var github = {
token: null,
getUser: function() {
return request({
"method":"GET",
"uri": "https://api.github.com/user",
"json": true,
var github = {
checkLicense: function(uri) {
return request({
"method": "GET",
"uri": uri,
"json": true,
"headers": {
"Authorization": "Bearer " + github.token,
"User-Agent": "My little demo app"
}
var github = {
isPublic: function(repo) {
return !repo.private;
},
isOriginal: function(repo) {
return !repo.fork;
},
licenseUrl: function(repo) {
var github = {
getUserRepos: function(uri, repos) {
return request({
"method": "GET",
"uri": uri,
"json": true,
"resolveWithFullResponse": true,
"headers": {
"Authorization": "Bearer " + github.token,
"User-Agent": "My little demo app"
var github = {
getUserReposUrl: function(user) {
return user.repos_url;
}
};
function main(params) {
github.token = params.token;
return github.getUser()
.then(github.getUserReposUrl);
var request = require('request-promise');
var github = {
token: null,
getUser: function() {
return request({
"method":"GET",
"uri": "https://api.github.com/user",
"json": true,
var request = require('request-promise');
request({
"method":"GET",
"uri": "https://api.github.com/",
"json": true,
"headers": {
"User-Agent": "My little demo app"
}
}).then(console.log, console.log);
var request = require('request-promise');
var github = {
token: null,
getUser: function() {
return request({
"method":"GET",
"uri": "https://api.github.com/user",
"json": true,