Skip to content

Instantly share code, notes, and snippets.

View qetr1ck-op's full-sized avatar
💫

Orest Prystayko qetr1ck-op

💫
View GitHub Profile
@ronkot
ronkot / rastas-promise.js
Last active July 25, 2023 05:42
Simple Promise implementation
const PENDING = 1;
const RESOLVED = 2;
const REJECTED = 3;
const callLater = (fn) => setTimeout(fn, 0);
class Promise {
constructor(initPromiseFn) {
this._state = PENDING;
this._value = undefined;
import { Directive, ElementRef, forwardRef, Input, Renderer2 } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { merge } from 'rxjs/observable/merge';
import { timer } from 'rxjs/observable/timer';
import { Subscription } from 'rxjs/Subscription';
export const DEFAULT_VALUE_ACCESSOR : any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NgControlOptionsDirective),
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active November 16, 2024 16:15
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@sadikaya
sadikaya / git-bash-in-webstorm.md
Last active September 23, 2024 17:50
git bash inside Webstorm terminal

Go to File -> Settings -> Tools -> Terminal and change Shell path based on the the installed git version.

for 64bit:

"C:\Program Files\Git\bin\sh.exe" --login -i

for 32bit:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
@btroncone
btroncone / ngrxintro.md
Last active November 5, 2024 12:20
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

(function(self) {
'use strict';
if (self.fetch) {
return
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () =&gt; x) {
@darrenscerri
darrenscerri / Middleware.js
Last active July 11, 2023 02:59
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});
echo %USERPROFILE%
C:\Users\Orest
@oharsta
oharsta / AngularNonLatin1
Created January 31, 2015 06:15
Angular Validate non latin-1 chars
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form latin-1 input validation</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>
<script type="text/javascript">
(function(angular) {
'use strict';