Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Install xcode CLI
echo "Installing xcode-stuff"
xcode-select --install
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
@fabianmarz
fabianmarz / potx.sh
Last active April 13, 2018 10:22
Generate and move Drupal translation files to related folder via potx.
#!/bin/bash -eux
CURRENT_DIR=${PWD}
NAME="$(basename $CURRENT_DIR)"
DOCROOT=$(drush dd)
FILEPATH=$(realpath --relative-to="$DOCROOT" "$CURRENT_DIR")
drush potx --api=8 --folder=$FILEPATH/*
mkdir -p ./translations
mv $DOCROOT/general.pot ./translations/$NAME.pot
@fabianmarz
fabianmarz / nginx.conf
Created March 20, 2018 10:37
Serve missing images from remote
location ~* \.(png|jpe?g|gif|ico)$ {
alias /path/to/public_html/;
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
}
location @production {
resolver 8.8.8.8;
proxy_pass http://<staging_url>.com/$uri;
@fabianmarz
fabianmarz / PHP.sublime-build
Last active March 13, 2018 12:24
File should be placed in: `~/Library/Application Support/Sublime Text 3/Packages/User/`
/**
* Create a custom [build system](http://bit.ly/17IKkU9) to provide PHP syntax checking.
* Save this file as ~/.config/sublime-text-2/Packages/User/PHP.sublime-build
*
* Usage
* - In the editor, select a tab with PHP source code.
* - Press F7 or CTRL + B to run PHP syntax check.
* - The status will be be displayed in the console at the bottom.
* - If it shows error, press F4, and the editor cursor will be brought to the relevant line in the source code.
*/
@fabianmarz
fabianmarz / Package Control.sublime-settings
Last active March 13, 2018 12:24
File should be placed in: `~/Library/Application Support/Sublime Text 3/Packages/User/`
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AdvancedNewFile",
"Auto Semi-Colon",
"ayu",
<?php
/**
* Regenerate missing image sizes only.
*
* Note: Untested code
*/
function regenerate($image_size = '', $attachment_id = []) {
global $wpdb;
@fabianmarz
fabianmarz / Preferences.sublime-settings
Last active June 5, 2017 12:42
Sublime Text config
{
"always_show_minimap_viewport": true,
"animation_enabled": false,
"auto_complete_selector": "source, text",
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"color_scheme": "Packages/ayu/ayu-mirage.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,