Skip to content

Instantly share code, notes, and snippets.

@BrianGilbert
BrianGilbert / nginx_wp_include.conf
Last active April 25, 2022 11:55 — forked from omega8cc/gist:1677835
Create it as: /var/aegir/config/includes/nginx_wp_include.conf and add it in your custom vhost eg. https://gist.github.com/BrianGilbert/6227181
#######################################################
### nginx.conf site wp vhost include start
#######################################################
###
### deny crawlers without 403 response
###
if ($http_user_agent ~* (HTTrack|HTMLParser|libwww|wget) ) {
return 444;
}
@thenbrent
thenbrent / switch-subscription-link.php
Created November 13, 2013 19:27
Output a link to switch a subscription for the current user.
@aquelito
aquelito / git-command.md
Last active July 6, 2024 07:10
GIT - Ligne de commande principale
title category
Git config
Git

Rappel

Ne pas oublier : l'aide en ligne de commande.

@mannieschumpert
mannieschumpert / gist:8888351
Last active February 22, 2021 05:02
Some filter examples for preventing editing of certain users.
<?php
/**
* Prevent Editing of a specified user
*
* This example shows how you can protect the original admin from being edited or deleted by anyone else
*/
add_filter('map_meta_cap', 'prevent_user_edit', 10, 4 );
function prevent_user_edit( $required_caps, $cap, $user_id, $args ){
$protected_user = 1; // ID of user not editable
@seyhunak
seyhunak / digitalocean.sh
Created October 29, 2014 13:51
DigitalOcean - Scaling
Client Key: A2a9SfT4NeFBl6df5cu42
API Key: mnqWGdu4OfLBwwJPee6cpjkeY70qv9mKicqZYvtHJ
@artbristol
artbristol / monitor.sh
Last active March 24, 2023 04:54
inotify watch a directory with timestamps
inotifywait --monitor --timefmt '%F %T' --format '%T %w%f %e' --recursive $1
@guiliredu
guiliredu / facebook-page-invite.js
Last active July 2, 2024 15:12
Facebook - Script to auto invite people who liked a page post do like the page
var buttons;
buttons = document.getElementsByClassName('_42ft');
for (var i = 0; i < buttons.length; i++) {
if(buttons[i].getAttribute('ajaxify') != null){
if(buttons[i].getAttribute('ajaxify').indexOf('invite') != -1){
buttons[i].click();
}
}
}
@raphaellarrinaga
raphaellarrinaga / drupal_8_twig_cheatsheet.md
Last active July 20, 2023 21:21
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Please note I created that sheet as a personal side note/draft and not everything is fully tested. There could be errors or better things to do. So if you spot something wrong or something that can be improved, feel free to comment below and I will do the changes.

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

@leahtard
leahtard / node.twig.html
Last active June 9, 2022 18:32
Get file url in node for Drupal 8 twig template
{# Get URL of single file field #}
{{ node.field_file.entity.uri.value }}
{# Get URL of multi file field #}
{{ node.field_file['#items'].entity.uri.value }}
{# Trun into link #}
{{ file_url(node.field_file.entity.uri.value) }}
{# Check if there is at least one value #}
@velizarn
velizarn / sendgrid.bash
Last active March 12, 2024 13:13
Send email from bash script by using SendGrid API
#!/bin/bash
SENDGRID_API_KEY=""
EMAIL_TO=""
FROM_EMAIL=""
FROM_NAME=""
SUBJECT=""
bodyHTML="<p>Email body goes here</p>"