Skip to content

Instantly share code, notes, and snippets.

@boda2004
boda2004 / gist:2e1a380824eb0934b827f2649c642fbb
Created March 28, 2024 12:14
grafana dashboard for spring app
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
@boda2004
boda2004 / Dockerfile
Last active October 25, 2021 16:12
openttd in docker
ARG DISTRO=debian
ARG RELEASE=bullseye-slim
FROM ${DISTRO}:${RELEASE} as builder
ARG OPENTTD_RELEASE=12.0
ARG OPENGFX_RELEASE=7.1
ENV DEBIAN_FRONTEND=noninteractive
# Dependencies needed to compile OpenTTD
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && \
@boda2004
boda2004 / Department.java
Created March 23, 2020 06:30
Localized (de)serialization
package com.example.demo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
public class Department {
@JsonView(Views.English.class)
@JsonProperty("category")
private String category;
.root {
color: red;
}
CACHE MANIFEST
#v3
index.html
example.appcache
@boda2004
boda2004 / model-oriented-actions.js
Created May 11, 2015 18:11
Flummox server side page boostrapping
class PhotoActions extends Actions {
async loadPhoto(id) {
try {
return await ApiService.getPhoto(id);
} catch (e) {
console.error(e);
}
}
}
/* ... other actions */
#ServiceCircularReferenceException: Circular reference detected for service "doctrine.orm.default_entity_manager", path: "doctrine.orm.default_entity_manager -> doctrine.dbal.default_connection -> photo.listener -> security.context -> security.authentication.manager -> security.user.provider.concrete.main".
photo.listener:
class: Acme\ArmmBundle\EventListener\PhotoListener
arguments:
uploadRootDir: "%kernel.root_dir%/../web/uploads"
context: "@security.context"
tags:
- { name: doctrine.event_listener, event: preUpdate}
- { name: doctrine.event_listener, event: postUpdate}
- { name: doctrine.event_listener, event: prePersist}
var config = require('./config').config;
/* Usage sample */
var io = require('socket.io').listen(config.websockets.port);
Modernizr.load({
test:Modernizr.input.placeholder,
nope:["//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", "//raw.github.com/danielstocks/jQuery-Placeholder/master/jquery.placeholder.min.js"],
complete:function () {
if (!Modernizr.input.placeholder && $) {
$(function () {
$('input[placeholder], textarea[placeholder]').placeholder();
});
}
}
@boda2004
boda2004 / gist:2350127
Created April 10, 2012 10:17
vkontakte oauth provider
<?php
namespace Boda\VkontakteBundle\Security\Http\OAuth;
use Knp\Bundle\OAuthBundle\Security\Http\OAuth\OAuthProvider;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Request;