Skip to content

Instantly share code, notes, and snippets.

Avatar

Cerys Williams c3ry5

  • London, United Kingdom
View GitHub Profile
View userguid.js
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 Jan 10, 2019
A script to export images in photoshop with max with and file size
View SaveforWebSP.jsx
//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 Dec 19, 2018
Basic Docker Setup for php & MySql with the dependancies for Xenforo
View Dockerfile
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
View macsetup.sh
# 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 Dec 8, 2017 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

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 Oct 5, 2016 — forked from funkman/remove-geometrixx.sh
Remove all geometrixx (and other sample content) from AEM 6.2
View remove-geometrixx.sh
#!/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 Jun 19, 2018
Get request using the AEM sightly Javascript use api
View aem.cq.getRequest.js
"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 Aug 5, 2015
A fix for malformed json
View json.fix.js
JSON.fix = function(obj) {
return obj.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2": ');
};
@c3ry5
c3ry5 / cq.triggercallback.js
Last active Aug 29, 2015
An exjs trigger callback xtype for AEM/CQ
View cq.triggercallback.js
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 Nov 4, 2018
A script to serialize a form using native js - https://codepen.io/anon/pen/VVwopj
View serialize.es6.js
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;