Skip to content

Instantly share code, notes, and snippets.

@marcolink
marcolink / chunkify.js
Last active January 17, 2023 23:46
Create contentful export chunks
/*
For very big spaces, we can create chunks of the export, and import them separately.
To make it work, we have to keep a specific order.
*/
const fs = require('fs');
const path = require('path');
/* the order of types must be kept */
const types = [
@hyle
hyle / ko.utils.3.5.0.signatures.js
Created September 25, 2018 09:09
KnockoutJS 3.5.0 utils (ko.utils) signatures
// knockout 3.5.0
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
@LeiZeng
LeiZeng / .babelrc
Last active November 8, 2019 18:56
YUI compressor error from babel export default
{
"presets":["es2015"],
"plugins": [
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}
@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active March 12, 2024 15:59 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@schickling
schickling / _README.md
Last active January 4, 2024 09:37
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@nateyolles
nateyolles / SlingResourceResolutionServlet.java
Created October 9, 2015 04:29
Get the HTML markup for a resource in Apache Sling.
package com.nateyolles.sling;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.engine.SlingRequestProcessor;
@afolarin
afolarin / docker-log-gist.md
Last active March 16, 2023 13:02
docker-logs
@trekawek
trekawek / brokenLinks.groovy
Created October 4, 2014 07:27
Following groovy script finds broken internal links under the given site
@floriankraft
floriankraft / JcrQueryLibrary.md
Last active May 3, 2024 05:50
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path

@bvaughn
bvaughn / overview-for-angular-apps-with-roles-and-permissions.md
Last active April 28, 2017 11:51
RE: Reddit Angular JS question "Advice on separating the logical parts of an application"

This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.

There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...

A local session service

First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.

Let's assume yo