Skip to content

Instantly share code, notes, and snippets.

@PavelPolyakov
PavelPolyakov / routes.php
Last active October 2, 2016 21:06
Complete example of the named routes for the Route::controller, Laravel 4.
<?php
// for Laravel 4.1.*
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
'postCreate'=>'dashboard.bank-accounts.create.post'));
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
// for Laravel 4.0.* it was possible to do like this
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
@PavelPolyakov
PavelPolyakov / custom_logs.php
Created December 6, 2013 14:19
Storing logs to the custom files, Laravel 4
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$monolog = new Logger('log');
$monolog->pushHandler(new StreamHandler(storage_path('logs/log-'.date('Y-m-d').'.txt')), Logger::WARNING);
$monolog->debug("hello ".rand(100,200), array(rand(30,20), array(rand(1,1000), rand(1000,2000))));
@PavelPolyakov
PavelPolyakov / app.php
Last active February 6, 2023 04:11
How to still have the debug turned on on production
<?php
return array(
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
@PavelPolyakov
PavelPolyakov / filters.php
Last active February 6, 2023 04:11
Laravel the very basic auth filter
<?php
// located in the /app/filters.php
/* some original code */
Route::filter('statistics.auth.basic', function() {
$user = Request::getUser();
$password = Request::getPassword();
if (!App::environment('development') &&
@PavelPolyakov
PavelPolyakov / quests.json
Last active August 29, 2015 14:04
quests.json
{
"basePath": "http://local.questouri.com/api",
"swaggerVersion": "1.2",
"apiVersion": "0.1",
"resourcePath": "/quests",
"apis": [
{
"path": "/quests",
"description": "Display a listing of the resource. GET /user-quests",
"operations": [
var require = patchRequire(require);
// now you're ready to go
var utils = require('utils');
// jquery
var $ = require('jquery');
exports.solveCaptcha = function(captchaData, options) {
@PavelPolyakov
PavelPolyakov / builder.vue
Created July 13, 2015 20:57
trying vueify
<template>
<button type="button"
class="btn btn-lg btn-success"
style="margin: 10px;"
v-class="disabled: isMaxResponses"
v-on="click: addResponse">
<span class="glyphicon glyphicon-plus"></span> Add Response
</button>
<response v-repeat="responses" remove-response="{{removeResponse}}"></response>
<template>
<button type="button"
class="btn btn-lg btn-success"
style="margin: 10px;"
v-class="disabled: isMaxResponses"
v-on="click: addResponse">
<span class="glyphicon glyphicon-plus"></span> Add Response
</button>
<response v-repeat="responses" remove-response="{{removeResponse}}"></response>
<template>
<button type="button"
class="btn btn-lg btn-success"
style="margin: 10px;"
v-class="disabled: isMaxResponses"
v-on="click: addResponse">
<span class="glyphicon glyphicon-plus"></span> Add Response
</button>
<response v-repeat="responses" remove-response="{{removeResponse}}"></response>
<template>
<div class="modal fade" id="addVerbModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">