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 fs = require("fs"); | |
| const path = require("path"); | |
| function fixFile(filepath) { | |
| const contents = fs.readFileSync(filepath, "utf-8"); | |
| const matcher = /([0-9]+(?:\.[0-9]+)?)rem/igm; | |
| const result = contents.replaceAll(matcher, (substr, size) => { | |
| const rem = Number(size); |
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
| #include <winsock2.h> | |
| #include <iostream> | |
| struct CLIENT_INFO { | |
| SOCKET hClientSocket; | |
| struct sockaddr_in clientAddr; | |
| }; | |
| char szServerIPAddr[] = "192.168.1.4"; // Put here the IP address of the server | |
| int nServerPort = 5050; // The server port that will be used by |
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
| using System; | |
| using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; | |
| namespace Foo { | |
| // Implementation makes use of the IPropertyValidationFilter interface that allows | |
| // control over whether the attribute (and its children, if relevant) need to be | |
| // validated. | |
| [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |
| public class ConditionalValidationAttribute : Attribute, IPropertyValidationFilter { | |
| public string OtherProperty { get; set; } |
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
| /** | |
| * Convert a Readable Stream to base64 string | |
| * @param {ReadableStream} stream - a readable stream to convert in base64 string | |
| * @returns {Promise} - Promise that resolve in a string containing the base64 | |
| */ | |
| const streamToBase64 = (stream) => { | |
| const concat = require('concat-stream') | |
| const { Base64Encode } = require('base64-stream') | |
| return new Promise((resolve, reject) => { |
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 BlobToBase64 = function(blob){ | |
| let blobUrl = URL.createObjectURL(blob); | |
| return new Promise((resolve, reject) => { | |
| let img = new Image(); | |
| img.onload = () => resolve(img); | |
| img.onerror = err => reject(err); | |
| img.src = blobUrl; | |
| }).then(img => { | |
| URL.revokeObjectURL(blobUrl); |
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
| using System; | |
| using System.Linq; | |
| using System.Reflection; | |
| using Microsoft.Extensions.DependencyInjection; | |
| public static class ServiceCollectionExtentions | |
| { | |
| public static void AddAllTypes<T>(this IServiceCollection services | |
| , Assembly[] assemblies | |
| , bool additionalRegisterTypesByThemself = false |
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
| using Newtonsoft.Json; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Security.Cryptography; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.IdentityModel.Tokens; |
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
| request | |
| response | |
| app | |
| req | |
| res | |
| originalUrl | |
| state | |
| _i18n | |
| matched | |
| router |
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
| /* | |
| *ngFor="let c of oneDimArray | sortBy:'asc'" | |
| *ngFor="let c of arrayOfObjects | sortBy:'asc':'propertyName'" | |
| */ | |
| import { Pipe, PipeTransform } from '@angular/core'; | |
| import { orderBy } from 'lodash'; | |
| @Pipe({ name: 'sortBy' }) | |
| export class SortByPipe implements PipeTransform { |
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 classNameProp from 'class-name-prop'; | |
| import { useRouter } from 'next/router'; | |
| import React from 'react'; | |
| import styles from './RouteIndicator.module.css'; | |
| const DONE_DURATION = 250; | |
| export default function RouteIndicator() { | |
| const router = useRouter(); |