Skip to content

Instantly share code, notes, and snippets.

View saulovenancio's full-sized avatar

Saulo Venancio saulovenancio

View GitHub Profile
@saulovenancio
saulovenancio / component.html
Created December 30, 2019 12:54 — forked from kevinweber/component.html
HTL/Sightly: "Use and call template" pattern. Put template into separate file for reusability, and pass parameters when calling it. Note that in most cases it's not necessary to pass "properties" to the template because they work even if they're not passed explicitly.
<sly data-sly-use.component="template.html"
data-sly-call="${component.template @ properties=properties}" />
@ammmze
ammmze / ConverterDateAndJavaTime.java
Last active June 1, 2023 07:12
opencsv HeaderColumnNameAndOrderMappingStrategy
package com.example.csv;
import com.opencsv.bean.ConverterDate;
import com.opencsv.exceptions.CsvDataTypeMismatchException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import java.util.Locale;
@mistic100
mistic100 / vimeo-downloader.js
Created September 15, 2018 09:01
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
@nateyolles
nateyolles / OsgiServletAnnotation.java
Last active June 23, 2020 07:06
A sample OSGi Declarative Services Servlet Annotation
@Component(
service = Servlet.class,
property = {
"sling.servlet.extensions=html",
"sling.servlet.selectors=foo",
"sling.servlet.paths=/bin/foo",
"sling.servlet.paths=/bin/bar",
"sling.servlet.methods=get",
"sling.servlet.resourceTypes=nt:file",
"sling.servlet.resourceTypes=project/components/component"
@bfosterscripps
bfosterscripps / toggle-touchui-author-bookmarklet.js
Last active August 1, 2018 17:54
Toggle between editing in Touch UI and preview mode on AEM author pages.
(function() {
var newUrl = '',
prevUrl = document.URL,
isWcmmodeDisabled = /wcmmode=disabled/.test(prevUrl);
if (/author\./.test(prevUrl)) {
if (/^.*?\/editor.html/.test(prevUrl)) {
newUrl = prevUrl.replace(/\/editor.html/, '');
if (!isWcmmodeDisabled) {
newUrl = newUrl + ((/\.html\?/.test(newUrl)) ? '&' : '?') + 'wcmmode=disabled';
}
<alignment jcr:primaryType="nt:unstructured"
name="./alignChildren"
fieldLabel="Alignment of components"
required="{Boolean}true"
selectionMode="single"
sling:resourceType="granite/ui/components/coral/foundation/form/buttongroup">
<items jcr:primaryType="nt:unstructured">
<default jcr:primaryType="nt:unstructured"
name="./default"
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 26, 2024 01:50
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@kuckmc01
kuckmc01 / PublishAuditEventListener.java
Created January 19, 2017 15:11
Sample Replication Event Listener
package com.mk.core.services;
import com.adobe.granite.workflow.PayloadMap;
import com.day.cq.replication.ReplicationAction;
import com.day.cq.replication.ReplicationActionType;
import com.day.cq.wcm.api.NameConstants;
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowService;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.exec.WorkflowData;
@wojteklu
wojteklu / clean_code.md
Last active May 4, 2024 22:32
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@subfuzion
subfuzion / curl.md
Last active May 3, 2024 09:26
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.