Skip to content

Instantly share code, notes, and snippets.

View 4unkur's full-sized avatar
🇰🇬
"Patrick"

Daiyrbek Artelov 4unkur

🇰🇬
"Patrick"
View GitHub Profile
@jangaraev
jangaraev / MorphMapServiceProvider.php
Last active August 17, 2022 10:13
Specifying map for morph relationships which enables short/human-friendly model names in DB
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class MorphMapServiceProvider extends ServiceProvider
{
function c {
git add --all
git commit -m $1
}
function p {
git add --all
git commit -m $1
@amalichev
amalichev / mixins.scss
Last active March 6, 2022 15:29
adaptive-font()
$layout-width: 1280;
@mixin adaptive-font($lg-size: 16, $xs-size: 14, $xs-screen: 320) {
$add-size: $lg-size - $xs-size;
$max-width: $layout-width - $xs-screen;
font-size: calc(#{$xs-size + px} + #{$add-size} * ((100vw - #{$xs-screen + px}) / #{$max-width}));
}
// h1 { @include adaptive-font(32, 24); }
@fedorkk
fedorkk / books_list.txt
Last active April 26, 2024 21:09
Список книг для обучения
Алгоритмы:
1) Стивен Скиена "Алгоритмы. Руководство по разработке"
2) Томас Кормен "Алгоритмы. Построение и анализ"
3) Дональд Кнут "Искусство программирования" (никто в реальности не читал этот многотомный труд целиком, но в любой подборке по алгоритмам он обязан быть)
Общее:
1) Род Хаггарти "Дискретная математика для программистов"
2) Керниган, Ритчи "Язык программирования С" - для общего понимания принципов программирования
3) Дж. Андресон "Дискретная математика и комбинаторика"
4) Романовский И.В. "Дискретный анализ"
@jmny
jmny / migration.php
Last active December 14, 2023 04:44
phinx outside cli
// see also https://github.com/robmorgan/phinx/issues/364
$phinxApp = new \Phinx\Console\PhinxApplication();
$phinxTextWrapper = new \Phinx\Wrapper\TextWrapper($phinxApp);
$phinxTextWrapper->setOption('configuration', '/path/to/phinx.yml');
$phinxTextWrapper->setOption('parser', 'YAML');
$phinxTextWrapper->setOption('environment', 'development');
@alfredobarron
alfredobarron / select2-bootstrap3.css
Created August 19, 2015 21:55
Height select 2 in bootstrap 3.3.4
/**
* Change three lines
*
/* line 11 */
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 34px;
user-select: none;
@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active May 19, 2024 11:02
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@vluzrmos
vluzrmos / compat_l5.php
Last active November 1, 2022 20:43
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@goranprijic
goranprijic / BaseModel.php
Created December 17, 2014 10:12
Check if table is already joined in Laravel Query Builder
<?php
class BaseModel extends Eloquent {
public static function isJoined($query, $table)
{
$joins = $query->getQuery()->joins;
if($joins == null) {
return false;
}
@barryvdh
barryvdh / _ide_helper.php
Last active May 6, 2024 07:45
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");