Skip to content

Instantly share code, notes, and snippets.

SELECT
`sights_lang`.`name`,
`sights_lang`.`address`,
`sights`.`category_id`,
`sights_categories_lang`.`
categoryName`,
`sights`.`latitude`,
`sights`.`longitude`,
`sights`.`sights_id`
FROM `partner_hotels`.`sights_lang`
@shmaltorhbooks
shmaltorhbooks / covnert_to_utf8.sh
Created August 27, 2015 09:05
convert project files to OTF-8
find . -name "*.jsp" -exec fconv {} \;
@shmaltorhbooks
shmaltorhbooks / reg.php
Created August 27, 2015 09:03
Cut images (with links and without)
$image = "/(<a[^<]+\>[^<]*|)\<img [^<]+\>([^<]*\<\/a\>|)/ism";
@shmaltorhbooks
shmaltorhbooks / objectByString.js
Last active August 29, 2015 14:21
Access to object members by string path
/**
* @example Object.byString(someObject, 'part1.name')
* @example Object.byString(someObject, 'part2.qty')
* @example Object.byString(someObject, 'part3[0].name')
*
* @param obj {Object}
* @param str {String}
* @returns {*}
*/
Object.byString = function(obj, str) {
# Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html
MyEntity:
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
namedQueries:
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
server {
listen 80;
server_name ~^(www\.)?(?<sname>.+?).local.com$;
root /var/www/$sname/public;
index index.html index.htm index.php;
charset utf-8;
location / {
@shmaltorhbooks
shmaltorhbooks / router.yml
Created February 2, 2015 16:32
define symfony routing as service in symfony DI-container
parameters:
routing.file: 'routing_%core.name%.yml'
routing.cache:
debug: %core.debug%
cache_dir: '%core.cache_path%/routing/'
generator_cache_class: '%core.name%UrlGenerator%core.env%'
matcher_cache_class: '%core.name%UrlMatcher%core.env%'
services:
routing.file_locator:
@shmaltorhbooks
shmaltorhbooks / doctrine.yml
Last active August 29, 2015 14:14
define doctrine as service in symfony2 DI-container
parameters:
doctrine_cache.class: Doctrine\Common\Cache\ArrayCache
doctrine_metadata.class: Doctrine\Common\Annotations\Reader
doctrine_configuration.class: Doctrine\ORM\Configuration
doctrine_entity_manager.class: Doctrine\ORM\EntityManagerInterface
doctrine_entity_manager_factory.class: Doctrine\ORM\EntityManager
doctrine.proxy_dir.path: '/path/to/proxy'
doctrine.proxy.namespace: 'Project\Proxies'
#!/bin/sh
sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
@shmaltorhbooks
shmaltorhbooks / mediawiki.com.conf
Created July 3, 2014 09:36
Nginx config for MediaWiki
server {
listen 80;
server_name mediawiki.com;
root /var/www/mediawiki.com;
client_max_body_size 5m;
client_body_timeout 60;