Skip to content

Instantly share code, notes, and snippets.

View a10k's full-sized avatar

Alok Pepakayala a10k

View GitHub Profile
@codediodeio
codediodeio / database.rules.json
Last active June 1, 2024 14:26
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@mickleroy
mickleroy / CORSFilter.java
Created February 4, 2017 22:18
Sets Access-Control headers in AEM for Cross Origin Resource Sharing
package com.github.mickleroy.models;
import org.apache.felix.scr.annotations.sling.SlingFilter;
import org.apache.felix.scr.annotations.sling.SlingFilterScope;
import org.apache.sling.api.SlingHttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import java.io.IOException;
@mbostock
mbostock / .block
Last active January 14, 2023 04:21
Screen Recording to GIF
license: gpl-3.0
@mbostock
mbostock / .block
Last active April 24, 2023 22:16 — forked from mbostock/.block
Clustered Force Layout III
license: gpl-3.0
@rosszurowski
rosszurowski / lerp-color.js
Last active March 3, 2023 12:14
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hexadecimal colors
* @param {String} a
* @param {String} b
* @param {Number} amount
* @example
* // returns #7F7F7F
* lerpColor('#000000', '#ffffff', 0.5)
* @returns {String}
*/
@atenni
atenni / README.md
Last active June 17, 2024 02:30
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@samhernandez
samhernandez / gist:5260558
Last active September 24, 2019 11:58
Get an RSS pubDate from a Javascript Date instance.
/**
* Get an RSS pubDate from a Javascript Date instance.
* @param Date - optional
* @return String
*/
function pubDate(date) {
if (typeof date === 'undefined') {
date = new Date();
}