Skip to content

Instantly share code, notes, and snippets.

> [!WARNING]
> **Comark 0.6.0** is a breaking release.
>
> Components and functions are renamed to more generic, friendly names. Framework components are now `Markdown` / `MarkdownDocument`, parser entry points are `parseMarkdown` / `createMarkdownParser`, AST types use the `MarkdownDocument` / `Node` names, and props are unified on `value` (with `documentKey` for live documents). Old names fail at compile time or runtime — there are no compatibility shims left.
>
> A full changelog for 0.6.0 is at the bottom of this page.
Using the prompt below, you can migrate your Comark usage to the new API. It covers every rename and gives a simple path through the breaking changes.
If you don't have an AI subscription, try [OpenCode](https://opencode.ai) — they have a generous free tier that is more than enough for this migration and other tasks.
import type { RouterConfig } from '@nuxt/schema'
// https://router.vuejs.org/api/#routeroptions
export default <RouterConfig>{
scrollBehavior: (to, _from, savedPosition) => {
if (to.params?.stop) {
return
}
if (to.hash) {
const el = document.querySelector(to.hash)
// jalali date
JalaliDate = {
month_names: ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"],
g_days_in_month: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
j_days_in_month: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29]
};
JalaliDate.jalaliToGregorian = function(j_y, j_m, j_d) {
j_y = parseInt(j_y);
j_m = parseInt(j_m);
j_d = parseInt(j_d);
@farnabaz
farnabaz / rank_metrics.py
Created May 10, 2016 19:28 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@farnabaz
farnabaz / randomColor.swift
Created October 13, 2015 20:12
Generate random UIColor in swift
/* usage:
* UIColor.randomColor()
*/
extension UIColor {
class func randomColor() -> UIColor{
let r:CGFloat = CGFloat(drand48())
let g:CGFloat = CGFloat(drand48())
let b:CGFloat = CGFloat(drand48())
return UIColor(red: r, green: g, blue: b, alpha: 1.0)
@farnabaz
farnabaz / spinner.html
Last active September 21, 2015 17:32
Simple Number Spinner with jQuery & Font-Awesome. DEMO: http://codepen.io/farnabaz/pen/xwOPVR
<span class="spinner">
<i class="fa fa-chevron-up" onclick="var el = $(this).siblings('input')[0]; el.value = Math.min(5, parseInt(el.value)+1)"></i>
<input type="text" name="day" value="0">
<i class="fa fa-chevron-down" onclick="var el = $(this).siblings('input')[0]; el.value = Math.max(0, parseInt(el.value)-1)"></i>
</span>
<style>
.spinner {
position: relative;
display: inline-block;
}
@farnabaz
farnabaz / gist:4eb4c265020ff3bea2a9
Last active August 29, 2015 14:25
Atom Snippets
# Persian Lorem Ipsum
'.text, .source':
'Lorem Ipsum':
'prefix': "لورم"
'body' : "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد."
@farnabaz
farnabaz / gist:d4bdee0f51a890b2266b
Created May 23, 2015 11:30
Simple Angular timer filter
// usage {{ 122 | timer }}
.filter("timer", function () {
return function (time) {
var sec = time % 60,
min = parseInt(time/60) % 60,
hou = parseInt(time/3600) % 60
sec < 10 && (sec = '0'+sec)
min < 10 && (min = '0'+min)
hou < 10 && (hou = '0'+hou)
@farnabaz
farnabaz / arrow.fabric.js
Created May 22, 2015 23:29
fabric.js arrow shape
//
// Arrow for fabric.js
//
(function($){
$.Arrow = $.util.createClass($.Line, $.Observable, {
initialize: function(e,t) {
this.callSuper("initialize", e, t)
this.set({type:'arrow'});
},
_render: function(e) {