Skip to content

Instantly share code, notes, and snippets.

View metalagman's full-sized avatar

Alexey Samoylov metalagman

View GitHub Profile
Options FollowSymLinks
AddDefaultCharset utf-8
<IfModule mod_rewrite.c>
RewriteEngine On
# the main rewrite rule for the frontend application
RewriteCond %{REQUEST_URI} !^/(backend/web|admin)
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]
<?php
/**
* @author Alexey Samoylov <[email protected]>
*/
namespace common\components;
use yii\data\DataProviderInterface;
class MapDataProvider implements DataProviderInterface
{
@metalagman
metalagman / UI.php
Last active November 15, 2017 08:55
Yii2 asset url resolving
/**
* @param $url
* @return string
* @throws \yii\base\InvalidConfigException
*/
public static function getAssetUrl($url)
{
$class = ArrayHelper::getValue([
'app-frontend' => \frontend\assets\AppAsset::class,
], \Yii::$app->id);
func initConfig() {
viper.SetConfigType("toml")
cobra.CheckErr(viper.ReadConfig(bytes.NewBuffer(defaultConfig)))
cobra.CheckErr(viper.BindPFlags(rootCmd.PersistentFlags()))
viper.SetEnvPrefix(envPrefix)
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
cobra.CheckErr(viper.BindPFlag("log.level", rootCmd.PersistentFlags().Lookup("level")))
cobra.CheckErr(viper.BindPFlag("log.pretty", rootCmd.PersistentFlags().Lookup("pretty")))