Skip to content

Instantly share code, notes, and snippets.

Avatar

Stan Angeloff StanAngeloff

View GitHub Profile
View add-space-to-extent_test_chars.patch
Add space to extent_test_chars to have FontAwesome being recognized.
Fixes:
$ urxvt -fn "xft:FontAwesome"
urxvt: unable to calculate font width for 'FontAwesome:minspace=True', ignoring.
urxvt: unable to load base fontset, please specify a valid one using -fn, aborting.
Posted to upstream mailinglist:
@StanAngeloff
StanAngeloff / СЛП.sh
Last active Jan 30, 2019
Фибанк: СЛП (Лихвен процент, базиран на спестяванията) от терминала
View СЛП.sh
#!/bin/sh
curl -sSL 'https://www.fibank.bg/bg/jilishten-kredit-pravo-na-izbor/page/3467' | \
pup -p '#AIRResults json{}' | \
jq '. as $page | $page | ( [ .[].children[] | select(has("children")) ] | map(.["children"][]["text"]) ) as $list | ( $list | [ range(0; $list | length; 2) | { ($list[.]): $list[(. + 1)] } ] | add ) as $currencies | [{ ($page[0].children[0].text): ($page[0].children[1].text) }, $currencies] | add'
View functional.js
const curry = (fx) => {
const arity = fx.length;
return function f1(...args) {
return args.length >= arity ? fx.apply(null, args) : function f2(...args2) {
return f1.apply(null, args.concat(args2));
};
};
};
View CreateRegistryServicesPass.php
<?php
final class CreateRegistryServicesPass extends AbstractCompilerPass
{
# …
/**
* Create a service decorator which will memoize values returned by the registry making it deterministic.
*
* @param ContainerBuilder $container
View config-grsec
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.1.10 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
View adapter.jsx
export function quit() {
'use strict';
Factory.logger().info('quit() requested.');
emit(AdapterQuitEvent).then(function() {
window.close();
});
}
View DistributionServiceTest.php
<?php
# snip...
/**
* @test
*/
public function distributeCreatesANewFile()
{
$this->distributionRepository->findOneBySegmentName(Argument::exact('Segment 1'))
@StanAngeloff
StanAngeloff / expressions.md
Created May 28, 2015
Query Expressions (short introduction)
View expressions.md

Query Expressions

When crafting a query, a Query\Expression instance can be used in the 'selectPrimary' option. The expression wraps a string formatted according to a domain-specific language (DSL) for queries.

Evaluation

The primary PostgreSqlQueryBuilder does not have any special knowledge what an Expression is and how to parse it. Instead, the builder relies on visitors to extend existing functionality with new cases.

The visitor ExpressionQueryBuilderVisitor is registered in the builder and is responsible for parsing the expression and adjusting the options of the query. When an Expression instance is encountered in this visitor, the expression is parsed into an abstract syntax tree (AST). The original query is modified so that all columns which are mentioned in the expression are included to be SELECT'ed. E.g., the expression SUM("table"."column1" + "table"."column2") will instruct the query builder to generate SQL code for "table"."column1" and `"table"."column2"

View LICENSE
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View multitenant.php
<?php
// [..snip..]
$this->participantRepositoryFactory
->forTenant(
$this->getTenantIdFromOAuthClient($client)
)
->persist(
$participant