Skip to content

Instantly share code, notes, and snippets.

View MRezaSafari's full-sized avatar
🎯
Focusing

Lukas Safari MRezaSafari

🎯
Focusing
View GitHub Profile
@MRezaSafari
MRezaSafari / PersianDatePicker.jsx
Last active July 11, 2020 14:20
antd jalali date picker
import React from 'react';
import {DatePicker} from 'antd';
import moment from 'moment-jalaali';
export default function PersianDatePicker() {
var locale = {
"lang": {
locale: 'fa_IR',
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'
@MRezaSafari
MRezaSafari / CalculateAspectRatio.cs
Last active April 26, 2020 13:45
calculate the aspect ratio of image
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)
var mainInfo = null;
$http.get('content.json').success(function(data) {
mainInfo = data;
});
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);