Skip to content

Instantly share code, notes, and snippets.

View sergeifilippov's full-sized avatar
:octocat:
👍🏻

Sergei Filippov sergeifilippov

:octocat:
👍🏻
View GitHub Profile
@sergeifilippov
sergeifilippov / domain-nginx.conf
Created February 10, 2014 03:22
linux-dash with nginx
server {
server_name $domain_name;
root /var/www;
index index.html index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;
@sergeifilippov
sergeifilippov / how-twig-ternary-statements-work.twig
Created March 17, 2019 23:25
How Twig ternary statements work by John Dohm
{#
Ternary Statements: Ternaries evaluate the variable
based on whether it is truthful
#}
{{ foo ? 'yes' : 'no' }} {# Returns 'yes' or 'no' #}
{{ foo ?: 'no' }} {# Returns foo or 'no' #}
{{ foo ? 'yes' }} {# Returns 'yes' or nothing #}
{#
#!/bin/bash
## Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate
# If using on macOS, try https://github.com/discoteq/flock
### HEADER ###
@sergeifilippov
sergeifilippov / compile-nginx.sh
Last active September 1, 2017 15:18 — forked from tollmanz/compile-nginx.sh
Compile nginx from source with latest openssl, without-mail, modules: pagespeed, echo
# Install dependencies
#
# Setup adjustable vars
NGX_MODULE_PATH=$HOME/source
NGX_VERSION=1.10.2
OPENSSL_VERSION=1.0.2j
NGX_MODULE_ECHO=0.60
NGX_MODULE_CACHEPURGE=2.3
NGX_MODULE_HEALTHCHECK=0.3.0

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name

Templating in EE vs. Craft

Lots of people have asked, so here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft.

Table of Contents

  1. Comments
  2. Conditionals
  3. Loops
#!/bin/bash
# Reload a varnish config
# Author: Kristian Lyngstol
FILE="/etc/varnish/ugc.vcl"
# Hostname and management port
# (defined in /etc/default/varnish or on startup)
HOSTPORT="localhost:6082"
NOW=`date +%s`
@sergeifilippov
sergeifilippov / mounting-instructions.md
Created December 4, 2013 23:07
Mounting a partition/drive with out execration parameters

mount a partition with out execution enabled - for security

make a mounting point

sudo mkdir /mnt/mounting_point

find the drive to mount

sudo blkid
@sergeifilippov
sergeifilippov / alias.txt
Created August 10, 2013 22:42
Add this to your bash_profile. Now, whenever you need to fetch your ssh-key, just type sshkey, and it'll be copied to your clipboard.
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
@sergeifilippov
sergeifilippov / poseidon-art
Created July 30, 2013 22:31
poseidon ascii art
|||
\|/
| WWW o
| /_^_\ O )
B, /|o o\\_ (
|\\ |\ - |\\_/ o ) <*)<
| \\\_/= \_/ <^)< (
| `\ \\
| | .][. | )
| \ | /( ) o (