Skip to content

Instantly share code, notes, and snippets.

@tabula-rasa
tabula-rasa / index.html
Last active August 15, 2019 10:14
An Example of exceptions logs page with quick search and rendering via mithril.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
@tabula-rasa
tabula-rasa / css
Last active August 14, 2019 16:35
JQuery filter on page with highlights
.hidden {
display: none!important;
}
mark {
background-color: #fcf8e3;
padding: 0.2em 0;
}
@tabula-rasa
tabula-rasa / app.js
Last active June 1, 2018 20:29
The go handler (server-side script) for standard CkEditor 5 image upload
$(document).ready(function () {
ClassicEditor
.create(document.querySelector('#ck-content'), {
ckfinder: {
uploadUrl: '/upload'
},
})
.catch(error => {
console.error(error);
});
@tabula-rasa
tabula-rasa / app.scss
Created February 24, 2018 20:04
Mithril JS toaster-like notifications with proper css fade-out/fade-in animation
.m-notifications {
position: fixed;
bottom: 20px;
right: 20px;
display: flex;
flex-direction: column;
align-items: flex-end;
z-index: 10;
.m-notification {
@tabula-rasa
tabula-rasa / input(es6).js
Created February 23, 2018 21:37
Mithril JS input focus
m('input', { oncreate: (el) => { el.dom.focus() }})
@tabula-rasa
tabula-rasa / app(es6).js
Last active February 23, 2018 21:18
Mithril JS Bootstrap 4 modal dialog component
//usage
import modal from './modal(es6)'
var state = {
showDialog: false,
onOk() {
console.log('OK pressed')
},
onCancel() {
console.log('Cancel pressed')
}
@tabula-rasa
tabula-rasa / ApiModel.cs
Created October 20, 2016 22:04
Core.NET Razor-like html helpers (input, label) for mithril js - example (with some es6 syntax mixed in)
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Catalog.Models
{
public class ApiModel
{
public ApiModel(IModelMetadataProvider MetadataProvider, Type childType)
@tabula-rasa
tabula-rasa / tabs.js
Created October 20, 2016 21:32
Mithril js tabs for twitter bootstrap with components (some es6 markup present)
'use strict'
export var Tabs = {}
//args is an array of objects {id: "tab id", title: "tab title", component: "component to be rendered in that tab"}
Tabs.controller = function(args) {
var ctrl = this
ctrl.active = m.prop(args[0].id)
ctrl.setactive = function(id) {
ctrl.active(id)
@tabula-rasa
tabula-rasa / ckupload.go
Created November 20, 2015 19:25
Golang handler for Ckeditor image upload
package controllers
import (
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"