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 / 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 / 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....
#!/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
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;
@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>