Skip to content

Instantly share code, notes, and snippets.

View Deviad's full-sized avatar

Davide P. Deviad

View GitHub Profile
@Deviad
Deviad / Acl.java
Created September 10, 2017 05:44
AOP - Aspect not working
package com.davidepugliese.springfood.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Deviad
Deviad / WebConfig.java
Created September 9, 2017 23:15
Test with EnableLoadTimeWeaving
package com.davidepugliese.springfood;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
@Deviad
Deviad / Acl.java
Created September 9, 2017 23:09
AOP implementation of a filter to create an ACL
package com.davidepugliese.springfood.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Deviad
Deviad / reactivex.js
Created August 26, 2017 12:53
Import the most needed parts of rxjs in ES6 Using prototype as using webpack it cannot do inference properly on names that are used also by other libraries.
import {Observable} from "rxjs/Observable";
import "rxjs/observable/concat";
import "rxjs/observable/from";
import "rxjs/observable/of";
import "rxjs/add/operator/map";
import "rxjs/add/operator/mergeMap";
import "rxjs/add/operator/startWith";
import "rxjs/add/operator/filter";
import "rxjs/add/operator/switchMap";
/*
eslint-disable react/prefer-stateless-function, react/jsx-boolean-value,
no-undef, jsx-a11y/label-has-for, react/jsx-first-prop-new-line
*/
class TimersDashboard extends React.Component {
state = {
timers: [
{
title: 'Practice squat',
project: 'Gym Chores',
export const FETCH_USER = 'FETCH_USER';
export const FETCH_USER_FULFILLED = 'FETCH_USER_FULFILLED';
@Deviad
Deviad / src_ActionTypes.js
Last active August 14, 2017 11:28
I need to know how to make this work with react.It's the official demo from redux-observable
export const FETCH_USER = 'FETCH_USER';
export const FETCH_USER_FULFILLED = 'FETCH_USER_FULFILLED';
@Deviad
Deviad / app_unit_tests_.py
Created July 21, 2017 22:52
app_unit_tests_.py:25: in <module> class TestApp(app): ../lib/python3.6/site-packages/flask/app.py:539: in __init__ self.add_url_rule(self.static_url_path + '/<path:filename>', E TypeError: can only concatenate tuple (not "str") to tuple
import json
import urllib
from pprint import pprint
from urllib import request, parse
import pytest
from inspect import getsourcefile
from os import path, sys
current_dir = path.dirname(path.abspath(getsourcefile(lambda:0)))
@Deviad
Deviad / app_unit_tests_.py
Created July 21, 2017 20:48
Getting out of context error
import json
import urllib
from pprint import pprint
from urllib import request, parse
import pytest
from inspect import getsourcefile
from os import path, sys
current_dir = path.dirname(path.abspath(getsourcefile(lambda:0)))
@Deviad
Deviad / index.html
Created June 22, 2017 08:23
Script for opening tabs from Divi Menu
<script>
var tab = null;
var menuSelector = null;
jQuery(function ($) {
console.log('test');
//howtos tab
function changeMenuSelector() {
if ($( document ).width() > 967) {
menuSelector = 'top-menu-nav';
} else {