Skip to content

Instantly share code, notes, and snippets.

@berkSahin
berkSahin / select2_ajax.js
Created Sep 24, 2018 — 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.
View select2_ajax.js
$("[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(),
@berkSahin
berkSahin / Index.cshtml
Created Jul 27, 2018 — forked from vanillajonathan/Index.cshtml
TinyMCE image upload on ASP.NET MVC
View Index.cshtml
<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 / JsonHelper.cs
Created Jun 27, 2018
C# JSON Formatter
View JsonHelper.cs
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 / cities_of_turkey.json
Created Jun 5, 2018 — 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.
View cities_of_turkey.json
[
{
"id": "1",
"name": "Adana",
"latitude": "37.0000",
"longitude": "35.3213",
"population": "2183167",
"region": "Akdeniz"
},
{
View SampleHash.cs
///////////////////////////////////////////////////////////////////////////////
// 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 / isoCodes.json
Created Mar 2, 2017
Android Multi Language ISO Codes
View isoCodes.json
[
{
"language": "German",
"locale": "de",
"path": "values-de"
},
{
"language": "Chinese",
"locale": "zh",
"path": "values-zh"
View CitiesDistance.json
[
{
"Start_City": "Adana",
"End_City": "Adıyaman",
"Distance": "333 Km",
"Duration": "3 saat 47 dakika"
},
{
"Start_City": "Adana",
"End_City": "Afyonkarahisar",
View agm.py
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)
View Connectivity.java
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
View Devices.java
/*
* 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