Skip to content

Instantly share code, notes, and snippets.

🌌
Loading...

Yuriy Yakovenko djleonskennedy

🌌
Loading...
Block or report user

Report or block djleonskennedy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@djleonskennedy
djleonskennedy / openconnect-totp.sh
Last active May 2, 2019
connect to vpn via "openconnect" automatically with OTP
View openconnect-totp.sh
#!/bin/sh
PASSWORD=<userpassword>
BASE32_TOKEN=<BASE32 SECRET>
HOST=vpn.some.com
# topt token generation
# tools can be get here https://www.nongnu.org/oath-toolkit/
# also don't forget to set current time
# this method is using is in case if "token" and "password" swapped
View y-combinator
-- The Y combinator, discovered by Haskell B. Curry, is defined as: Y = \f.(\x.f (x x)) (\x. f (x x))
-- haskell
newtype Mu a = Mu (Mu a -> a)
y f = (\h -> h $ Mu h) (\x -> f . (\(Mu g) -> g) x $ x)
-- javascript
const factSource = partial => n => n === 0 ? 1 : n * partial(n - 1);
@djleonskennedy
djleonskennedy / contavatiant-example.hs
Last active Mar 27, 2019
Contravariant Functor how to use it in practice
View contavatiant-example.hs
import Data.Functor.Contravariant
-- newtype Predicate a = Predicate { getPredicate :: a -> Bool }
--instance Contravariant Predicate where
-- contramap f (Predicate p) = Predicate (p . f)
-- | `- First, map the input...
-- `----- then apply the predicate.
fb = Predicate (\x -> x > 20)
View gist:d63498e6571f5709a28cd7b25469049c
I had the same issue but manually triggering configure script
```(cd ./node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh)``` resolves it.
Also - If you want to build app for iOS 12 you have to switch path to the active developer directory
```(xcode-select -s /Applications/Xcode-beta.app/Contents/Developer).```
View sync-control.directive.spec.ts
import { Component } from '@angular/core';
import { async, TestBed } from '@angular/core/testing';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { SyncControlDirective } from './sync-control.directive';
class FormGroupHostComponent {
formGroup = new FormGroup({
ctrl: new FormControl('')
});
View haskell-monad-laws.hs
-- Left identity
-- return x >>= f 'same as' f x
return 3 >>= (\x -> Just (x+100000))
-- Just 100003
(\x -> Just (x+100000)) 3
-- Just 100003
-- Right identity
@djleonskennedy
djleonskennedy / identity-functor-compare.hs
Created Aug 19, 2017
Compare Identity Functor Implementation
View identity-functor-compare.hs
// Typescript
class Identity {
constructor(private x: any) {
}
map(f: Function): any {
this.x = f(this.x);
}
}
const id = new Identity(2);
View regular-and-tail.js
// Recursive:
const factorial = n =>
n < 2
? 1
: n * factorial(n-1);
// Tail-recursive:
@djleonskennedy
djleonskennedy / renderSharePointList.js
Last active Apr 27, 2017
example how to render SharePoint List to App, es5
View renderSharePointList.js
requirejs.config({
paths: {
ramda: '../Scripts/vendor/ramda.min',
jquery: '../Scripts/vendor/jquery-1.12.4.min',
}
});
require(['ramda', 'jquery'], function (R, $) {
$.ajaxSetup({
@djleonskennedy
djleonskennedy / randomColorGenerator.ts
Last active Apr 18, 2017
generates random HEX color
View randomColorGenerator.ts
// TS
const randomColorGenerator = (): string =>
`#${(Math.random().toString(16) + '0000000').slice(2, 8)}`;
// ES6
const randomColorGenerator = () =>
`#${(Math.random().toString(16) + '0000000').slice(2, 8)}`;
// ES5
var randomColorGenerator = function () {
You can’t perform that action at this time.