Skip to content

Instantly share code, notes, and snippets.

View keltanas's full-sized avatar
🇷🇺
justice will be served

Ke7Tana5 keltanas

🇷🇺
justice will be served
  • Saint Petersburg
View GitHub Profile
@keltanas
keltanas / gist:3499449
Created August 28, 2012 15:59
Плагин для twitter bootstrap, открывает dropdown меню при наведении, если оно находится внутри navbar
/**
* Плагин для twitter bootstrap, открывает dropdown меню при наведении, если оно находится внутри navbar
* <div class="navbar" id="menu1">...</div>
* <script type="javascript">$(document).ready(function(){
* $('#menu1').dropdownMouse()
* });</script>
* @return {*}
*/
$.fn.dropdownMouse = function()
{
@keltanas
keltanas / VatCalculatingService.php
Last active November 21, 2016 14:37
Vat calculating
<?php
use Money\Money;
/**
* Class VatCalculatingService
* Calculating VAT
*
* @see: http://www.achievertalk.com/achievertalkwp/2011/06/vat-in-your-young-enterprise-company/
*/
class VatCalculatingService
<?php
# http://seyferseed.ru/ru/php/kastomnaya-strategiya-gerenatsii-id-v-doctrine-2.html#sthash.r0n7nj05.dpbs
print 'orig: 581a8775b67e88-ca53-8b4568' . PHP_EOL;
print 'comp: ' . uniqid('', false) . dechex(mt_rand(0, 0xF)) . '-' . dechex(getmypid()) . '-' . dechex(mt_rand(0, 0xFFFFFF)) . PHP_EOL;
@keltanas
keltanas / vkmixin.py
Created January 27, 2016 14:43 — forked from adilkhash/vkmixin.py
Vkontakte Oauth 2.0 Mixin
#!/usr/bin/env python
#
# Vkontatke OAuth 2.0 wrapper
# Copyright 2011, Adil Khashtamov [adil.khashtamov@gmail.com]
# http://khashtamov.kz
#
#
import logging
<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
Это вставить например, в "верхняя часть сайта"
<a href="#" id="blind">Версия</a>
<script>
$(function(){
$('#blind') // ссылается на <a href="#" id="blind"></a>
.click(function(){
$('body').toggleClass('blind');
return false;

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

// Шаг 1
function(){} // объявляем анонимную функцию
// Шаг 2
(function(){})(); // - объявляем и запускаем анонимную функцию
// Шаг 3
(function($){
@keltanas
keltanas / gist:4374759
Created December 25, 2012 18:47
Тестирование демо-блога на tornado в локалхосте. Процессор Corei5 mobile.
keltanas@kelbook:~/PycharmProjects/tornado/static$ ab -n 10000 -c 1000 http://localhost:8888/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@keltanas
keltanas / true_closure.py
Created December 24, 2012 18:20
Передаем ссылку на объект через лямда-функцию
__author__ = 'keltanas'
class closure:
def get_me(self):
return lambda : self
inst_test = closure()
me = inst_test.get_me()
del inst_test