CLICK ME
yes, even hidden code blocks!
print("hello world!")| import * as React from "react" | |
| import { useState, useEffect } from "react" | |
| // Hook | |
| let cachedScripts = [] | |
| export function useScript(src) { | |
| // Keeping track of script loaded and error state | |
| const [state, setState] = useState({ | |
| loaded: false, |
| @Pipe({name: 'cnpj'}) | |
| export class CNPJPipe implements PipeTransform { | |
| transform(value) { | |
| return value.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/g,"\$1.\$2.\$3\/\$4\-\$5") | |
| } | |
| } |
| import { withRouter } from 'next/router'; | |
| import Link from 'next/link'; | |
| import React, { Children } from 'react'; | |
| const ActiveLink = ({ router, children, ...props }) => { | |
| const child = Children.only(children); | |
| let className = child.props.className || ''; | |
| if (router.pathname === props.href && props.activeClassName) { | |
| className = `${className} ${props.activeClassName}`.trim(); |
| class CustomSearchTextField: UITextField { | |
| required init?(coder aDecoder: NSCoder) { | |
| super.init(coder: aDecoder) | |
| } | |
| override func textRect(forBounds bounds: CGRect) -> CGRect { | |
| return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15)) | |
| } | |
| override func editingRect(forBounds bounds: CGRect) -> CGRect { |
| class CustomSearchTextField: UITextField { | |
| required init?(coder aDecoder: NSCoder) { | |
| super.init(coder: aDecoder) | |
| } | |
| override func textRect(forBounds bounds: CGRect) -> CGRect { | |
| return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15)) | |
| } | |
| override func placeholderRect(forBounds bounds: CGRect) -> CGRect { |
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success 🎉 | |
| console.log(response); | |
| } catch (error) { | |
| // Error 😨 |
| <?php | |
| use Illuminate\Support\Facades\Password; | |
| # Generate a token in the same style as laravels password reset tokens. | |
| # Will generate something like: 785f616c4978a87ad65a899ed4133b358a4697649c55b0965a7ebb7486bd9801 | |
| /** @var DatabaseTokenRepository */ | |
| $repo = Password::getRepository(); | |
| $token = $repo->createNewToken($user); |
This is a guide for aligning images.
See the full Advanced Markdown doc for more tips and tricks