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
module Markdown | |
module Fixer | |
# Since gsub returns a replaced string, we can chain the methods together | |
# without yielding the module itself | |
def self.fix_all(markdown) | |
markdown.gsub('title', '"title"') | |
.gsub('hr', 'hhr') | |
.gsub('\r\n', '\n') |
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
module Markdown | |
module Fixer | |
def self.fix(markdown, pattern=@fix_all_pattern) | |
pattern.map do |key, value| | |
markdown.gsub!(key.to_s, value.to_s) | |
end | |
markdown | |
end |
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
class Integer | |
def divisible_by?(number) | |
self % number == 0 | |
end | |
end | |
irb(main):054:0> 1.divisible_by? 1 | |
=> true | |
irb(main):055:0> 1.divisible_by? 2 | |
=> false |
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 { Routes, RouterModule } from "@angular/router"; | |
import { NgModule } from '@angular/core'; | |
import { AdminComponent } from './component/admin/admin.component'; | |
import { IsAuthenticatedGuard } from '../shared/guard/is-authenticated.guard'; | |
const routes: Routes = [ | |
{ | |
path: 'admin', | |
canActivate: [IsAuthenticatedGuard], | |
component: AdminComponent, |
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 { Injectable } from '@angular/core'; | |
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild} from '@angular/router'; | |
import { Router} from "@angular/router"; | |
import { Observable } from 'rxjs'; | |
import { AuthService } from '../service/auth/auth.service'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class IsAuthenticatedGuard implements CanActivate { |
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 { Injectable } from '@angular/core'; | |
import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild} from '@angular/router'; | |
import {Observable} from 'rxjs'; | |
import {AuthService} from '../service/auth/auth.service'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class IsAuthenticatedGuard implements CanActivate, CanActivateChild { |
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 { Routes, RouterModule } from "@angular/router"; | |
import { NgModule } from '@angular/core'; | |
import { DashboardComponent } from './component/dashboard/dashboard.component'; | |
import { SettingsComponent } from './component/settings/settings.component'; | |
import { IsAuthenticatedGuard } from '../shared/guard/is-authenticated.guard'; | |
const routes: Routes = [ | |
{ | |
path: 'admin', | |
canActivate: [IsAuthenticatedGuard], |
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 default function log(targetObject: Object, targetMethodName: string | symbol, targetMethod: TypedPropertyDescriptor<Function>) { | |
return { | |
value: function( ... args: any[]) { | |
if(targetMethod.value) { | |
const result = targetMethod.value.apply(targetObject, args); | |
return result + 1; | |
} | |
} | |
} | |
} |
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
public class Server implements Runnable { | |
private DatagramSocket socket; | |
private boolean running; | |
@Override | |
public void run() { | |
running = true; | |
try { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.scene.layout.*?> | |
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="720" prefWidth="1280" fx:controller="dev.nhh.echoclient.controller.LayoutController" xmlns:fx="http://javafx.com/fxml" stylesheets="@layout.css"> | |
<children> | |
<!-- Top Menu --> | |
<fx:include GridPane.rowIndex="0" source="/menu/menu.fxml"></fx:include> |
OlderNewer