Skip to content

Instantly share code, notes, and snippets.

View stefan-vatov's full-sized avatar
🦀
rock on

Stefan Vatov stefan-vatov

🦀
rock on
View GitHub Profile
@stefan-vatov
stefan-vatov / nginx_codeigniter_virtualhost.nginxconf
Last active June 13, 2018 09:33
Nginx: Codeigniter virtual host
server {
listen [port];
server_name [web url];
access_log [access_log_location];
error_log [error_log_location];
root [where_to_serve from];
index index.html index.php;
# If file is an asset, set expires and break
@stefan-vatov
stefan-vatov / nginx_wordpress_virtual_host.nginxconf
Last active March 10, 2016 19:27
Nginx: Wordpress Virtual Host
server{
listen [port];
server_name [url] [www.url];
access_log [access_log_location];
error_log [error_log];
root [where_to_serve_from];
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
@stefan-vatov
stefan-vatov / PhotoshopGetUsedFonts.jsx
Created April 11, 2013 00:32
Get all the fonts used in text layers in all open documents and save them to a target txt file, one at a line.
/**
*
*
* Modified version of text export script (https://github.com/omgmog/photoshop-text-export) 1.3
* Used to export the used fonts in all open photoshop documents
*
**/
// Use save as dialog (true/false)? - This will be overriden to false when running TextExport on multiple files!
-------------------------------------------------------------------------
HANDY ONE-LINERS FOR SED (Unix stream editor) Apr. 26, 2004
compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.4
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
@stefan-vatov
stefan-vatov / example
Created December 18, 2013 07:33 — forked from cedricwalter/example
Sample config for nginx when proxying through Atlassian products.
## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application
#
# author cedric.walter, www.waltercedric.com
# to be saved for ex in /etc/nginx/sites-available/example
server {
listen 80;
server_name jira.example.com;
access_log off;
location / {
server {
listen 80;
server_name jenkins.domain.tld;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#
@stefan-vatov
stefan-vatov / target-ff-css
Created November 3, 2014 00:21
Targeting only Firefox with CSS
@-moz-document url-prefix() {
// Rules
}
@stefan-vatov
stefan-vatov / dynamically_load.js
Created May 20, 2015 15:24
Dynamically load JS & CSS
var loadCSS = function (href) {
var cssLink = $("<link rel='stylesheet' type='text/css' href='" + href + "'>");
$("head").append(cssLink);
};
// Could load the JS at the end of the body, depends on the case
var loadJS = function (src) {
var jsLink = $("<script type='text/javascript' src='" + src + "'>");
$("head").append(jsLink);
};
@stefan-vatov
stefan-vatov / php_sanitise_input.php
Created May 20, 2015 15:27
Collection of methods to sanitise input
filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);