Skip to content

Instantly share code, notes, and snippets.

View mesuutt's full-sized avatar

Mesut Taşçı mesuutt

View GitHub Profile
;(function ( $, window, undefined ) {
/*
Handle data layer of the tables.
*/
var CustomDataView = function(options) {
$.extend(this.defaults, options);
}
CustomDataView.prototype = {
data: {}
@mesuutt
mesuutt / djang-tables2-base-table.html
Last active August 29, 2015 13:56
Bootstrap style table. Fixed several bugs related pagination and column sorting.
{% spaceless %}
{% load django_tables2 %}
{% load i18n %}
<div class="grid">
<div class="grid-title">
<div class="pull-left">
<div class="icon-title"><i class="icon-eye-open"></i></div>
<span>{{ table.Meta.title }}</span>
<div class="clearfix"></div>
@mesuutt
mesuutt / django-template-filters.py
Last active October 1, 2020 06:39
Useful django template tags and filters
# coding: utf-8
import json
from django import template
from django.utils.dateparse import parse_datetime
from django.utils.html import mark_safe
register = template.Library()
@mesuutt
mesuutt / deploy-hugo.sh
Last active January 18, 2019 09:47
bash script for deploying hugo site to github pages.
#!/bin/bash
# bash script for deploying hugo site to github pages.
# I have a two branch develop and master.
# develop branch keeps source files of my blog
# master branch keeps generated website files
# If you have unstaged or not tracked files, script adds these files to stash.
# So you unstash these changes after deploy.
@mesuutt
mesuutt / System Design.md
Created July 6, 2016 23:08 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mesuutt
mesuutt / i3block-take-a-break.sh
Created October 13, 2016 14:56
Break reminder for i3blocks.
#!/bin/bash
#[remind_break]
#command=~/.i3/i3blocks/take-a-break.sh
#interval=10
# Minutes
work_time=20
break_time=5
@mesuutt
mesuutt / .bashrc
Last active October 26, 2021 09:47
Check active window every second and run script when window class changed
# ....
# Run script if not running.
if ! pidof -x "catch_window_change.sh" > /dev/null; then
(~/bin/catch_window_change.sh > /dev/null 2>&1 &)
fi
@mesuutt
mesuutt / convert-timestamp.js
Created November 10, 2016 02:05
Convert a timestamp to user's local time via JavaScript
function convertToLocalTimestamp(timestamp) {
var offset = new Date().getTimezoneOffset();
return timestamp + (60 * offset * 1000);
}
// convertToLocalTimestamp(1479168000000);
@mesuutt
mesuutt / chart.html
Last active March 23, 2021 02:08
Chart.js - Doughnut chart with custom legend http://codepen.io/mesuutt/pen/LbyPvr
<div class="canvas-con">
<div class="canvas-con-inner">
<canvas id="mychart" height="250px"></canvas>
</div>
<div id="my-legend-con" class="legend-con"></div>
</div>
@mesuutt
mesuutt / format-money-try.js
Last active April 23, 2024 17:57
Format money as Turkish money format.
function formatMoney(n) {
return parseFloat(n).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1.').replace(/\.(\d+)$/,',$1');
}
formatMoney(1234567) // 1.234.567,00
formatMoney(1234567.99) // 1.234.567,99