Skip to content

Instantly share code, notes, and snippets.

View xtrmstep's full-sized avatar
🏠
Working from home

Alexander Goida xtrmstep

🏠
Working from home
View GitHub Profile
@xtrmstep
xtrmstep / Docker shell commands.sh
Created July 29, 2019 12:46 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@xtrmstep
xtrmstep / browser_detect.js
Last active October 16, 2020 18:23
Detect browser using duck typing and User agent
function detectBrowserByFeatures() {
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function(p) {
return p.toString() === "[object SafariRemoteNotification]";
@xtrmstep
xtrmstep / git-ssh-auth-win-setup.md
Created May 20, 2019 09:43 — forked from bsara/git-ssh-auth-win-setup.md
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
  • .ssh/config
@xtrmstep
xtrmstep / ToJson.cs
Created February 8, 2018 17:58
Get object dump in JSON with Google ProtocolBuffers
public static string ToJson(this object obj)
{
var messageLite = obj as IMessageLite;
if (messageLite != null)
return Google.ProtocolBuffers.Extensions.ToJson(messageLite);
return JsonConvert.SerializeObject(obj);
}
@xtrmstep
xtrmstep / log4net-01.cs
Created October 10, 2017 14:54
log4net snippets
// variable declaration
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// You have several options to make it alive
// 1) AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
// 2) manual kick in the beginning of program execution
XmlConfigurator.Configure();
@xtrmstep
xtrmstep / SqlHelpers-01.sql
Last active October 10, 2017 14:21
SQL code snippets and helpers
/*
- Get default constraints of database with definition
- Several scripts to deal with locks in database
- Convert rows to columns in SQL
- SQL to select from XML
- Get table sizes
*/
@xtrmstep
xtrmstep / Div auto heigh resizing.html
Created July 7, 2016 22:39
How DIV can be automatically resized during resizing of the window
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<script src="http://code.jquery.com/jquery-git.min.js"></script>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
@xtrmstep
xtrmstep / cleanup-objbin.ps1
Created March 29, 2016 09:02
PowerShell script to delete all \bin and \obj folders
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
@xtrmstep
xtrmstep / RangesToArray
Created December 14, 2015 14:07
Convert text ranges to int array and back
public static int[] ToIntArray(this string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return new int[]
{
};
}
List<int> result = new List<int>();