Skip to content

Instantly share code, notes, and snippets.

@ahmadazimi
ahmadazimi / post-receive
Last active December 31, 2017 10:56
Git post-receive hook to update submodules and run composer install
#!/bin/bash
# Place this file in .git/hooks/ directory.
# Update the working tree after changes have been pushed here
cd ..
env -i git checkout -f
env -i git submodule update --init --recursive
@ahmadazimi
ahmadazimi / nginx.conf
Last active June 4, 2020 21:34
My customized nginx.conf file for optimization and performance boost.
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
@ahmadazimi
ahmadazimi / server.ini
Last active January 26, 2017 12:18
HHVM server.ini
; location: /etc/hhvm/server.ini
pid = /run/hhvm.pid
hhvm.server.ip = 127.0.0.1
hhvm.server.port = 9001
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.source_root = /usr/share/nginx/html
hhvm.server.always_use_relative_path = false
@ahmadazimi
ahmadazimi / ContentMD5-ReqDotMD5.pm
Created December 17, 2015 05:15 — forked from sivel/ContentMD5-ReqDotMD5.pm
nginx Perl Module to Output Content-MD5 HTTP Header
# nginx Embedded Perl module for adding a Content-MD5 HTTP header
#
# This perl module, will output an MD5 of a requested file using the
# Content-MD5 HTTP header, by pulling the hex hash from a file of the
# same name with .md5 appended to the end, if it exists.
#
# Author: Matt Martz <matt@sivel.net>
# Link: https://gist.github.com/1870822#file_content_md5_req_dot_md5.pm
# License: http://www.nginx.org/LICENSE
@ahmadazimi
ahmadazimi / javascript-query-string.js
Created August 10, 2016 18:08 — forked from DavidWells/javascript-query-string.js
JavaScript :: Regex trick: Parse a query string into an object
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// JavaScript regex trick: Parse a query string into an object
var queryString = {};
anchor.href.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
// Usage
[Unit]
Description=HipHop Virtual Machine
[Service]
PIDFile=/run/hhvm.pid
ExecStart=/usr/local/bin/hhvm -m daemon -u nginx -c /etc/hhvm/server.ini
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
@ahmadazimi
ahmadazimi / neshan-maps-web-sdk-get-started.html
Last active June 24, 2018 06:05
Neshan Maps Web SDK get started guide
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="https://static.neshan.org/api/web/v1/openlayers/v4.6.5.css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script type="text/javascript" src="https://static.neshan.org/api/web/v1/openlayers/v4.6.5.js?callback=initMyMap" async></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Neshan Map Example (OpenLayers)</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="https://static.neshan.org/sdk/openlayers/4.6.5/ol.css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Neshan Map Example (Leaflet)</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://static.neshan.org/sdk/leaflet/1.3.3/leaflet.css" rel="stylesheet" type="text/css">
<script src="https://static.neshan.org/sdk/leaflet/1.3.3/leaflet.js" type="text/javascript"></script>
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Neshan Map Traffic Layer Example (Leaflet)</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://static.neshan.org/sdk/leaflet/1.4.0/leaflet.css" rel="stylesheet" type="text/css">
<script src="https://static.neshan.org/sdk/leaflet/1.4.0/leaflet.js" type="text/javascript"></script>
</head>