Skip to content

Instantly share code, notes, and snippets.

View martonlente's full-sized avatar

Márton Lente martonlente

View GitHub Profile
@rileyjshaw
rileyjshaw / convert.sh
Last active March 22, 2024 11:01
Download all issues of Emigre Magazine from Letterform Archive’s Online Archive
# Move the results into their own folder, drag that parent folder into imageOptim, `cd` into it, then:
for d in Issue\ */; do
cd "$d"
convert -compress jpeg -quality 33 -resize 2388x2388\> *.jpg "../${d%/}.pdf"
cd ..
done
@broofa
broofa / checkForUndefinedCSSClasses.js
Last active January 21, 2024 17:22
ES module for detecting undefined CSS classes (uses mutation observer to monitor DOM changes). `console.warn()`s undefined classes.
/**
* Sets up a DOM MutationObserver that watches for elements using undefined CSS
* class names. Performance should be pretty good, but it's probably best to
* avoid using this in production.
*
* Usage:
*
* import cssCheck from './checkForUndefinedCSSClasses.js'
*
* // Call before DOM renders (e.g. in <HEAD> or prior to React.render())
@PatrickLang
PatrickLang / Fedora34-VM.ps1
Last active September 27, 2023 10:31
Hyper-V example setup for Fedora 34
# Echo the commands as they're run
Set-PSDebug -Trace 1
# Dump Windows version
Get-ComputerInfo | Format-Table WindowsVersion, OsVersion
# Create a UEFI VM, secure boot enabled, use the secure boot settings for the
$vm = New-VM -Generation 2 -Name "Fedora 34 beta" -Path .
$vm | Set-VMFirmware -EnableSecureBoot On -SecureBootTemplate "MicrosoftUEFICertificateAuthority"
@eht16
eht16 / Properties.txt
Created May 26, 2020 11:08
RFC: Documenting Scintilla lexer properties
# lexer:property_name:property_type:description
asm:fold:boolean:Enable or disable folding
asm:fold.asm.comment.explicit:boolean:This option enables folding explicit fold points when using the Asm lexer. Explicit fold points allows adding extra folding by placing a ;{ comment at the start and a ;} at the end of a section that should fold.
asm:fold.asm.comment.multiline:boolean:Set this property to 1 to enable folding multi-line comments.
asm:fold.asm.explicit.anywhere:boolean:Set this property to 1 to enable explicit fold points anywhere, not just in line comments.
asm:fold.asm.explicit.end:string:The string to use for explicit fold end points, replacing the standard ;}.
asm:fold.asm.explicit.start:string:The string to use for explicit fold start points, replacing the standard ;{.
asm:fold.asm.syntax.based:boolean:Set this property to 0 to disable syntax based folding.
asm:fold.compact:boolean:This option on leads to blank lines following the end of an element folding with that element. Defaults to on.
asm:le
@lucasmezencio
lucasmezencio / SLUG.md
Last active April 24, 2024 14:01
Creating URL slugs properly in PHP (including transliteration for UTF-8)

Creating URL slugs properly in PHP (including transliteration for UTF-8)

The point to use a slug (semantic URL) besides of improve the SEO of your articles is to prevent that the user, at the creation of for example an article, it uses special characters that aren't allowed in a URL, appropiate the usage etc. What target usage means, is context dependent.

In this article, you'll learn how to slugify a string in PHP properly, including (or not) support (conversion) for cyrilic and special latin characters.

Slugify in PHP

The following function exposes a simple way to convert text into a valid slug:

@clivewalker
clivewalker / image_orientation_detection.php
Last active June 19, 2019 09:32
A Perch CMS template filter to detect whether an image is portrait or landscape orientation. Written by Jay George.
/* GROUP IMAGE ORIENTATION DETECTION
=================================================== */
class PerchTemplateFilter_image_orientation_detection extends PerchTemplateFilter
{
/* Notes...
You may want to do something different if the image is landscape e.g. span 2 columns in a CSS grid rather than 1
- Assumes your template image has an ID of `image`
- e.g. `<div class="c-photo-grid__item c-photo-grid__item--<perch:content id="image" filter="image-orientation-detection" />">`
This would either output `c-photo-grid__item--landscape` or `c-photo-grid__item--portrait`
*/
@nr1q
nr1q / qtranslate_cleanup.sql
Created August 8, 2017 22:55 — forked from frnhr/qtranslate_cleanup.sql
clean database after qTranslate uninstall
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
## fill `tmp_exceprt` column
UPDATE wp_posts SET tmp_excerpt =
add_filter( 'your-post-type_post_type_args', '_my_rewrite_slug' ); // Here replace "your-post-type" with the actual post type, e.g., "cherry_services", "cherry-projects"
function _my_rewrite_slug( $args ) {
$args['rewrite']['slug'] = 'our-services'; // Replace "our-services" with your preferable slug
return $args;
}
@giordanocardillo
giordanocardillo / README.MD
Last active March 31, 2024 09:48
Remove Office 2016 Product Key
  1. Open a command prompt as Administrator
  2. In the command prompt, type the following:
  • Office 2016 (32-bit) on a 32-bit version of Windows

    cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (32-bit) on a 64-bit version of Windows

    cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (64-bit) on a 64-bit version of Windows

@tim545
tim545 / lg-jquery-app-struct.md
Last active March 11, 2024 18:59
Structuring a large jQuery application

Structuring a large jQuery application

This document assumes you are building a traditional backend-heavy application as opposed to a frontend-heavy appliction which would typically use a framework like Angular or React. The use of these frameworks make this document irrelevant, however also require a change to your application architecture and a much larger overhead in order to get content onto a page, so as a simple way to build interactive web content a simple jquery based js stack will do fine.

Directory structure

It's important you use a directory structure which is impartial to your development environment, chosen server language (Python v. Java v. C# ...), and styling framwork (Twitter Bootstrap etc). This layer of separation means you can swap out the styles or the backend with minimal changes to the Js, simple and maintainable.

Here's an example from the project root: