Skip to content

Instantly share code, notes, and snippets.

@kt0
kt0 / digikala.js
Last active December 13, 2020 23:57
Fix only app offers in digikala
// ==UserScript==
// @name Replace digikala mobile links
// @namespace KiTO
// @description Replace digikala mobile links
// @author KiTO
// @version 0.0.1
// @grant none
// @run-at document-end
// @match https://www.digikala.com/*
// @match http://www.digikala.com/*
@kt0
kt0 / tweetdeckrtl.user.js
Last active May 13, 2020 21:37
TweetDeck autortl
// ==UserScript==
// @name TweetDeck RTL checker
// @namespace http://twitter.com/keykakito
// @description TweetDeck RTL checker
// @include https://tweetdeck.twitter.com/
// @version 0.2
// @grant none
// ==/UserScript==
(function() {
@kt0
kt0 / devise.fa.yaml
Created February 16, 2014 15:04
Persian devise locale file (devise.fa.yaml)
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
fa:
devise:
confirmations:
confirmed: "حساب کاربری شما با موفقیت تایید شد. شما اکنون وارد شدید."
send_instructions: "ایمیلی حاوی اطالاعات و روند تایید‌سازی حساب کاربری برای شما ارسال شد."
send_paranoid_instructions: "در صورتی که ایمیلی با محتوای وارد شده در داده‌های ما وجود داشته باشد، ایمیلی حاوی فرآید فعال‌سازی حساب کاربری برای شما ارسال خواهد شد."
failure:
already_authenticated: "شما قبال وارد سایت شده‌ای."
@kt0
kt0 / persian_number.md
Last active November 19, 2016 16:34
Persian date and numbers in ruby / ruby on rails

For persian_date add jalalidate to your gemfiles, then add this to ApplicationHelper as helper (or any other place you want to use).

Default date format here is like (یک‌شنبه ۲۹ دی ۱۳۹۲ - ۰۳:۱۰) for more format options see.

unpack Snippet from a question in stackoverflow

module ApplicationHelper
  def persian_numbers(str)
 str ? str.unpack('U*').map{ |e| (0..9).to_a.include?(e-48) ? e + 1728 : e }.pack('U*') : ''
@kt0
kt0 / trim.rb
Created January 13, 2014 13:34
Remove extra whitespace and comments from html templates and create a single JS and RB file
#! /usr/bin/env ruby
Js = 'public/static/js/_tpl.js'
Rb = 'config/initializers/templates.rb'
files = Dir.glob('templates/**/*.html')
templates = {}
total_size = 0
count = 0
@kt0
kt0 / marionette+jquery.md
Last active January 2, 2016 21:59
Model-View binding in marionette

How it tend to work :

user provide's a hash like this to view (in any way they want to and acceptable by marionette):

    bindAttributes: {
        name: [{
            to: 'html',
            el: '.change'
 }],