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
function readTextFile(file, callback) { | |
var rawFile = new XMLHttpRequest(); | |
rawFile.overrideMimeType("application/json"); | |
rawFile.open("GET", file, true); | |
rawFile.onreadystatechange = function() { | |
if (rawFile.readyState === 4 && rawFile.status == "200") { | |
callback(rawFile.responseText); | |
} | |
} | |
rawFile.send(null); |
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
var mainInfo = null; | |
$http.get('content.json').success(function(data) { | |
mainInfo = data; | |
}); |
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 Size CalculateAspectRation(int desiredWidth, int desiredHeight, Image image){ | |
var widthScale = (double)desiredWidth / image.Width; | |
var heightScale = (double)desiredHeight / image.Height; | |
var scale = widthScale < heightScale ? widthScale : heightScale; | |
return new Size | |
{ | |
Width = (int)(scale * image.Width), | |
Height = (int)(scale * image.Height) |
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
Error C2143 syntax error: missing ';' before ')' | |
Error C2143 syntax error: missing ';' before ')' | |
Error C2143 syntax error: missing ';' before ')' | |
Error C2143 syntax error: missing ';' before ')' | |
Error C2143 syntax error: missing ';' before ')' | |
Error C2143 syntax error: missing ';' before ')' | |
Error C2061 syntax error: identifier 'DelayedSpellCastEvent' | |
Error C2061 syntax error: identifier 'DelayedSpellCastEvent' |
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 React from 'react'; | |
import {DatePicker} from 'antd'; | |
import moment from 'moment-jalaali'; | |
export default function PersianDatePicker() { | |
var locale = { | |
"lang": { | |
locale: 'fa_IR', |
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 axios from 'axios'; | |
import React from 'react'; | |
const useTable = (url, initialParams) => { | |
const [data, setData] = React.useState([]); | |
const [loading, setLoading] = React.useState(false); | |
const [filters, setFilters] = React.useState({}); | |
const [pagination, setPagination] = React.useState({ | |
pageSizeOptions: ['5', '10', '20', '30', '100'], | |
defaultPageSize: 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
import axios from 'axios'; | |
import {useCallback, useEffect, useState} from 'react'; | |
const useApi = (url, method, data = {}, options = {}) => { | |
const [response, setResponse] = useState(null); | |
const [loading, setLoading] = useState(true); | |
const fetch = useCallback(async () => { | |
const req = await axios({url, method, data, ...options}); |
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
# Install-Module PANSIES -AllowClobber | |
# Install-Module PowerLine | |
# lets set the powerline in this profile | |
Import-Module PowerLine | |
# aux variables | |
$ERRORS_COUNT = 0 | |
$ERROR_EMOJI = "😖", "😵", "🥴", "😭", "😱", "😡", "🤬", "🙃", "🤔", "🙄", ` | |
"🥺", "😫", "💀", "💩", "😰" |
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
function isValidIranianNationalCode(input) { | |
if (!/^\d{10}$/.test(input)) | |
return false; | |
var check = parseInt(input[9]); | |
var sum = 0; | |
var i; | |
for (i = 0; i < 9; ++i) { | |
sum += parseInt(input[i]) * (10 - i); | |
} |
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
function serverObjectsSanitizer<T>(input: T, ignoreList: string[]): T { | |
if (Array.isArray(input)) | |
return input.map((i) => | |
serverObjectsSanitizer(i, ignoreList) | |
) as unknown as T; | |
if (typeof input == 'object' && input != null) | |
return Object.keys(input).reduce((t, c) => { | |
const before = input[c]; | |
if (ignoreList.indexOf(c) > -1) { | |
delete t[c]; |
OlderNewer