Skip to content

Instantly share code, notes, and snippets.

View uzbekdev1's full-sized avatar
🌴
On vacation

Elyor Latipov uzbekdev1

🌴
On vacation
View GitHub Profile
@uzbekdev1
uzbekdev1 / server_time_sync.js
Created June 8, 2019 15:38 — forked from ethaizone/server_time_sync.js
Sync server time to client browser with JS. Implement follow Network Time Protocol.
// Thanks http://stackoverflow.com/questions/1638337/the-best-way-to-synchronize-client-side-javascript-clock-with-server-date
var serverTimeOffset = false;
function getServerTime(callback) {
if (serverTimeOffset === false) {
var scripts = document.getElementsByTagName("script"),
URL = scripts[scripts.length - 1].src;
var clientTimestamp = Date.parse(new Date().toUTCString());
http://cronus.allowed.org works for me, 2018.1.6
@uzbekdev1
uzbekdev1 / C#
Created June 21, 2019 14:24 — forked from conrjac/C#
C# Encrypt and Decrypt File - using http://support.microsoft.com/kb/307010
using System;
using System.IO;
using System.Security;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
using System.Text;
namespace CSEncryptDecrypt
{
class Class1
@uzbekdev1
uzbekdev1 / count_up.js
Created July 6, 2019 16:13 — forked from noahub/count_up.js
Count Up Animation
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$('.counter').each(function() {
var $this = $(this),
countTo = $this.attr('data-count');
$({ countNum: $this.text()}).animate({
countNum: countTo
@uzbekdev1
uzbekdev1 / list.component.html
Created July 16, 2019 17:07 — forked from bentedder/list.component.html
Pagination Component
<div>list of things</div>
<my-pagination
(goPage)="goToPage($event)"
(goNext)="onNext()"
(goPrev)="onPrev()"
[pagesToShow]="3"
[page]="page"
[perPage]="limit"
[count]="total"></my-pagination>
@uzbekdev1
uzbekdev1 / AndroidMainfest.xml
Created August 19, 2019 20:56 — forked from jayrambhia/AndroidMainfest.xml
First Android OpenCV Application.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.imgloader"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
@uzbekdev1
uzbekdev1 / media-query.css
Created September 10, 2019 06:58 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@uzbekdev1
uzbekdev1 / blazor-auth.md
Created September 25, 2019 09:44 — forked from SteveSandersonMS/blazor-auth.md
Blazor authentication and authorization

Authentication and Authorization

Authentication means determining who a particular user is. Authorization means applying rules about what they can do. Blazor contains features for handling both aspects of this.

It worth remembering how the overall goals differ between server-side Blazor and client-side Blazor:

  • Server-side Blazor applications run on the server. As such, correctly-implemented authorization checks are both how you determine which UI options to show (e.g., which menu entries are available to a certain user) and where you actually enforce access rules.
  • Client-side Blazor applications run on the client. As such, authorization is only used as a way of determining what UI options to show (e.g., which menu entries). The actual enforcement of authorization rules must be implemented on whatever backend server your application operates on, since any client-side checks can be modified or bypassed.

Authentication-enabled templates for Server-Side Blazor

Real-Time Interaction Between Maps With Socket.io and JavaScript
I was doing some thinking recently. I was thinking about how I could make maps more useful than just displaying visual content on the screen when requested. While displaying map information on a screen is useful in many circumstances, it doesn't make for the most exciting of examples. This lead me to thinking about things from a more interactive level.
Take the example of first responders, such as law enforcement, fire, and medical. It might not make the most sense for them to be looking and refreshing a map to find incidents. Instead, what if the map automatically refreshed and was synchronized between the first responders? What I mean by this is, what if incidents automatically appeared on everyone's map at the same time without interaction?
In this tutorial, we're going to explore sockets to broadcast map related information in real-time using Socket.io and simple JavaScript.
To get a sense of what we're going to accomplish, take a look a
@uzbekdev1
uzbekdev1 / gist:a367b8b6db975ec3a70686874ddd18d5
Created December 17, 2019 13:19 — forked from jferguson/gist:1681480
SqlBulkCopy Generic List<T>
public static void BulkInsert<T>(string connection, string tableName, IList<T> list)
{
using (var bulkCopy = new SqlBulkCopy(connection))
{
bulkCopy.BatchSize = list.Count;
bulkCopy.DestinationTableName = tableName;
var table = new DataTable();
var props = TypeDescriptor.GetProperties(typeof(T))
//Dirty hack to make sure we only have system data types