This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FIRST_MONTH_OF_THE_YEAR = 0; | |
const FIRST_DAY_OF_THE_MONTH = 1; | |
const DAYS_IN_A_WEEK = 7; | |
const THURSDAY_DAY_OF_THE_WEEK = 4; | |
const SUNDAY_DAY_OF_THE_WEEK = 7; | |
const TEN_DAYS_MILISECONDS = 86400000; | |
export type WeekOfYear = { | |
week: number; | |
year: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<script async src="https://cdn.ampproject.org/shadow-v0.js"></script> | |
<title>Hello, AMP Shadow</title> | |
<meta name="viewport" content="width=device-width"> | |
<style> | |
div, article { | |
box-sizing: border-box; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
class MarfeelAdserverProvider extends React.Component { | |
render() { | |
const adserverHtml = document | |
.createRange() | |
.createContextualFragment( | |
'<ins class="adsense" slot="mySlot" clientId="myClientId"><h1>Adserver Type</h1>Adsense</ins>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html amp lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<script async src="https://cdn.ampproject.org/v0.js"></script> | |
<title>Hello, AMPs</title> | |
<link rel="canonical" href="http://example.ampproject.org/article-metadata.html" /> | |
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | |
<script type="application/ld+json"> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean hasPermission(UserDetails userDetails, Object target, Object permission) { | |
RunAsUserToken asUserToken = new RunAsUserToken( | |
"key", | |
userDetails, | |
userDetails.getPassword(), | |
userDetails.getAuthorities(), | |
authentication.getClass()); | |
return permissionEvaluator.hasPermission(asUserToken, target, permission); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A small modification from Spring's | |
* org.springframework.security.acls.domain.DefaultPermissionGrantingStrategy | |
* that performs bit-wise permmission comparison. | |
* Useful if you want to be able to assign multiple permissions to a SID using a single ACE | |
*/ | |
package com.marfeel.secure.permission; | |
import org.springframework.security.acls.domain.AuditLogger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy"> | |
<constructor-arg ref="dataSource"/> | |
<constructor-arg ref="aclCache"/> | |
<constructor-arg ref="aclAuthorizationStrategy"/> | |
<constructor-arg ref="permissionGrantingStrategy"/> | |
</bean> | |
<bean id="permissionGrantingStrategy" class="org.springframework.security.acls.domain.DefaultPermissionGrantingStrategy"> | |
<constructor-arg> | |
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Declare an acl authorization strategy--> | |
<bean id="aclAuthorizationStrategy" class="org.springframework.security.acls.domain.AclAuthorizationStrategyImpl"> | |
<constructor-arg> | |
<list> | |
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority"> | |
<constructor-arg value="ROLE_ADMIN"/> | |
</bean> | |
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority"> | |
<constructor-arg value="ROLE_ADMIN"/> | |
</bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
([\w\.\-]+)(?:@|\[at\]| \[at\] )([\w\-]+)(?:\.|\[dot\]| \[dot\] )(?!png|gif|jpg|jpeg)([\w\-\.]+) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mainNodeInner = document.createElement('div'), | |
mainNodeInnerPlus = document.createElement('div'), | |
mainNodeAppend = document.createElement('div'), | |
sampleHTML = '<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>', | |
testHTML = '', | |
numSamples = 1000, | |
before = null, | |
after = null; | |
//SET UP |
NewerOlder