This file contains 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
private openPhotoSwipe(index: number): boolean { | |
const options = { | |
addCaptionHTMLFn: (item, captionEl, isFake) => { | |
if (!_.isString(item.title)) { | |
captionEl.children[0].innerHTML = ''; | |
return false; | |
} | |
captionEl.children[0].innerHTML = item.title; | |
if (_.isString(item.author)) { |
This file contains 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
<div class="youtube" data-params="modestbranding=1&showinfo=0&vq=hd720" id="Ey14IvWsZx4"></div> |
This file contains 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
.youtube | |
background-position: center | |
background-repeat: no-repeat | |
position: relative | |
display: inline-block | |
overflow: hidden | |
transition: all 200ms ease-out | |
cursor: pointer | |
.play | |
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAERklEQVR4nOWbTWhcVRTHb1IJVoxGtNCNdal2JYJReC6GWuO83PM/59yUS3FRFARdFlwYP1CfiojQWt36sRCUurRIdVFXIn41lAoVdRGrG1M01YpKrWjiYmaSl8ybZJL3cd+YA//NLObd3++eO8x79z5jSq5Gw+8kov0AP8vMR5l1BtBZQM4B8ks75wCdZdYZZj5qLZ4hov2Nht9Z9vhKKSIaB/gI4M4w62KeAO6Mte4lYOq20FxrlqqOibhHmeWbvNC9ZfDX1mLae391aN6limO/gwgvAPJbWeAZuSDingdwXTBw7/0IsyaA/Fkh+KqOkD+YNfHej1QKD+y7iVlOhgLvFqFfNJvNGyuBJ+KDAF8MDd0tgS8y64OlgSdJMsysL4cG7SOHkyQZLhTee7+d2R2rAVy/S+Jd7/32ouBHAP4gNNRGQyTHc/84NhqNywZp5rvjjnnvt21aABFeCQ+RLwAf2hQ8s7sv9OCLk6AHNgQvIrvbfzKCD76g/O6cu7lf/iER/aQGgy448pExZmhdegAPhR9sObFWH1gT3lp7DaA/5bkIgJhZPgsNmz02novj+KqeApj1ubwXWe4kdyeznAgNvTpE/HQmvKqOMeuFogTUVQSRno+iaLRLAJF7uIgL9O4ubgL8aWgB7S44mNX+35YpICUiAvS9sBLkq1WzT+NFffl6AuoiApi6NT37h6sWkBIRZGkQ8YtLgyji6e1mBYTqCEBPG2Naz+0B |
This file contains 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 {HostListener} from '@angular/core'; | |
import {Observable} from 'rxjs'; | |
export abstract class ComponentCanDeactivate { | |
abstract get saved(): boolean; | |
abstract canDeactivate(): Observable<boolean> | Promise<boolean> | boolean | |
@HostListener('window:beforeunload', ['$event']) |
This file contains 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
static youtubePattern(isString?: boolean): string | RegExp { | |
const p: string = '^((?:https?:)?\\/\\/)?((?:www|m)\\.)?((?:youtube\\.com|youtu.be))(\\/(?:[\\w\\-]+\\?v=|embed\\/|v\\/)?)([\\w\\-]+)(\\S+)?$'; | |
return isString ? p : new RegExp(p); | |
} | |
static parseYouTubeVideo(url: string): string { | |
if (!Utils.isString(url)) throw new Error('Url is not a string'); | |
return url.replace(Utils.youtubePattern(), '$5'); | |
} |
This file contains 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
private static boolean resizeImage(final String image_path, final String quality, final String size, final String output_image) { | |
// absolute path to ImageMagick: Command-line Tools: Convert | |
String convert_path = "magick"; | |
// Build process to execute convert | |
ProcessBuilder pb = new ProcessBuilder( | |
convert_path, | |
image_path, | |
"-quality", | |
quality, |
This file contains 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
static getCookie(name: string): string { | |
const matches = document.cookie.match(new RegExp( | |
'(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)' | |
)); | |
return matches ? decodeURIComponent(matches[1]) : undefined; | |
} | |
static setCookie(name: string, value: string, props: any = {}): void { | |
let exp: Date | number = props.expires; |
This file contains 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
@Component | |
@Order(Ordered.HIGHEST_PRECEDENCE) | |
public class Forward extends OncePerRequestFilter { | |
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |
@Override | |
public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) | |
throws IOException, ServletException { |
This file contains 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
export DBPASSWORD=`aws ssm get-parameters --name DBpassword --region us-east-1 --with-decryption --output text --query Parameters[].Value` | |
export DBUSERNAME=`aws ssm get-parameters --name DBusername --region us-east-1 --output text --query Parameters[].Value` | |
export DBENDPOINT=`aws ssm get-parameters --name DBendpoint --region us-east-1 --output text --query Parameters[].Value` |
This file contains 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
events { | |
worker_connections 1024; | |
} | |
http { | |
default_type text/html; | |
access_log /dev/stdout; | |
sendfile on; | |
keepalive_timeout 65; |