Skip to content

Instantly share code, notes, and snippets.

View mandemeskel's full-sized avatar
💭
Trolling Gëøff Thé

Michael T. Andemeskel mandemeskel

💭
Trolling Gëøff Thé
  • Oakland, CA
View GitHub Profile
@mandemeskel
mandemeskel / RecordBtnTest.java
Created August 26, 2017 22:40
Record Espresso Test for button that becomes invisible when clicked, using Android Studio 3.
package io.enfant.maggie;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@mandemeskel
mandemeskel / RecordBtnTest.java
Created August 26, 2017 22:41
Refactored test for button that becomes invisible when clicked, using Android Studio 3.
package io.enfant.maggie;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@mandemeskel
mandemeskel / create_git_aliases.sh
Last active June 9, 2018 18:47
Bash Script to Create Git Aliases
#!/bin/bash
# https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
# 'git checkout' becomes 'git ch'
git config --global alias.ch checkout
git config --global alias.c commit
git config --global alias.s status
git config --global alias.sh stash
git config --global alias.b branch
git config --global alias.a add
git config --global alias.d diff
@mandemeskel
mandemeskel / aliases_for_common_commands
Last active June 26, 2018 00:53
Aliases for common commands: git, bundle, rails, postgres...
# git
alias gs='git status'
alias gd='git diff'
alias gco='git commit'
alias gch='git checkout'
alias gcl='git clone'
alias gpl='git pull'
alias gps='git push'
alias gf='git fetch'
alias gb='git branch'
#!/bin/sh
# get the start date and time
start_datetime=$(date '+%m_%d_%Y_%H_%M_%S')
echo "${start_datetime} - starting spider ${SPIDER_NAME} - debug: ${DEBUG}"
# go to the spider directory
cd $SPIDER_PATH
# prevent click, which pipenv relies on, from freaking out to due to lack of locale info https://click.palletsprojects.com/en/7.x/python3/
export LC_ALL=en_US.utf-8
@mandemeskel
mandemeskel / deploy.sh
Last active December 11, 2021 08:25
Deploy an app build to a remote server with SSH and SCP.
#!/bin/sh
echo "deploying..."
# bundle, minify, and package css and js - optional
# gulp build
# using SSH vs SFTP because SSH offers us rm -rf *
# which deletes directories even if they are empty
# we don't have to traverse the directory and delete files manually
@mandemeskel
mandemeskel / SimpleTypeahead.vue
Created October 5, 2021 04:32
Simple typeahead Vue component for handling local arrays.
<template>
<input
:id='unique_typeahead_id'
class='typeahead'
type='text'
>
</template>
<script>
@mandemeskel
mandemeskel / background.js
Created November 19, 2021 09:24
Using Axios' Cancel Token with Electron's IPC
// Cancel Token Docs: https://axios-http.com/docs/cancellation
// IPC Docs: https://www.electronjs.org/docs/api/ipc-main
import { ipcMain } from ‘electron’
import axios from 'axios'
const CancelToken = axios.CancelToken
let cancel
// 1. make the request
ipcMain.handle('download', async (event, ...args) => {
@mandemeskel
mandemeskel / ipc_renderer_service.ts
Created March 20, 2022 22:50
Abstraction for IPC Renderer Service to Handle Custom Error Objects
/**
* This exists because `ipcMain.handle` does not allow
* you to return rejected Promises with custom data.
* You can throw an error in `handle` but it can only
* be a string or existing error object. This means all
* the error processing logic must live in main process
* in order to figure what string or error type to throw
* in `handle`.
*
* This abstract allows us to send messages to `handle`.
@mandemeskel
mandemeskel / controller.ts
Created July 7, 2023 23:10
Separating controller from the Vue component to build archtectural boundrgy between your code and Vue.
import AppTypes from "@app/app_types"
import DataTypes from "@gateways/gateway_data_types"
import UiTypes from "@ui/ui_types"
class Controller {
public customers: DataTypes.Customer[]
public payment_methods: UiTypes.PaymentMethod[]