Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
👍🏻

Sergei Filippov sergeifilippov

:octocat:
👍🏻
View GitHub Profile
@sergeifilippov
sergeifilippov / how-twig-ternary-statements-work.twig
Created Mar 17, 2019
How Twig ternary statements work by John Dohm
View how-twig-ternary-statements-work.twig
{#
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 #}
{#
View lockable_script_boilerplate.sh
#!/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 Sep 1, 2017 — forked from tollmanz/compile-nginx.sh
Compile nginx from source with latest openssl, without-mail, modules: pagespeed, echo
View compile-nginx.sh
# 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
View Contract Killer 3.md

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

View magento-code-snippets.md

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
View php-fpm-cli
#!/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
View 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 Jul 10, 2014
Loading webfonts in Firefox using Nginx
View any-nginx-config.conf
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)
View .jshintrc.js
// 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`.
View domain-nginx.conf
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;