Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gemfarmer's full-sized avatar

Brian Hedberg gemfarmer

View GitHub Profile
@gemfarmer
gemfarmer / rspec_rails_cheetsheet.rb
Created June 30, 2019 21:59 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@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
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
// 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);
#include "Particle.h"
#include "system_update.h"
SerialDebugOutput debugOutput(9600, ALL_LEVEL);
void flashTinker(); // forward declaration
bool uploaded = false;
@gemfarmer
gemfarmer / SDFlash.ino
Last active March 12, 2019 16:10
Read Firmware from SD Card, Flash to P1
#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 config.py):

  • Add it to .gitignore:

$ echo "config.py" >> .gitignore

@gemfarmer
gemfarmer / jekyll-oembed
Created February 22, 2017 19:11
An OEmbed liquid tag for Jekyll
##
# OEmbed Liquid Tag for Jekyll
# - requires https://github.com/judofyr/ruby-oembed/
#
# Copyright 2011 Tammo van Lessen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@gemfarmer
gemfarmer / migrate_postgresql_database.md
Created June 18, 2017 04:15 — forked from olivierlacan/migrate_postgresql_database.md
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
gemfarmer / 18f-pride.svg
Last active June 1, 2017 16:57
18f pride logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gemfarmer
gemfarmer / reset_audio.md
Last active April 21, 2017 17:32
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
gemfarmer / README.md
Last active April 17, 2017 19:56
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