Skip to content

Instantly share code, notes, and snippets.

View ivanovvitaly's full-sized avatar

Vitaly Ivanov ivanovvitaly

  • AgileEngine
  • Kharkov
View GitHub Profile
@InfectedBytes
InfectedBytes / XTEA.cs
Created October 22, 2017 12:05
XTEA encryption for C#
/*
* Helper class for XTEA en/decryption of arbitrary data.
*
* Copyright (c) 2017, Henrik Heine
*/
using System;
using System.IO;
using System.Text;
@skynyrd
skynyrd / serilog.md
Created May 9, 2017 08:08
Add Serilog to .NET Core running in Docker Container

Dependencies:

    "Serilog.Settings.Configuration": "2.3.1",
    "Serilog.Sinks.Literate": "2.1.0",
    "Serilog.Extensions.Logging": "1.4.0"

Your Startup constructor:

@fernandohu
fernandohu / Reading configuration files before application startup in Angular2 final release.md
Last active May 8, 2023 16:40
Reading configuration files before application startup in Angular2 final release

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@ricca509
ricca509 / chrome-web-security.sh
Last active August 10, 2023 08:25
Chrome: Disable web security [OSX]
// OSX
open -na Google\ Chrome --args --disable-web-security --user-data-dir="/tmp/chrome_dev"
@mlynch
mlynch / info.plist
Last active August 6, 2023 07:31
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
@robzhu
robzhu / Startup.cs
Last active March 23, 2022 09:51
OWIN Startup configuration for JSON serialization
using System.Collections.Generic;
using System.Web.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Owin;
using Swashbuckle.Application;
namespace Project
{
@jsauve
jsauve / AsyncDapperDemo.cs
Last active August 18, 2023 17:58
Async Dapper Demo. Includes buffered and non-buffered connection helpers.
using System;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
using Dapper;
public class Program
{
public static void Main()
@chriseidhof
chriseidhof / AppDelegate.swift
Created October 30, 2014 22:54
Image Processing
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var imageView: NSImageView!
func applicationDidFinishLaunching(aNotification: NSNotification) {
self.imageView.image = convert(myImage())
@dlo
dlo / Auto-layout-keyboard-adjustment.md
Last active February 26, 2021 07:33
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.

@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions