Skip to content

Instantly share code, notes, and snippets.

View rabbl's full-sized avatar

Ralf Junghanns rabbl

View GitHub Profile
<?php
/**
* Recursively takes the specified criteria and adds too the expression.
*
* The criteria is defined in an array notation where each item in the list
* represents a comparison <fieldName, operator, value>. The operator maps to
* comparison methods located in ExpressionBuilder. The key in the array can
* be used to identify grouping of comparisons.
*
@rabbl
rabbl / RasterBand.php
Last active February 22, 2016 08:28
Raster as Custom Mapping Type in Doctrine
<?php
namespace AppBundle\Model;
class RasterBand
{
/**
* @var float[][]
*/
private $data;
// This is working
public function testInsertNullRaster()
{
$conn = $this->entityManager->getConnection();
$stmt = $conn->prepare('SET NAMES \'UTF8\'');
$stmt->execute();
$stmt = $conn->prepare('SELECT NEXTVAL(\'rasters_id_seq\')');
$stmt->execute();
@rabbl
rabbl / User.php
Last active February 2, 2019 22:26
User.php
<?php
// src/Entity/User.php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Uuid;
<?php
// src/Command/CreateUserCommand.php
declare(strict_types=1);
namespace App\Command;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rabbl
rabbl / rotate_2d_point.py
Created November 2, 2023 07:19 — forked from LyleScott/rotate_2d_point.py
Rotate X,Y (2D) coordinates around a point or origin in Python
"""
Lyle Scott, III // lyle@ls3.io
Multiple ways to rotate a 2D point around the origin / a point.
Timer benchmark results @ https://gist.github.com/LyleScott/d17e9d314fbe6fc29767d8c5c029c362
"""
from __future__ import print_function
import math
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rabbl
rabbl / build.sh
Created November 24, 2023 08:26 — forked from tifasoftware/build.sh
Building Source Engine for Apple Silicon
#!/bin/zsh
brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit
cd ~
mkdir ~/Documents/Gaming/
mkdir ~/Documents/Gaming/Half\ Life\ 2
mkdir ~/Documents/Gaming/Half\ Life\ 2\ Episodes
mkdir ~/Documents/Gaming/Portal
@rabbl
rabbl / gist:ceef6a6e9f692c55f7039abdc281c5d6
Created November 27, 2023 09:06
ConstantHeadBoundaryMapping
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"outputs": [],
"source": [
"import sys\n",
"\n",
"import numpy as np\n",