Skip to content

Instantly share code, notes, and snippets.

View ben-gy's full-sized avatar
🏠
Working from home

Ben Richardson ben-gy

🏠
Working from home
View GitHub Profile
# Get all users' emails that signed in today
User.where(["last_sign_in_at > ?", 2.days.ago]).map(&:email)
## Installing nokigiri
### on Mavericks
brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install
### on Yosemite
brew install libxml2
bundle config build.nokogiri --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
@ben-gy
ben-gy / devmethod.md
Last active January 17, 2016 04:35
How we develop as fast as a startup within the walls of a large corporate

PwC Shipyard Development Methodology

In Shipyard we try to minimise as much project management as possible. This is how we keep our team lean and nimble.

Tools

GitHub is our base of operations in which we've integrated some apps to help us run lean whilst delivering high quality code. Here are our integrations:

  • Circle CI for continuous development and deployment
  • Heroku for hosting (automatic deployments from master to staging - US & EU)

Amazon Web Services

This document provides a succinct description of product offered by Amazon Web Services (AWS). It's a working progress.


Compute

EC2

Virtual Servers in the Cloud

Captain Harrison is busy exploring Nifty's Loch. Unfortunately - he keeps getting lost. You decide to help him by building a positioning system that can be installed on his ship (The SS Reckoning).
Luckily, Nifty's Loch is a a perfect square, 10 units high and 10 units wide. With the docks positioned at (0,0).
As the ship moves or changes direction, it will send messages to your positioning system. These relate to the ship moving forwards or changing direction. For example:
F 4 - This will move the ship forward four units, not changing the direction the ship is pointing in. B 2 - This will move the ship backwards two units, not changing the direction the ship is pointing in. L 2 - This will rotate the ship 90 degrees left twice. L 2 then makes the ship point in the opposite direction, while L 4 does a complete 360 and point in the same direction. 'R 3' - This will turn the ship right 90 degrees, 3 times.
When the program receives the REPORT command, it should give it's current position, as well as the com
@ben-gy
ben-gy / gist:633bacb1be7255b217a5
Created February 10, 2016 07:05
Programming challenge freighter ship
You have been hired by a late 18th century naval shipping company who transport large quantities of gold.
They company has multiple ships, all capable of carry different amounts of gold.
The current shipping coordinator, known only as the Seawolf, has realised that their current shipping methods are inefficient and wishes to have a system to reduce the required trips for a given weight of gold.
Your task is to create a system that for a given set of ships, can transport a quantity of gold with the fewest possible trips. Each ship may only carry it's exact quantity. The company has multiple of each ship class.
For instance, with the following ship classes:
  1. Open terminal
  2. Drop the folder where you want to keep the script in the terminal window
  3. Type "touch backup_script" and hit enter

Now, every time you want to run a backup, open your terminal and drop the script into the window and hit enter.

nb// the folder locations are hardcoded and it's not automatic (run it manually each day)

#!/bin/bash
meta[name="mobile-web-app-capable" content="yes"]
meta[name="apple-mobile-web-app-capable" content="yes"]
meta[name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"]
meta[http-equiv="X-UA-Compatible" content="IE=edge"]
meta[name="apple-mobile-web-app-status-bar-style" content="black"]
meta[name="format-detection" content="telephone=no"]

My Gemfile (working version)

I try and keep a very verbose Rails Gemfile so any new developers working on my startup can very quickly understand what gems are installed, why they're installed, and the value they add to the project.

I also use my Gemfile as a bit of a todo list when I find smarter or faster gems, or just new cool things that I want to try out. I thought I'd release a copy of what it looks like if you're interested.

source 'https://rubygems.org'
ruby '2.3.1'
import string
import requests
from bs4 import BeautifulSoup
import json
import glob
from multiprocessing import Pool
import sys
API_KEY = None # your api key here
CRUNCHBASE_COMPANY_API = "http://api.crunchbase.com/v/1/company/%s.js?api_key=%s"