Skip to content

Instantly share code, notes, and snippets.

Avatar

Václav Šír VaclavSir

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am vaclavsir on github.
  • I am vaclavsir (https://keybase.io/vaclavsir) on keybase.
  • I have a public key ASCkrZLdR5A2e52GUmPaRlhhiowbq7CzpM2qMue4_eg9wgo

To claim this, I am signing this object:

View article-react-1.html
<div
data-embed-component="Hello"
data-embed-props='{"recipient": "World"}'
></div>
@VaclavSir
VaclavSir / howto.md
Created Mar 16, 2017
How to read articles at martinfowler.com
View howto.md
  1. Open developer tools.
  2. Open Console.
  3. Execute $('#content')[0].style.margin='0 auto'
@VaclavSir
VaclavSir / tmp.js
Created Feb 20, 2017
package.json: Find duplicities between devDependencies and dependencies
View tmp.js
const packageJson = require('./package.json');
console.log(
Object.keys(packageJson.devDependencies).filter(packageName => packageJson.dependencies.hasOwnProperty(packageName))
);
View service.php
<?php
abstract class Service
{
public function doSomething()
{
something();
$this->getLogger()->log('¯\_(ツ)_/¯');
}
@VaclavSir
VaclavSir / text.md
Created Dec 3, 2016
Why Is Context-Aware Escaping a Leaky Abstraction
View text.md

This is what the documentation says:

All is done automatically, consistently and correctly. You don't have to worry about security holes.

This is simply not true. What if you write this:

<a href="javascript:{$variable}">...</a>
View Nette 2.2
x@ACER2 /d (master)
$ /c/xampp/apache/bin/ab -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
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 100 requests
Completed 200 requests
Completed 300 requests
@VaclavSir
VaclavSir / dumpArray.php
Last active Aug 29, 2015
{{ dump_array({'foo': 'bar'}) }}
View dumpArray.php
<?php
class AcmeDemoExtension extends \Twig_Extension {
public function getFunctions() {
return [
'dump_array' => new \Twig_Function_Method($this, 'dumpArray'),
];
}
public function dumpArray($arrayLikeObject, $indentLevel = 1) {
View search.sh
#!/bin/bash
for SUBDIR in $(ls -d -- */)
do
cd $SUBDIR
echo -ne "."
CMD="git log --all --grep='$1' 2>/dev/null"
RESULT=$(eval $CMD)
if [[ "$RESULT" != "" ]]
View BasePresenter.php
<?php
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
/**
* Path to theme templates.
*
* @var string
*/