Skip to content

Instantly share code, notes, and snippets.

View gjrevans's full-sized avatar
🏠
Working from home

Gordon Evans gjrevans

🏠
Working from home
View GitHub Profile
@gjrevans
gjrevans / export_git_logs
Last active October 6, 2016 16:23
Export a CSV of all git logs for a given repository
git log --all --pretty=format:'%H||%h||%t||%p||%an||%ae||%ad||%cn||%ce||%cd||%d||%s'>[file_name_wo_brackets].csv
@gjrevans
gjrevans / css-rules.md
Last active November 21, 2017 19:44
An overview of the CSS rules that I push for in my development practices

CSS RULES FOR GOOD DEVELOPERS

Writing consistent and readable CSS that will scale well is a challenging process. Especially when the style sheets are getting larger, more complex, and harder to maintain. I have created this set of rules to simplify decision making and maintainability when developing new projects. The following rules assume we are using CSS preprocesser like SASS (.scss) to simplify our lives.

GENERAL RULES

As a general rule of thumb, code should be as modular as possible. Don't be afraid to break CSS into seperate files where it makes sense.

Installing Ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@gjrevans
gjrevans / intercom.js
Last active January 24, 2023 13:46
Customize the placement, size, color of the intercom launcher
// Intercom
//
// Inject styles into Intercom iframe
var stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = 'path_to_file.css';
// Wait for the iframe to become ready (max 30 seconds)
var timeout = setTimeout(function() {
clearInterval(interval);
/* Intercom Fix */
/* If you're here for the fix, you can ignore this file, this is for my own personal implementation */
@media (max-width: 767px) {
#intercom-container iframe.intercom-launcher-frame {
bottom: 4rem !important;
right: 1rem !important;
}
}
@gjrevans
gjrevans / run_phoenix.ex
Last active August 15, 2017 20:45
Run Phoenix in Production
# Initial setup
$ mix deps.get --only prod
$ MIX_ENV=prod mix compile
# Compile assets
$ brunch build --production
$ MIX_ENV=prod mix phoenix.digest
# Custom tasks (like DB migrations)
$ MIX_ENV=prod mix ecto.migrate
/* Identify the current logged-in user with Segment.io */
segment_user = {
first_name: "<%= @current_user.first_name %>",
last_name: "<%= @current_user.last_name %>",
email: "<%= @current_user.email %>",
date_of_birth: "<%= @current_user.birthdate %>"
};
/* Add a company if the user is part of a group */
<%= if assigns[:group] do %>
/**
* JS ScrollFix
* Fixes an element to the top of a page at a certain scroll height
* *
* @author Avail
* @copyright Copyright (c) 2017
* @since Version 1.0.0
*
*/
<table cellpadding="0" cellspacing="0" class="sc-gPEVay eQYmiW" style="vertical-align: -webkit-baseline-middle; font-size: medium; font-family: Tahoma;">
<tbody>
<tr>
<td>
<table cellpadding="0" cellspacing="0" class="sc-gPEVay eQYmiW" style="vertical-align: -webkit-baseline-middle; font-size: medium; font-family: Tahoma;">
<tbody>
<tr>
<td width="150" style="vertical-align: middle;"><span class="sc-kgAjT cuzzPp" style="margin-right: 20px; display: block;"><img src="https://imgur.com/jIuAQBZ.png" role="presentation" width="130" class="sc-cHGsZl bHiaRe" style="max-width: 130px;"></span></td>
<td style="vertical-align: middle;">
<!-- REPLACE ME -->
#!/bin/sh
# Install Python 3
echo "Installing Python 3..."
sudo apt install python3-pip
echo
# Install Python 3
echo "Installing PY Serial Monitor..."
python -m pip install pyserial