Skip to content

Instantly share code, notes, and snippets.

@nfsarmento
nfsarmento / nginx-wordpress.conf
Last active November 2, 2025 09:45
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@aaemnnosttv
aaemnnosttv / gravity-forms-select-optgroupify.php
Created October 5, 2018 09:58
GravityForms filter to allow for grouping select choices into labelled groups using special choice options.
<?php
/**
* Filter for GravityForms to group select field choices by a special "optgroup" choice.
*
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options.
* All following choices will be grouped under it using its label for the group.
* Any number of groups can be created, as each optgroup choice will start a new group.
* Supports field placeholder & ungrouped options, but must be before the first group.
*
* This snippet can be added to your theme's functions.php, or a custom plugin.
@fasiha
fasiha / xargsDemo.py
Last active July 24, 2020 08:57
Python demo for xargs-based command-line parallelization
USAGE = """
Python demo for `xargs`-based command-line parallelization.
Run this script as:
$ python [thisscript.py] [number]
for serial, single-argument execution. Then try:
$ seq -1 0.25 1 | xargs -I% -P2 -n1 python argsDemo.py % 100
@vhsu
vhsu / Suisseograntsscript.js
Last active February 24, 2024 23:14
Google Grants Report Google Ads Script By Suisseo (Single Account Script)
/**********************************************************************************************************************
This Google Ads script checks a single Google grants account for mandatory requirements and logs the results in a Google Spreadsheet
UPDATED : 23.02.2024 : Updated to v16 api + updated the adgroup counting to consider DSA (thanks Frederique Boitelle for reporting this issue).
Author : Suisseo (Vincent Hsu)
More Info : https://www.suisseo.ch/en/blog/google-ad-grants-script/
1. Detect if Campaigns are set to 'maximize conversion' to allow bids higher that 2 dollars
2. Detect if each Campaign has at least 2 active ad groups with at least 2 active text (or at least 1 RSA)
3. Detect if each account has at least 2 active Sitelinks
4. Detect if each campaign has geo-targeting .
@maedoc
maedoc / guacboot.sh
Created October 19, 2017 16:51
a few functions to make it easier to test out Guacamole with Docker
#!/bin/bash
function setup_db() {
docker run -d --name gcpg postgres
echo "waiting for db to spin up..."
sleep 2
docker exec gcpg psql -U postgres -c 'CREATE DATABASE gcdb;'
docker exec gcpg psql -U postgres -c "CREATE ROLE gcu WITH PASSWORD 'foo';"
docker exec gcpg psql -U postgres -c "ALTER ROLE gcu WITH LOGIN;"
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres | \
@colophonemes
colophonemes / create_triggers
Last active February 1, 2025 14:53
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
@alekseykulikov
alekseykulikov / index.md
Last active February 6, 2025 21:20
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@nepsilon
nepsilon / git-change-commit-messages.md
Last active November 19, 2024 18:18
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@codearachnid
codearachnid / filter_gf_select_optgroup.php
Last active November 10, 2025 09:01
Add the optgroup ability to Gravity Forms default select field.
<?php
/**
* Filter Gravity Forms select field display to wrap optgroups where defined
* USE:
* set the value of the select option to `optgroup` within the form editor. The
* filter will then automagically wrap the options following until the start of
* the next option group
*/