Skip to content

Instantly share code, notes, and snippets.

AntonioCS AntonioCS

Block or report user

Report or block AntonioCS

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 flip_unordered_map.cpp
#include <iostream>
#include <unordered_map>
#include <string>
template <typename T1, typename T2>
std::unordered_map<T2, T1> flip(std::unordered_map<T1, T2>& m) {
std::unordered_map<T2, T1> result;
for (auto&& [key, value] : m) {
result.emplace(value, key);
View getPrivateParentProperties.php
class Pappi {
private $prop = "default value";
class Child extends Pappi {
View permutations_example.php
function swap(string &$str, int $i, int $ii) : void {
$tmp = $str[$i];
$str[$i] = $str[$ii];
$str[$ii] = $tmp;
function permute(string $str, int $l, int $r, array &$result) : void {
AntonioCS / regex_match_all.cpp
Created Oct 29, 2019
Using c++ regex to create a match all function which returns the matched element and the position
View regex_match_all.cpp
#include <iostream>
#include <string>
#include <vector>
#include <regex>
auto match_all(std::string input, const std::string& pattern) noexcept {
std::vector<std::pair<std::string, int>> matches{};
try {
const std::regex self_regex(pattern);//, std::regex_constants::ECMAScript | std::regex_constants::icase);
AntonioCS / Makefile
Last active Nov 21, 2019
Self documenting makefile template for docker (php)
View Makefile
.PHONY: help
compose_file_path = ./docker/docker-compose.yml
dc = docker-compose --file $(compose_file_path)
service_php = php_fpm
phpstorm_server_config_name = my-server-name
service_redis = redis
AntonioCS / main.cpp
Created Aug 21, 2019
Using regex in C++ to transform a string into JSON
View main.cpp
This should transform the string:
- name=Maria, grades-90,age/25?university-UCL,surname=Hill,grades//85,graduates=5%ID=356231, graduates-7,grades=78//graduates=3
View solution.cmd
@echo off
set __SOURCE_PATH=%~dp0
for /f %%i in ('where vcpkg.exe') do (
set __SCRIPT_PATH=%%~dpiscripts
goto :script_found
echo Could not find executable: vcpkg.exe
AntonioCS /
Created Nov 26, 2015
Create or recreate a doctrine2 entity
php app/console doctrine:mapping:import --filter=$entity $bundle xml
php app/console doctrine:mapping:convert --force --filter=$entity annotation ./src
php app/console doctrine:generate:entities $bundle:$entity
AntonioCS / Scripting\PHP Class
Last active Nov 25, 2015
Netbeans Template for PHP Class
View Scripting\PHP Class
<#assign licenseFirst = "/* ">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">
<#if namespace?? && namespace?length &gt; 0>
<#assign strings = namespace?split("\\")>
<#assign package = strings[0]>
<#assign category = namespace?substring(namespace?index_of("\\") + 1)>
View gist:5129826
//Based on
class hex2rgb {
private static $_cache = array();
private function __construct() {
You can’t perform that action at this time.