Skip to content

Instantly share code, notes, and snippets.

View dmitrymomot's full-sized avatar
🤨

Dmytro Momot dmitrymomot

🤨
View GitHub Profile
@mreschke
mreschke / nginx.conf
Last active January 3, 2025 07:03
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@sayden
sayden / ObserverDesignPattern.go
Created December 14, 2015 22:45
Observer Pattern in Golang
package main
import "fmt"
//Listener is a
type Listener struct {
ID int
}
//ListenerInterface is an
@dvapelnik
dvapelnik / config.py
Last active April 27, 2018 12:25
Translate in command line using YandexTranslateAPI
YandexApiKey = 'Your.Yandex.Translate.API.Key.Should.Be.Here'
@stupidbodo
stupidbodo / aes_encryption.go
Last active February 20, 2025 12:09
AES Encryption Example in Golang
// Playbook - http://play.golang.org/p/3wFl4lacjX
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
@fhferreira
fhferreira / CORS.php
Last active April 7, 2025 20:14
Try to create - Cors Filter Laravel 5 Middleware
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
@antonmedv
antonmedv / DotNotation.php
Last active August 11, 2022 13:47
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@dmitrymomot
dmitrymomot / gist:4654524
Last active June 28, 2017 18:32
Получение в jquery get-параметра с url страницы
// получаем URL параметры
// var allVars = $.getUrlVars();
// получаем значение параметра по его имени
// var byName = $.getUrlVar('name');
$.extend({
getUrlVars: function(){
var vars = [], hash;
@karlhorky
karlhorky / grayscale-disable.css
Created August 26, 2012 12:17
Cross-Browser CSS Grayscale
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,&lt;svg xmlns=\'http://www.w3.org/2000/svg\'&gt;&lt;filter id=\'grayscale\'&gt;&lt;feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/&gt;&lt;/filter&gt;&lt;/svg&gt;#grayscale");
-webkit-filter: grayscale(0%);
}
@samdark
samdark / render_leveled_list_as_ul.php
Created June 29, 2012 08:31
Render leveled list as unordered list
<?php
function render_level_list($items)
{
$level=0;
foreach($items as $item)
{
if($item->level==$level) {
echo "</li>\n";
}