Skip to content

Instantly share code, notes, and snippets.

@AlexanderPro
AlexanderPro / index.html
Last active April 1, 2018 20:40
Tooltip by CSS2
<!DOCTYPE html>
<html>
<head>
<title>Tooltip by CSS2</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type="text/css">
div {
padding: 150px;
display: inline-block;
}
@AlexanderPro
AlexanderPro / index.html
Last active April 1, 2018 20:39
Tooltip by CSS3
<!DOCTYPE html>
<html>
<head>
<title>Tooltip by CSS3</title>
<meta charset="UTF-8" />
<style type="text/css">
div {
padding: 150px;
display: inline-block;
}
@AlexanderPro
AlexanderPro / app.js
Created April 1, 2018 17:34
JavaScript app with webpack
class User {
constructor(name) {
this.name = name;
}
sayHello(...who) {
who.forEach(e => alert(`Hello from ${this.name}, ${e}`));
}
}
@AlexanderPro
AlexanderPro / .eslint.json
Last active June 10, 2018 14:27
ESLint settings for React app
{
"extends": "plugin:react/recommended",
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
@AlexanderPro
AlexanderPro / index.js
Last active September 16, 2018 19:30
JavaScript function that processes large arrays async
/**
* Processes a large array in async mode and gives the UI thread a chance to process any pending UI events
* between each chunk which will keep the UI active
* @param array - source array
* @param process - function that processes one array item
* @param maxTimePerChunk - number milliseconds per chunk
* @param complete - function that is called upon completion
*/
function processArrayAsync(array, process, maxTimePerChunk, complete) {
maxTimePerChunk = maxTimePerChunk || 100;
@AlexanderPro
AlexanderPro / VkAccessToken.md
Last active October 21, 2025 05:57
Как получить access token приложения vk.com

Что бы использовать Api vk.com нужно получить access token аккаунта.

  1. Для этого вам потребуется Standalone-приложение, которое можно создать тут.
  2. После того как вы создали приложение его можно найти на вкладке Приложения.
  3. Далее нам потребуется его id, который можно получить перейдя по ссылке на приложение в вашем аккаунте. Ссылка будет выглядеть так: https://vk.com/app123456. Где 123456 и есть id приложения.
  4. Теперь осталось перейти по ссылке вида:
    https://oauth.vk.com/authorize?client_id=123456&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=messages,wall,offline&response_type=token
    
  5. После перехода ВК попросит подтвердить доступ к аккаунту и перенаправит вас на страницу с предупреждением, где в url будет содержаться access token:
@AlexanderPro
AlexanderPro / DisposePattern.cs
Last active May 3, 2020 10:54
Dispose Pattern in C#
public class DisposableResource : IDisposable
{
private SafeHandle managedResource;
private IntPtr unmanagedResource;
public DisposableResource()
{
//managedResource = ...
//unmanagedResource = ...
}
@AlexanderPro
AlexanderPro / Examples
Last active February 19, 2019 13:13 — forked from davidfowl/Examples
Powershell function that recursively walks all project items within a project and lets you execute an action on each one
#In Package Manager Console:
#1. Re-format all files of the selected project
#Format-Document
#2. Re-format all files of the whole solution
#Get-Project -All | Format-Document
# Print all project items
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" }
# Function to format all documents based on https://gist.github.com/984353
@AlexanderPro
AlexanderPro / Run.cmd
Created February 25, 2019 12:36
Enable asp.net 4.5 in IIS
dism /online /enable-feature /featurename:IIS-ASPNET45 /all
@AlexanderPro
AlexanderPro / README.md
Last active May 25, 2019 10:34
Removing ASP.NET HTTP Headers

Removing ASP.NET HTTP Headers

Global.asax.cs

protected void Application_Start()
   2:  {
   3:      ...
   4:      MvcHandler.DisableMvcResponseHeader = true;
   5:      ...
 6: }