Skip to content

Instantly share code, notes, and snippets.

@e-kostylov
e-kostylov / cors-nginx.conf
Created August 13, 2017 20:10 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
<?php
class DefaultController extends Controller
{
/**
* Dashboard page.
* @Permissions(perm="dashboard_view")
* @Route("/", name="ITEDashboardBundle_index")
* @Template()
* @return array
@e-kostylov
e-kostylov / 1. remapConfigsToParameters.php
Created May 23, 2017 15:00 — forked from carlcraig/1. remapConfigsToParameters.php
Symfony2 Extension Configuration function to remap config tree builder to parameters
<?php
/**
* Remaps Configurations to Parameters
*
* @param array $configs The array of configurations
* @param ContainerBuilder $container The container builder
* @param string $prefix A prefix to apply to all parameters
* @param array $ignore An array of parameter namespaces to ignore
* @param array $isArray An array of parameter namespaces which should be arrays
@e-kostylov
e-kostylov / supervisord-example.conf
Created March 27, 2017 09:03 — forked from didip/supervisord-example.conf
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@e-kostylov
e-kostylov / qsort.go
Created March 5, 2017 21:50 — forked from vderyagin/qsort.go
quick sort implementation in Golang
package qsort
import "math/rand"
func QuickSort(slice []int) []int {
length := len(slice)
if length <= 1 {
sliceCopy := make([]int, length)
copy(sliceCopy, slice)
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@e-kostylov
e-kostylov / InvoiceController.php
Created December 5, 2016 10:29 — forked from cifren/InvoiceController.php
Paginator class for symfony2 Give the possibility to create pagination on symfon2 and with bootstrap3, including Doctrine management
<?php
/*Controller/InvoiceController.php*/
namespace Ruby\CheckbookBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class InvoiceController extends Controller
{
public function listAction($page)
{
@e-kostylov
e-kostylov / verify_appstore_in_app.php
Created November 24, 2016 16:29 — forked from menny/verify_appstore_in_app.php
How to verify in-app purchases from AppStore and Market in PHP code (server-side)
function verify_app_store_in_app($receipt, $is_sandbox)
{
//$sandbox should be TRUE if you want to test against itunes sandbox servers
if ($is_sandbox)
$verify_host = "ssl://sandbox.itunes.apple.com";
else
$verify_host = "ssl://buy.itunes.apple.com";
$json='{"receipt-data" : "'.$receipt.'" }';
//opening socket to itunes
@e-kostylov
e-kostylov / smtp-gmail-send.go
Created November 14, 2016 09:48 — forked from jpillora/smtp-gmail-send.go
Send email using Go (Golang) via GMail with net/smtp
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@e-kostylov
e-kostylov / bash-cheatsheet.sh
Created October 2, 2016 19:25 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04