Skip to content

Instantly share code, notes, and snippets.

@titenkov
titenkov / vim-visual-blocks.md
Last active April 10, 2024 18:06
Use Vim visual blocks during interactive git rebase

Sometimes, when rebasing interactively with git, we need to squash a sequence of commits in a branch.

For example, we need to transform this:

pick 0253dc894f bumped
pick 5a1e86933c remove dependency
pick bffoffb395 memberships rpc resource
pick 222fabf5e0 rpc membership service
pick 726a2f9a10 remove crypto logic
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@mrichman
mrichman / osx_bootstrap.sh
Last active February 5, 2024 13:38
Bootstrap script for setting up a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
import * as admin from 'firebase-admin'
import * as fft from 'firebase-functions-test'
const ft = fft()
import * as sinon from 'sinon'
import { makeUppercase, addMessage } from './function'
describe('order', () => {
describe('makeUpperCase', () => {
it('should upper case input and write it to /uppercase', async () => {
const fakeSnaphost = ft.firestore.makeDocumentSnapshot({
@mbrochh
mbrochh / some_test.js
Last active February 8, 2024 13:02
Controlling a Stripe payent popup with Cypress.io
// for this to work you need to set `"chromeWebSecurity": false` in cypress.json
describe('Make Stripe Payment', function() {
before(function() {
cy.visit('http://localhost:3000/en/stripe/checkout/')
Cypress.Cookies.preserveOnce('sessionid')
})
it('should enter credit card details and finalise payment', function() {
cy.get('[data-test="button-FormStripeCart-PayWithCreditCard"]').click()
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 1, 2024 09:43 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@beaufortfrancois
beaufortfrancois / finally.js
Created October 10, 2017 08:34
Promise.prototype.finally vs try/catch/finally with Async/Await
// Promise.prototype.finally
fetch('http://foo.bar')
.then(response => console.log(response))
.catch(error => console.log(error))
.finally(_ => console.log('finally'))
// try/catch/finally with Async/Await
@xonlly
xonlly / jsconfig.json
Created September 7, 2017 14:09
jsconfig for react jsx project
{
"compilerOptions": {
"jsx": "react",
// This must be specified if "paths" is set
"baseUrl": ".",
// Relative to "baseUrl"
"paths": {
// exemple: "*": ["*", "web_modules/*", "web_modules/shared/*", "test/*"]
}
}
@sdorra
sdorra / Jenkinsfile
Created October 23, 2016 20:05
Docker jenkins pipeline example
node('docker') {
stage 'start database'
docker.image('redis:3.0.7-alpine').withRun { c ->
def ip = hostIp(c)
stage 'client set'
docker.image('redis:3.0.7-alpine').inside {
sh "redis-cli -h ${ip} set test 123"
@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved