Skip to content

Instantly share code, notes, and snippets.

Pawel Dubiel pawel-dubiel

Block or report user

Report or block pawel-dubiel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1157b2e89d8ab3d565ad756477c2e961
### Keybase proof
I hereby claim:
* I am pawel-dubiel on github.
* I am paweld ( on keybase.
* I have a public key ASCpp9-PytysQjos85C369ICb2c50z_vQj9Y4-R-k6ZifQo
To claim this, I am signing this object:
View gist:30ad98fe3ef4f1baa3d3bbe0f020fabf
alias babel-node='babel-node --presets stage-0'
------ RECV ------
// babel-node recv2.js "#"
// babel-node recv2.js "kern.*"
const amqp = require('amqplib');
const args = process.argv.slice(2);
if (args.length == 0) {
View gist:eb19b94d0b351f086aeecb7aa5433452
//use script not recommended in es6 modules
export {average, sort_by_ranking_desc};
let items = [],max_test_items=10;
for ( let i=0;i<max_test_items;i++) {
items[i] = { name: "foo", ranking: Math.random() };
let sort_by_ranking_desc = (a, b) => (b.ranking-a.ranking );
pawel-dubiel / gist:b3b8c561ae3ee0e954f49ec44eea5ff7
Created Apr 17, 2017
javascript dom manipulation without jquery
View gist:b3b8c561ae3ee0e954f49ec44eea5ff7
function $(id) { return document.getElementById(id); }
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] }
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] }
function allof (cl) { return byClass(document, cl) }
function hasClass (el, cl) { var a = el.className.split(' '); return find(cl, a) }
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!find(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} }
function remClass (el, cl) { if (el) { var a = el.className.split(' '); rem(a, cl); el.className = a.join(' ') } }
function html (el) { return el ? el.innerHTML : null; }
function attr (el, name) { return el.getAttribute(name) }
function tonum (x) { var n = parseFloat(x); return isNaN(n) ? null : n }
View new_gist_file_0
get last top 10 ips from access log ( last 10000 requests )
tail -n 10000 access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail -n 10
View magento_order_status_change.php
require_once 'app/Mage.php';
* SELECT DISTINCT(status) FROM sales_flat_order ;
pawel-dubiel / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
View gist:cb261f790848f03b6c14
:new will create a split window with an unnamed buffer.
:enew will open one in the current window.
:vnew will open one in a vertically split window.
:tabnew will open one in a new tab.
Next tab: gt
View gist:053e0c784b004adc3214
#add to cron
#59 23 * * * root /bin/count_email_log
touch /var/www/mail.txt || exit
VCURRENTDATE=$(date "+%b %-d")
VCURRENTDATEFULL=$(date "+%b.%-d.%y")
You can’t perform that action at this time.