Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (C) 2014 Jared Rummler <jared.rummler@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
from PySide import QtCore, QtGui
import os, requests, threading, time, StringIO
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
from threading import Thread
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(480, 232)
[
{
"Start_City": "Adana",
"End_City": "Adıyaman",
"Distance": "333 Km",
"Duration": "3 saat 47 dakika"
},
{
"Start_City": "Adana",
"End_City": "Afyonkarahisar",
@berkSahin
berkSahin / isoCodes.json
Created March 2, 2017 09:48
Android Multi Language ISO Codes
[
{
"language": "German",
"locale": "de",
"path": "values-de"
},
{
"language": "Chinese",
"locale": "zh",
"path": "values-zh"
///////////////////////////////////////////////////////////////////////////////
// SAMPLE: Hashing data with salt using MD5 and several SHA algorithms.
//
// To run this sample, create a new Visual C# project using the Console
// Application template and replace the contents of the Class1.cs file with
// the code below.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
@berkSahin
berkSahin / cities_of_turkey.json
Created June 5, 2018 00:39 — forked from ozdemirburak/cities_of_turkey.json
List of cities in Turkey presented in JSON format with the information of name, latitude, longitude, population and region.
[
{
"id": "1",
"name": "Adana",
"latitude": "37.0000",
"longitude": "35.3213",
"population": "2183167",
"region": "Akdeniz"
},
{
@berkSahin
berkSahin / JsonHelper.cs
Created June 27, 2018 21:09
C# JSON Formatter
class JsonHelper
{
private const string INDENT_STRING = " ";
public static string FormatJson(string str)
{
var indent = 0;
var quoted = false;
var sb = new StringBuilder();
for (var i = 0; i < str.Length; i++)
{
@berkSahin
berkSahin / Index.cshtml
Created July 27, 2018 20:30 — forked from vanillajonathan/Index.cshtml
TinyMCE image upload on ASP.NET MVC
<script src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script>
<script>
tinymce.init({
selector: 'textarea',
images_upload_url: "TinyMceUpload",
});
function upload(form) {
tinymce.activeEditor.uploadImages(function (success) {
form.submit();
@berkSahin
berkSahin / select2_ajax.js
Created September 24, 2018 16:31 — forked from techniq/select2_ajax.js
Select2 ajax example with custom query call to append data to the request. Note: Providing ajax settings is not needed (and not used) when query is provided. Left here as a full example.
$("[data-provide='select2']").each(function () {
var $element = $(this);
$element.select2({
placeholder: $element.data("placeholder"),
minimumInputLength: 0,
allowClear: true,
initSelection: function (element, callback) {
callback({
id: $(element).val(),