Skip to content

Instantly share code, notes, and snippets.

💭
🦀

Mesut Taşçı mesuutt

💭
🦀
Block or report user

Report or block mesuutt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nested_scroll_demo.dart
import 'package:flutter/material.dart';
void main() async {
runApp(new TestApp());
}
class TestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
View nested_scroll_view.dart
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() {
runApp(new TestApp());
}
@mesuutt
mesuutt / format-money.dart
Last active Feb 11, 2019
Format money as Turkish money format in dart language
View format-money.dart
String formatMoney(dynamic text) {
if (text is num){
text = text.toStringAsFixed(2);
}
return text
.toString()
.replaceAllMapped(RegExp(r"(\d)(?=(\d{3})+\.)"), (m) => "${m.group(1)}.")
.replaceAllMapped(RegExp(r"\.(\d+)$"), (m) => ",${m.group(1)}");
}
@mesuutt
mesuutt / views.py
Last active Oct 25, 2018
Django save file to storage & Read from storage without model
View views.py
from django.core.files.storage import default_storage
# Saving POST'ed file to storage
file = request.FILES['myfile']
filename = default_storage.save(file.name, file)
# Reading file from storage
file = default_storage.open(filename)
@mesuutt
mesuutt / postgresql.md
Last active Feb 27, 2018
Kullanisli Postgresql Sorgulari
View postgresql.md
@mesuutt
mesuutt / ajax-setup.js
Last active Feb 25, 2018
Django handling expired session (for ajax request)
View ajax-setup.js
$.ajaxSetup({
complete: function(xhr, status) {
if(xhr.status == 278) {
if (xhr.responseJSON) {
var data = xhr.responseJSON;
if (!data.success && data.error_message) {
alert(data.error_message);
}
}
@mesuutt
mesuutt / city.json
Last active Jan 21, 2018
Django projeleri için il-ilçe fixtureları ve modeli (İl id'leri plaka kodlarıdır)
View city.json
[
{
"model": "other.city",
"pk": 1,
"fields": {
"name": "ADANA"
}
},
{
"model": "other.city",
View gist:757e1f1e892f0eff63e6e5c50e2541d7
DELETE = "delete"
UPDATE = "update"
SELECT = "select"
INSERT = "insert"
QUOTE = "'"
def format_parameter(parameter, value):
return "%s = %s" % (parameter, determine_quote(value))
@mesuutt
mesuutt / form_widgets.py
Last active Aug 23, 2017
Custom form widget for add additional attributes to option tags of select on Django forms.
View form_widgets.py
from django import forms
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark_safe
class SelectOptionsWithAttrs(forms.widgets.Select):
def render_options(self, selected_choices):
# Normalize to strings.
selected_choices = set(force_text(v) for v in selected_choices)
@mesuutt
mesuutt / rates.py
Last active Mar 7, 2018
Show BTC,ETH and LTC exchange rates without leaving commandline.
View rates.py
import re
import sys
import getopt
from datetime import datetime, timedelta
from decimal import Decimal
import requests
GREEN = '\033[0;32m'
RED = '\033[0;31m'
MAGENTA = '\033[0;35m'
You can’t perform that action at this time.