Skip to content

Instantly share code, notes, and snippets.

View felipegmarques's full-sized avatar

Felipe Gonçalves Marques felipegmarques

  • São Paulo – Brazil
View GitHub Profile
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@felipegmarques
felipegmarques / s3-edit.clj
Created June 7, 2020 11:30
Kubectl provides a nice feature for editing some of its objects. You can type `kubectl edit deployment my-cool-deployment` and it will download the deployment description, allow you do edit it on VI and once you save it, it will update the deployment. I would like to have a similar experience with s3 files instead of having to copy, edit and cop…
(ns s3-edit
(:require [clojure.string :as str]
[clojure.java.shell :as sh]
[clojure.java.io :as io])
(:import (java.util UUID)))
(defn s3-edit [s3-path]
(let [temp-secrets-file-name (str "./temp-secrets-" (UUID/randomUUID) ".json")]
(sh/sh "aws" "s3" "cp" s3-path temp-secrets-file-name)
(->
interface UserFilter {
status: string;
}
const getUsersEmail = (filter: UserFilter): string[] => {
// some code
const status = filter.status;
const filteredUsers = users.filter(({ status }) => status === filter.status);
const emails = filteredUsers.map(({ email }) => email);
return emails;
interface UserFilter {
status: string;
}
interface User {
name: string;
email: string;
status: string;
}
const users = fetchUsers('5', { userStatus: 'active' });
// Ideally the status should be an enum or a constant instead of replicating the string everyplace.
@felipegmarques
felipegmarques / untyped-fetch-user.ts
Last active June 30, 2018 07:25
Untyped method example
const fetchUsers = (page: any, filter: any): any[] => {
// more code
const offset = page * pageSize;
// some code
const status = filter.status;
// more code
return users;
}
const getUser = (id: any): any {
// some code
}
// vs
interface User {
id: string;
name: string;
this.viewContainerRef.createEmbeddedView(this.templateRef, this.context);
- "let val = val" -> let-val="val"
- "let hero of heros" -> let-hero and [ngForOf]="hero"
- "trackBy: trackById" -> [ngForTrackBy]="trackById
<autocomplete
*sWAutocomplete="let options = options; let onSearchChange = onSearchChange"
[options]="options"
[placeholder]="'Search for Star Wars characters'"
(searchTermChange)="onSearchChange($event)"
(selectItem)="onSelectItem($event)">
</autocomplete>
<!-- is transformed in -->