Skip to content

Instantly share code, notes, and snippets.

import os
import sys
import MySQLdb
MYSQL_HOST = "localhost"
MYSQL_USER = "testuser"
MYSQL_PASSWORD = "testpass"
MYSQL_DB = "test"
<?php
/**
* NestedSetBehavior class file.
*
* @author Alexander Kochetov <creocoder@gmail.com>
* @link https://github.com/yiiext/nested-set-behavior
*/
/**
* Provides nested set functionality for a model.
<?php
$criteria = new CDbCriteria();
$criteria->condition = "status IN(1)";
$criteria->mergeWith($model->lang()->children()->getDbCriteria());
$criteria->order = "type ASC, create_time DESC";
Pages::model()->findAll($criteria);
$qs = User::objects();
$qs = $qs->filter(...);
$qs = $qs->exclude(...);
$qs = $qs->order();
<?php
$user_qs = User::objects()->filter([
'group__permission__code__in' => [
'can_create' => true,
'can_update' => true,
'can_delete' => false
],
'is_active__isnull' => false,
'cart__price__gte' => 10000,
package main
import (
"github.com/coreos/go-etcd/etcd"
"log"
"strings"
)
var etcdKey string
var backends []string
#!/usr/bin/perl
use strict;
use warnings;
my $exclude_list_path_static = "/etc/ovznodes_backup_rsync_exclude_list.static";
my $exclude_list_path_dynamic = "/etc/ovznodes_backup_rsync_exclude_list.dynamic";
my $config_file_path = '/etc/ovznodes_backup_config';
# должна объявляться в конфиге
<VirtualHost 127.0.0.1:81>
DocumentRoot "/absolute/path/to/project/www"
DirectoryIndex index.php
ServerAdmin admin@example.com
ServerAlias test.dev
ErrorLog "/absolute/path/to/project/logs/apache-error.log"
CustomLog "/absolute/path/to/project/logs/apache-access.log" common
package main
import (
"fmt"
"github.com/moovweb/gokogiri"
"io/ioutil"
"net/http"
"net/url"
"time"
)
/**
* Return the value of any protected class variable.
*
* // Get the response parameters
* $params = $response->params;
*
* @param string variable name
* @return mixed
*/
public function __get($key)