Skip to content

Instantly share code, notes, and snippets.

View joekolade's full-sized avatar

Joe Kolade joekolade

View GitHub Profile
@joekolade
joekolade / commands.sh
Last active March 4, 2023 21:28
[tar] Tar commands for everyday use
# Create tar.gz archive
tar -czvf archive.tar.gz what_to_pack
# Extract zipper archive
tar xzf archive.tar.gz
@joekolade
joekolade / crawl-site.py
Last active March 3, 2023 15:24
[scrapy site crawler] crawls a whole site
# run with
# `scrapy runspider crawl-site.py`
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class MySpider(CrawlSpider):
name = 'domain.com'
allowed_domains = ['domain.com']
@joekolade
joekolade / debounce.js
Created March 3, 2023 11:21
[JS Debounce] Simple debouncer function
/*
@param : fn => the function to convert
@param : time => the time delay for debounce
*/
function debounce(fn, delay) {
let timer = null
return (...args) => {
if (timer) clearTimeout(timer)
timer = setTimeout(() => fn(...args), delay)
@joekolade
joekolade / snippet.php
Last active March 3, 2023 11:08
[Debug per IP] PHP Debug information based on request IP #typo3
if($_SERVER['REMOTE_ADDR'] == '37.209.17.41'){
var_dump($var);
exit;
}
@joekolade
joekolade / .htaccess
Last active May 12, 2023 09:56
[htaccess] Htaccess things #server
# redirect non www to www
RewriteCond %{HTTP_HOST} !^(www|dev)\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
# Non SSL to SSL
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
@joekolade
joekolade / AbtractPage.fusion
Last active March 3, 2023 11:04 — forked from abteilung/Favicons.fusion
[Favicons in Neos CMS] Render Favicons with Neos CMS #neos #fusion
prototype(Joekolade.SbfwSite:Document.AbstractPage) < prototype(Neos.Neos:Page) {
head {
favicons = Joekolade.SbfwSite:Component.Favicon
headTags = Neos.Fusion:Component {
renderer = afx`
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
`
}
@joekolade
joekolade / DropzoneModifier.php
Last active March 3, 2023 11:09
[TYPO3 FE Edit] Enable frontend_editing with gridelements in TYPO3 CMS 8.7 #typo3 #typoscript
<?php
declare(strict_types=1);
namespace Vendor\Extension\Hooks;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\FrontendEditing\EditingPanel\FrontendEditingDropzoneModifier;
use TYPO3\CMS\FrontendEditing\Service\ContentEditableWrapperService;
/**
@joekolade
joekolade / LangSwitch.ts
Last active March 3, 2023 11:03
[Langswitch] Typoscript Langswicth based on HMENU w/ fallback #typo3 #typoscript
lib.langSwitch = HMENU
lib.langSwitch {
special = language
special.value = 0,1
special.normalWhenNoLanguage = 0
1 = TMENU
1 {
noBlur = 1
# Standard Sprachen
NO = 1
@joekolade
joekolade / Email_recommend.ts
Last active March 1, 2023 21:19
[E-Mail recommend this site] A simple recommendation link in Typoscript #typo3 #typoscript
10 = TEXT
10.wrap = <a href="mailto:?Subject={$text.emailTip}&body={$text.emailTipBody} | ">
10.data = getIndpEnv:TYPO3_REQUEST_URL
@joekolade
joekolade / Neos console commands
Last active March 3, 2023 11:04
[Neos Console Commands] commonly used commands for Neos CMS #neos #shell
# Flush or warmup caches
./flow flow:cache:warmup
./flow flow:cache:flush
# Flush or warmup caches in other contexts
FLOW_CONTEXT=Production ./flow flow:cache:flush
# Kickstart Page
./flow kickstart:site