Skip to content

Instantly share code, notes, and snippets.

Avatar

Sergey Mochalov proweb

View GitHub Profile
@MatthieuScarset
MatthieuScarset / gist:47b57f2e3bd4afee39a81ae5a7c3dc28
Created Dec 27, 2016
Drupal 8 - Get canonical node URL in TWIG
View gist:47b57f2e3bd4afee39a81ae5a7c3dc28
{{ path('entity.node.canonical', {'node': node.id }) }}
@ericclemmons
ericclemmons / example.md
Last active Sep 22, 2021
HTML5 <details> in GitHub
View example.md

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
View openssl.sh
#!/usr/bin/env sh
------------------------------------------
openssl genrsa -out jbzoo-com-ca.key 2048
openssl req -x509 -new -key jbzoo-com-ca.key -days 10000 -out jbzoo-com-ca.crt
openssl genrsa -out jbzoo-com-server.key 2048
openssl req -new -key jbzoo-com-server.key -out jbzoo-com-server.csr
openssl x509 -req -in jbzoo-com-server.csr -CA jbzoo-com-ca.crt -sha256 -CAkey jbzoo-com-ca.key -CAcreateserial -out jbzoo-com-server.crt -days 5000
@mattclements
mattclements / function.php
Last active Sep 20, 2021
Wordpress Disable Comments (add to function.php)
View function.php
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@J2TEAM
J2TEAM / sublime-text-scopes.md
Last active Aug 30, 2021 — forked from iambibhas/scopes.txt
Sublime Text 2/3: Snippet scopes
View sublime-text-scopes.md

Here is a list of scopes to use in Sublime Text 2/3 snippets -

ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
@tomazzaman
tomazzaman / class-watermark-image.php
Created Apr 7, 2015
Watermarking uploads in WordPress with Imagemagick
View class-watermark-image.php
function register_watermarked_size() {
add_image_size( 'watermarked', 550, 550, true ); // This is what should be uploaded
}
add_action( 'init', 'register_watermarked_size' );
class Watermark_Image {
// The attachment meta array
public $meta = array();
View jetpack-all-modules.php
<?php
//Do not copy the above php tag
// Stop JetPacks Minified/Concatention CSS file
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
//Remove JepPack CSS
function themeprefix_remove_jetpack_css() {
wp_deregister_style( 'AtD_style' ); // After the Deadline
wp_deregister_style( 'jetpack_likes' ); // Likes
@tomazzaman
tomazzaman / README.md
Last active Mar 18, 2020
Gulp workflow for WordPress theme development
View README.md

Gulp workflow for WordPress theme development

Requirements

In order for Livereload to work, you need a Firefox or Chrome extension as Gulp doesn't inset it automatically. Alternatively, you can also manually put the livereload script in footer.php, just make sure to insert it only on development environment:

<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@tmos
tmos / wpmd 2 grav
Last active May 1, 2018
This script converts the headers from wp2md to Grav headers format
View wpmd 2 grav
#! /bin/bash
#####################################################################################################
# == wpmd 2 grav == #
# This script converts the headers from wp2md to Grav headers format #
# wp2md : https://github.com/dreikanter/wp2md ; with `wp2md -d ./ export.xml -ps {title}/item.md` #
# Grav : http://getgrav.org/ #
# @author : Tom Canac http://tomcanac.com/ #
# @version : 0.1 #
# @licence : CC-BY #