Skip to content

Instantly share code, notes, and snippets.

/**
* should behave like LocalStorage
*/
var inMemoryStorage = (function () {
var items = {};
return {
length: 0, // todo: read only
getItem: function (key) {
return 'undefined' !== typeof items[key] ? items[key] : null;
@MacDada
MacDada / build.xml
Created October 18, 2015 15:32
Ant: build.xml: php lint
<?xml version="1.0" encoding="UTF-8"?>
<project name="NazwaProjektu" default="lint">
<target name="lint" description="Sprawdzamy poprawność składni PHP (syntax check)">
<apply executable="php" failonerror="true">
<arg value="--syntax-check" />
<fileset dir="${basedir}">
<include name="**/*.php" /><!-- sprawdzaj wszystkie pliki php -->
<exclude name="PominTenFolder/**/*" />
<?php
class Updatable
{
private $field1;
private $field2;
public function __construct($field1, $field2)
{
$this->field1 = $field1;
<project name="blabla">
<condition property="composerDoesNotExist">
<not>
<available file="${basedir}/bin/composer.phar" />
</not>
</condition>
<target name="composer-download" description="Downloading Composer" if="composerDoesNotExist">
<mkdir dir="${basedir}/bin" />
`/Applications/Colobot.app/Contents/MacOS/colobot --language=pl`
/\ This opens the polish translation of http://colobot.info/
How do I set this pernamently, so that double-clicking `Colobot.app` opens the polish version?
<?php
class FormController
{
public function formAction()
{
$form = $this->createFormBuilder()
->add('something_at', 'datetime', [
'date_widget' => 'single_text',
'time_widget' => 'single_text',
{% form_theme form with [_self, 'form_table_layout.html.twig'] %}
{% block _field_that_should_be_hidden_row %}
{{ block('hidden_row') }}
{% endblock %}
<?php
class ShopOpenings
{
/**
* @var array
*/
private $config;
/**
<?php
/**
* Model szkieletor:
* struktura danych co nie ma żadnej logiki, żadnej enkapsulacji,
* korzystający może z tym obiektem zrobić co tylko zechce.
*/
class BadEntity
{
private $username;
<?php
class MyCode
{
private function option1()
{
$this->notMyCode->doSomething(function ($value) {
return strlen($value);
});
}