Skip to content

Instantly share code, notes, and snippets.

View antonkomarev's full-sized avatar
🇦🇶
Antarctic Bear

Anton Komarev antonkomarev

🇦🇶
Antarctic Bear
View GitHub Profile
@antonkomarev
antonkomarev / style.css
Last active August 28, 2015 00:55 — forked from marcelotk15/style.css
Style to https://github.com/cmgmyr/laravel-messenger with differentiate senders and receiver.
.mensagens-chat
{
list-style: none;
margin: 0;
padding: 0;
}
.mensagens-chat li
{
margin-bottom: 10px;
requests.put('http://localhost:9200/site/', data=json.dumps({
'settings': {
'analysis': {
'analyzer': {
'ru': {
'type': 'custom',
'tokenizer': 'standard',
"filter": ['lowercase', 'russian_morphology', 'english_morphology', 'ru_stopwords'],
},
},
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
<?php
namespace frontend\assets;
use yii\web\AssetBundle;
use yii\web\View;
class ShivAsset extends AssetBundle
{
public $sourcePath = '@bower';
@antonkomarev
antonkomarev / Redirect After Session Expires.md
Last active August 29, 2015 14:27 — forked from flackend/Redirect After Session Expires.md
Example solution to handling re-authentication after session expires for AJAX requests.

When a user's session expires and they're on a page that uses ajax requests, you need to set up something to gracefully handle reauthenticating. In this example, we prompt the user and redirect them to the login page.

demo

For Laravel, in your auth filter:

<?php
Route::filter('auth', function()
{

DB Design performance tips and tricks


  • Learn from smarties
  • Evangelize good DB design (which in turn helps you solidify your own knowledge)
  • Talk to business people
  • Benchmark your queries to determine the fastest

@antonkomarev
antonkomarev / gist:7a0c9367695babf76b78930f67f6ad05
Created April 16, 2016 17:07 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
# Example integration of a background-image uploader
# Author: Guillaume Piot
# Email: guillaume@cotidia.com
# Company: Cotidia Ltd
# Licence: MIT
#
# The div holder is absolute positioned within the parent div
#
# <div class="[ article__image ] [ article-image ] [ editable ] [ parallax ]" data-name="article_image">
# <div

Real-time Grid Component with Laravel, Vue.js, Vuex & Socket.io (Google Docs-like Functionality)

Motivation

The exercise of writing this tutorial -- as well as recording it as a screencast -- has helped me better understand the concepts behind a couple of my favorite open source tools. Both the tutorial and screencast will be of personal use in the future as references. If they are of help to others, that will be great too.

I love Google Docs' real-time, multi-user interactive capability, and I've have always been a fan of spreadsheets. I wanted to see if I could replicate that type of functionality. What I've done is taken the basic Vue.js Grid Component example and altered it a bit so that when a user clicks on a cell, that cell becomes highlighted or "active", not just in the user's browser but in any browser instance cur

<?php
namespace App\Domain\Courses;
use App\Domain\Courses\Exam\ExamQuestion;
use App\Domain\Courses\Exam\ExamVersion;
use App\Exceptions\Courses\CourseCannotBeOpened;
class CourseOpener
{