Skip to content

Instantly share code, notes, and snippets.

View goldingdamien's full-sized avatar

Damien Golding goldingdamien

View GitHub Profile
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@digitaljhelms
digitaljhelms / gist:4287848
Last active July 7, 2025 14:58
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@tonysm
tonysm / UsuariosController.php
Last active June 3, 2022 13:00
dynamically creating inputs with CakePHP and jQuery
<?php
/**
* Controller de usuários
*/
class UsuariosController extends AppController
{
public function index()
{
if(isset($this->request->data) && $this->request->is('post')) {
@a1phanumeric
a1phanumeric / gist:5346170
Created April 9, 2013 14:35
Grep exclusions. Demonstrates how to exclude multiple directories, and files.
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
@jdevalk
jdevalk / .htaccess
Last active January 7, 2025 07:26
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>
@nikmartin
nikmartin / A: Secure Sessions Howto
Last active January 7, 2025 13:29
Secure sessions with Node.js, Express.js, and NginX as an SSL Proxy
Secure sessions are easy, but not very well documented.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT]
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now.
@bosskovic
bosskovic / example.po
Last active March 14, 2022 09:43
A simple example of a PO file
msgid ""
msgstr ""
"Project-Id-Version: Lingohub 1.0.1\n"
"Report-Msgid-Bugs-To: [email protected] \n"
"Last-Translator: Marko Bošković <[email protected]>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
@luckyshot
luckyshot / abusecheck.php
Last active April 28, 2023 07:46
Throttle client requests to avoid DoS attack (scroll down for IP-based)
<?php
/**
ABUSE CHECK
Throttle client requests to avoid DoS attack
*/
session_start();
$usage = array(5,5,5,5,10,20,30,40,50,60,120,180,240); // seconds to wait after each request
if (isset($_SESSION['use_last'])) {
$nextin = $_SESSION['use_last']+$usage[$_SESSION['use_count']];
@docluv
docluv / gist:6661473
Created September 22, 2013 16:19
Internet Explorer Meta Tags
<meta name="msapplication-allowDomainMetaTags" content="true">
<meta name="msapplication-config" content="http://love2dev.com/livetile.xml" />
<meta name="msapplication-navbutton-color" content="#990000">
<meta name="msapplication-TileColor" content="#000000" />
<meta name="msapplication-TileImage" content="img/love2devlogo.png" />
<meta name="msapplication-square70x70logo" content="img/tinylove2devlogo.png" />
@pauloricardomg
pauloricardomg / cors.nginxconf
Last active July 7, 2025 05:14
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {