Skip to content

Instantly share code, notes, and snippets.

View b1rdex's full-sized avatar
🚀
༼ つ◕_◕ ༽つ

Anatoly Pashin b1rdex

🚀
༼ つ◕_◕ ༽つ
View GitHub Profile
@b1rdex
b1rdex / breadcrumbsFilter.class.php
Created April 3, 2014 04:13
symfony1 breadcrumbs builder based on filter
<?php
class breadcrumbsFilter extends sfFilter
{
public function execute($filterChain)
{
if ($this->isFirstCall()) {
$module = $this->context->getRequest()->getParameter("module");
$action = $this->context->getRequest()->getParameter("action");
@b1rdex
b1rdex / is-focused.js
Created February 25, 2014 05:48
node-webkit window.isFocused emulation
(function() {
window.frame = require("nw.gui").Window.get();
window.frame.isFocused = true;
var windowFocusHandler = function() {
window.frame.isFocused = true;
}
, windowBlurHandler = function() {
window.frame.isFocused = false;
#property copyright ""
#property link ""
#property description "moving averages"
#define MAGICMA 123123123
input double MaximumRisk = 0.02; // maximum risk (% of depo)
input bool willYouTradeBuyHands = false; // if true, I'll check every opened order for creator (possible slowing?)
@b1rdex
b1rdex / main.js
Last active December 27, 2015 23:49
node-webkit cut/copy/paste context menu example
// script moved to http://github.com/b1rdex/nw-contextmenu
@b1rdex
b1rdex / gist:5624332
Created May 22, 2013 00:14
support for exprlib syntax for formulate
static public function build($formula, $isCalculable = self::CALCULABLE)
{
return new Formula($formula, $isCalculable);
}
public function setVars(array $vars)
{
$this->parameterBag->datas = array_merge($this->parameterBag->datas, $vars);
return $this;
@b1rdex
b1rdex / gist:5624325
Created May 22, 2013 00:11
hoa math condition functions
// defining hoa functions
'if' => xcallable(function($condition, $than, $else) {
return $condition ? $than : $else;
}),
'lt' => xcallable(function($left, $right) {
return $left < $right;
}),
'gt' => xcallable(function($left, $right) {
return $left > $right;
}),
@b1rdex
b1rdex / gist:2699921
Created May 15, 2012 08:06
Print cart for ulmart.ru shop
//Dear Razrabs, please add this fucking feature to your site.
;(function() {
var artids = $('.artid'),
names = $('.clName a'),
counts = $('.clCount input'),
prices = $('.clPrice'),
costs = $('.clCost'),
r = []
;
@b1rdex
b1rdex / sfWidgetFormSchemaFormatterBootstrap.class.php
Created April 14, 2012 07:51 — forked from aledujke/sfWidgetFormSchemaFormatterBootstrap.class.php
Symfony form formatter to use with Twitter Bootstrap v2.0 CSS
<?php
class sfWidgetFormSchemaFormatterBootstrap extends sfWidgetFormSchemaFormatter
{
protected
$rowFormat = "<div class=\"control-group %row_class%\">\n %label%\n <div class=\"controls\">\n %field%\n %error%\n %help%\n %hidden_fields%\n </div>\n</div>\n",
$errorRowFormat = '%errors%',
$errorListFormatInARow = "<span class=\"help-inline\">%errors%</span>\n",
$errorRowFormatInARow = "%error% ",
$namedErrorRowFormatInARow = "%name%: %error% ",
$helpFormat = '<p class="help-block">%help%</p>',