Skip to content

Instantly share code, notes, and snippets.

View rodush's full-sized avatar
👷‍♂️
building web applications

Roman Dushko rodush

👷‍♂️
building web applications
View GitHub Profile
@rodush
rodush / enzyme_render_diffs.md
Created April 25, 2018 07:53 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@rodush
rodush / protips.js
Created March 29, 2018 23:38 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@rodush
rodush / gist:d5ee54b44958f8eb06d1ade4dc701bf1
Created January 18, 2018 13:07
AWS S3 Cloudfront deployment Gulp Task
gulp.task('deploy', function(cb) {
var publisher = $.awspublish.create(aws);
var headers = {'Cache-Control': 'max-age=315360000, no-transform, public'};
return gulp.src('dist/**')
.pipe($.awspublish.gzip())
.pipe(publisher.publish(headers))
.pipe(publisher.cache())
.pipe($.awspublish.reporter())
.pipe($.cloudfront(aws))
.on('end', function() {
<script name="tophatvariables">
email="mostafa@tophat.com"
username="mostafaprof"
userFirstName="Mostafa"
userLastName="Younis"
</script>
<script type='text/javascript' src='https://c.la4-c2-was.salesforceliveagent.com/content/g/js/37.0/deployment.js'></script>
@rodush
rodush / object-fit-testing.html
Created June 2, 2017 12:55
Playing with object-fit and a bit of transformation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Object-Fit CSS test</title>
<style type="text/css">
body {
font-family: Verdana, Sans-Serif, Arial, Tahoma;
font-size: 14px;
@rodush
rodush / ngrxintro.md
Created March 7, 2017 22:59 — forked from btroncone/ngrxintro.md
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

@rodush
rodush / golang-tls.md
Created January 31, 2017 14:56 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@rodush
rodush / complex-inheritance.php
Created December 8, 2016 09:31
Example of how to get correct static instance with Trait and class extension
<?php
trait InstanceBuilderTrait
{
/**
* Instantiates object of type $self and populates from input
*
* @static
* @access public
* @param array $input Empty array by default
@rodush
rodush / golang_tree
Created June 23, 2016 08:23
Go tour - tree (cheated, spied on Walk implementation)
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@rodush
rodush / Go lang tour - rot13
Last active June 17, 2016 11:27
Go lang tour - rot13 (cheated to see how to deal with streams and stolen the idea of ro13)
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader