Skip to content

Instantly share code, notes, and snippets.

View sebastian-marinescu's full-sized avatar
🤓

Sebastian G. Marinescu sebastian-marinescu

🤓
View GitHub Profile
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active August 20, 2025 20:17
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@carnevlu
carnevlu / install-CB-import-Fields-Layouts-Templates.php
Last active May 18, 2022 09:08
MODX install package __ContentBlock__ and import Fields,Layouts,Templates from multiple export files
<?php
define('MODX_API_MODE', true);
// Full path to the index
require_once('index.php');
$modx = new modX();
$modx->initialize('mgr');
######################## Variables
@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active July 27, 2025 00:19
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@benhuson
benhuson / .htaccess
Created September 14, 2016 11:42
Disable HTTP Strict Transport Security (HSTS) in .htaccess
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=0; includeSubDomains; preload" env=HTTPS
</IfModule>
@ramsey
ramsey / google-font-download-woff2.php
Created September 13, 2016 17:08
Downloads the .woff2 formats of the specified Google Font for the specified language types. This also creates the appropriate CSS for the downloaded font files
<?php
/**
* Downloads the .woff2 formats of the specified Google Font for the specified
* language types. This also creates the appropriate CSS for the downloaded
* font files
*
* Usage:
* php google-font-download.php 'Open Sans' ['latin-ext,latin' [/path/to/write/to]]
*/
@takvol
takvol / Copy.gs
Last active December 2, 2024 22:36
Copy google spreadsheet with all protected ranges permissions
function Main() {
var template = DriveApp.getFileById('YOUR_SPREADSHEET_ID'); //template spreadsheet
var destination = DriveApp.getFolderById('COPY_DESTINATION_FOLDER_ID'); //the directory to copy the file into
var curDate = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "yyyy-MM-dd");
var copyName = template.getName() + ' copy ' + curDate; //the filename that should be applied to the new copy (e.g. "My spreadsheet copy 2019-08-24")
copyTemplate(template, copyName, destination);
}
/**
@bwente
bwente / pingX.php
Created June 7, 2016 17:54
MODX snippet to ping a site
<?php
// [[pingX? &url=`www.google.com` &offline=`site down`]]
$url = $modx->getOption('url', $scriptProperties, '');
$offline = $modx->getOption('offline', $scriptProperties, '');
$timeout = $modx->getOption('timeout', $scriptProperties, '30');
$port = $modx->getOption('port', $scriptProperties, '80');
if (!$socket = @fsockopen($url, $port, $errno, $errstr, $timeout)) {
// Offline
$result = $offline;
@em-piguet
em-piguet / article2collections.sql
Created March 30, 2016 09:59
How to convert an MODX articles container to a MODX collections container...
# switch ArticlesContainer -> CollectionContainer
# the res. ID I want to migrate is 11
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'ArticlesContainer', 'CollectionContainer') WHERE id=11;
# switch class_key to go back to default document view for children
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'Article', 'modDocument') WHERE parent=11;
# Change template 49 -> 57
<?php
/**
* Based on @garryn Garry Nutting's amazingly fast sitemap generator:
* http://www.modx360.com/blog/2013/09/03/google-sitemap-thousands-of-resources/
*
* Modified by @sepiariver for multi-context support
* GPL, no warranties, etc.
*
*/
@sepiariver
sepiariver / getTVInputsFromJson.snippet.php
Last active December 21, 2017 12:35
Turns JSON into TV input options in MODX.
<?php
/*
* getTVInputsFromJson
* @author @sepiariver <[email protected]>
*
* Example usage:
* 1. Create a Chunk with this Snippet call: [[getTVInputsFromJson? &jsonFile=`http://schema.org/docs/tree.jsonld`]]
* 2. Create a Single-Select TV with @CHUNK binding for "Input Options": @CHUNK my_schema_tv_chunk
* 3. Resources with the TV enabled will get a list of schema.org itemtype property values, like this screenshot: http://sepiariver.co/1KUr4LJ
*