Skip to content

Instantly share code, notes, and snippets.

View AdeptSEO's full-sized avatar

Веб-студия «AdeptSEO» AdeptSEO

View GitHub Profile
@AdeptSEO
AdeptSEO / set-active-class-in-nunjucks.md
Created February 26, 2022 05:37 — forked from atelierbram/set-active-class-in-nunjucks.md
Set Active Class on Nav-Menu-Item in Nunjucks

In html/about/index.html:

{% extends "layouts/layout.njk" %}

{% set base_path = "../../" %}
{% set page_title = "about" %} 

In data.json:

@AdeptSEO
AdeptSEO / nunjucks-multilevel-navigation
Created February 26, 2022 05:38 — forked from benald/nunjucks-multilevel-navigation
Nunjucks Multi Level Navigation Template
// JSON Structure
[{
"title": "Home",
"name": "index"
},
{
"title": "Find a service",
"name": "find a service"
},
{
@AdeptSEO
AdeptSEO / highlightjs-tag-nunjucks.js
Created February 27, 2022 11:23 — forked from RRMoelker/highlightjs-tag-nunjucks.js
Nunjuck highlight.js tag extension
//
// Allows highlighting of code blocks in Nunjucks template.
// https://mozilla.github.io/nunjucks/api.html#custom-tags
//
const nunjucks = require('nunjucks');
const hljs = require('highlight.js');
function HighlightJsExtension() {
this.tags = ['highlightjs'];
// Set cross-browser viewport height and width variable
viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
viewWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
{# Import macros for global use in all views #}
{% set components = {} %}
{% for component in macroFilePaths %}
{% import component as temp %}{% set macro = _.assign(components, temp) %}
{% endfor %}
{# end #}
@AdeptSEO
AdeptSEO / .gulpfile
Created March 9, 2022 15:32 — forked from IcarusFW/.gulpfile
Nunjucks - JSON into Template Macro
var manageEnvironment = function(environment) {
environment.addFilter("json", function(value) {
return JSON.parse(value); // convert the complete string imported by Nunjucks into JSON and return
});
};
gulp.task("nunjucks", function() {
// .njk files in pages
return (
gulp
@AdeptSEO
AdeptSEO / index.html
Created March 11, 2022 03:33 — forked from joelgarzatx/index.html
Masonry - imagesLoaded progress, vanilla JS
<h1>Masonry - imagesLoaded progress, vanilla JS</h1>
<div class="grid">
<div class="grid-sizer"></div>
<div class="grid-item">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" />
</div>
<div class="grid-item">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/submerged.jpg" />
</div>
gulp.task("watch-upload", function() {
gulp.watch("src/**/*", function(obj) {
if(["changed", "added"].indexOf(obj.type) !== -1) {
gulp.src(obj.path, {"base": "src/"})
.pipe(sftp(config.sftp));
}
});
});
@AdeptSEO
AdeptSEO / index.html
Created April 29, 2022 04:46 — forked from miguelmota/index.html
Hugo render from JSON file data
<!-- posts.json must be at root level -->
{{ $items := getJSON "posts.json" }}
{{ range $item := $items }}
<a href="{{ $item.url }}">{{ $item.name }}</a>
{{ end }}
@AdeptSEO
AdeptSEO / aria2.conf
Created December 3, 2022 11:09 — forked from qzm/aria2.conf
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5