Skip to content

Instantly share code, notes, and snippets.

View bjorn-ali-goransson's full-sized avatar

Björn Ali Göransson bjorn-ali-goransson

View GitHub Profile
@bjorn-ali-goransson
bjorn-ali-goransson / Example.csproj
Created July 4, 2017 00:12
Sample csproj for classic .NET apps
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
<OutputTypeEx>library</OutputTypeEx>
<BuildOutputTargetFolder>lib\net461</BuildOutputTargetFolder>
</PropertyGroup>
@bjorn-ali-goransson
bjorn-ali-goransson / LoginTest.aspx
Created June 16, 2017 12:14
This file can help by debugging "user cannot log in" problems when in EPiServer the user is just redirected back to the login page when logging in. Probably you are authenticated but not authorized.
<%@ Page Language="C#" %>
<script runat="server">
protected override void OnInit(EventArgs e){
Response.Write(User.Identity.Name);
Response.Write("<br>");
foreach(var role in System.Web.Security.Roles.GetRolesForUser()){
Response.Write(role);
Response.Write("<br>");
}
}
@bjorn-ali-goransson
bjorn-ali-goransson / persistence.xml
Created March 24, 2014 22:26
Example of a minimal persistence.xml for use in the Play! framework
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<!-- <property name="hibernate.hbm2ddl.auto" value="create"/> -->
@bjorn-ali-goransson
bjorn-ali-goransson / arabic-alphabet.htm
Created November 5, 2015 17:41
Generation of all arabic alphabet + harakah combinations in one A4
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
<style>
body,
td,
th {
font-family: Arial;
@bjorn-ali-goransson
bjorn-ali-goransson / caret.less
Created October 24, 2015 19:42
CSS-only caret inheriting from text-color
.caret(@width: @caret-width-base) {
display: inline-block;
content: '';
width: 0;
height: 0;
margin-left: 10px;
vertical-align: middle;
border-top: @width dashed;
border-top: @width solid ~"\9"; // IE8
border-right: @width solid transparent;
@bjorn-ali-goransson
bjorn-ali-goransson / Remove.aspx
Created September 15, 2015 20:34
Remove EPiServer content programmatically
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
@bjorn-ali-goransson
bjorn-ali-goransson / Bootstrap.cshtml
Last active August 29, 2015 14:25
Bootstrap rendering of blocks in EPiServer, with AJAX support on On Page Editing. Bootstrap.cshtml should be put in /Views/Shared/DisplayTemplates/ and don't forget to use Tag = "Bootstrap" in the page template.
@model EPiServer.Core.ContentArea
@{
new BootstrapContentAreaRenderer().Render(Html, Model);
}
@bjorn-ali-goransson
bjorn-ali-goransson / GetTextFromDialog.java
Created April 24, 2014 20:51
Get Text String from User via Dialog in Android
final EditText input = new EditText(this);
new AlertDialog.Builder(this)
.setTitle("Title")
.setMessage("Message")
.setView(input)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
ip = input.getText().toString();
}
@bjorn-ali-goransson
bjorn-ali-goransson / activity.xml
Created April 22, 2014 21:57
Activity markup example for Android Manifest
<activity android:name="se.bjorngoransson.basictest.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
@bjorn-ali-goransson
bjorn-ali-goransson / index.scala.html
Created April 7, 2014 09:42
Template for REST demo
@(message: String)
@main("Welcome to Play") {
<ul id="students"></ul>
<hr>
<button id="create-new-student">Create new</button>