Skip to content

Instantly share code, notes, and snippets.

View Snegovikufa's full-sized avatar
📍
Push the red button

Rustam Safin Snegovikufa

📍
Push the red button
View GitHub Profile
@Snegovikufa
Snegovikufa / stopwatch.snippet
Created February 7, 2014 10:37
Surround with stopwatch Resharper template
Stopwatch $stopwatch$ = new Stopwatch();
stopwatch.Start();
$SELECTION$
$stopwatch$.Stop();
Console.WriteLine("EXEC TIME {0}", $stopwatch$.ElapsedMilliseconds);
$END$
@Snegovikufa
Snegovikufa / mouseover.xaml
Created February 21, 2014 09:38
XAML mouse over button background
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="Green"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
@Snegovikufa
Snegovikufa / Earthsong.xml
Created February 22, 2014 02:23
"Earthsong" code style for Qt creator
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="Eartsong">
<style name="Text" foreground="#ebd1b7" background="#36312c"/>
<style name="Link" foreground="#66d9ef"/>
<style name="Selection" foreground="#e6e5e2" background="#161A1F"/>
<style name="LineNumber" foreground="#a0a19c" background="#272822"/>
<style name="SearchResult" foreground="#ffffff" background="#2572b8"/>
<style name="SearchScope" foreground="#000000" background="#e2efff"/>
<style name="Parentheses" foreground="#ff0000" background="#515d6a"/>
<style name="CurrentLine" background="#3e3d32"/>
@Snegovikufa
Snegovikufa / wpf_dpi.cs
Created February 25, 2014 02:32
How to get dpi settings in WPF
var dpiXProperty = typeof(SystemParameters).GetProperty("DpiX", BindingFlags.NonPublic | BindingFlags.Static);
var dpiYProperty = typeof(SystemParameters).GetProperty("Dpi", BindingFlags.NonPublic | BindingFlags.Static);
var dpiX = (int)dpiXProperty.GetValue(null, null);
var dpiY = (int)dpiYProperty.GetValue(null, null);
public static void RegisterBundles(BundleCollection bundles)
{
bundles.IgnoreList.Clear();
AddDefaultIgnorePatterns(bundles.IgnoreList);
}
public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
{
if (ignoreList == null)
{
@Snegovikufa
Snegovikufa / App.xaml.cs
Last active August 29, 2015 14:04
Set application-wide own culture
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Markup;
namespace WpfApplication1
{
/*
@Snegovikufa
Snegovikufa / dark.css
Last active June 28, 2019 19:56
YouTrack dark theme. Set Darcula theme first!
body, .darcula .sb-row, .darcula .sb-row, .darcula .sb-board-title {
background: #303030 !important;
color: #eeeeee !important;
}
.yt-header__create-btn > .ring-menu__item__i {
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ef9331), to(#e9701d)) !important;
}
.ring-menu, .jt-menu-button, .ring-dropdown__item, .suggest, .inputWrapper > input {
@Snegovikufa
Snegovikufa / test_queue.py
Created February 16, 2015 04:11
Shows how to run many Python threads and wait them to complete. It's very good for I/O operations, not for CPU high load operations!
# -*- coding: utf-8 -*-
__author__ = 'Rustam Safin'
import threading
from Queue import Queue
import time
import random
import logging
@Snegovikufa
Snegovikufa / leaks.py
Created February 17, 2015 03:51
Identify memory leaks in python
from pympler import refbrowser
ib = refbrowser.InteractiveBrowser(root)
ib.main()
@Snegovikufa
Snegovikufa / multi.py
Last active August 29, 2015 14:15
Parallel processing of dictionary
from multiprocessing import Pool, cpu_count
import time
import random
import logging
from pprint import pprint
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)