Skip to content

Instantly share code, notes, and snippets.

@dragg
dragg / example.js
Created March 18, 2020 05:56
Sort exapmle
import sort from './sort';
function sort(type) {
const sortFunction = getSortFunctiion(type);
if(sortFunction) {
return products.sort(sortFunction);
}
return products;
@dragg
dragg / XDebug
Last active January 8, 2020 18:25
PHP switching xdebug command's aliases
alias xoff='sudo phpdismod -v 7.3 -s cli xdebug'
alias xon='sudo phpenmod -v 7.3 -s cli xdebug'
@dragg
dragg / Links
Created April 27, 2019 08:05
ITerm Profile with hotkeys
@dragg
dragg / using
Last active January 29, 2018 07:01
Examples
/**
* Return order field and direction
*
* @param \Illuminate\Http\Request $request
* @return array
*/
function datatable_get_order_data(\Illuminate\Http\Request $request)
{
$columnNumber = $request->get('order')[0]['column'];
$column = $request->get('columns')[$columnNumber];
@dragg
dragg / Select2
Last active August 27, 2021 05:31
Vue Components
<template>
<select :name="name" class="form-control">
<slot></slot>
</select>
</template>
<script>
import 'select2-bootstrap-theme/dist/select2-bootstrap.css';
export default {
server {
...
location / {
auth_basic "Restricted";
auth_basic_user_file "/home/vagrant/Projects/school/.htpasswd";
try_files $uri $uri/ /index.php?$query_string;
}
@dragg
dragg / .env
Last active June 3, 2017 11:33 — forked from Ellrion/.tinker
Laravel tinker helper include file
PSYSH_CONFIG=tinker.config.php
@dragg
dragg / down method example
Created April 3, 2017 11:06
Laravel migration - changing enum field
DB::statement("ALTER TABLE $TABLE_NAME$ CHANGE $FIELD_NAME$ type ENUM($ENUM_PREVIOUS_OPTION_1$, $ENUM_PREVIOUS_OPTION_2$)");
location ~* \.(eot|ttf|woff|woff2|jpg|jpeg|png)$ {
add_header Access-Control-Allow-Origin *;
}
@dragg
dragg / alert-service.js
Created February 10, 2017 06:18
Alert service using inside https://github.com/jirikavi/AngularJS-Toaster and angular translation package
(function () {
'use strict';
angular
.module('app')
.service('alertService', alertService);
alertService.$inject = ['toaster', '$filter'];
/* @ngInject */