Skip to content

Instantly share code, notes, and snippets.

@Neoglyph
Neoglyph / rgb2cmyk.php
Last active November 17, 2023 21:57
Convert RGB to CMYK in PHP with Imagick
<?php
$iccProfile = '../path_to_icc/Profile.icc';
$image = new Imagick();
$image->clear();
$image->readImage($imagePath);
if ($image->getImageColorspace() == Imagick::COLORSPACE_CMYK) {
return;
}
$iccCmyk = file_get_contents($iccProfile);
@ejlp12
ejlp12 / gist:059373f1785c52114d778a4ee7277ccb
Created October 25, 2017 01:45
upgrade vagrant on mac os-x
brew cask reinstall vagrant
# this might take a long time
vagrant plugin update
@hackjutsu
hackjutsu / .leptonrc
Last active December 7, 2022 01:01
[Template for .leptonrc] This is a template for Lepton's configuration file. Please place it on your home directory. #lepton
{
"theme": "light",
"autoUpdate": false,
"snippet": {
"expanded": true,
"newSnippetPrivate": false,
"sorting": "updated_at",
"sortingReverse": true
},
"editor" : {
<?php
define('SLACK_WEBHOOK', 'https://hooks.slack.com/services/xxx/yyy/zzz');
define('TELEGRAM_BOT_TOKEN', '...');
define('TELEGRAM_CHAT_ID', '12345');
function slack($txt) {
$msg = array('text' => $txt);
$c = curl_init(SLACK_WEBHOOK);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
@shakee93
shakee93 / .htaccess
Created January 31, 2017 17:45
Laravel Apache hide .env and several security settings via .htaccess
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden // in here specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
# in here specify full file name sperator '|'
@peterdalle
peterdalle / robots.txt
Created December 3, 2016 15:18
Robots.txt that makes sure Facebook and Twitter can crawl images on your site.
# Disallow everything.
User-agent: *
Disallow: /
# Certain social media sites are whitelisted to allow crawlers to access page markup when links to /images are shared.
User-agent: Twitterbot
Allow: /images
User-agent: facebookexternalhit
Allow: /images
@iamandrewluca
iamandrewluca / MyModel.php
Last active June 17, 2022 12:34
typo3 extbase categories
<?php
/**
* categories
*
* \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
* @lazy
*/
protected $categories;
/**
* MyModel constructor.
@briezler
briezler / WebDirectoryBackup.sh
Last active May 16, 2016 23:17
Webdirectory Backup including database
#/bin/bash
# SET Variables
NOW="$(date +"%d-%m-%Y_%H-%M-%S")"
ROOT_PATH="/home/www/p177910/html"
DIRECTORY_TO_SAVE="$ROOT_PATH/typo3"
BACKUP_TO_DIRECTORY="$ROOT_PATH/backup"
LOGFILE="$ROOT_PATH/backup/log/yourlogfile.log"
USER=who
DB_USER=""
@a-r-m-i-n
a-r-m-i-n / FluidTemplate.html
Last active July 30, 2020 14:02
How to render responsive images in fluid templates (dce example)
{namespace dce=ArminVieweg\Dce\ViewHelpers}
<f:layout name="Default" />
<f:section name="main">
<f:for each="{dce:fal(field:'images', contentObject:contentObject)}" as="image">
<!-- This is the normal unresponsive way -->
<f:image image="{image}" />
<!-- Here we referer to typoscript to render the responsive image -->
<f:cObject typoscriptObjectPath="lib.responsiveImage" data="{image.uid}"></f:cObject>
</f:for>
@cliffordp
cliffordp / functions.php
Last active September 23, 2023 06:22
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*