Skip to content

Instantly share code, notes, and snippets.

View c3ry5's full-sized avatar

Cerys Williams c3ry5

  • London, United Kingdom
View GitHub Profile
var guid = function() {
var nav = window.navigator;
var screen = window.screen;
var guid = nav.mimeTypes.length;
guid += nav.userAgent.replace(/\D+/g, '');
guid += nav.plugins.length;
guid += screen.height || '';
guid += screen.width || '';
guid += screen.pixelDepth || '';
@c3ry5
c3ry5 / SaveforWebSP.jsx
Last active January 10, 2019 16:08
A script to export images in photoshop with max with and file size
//SaveforWebSP.jsx
var docRef = activeDocument;
var outputFolder = docRef.path;
var segments = app.activeDocument.name.split(".");
segments.splice(segments.length - 1, 1);
var docName = segments.join(".");
var fileName = prompt("Please Enter a file name without extension?", docName);
var safeFileName = fileName.replace(/[^A-Z0-9]+/ig, "_");
@c3ry5
c3ry5 / Dockerfile
Created December 19, 2018 11:45
Basic Docker Setup for php & MySql with the dependancies for Xenforo
FROM php:7.1.2-apache
RUN apt-get update && \
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install gd
RUN docker-php-ext-install mysqli
@c3ry5
c3ry5 / macsetup.sh
Last active September 5, 2019 15:19
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Apps
apps=(
java
docker
@c3ry5
c3ry5 / gitflow-breakdown.md
Created December 8, 2017 13:36 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@c3ry5
c3ry5 / remove-geometrixx.sh
Created October 5, 2016 12:19 — forked from funkman/remove-geometrixx.sh
Remove all geometrixx (and other sample content) from AEM 6.2
#!/bin/sh
# UNINSTALL PACKAGES
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/adobe/aem6/sample/we.retail.download-1.0.8.zip?cmd=uninstall
sleep 2
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/adobe/aem6/sample/we.retail.download-1.0.8.zip?cmd=delete
sleep 2
curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/aemfd/cq-geometrixx-gov-pkg-3.0.6.zip?cmd=uninstall
sleep 2
@c3ry5
c3ry5 / aem.cq.getRequest.js
Last active March 15, 2023 04:39
Get request using the AEM sightly Javascript use api
"use strict";
use(function() {
var url = this.api,
getRequest = new org.apache.commons.httpclient.methods.GetMethod(url),
client = new org.apache.commons.httpclient.HttpClient(),
status = new org.apache.commons.httpclient.HttpStatus(),
inputStream;
console.log("Retrieving data from " + url);
try {
var statusCode = client.executeMethod(getRequest);
@c3ry5
c3ry5 / json.fix.js
Created August 5, 2015 12:12
A fix for malformed json
JSON.fix = function(obj) {
return obj.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2": ');
};
@c3ry5
c3ry5 / cq.triggercallback.js
Last active August 29, 2015 14:10
An exjs trigger callback xtype for AEM/CQ
var triggerCallback = CQ.Ext.extend(CQ.Ext.form.TriggerField, {
initComponent: function() {
triggerCallback.superclass.initComponent.call(this)
},
triggerClass: "x-form-search-trigger",
onTriggerClick: function() {
if(this.callback) {
this.callback.call(this);
}
},
@c3ry5
c3ry5 / serialize.es6.js
Last active November 4, 2018 11:07
A script to serialize a form using native js - https://codepen.io/anon/pen/VVwopj
window.serialize = {
simple(form) {
const formel = document.querySelectorAll(form);
const inputs = formel[0].querySelectorAll("input, select, textarea");
const obj = {};
let key;
for (key in inputs) {
if (inputs[key].tagName) {
if (inputs[key].type === "checkbox") {
obj[inputs[key].name] = inputs[key].checked === true ? inputs[key].value : false;