Skip to content

Instantly share code, notes, and snippets.

View rawroland's full-sized avatar

Roland Awemo rawroland

View GitHub Profile
@rawroland
rawroland / delete-pods
Last active August 13, 2019 15:41
Delete pods
while kubectl delete pod $(kubectl get pods -nkube-system | awk '/kube-/ {print $1;exit}') -nkube-system; do done;
{
"name": "NRWgov/NRWgov",
"description": "Drupal 8 for Government (Drupal 8 für die öffentliche Verwaltung)",
"type": "project",
"license": "GPL-2.0+",
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"drupal/drupal-extension": "^3.2",
"behat/mink": "~1.7",
@rawroland
rawroland / Translation.js
Created May 16, 2017 13:42
Local storage for translations / locales
import {EventEmitter} from 'fbemitter';
const CHANGE_EVENT = 'change';
export default class Translation extends EventEmitter {
constructor(eventEmitter = null, storage = null) {
super();
this.eventEmitter = eventEmitter || new EventEmitter();
this.localeStorage = storage || localStorage;
// encode(decode) html text into html entity (assuming entity is hex)
var HtmlEntity = {
decode : function(str) {
return str.replace(/&#x([0-9A-F]+);/gi, function(match, dec) {
return String.fromCharCode(parseInt(dec, 16));
});
},
encode : function(str) {
var buf = [];
Search: \$this->Session->setFlash(.*)\), 'alert_success'\); # (.*) Denotes a group with any text in the
Replace: \$this->flashSuccess$1\)\); # $1 is the back reference to replace the group
current_datetime:
class: \DateTime
arguments: ["now"]
access_control:
# Would I need to write such rules for all urls?
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [1.1.1.0/24]}
- { path: ^/reset-password, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [1.1.1.0/24]}
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY}
@rawroland
rawroland / security.yml
Last active November 24, 2016 16:32
access control without ip range
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1]}
- { path: ^/login, roles: ROLE_NO_ACCESS}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Herzlich Willkomen bei Präventionsatlas | Präventionsatlas</title>
<link href="/css/bootstrap.css" rel="stylesheet" media="screen">
<link href="/assets/vendor/bootstrap-material-design/dist/css/bootstrap-material-design.css" rel="stylesheet" media="screen">
<link href="/assets/vendor/bootstrap-material-design/dist/css/ripples.css" rel="stylesheet" media="screen">
<link href="/css/jquery-ui-theme/jquery-ui.css" rel="stylesheet" media="screen">
<link href="/assets/vendor/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css" rel="stylesheet" media="screen">
{% extends 'base.html.twig' %}
{% set pageHeader = 'Welcome' %}
{% set title = pageHeader %}
{% block body %}
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="{{ path('login') }}" method="post" class="form-horizontal" novalidate="novalidate" accept-charset="utf-8">
<div class="form-group required">
<label for="username" class="col-md-2 control-label">Email:</label>