Skip to content

Instantly share code, notes, and snippets.

View dmitrymomot's full-sized avatar
🤨

Dmytro Momot dmitrymomot

🤨
View GitHub Profile
@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";
}
@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%);
}
@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;
@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]
*
@fhferreira
fhferreira / CORS.php
Last active April 30, 2023 16:49
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.
@stupidbodo
stupidbodo / aes_encryption.go
Last active January 3, 2024 10:29
AES Encryption Example in Golang
// Playbook - http://play.golang.org/p/3wFl4lacjX
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
@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'
@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
@mreschke
mreschke / nginx.conf
Last active May 14, 2024 14:54
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
@lukas-h
lukas-h / license-badges.md
Last active July 11, 2024 07:00
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)