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 sys | |
import os | |
import urllib2 | |
if len(sys.argv) < 3: | |
print 'usage: python py_mangatown_download.py <url_of_chapter_first_img> <dest_folder>' | |
exit() | |
dirs = sys.argv[2].split('/') | |
for dir in dirs: |
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
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"> | |
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script> | |
<title>Alpine Tic-Tac-Toe</title> |
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
type HandlerFunction = (error: Error, ctx: any) => void; | |
export const Catch = (errorType: any, handler: HandlerFunction): any => { | |
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => { | |
// Save a reference to the original method | |
const originalMethod = descriptor.value; | |
// Rewrite original method with try/catch wrapper | |
descriptor.value = function (...args: any[]) { | |
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
// Decorator factory function | |
export const Catch = (errorType: any, handler: HandlerFunction): any => { | |
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => { | |
// Method decorator | |
if (descriptor) { | |
return _generateDescriptor(descriptor, errorType, handler); | |
} | |
// Class decorator | |
else { | |
// Iterate over class properties except constructor |
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 { Controller, Get, Area, App } from 'https://deno.land/x/alosaur/mod.ts'; | |
@Controller('/home') | |
export class HomeController { | |
@Get('/text') | |
text() { | |
return 'Hello world'; | |
} | |
@Get('/json') | |
json() { |
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 { Controller, Get, Area, App } from 'https://deno.land/x/alosaur/src/mod.ts'; | |
// We import it as | |
// import { Controller, Get, Area, App } from 'deps.ts'; |
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
[ | |
{ | |
"id": "1fa7dfa9", | |
"title": "How to Use the Environment for Specific HTTP Services", | |
"coverUrl": "https://blog-backend-deno.herokuapp.com/post-covers/data-service-article.png", | |
"labels": ["Angular", "TypeScript", "Programming", "Web Development"] | |
}, | |
{ | |
"id": "e6308bab", | |
"title": "A Try/Catch Decorator to Stylize Your Code", |
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
{ | |
"1fa7dfa9": "./posts/specific-data-service.html", | |
"e6308bab": "./posts/try-catch-decorator.html" | |
} |
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 { join, normalize } from '../../../deps.ts'; | |
import { readJson } from '../../../deps.ts'; | |
import { Request, Response, serveFile } from '../../../deps.ts'; | |
import { Post } from './interfaces/post.interface.ts'; | |
export class PostsService { | |
private CWD = '.'; | |
constructor() { | |
this.CWD = Deno.cwd(); |
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 { Controller, Get, Param, Req, Request } from '../../../deps.ts'; | |
import { PostsService } from './posts.service.ts'; | |
import { Post } from './interfaces/post.interface.ts'; | |
@Controller('/posts') | |
export class PostsController { | |
constructor(private _service: PostsService) {} | |
@Get() | |
async list(): Promise<Post[]> { |
OlderNewer