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 / 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

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@sergeifilippov
sergeifilippov / btsync
Last active August 29, 2015 14:06 — forked from mendelgusmao/btsync
#!/bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of btsync.
@sergeifilippov
sergeifilippov / any-nginx-config.conf
Created July 10, 2014 02:08
Loading webfonts in Firefox using Nginx
add this to any of your server blocks
```nginx
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
```
[Source](http://serverfault.com/questions/162429/how-do-i-add-access-control-allow-origin-in-nginx)
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@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;