Skip to content

Instantly share code, notes, and snippets.

View gemmadlou's full-sized avatar

Gemma Black gemmadlou

View GitHub Profile
@gemmadlou
gemmadlou / alert.js
Last active April 11, 2018 12:59
Alert
console.log('Hi')
document.querySelector('body').innerHTML += 'xss';
@gemmadlou
gemmadlou / WYSIWYG-character-counter-for-wp.js
Last active April 12, 2018 10:38
WYSIWYG character counter for wordpress
/**
* WYSIWYG character counter for WordPress
* First iteration unfortunately involves listening for a jQuery
* event. There doesn't appear to be another way without creating adding
* functionality to tinymce
*
* @link https://amystechnotes.com/2015/05/06/tinymce-add-character-count/
*/
@gemmadlou
gemmadlou / nginx-example-config.conf
Last active April 12, 2018 20:18
nginx Example config for wp
server {
listen 80;
server_name somesite.com;
root /var/www/vhosts/somewebsite/public;
# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
@gemmadlou
gemmadlou / partial-application-saves-the-day.md
Last active April 13, 2018 22:29
Partial Application Saves The Day

Partial Application Saves The Day

The Problem

I want to return errors in Javascript, and not throw them. This is the pure functional way. However, Javascript is not a pure functional programming language. Even if I anticipate some errors, run-time errors might creep in. Take this example.

let person = args = ({ name: args.name })
@gemmadlou
gemmadlou / books-and-reads.md
Created April 14, 2018 16:12
Developers Might Just Make Half Decent Designers If They Apply The Logic
@gemmadlou
gemmadlou / 1-why.md
Created April 16, 2018 11:34
Easy FB Share

Easy FB Share

You can create a facebook share button with a simple link. You can even generate a simple link using one of the many link generators: http://www.sharelinkgenerator.com. However, if you want more control over your share button dialog boxes that are opened, you will need to use the Facebook SDK.

Even more so, if you use WordPress' yoast plugin, or already have og meta tags on your page, you can configure how your facebook share dialogues look through this.

@gemmadlou
gemmadlou / Docker-Production.md
Last active February 15, 2021 11:51
Test Markdown Checklist
  • [] Logging goes to stdout
  • [] Trivy for security
  • [] Readme has production release notes
  • [] Simple commands to make docker easier
  • [] Have a small image < 200MB if possible, < 100MB is better, < 60 is best :tada
  • [] Handle errors with 5xx
  • [] Ensure sessions are in database
  • [] Ensure no files are saved in container and are persisted in a remote object store (s3)
  • [] Setup container image repository
  • Handle signals in nodejs gracefully if needed (https://medium.com/better-programming/docker-for-node-js-in-production-b9dc0e9e48e0)
@gemmadlou
gemmadlou / command-piping-linux.md
Created April 18, 2018 14:37
Command piping linux
@gemmadlou
gemmadlou / requirements-gathering.md
Last active April 19, 2018 10:39
Requirements Gathering

Requirements Gathering

  • Get a list of current functionalities, libraries, plugins, external tools that are in use.
  • Find out why these tools where used?
  • Based on the whys provided, request if these tools, functionalities etc are still needed?

Find out what the client wants you to build

  • Get their solution perspective
  • Take a step back and find out what problem the client has. There might be a better solution
@gemmadlou
gemmadlou / UserSingleton.php
Created April 23, 2018 10:21 — forked from amacgregor/UserSingleton.php
PHP Singleton pattern example
<?php
/** Example taken from http://www.webgeekly.com/tutorials/php/how-to-create-a-singleton-class-in-php/ **/
class User
{
// Hold an instance of the class
private static $instance;
// The singleton method