Skip to content

Instantly share code, notes, and snippets.

View valerysntx's full-sized avatar
🔋
99%

valery sntx valerysntx

🔋
99%
  • Ukraine, Uzhgorod
View GitHub Profile
@valerysntx
valerysntx / generic.tag.function.ts
Created October 4, 2016 23:31
generics for template literal tag functions
class Greeter<T>
{
greeting: T;
constructor(message: T) {
this.greeting = message;
}
greet() {
return this.greeting;
}
}
@valerysntx
valerysntx / .eslintrc.json
Created September 20, 2016 15:08
.eslintrc.json
{
"env": {
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true,
"templateStrings": true,
@valerysntx
valerysntx / ckeditor.js
Created September 20, 2016 12:48
ckeditor pastetext + forcePasteAsPlainText, pasteFromWordRemoveFontStyles
// start new.
var editor = CKEDITOR.replace(element, {
enterMode: CKEDITOR.ENTER_BR,
shiftEnterMode: CKEDITOR.ENTER_BR,
allowedContent: true
});
...
@valerysntx
valerysntx / run.bat
Created September 20, 2016 06:48
start cmd /k react-native start
set /p id="(Reminder) Did you start a vm? and is it available in adb? "
start cmd /k react-native start
rem *** HACK ALERT: Sleep for 10 seconds ***
ping -n 10 127.0.0.1 > nul
start cmd /k react-native run-android
@valerysntx
valerysntx / GenericRepository'T.cs
Last active August 17, 2016 16:00
Row-Level Access in Generic Repository
using Models;
using System;
using System.Linq;
using System.Linq.Dynamic;
using System.Linq.Expressions;
namespace Repository
{
public interface IGenericRepository<T>
{
public class StructureMapServiceLocator : ServiceLocatorImplBase {
private IContainer container;
public StructureMapServiceLocator(IContainer container) {
this.container = container;
}
/// <summary>
/// When implemented by inheriting classes, this method will do the actual work of resolving
/// the requested service instance.
@valerysntx
valerysntx / fetch.api.js
Created May 23, 2016 12:56
fetch with utf-8 decoder
var jsonContentTypeHeaders = new Headers();
jsonContentTypeHeaders.append("Content-Type", "application/json");
fetch("http://localhost:5000/v1/permissions/getlist",{
method: 'GET',
headers: jsonContentTypeHeaders,
mode: 'cors',
cache: 'default'})
@valerysntx
valerysntx / DotNetCLI.install.cmd
Created May 19, 2016 02:18
automate dotnet CLI deployment // DotNetCore.1.0.0.RC2-SDK.Preview1-x64 // DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe
@echo off
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
@cinst DotNetCLI
@powershell -NoProfile -ExecutionPolicy None -Command "Invoke-Expression \""((New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/4/6/1/46116DFF-29F9-4FF8-94BF-F9BE05BE263B/DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe','DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe'))\""
@DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe
@powershell -NoProfile -ExecutionPolicy None -Command "Invoke-Expression \""((New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/4/6/1/46116DFF-29F9-4FF8-94BF-F9BE05BE263B/packages/DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe','DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe'))\""
@DotNetCore.1.0.0.RC2-SDK.Preview1-x64.exe
@pause
@valerysntx
valerysntx / EnumerableRangeParallelAwait.cs
Last active May 6, 2016 00:51
Enumerable.AsParallel Method
/* start 100 parallel tasks, and wait all results asyncronously */
Enumerable.Range(0,100)
/* .AsParallel() */
.Select(
/* async timer sequence */
async x=> await Observable.FromAsync(
async (t) => Task.FromResult(
/* will stop after 500 milliseconds */
await Observable.Interval(TimeSpan.FromMilliseconds(100)).Take(5).Replay()