Skip to content

Instantly share code, notes, and snippets.

View milosh-96's full-sized avatar

Miloš Jovanović milosh-96

View GitHub Profile
@milosh-96
milosh-96 / Layout.cshtml
Created March 5, 2025 00:53
Orchard Core Content Culture Picker shape rendered in a razor Layout (CSHTML)
@using System.Globalization
@using OrchardCore.ContentLocalization.ViewModels
@using OrchardCore.Localization
@inject ILocalizationService localizationService
<!DOCTYPE html>
<html lang="@Orchard.CultureName()" dir="@Orchard.CultureDir()">
<head>
<title>Welcome</title>
</head>
@milosh-96
milosh-96 / allowed-tags.php
Created November 22, 2024 16:19
Allow more tags in Sanitizer (WP KSES)
<?php
/*
Plugin Name: Allow more tags in Sanitizer (WP KSES)
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is plugin adds more tags Sanitizer so they are not stripped. This is useful if some plugins use styling via style tag and then pass that code via sanitizer.
Author: Milos
Version: 1.0.0
Author URI:
*/
@milosh-96
milosh-96 / gist:0f9629856a4ccb906356201acdec97d5
Last active November 14, 2024 03:16
Dynamic Table of contents
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.container {
width: 700px;
@milosh-96
milosh-96 / asp-net-3.1-identity-mysql-migration.cs
Created June 11, 2022 23:22
The main purpose of this is that I adjusted lengths so you don't get errors like "specified key is too long".
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using MySql.EntityFrameworkCore.Metadata;
namespace AspNetProject.Data.Migrations
{
public partial class Identity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
#1 Resetting work
git pull origin dev // ensure you have latest code from the remote repo (unless you want to do something with old code)
git status // ensure you commited all changes
git reset --hard // this will reset code to the last commit
git reset --hard <commit id> // this will reset code to specific commit
git pull origin dev // just confirm everything is up-to-date.
git status // ensure there are not unstaged files something like that
.w-25 {
width: 25% !important;
}
.w-50 {
width: 50% !important;
}
.w-75 {
import xml.etree.ElementTree as ET
import urllib
xml = urllib.urlopen("https://www.w3schools.com/xml/books.xml")
tree = ET.parse(xml)
root = tree.getroot()
cat = raw_input('Kategorija: ')
for child in root:
@milosh-96
milosh-96 / character-input
Created June 23, 2015 13:18
Character Input
import datetime
name = raw_input("Enter your name")
years = raw_input("How old are you?")
try:
years = int(years);
print "Your name is",name,", 100 years you will have on a", (datetime.date.today().year - years) + 100," year"
except:
print "broj godina mora biti unet BROJEVIMA, ne slovima."