Skip to content

Instantly share code, notes, and snippets.

@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(),
@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 / 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"
},
{
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
/*
* 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