Skip to content

Instantly share code, notes, and snippets.

@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>
[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 / 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
@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 / 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 / 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 / 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 / post-rewrite
Created December 1, 2015 13:32 — forked from digitaljhelms/post-rewrite
Git hook to call `git submodule update` automatically.
#!/bin/sh
echo "[post-rewrite hook: $1]"
# quick script to call "git submodule update" automatically if the
# .gitmodules file is changed
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
if [[ "${changedfiles[*]}" =~ ".gitmodules" ]]; then
echo "initializing & updating submodule(s)"
@ahmadazimi
ahmadazimi / nginx.conf
Created November 19, 2015 05:49 — forked from dylansm/nginx.conf
Dynamic nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
access_log /usr/local/var/log/nginx/access.log;
error_log /usr/local/var/log/nginx/error.log;
include mime.types;
@ahmadazimi
ahmadazimi / Mac OS enable NTFS read write.md
Last active December 1, 2015 11:04
How to enable read and write functionality on NTFS drive on Mac

Open Terminal.

If you have brewed osxfuse installed, you have to uninstall it, because unsigned kexts are banned now. Type:

brew cask uninstall osxfuse

On the other hand, if you don't have Homebrew at all, download it:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"