Skip to content

Instantly share code, notes, and snippets.

View dmitryd's full-sized avatar

Dmitry Dulepov dmitryd

View GitHub Profile
@dmitryd
dmitryd / renderImage.ts
Last active October 14, 2015 11:52
Render image reference from page properties with TypoScript (TYPO3 CMS)
ogimageNoSlide = FILES
ogimageNoSlide {
references {
table = pages
uid.data = page:uid
fieldName = ogimage
}
maxItems = 1
renderObj = TEXT
renderObj {
@dmitryd
dmitryd / set_enviroment_variable_per_dir_in_bash.sh
Last active October 12, 2015 16:31
This little shell function allows to set environment variables when you cd into that directory.
# Note: this is just a fragment that you should put in your ~/.bash_profile
# Tested on Mac only!
#
# If you want a more sophisticated and feature rich solution here are some pointers:
# - https://github.com/cxreg/smartcd
# - http://swapoff.org/ondir.html
function cd_ {
if [ -e .env_off ] ; then
. .env_off
@dmitryd
dmitryd / lj-selfie.html
Created September 18, 2015 08:55
LJ: Show a userpic of the current viewer to him in the comment
<lj-userpic remote="remote" />
@dmitryd
dmitryd / setup.ts
Created September 7, 2015 08:43
TYPO3: typolink that handles classes in the link field as well as having a custom class in the TypoScript
10 = LOAD_REGISTER
moreUrl {
field = linkUrl
listNum = 0
listNum.splitChar = 32
}
extraClasses {
field = linkUrl
listNum = 2
@dmitryd
dmitryd / Classes_Xclass_DocumentFactory.php
Last active October 9, 2015 12:20
Indexing file content in TYPO3 6.2 with Solr
<?php
namespace My\solrfileindexing\Xclass;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Requires cc_text* extensions!
*/
class DocumentFactory extends \TYPO3\Solr\Solrfal\Indexing\DocumentFactory {
@dmitryd
dmitryd / ipfw.conf
Last active August 29, 2015 14:23
Prevent access to local Apache on OS X with ipfw
add 1000 deny tcp from any to any dst-port 80 recv en0
add 2000 deny tcp from any to any dst-port 80 recv en1
add 3000 deny tcp from any to any dst-port 80 recv en3
# The next one works only if you have tun/tap driver installed for VPN apps. If you do not have it, comment it.
add 4000 deny tcp from any to any dst-port 80 recv tun0
@dmitryd
dmitryd / Library_LaunchDaemons_com.noatime.root.plist
Created June 29, 2015 14:38
"noatime" for OS X on SSD. Place this file to /Library/LaunchDaemons/com.noatime.root.plist and do `sudo launchctl load -w /Library/LaunchDaemons/com.noatime.root.plist`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.noatime.root</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/mount</string>
<string>-vuwo</string>
@dmitryd
dmitryd / set-file-url.sh
Last active August 29, 2015 14:23
Change source URL of the file in the OS X metadata from shell
#/bin/bash
if [ ! -e "$2" ] ; then
echo "Format: `basename $0` url file"
echo ""
echo "Sets the source URL of the file."
echo ""
exit 1
fi
@dmitryd
dmitryd / git-change-committer.sh
Created May 28, 2015 07:55
Changing committer information for git
#!/bin/bash
git filter-branch --env-filter '
OLD_EMAIL="user1@example.org"
CORRECT_NAME="Rick Grimes"
CORRECT_EMAIL="rick.grimes@zombyworld.net"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@dmitryd
dmitryd / fix-phpstorm-network.sh
Created May 28, 2015 07:16
(Mac) Fix PhpStorm prompt for accepting incoming connections
#!/bin/bash
#
# @see https://youtrack.jetbrains.com/issue/IDEA-129941
#
# Make sure you have Wi-Fi on and automatic time zone on on your Mac!
sudo codesign --force --deep --sign - /Applications/PhpStorm.app/