Skip to content

Instantly share code, notes, and snippets.

View iamdanthedev's full-sized avatar
😃

Dan The Dev iamdanthedev

😃
  • Bonliva AB
  • Stockholm/Kiev
View GitHub Profile
@vabka
vabka / Main.cs
Created November 28, 2019 14:42
Как скачать файл при помощи puppeteersharp, чтобы он скачался в нужную папку
using System;
using System.IO;
using System.Threading.Tasks;
using PuppeteerSharp;
namespace pptrTest
{
class Program
{
static async Task Main()
@saschwarz
saschwarz / commands.js
Last active August 31, 2022 07:16
Automated Azure AD login and session token capture to json file for reading by Cypress commands. Heavily inspired by https://gist.github.com/pieterdv/82773fbe036719479d76ab0a4985dc3b
const API = Cypress.env('API');
const headers = {
Authorization: '',
};
Cypress.Commands.add('loginUser', () => {
return cy.readFile('aad-tokens.json')
.then(creds => {
// set auth headers so test setup calls are authorized
@cdelgadob
cdelgadob / cleanTypenameFieldLink.ts
Last active August 9, 2022 18:20
This is a custom ApolloLink which we use to clean the "__typename" field to prevent sending it to the GraphQL server. omitDeep based on this gist: https://gist.github.com/Billy-/d94b65998501736bfe6521eadc1ab538
@Billy-
Billy- / README.md
Last active April 15, 2019 16:48
deep version of lodash omit

Inspired by this issue on the lodash repo, asking for deep functionality for omit.

Note that there are plans to remove omit entirely in lodash v5... and props to this comment (and the one it quotes) in response to that 😆.

@bvis
bvis / Jenkinsfile
Last active January 3, 2023 20:45
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@jacob-beltran
jacob-beltran / requestAnimationFrame.js
Last active April 17, 2020 04:05
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
@jbaxleyiii
jbaxleyiii / test.js
Created November 15, 2016 19:43
react-apollo testing
import { Component } from "react";
import { print } from "graphql-tag/printer";
import { graphql } from "react-apollo";
import { MockedProvider } from "react-apollo/test-utils";
import { addTypenameToDocument } from "apollo-client/queries/queryTransform";
import { mount } from "enzyme";
import { withSavedPayments, SAVED_ACCTS_QUERY } from "../";
@newyankeecodeshop
newyankeecodeshop / ServingES6.md
Last active June 19, 2021 07:36
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@flipace
flipace / replacePropertyValue.js
Created November 29, 2015 19:46
Deep replace a value within an object or array (using lodash or underscore)
/**
* Deep search and replaces the given property value "prevVal" with "newVal"
* @param {any} prevVal [description]
* @param {any} newVal [description]
* @param {object|array} object the original object or array in which the values should be replaced
* @return {object|array} the new object or array
*/
function replacePropertyValue(prevVal, newVal, object) {
const newObject = _.clone(object);