Skip to content

Instantly share code, notes, and snippets.

View cawa87's full-sized avatar
🤡
bip bip

Aleksandr Zamiatin cawa87

🤡
bip bip
View GitHub Profile
@cawa87
cawa87 / CarBrandTable.php
Created June 6, 2015 10:06
Zf2 datatables
<?php
namespace CarAdmin\Table;
use ZfTable\AbstractTable;
class CarBrandTable extends AbstractTable
{
@cawa87
cawa87 / base64.js
Last active August 26, 2021 07:36
JavaScript Convert an image to a base64 url
/**
* Convert an image
* to a base64 url
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat=image/png]
*/
function convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();
img.crossOrigin = 'Anonymous';
@cawa87
cawa87 / symfony2.php
Created May 16, 2015 10:38
Simple round radius from coordinates, geo point
/**
* Get restaurants around user
*
* @param $lng
* @param $lat
* @param $rad
* @return array
*/
public function getRestaurantsAround($lng, $lat, $rad = 1200)
{
@cawa87
cawa87 / LaravelTestCase.php
Last active August 29, 2015 14:18
Base testing class for codeception and laravel5
<?php
namespace App\Testing;
use Illuminate\Foundation\Testing\ApplicationTrait;
use Illuminate\Foundation\Testing\AssertionsTrait;
/**
* Class LaravelTestCase
* @package App\Testing
@cawa87
cawa87 / zshell.md
Last active October 12, 2017 11:21
oh-my-zsh, #Z-shell

То, без чего, я не представляю свою консоль или замена стандартной оболочки терминала

  • Установка необходимых пакетов:

sudo apt-get install zsh

Если еще не установлен git, то: sudo apt-get install git

  • Клонируем репозиторий oh-my-zsh
@cawa87
cawa87 / microcache_host.nginxconf
Last active August 29, 2015 14:15
Nginx micro cache conf example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@cawa87
cawa87 / laravel.conf
Last active August 29, 2015 14:14
Full Laravel nginx config
server {
listen 80 default_server;
server_name example.com www.example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
root /srv/www/example.com/public;
index index.php index.html;
@cawa87
cawa87 / iptables_flush.sh
Created January 11, 2015 14:29
Reset iptables firewall rules
#!/bin/sh
echo "Flushing iptables rules..."
sleep 1
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
@cawa87
cawa87 / form
Created December 24, 2014 10:26
Ajax
$('#asideRegisterForm').on('submit', function (e) {
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize()
}).done(function () {
$('#asideRegisterForm').hide('fast');
$('#asideRegister').show('fast');
});
return false;
@cawa87
cawa87 / gist:485a4e46b4aecfdd4801
Created December 15, 2014 09:18
KnpPagination View with filters
{% extends "VswSystemAdminBundle::layout.html.twig" %}
{% block title %}
VswSystem - Donors
{% endblock %}
{% block content %}
{% from 'MopaBootstrapBundle::macros.html.twig' import label %}
<div class="page-header">
<h1>Donors
<small>
<hr>