Skip to content

Instantly share code, notes, and snippets.

overlooking issues

Guilherme Ventura danguilherme

overlooking issues
Block or report user

Report or block danguilherme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
danguilherme / _example.ts
Created Aug 5, 2019
Send messages from Electron Renderer to Main processes, with an RxJS observable to communicate progress and completion
View _example.ts
// In Renderer
export function makeHttpRequest(url: string; method: string) {
return createIpcSender<{ url: string; method: string }, void>(
{ url, method },
// ... in browser window code ...
makeHttpRequest('', 'GET').subscribe({
danguilherme / imperative.ts
Created May 21, 2019
Imperative vs Declarative
View imperative.ts
function waitSingleWidgetInVirtualTree(
options: MacroApiOptions,
scope: ScopeItem[] = [],
callback: (
(error: Error | null, virtualTreeNode: VirtualTreeNode | null) => void
) {
let unsubscribeFromStore: (() => void) | null = null;
function stopWaitingSingleWidgetInVirtualTree() {
if (unsubscribeFromStore) {
danguilherme / index.html
Last active Jan 18, 2019
Electron Fiddle Gist - test menu shortcuts/accelerators
View index.html
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Hello World!</title>
<!-- All of the Node.js APIs are available in this renderer process. -->
<b>Node.js :</b> <script>document.write(process.versions.node)</script>

And the famous answer is: it depends. Depends on the use case.

Use case #1: Optional parameters

If the parameters are optional, you may use a single parameter (generally named options) to receive and conditionally Object.assign the default values (mostly used in pre-ES6 code, but still has its use).

jQuery uses this approach in lots of functions. Here's an example from Angular's $http.get:

// No params
// Optional params
danguilherme / symlink.bat
Last active Nov 14, 2017
Windows symlink
View symlink.bat
danguilherme /
Created Feb 29, 2016
Command Line Magic
# Create a symbolic link to conveniently run $app from the terminal:
sudo ln -s /path/to/$app /usr/local/bin/$app
danguilherme /
Last active Jul 25, 2018 — forked from tacsio/Git Configs
My git config
git config --global "Guilherme Ventura"
git config --global ""
git config --global push.default simple
git config --global color.ui true
git config --global alias.s status
git config --global alias.c checkout
git config --global checkout
danguilherme / aliases
Last active Aug 29, 2015
Alias file for Cmder
View aliases
e.=explorer .
gl=git log --oneline --all --graph --decorate $*
ls=ls --color $*
subl="C:\Program Files\Sublime Text 3\subl.exe" $*
atom="C:\Users\Guilherme\AppData\Local\atom\app-1.0.0\atom.exe" $*
eval=node -p $*
danguilherme /
Created Apr 26, 2015
Git commands cheat sheet
git branch # list all local branches
git branch -a # list all branches (local and remote)
# Clone remote branches -
git checkout -b branch-name origin/branch-name # create local branch and set it to track origin/branch-name
danguilherme / useful_scripts.user.js
Last active Aug 29, 2015
All my public user scripts
View useful_scripts.user.js
// ==UserScript==
// @name Useful Scripts
// @version 1.3.0
// @description Useful scripts for developers, to be loaded and used in every page
// @match http://**/*
// @author Guilherme Ventura
// @downloadURL
// @grant unsafeWindow
// ==/UserScript==
You can’t perform that action at this time.