Skip to content

Instantly share code, notes, and snippets.

View bocharsky-bw's full-sized avatar
💔
#StandWithUkraine 🇺🇦

Victor Bocharsky bocharsky-bw

💔
#StandWithUkraine 🇺🇦
View GitHub Profile
@bocharsky-bw
bocharsky-bw / add-user-to-group
Created May 5, 2014 13:46
Add existent user to existent group | Ubuntu
sudo usermod -a -G groupname username
@bocharsky-bw
bocharsky-bw / .htaccess
Created June 3, 2014 09:20
Rewrite all requests to the index.php script, except physical file or folder requests
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php/?(.*)\s [NC]
RewriteRule ^.*$ /%1%2 [R=301,L]
# if the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
@bocharsky-bw
bocharsky-bw / symfony.conf
Last active August 29, 2015 14:02
The Nginx with PHP5-FPM config example for Symfony Framework
server {
listen 80;
server_name symfony.localhost www.symfony.localhost;
root /var/www/symfony/web;
error_log /var/log/nginx/symfony.error.log;
access_log /var/log/nginx/symfony.access.log;
# strip app_dev.php/ prefix if exists
@bocharsky-bw
bocharsky-bw / multilingual-router.yml
Last active August 29, 2015 14:02
The multilingual router example with excluding default locale from URI for Symfony Framework
home_redirect:
host: "%domain%"
pattern: /%locale%/
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /
permanent: false
home_locale:
host: "%domain%"
@bocharsky-bw
bocharsky-bw / set-default-column-value.php
Last active August 29, 2015 14:02
Set default column value for
<?php
/**
* @var string $name
*
* @ORM\Column(type="string")
*/
private $name = '';
public function setName($name) {
@bocharsky-bw
bocharsky-bw / show-dynamic-content-by-hash.js
Last active August 29, 2015 14:02
Show dynamic content by hash changes
function getDefaultSelector() {
return '.home';
}
function hashToSelector(hash) {
return hash.match(/^#.+/)
? hash.replace(/^#/, '.')
: getDefaultSelector()
;
}
@bocharsky-bw
bocharsky-bw / objec-ro-array.php
Last active August 29, 2015 14:02
The method convert current object to array
<?php
/**
* Convert current object to array
*/
public function toArray()
{
$data = array();
foreach (get_object_vars($this) as $property => $value) {
@bocharsky-bw
bocharsky-bw / .htaccess
Created June 19, 2014 10:10
The .htaccess example for Symfony Framework project that deployed on shared hosting.
#path/to/project/.htaccess
# Rewrite all requests to subdirectory, except exists file requests
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /web/$1 [QSA,L]
</IfModule>
@bocharsky-bw
bocharsky-bw / elephants
Created June 20, 2014 11:55
Console elephants when Vagrant up
_
/ )
.--.; | _...,-"""-,
.-""-.-""""-. / _`'-._.' /` \
/' \ \| (/'-._/ ) ;
.-""""-; ( '--' /-' _ |
.' | ; e / a , ;
/ \ | __.'`-.__, ; /
/ `._ ; .-' `--.,__.\ /`
//| \ \,-' /\_.'
@bocharsky-bw
bocharsky-bw / vmware-fix
Created June 22, 2014 21:31
Resolving VMware’s “Unable to update run-time folder sharing status: Unknown error”
http://jesseforrest.name/resolving-vmwares-unable-to-update-run-time-folder-sharing-status-unknown-error/305
The Problem
Sometimes when upgrading VMware, I noticed that I can no longer share directories between my local file system and the VMs file system.
In an effort to get shared folders working, I would then go to the following location in VMware:
Virtual Machine -> Sharing -> Sharing Settings …
I would accurately see the folders I want to share and I would see that Shared Folders is “ON”. In an attempt to re-share the folders I toggled Shared Folders to “OFF”. I then toggled it back to “ON” and noticed the following error: