Skip to content

Instantly share code, notes, and snippets.

Brian Hedberg gemfarmer

Block or report user

Report or block gemfarmer

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
gemfarmer / rspec_rails_cheetsheet.rb
Created Jun 30, 2019 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
response.should render_template(:index)
response.should redirect_to(movies_path)
View SDFlash2.ino
// This #include statement was automatically added by the Particle IDE.
#include "Particle.h"
#include "system_update.h"
int fileSize;
void poll();
void setupOpenLog(void);
void readFirmware(char *fileName);
View FlashTinkerFailing.ino
#include "Particle.h"
#include "system_update.h"
SerialDebugOutput debugOutput(9600, ALL_LEVEL);
void flashTinker(); // forward declaration
bool uploaded = false;
gemfarmer / SDFlash.ino
Last active Mar 12, 2019
Read Firmware from SD Card, Flash to P1
View SDFlash.ino
#include "Particle.h"
#include "system_update.h"
bool uploaded = false;
SerialDebugOutput debugOutput(9600, ALL_LEVEL);
// float dummyVoltage = 3.50; //This just shows to to write variables to OpenLog
// char mystr[13]; //Initialized variable to store recieved data
void setup() {

Git: How can I ignore a file that is already committed to the repo?

You have a repo and quite some developers have cloned the repo and working on it. Now you want to add a file to gitignore which is already checked-in or tracked by Git.(The file is already commited into the repo)

Below are the steps on how to ignore this file (lets say the filename is

  • Add it to .gitignore:

       $ echo "" >> .gitignore
gemfarmer /
Created Jun 18, 2017 — forked from olivierlacan/
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

gemfarmer / 18f-pride.svg
Last active Jun 1, 2017
18f pride logo
View 18f-pride.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
gemfarmer /
Last active Apr 21, 2017
Reset system sound for Hangouts

To reset the system sound for Hangouts, run (only works in OSX):

sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`
gemfarmer /
Last active Apr 17, 2017
Script to crawl a yaml list of broken urls and determine where they were moved to..

To run this script,

  1. Add crawl_broken_urls.rb to you directory
  2. At the same directory level, add a broken_links.yml.
  3. Then run ruby crawl_broken_urls.rb
gemfarmer /
Last active Mar 23, 2017
Bash script that kills a process


This script will kill the pid process that is responsible for keeping a port open. Use as follows to kill the process that corresponds to a given port:

./killport [PORT]

If the command killport is not recognized, make it executable:

You can’t perform that action at this time.