Skip to content

Instantly share code, notes, and snippets.

Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
$ctrl = $chain->next($self, $params, $chain);
if (Auth::check('default')) {
return $ctrl;
}
if (isset($ctrl->publicActions) && in_array($params['params']['action'], $ctrl->publicActions)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return $ctrl;
}
@agborkowski
agborkowski / app.css
Created February 21, 2012 22:15
bordered submit button
/* app */
.app-btn-submit{
border: 1px solid black !important;
}
@agborkowski
agborkowski / gist:1879411
Created February 21, 2012 22:18
form buttons
Ext.define('APP.view.classificationIndicators.Edit', {
extend: 'Ext.window.Window',
//...
initComponent: function() {
var me = this;
Ext.applyIf(me, {
buttons: [{
text: 'Cancel',
scope: this,
@agborkowski
agborkowski / gist:1879462
Created February 21, 2012 22:27
MySql: database values normalization
/**
* Database values normalization shows diferences betwen @OUTPUT_LOW - @OUTPUT_HIGH
* its sample for forex database with tips table and 5 colls
* open FLOAT(8,5), high FLOAT(8,5), low FLOAT(8,5), close FLOAT(8,5),
* volume TINYINT(4), symbol (ENUM), time (DATETIME).
* tested on MySql
*
* @author AgBorkowski andrzejborkowski@gmail.com
* @uses http://www.heatonresearch.com/content/really-simple-introduction-normalization (java)
* @link http://blog.aeonmedia.eu/2011/02/mysql-database-values-normalization
@agborkowski
agborkowski / .bash_profile
Created June 18, 2012 13:21
bash:profile:command: github push active branch to github, make new feature
# GitHub make new feature
ghf(){
git checkout master
git fetch github
git merge --ff github/master
git checkout -b $1 master
git push -u github $1
echo 'done'
}
# GitHub push new feature to github
<?php
//@link http://codepad.viper-7.com/GOutvO
$data = array(1,2,3,1,3,99,99,4,5,3,2,1,99);
$duplicate = array();
foreach ($data as $a) {
array_pop($data);
foreach($data as $b){
if ($a == $b && !in_array($a,$duplicate)){
$duplicate[] = $b;
echo "duplicate {$a} <br />\r\n";
@agborkowski
agborkowski / gist:3338083
Created August 13, 2012 08:03 — forked from jaseg/gist:3334991
Password manager without a password manager

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

It is 00:23 local time and I spent the part of the last night that I slept on a couch with loud music playing, so I would recommend you not to rely on my brilliant mind to produce a cryptographically secure algorithm at this time. I would, however, appreciate any comments and especially improvements of this algorithm. The first person to find a flaw has the honor to name the algorithm.

Usage

@agborkowski
agborkowski / gist:3338134
Created August 13, 2012 08:18
php::http::force cache off
<?php
//@link http://www.paulund.co.uk/disable-http-cache-with-php
header("Content-Type: application/json");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
@agborkowski
agborkowski / gist:3467776
Created August 25, 2012 16:48
c::max write speed::ssd
#include <stdio.h>
const unsigned long long size = 8ULL*1024ULL*1024ULL; unsigned long long a[size];
int main()
{
FILE* pFile;
pFile = fopen("file.binary", "wb");
for (unsigned long long j = 0; j < 1024; ++j){
//Some calculations to fill a[]
fwrite(a, 1, size*sizeof(unsigned long long), pFile); }
fclose(pFile);
@agborkowski
agborkowski / g11n.php
Created October 12, 2012 17:32
Lithiumphp::g11n::tld
/**
* @author AgBorkowski <andrzejborkowski@gmail.com>
* @link http://blog.aeonmedia.eu
*/
/**
* Locales
*
* Adds globalization specific settings to the environment. The settings for
* the current locale, time zone and currency are kept as environment settings.