Skip to content

Instantly share code, notes, and snippets.

View bchewy's full-sized avatar
:shipit:
probably on @codex or @cursor

Brian Chew bchewy

:shipit:
probably on @codex or @cursor
View GitHub Profile
@bchewy
bchewy / _devdebug.html.erb
Last active January 5, 2019 14:08
RoR Developer's Debug Menu for JSON data.
<!--Developer's debug menu at bottom of index page-->
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Developer Debug Menu (click to toggle)
</button>
</h5>
</div>
package com.danielappdev.fosterships;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
#!/bin/bash
# NAME: full-backup
# PATH: $HOME/bin
# DESC: Full system backup - must call with SUDO
# DATE: July 16, 2017. Modified July 26, 2017.
apt autoclean # reduces size of /var/cache/apt/archives
@bchewy
bchewy / cheatsheet.md
Last active July 31, 2019 07:09
RSpecs cheatsheet

RSpec Cheatshet

This gist will give you a quick insight on how you can write unit tests with rspec!

Mini-topics covered:

  • Defining test cases
  • Writing your own factory
  • Mocking methods/classes
  • Expected test results;
  • Writing controller specs
  • Before you do....
@bchewy
bchewy / rsync_tmbackup.sh
Created August 10, 2019 07:52
Rsync Backup - taken from rsync tmbackup
#!/usr/bin/env bash
APPNAME=$(basename $0 | sed "s/\.sh$//")
# -----------------------------------------------------------------------------
# Log functions
# -----------------------------------------------------------------------------
fn_log_info() { echo "$APPNAME: $1"; }
fn_log_warn() { echo "$APPNAME: [WARNING] $1" 1>&2; }
@bchewy
bchewy / readme.md
Last active November 13, 2019 08:30
writing selenium test cases with pytest on Django.

Writing selenium test cases with pytest on Django.

This document is not written in any particular order. It is ordered in sections

  • Tips for using the Selenium WebDriver
  • Using the pytest command on the CLI
  • Configurating Pytest for Django

Follow at your own risk!

Tips for using the Selenium WebDriver

  1. Make sure to use driver methods to see where you're at!
@bchewy
bchewy / .zshrc
Last active November 20, 2019 06:12
### ZShell
# Brian's Config for ZShell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
@bchewy
bchewy / gist:be417b1ddb3edd71cf76dc24a0172af8
Last active December 13, 2019 14:45
Installing Docker on Ubuntu 19.x
# Simple script to install docker - you need to check some values to enable this to work
sudo apt update
sudo apt remove docker docker-engine docker.io
sudo apt install docker.io # return Y to install
sudo systemctl start docker
sudo systemctl enable docker
docker --version # Checks what docker version
@bchewy
bchewy / gist:a97ac5279fcd2bd25bf182a4bb9e5db4
Created December 13, 2019 14:39
Installing NodeJS 12.x on Ubuntu 19.x
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs