This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# run: fab backup | |
__author__ = 'fdcore' | |
from fabric.api import env, run, get | |
from datetime import datetime | |
import os | |
env.hosts = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title>{% block title %}{{ title|default('My Default Title') }}{% endblock %}</title> | |
<!-- | |
in code | |
$tags['title'] = 'my title'; | |
or | |
{% block title %}my title{% endblock %} | |
--> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function curl_get_file_contents($URL) | |
{ | |
$c = curl_init(); | |
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($c, CURLOPT_URL, $URL); | |
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:37.0) Gecko/20100101 Firefox/37.0'); | |
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($c, CURLOPT_VERBOSE, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function stars ($string, $color_class='') { | |
$html = '<ul class="rating '.$color_class.'">'; | |
$avg5 = round($string / 2, 1); | |
for($i=0; $i <= 5; $i++){ | |
$x = $i + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// принимает время в unix timestamp | |
// возвращает текст (сегодня в 01:23, вчера в 12:34, 3 мар 2015 в 23:45) | |
function short_date($a) { | |
date_default_timezone_set('Europe/Moscow'); | |
$ndate = date('d.m.Y', $a); | |
$ndate_time = date('H:i', $a); | |
$ndate_exp = explode('.', $ndate); | |
$nmonth = array('','янв','фев','мар','апр','мая','июн','июл','авг','сен','окт','ноя','дек'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists('url_title')) | |
{ | |
/** | |
* Create URL Title | |
* | |
* Takes a "title" string as input and creates a | |
* human-friendly URL string with a "separator" string | |
* as the word separator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// echo uuid_encode('cd76b808-4017-4965-b9b1-2dbcf857e405'); | |
function uuid_encode($uuid){ | |
$binary = pack("h*", str_replace('-', '', $uuid)); | |
$binary = base64_encode($binary); | |
$binary = str_replace('/', '_', $binary); | |
$binary = str_replace('=', '', $binary); | |
return $binary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function parseCondition($field, $value = null, $join = '', $escape = true) { | |
if (is_string($field)) { | |
$operator = ''; | |
if (strpos($field, ' ') !== false) { | |
list($field, $operator) = explode(' ', $field); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_win($arr){ | |
$chance = rand(0, 100); | |
$keys = array_keys($arr); | |
$total = count($keys); | |
if($total == 0) return false; | |
$inter_stopper = 100;// DDOS FIX? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
By dmitriy@nyashk.in | |
<input type="hidden" name="rate" id="star_rate" value="0"> | |
<div class="stars empty" data-id="rate"> | |
<ul> | |
<li><i class="fa fa-star-o"></i></li> | |
<li><i class="fa fa-star-o"></i></li> | |
<li><i class="fa fa-star-o"></i></li> |
OlderNewer