Skip to content

Instantly share code, notes, and snippets.

View mervick's full-sized avatar

Andrey Izman mervick

View GitHub Profile
@mervick
mervick / Doxygen
Created April 25, 2017 05:19 — forked from itarato/Doxygen
Doxygen example for PHP code
# Doxyfile 1.8.9
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Cameron & Wilding Tool"
PROJECT_NUMBER =
PROJECT_BRIEF = "Drupal 7 Architecture tool"
PROJECT_LOGO = /Users/itarato/Desktop/logo.png
@mervick
mervick / nano_js_syntax_highlighting.md
Created May 14, 2017 00:42 — forked from leommoore/nano_js_syntax_highlighting.md
nano javascript syntax highlighting

#nano javascript syntax highlighting

The existing syntax highlighting is located in /usr/share/nano/

To add a new language

sudo nano /usr/share/nano/javascript.nanorc

Put the following in the contents:

@mervick
mervick / nginx-font-serving
Created May 24, 2017 23:14 — forked from atiw003/nginx-font-serving
Nginx header write for serving fonts to firefox cross domain
For nginx,
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
Or better way inside virtual host location use,
Inside location use
if ($request_filename ~* ^.?/([^/]?)$)
@mervick
mervick / zsh.zsh
Created July 11, 2017 23:58 — forked from clairvy/zsh.zsh
#!zsh
# __git_branch_switches
# _git-submodule
# _git-filter-branch
(( $+functions[_git-now] )) ||
_git-now () {
local curcontext=$curcontext state line
declare -A opt_args
@mervick
mervick / Description.md
Created July 27, 2017 22:38 — forked from juanje/Description.md
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@mervick
mervick / main.go
Created August 9, 2017 05:36 — forked from eagletmt/main.go
List installable Android SDK packages (similar to sdkmanager --verbose --list)
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@mervick
mervick / mail2.php
Created August 12, 2017 20:49 — forked from suzuki/mail2.php
Swift Mailer sample / DKIM email
<?php
require 'vendor/autoload.php';
$transport = Swift_SmtpTransport::newInstance('localhost', 25);
$mailer = Swift_Mailer::newInstance($transport);
// DKIM 用の Signer を作成する
$privateKey = file_get_contents('./default.private');
$domainName = 'example.com';
@mervick
mervick / getFirafonts.sh
Last active September 4, 2017 07:29 — forked from muammar/getFirafonts.sh
Download and install Fira fonts in Linux or Mac OS X
#!/bin/bash
## cf from http://programster.blogspot.com/2014/05/ubuntu-14-desktop-install-fira-sans-and.html
cd /tmp
# install unzip just in case the user doesn't already have it.
if [[ `uname` = Linux ]]; then
sudo apt-get install unzip -y
wget "http://www.carrois.com/downloads/fira_4_1/FiraFonts4106.zip"
@mervick
mervick / hack-sign-in-dependencies.sh
Created October 9, 2017 14:50
Script to build a new Google Sign in dependencies that will work with Firebase
root=$PWD
binary=GoogleSignInDependencies
signInFrameworkDir=./google_signin_sdk_4_0_1
archs=(armv7 x86_64 arm64 i386)
duplicateClasses=(GTMLogger GTMNSDictionary+URLArguments GTMSessionFetcher GTMSessionFetcherService GTMSessionUploadFetcher)
hackDir=hack
framework=$binary.framework
@mervick
mervick / functions.php
Created November 8, 2017 23:11 — forked from digamber89/functions.php
Validating Custom Fields
<?php
add_action( 'wp_enqueue_scripts', 'child_enqueue_styles' );
function child_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action('woocommerce_after_checkout_validation', 'digthis_two_step_checkout_validate', 9999, 2);
function digthis_two_step_checkout_validate($data, $errors) {